iPXE
xhci.h File Reference

USB eXtensible Host Controller Interface (xHCI) driver. More...

#include <assert.h>
#include <ipxe/pci.h>
#include <ipxe/usb.h>

Go to the source code of this file.

Data Structures

struct  xhci_trb_template
 A transfer request block template. More...
struct  xhci_trb_common
 A transfer request block. More...
struct  xhci_trb_normal
 A normal transfer request block. More...
struct  xhci_trb_setup
 A setup stage transfer request block. More...
struct  xhci_trb_data
 A data stage transfer request block. More...
struct  xhci_trb_status
 A status stage transfer request block. More...
 A link transfer request block. More...
struct  xhci_trb_enable_slot
 An enable slot transfer request block. More...
struct  xhci_trb_disable_slot
 A disable slot transfer request block. More...
struct  xhci_trb_context
 A context transfer request block. More...
struct  xhci_trb_reset_endpoint
 A reset endpoint transfer request block. More...
struct  xhci_trb_stop_endpoint
 A stop endpoint transfer request block. More...
struct  xhci_trb_set_tr_dequeue_pointer
 A set transfer ring dequeue pointer transfer request block. More...
struct  xhci_trb_transfer
 A transfer event transfer request block. More...
struct  xhci_trb_complete
 A command completion event transfer request block. More...
struct  xhci_trb_port_status
 A port status change transfer request block. More...
struct  xhci_trb_host_controller
 A port status change transfer request block. More...
union  xhci_trb
 A transfer request block. More...
struct  xhci_control_context
 An input control context. More...
struct  xhci_slot_context
 A slot context. More...
struct  xhci_endpoint_context
 An endpoint context. More...
struct  xhci_event_ring_segment
 An event ring segment. More...
struct  xhci_trb_ring
 A transfer request block command/transfer ring. More...
struct  xhci_event_ring
 An event ring. More...
struct  xhci_pch
 Intel PCH quirk. More...
struct  xhci_dcbaa
 Device context base address array. More...
struct  xhci_scratchpad
 Scratchpad buffer. More...
struct  xhci_device
 An xHCI device. More...
struct  xhci_slot
 An xHCI device slot. More...
struct  xhci_endpoint
 An xHCI endpoint. More...

Macros

#define XHCI_MIN_ALIGN   64
 Minimum alignment required for data structures.
#define XHCI_MTU   65536
 Maximum transfer size.
#define XHCI_BAR   PCI_BASE_ADDRESS_0
 xHCI PCI BAR
#define XHCI_CAP_CAPLENGTH   0x00
 Capability register length.
#define XHCI_CAP_HCIVERSION   0x02
 Host controller interface version number.
#define XHCI_CAP_HCSPARAMS1   0x04
 Structural parameters 1.
#define XHCI_HCSPARAMS1_SLOTS(params)
 Number of device slots.
#define XHCI_HCSPARAMS1_INTRS(params)
 Number of interrupters.
#define XHCI_HCSPARAMS1_PORTS(params)
 Number of ports.
#define XHCI_CAP_HCSPARAMS2   0x08
 Structural parameters 2.
#define XHCI_HCSPARAMS2_SCRATCHPADS(params)
 Number of page-sized scratchpad buffers.
#define XHCI_CAP_HCCPARAMS1   0x10
 Capability parameters.
#define XHCI_HCCPARAMS1_ADDR64(params)
 64-bit addressing capability
#define XHCI_HCCPARAMS1_CSZ_SHIFT(params)
 Context size shift.
#define XHCI_HCCPARAMS1_XECP(params)
 xHCI extended capabilities pointer
#define XHCI_CAP_DBOFF   0x14
 Doorbell offset.
#define XHCI_CAP_RTSOFF   0x18
 Runtime register space offset.
#define XHCI_XECP_ID(xecp)
 xHCI extended capability ID
#define XHCI_XECP_NEXT(xecp)
 Next xHCI extended capability pointer.
#define XHCI_XECP_ID_LEGACY   1
 USB legacy support extended capability.
#define XHCI_USBLEGSUP_BIOS   0x02
 USB legacy support BIOS owned semaphore.
#define XHCI_USBLEGSUP_BIOS_OWNED   0x01
 USB legacy support BIOS ownership flag.
#define XHCI_USBLEGSUP_OS   0x03
 USB legacy support OS owned semaphore.
#define XHCI_USBLEGSUP_OS_OWNED   0x01
 USB legacy support OS ownership flag.
#define XHCI_USBLEGSUP_CTLSTS   0x04
 USB legacy support control/status.
#define XHCI_XECP_ID_SUPPORTED   2
 Supported protocol extended capability.
#define XHCI_SUPPORTED_REVISION   0x00
 Supported protocol revision.
#define XHCI_SUPPORTED_REVISION_VER(revision)
 Supported protocol minor revision.
#define XHCI_SUPPORTED_NAME   0x04
 Supported protocol name.
#define XHCI_SUPPORTED_PORTS   0x08
 Supported protocol ports.
#define XHCI_SUPPORTED_PORTS_OFFSET(ports)
 Supported protocol port offset.
#define XHCI_SUPPORTED_PORTS_COUNT(ports)
 Supported protocol port count.
#define XHCI_SUPPORTED_PORTS_PSIC(ports)
 Supported protocol PSI count.
#define XHCI_SUPPORTED_SLOT   0x0c
 Supported protocol slot.
#define XHCI_SUPPORTED_SLOT_TYPE(slot)
 Supported protocol slot type.
#define XHCI_SUPPORTED_PSI(index)
 Supported protocol PSI.
#define XHCI_SUPPORTED_PSI_VALUE(psi)
 Supported protocol PSI value.
#define XHCI_SUPPORTED_PSI_MANTISSA(psi)
 Supported protocol PSI mantissa.
#define XHCI_SUPPORTED_PSI_EXPONENT(psi)
 Supported protocol PSI exponent.
#define XHCI_OP_USBCMD   0x00
 USB command register.
#define XHCI_USBCMD_RUN   0x00000001UL
 Run/stop.
#define XHCI_USBCMD_HCRST   0x00000002UL
 Host controller reset.
#define XHCI_OP_USBSTS   0x04
 USB status register.
#define XHCI_USBSTS_HCH   0x00000001UL
 Host controller halted.
#define XHCI_OP_PAGESIZE   0x08
 Page size register.
#define XHCI_PAGESIZE(pagesize)
 Page size.
#define XHCI_OP_DNCTRL   0x14
 Device notifcation control register.
#define XHCI_OP_CRCR   0x18
 Command ring control register.
#define XHCI_CRCR_RCS   0x00000001UL
 Command ring cycle state.
#define XHCI_CRCR_CA   0x00000004UL
 Command abort.
#define XHCI_CRCR_CRR   0x00000008UL
 Command ring running.
#define XHCI_OP_DCBAAP   0x30
 Device context base address array pointer.
#define XHCI_OP_CONFIG   0x38
 Configure register.
#define XHCI_CONFIG_MAX_SLOTS_EN(slots)
 Maximum device slots enabled.
#define XHCI_CONFIG_MAX_SLOTS_EN_MASK    XHCI_CONFIG_MAX_SLOTS_EN ( 0xff )
 Maximum device slots enabled mask.
#define XHCI_OP_PORTSC(port)
 Port status and control register.
#define XHCI_PORTSC_CCS   0x00000001UL
 Current connect status.
#define XHCI_PORTSC_PED   0x00000002UL
 Port enabled.
#define XHCI_PORTSC_PR   0x00000010UL
 Port reset.
#define XHCI_PORTSC_PLS(pls)
 Port link state.
#define XHCI_PORTSC_PLS_DISABLED   XHCI_PORTSC_PLS ( 4 )
 Disabled port link state.
#define XHCI_PORTSC_PLS_RXDETECT   XHCI_PORTSC_PLS ( 5 )
 RxDetect port link state.
#define XHCI_PORTSC_PLS_MASK   XHCI_PORTSC_PLS ( 0xf )
 Port link state mask.
#define XHCI_PORTSC_PP   0x00000200UL
 Port power.
#define XHCI_PORT_POWER_DELAY_MS   20
 Time to delay after enabling power to a port.
#define XHCI_PORTSC_PSIV(portsc)
 Port speed ID value.
#define XHCI_PORTSC_PIC(indicators)
 Port indicator control.
#define XHCI_PORTSC_PIC_MASK   XHCI_PORTSC_PIC ( 3 )
 Port indicator control mask.
#define XHCI_PORTSC_LWS   0x00010000UL
 Port link state write strobe.
#define XHCI_LINK_STATE_DELAY_MS   100
 Time to delay after writing the port link state.
#define XHCI_PORTSC_CSC   0x00020000UL
 Connect status change.
#define XHCI_PORTSC_PEC   0x00040000UL
 Port enabled/disabled change.
#define XHCI_PORTSC_WRC   0x00080000UL
 Warm port reset change.
#define XHCI_PORTSC_OCC   0x00100000UL
 Over-current change.
#define XHCI_PORTSC_PRC   0x00200000UL
 Port reset change.
#define XHCI_PORTSC_PLC   0x00400000UL
 Port link state change.
#define XHCI_PORTSC_CEC   0x00800000UL
 Port config error change.
#define XHCI_PORTSC_CHANGE
 Port status change mask.
#define XHCI_PORTSC_PRESERVE   ( XHCI_PORTSC_PP | XHCI_PORTSC_PIC_MASK )
 Port status and control bits which should be preserved.
