18 PCI Driver Design Guidelines
There are several categories of PCI drivers that cooperate to provide support for PCI controllers in a platform. Table 25- lists these PCI drivers.
Table 25-Classes of PCI drivers
Class of driver | Description |
---|---|
PCI root bridge driver | Produces one or more instances of the PCI Root Bridge I/O Protocol. |
PCI bus driver | Consumes the PCI Root Bridge I/O Protocol, produces a child handle for each PCI controller, and installs the Device Path Protocol and the PCI I/O Protocol onto each child handle. |
PCI driver | Consumes the PCI I/O Protocol and produces an I/O abstraction providing services for the console and boot devices required to boot an EFI-conformant operating system. |
This chapter concentrates on the design and implementation of PCI drivers. PCI drivers must follow all of the general design guidelines described in Chapter 4. This chapter covers guidelines that apply specifically to the management of PCI controllers.
The following figure shows an example PCI driver stack and the protocols the
PCIrelated drivers consume and produce. In this example, the platform hardware
produces a single PCI root bridge. The PCI Root Bridge I/O Protocol driver
accesses the hardware resources to produce a single handle with the
EFI_DEVICE_PATH_PROTOCOL
and the EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL
.
The PCI bus driver consumes the services of the PCI_ROOT_BRIDGE_IO_PROTOCOL
and uses those services to enumerate the PCI controllers present in the system.
In this example, the PCI bus driver detected a disk controller, a graphics
controller, and a USB host controller. As a result, the PCI bus driver produces
three child handles with the EFI_DEVICE_PATH_PROTOCOL
and the
EFI_PCI_IO_PROTOCOL
.
- The driver for the PCI disk controller consumes the services of the
EFI_PCI_IO_PROTOCOL
and produces two child handles with theEFI_DEVICE_PATH_PROTOCOL
and theEFI_BLOCK_IO_PROTOCOL
. - The PCI driver for the graphics controller consumes the services of the
EFI_PCI_IO_PROTOCOL
and produces a child handle with theEFI_GRAPHICS_OUTPUT_PROTOCOL
. - The PCI driver for the USB host controller consumes the services of the
EFI_PCI_IO_PROTOCOL
to produce theEFI_USB_HOST_CONTROLLER_PROTOCOL
. Although not shown in Figure 19, theEFI_USB_HOST_CONTROLLER_PROTOCOL
would then be consumed by the USB bus driver to produce child handles for each USB device. USB drivers would then manage those child handles.
Chapter 19 contains the guidelines for designing USB drivers.