This topic describes the data structures used by the USB 3.0 host controller driver. Understanding these data structures will help you use the USB 3.0 and RCDRKD debugger extension commands effectively. The data structures presented here have names that are consistent with the USB 3.0 specification. Familiarity with the USB 3.0 specification will further enhance your ability to use the extension commands to debug USB 3.0 drivers.
The USB 3.0 host controller driver is part of the USB 3.0 core driver stack. For more information, see USB Driver Stack Architecture.
Each USB 3.0 host controller can have up to 255 devices, and each device can have up to 31 endpoints. The following diagram shows some of the data structures that represent one host controller and the connected devices.
Device Context Base Array
The Device Context Base Array is an array of pointers to Device Context structures. There is one Device Context structure for each device connected to the host controller. Elements 1 through 255 point to Device Context structures. Element 0 points to a context structure for the host controller.
Device Context and Slot Context
A Device Context structure holds an array of pointers to Endpoint Context structures. There is one Endpoint Context structure for each endpoint on the device. Elements 1 through 31 point to Endpoint Context structures. Element 0 points to a Slot Context structure, which holds context information for the device.
The Command Ring is used by software to pass commands to the host controller. Some of these commands are directed at the host controller, and some are directed at particular devices connected to the host controller.
The Event Ring is used by the host controller to pass events to software. That is, the Event Ring is a structure that the host controller uses to inform drivers that an action has completed.
Doorbell Register Array
The Doorbell Register Array is an array of doorbell registers, one for each device connected to the host controller. Elements 1 through 255 are doorbell registers. Element 0 indicates whether there is a pending command in the Command Ring.
Software notifies the host controller that it has device-related or endpoint-related work to perform by writing context information into the doorbell register for the device.
The following diagram continues to the right of the preceding diagram. It shows additional data structures that represent a single endpoint.
Each endpoint has one or more Transfer Rings. A Transfer Ring is an array of Transfer Request Blocks (TRBs). Each TRB points to a block of contiguous data (up to 64 KB) that will be transferred between hardware and memory as a single unit.
When the USB 3.0 core stack receives a transfer request from a USB client driver, it identifies the Endpoint Context for the transfer, and then breaks the transfer request into one or more Transfer Descriptors (TDs). Each TD contains one or more TRBs.
An Endpoint Context structure holds context information for a single endpoint. It also has Dequeue and Enqueue members, which are used to track where TRBs are being consumed by the hardware and where TRBs are being added by software.