Writing Device Drivers

Transporting a Command

After creating and filling in the scsi_pkt(9S) structure, the final step is to hand it to the host bus adapter driver using scsi_transport(9F):

	if (scsi_transport(pkt) != TRAN_ACCEPT) {
 		bp->b_resid = bp->b_bcount;
 		bioerror(bp, EIO);

The other return values from scsi_transport(9F) are:

Caution - Caution -

The mutex sd_mutex in the scsi_device(9S) structure must not be held across a call to scsi_transport(9F).

If scsi_transport(9F) returns TRAN_ACCEPT, the packet is the responsibility of the host bus adapter driver and should not be accessed by the target driver until the command completion routine is called.

Synchronous scsi_transport(9F)

If FLAG_NOINTR is set in the packet, then scsi_transport(9F) will not return until the command is complete, and no callback will be performed.

Note -

FLAG_NOINTR should never be used in interrupt context.