Introduction to SCSI drivers

Completing the I/O operation

When the data transfer is completed, the following steps are taken:

SCSI host adapter hardware
announces that the I/O operation is complete. This can be done with an interrupt (if the host adapter hardware generates interrupts and the host adapter driver includes an interrupt handler), or the hardware can set a flag that is examined periodically by the driver's poll( ) routine.

In either case, the event that wakes up the adapter driver is communicated through the Programmable Interrupt Controller (PIC) which arbitrates interrupts to the CPU. Polling is initiated when the PIC generates the clock interrupt; the clock interrupt handling routine then calls poll( ) routines that have been registered by various drivers.

The following discussion assumes hardware for SCSI host adapters and SCSI peripheral devices that generate interrupts and whose drivers are coded with interrupt handlers. The details are much the same for devices that use poll( ) to announce I/O completion except that it is invoked indirectly by the clock interrupt routine.

Host adapter's intr(D2osdi) routine
look at the io_intr member of the REQ_IO structure which identifies the peripheral driver's intr( ) routine. For example:
In this case, the peripheral driver's interrupt handling routine is intr( ).

The host adapter's intr( ) routine then calls the peripheral driver's intr( ) routine to notify the peripheral driver that the I/O operation is complete.

Peripheral driver's intr( ) routine
issue a wakeup(D3oddi) call to unblock the user process and, if appropriate, start the next I/O operation.

Host adapter's intr( ) routine
start the next io_req if one is queued.

© 2005 The SCO Group, Inc. All rights reserved.