EXtensible Host Controller Interface

Revision as of 21:43, 12 January 2013 by osdev>Spydertl

eXtensible Host Controller Interface (xHCI) defines a register-level description of a Host Controller for Universal Serial bus (USB), which is capable of interfacing to USB 1.x, 2.0, and 3.0 compatible devices.

Technical Details

The xHCI controller communicates with the operating system using registers that can be located by searching the PCI configuration space for a device with a specific Class ID, Subclass ID, and Interface number. All xHCI controllers will have a Class ID of 0x0C, a Sublcass ID of 0x03, and an Interface value of 0x30. The configuration space for this device will contain two Base Address Registers: BAR0 and BAR1. These two 32-bit address fields combine to create a single 64-bit address that points to the base address of the memory mapped registers for the controller.

Capability Registers

The capability registers are located at the address specified by the PCI configuration space.

Offset (Hex) Name Description
00 CAPLENGTH Capability Register Length
02 HCIVERSION Interface Version Number
04 HCSPARAMS1 Structural Parameters 1
08 HCSPARAMS2 Structural Parameters 2
0C HCSPARAMS3 Structural Parameters 3
10 HCCPARAMS Capability Parameters
14 DBOFF Doorbell Offset
18 RTSOFF Runtime Registers Space Offset

Operational Registers

The operational registers are located after the capability registers in memory, and can be found by adding the CAPLENGTH field to the base address specified in the PCI configuration space.

Offset (Hex) Name Description
00 USBCMD USB Command
04 USBSTS USB Status
08 PAGESIZE Page Size
14 DNCTRL Device Notification Control
18 CRCR Command Ring Control
30 DCBAAP Device Context Base Address Array Pointer
38 CONFIG Configure

Port Registers

Runtime Registers

The runtime registers are located after the operational registers in memory, and can be found by adding the RTSOFF field to the base address specified in the PCI configuration space.

Offset (Hex) Name Description
00 CAPLENGTH Capability Register Length
02 HCIVERSION Interface Version Number
04 HCSPARAMS1 Structural Parameters 1
08 HCSPARAMS2 Structural Parameters 2
0C HCSPARAMS3 Structural Parameters 3
10 HCCPARAMS Capability Parameters
14 DBOFF Doorbell Offset
18 RTSOFF Runtime Registers Space Offset

Doorbell Registers

The doorbell registers are located after the runtime registers in memory, and can be found by adding the DBOFF field to the base address specified in the PCI configuration space.

Virtual Registers

The xHCI specifications support "virtual" controllers that can be used to support multiple virtual machines running on a single physical machine. These registers must be configured and managed by the VM host, and effectively duplicate the registers above for use by the guest VMs.