Writing a SCSI peripheral driver
This chapter summarizes how to write
each of the entry-point routines in a
SCSI peripheral driver.
This material should be read in conjunction with
the sample SCSI peripheral driver
supplied in the ./scsi/eve/Sflp directory
on the AHDK CD-ROM.
This chapter uses ``xx_'' to represent the
SCSI peripheral driver's prefix.
Your driver should replace ``xx_'' with
the prefix defined for your driver.
The routines discussed are:
-
``xxinit and xxinit2''
registers the device and initializes
data structures required for the SCSI peripheral driver.
-
``open''
checks errors and permissions
and completes initialization for the peripheral.
-
``read and write''
call the xxstrategy
routine directly or through the kernel's
physio(K) routine.
-
``strategy''
builds and queues a request
by sending it to the host adapter driver
via the configured xx_entry routine,
taking care to check for possible errors.
This request contains a pointer to
an interrupt handler routine to call at interrupt time.
-
``intr''
At interrupt time, the SCSI host adapter
driver handles the interrupt,
determines the SCSI peripheral
that caused the interrupt,
and passes the interrupt
along with appropriate data structure pointers
to the SCSI peripheral driver's
intr(D2osdi)
routine, also called the callback function.
This routine then processes the information
and passes it back to the calling user process.
SCSI peripheral drivers must use
the standard structures required by the kernel
for that type of device.
``Notes about drivers for disk devices''
provides notes about the requirements for disk devices.
© 2005 The SCO Group, Inc. All rights reserved.