19.1.2 Driver Binding Protocol Start()

The Start() service of the Driver Binding Protocol for the USB host controller driver also opens the PCI I/O Protocol with an attribute of EFI_OPEN_PROTOCOL_BY_DRIVER. This is followed by an initialization of the USB host controller hardware and an installation of a EFI_USB2_HC_PROTOCOL instance into the Handle Database.

19.1.2.1 Support for legacy devices

Some USB host controllers provide legacy support to be compatible with legacy devices. Under this mode, the USB input device, including mouse and keyboard, act as if they are behind an 8042 keyboard controller. A UEFI implementation uses the native USB support rather than the legacy support.

As a result, the USB legacy support must be disabled in the Start() service of the USB host controller driver, before enabling the USB host controller. This step is required because the legacy support conflicts with the native USB support provided in UEFI USB driver stack. The example below shows how to turn off USB legacy support for a UHCI 1.1 Host Controllers.

Example 205-Disable USB Legacy Support

///
/// USB legacy Support
///
#define USB_EMULATION 0xc0
EFI_STATUS
EFIAPI
TurnOffUSBLegacySupport (
IN EFI_PCI_IO_PROTOCOL *PciIo
)
{
EFI_STATUS Status;
UINT16 Command;
//
// Disable USB Legacy Support by writing 0x0000 to the USB_EMULATION
// register in the PCI Configuration of the PCI Controller
//
Command = 0;
Status = PciIo->Pci.Write (
PciIo, // This
EfiPciIoWidthUint16, // Width
USB_EMULATION, // Offset
1, // Count
&Command // Buffer
);
return Status;
}