#define XHCI_OP_PORTPMSC(port)
 Port power management status and control register.
#define XHCI_OP_PORTLI(port)
 Port link info register.
#define XHCI_OP_PORTHLPMC(port)
 Port hardware link power management control register.
#define XHCI_RUN_ERSTSZ(intr)
 Event ring segment table size register.
#define XHCI_RUN_ERSTBA(intr)
 Event ring segment table base address register.
#define XHCI_RUN_ERDP(intr)
 Event ring dequeue pointer register.
#define XHCI_TRB_C   0x01
 Transfer request block cycle bit flag.
#define XHCI_TRB_TC   0x02
 Transfer request block toggle cycle bit flag.
#define XHCI_TRB_CH   0x10
 Transfer request block chain flag.
#define XHCI_TRB_IOC   0x20
 Transfer request block interrupt on completion flag.
#define XHCI_TRB_IDT   0x40
 Transfer request block immediate data flag.
#define XHCI_TRB_TYPE(type)
 Transfer request block type.
#define XHCI_TRB_TYPE_MASK   XHCI_TRB_TYPE ( 0x3f )
 Transfer request block type mask.
#define XHCI_TRB_NORMAL   XHCI_TRB_TYPE ( 1 )
 A normal transfer request block.
#define XHCI_TD_SIZE(remaining)
 Construct TD size field.
#define XHCI_TRB_SETUP   XHCI_TRB_TYPE ( 2 )
 A setup stage transfer request block.
#define XHCI_SETUP_IN   3
 Setup stage input data direction.
#define XHCI_SETUP_OUT   2
 Setup stage output data direction.
#define XHCI_TRB_DATA   XHCI_TRB_TYPE ( 3 )
 A data stage transfer request block.
#define XHCI_DATA_IN   0x01
 Input data direction.
#define XHCI_DATA_OUT   0x00
 Output data direction.
#define XHCI_TRB_STATUS   XHCI_TRB_TYPE ( 4 )
 A status stage transfer request block.
#define XHCI_STATUS_IN   0x01
 Input status direction.
#define XHCI_STATUS_OUT   0x00
 Output status direction.
#define XHCI_TRB_LINK   XHCI_TRB_TYPE ( 6 )
 A link transfer request block.
#define XHCI_TRB_NOP   XHCI_TRB_TYPE ( 8 )
 A no-op transfer request block.
#define XHCI_TRB_ENABLE_SLOT   XHCI_TRB_TYPE ( 9 )
 An enable slot transfer request block.
#define XHCI_TRB_DISABLE_SLOT   XHCI_TRB_TYPE ( 10 )
 A disable slot transfer request block.
#define XHCI_TRB_ADDRESS_DEVICE   XHCI_TRB_TYPE ( 11 )
 An address device transfer request block.
#define XHCI_TRB_CONFIGURE_ENDPOINT   XHCI_TRB_TYPE ( 12 )
 A configure endpoint transfer request block.
#define XHCI_TRB_EVALUATE_CONTEXT   XHCI_TRB_TYPE ( 13 )
 An evaluate context transfer request block.
#define XHCI_TRB_RESET_ENDPOINT   XHCI_TRB_TYPE ( 14 )
 A reset endpoint transfer request block.
#define XHCI_TRB_STOP_ENDPOINT   XHCI_TRB_TYPE ( 15 )
 A stop endpoint transfer request block.
#define XHCI_TRB_SET_TR_DEQUEUE_POINTER   XHCI_TRB_TYPE ( 16 )
 A set transfer ring dequeue pointer transfer request block.
#define XHCI_TRB_NOP_CMD   XHCI_TRB_TYPE ( 23 )
 A no-op command transfer request block.
#define XHCI_TRB_TRANSFER   XHCI_TRB_TYPE ( 32 )
 A transfer event transfer request block.
#define XHCI_TRB_COMPLETE   XHCI_TRB_TYPE ( 33 )
 A command completion event transfer request block.
#define XHCI_TRB_PORT_STATUS   XHCI_TRB_TYPE ( 34 )
 A port status change transfer request block.
#define XHCI_TRB_HOST_CONTROLLER   XHCI_TRB_TYPE ( 37 )
 A port status change transfer request block.
#define XHCI_SLOT_INFO(entries, hub, speed, route)
 Construct slot context device info.
#define XHCI_ENDPOINT_STATE_MASK   0x07
 Endpoint state mask.
#define XHCI_EP_TYPE(type)
 Endpoint type.
#define XHCI_EP_TYPE_CONTROL   XHCI_EP_TYPE ( 4 )
 Control endpoint type.
#define XHCI_EP_TYPE_IN   XHCI_EP_TYPE ( 4 )
 Input endpoint type.
#define XHCI_EP_TYPE_PERIODIC   XHCI_EP_TYPE ( 1 )
 Periodic endpoint type.
#define XHCI_EP_DCS   0x00000001UL
 Endpoint dequeue cycle state.
#define XHCI_EP0_TRB_LEN   8
 Control endpoint average TRB length.
#define XHCI_DBVAL(target, stream)
 Calculate doorbell register value.
#define XHCI_CTX_SLOT   0
 Slot context index.
#define XHCI_CTX(address)
 Calculate context index from USB endpoint address.
#define XHCI_CTX_EP0   XHCI_CTX ( 0x00 )
 Endpoint zero context index.
#define XHCI_CTX_END   32
 End of contexts.
#define XHCI_DCI(ctx)
 Device context index.
#define XHCI_ICI(ctx)
 Input context index.
#define XHCI_CMD_TRBS_LOG2   2
 Number of TRBs (excluding Link TRB) in the command ring.
#define XHCI_EVENT_TRBS_LOG2   6
 Number of TRBs in the event ring.
#define XHCI_TRANSFER_TRBS_LOG2   6
 Number of TRBs in a transfer ring.
#define XHCI_USBLEGSUP_MAX_WAIT_MS   100
 Maximum time to wait for BIOS to release ownership.
#define XHCI_STOP_MAX_WAIT_MS   100
 Maximum time to wait for host controller to stop.
#define XHCI_RESET_MAX_WAIT_MS   500
 Maximum time to wait for reset to complete.
#define XHCI_COMMAND_MAX_WAIT_MS   USB_CONTROL_MAX_WAIT_MS
 Maximum time to wait for a command to complete.
#define XHCI_COMMAND_ABORT_DELAY_MS   500
 Time to delay after aborting a command.
#define XHCI_PORT_RESET_MAX_WAIT_MS   500
 Maximum time to wait for a port reset to complete.
#define XHCI_PCH   0x0001
 Intel PCH quirk flag.
#define XHCI_PCH_XUSB2PR   0xd0
 Intel PCH USB2 port routing register.
#define XHCI_PCH_XUSB2PRM   0xd4
 Intel PCH USB2 port routing mask register.
#define XHCI_PCH_USB3PSSEN   0xd8
 Intel PCH SuperSpeed enable register.
#define XHCI_PCH_USB3PRM   0xdc
 Intel PCH USB3 port routing mask register.
#define XHCI_BAD_PSIV   0x0002
 Invalid protocol speed ID values quirk.

Enumerations

enum  xhci_default_psi_value { XHCI_SPEED_FULL = 1 , XHCI_SPEED_LOW = 2 , XHCI_SPEED_HIGH = 3 , XHCI_SPEED_SUPER = 4 }
 Default PSI values. More...
enum  xhci_completion_code { XHCI_CMPLT_SUCCESS = 1 , XHCI_CMPLT_SHORT = 13 , XHCI_CMPLT_CMD_STOPPED = 24 }
 xHCI completion codes More...
enum  xhci_endpoint_state {
  XHCI_ENDPOINT_DISABLED = 0 , XHCI_ENDPOINT_RUNNING = 1 , XHCI_ENDPOINT_HALTED = 2 , XHCI_ENDPOINT_STOPPED = 3 ,
  XHCI_ENDPOINT_ERROR = 4
}
 Endpoint states. More...

Functions

 FILE_LICENCE (GPL2_OR_LATER_OR_UBDL)
 FILE_SECBOOT (PERMITTED)
static unsigned int xhci_ring_fill (struct xhci_trb_ring *ring)
 Calculate space used in TRB ring.
static unsigned int xhci_ring_remaining (struct xhci_trb_ring *ring)
 Calculate space remaining in TRB ring.
static physaddr_t xhci_ring_consumed (struct xhci_trb_ring *ring)
 Calculate physical address of most recently consumed TRB.
void xhci_init (struct xhci_device *xhci)
 Initialise device.
int xhci_register (struct xhci_device *xhci)
 Register xHCI controller.
void xhci_unregister (struct xhci_device *xhci)
 Unregister xHCI controller.

Detailed Description

USB eXtensible Host Controller Interface (xHCI) driver.

Definition in file xhci.h.

Macro Definition Documentation

◆ XHCI_MIN_ALIGN

#define XHCI_MIN_ALIGN   64

Minimum alignment required for data structures.

With the exception of the scratchpad buffer pages (which are page-aligned), data structures used by xHCI generally require from 16 to 64 byte alignment and must not cross an (xHCI) page boundary. We simplify this requirement by aligning each structure on its own size, with a minimum of a 64 byte alignment.

Definition at line 25 of file xhci.h.

Referenced by xhci_align().

◆ XHCI_MTU

#define XHCI_MTU   65536

Maximum transfer size.

Definition at line 28 of file xhci.h.

Referenced by xhci_endpoint_count(), xhci_endpoint_stream(), and xhci_register().

