drivers/usb/host/xhci.h
Source file repositories/reference/linux-study-clean/drivers/usb/host/xhci.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/host/xhci.h- Extension
.h- Size
- 83294 bytes
- Lines
- 2614
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bits.hlinux/usb.hlinux/timer.hlinux/kernel.hlinux/usb/hcd.hlinux/io-64-nonatomic-lo-hi.hlinux/io-64-nonatomic-hi-lo.hxhci-ext-caps.hpci-quirks.hxhci-port.hxhci-caps.h
Detected Declarations
struct xhci_cap_regsstruct xhci_port_regsstruct xhci_op_regsstruct xhci_intr_regstruct xhci_run_regsstruct xhci_doorbell_arraystruct xhci_container_ctxstruct xhci_slot_ctxstruct xhci_ep_ctxstruct xhci_input_control_ctxstruct xhci_commandstruct xhci_stream_ctxstruct xhci_stream_infostruct xhci_bw_infostruct xhci_virt_epstruct xhci_interval_bwstruct xhci_interval_bw_tablestruct xhci_virt_devicestruct xhci_root_port_bw_infostruct xhci_tt_bw_infostruct xhci_device_context_arraystruct xhci_transfer_eventstruct xhci_link_trbstruct xhci_event_cmdstruct xhci_generic_trbstruct xhci_segmentstruct xhci_tdstruct xhci_cdstruct xhci_ringstruct xhci_erst_entrystruct xhci_erststruct xhci_scratchpadstruct urb_privstruct s3_savestruct dev_infostruct xhci_bus_statestruct xhci_interrupterstruct xhci_port_capstruct xhci_portstruct xhci_hubstruct xhci_hcdstruct xhci_driver_overridesenum xhci_overhead_typeenum xhci_ep_reset_typeenum xhci_setup_devenum xhci_cancelled_td_statusenum xhci_ring_typefunction xhci_hcd_is_usb3
Annotated Snippet
struct xhci_cap_regs {
__le32 hc_capbase;
__le32 hcs_params1;
__le32 hcs_params2;
__le32 hcs_params3;
__le32 hcc_params;
__le32 db_off;
__le32 run_regs_off;
__le32 hcc_params2; /* xhci 1.1 */
/* Reserved up to (CAPLENGTH - 0x1C) */
};
/*
* struct xhci_port_regs - Host Controller USB Port Register Set. xHCI spec 5.4.8
* @portsc: Port Status and Control
* @portpmsc: Port Power Management Status and Control
* @portli: Port Link Info
* @porthlmpc: Port Hardware LPM Control
*/
struct xhci_port_regs {
__le32 portsc;
__le32 portpmsc;
__le32 portli;
__le32 porthlmpc;
};
/**
* struct xhci_op_regs - xHCI Host Controller Operational Registers.
* @command: USBCMD - xHC command register
* @status: USBSTS - xHC status register
* @page_size: This indicates the page size that the host controller
* supports. If bit n is set, the HC supports a page size
* of 2^(n+12), up to a 128MB page size.
* 4K is the minimum page size.
* @cmd_ring: CRP - 64-bit Command Ring Pointer
* @dcbaa_ptr: DCBAAP - 64-bit Device Context Base Address Array Pointer
* @config_reg: CONFIG - Configure Register
* @port_regs: Port Register Sets, from 1 to MaxPorts (defined by HCSPARAMS1).
*/
struct xhci_op_regs {
__le32 command;
__le32 status;
__le32 page_size;
__le32 reserved1;
__le32 reserved2;
__le32 dev_notification;
__le64 cmd_ring;
/* rsvd: offset 0x20-2F */
__le32 reserved3[4];
__le64 dcbaa_ptr;
__le32 config_reg;
/* rsvd: offset 0x3C-3FF */
__le32 reserved4[241];
struct xhci_port_regs port_regs[];
};
/* USBCMD - USB command - command bitmasks */
/* start/stop HC execution - do not write unless HC is halted*/
#define CMD_RUN XHCI_CMD_RUN
/* Reset HC - resets internal HC state machine and all registers (except
* PCI config regs). HC does NOT drive a USB reset on the downstream ports.
* The xHCI driver must reinitialize the xHC after setting this bit.
*/
#define CMD_RESET BIT(1)
/* Event Interrupt Enable - a '1' allows interrupts from the host controller */
#define CMD_EIE XHCI_CMD_EIE
/* Host System Error Interrupt Enable - get out-of-band signal for HC errors */
#define CMD_HSEIE XHCI_CMD_HSEIE
/* bits 4:6 are reserved (and should be preserved on writes). */
/* light reset (port status stays unchanged) - reset completed when this is 0 */
#define CMD_LRESET BIT(7)
/* host controller save/restore state. */
#define CMD_CSS BIT(8)
#define CMD_CRS BIT(9)
/* Enable Wrap Event - '1' means xHC generates an event when MFINDEX wraps. */
#define CMD_EWE XHCI_CMD_EWE
/* MFINDEX power management - '1' means xHC can stop MFINDEX counter if all root
* hubs are in U3 (selective suspend), disconnect, disabled, or powered-off.
* '0' means the xHC can power it off if all ports are in the disconnect,
* disabled, or powered-off state.
*/
#define CMD_PM_INDEX BIT(11)
/* bit 14 Extended TBC Enable, changes Isoc TRB fields to support larger TBC */
#define CMD_ETE BIT(14)
/* bits 15:31 are reserved (and should be preserved on writes). */
#define XHCI_RESET_LONG_USEC (10 * 1000 * 1000)
#define XHCI_RESET_SHORT_USEC (250 * 1000)
/* USBSTS - USB status - status bitmasks */
Annotation
- Immediate include surface: `linux/bits.h`, `linux/usb.h`, `linux/timer.h`, `linux/kernel.h`, `linux/usb/hcd.h`, `linux/io-64-nonatomic-lo-hi.h`, `linux/io-64-nonatomic-hi-lo.h`, `xhci-ext-caps.h`.
- Detected declarations: `struct xhci_cap_regs`, `struct xhci_port_regs`, `struct xhci_op_regs`, `struct xhci_intr_reg`, `struct xhci_run_regs`, `struct xhci_doorbell_array`, `struct xhci_container_ctx`, `struct xhci_slot_ctx`, `struct xhci_ep_ctx`, `struct xhci_input_control_ctx`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.