2.5.7 SCSI Drivers’ Device Objects

Figure 2.25 illustrates a sample set of device objects that represent peripheral devices on the SCSI bus shown previously in Figure 2.17. The system-supplied SCSI port and class drivers and the toaster class driver shown in Figure 2.18 would create these device objects by calling an I/O support routine.

Figure 2.25 SCSI Device Objects

The NT SCSI port driver creates a device object representing the HBA within the system. In machines with more than one SCSI HBA, the NT port driver creates a separate device object for each HBA. To any NT SCSI class driver, these HBA-specific device objects appear to represent separate, HBA-specific, instantiations of the NT SCSI port driver.

When it loads, each NT SCSI class driver determines which SCSI bus has connected devices of its type by accessing the SCSI inquiry data collected by the NT SCSI port driver. Each SCSI class driver chains itself over one or more HBA-specific NT port driver instantiations, depending on which HBAs have devices of that class connected on their buses.

Windows NT defines a class/port interface between any NT SCSI class driver and the NT port driver that insulates class drivers from having to deal with HBA-specific hardware peculiarities. After a class driver locates its devices, that driver’s SCSI requests are sent as IRPs containing system-defined SCSI request blocks (SRBs) to the appropriate instantiation(s) of the NT port driver.

Each NT SCSI class driver shown previously in Figure 2.18 creates at least one device object representing its physical device connected to a corresponding logical unit on the SCSI bus.

Like the “AT” disk driver (see Figure 2.23), the SCSI disk class driver also creates a logical device object to represent each additional partition on its disks.

If a new SCSI filter driver is added to the system, it must create one or more device objects to be attached to the corresponding class driver’s device object(s).

As Figure 2.25 shows, adding a SCSI device of a new class to an NT machine requires its driver to create at least one device object to represent the physical device it controls. Possibly the new class driver must create more than one device object, depending on the nature of the (toaster) device. Such a driver must be implemented as an NT SCSI class driver.

For more information about the NT SCSI class/port interface and requirements for SCSI class and filter drivers, see Appendix A, and see also the Kernel-Mode Driver Reference.

The NT SCSI port driver also sets up any HBA-specific interrupt object(s), handles DMA, and, in effect, insulates each HBA-specific miniport driver from having to know anything about NT objects. SCSI miniport drivers interact only with their respective HBAs and with the OS-dependent port driver.