◆ XHCI_BAR

#define XHCI_BAR   PCI_BASE_ADDRESS_0

xHCI PCI BAR

Definition at line 31 of file xhci.h.

Referenced by xhci_probe().

◆ XHCI_CAP_CAPLENGTH

#define XHCI_CAP_CAPLENGTH   0x00

Capability register length.

Definition at line 34 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_CAP_HCIVERSION

#define XHCI_CAP_HCIVERSION   0x02

Host controller interface version number.

Definition at line 37 of file xhci.h.

◆ XHCI_CAP_HCSPARAMS1

#define XHCI_CAP_HCSPARAMS1   0x04

Structural parameters 1.

Definition at line 40 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCSPARAMS1_SLOTS

#define XHCI_HCSPARAMS1_SLOTS ( params)
Value:
( ( (params) >> 0 ) & 0xff )

Number of device slots.

Definition at line 43 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCSPARAMS1_INTRS

#define XHCI_HCSPARAMS1_INTRS ( params)
Value:
( ( (params) >> 8 ) & 0x3ff )

Number of interrupters.

Definition at line 46 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCSPARAMS1_PORTS

#define XHCI_HCSPARAMS1_PORTS ( params)
Value:
( ( (params) >> 24 ) & 0xff )

Number of ports.

Definition at line 49 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_CAP_HCSPARAMS2

#define XHCI_CAP_HCSPARAMS2   0x08

Structural parameters 2.

Definition at line 52 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCSPARAMS2_SCRATCHPADS

#define XHCI_HCSPARAMS2_SCRATCHPADS ( params)
Value:
( ( ( (params) >> 16 ) & 0x3e0 ) | ( ( (params) >> 27 ) & 0x1f ) )

Number of page-sized scratchpad buffers.

Definition at line 55 of file xhci.h.

55#define XHCI_HCSPARAMS2_SCRATCHPADS(params) \
56 ( ( ( (params) >> 16 ) & 0x3e0 ) | ( ( (params) >> 27 ) & 0x1f ) )

Referenced by xhci_init().

◆ XHCI_CAP_HCCPARAMS1

#define XHCI_CAP_HCCPARAMS1   0x10

Capability parameters.

Definition at line 59 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCCPARAMS1_ADDR64

#define XHCI_HCCPARAMS1_ADDR64 ( params)
Value:
( ( (params) >> 0 ) & 0x1 )

64-bit addressing capability

Definition at line 62 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCCPARAMS1_CSZ_SHIFT

#define XHCI_HCCPARAMS1_CSZ_SHIFT ( params)
Value:
( 5 + ( ( (params) >> 2 ) & 0x1 ) )

Context size shift.

Definition at line 65 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_HCCPARAMS1_XECP

#define XHCI_HCCPARAMS1_XECP ( params)
Value:
( ( ( (params) >> 16 ) & 0xffff ) << 2 )

xHCI extended capabilities pointer

Definition at line 68 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_CAP_DBOFF

#define XHCI_CAP_DBOFF   0x14

Doorbell offset.

Definition at line 71 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_CAP_RTSOFF

#define XHCI_CAP_RTSOFF   0x18

Runtime register space offset.

Definition at line 74 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_XECP_ID

#define XHCI_XECP_ID ( xecp)
Value:
( ( (xecp) >> 0 ) & 0xff )

xHCI extended capability ID

Definition at line 77 of file xhci.h.

Referenced by xhci_extended_capability().

◆ XHCI_XECP_NEXT

#define XHCI_XECP_NEXT ( xecp)
Value:
( ( ( (xecp) >> 8 ) & 0xff ) << 2 )

Next xHCI extended capability pointer.

Definition at line 80 of file xhci.h.

Referenced by xhci_extended_capability().

◆ XHCI_XECP_ID_LEGACY

#define XHCI_XECP_ID_LEGACY   1

USB legacy support extended capability.

Definition at line 83 of file xhci.h.

Referenced by xhci_legacy_init().

◆ XHCI_USBLEGSUP_BIOS

#define XHCI_USBLEGSUP_BIOS   0x02

USB legacy support BIOS owned semaphore.

Definition at line 86 of file xhci.h.

Referenced by xhci_legacy_claim(), and xhci_legacy_init().

◆ XHCI_USBLEGSUP_BIOS_OWNED

#define XHCI_USBLEGSUP_BIOS_OWNED   0x01

USB legacy support BIOS ownership flag.

Definition at line 89 of file xhci.h.

Referenced by xhci_legacy_claim(), and xhci_legacy_init().

◆ XHCI_USBLEGSUP_OS

#define XHCI_USBLEGSUP_OS   0x03

USB legacy support OS owned semaphore.

Definition at line 92 of file xhci.h.

Referenced by xhci_legacy_claim(), and xhci_legacy_release().

◆ XHCI_USBLEGSUP_OS_OWNED

#define XHCI_USBLEGSUP_OS_OWNED   0x01

USB legacy support OS ownership flag.

Definition at line 95 of file xhci.h.

Referenced by xhci_legacy_claim().

◆ XHCI_USBLEGSUP_CTLSTS

#define XHCI_USBLEGSUP_CTLSTS   0x04

USB legacy support control/status.

Definition at line 98 of file xhci.h.

Referenced by xhci_legacy_claim().

◆ XHCI_XECP_ID_SUPPORTED

#define XHCI_XECP_ID_SUPPORTED   2

Supported protocol extended capability.

Definition at line 101 of file xhci.h.

Referenced by xhci_supported_protocol().

◆ XHCI_SUPPORTED_REVISION

#define XHCI_SUPPORTED_REVISION   0x00

Supported protocol revision.

Definition at line 104 of file xhci.h.

Referenced by xhci_port_protocol().

◆ XHCI_SUPPORTED_REVISION_VER

#define XHCI_SUPPORTED_REVISION_VER ( revision)
Value:
( ( (revision) >> 16 ) & 0xffff )
uint32_t revision
Entry point revision.
Definition ib_mad.h:9

Supported protocol minor revision.

Definition at line 107 of file xhci.h.

Referenced by xhci_port_protocol().

◆ XHCI_SUPPORTED_NAME

#define XHCI_SUPPORTED_NAME   0x04

Supported protocol name.

Definition at line 110 of file xhci.h.

Referenced by xhci_port_protocol().

◆ XHCI_SUPPORTED_PORTS

#define XHCI_SUPPORTED_PORTS   0x08

Supported protocol ports.

Definition at line 113 of file xhci.h.

Referenced by xhci_port_protocol(), xhci_port_psiv(), xhci_port_speed(), and xhci_supported_protocol().

◆ XHCI_SUPPORTED_PORTS_OFFSET

#define XHCI_SUPPORTED_PORTS_OFFSET ( ports)
Value:
( ( (ports) >> 0 ) & 0xff )

Supported protocol port offset.

Definition at line 116 of file xhci.h.

Referenced by xhci_supported_protocol().

◆ XHCI_SUPPORTED_PORTS_COUNT

#define XHCI_SUPPORTED_PORTS_COUNT ( ports)
Value:
( ( (ports) >> 8 ) & 0xff )

Supported protocol port count.

Definition at line 119 of file xhci.h.

Referenced by xhci_supported_protocol().

◆ XHCI_SUPPORTED_PORTS_PSIC

#define XHCI_SUPPORTED_PORTS_PSIC ( ports)
Value:
( ( (ports) >> 28 ) & 0x0f )

Supported protocol PSI count.

Definition at line 122 of file xhci.h.

Referenced by xhci_port_protocol(), xhci_port_psiv(), and xhci_port_speed().

◆ XHCI_SUPPORTED_SLOT

#define XHCI_SUPPORTED_SLOT   0x0c

Supported protocol slot.

Definition at line 125 of file xhci.h.

Referenced by xhci_port_protocol(), and xhci_port_slot_type().

◆ XHCI_SUPPORTED_SLOT_TYPE

#define XHCI_SUPPORTED_SLOT_TYPE ( slot)
Value:
( ( (slot) >> 0 ) & 0x1f )
uint8_t slot
Slot.
Definition edd.h:3

Supported protocol slot type.

Definition at line 128 of file xhci.h.

Referenced by xhci_port_protocol(), and xhci_port_slot_type().

◆ XHCI_SUPPORTED_PSI

#define XHCI_SUPPORTED_PSI ( index)
Value:
( 0x10 + ( (index) * 4 ) )
long index
Definition bigint.h:65

Supported protocol PSI.

Definition at line 131 of file xhci.h.

Referenced by xhci_port_protocol(), xhci_port_psiv(), and xhci_port_speed().

◆ XHCI_SUPPORTED_PSI_VALUE

#define XHCI_SUPPORTED_PSI_VALUE ( psi)
Value:
( ( (psi) >> 0 ) & 0x0f )

Supported protocol PSI value.

Definition at line 134 of file xhci.h.

Referenced by xhci_port_protocol(), xhci_port_psiv(), and xhci_port_speed().

◆ XHCI_SUPPORTED_PSI_MANTISSA

#define XHCI_SUPPORTED_PSI_MANTISSA ( psi)
Value:
( ( (psi) >> 16 ) & 0xffff )

Supported protocol PSI mantissa.

Definition at line 137 of file xhci.h.

Referenced by xhci_port_psiv(), xhci_port_speed(), and xhci_speed_name().

◆ XHCI_SUPPORTED_PSI_EXPONENT

