To operate the USB controller in various modes, a set of data structures are defined by the xHCI specification. The application software gives information to the xHCI driver that takes care of the programming and interaction with the data structures. The data structures are used to communicate control, status, and data between the xHCI stack (software) and USB 3.0 controller. The data structures support 32-bit or 64-bit memory buffer address space.
The basic data structures are shown in Table: Basic Data Structures.
Table 31-2: Basic Data Structures
Data Structure
|
Max Size (Bytes)
|
Boundary
|
Alignment (Bytes)
|
Context Data Structures
|
Device context
|
2048
|
PAGESIZE
|
64
|
Device context data structure contains slot context and endpoint contexts (up to 32). An array of device contexts is prepared and maintained by the xHCI embedded block and software. This array contains a maximum of 256 device contexts. The first entry (slot ID = 0) in the device context base address array is utilized by the xHCI scratchpad mechanism.
|
Slot context
|
64
|
PAGESIZE
|
32
|
The slot context data structure defines information that applies to a device as a whole. The slot context data structure of a device context is also referred to as an output slot context.
|
Endpoint context
|
64
|
PAGESIZE
|
32
|
The endpoint context data structure defines information that applies to a specific endpoint
|
Stream context
|
16
|
PAGESIZE
|
16
|
This data structure defines information that applies to a specific stream associated with an endpoint.
|
Input context
|
132
|
PAGESIZE
|
64
|
The input context data structure specifies the endpoints and the operations to be performed on those endpoints by the address device, configure endpoint, and evaluate context commands.
|
Input control context
|
64
|
PAGESIZE
|
64
|
The input control context data structure defines which device context data structures are affected by a command and the operations to be performed on those contexts.
|
Port bandwidth context
|
#ports * 4
|
PAGESIZE
|
32
|
The port bandwidth context data structure is used to provide system software with the percentage of periodic bandwidth available on each root hub port, at the speed indicated by the device speed field of the get port bandwidth command. Software allocates the context data structure and the xHCI updates the context data structure during the execution of a get port bandwidth command.
|
Ring Data Structures
|
Transfer ring segments
|
64 KB
|
64 KB
|
16
|
A transfer request block (TRB) ring is an array of TRB structures, that are used by the xHCI as a circular queue to communicate with the host. Transfer rings provide data transport to and from USB devices. There is a 1:1 mapping between transfer rings and USB pipes. They are defined by an endpoint context data structure contained in a device context, or the stream context array pointed to by the endpoint context.
|
Command ring segments
|
64 KB
|
64 KB
|
64
|
The command ring provides system software the ability to issue commands to enumerate USB devices, configure the xHCI to support those devices, and coordinate virtualization features. The command ring is managed by the command ring control register that resides in the operational registers.
|
Event ring segments
|
64 KB
|
64 KB
|
64
|
The event ring provides the xHCI with a means of reporting to system software: data transfer and command completion status, root hub port status changes, and other xHCI related events. An event ring is defined by the event ring segment table base address, segment table size, and dequeue pointer registers which reside in the run time registers.
|
Event ring segment table
|
512 KB
|
None
|
64
|
This is a table of event ring segments.
|
Scratchpad buffers
|
PAGESIZE
|
PAGESIZE
|
Page
|
A scratchpad buffer is a PAGESIZE block of system memory located on a PAGESIZE boundary. Each of these buffers allocated from system memory for storing internal state.
|