SCSI_DEVICE(9S) | Data Structures for Drivers | SCSI_DEVICE(9S) |
#include <sys/scsi/scsi.h>
struct scsi_address sd_address; /* Routing info. */ dev_info_t *sd_dev; /* Cross-ref. to */ /* dev_info_t */ kmutex_t sd_mutex; /* Mutex for this dev. */ struct scsi_inquiry *sd_inq; /* scsi_inquiry data struc. */ struct scsi_extended_sense *sd_sense; /* Optional request */ /* sense buffer ptr */ caddr_t sd_private; /* Target drivers private data */
sd_address contains the routing information that the target driver normally copies into a scsi_pkt(9S) structure using the collection of makecom(9F) functions. The SCSA library routines use this information to determine which host adapter, SCSI bus, and target/logical unit number (lun) a command is intended for. This structure is initialized by the host adapter driver.
sd_dev is a pointer to the corresponding dev_info structure. This pointer is initialized by the host adapter driver.
sd_mutex is a mutual exclusion lock for this device. It is used to serialize access to a device. The host adapter driver initializes this mutex. See mutex(9F).
sd_inq is initially NULL (zero). After executing scsi_probe(9F), this field contains the inquiry data associated with the particular device.
sd_sense is initially NULL (zero). If the target driver wants to use this field for storing REQUEST SENSE data, it should allocate an scsi_extended_sense(9S) buffer and set this field to the address of this buffer.
sd_private is reserved for the use of target drivers and should generally be used to point to target specific data structures.
Writing Device Drivers
February 19, 1993 | OmniOS |