#define XHCI_SUPPORTED_PSI_EXPONENT ( psi)
Value:
( ( (psi) >> 4 ) & 0x03 )

Supported protocol PSI exponent.

Definition at line 140 of file xhci.h.

Referenced by xhci_port_psiv(), xhci_port_speed(), and xhci_speed_name().

◆ XHCI_OP_USBCMD

#define XHCI_OP_USBCMD   0x00

USB command register.

Definition at line 155 of file xhci.h.

Referenced by xhci_dump(), xhci_reset(), xhci_run(), and xhci_stop().

◆ XHCI_USBCMD_RUN

#define XHCI_USBCMD_RUN   0x00000001UL

Run/stop.

Definition at line 158 of file xhci.h.

Referenced by xhci_dump(), xhci_run(), and xhci_stop().

◆ XHCI_USBCMD_HCRST

#define XHCI_USBCMD_HCRST   0x00000002UL

Host controller reset.

Definition at line 161 of file xhci.h.

Referenced by xhci_dump(), and xhci_reset().

◆ XHCI_OP_USBSTS

#define XHCI_OP_USBSTS   0x04

USB status register.

Definition at line 164 of file xhci.h.

Referenced by xhci_dump(), and xhci_stop().

◆ XHCI_USBSTS_HCH

#define XHCI_USBSTS_HCH   0x00000001UL

Host controller halted.

Definition at line 167 of file xhci.h.

Referenced by xhci_dump(), and xhci_stop().

◆ XHCI_OP_PAGESIZE

#define XHCI_OP_PAGESIZE   0x08

Page size register.

Definition at line 170 of file xhci.h.

Referenced by xhci_dump(), and xhci_init().

◆ XHCI_PAGESIZE

#define XHCI_PAGESIZE ( pagesize)
Value:
( (pagesize) << 12 )

Page size.

Definition at line 173 of file xhci.h.

Referenced by xhci_init().

◆ XHCI_OP_DNCTRL

#define XHCI_OP_DNCTRL   0x14

Device notifcation control register.

Definition at line 176 of file xhci.h.

Referenced by xhci_dump().

◆ XHCI_OP_CRCR

#define XHCI_OP_CRCR   0x18

Command ring control register.

Definition at line 179 of file xhci.h.

Referenced by xhci_abort(), xhci_command_alloc(), and xhci_command_free().

◆ XHCI_CRCR_RCS

#define XHCI_CRCR_RCS   0x00000001UL

Command ring cycle state.

Definition at line 182 of file xhci.h.

Referenced by xhci_abort(), and xhci_command_alloc().

◆ XHCI_CRCR_CA

#define XHCI_CRCR_CA   0x00000004UL

Command abort.

Definition at line 185 of file xhci.h.

Referenced by xhci_abort().

◆ XHCI_CRCR_CRR

#define XHCI_CRCR_CRR   0x00000008UL

Command ring running.

Definition at line 188 of file xhci.h.

Referenced by xhci_abort(), and xhci_command_free().

◆ XHCI_OP_DCBAAP

#define XHCI_OP_DCBAAP   0x30

Device context base address array pointer.

Definition at line 191 of file xhci.h.

Referenced by xhci_dcbaa_alloc(), and xhci_dcbaa_free().

◆ XHCI_OP_CONFIG

#define XHCI_OP_CONFIG   0x38

Configure register.

Definition at line 194 of file xhci.h.

Referenced by xhci_dump(), and xhci_run().

◆ XHCI_CONFIG_MAX_SLOTS_EN

#define XHCI_CONFIG_MAX_SLOTS_EN ( slots)
Value:
( (slots) << 0 )

Maximum device slots enabled.

Definition at line 197 of file xhci.h.

Referenced by xhci_run().

◆ XHCI_CONFIG_MAX_SLOTS_EN_MASK

#define XHCI_CONFIG_MAX_SLOTS_EN_MASK    XHCI_CONFIG_MAX_SLOTS_EN ( 0xff )

Maximum device slots enabled mask.

Definition at line 200 of file xhci.h.

200#define XHCI_CONFIG_MAX_SLOTS_EN_MASK \
201 XHCI_CONFIG_MAX_SLOTS_EN ( 0xff )

Referenced by xhci_run().

◆ XHCI_OP_PORTSC

#define XHCI_OP_PORTSC ( port)
Value:
( 0x400 - 0x10 + ( (port) << 4 ) )
u8 port
Port number.
Definition CIB_PRM.h:3

Port status and control register.

Definition at line 204 of file xhci.h.

Referenced by xhci_dump_port(), xhci_port_status(), xhci_root_disable(), xhci_root_enable(), xhci_root_open(), and xhci_root_speed().

◆ XHCI_PORTSC_CCS

#define XHCI_PORTSC_CCS   0x00000001UL

Current connect status.

Definition at line 207 of file xhci.h.

Referenced by xhci_dump_port(), and xhci_root_speed().

◆ XHCI_PORTSC_PED

#define XHCI_PORTSC_PED   0x00000002UL

Port enabled.

Definition at line 210 of file xhci.h.

Referenced by xhci_dump_port(), xhci_root_disable(), xhci_root_enable(), and xhci_root_speed().

◆ XHCI_PORTSC_PR

#define XHCI_PORTSC_PR   0x00000010UL

Port reset.

Definition at line 213 of file xhci.h.

Referenced by xhci_dump_port(), and xhci_root_enable().

◆ XHCI_PORTSC_PLS

#define XHCI_PORTSC_PLS ( pls)
Value:
( (pls) << 5 )

Port link state.

Definition at line 216 of file xhci.h.

◆ XHCI_PORTSC_PLS_DISABLED

#define XHCI_PORTSC_PLS_DISABLED   XHCI_PORTSC_PLS ( 4 )

Disabled port link state.

Definition at line 219 of file xhci.h.

Referenced by xhci_root_open().

◆ XHCI_PORTSC_PLS_RXDETECT

#define XHCI_PORTSC_PLS_RXDETECT   XHCI_PORTSC_PLS ( 5 )

RxDetect port link state.

Definition at line 222 of file xhci.h.

Referenced by xhci_root_disable(), and xhci_root_open().

◆ XHCI_PORTSC_PLS_MASK

#define XHCI_PORTSC_PLS_MASK   XHCI_PORTSC_PLS ( 0xf )

Port link state mask.

Definition at line 225 of file xhci.h.

Referenced by xhci_root_open().

◆ XHCI_PORTSC_PP

#define XHCI_PORTSC_PP   0x00000200UL

Port power.

Definition at line 228 of file xhci.h.

Referenced by xhci_dump_port(), and xhci_root_open().

◆ XHCI_PORT_POWER_DELAY_MS

#define XHCI_PORT_POWER_DELAY_MS   20

Time to delay after enabling power to a port.

Definition at line 231 of file xhci.h.

Referenced by xhci_root_open().

◆ XHCI_PORTSC_PSIV

#define XHCI_PORTSC_PSIV ( portsc)
Value:
( ( (portsc) >> 10 ) & 0xf )

Port speed ID value.

Definition at line 234 of file xhci.h.

Referenced by xhci_dump_port(), and xhci_root_speed().

◆ XHCI_PORTSC_PIC

#define XHCI_PORTSC_PIC ( indicators)
Value:
( (indicators) << 14 )

Port indicator control.

Definition at line 237 of file xhci.h.

◆ XHCI_PORTSC_PIC_MASK

#define XHCI_PORTSC_PIC_MASK   XHCI_PORTSC_PIC ( 3 )

Port indicator control mask.

Definition at line 240 of file xhci.h.

◆ XHCI_PORTSC_LWS

#define XHCI_PORTSC_LWS   0x00010000UL

Port link state write strobe.

Definition at line 243 of file xhci.h.

Referenced by xhci_root_disable(), and xhci_root_open().

◆ XHCI_LINK_STATE_DELAY_MS

#define XHCI_LINK_STATE_DELAY_MS   100

Time to delay after writing the port link state.

Definition at line 246 of file xhci.h.

Referenced by xhci_root_disable(), and xhci_root_open().

◆ XHCI_PORTSC_CSC

#define XHCI_PORTSC_CSC   0x00020000UL

Connect status change.

Definition at line 249 of file xhci.h.

Referenced by xhci_port_status(), and xhci_root_speed().

◆ XHCI_PORTSC_PEC

#define XHCI_PORTSC_PEC   0x00040000UL

Port enabled/disabled change.

Definition at line 252 of file xhci.h.

◆ XHCI_PORTSC_WRC

#define XHCI_PORTSC_WRC   0x00080000UL

Warm port reset change.

Definition at line 255 of file xhci.h.

◆ XHCI_PORTSC_OCC

#define XHCI_PORTSC_OCC   0x00100000UL

Over-current change.

Definition at line 258 of file xhci.h.

◆ XHCI_PORTSC_PRC

#define XHCI_PORTSC_PRC   0x00200000UL

Port reset change.

Definition at line 261 of file xhci.h.

◆ XHCI_PORTSC_PLC

#define XHCI_PORTSC_PLC   0x00400000UL

Port link state change.

Definition at line 264 of file xhci.h.

◆ XHCI_PORTSC_CEC

#define XHCI_PORTSC_CEC   0x00800000UL

Port config error change.

Definition at line 267 of file xhci.h.

◆ XHCI_PORTSC_CHANGE

