SCSI_ALLOC_CONSISTENT_BUF(9F) | Kernel Functions for Drivers | SCSI_ALLOC_CONSISTENT_BUF(9F) |
#include <sys/scsi/scsi.h> struct buf *scsi_alloc_consistent_buf(structscsi_address*ap, struct buf *bp, size_t datalen, uint_t bflags, int (*callback)(caddr_t), caddr_t arg);
bp
datalen
bflags
callback
arg
For buffers allocated via scsi_alloc_consistent_buf(), and marked with the PKT_CONSISTENT flag via scsi_init_pkt(9F), the HBA driver must ensure that the data transfer for the command is correctly synchronized before the target driver's command completion callback is performed.
If bp is NULL, a new buffer header will be allocated using getrbuf(9F). In addition, if datalen is non-zero, a new buffer will be allocated using ddi_dma_mem_alloc(9F).
callback indicates what the allocator routines should do when direct memory access (DMA) resources are not available; the valid values are:
NULL_FUNC
SLEEP_FUNC
Other Values
bp = scsi_alloc_consistent_buf(&devp->sd_address, NULL, SENSE_LENGTH, B_READ, SLEEP_FUNC, NULL); rqpkt = scsi_init_pkt(&devp->sd_address, NULL, bp, CDB_GROUP0, 1, 0, PKT_CONSISTENT, SLEEP_FUNC, NULL);
Example 2 Allocate an inquiry packet with consistent DMA resources attached.
bp = scsi_alloc_consistent_buf(&devp->sd_address, NULL, SUN_INQSIZE, B_READ, canwait, NULL); if (bp) { pkt = scsi_init_pkt(&devp->sd_address, NULL, bp, CDB_GROUP0, 1, PP_LEN, PKT_CONSISTENT, canwait, NULL); }
Writing Device Drivers
January 16, 2006 | OmniOS |