20.1.4 Implementing driver binding protocol

A SCSI host controller driver follows the UEFI driver model, so the image entry point of a SCSI host controller driver installs the Driver Binding Protocol instance on the image handle. All three of the services in the Driver Binding Protocol-Supported(), Start(), and Stop()-must be implemented by a SCSI host controller driver. Supported()

The Supported() function tests to see if a given controller handle is SCSI adapter the driver knows how to manage. In this function, a SCSI host controller driver checks to see if the EFI_DEVICE_PATH_PROTOCOL and EFI_PCI_IO_PROTOCOL are present to ensure the handle that is passed in represents a PCI device. In addition, a SCSI host controller driver checks the ClassCode, VendorId, and DeviceId from the device's PCI configuration header to see if it is a conformant SCSI adapter that can be managed by the SCSI host controller driver. Start()

The Start() function tells the SCSI host controller driver to start managing the SCSI host controller. In this function, a single channel SCSI host controller driver uses chipspecific knowledge to perform the following tasks:
  • Initialize the SCSI host controller.
  • Enable the PCI device.
  • Allocate resources.
  • Construct data structures for the driver to use.
  • Install the Extended SCSI Pass Thru Protocol instance on the same handle that
    has the PCI I/O Protocol.
If the SCSI adapter is a multi-channel adapter, then the driver should also do the following:
  • Enumerate the SCSI channels that are supported by the SCSI host controller.
  • Create child handles for each physical SCSI channel.
  • Append the device path for each channel handle.
  • Install the Device Path Protocol and Extended SCSI Pass Thru Protocol on
    every newly created channel handle. Stop()

The Stop() function performs the opposite operations as Start(). Generally speaking, a SCSI driver is required to do the following:
  • Disable the SCSI adapter.
  • Release all resources that were allocated for this driver.
  • Close the protocol instances that were opened in the Start()function.
  • Uninstall the protocol interfaces that were attached on the host controller
In general, if it is possible to design a SCSI host controller driver to create one child at a time, it should do so to support the rapid boot capability in the UEFI driver model.
Each of the channel child handles created in Start() must contain a Device Path Protocol instance and a Extended SCSI Pass Thru abstraction layer.