#define XHCI_PORTSC_CHANGE
Value:
#define XHCI_PORTSC_WRC
Warm port reset change.
Definition xhci.h:255
#define XHCI_PORTSC_PLC
Port link state change.
Definition xhci.h:264
#define XHCI_PORTSC_CSC
Connect status change.
Definition xhci.h:249
#define XHCI_PORTSC_OCC
Over-current change.
Definition xhci.h:258
#define XHCI_PORTSC_PRC
Port reset change.
Definition xhci.h:261
#define XHCI_PORTSC_PEC
Port enabled/disabled change.
Definition xhci.h:252
#define XHCI_PORTSC_CEC
Port config error change.
Definition xhci.h:267

Port status change mask.

Definition at line 270 of file xhci.h.

270#define XHCI_PORTSC_CHANGE \
271 ( XHCI_PORTSC_CSC | XHCI_PORTSC_PEC | XHCI_PORTSC_WRC | \
272 XHCI_PORTSC_OCC | XHCI_PORTSC_PRC | XHCI_PORTSC_PLC | \
273 XHCI_PORTSC_CEC )

Referenced by xhci_port_status(), and xhci_root_speed().

◆ XHCI_PORTSC_PRESERVE

#define XHCI_PORTSC_PRESERVE   ( XHCI_PORTSC_PP | XHCI_PORTSC_PIC_MASK )

Port status and control bits which should be preserved.

The port status and control register is a horrendous mix of differing semantics. Some bits are written to only when a separate write strobe bit is set. Some bits should be preserved when modifying other bits. Some bits will be cleared if written back as a one. Most excitingly, the "port enabled" bit has the semantics that 1=enabled, 0=disabled, yet writing a 1 will disable the port.

Definition at line 284 of file xhci.h.

Referenced by xhci_port_status(), xhci_root_disable(), xhci_root_enable(), xhci_root_open(), and xhci_root_speed().

◆ XHCI_OP_PORTPMSC

#define XHCI_OP_PORTPMSC ( port)
Value:
( 0x404 - 0x10 + ( (port) << 4 ) )

Port power management status and control register.

Definition at line 287 of file xhci.h.

Referenced by xhci_dump_port().

◆ XHCI_OP_PORTLI

#define XHCI_OP_PORTLI ( port)
Value:
( 0x408 - 0x10 + ( (port) << 4 ) )

Port link info register.

Definition at line 290 of file xhci.h.

Referenced by xhci_dump_port().

◆ XHCI_OP_PORTHLPMC

#define XHCI_OP_PORTHLPMC ( port)
Value:
( 0x40c - 0x10 + ( (port) << 4 ) )

Port hardware link power management control register.

Definition at line 293 of file xhci.h.

Referenced by xhci_dump_port().

◆ XHCI_RUN_ERSTSZ

#define XHCI_RUN_ERSTSZ ( intr)
Value:
( 0x28 + ( (intr) << 5 ) )
uint8_t intr
Interrupts enabled.
Definition ena.h:3

Event ring segment table size register.

Definition at line 296 of file xhci.h.

Referenced by xhci_event_alloc(), and xhci_event_free().

◆ XHCI_RUN_ERSTBA

#define XHCI_RUN_ERSTBA ( intr)
Value:
( 0x30 + ( (intr) << 5 ) )

Event ring segment table base address register.

Definition at line 299 of file xhci.h.

Referenced by xhci_event_alloc(), and xhci_event_free().

◆ XHCI_RUN_ERDP

#define XHCI_RUN_ERDP ( intr)
Value:
( 0x38 + ( (intr) << 5 ) )

Event ring dequeue pointer register.

Definition at line 302 of file xhci.h.

Referenced by xhci_event_alloc(), xhci_event_free(), and xhci_event_poll().

◆ XHCI_TRB_C

#define XHCI_TRB_C   0x01

Transfer request block cycle bit flag.

Definition at line 329 of file xhci.h.

Referenced by xhci_enqueue(), and xhci_event_poll().

◆ XHCI_TRB_TC

#define XHCI_TRB_TC   0x02

Transfer request block toggle cycle bit flag.

Definition at line 332 of file xhci.h.

Referenced by xhci_enqueue(), and xhci_ring_alloc().

◆ XHCI_TRB_CH

#define XHCI_TRB_CH   0x10

Transfer request block chain flag.

Definition at line 335 of file xhci.h.

Referenced by xhci_endpoint_stream().

◆ XHCI_TRB_IOC

#define XHCI_TRB_IOC   0x20

Transfer request block interrupt on completion flag.

Definition at line 338 of file xhci.h.

Referenced by xhci_endpoint_message(), xhci_endpoint_stream(), and xhci_nop().

◆ XHCI_TRB_IDT

#define XHCI_TRB_IDT   0x40

Transfer request block immediate data flag.

Definition at line 341 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_TRB_TYPE

#define XHCI_TRB_TYPE ( type)
Value:
( (type) << 2 )
uint32_t type
Operating system type.
Definition ena.h:1

Transfer request block type.

Definition at line 344 of file xhci.h.

◆ XHCI_TRB_TYPE_MASK

#define XHCI_TRB_TYPE_MASK   XHCI_TRB_TYPE ( 0x3f )

Transfer request block type mask.

Definition at line 347 of file xhci.h.

Referenced by xhci_event_poll().

◆ XHCI_TRB_NORMAL

#define XHCI_TRB_NORMAL   XHCI_TRB_TYPE ( 1 )

A normal transfer request block.

Definition at line 364 of file xhci.h.

Referenced by xhci_endpoint_stream().

◆ XHCI_TD_SIZE

#define XHCI_TD_SIZE ( remaining)
Value:
( ( ( (remaining) <= 0xf ) ? remaining : 0xf ) << 17 )

Construct TD size field.

Definition at line 367 of file xhci.h.

367#define XHCI_TD_SIZE(remaining) \
368 ( ( ( (remaining) <= 0xf ) ? remaining : 0xf ) << 17 )

◆ XHCI_TRB_SETUP

#define XHCI_TRB_SETUP   XHCI_TRB_TYPE ( 2 )

A setup stage transfer request block.

Definition at line 387 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_SETUP_IN

#define XHCI_SETUP_IN   3

Setup stage input data direction.

Definition at line 390 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_SETUP_OUT

#define XHCI_SETUP_OUT   2

Setup stage output data direction.

Definition at line 393 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_TRB_DATA

#define XHCI_TRB_DATA   XHCI_TRB_TYPE ( 3 )

A data stage transfer request block.

Definition at line 412 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_DATA_IN

#define XHCI_DATA_IN   0x01

Input data direction.

Definition at line 415 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_DATA_OUT

#define XHCI_DATA_OUT   0x00

Output data direction.

Definition at line 418 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_TRB_STATUS

#define XHCI_TRB_STATUS   XHCI_TRB_TYPE ( 4 )

A status stage transfer request block.

Definition at line 437 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_STATUS_IN

#define XHCI_STATUS_IN   0x01

Input status direction.

Definition at line 440 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_STATUS_OUT

#define XHCI_STATUS_OUT   0x00

Output status direction.

Definition at line 443 of file xhci.h.

Referenced by xhci_endpoint_message().

◆ XHCI_TRB_LINK

#define XHCI_TRB_LINK   XHCI_TRB_TYPE ( 6 )

A link transfer request block.

Definition at line 460 of file xhci.h.

Referenced by xhci_ring_alloc().

◆ XHCI_TRB_NOP

#define XHCI_TRB_NOP   XHCI_TRB_TYPE ( 8 )

A no-op transfer request block.

Definition at line 463 of file xhci.h.

◆ XHCI_TRB_ENABLE_SLOT

#define XHCI_TRB_ENABLE_SLOT   XHCI_TRB_TYPE ( 9 )

An enable slot transfer request block.

Definition at line 482 of file xhci.h.

Referenced by xhci_enable_slot().

◆ XHCI_TRB_DISABLE_SLOT

#define XHCI_TRB_DISABLE_SLOT   XHCI_TRB_TYPE ( 10 )

A disable slot transfer request block.

Definition at line 501 of file xhci.h.

Referenced by xhci_disable_slot().

◆ XHCI_TRB_ADDRESS_DEVICE

#define XHCI_TRB_ADDRESS_DEVICE   XHCI_TRB_TYPE ( 11 )

An address device transfer request block.

Definition at line 520 of file xhci.h.

Referenced by xhci_address_device().

◆ XHCI_TRB_CONFIGURE_ENDPOINT

#define XHCI_TRB_CONFIGURE_ENDPOINT   XHCI_TRB_TYPE ( 12 )

A configure endpoint transfer request block.

Definition at line 523 of file xhci.h.

Referenced by xhci_configure_endpoint(), and xhci_deconfigure_endpoint().

◆ XHCI_TRB_EVALUATE_CONTEXT

#define XHCI_TRB_EVALUATE_CONTEXT   XHCI_TRB_TYPE ( 13 )

An evaluate context transfer request block.

Definition at line 526 of file xhci.h.

Referenced by xhci_evaluate_context().

◆ XHCI_TRB_RESET_ENDPOINT

#define XHCI_TRB_RESET_ENDPOINT   XHCI_TRB_TYPE ( 14 )

A reset endpoint transfer request block.

Definition at line 545 of file xhci.h.

Referenced by xhci_reset_endpoint().

◆ XHCI_TRB_STOP_ENDPOINT

#define XHCI_TRB_STOP_ENDPOINT   XHCI_TRB_TYPE ( 15 )

A stop endpoint transfer request block.

Definition at line 564 of file xhci.h.

Referenced by xhci_stop_endpoint().

