3.10.2 Bus driver
A bus driver is nearly identical to a device driver except that a bus driver creates child handles. This capability leads to several added features and responsibilities for a bus driver that are addressed in detail throughout this document. For example, device drivers do not need to concern themselves with searching the bus.
Just as with a device driver, the Start()
function of a bus driver consumes
the parent bus I/O abstraction(s) and produces new I/O abstractions in the form
of protocols. For example, the PCI bus driver consumes the services of the
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
and uses these services to scan a PCI bus for
PCI controllers. Each time a PCI controller is found, a child handle is created
and the
EFI_PCI_IO_PROTOCOL
is installed on the child handle. The services of the
EFI_PCI_IO_PROTOCOL
are implemented using the services of the
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
As a second example, the USB bus driver uses the services of the
EFI_USB2_HC_PROTOCOL
to discover and create child handles that support the
EFI_USB_IO_PROTOCOL
for each USB device on the USB bus. The services of the
EFI_USB_IO_PROTOCOL
are implemented using the services of the
EFI_USB2_HC_PROTOCOL
.
The following are the main objectives of the bus driver:
Initialize the bus controller.
Determine how many children to create. For example, the PCI bus driver may discover and enumerate all PCI devices on the bus or only a single PCI device that is being used to boot. How a bus driver handles this step creates
a basic subdivision in the types of bus drivers. A bus driver can do one of the following:
Create handles for all child controllers on the first call to Start().
Allow the handles for the child controllers to be created across multiple calls to Start().
A bus driver that creates child handles across multiple Start() calls is very useful because it may reduce the platform boot time. It allows a few child handles, or even a single child handle, to be created across multiple calls to Start(). On buses that take a long time to enumerate their children (for example, SCSI and Fibre Channel), multiple calls to Start() can save a large amount of time when booting a platform.
Allocate resources and create a child handle in the UEFI handle database for one or more child controllers.
Install an I/O protocol on the child handle that abstracts the I/O operations that the controller supports (such as the PCI I/O Protocol or the USB I/O Protocol).
If the child handle represents a physical device, then install a Device Path Protocol (see the UEFI Specification).
Load drivers from option ROMs, if present. The PCI bus driver is currently the only bus driver that loads from option ROMs.
Some common examples of UEFI bus drivers include:
PCI Bus Driver
: Creates a child handle for PCI controllers, either directly attached to a PCI Root Bridge, or attached to a PCI Root Bridge through one or more PCI to PCI Bridges. The Device Path Protocol includesPci()
device path nodes.USB Bus Driver
: Creates a child handle for USB devices, either directly attached to a USB Root Port, or attached to a USB Root Port through one or more USB Hubs. The Device Path Protocol includesUsb()
device path nodes.SCSI Bus Driver
: Creates a child handle for SCSI devices attached to a SCSI channel. The Device Path Protocol includesScsi()
device path nodes.SATA Bus Driver
: Creates a child handle for SATA devices attached to a SATA ports. The Device Path Protocol includesSata()
device path nodes.
Because bus drivers are defined as drivers that produce child handles, there are some other drivers that unexpectedly qualify as bus drivers:
Serial Driver:
Creates a child handle and extends the Device Path Protocol to include aUart()
messaging device path node.LAN Driver:
Creates a child handle and extends the Device Path Protocol to include aMac()
address-messaging device path node.Graphics Driver:
Creates a child handle for each physical video output and any logical video output that is a combination of two or more physical video outputs. Graphics drivers do not extend the Device Path Protocol.