A.1.3.1    SCSI Class Driver’s GetInquiryData Routine

To find its device(s), the class driver either calls a GetInquiryData routine or implements the same functionality in its DriverEntry routine. A GetInquiryData routine allocates an INQUIRY_DATA_SIZE buffer for SCSI_ADAPTER_BUS_INFO-type data.

Next, it allocates an IRP with IoBuildDeviceIoControlRequest, sets the port driver’s I/O stack location up with the I/O control code IOCTL_SCSI_GET_INQUIRY_DATA, and passes the IRP on to the SCSI port driver with IoCallDriver.

The class driver uses the InquiryDataOffset in the SCSI_ADAPTER_BUS_INFO buffer to inspect the SCSI inquiry data and find device(s) of its type.

Like any other kernel-mode driver, a SCSI class driver must set up a device object to represent each physical, logical, and/or virtual device for which it handles I/O requests. The class driver also must establish a claim on each of the physical devices for which it creates a device object with IoCreateDevice.

Subsequently loaded drivers for the same type of device can determine whether a particular SCSI peripheral has already been claimed by inspecting the inquiry data for each HBA and SCSI bus in the machine. A class driver must not attempt to claim an already claimed device.

For more information about the SCSI_ADAPTER_BUS_INFO structure and IOCTLs supported by the Windows NT SCSI port driver, see the Kernel-Mode Driver Reference.