◆ XHCI_TRB_SET_TR_DEQUEUE_POINTER

#define XHCI_TRB_SET_TR_DEQUEUE_POINTER   XHCI_TRB_TYPE ( 16 )

A set transfer ring dequeue pointer transfer request block.

Definition at line 583 of file xhci.h.

Referenced by xhci_set_tr_dequeue_pointer().

◆ XHCI_TRB_NOP_CMD

#define XHCI_TRB_NOP_CMD   XHCI_TRB_TYPE ( 23 )

A no-op command transfer request block.

Definition at line 586 of file xhci.h.

Referenced by xhci_nop().

◆ XHCI_TRB_TRANSFER

#define XHCI_TRB_TRANSFER   XHCI_TRB_TYPE ( 32 )

A transfer event transfer request block.

Definition at line 609 of file xhci.h.

Referenced by xhci_event_poll().

◆ XHCI_TRB_COMPLETE

#define XHCI_TRB_COMPLETE   XHCI_TRB_TYPE ( 33 )

A command completion event transfer request block.

Definition at line 630 of file xhci.h.

Referenced by xhci_event_poll().

◆ XHCI_TRB_PORT_STATUS

#define XHCI_TRB_PORT_STATUS   XHCI_TRB_TYPE ( 34 )

A port status change transfer request block.

Definition at line 661 of file xhci.h.

Referenced by xhci_event_poll().

◆ XHCI_TRB_HOST_CONTROLLER

#define XHCI_TRB_HOST_CONTROLLER   XHCI_TRB_TYPE ( 37 )

A port status change transfer request block.

Definition at line 680 of file xhci.h.

Referenced by xhci_event_poll().

◆ XHCI_SLOT_INFO

#define XHCI_SLOT_INFO ( entries,
hub,
speed,
route )
Value:
( ( (entries) << 27 ) | ( (hub) << 26 ) | ( (speed) << 20 ) | (route) )
void route(void)
Print routing table.
Definition route.c:40

Construct slot context device info.

Definition at line 765 of file xhci.h.

765#define XHCI_SLOT_INFO( entries, hub, speed, route ) \
766 ( ( (entries) << 27 ) | ( (hub) << 26 ) | ( (speed) << 20 ) | (route) )

Referenced by xhci_address_device_input(), xhci_configure_endpoint_input(), xhci_deconfigure_endpoint_input(), and xhci_evaluate_context_input().

◆ XHCI_ENDPOINT_STATE_MASK

#define XHCI_ENDPOINT_STATE_MASK   0x07

Endpoint state mask.

Definition at line 809 of file xhci.h.

Referenced by xhci_transfer().

◆ XHCI_EP_TYPE

#define XHCI_EP_TYPE ( type)
Value:
( (type) << 3 )

Endpoint type.

Definition at line 812 of file xhci.h.

Referenced by xhci_endpoint_open().

◆ XHCI_EP_TYPE_CONTROL

#define XHCI_EP_TYPE_CONTROL   XHCI_EP_TYPE ( 4 )

Control endpoint type.

Definition at line 815 of file xhci.h.

Referenced by xhci_address_device_input(), and xhci_endpoint_open().

◆ XHCI_EP_TYPE_IN

#define XHCI_EP_TYPE_IN   XHCI_EP_TYPE ( 4 )

Input endpoint type.

Definition at line 818 of file xhci.h.

Referenced by xhci_endpoint_open().

◆ XHCI_EP_TYPE_PERIODIC

#define XHCI_EP_TYPE_PERIODIC   XHCI_EP_TYPE ( 1 )

Periodic endpoint type.

Definition at line 821 of file xhci.h.

Referenced by xhci_endpoint_open().

◆ XHCI_EP_DCS

#define XHCI_EP_DCS   0x00000001UL

Endpoint dequeue cycle state.

Definition at line 824 of file xhci.h.

Referenced by xhci_address_device_input(), xhci_configure_endpoint_input(), and xhci_set_tr_dequeue_pointer().

◆ XHCI_EP0_TRB_LEN

#define XHCI_EP0_TRB_LEN   8

Control endpoint average TRB length.

Definition at line 827 of file xhci.h.

Referenced by xhci_address_device_input().

◆ XHCI_DBVAL

#define XHCI_DBVAL ( target,
stream )
Value:
( (target) | ( (stream) << 16 ) )

Calculate doorbell register value.

Parameters
targetDoorbell target
streamDoorbell stream ID
Return values
dbvalDoorbell register value

Definition at line 889 of file xhci.h.

Referenced by xhci_ring_alloc().

◆ XHCI_CTX_SLOT

#define XHCI_CTX_SLOT   0

◆ XHCI_CTX

#define XHCI_CTX ( address)
Value:
( (address) ? ( ( ( (address) & 0x0f ) << 1 ) | \
( ( (address) & 0x80 ) >> 7 ) ) : 1 )
uint64_t address
Base address.
Definition ena.h:13

Calculate context index from USB endpoint address.

Definition at line 946 of file xhci.h.

946#define XHCI_CTX(address) \
947 ( (address) ? ( ( ( (address) & 0x0f ) << 1 ) | \
948 ( ( (address) & 0x80 ) >> 7 ) ) : 1 )

Referenced by xhci_endpoint_open().

◆ XHCI_CTX_EP0

#define XHCI_CTX_EP0   XHCI_CTX ( 0x00 )

Endpoint zero context index.

Definition at line 951 of file xhci.h.

Referenced by xhci_address_device(), xhci_address_device_input(), xhci_endpoint_close(), and xhci_endpoint_open().

◆ XHCI_CTX_END

◆ XHCI_DCI

#define XHCI_DCI ( ctx)
Value:
( (ctx) + 0 )
struct golan_eq_context ctx
Definition CIB_PRM.h:0

Device context index.

Definition at line 957 of file xhci.h.

Referenced by xhci_device_context_offset().

◆ XHCI_ICI

#define XHCI_ICI ( ctx)
Value:
( (ctx) + 1 )

Input context index.

Definition at line 960 of file xhci.h.

Referenced by xhci_input_context_offset().

◆ XHCI_CMD_TRBS_LOG2

#define XHCI_CMD_TRBS_LOG2   2

Number of TRBs (excluding Link TRB) in the command ring.

This is a policy decision.

Definition at line 966 of file xhci.h.

Referenced by xhci_command_alloc().

◆ XHCI_EVENT_TRBS_LOG2

#define XHCI_EVENT_TRBS_LOG2   6

Number of TRBs in the event ring.

This is a policy decision.

Definition at line 972 of file xhci.h.

Referenced by xhci_event_alloc(), xhci_event_free(), and xhci_event_poll().

◆ XHCI_TRANSFER_TRBS_LOG2

#define XHCI_TRANSFER_TRBS_LOG2   6

Number of TRBs in a transfer ring.

This is a policy decision.

Definition at line 978 of file xhci.h.

Referenced by xhci_endpoint_open().

◆ XHCI_USBLEGSUP_MAX_WAIT_MS

#define XHCI_USBLEGSUP_MAX_WAIT_MS   100

Maximum time to wait for BIOS to release ownership.

This is a policy decision.

Definition at line 984 of file xhci.h.

Referenced by xhci_legacy_claim().

◆ XHCI_STOP_MAX_WAIT_MS

#define XHCI_STOP_MAX_WAIT_MS   100

Maximum time to wait for host controller to stop.

This is a policy decision.

Definition at line 990 of file xhci.h.

Referenced by xhci_stop().

◆ XHCI_RESET_MAX_WAIT_MS

#define XHCI_RESET_MAX_WAIT_MS   500

Maximum time to wait for reset to complete.

This is a policy decision.

Definition at line 996 of file xhci.h.

Referenced by xhci_reset().

◆ XHCI_COMMAND_MAX_WAIT_MS

#define XHCI_COMMAND_MAX_WAIT_MS   USB_CONTROL_MAX_WAIT_MS

Maximum time to wait for a command to complete.

The "address device" command involves waiting for a response to a USB control transaction, and so we must wait for up to the 5000ms that USB allows for devices to respond to control transactions.

Definition at line 1004 of file xhci.h.

Referenced by xhci_command().

◆ XHCI_COMMAND_ABORT_DELAY_MS

#define XHCI_COMMAND_ABORT_DELAY_MS   500

Time to delay after aborting a command.

This is a policy decision

Definition at line 1010 of file xhci.h.

Referenced by xhci_abort().

◆ XHCI_PORT_RESET_MAX_WAIT_MS

#define XHCI_PORT_RESET_MAX_WAIT_MS   500

Maximum time to wait for a port reset to complete.

This is a policy decision.

Definition at line 1016 of file xhci.h.

Referenced by xhci_root_enable().

◆ XHCI_PCH

#define XHCI_PCH   0x0001

Intel PCH quirk flag.

Definition at line 1027 of file xhci.h.

Referenced by xhci_probe(), and xhci_remove().

◆ XHCI_PCH_XUSB2PR

#define XHCI_PCH_XUSB2PR   0xd0

Intel PCH USB2 port routing register.

Definition at line 1030 of file xhci.h.

Referenced by xhci_pch_fix(), and xhci_pch_undo().

◆ XHCI_PCH_XUSB2PRM

#define XHCI_PCH_XUSB2PRM   0xd4

Intel PCH USB2 port routing mask register.

Definition at line 1033 of file xhci.h.

Referenced by xhci_pch_fix().

◆ XHCI_PCH_USB3PSSEN

#define XHCI_PCH_USB3PSSEN   0xd8

