Host Mode Data Structures

Versal ACAP Technical Reference Manual (AM011)

Document ID
Release Date
1.4 English

To operate the USB controller, 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 the USB controller.

Context Data Structures

The USB context data structures are described in the following table. The PAGESIZE is 4 KB.

Table 1. USB 2.0 Context Data Structures
Context Data Structure Maximum Size (bytes) Boundary Byte Alignment Description
Device context 2048 PAGESIZE 64 Slot context and endpoint contexts (up to 32). An array of device contexts is prepared and maintained by the xHCI embedded RAM 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 used by the xHCI scratchpad mechanism.
Slot context 64 PAGESIZE 32 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 Information that applies to a specific endpoint
Stream context 16 PAGESIZE 16 Specific stream associated with an endpoint.
Input context 132 PAGESIZE 64 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 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 Provides 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

The USB ring data structures are defined in the following table.

Table 2. Ring Data Structures
Context Data Structure Maximum Size (KB) Boundary (KB) Byte Alignment Description
Transfer ring segments 64 64 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 64 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 64 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 None 64 Table of event ring segments.
Scratchpad buffers PAGESIZE PAGESIZE PAGESIZE A scratchpad buffer is allocated from system memory for storing internal state.