Download UEFI Driver Writer`s Guide

Transcript
19.1
USB Host Controller Driver
The USB host controller driver depends on which USB host controller specification the
host controller is based. Currently, the major types of USB host controllers are the
following:
•
Open Host Controller Interface (OHCI) (USB 1.0 and USB 1.1)
•
Universal Host Controller Interface (UHCI) (USB 1.0 and USB 1.1)
•
Enhanced Host Controller Interface (EHCI) (USB 2.0)
•
Extended Host Controller Interface (XHCI) (USB 3.0)
The USB host controller driver is a device driver and follows the UEFI driver model. It
typically consumes the services of EFI_PCI_IO_PROTOCOL and produces
EFI_USB2_HC_PROTOCOL. The following section provides guidelines for implementing the
EFI_DRIVER_BINDING_PROTOCOL services and EFI_USB2_HC_PROTOCOL services for the USB
host controller driver. The EDK II provides UEFI Drivers that implement the
EFI_USB_HC2_PROTOCOL for UHCI, ECHI, and XHCI in the MdeModulePkg in the following
paths:
19.1.1
•
UHCI - MdeModulePkg/Bus/Pci/UhciDxe
•
EHCI - MdeModulePkg/Bus/Pci/EhciDxe
•
XHCI - MdeModulePkg/Bus/Pci/XhciDxe
Driver Binding Protocol Supported()
The USB host controller driver must implement the EFI_DRIVER_BINDING_PROTOCOL
containing the Supported(), Start(), and Stop() services. The Driver Binding Protocol is
installed into the Handle Database in the drive entry point.
The Supported() service evaluates the ControllerHandle that is passed in to check if the
ControllerHandle represents a USB host controller that the USB host controller driver
knows how to manage. The typical method of implementing this evaluation is for the
USB host controller driver to retrieve the PCI configuration header from this controller
and check the Class Code field and possibly other fields such as the Device ID and
Vendor ID. If all these fields match the values that the USB host controller driver
knows how to manage, the Supported() service returns EFI_SUCCESS. Otherwise, the
Supported() service returns EFI_UNSUPPORTED.
The following example shows an example of the Supported() service for the USB host
controller driver managing a PCI controller with Class code 0x30c.
First, it attempts to open the PCI I/O Protocol EFI_OPEN_PROTOCOL_BY_DRIVER. If the PCI
I/O Protocol cannot be opened, then the USB host controller driver does not support
the controller specified by ControllerHandle. If the PCI I/O Protocol is opened, the
services of the PCI I/O Protocol are used to read the Class Code from the PCI
configuration header. The PCI I/O Protocol is always closed with CloseProtocol(), and
EFI_SUCCESS is returned if the Class Code fields match.
380
3/8/2012
Version 1.01