Intel PCH SuperSpeed enable register.

Definition at line 1036 of file xhci.h.

Referenced by xhci_pch_fix(), and xhci_pch_undo().

◆ XHCI_PCH_USB3PRM

#define XHCI_PCH_USB3PRM   0xdc

Intel PCH USB3 port routing mask register.

Definition at line 1039 of file xhci.h.

Referenced by xhci_pch_fix().

◆ XHCI_BAD_PSIV

#define XHCI_BAD_PSIV   0x0002

Invalid protocol speed ID values quirk.

Definition at line 1042 of file xhci.h.

Referenced by xhci_port_protocol(), xhci_port_psiv(), and xhci_port_speed().

Enumeration Type Documentation

◆ xhci_default_psi_value

Default PSI values.

Enumerator
XHCI_SPEED_FULL 

Full speed (12Mbps)

XHCI_SPEED_LOW 

Low speed (1.5Mbps)

XHCI_SPEED_HIGH 

High speed (480Mbps)

XHCI_SPEED_SUPER 

Super speed.

Definition at line 143 of file xhci.h.

143 {
144 /** Full speed (12Mbps) */
145 XHCI_SPEED_FULL = 1,
146 /** Low speed (1.5Mbps) */
147 XHCI_SPEED_LOW = 2,
148 /** High speed (480Mbps) */
149 XHCI_SPEED_HIGH = 3,
150 /** Super speed */
152};
@ XHCI_SPEED_SUPER
Super speed.
Definition xhci.h:151
@ XHCI_SPEED_FULL
Full speed (12Mbps)
Definition xhci.h:145
@ XHCI_SPEED_LOW
Low speed (1.5Mbps)
Definition xhci.h:147
@ XHCI_SPEED_HIGH
High speed (480Mbps)
Definition xhci.h:149

◆ xhci_completion_code

xHCI completion codes

Enumerator
XHCI_CMPLT_SUCCESS 

Success.

XHCI_CMPLT_SHORT 

Short packet.

XHCI_CMPLT_CMD_STOPPED 

Command ring stopped.

Definition at line 633 of file xhci.h.

633 {
634 /** Success */
636 /** Short packet */
637 XHCI_CMPLT_SHORT = 13,
638 /** Command ring stopped */
640};
@ XHCI_CMPLT_SUCCESS
Success.
Definition xhci.h:635
@ XHCI_CMPLT_CMD_STOPPED
Command ring stopped.
Definition xhci.h:639
@ XHCI_CMPLT_SHORT
Short packet.
Definition xhci.h:637

◆ xhci_endpoint_state

Endpoint states.

Enumerator
XHCI_ENDPOINT_DISABLED 

Endpoint is disabled.

XHCI_ENDPOINT_RUNNING 

Endpoint is running.

XHCI_ENDPOINT_HALTED 

Endpoint is halted due to a USB Halt condition.

XHCI_ENDPOINT_STOPPED 

Endpoint is stopped.

XHCI_ENDPOINT_ERROR 

Endpoint is halted due to a TRB error.

Definition at line 795 of file xhci.h.

795 {
796 /** Endpoint is disabled */
798 /** Endpoint is running */
800 /** Endpoint is halted due to a USB Halt condition */
802 /** Endpoint is stopped */
804 /** Endpoint is halted due to a TRB error */
806};
@ XHCI_ENDPOINT_DISABLED
Endpoint is disabled.
Definition xhci.h:797
@ XHCI_ENDPOINT_ERROR
Endpoint is halted due to a TRB error.
Definition xhci.h:805
@ XHCI_ENDPOINT_HALTED
Endpoint is halted due to a USB Halt condition.
Definition xhci.h:801
@ XHCI_ENDPOINT_STOPPED
Endpoint is stopped.
Definition xhci.h:803
@ XHCI_ENDPOINT_RUNNING
Endpoint is running.
Definition xhci.h:799

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL )

◆ FILE_SECBOOT()

FILE_SECBOOT ( PERMITTED )

◆ xhci_ring_fill()

unsigned int xhci_ring_fill ( struct xhci_trb_ring * ring)
inlinestatic

Calculate space used in TRB ring.

Parameters
ringTRB ring
Return values
fillNumber of entries used

Definition at line 898 of file xhci.h.

898 {
899
900 return ( ring->prod - ring->cons );
901}
unsigned int cons
Consumer counter.
Definition xhci.h:844
unsigned int prod
Producer counter.
Definition xhci.h:842

References xhci_trb_ring::cons, and xhci_trb_ring::prod.

Referenced by xhci_dequeue(), xhci_endpoint_close(), and xhci_ring_remaining().

◆ xhci_ring_remaining()

unsigned int xhci_ring_remaining ( struct xhci_trb_ring * ring)
inlinestatic

Calculate space remaining in TRB ring.

Parameters
ringTRB ring
Return values
remainingNumber of entries remaining

xHCI does not allow us to completely fill a ring; there must be at least one free entry (excluding the Link TRB).

Definition at line 913 of file xhci.h.

913 {
914 unsigned int fill = xhci_ring_fill ( ring );
915
916 /* We choose to utilise rings with ( 2^n + 1 ) entries, with
917 * the final entry being a Link TRB. The maximum fill level
918 * is therefore
919 *
920 * ( ( 2^n + 1 ) - 1 (Link TRB) - 1 (one slot always empty)
921 * == ( 2^n - 1 )
922 *
923 * which is therefore equal to the ring mask.
924 */
925 assert ( fill <= ring->mask );
926 return ( ring->mask - fill );
927}
static int fill
Definition string.h:209
#define assert(condition)
Assert a condition at run-time.
Definition assert.h:50
unsigned int mask
Ring counter mask.
Definition xhci.h:848
static unsigned int xhci_ring_fill(struct xhci_trb_ring *ring)
Calculate space used in TRB ring.
Definition xhci.h:898

References assert, fill, xhci_trb_ring::mask, and xhci_ring_fill().

Referenced by xhci_enqueue(), and xhci_enqueue_multi().

◆ xhci_ring_consumed()

physaddr_t xhci_ring_consumed ( struct xhci_trb_ring * ring)
inlinestatic

Calculate physical address of most recently consumed TRB.

Parameters
ringTRB ring
Return values
trbTRB physical address

Definition at line 936 of file xhci.h.

936 {
937 unsigned int index = ( ( ring->cons - 1 ) & ring->mask );
938
939 return virt_to_phys ( &ring->trb[index] );
940}
union xhci_trb * trb
Transfer request blocks.
Definition xhci.h:854

References xhci_trb_ring::cons, index, xhci_trb_ring::mask, and xhci_trb_ring::trb.

Referenced by xhci_complete(), and xhci_transfer().

◆ xhci_init()

void xhci_init ( struct xhci_device * xhci)
extern

Initialise device.

Parameters
xhcixHCI device

Definition at line 264 of file xhci.c.

