Adapter and Device Driver Intercommunication
This section describes the communication between the adapter and the device drivers through the various routines.
In a typical request to the device driver, a call is first made to the device driver's strategy routine, which takes care of any necessary queuing. The device driver's strategy routine then calls the device driver's start routine, which fills in the scsi_buf structure and calls the adapter driver's strategy routine through the devstrat kernel service.
The adapter driver's strategy routine validates all of the information contained in the scsi_buf structure and also performs any necessary queuing of the transaction request. If no queuing is necessary, the adapter driver's start subroutine is called.
When an interrupt occurs, adapter driver interrupt routine fills in the status_validity field and the appropriate scsi_status or adapter_status field of the scsi_buf structure. The bufstruct.b_resid field is also filled in with the value of nontransferred bytes. The adapter driver's interrupt routine then passes this newly filled in scsi_buf structure to the iodone kernel service, which then signals the device driver's iodone subroutine. The adapter driver's start routine is also called from the interrupt routine to process any additional transactions on the queue.
The device driver's iodone routine should then process all of the applicable fields in the queued scsi_buf structure for any errors and attempt error recovery if necessary. The device driver should then dequeue the scsi_buf structure and then pass a pointer to the structure back to the iodone kernel service so that it can notify the originator of the request.