DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Writing a SCSI host adapter driver

_entry routine

The _entry(D2osdi) routine of the Sram driver is coded as a switch statement with one case for each command that is documented on the scsi_io_req(D4osdi) manual page.

Notice how the complex processing associated with the SCSI_SEND_NC and SCSI_SG_NC case statements is coded in the process_req( ) and process_sg_reg( ) subroutines. Comparing those two subroutines illustrates how to code this functionality with and without scatter/gather capabilities.

Note how each case has a printf(D3oddi) statement that is commented out. This is a primitive but effective debugging trick; when compiling the driver for debugging, these statements can be activated to track the progress of the driver execution. Use the cmn_err(D3oddi) function rather than the printf(D3oddi) function for messages that print out of a production driver. By using printf( ) functions for debugging, it is easy to find them in the code to comment them in or out.


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