264 {
265 uint32_t hcsparams1;
266 uint32_t hcsparams2;
267 uint32_t hccparams1;
268 uint32_t pagesize;
269 size_t caplength;
270 size_t rtsoff;
271 size_t dboff;
272
273 /* Set device name */
274 xhci->name = xhci->dev->name;
275
276 /* Locate capability, operational, runtime, and doorbell registers */
277 xhci->cap = xhci->regs;
278 caplength = readb ( xhci->cap + XHCI_CAP_CAPLENGTH );
279 rtsoff = readl ( xhci->cap + XHCI_CAP_RTSOFF );
280 dboff = readl ( xhci->cap + XHCI_CAP_DBOFF );
281 xhci->op = ( xhci->cap + caplength );
282 xhci->run = ( xhci->cap + rtsoff );
283 xhci->db = ( xhci->cap + dboff );
284 DBGC2 ( xhci, "XHCI %s cap %08lx op %08lx run %08lx db %08lx\n",
285 xhci->name, virt_to_phys ( xhci->cap ),
286 virt_to_phys ( xhci->op ), virt_to_phys ( xhci->run ),
287 virt_to_phys ( xhci->db ) );
288
289 /* Read structural parameters 1 */
290 hcsparams1 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS1 );
291 xhci->slots = XHCI_HCSPARAMS1_SLOTS ( hcsparams1 );
292 xhci->intrs = XHCI_HCSPARAMS1_INTRS ( hcsparams1 );
293 xhci->ports = XHCI_HCSPARAMS1_PORTS ( hcsparams1 );
294 DBGC ( xhci, "XHCI %s has %d slots %d intrs %d ports\n",
295 xhci->name, xhci->slots, xhci->intrs, xhci->ports );
296
297 /* Read structural parameters 2 */
298 hcsparams2 = readl ( xhci->cap + XHCI_CAP_HCSPARAMS2 );
299 xhci->scratch.count = XHCI_HCSPARAMS2_SCRATCHPADS ( hcsparams2 );
300 DBGC2 ( xhci, "XHCI %s needs %d scratchpads\n",
301 xhci->name, xhci->scratch.count );
302
303 /* Read capability parameters 1 */
304 hccparams1 = readl ( xhci->cap + XHCI_CAP_HCCPARAMS1 );
305 xhci->addr64 = XHCI_HCCPARAMS1_ADDR64 ( hccparams1 );
306 xhci->csz_shift = XHCI_HCCPARAMS1_CSZ_SHIFT ( hccparams1 );
307 xhci->xecp = XHCI_HCCPARAMS1_XECP ( hccparams1 );
308
309 /* Read page size */
310 pagesize = readl ( xhci->op + XHCI_OP_PAGESIZE );
311 xhci->pagesize = XHCI_PAGESIZE ( pagesize );
312 assert ( xhci->pagesize != 0 );
313 assert ( ( ( xhci->pagesize ) & ( xhci->pagesize - 1 ) ) == 0 );
314 DBGC2 ( xhci, "XHCI %s page size %zd bytes\n",
315 xhci->name, xhci->pagesize );
316
317 /* Configure DMA device */
318 if ( xhci->dma && xhci->addr64 )
319 dma_set_mask_64bit ( xhci->dma );
320}
unsigned int uint32_t
Definition stdint.h:12
#define DBGC2(...)
Definition compiler.h:522
#define DBGC(...)
Definition compiler.h:505
static __always_inline void dma_set_mask_64bit(struct dma_device *dma)
Set 64-bit addressable space mask.
Definition dma.h:467
char name[40]
Name.
Definition device.h:79
unsigned int csz_shift
Context size shift.
Definition xhci.h:1098
unsigned int xecp
xHCI extended capabilities offset
Definition xhci.h:1100
struct device * dev
Underlying hardware device.
Definition xhci.h:1071
const char * name
Name.
Definition xhci.h:1075
void * db
Doorbell registers.
Definition xhci.h:1086
void * op
Operational registers.
Definition xhci.h:1082
void * run
Runtime registers.
Definition xhci.h:1084
unsigned int intrs
Number of interrupters.
Definition xhci.h:1091
unsigned int slots
Number of device slots.
Definition xhci.h:1089
int addr64
64-bit addressing capability
Definition xhci.h:1096
size_t pagesize
Page size.
Definition xhci.h:1103
struct xhci_scratchpad scratch
Scratchpad buffer.
Definition xhci.h:1112
void * regs
Registers.
Definition xhci.h:1069
struct dma_device * dma
DMA device.
Definition xhci.h:1073
void * cap
Capability registers.
Definition xhci.h:1080
unsigned int ports
Number of ports.
Definition xhci.h:1093
unsigned int count
Number of page-sized scratchpad buffers.
Definition xhci.h:1055
#define readl
Definition w89c840.c:157
#define readb
Definition w89c840.c:155
#define XHCI_CAP_HCSPARAMS1
Structural parameters 1.
Definition xhci.h:40
#define XHCI_HCCPARAMS1_ADDR64(params)
64-bit addressing capability
Definition xhci.h:62
#define XHCI_OP_PAGESIZE
Page size register.
Definition xhci.h:170
#define XHCI_HCSPARAMS1_SLOTS(params)
Number of device slots.
Definition xhci.h:43
#define XHCI_CAP_DBOFF
Doorbell offset.
Definition xhci.h:71
#define XHCI_CAP_HCSPARAMS2
Structural parameters 2.
Definition xhci.h:52
#define XHCI_PAGESIZE(pagesize)
Page size.
Definition xhci.h:173
#define XHCI_CAP_RTSOFF
Runtime register space offset.
Definition xhci.h:74
#define XHCI_HCCPARAMS1_XECP(params)
xHCI extended capabilities pointer
Definition xhci.h:68
#define XHCI_HCSPARAMS1_INTRS(params)
Number of interrupters.
Definition xhci.h:46
#define XHCI_HCSPARAMS2_SCRATCHPADS(params)
Number of page-sized scratchpad buffers.
Definition xhci.h:55
#define XHCI_CAP_HCCPARAMS1
Capability parameters.
Definition xhci.h:59
#define XHCI_HCCPARAMS1_CSZ_SHIFT(params)
Context size shift.
Definition xhci.h:65
#define XHCI_HCSPARAMS1_PORTS(params)
Number of ports.
Definition xhci.h:49
#define XHCI_CAP_CAPLENGTH
Capability register length.
Definition xhci.h:34

References xhci_device::addr64, assert, xhci_device::cap, xhci_scratchpad::count, xhci_device::csz_shift, xhci_device::db, DBGC, DBGC2, xhci_device::dev, xhci_device::dma, dma_set_mask_64bit(), xhci_device::intrs, device::name, xhci_device::name, xhci_device::op, xhci_device::pagesize, xhci_device::ports, readb, readl, xhci_device::regs, xhci_device::run, xhci_device::scratch, xhci_device::slots, xhci_device::xecp, XHCI_CAP_CAPLENGTH, XHCI_CAP_DBOFF, XHCI_CAP_HCCPARAMS1, XHCI_CAP_HCSPARAMS1, XHCI_CAP_HCSPARAMS2, XHCI_CAP_RTSOFF, XHCI_HCCPARAMS1_ADDR64, XHCI_HCCPARAMS1_CSZ_SHIFT, XHCI_HCCPARAMS1_XECP, XHCI_HCSPARAMS1_INTRS, XHCI_HCSPARAMS1_PORTS, XHCI_HCSPARAMS1_SLOTS, XHCI_HCSPARAMS2_SCRATCHPADS, XHCI_OP_PAGESIZE, and XHCI_PAGESIZE.

Referenced by dwusb_probe(), and xhci_probe().

◆ xhci_register()

int xhci_register ( struct xhci_device * xhci)
extern

Register xHCI controller.

Parameters
xhcixHCI device
Return values
rcReturn status code

Definition at line 3319 of file xhci.c.

3319 {
3320 struct usb_port *port;
3321 unsigned int i;
3322 int rc;
3323
3324 /* Reset device */
3325 if ( ( rc = xhci_reset ( xhci ) ) != 0 )
3326 goto err_reset;
3327
3328 /* Allocate USB bus */
3329 xhci->bus = alloc_usb_bus ( xhci->dev, xhci->ports, XHCI_MTU,
3330 &xhci_operations );
3331 if ( ! xhci->bus ) {
3332 rc = -ENOMEM;
3333 goto err_alloc_bus;
3334 }
3335 usb_bus_set_hostdata ( xhci->bus, xhci );
3336 usb_hub_set_drvdata ( xhci->bus->hub, xhci );
3337
3338 /* Set port protocols */
3339 for ( i = 1 ; i <= xhci->ports ; i++ ) {
3340 port = usb_port ( xhci->bus->hub, i );
3341 port->protocol = xhci_port_protocol ( xhci, i );
3342 }
3343
3344 /* Register USB bus */
3345 if ( ( rc = register_usb_bus ( xhci->bus ) ) != 0 )
3346 goto err_register;
3347
3348 return 0;
3349
3350 unregister_usb_bus ( xhci->bus );
3351 err_register:
3352 free_usb_bus ( xhci->bus );
3353 err_alloc_bus:
3354 xhci_reset ( xhci );
3355 err_reset:
3356 return rc;
3357}
struct arbelprm_rc_send_wqe rc
Definition arbel.h:3
#define ENOMEM
Not enough space.
Definition errno.h:535
static struct usb_port * usb_port(struct usb_hub *hub, unsigned int address)
Get USB port.
Definition usb.h:960
static void usb_hub_set_drvdata(struct usb_hub *hub, void *priv)
Set USB hub driver private data.
Definition usb.h:937
static void usb_bus_set_hostdata(struct usb_bus *bus, void *priv)
Set USB bus host controller private data.
Definition usb.h:1051
struct usb_hub * hub
Root hub.
Definition usb.h:995
A USB port.
Definition usb.h:813
struct usb_bus * bus
USB bus.
Definition xhci.h:1127
void unregister_usb_bus(struct usb_bus *bus)
Unregister USB bus.
Definition usb.c:2171
int register_usb_bus(struct usb_bus *bus)
Register USB bus.
Definition usb.c:2131
struct usb_bus * alloc_usb_bus(struct device *dev, unsigned int ports, size_t mtu, struct usb_host_operations *op)
Allocate USB bus.
Definition usb.c:2095
void free_usb_bus(struct usb_bus *bus)
Free USB bus.
Definition usb.c:2195
static unsigned int xhci_port_protocol(struct xhci_device *xhci, unsigned int port)
Find port protocol.
Definition xhci.c:706
static struct usb_host_operations xhci_operations
USB host controller operations.
Definition xhci.c:3280
static int xhci_reset(struct xhci_device *xhci)
Reset xHCI device.
Definition xhci.c:1142
#define XHCI_MTU
Maximum transfer size.
Definition xhci.h:28

References alloc_usb_bus(), xhci_device::bus, xhci_device::dev, ENOMEM, free_usb_bus(), usb_bus::hub, port, xhci_device::ports, rc, register_usb_bus(), unregister_usb_bus(), usb_bus_set_hostdata(), usb_hub_set_drvdata(), usb_port(), XHCI_MTU, xhci_operations, xhci_port_protocol(), and xhci_reset().

Referenced by dwusb_probe(), and xhci_probe().

◆ xhci_unregister()

void xhci_unregister ( struct xhci_device * xhci)
extern

Unregister xHCI controller.

Parameters
xhcixHCI device

Definition at line 3364 of file xhci.c.

3364 {
3365 struct usb_bus *bus = xhci->bus;
3366
3367 /* Unregister and free USB bus */
3369 free_usb_bus ( bus );
3370
3371 /* Reset device */
3372 xhci_reset ( xhci );
3373}
uint8_t bus
Bus.
Definition edd.h:1
A USB bus.
Definition usb.h:966

References bus, xhci_device::bus, free_usb_bus(), unregister_usb_bus(), and xhci_reset().

Referenced by dwusb_probe(), dwusb_remove(), xhci_probe(), and xhci_remove().