10#ifndef _EFI_XHCI_REG_H_
11#define _EFI_XHCI_REG_H_
13#define PCI_IF_XHCI 0x30
18#define XHC_BAR_INDEX 0x00
20#define XHC_PCI_BAR_OFFSET 0x10
21#define XHC_PCI_BAR_MASK 0xFFFF
23#define XHC_PCI_SBRN_OFFSET 0x60
25#define USB_HUB_CLASS_CODE 0x09
26#define USB_HUB_SUBCLASS_CODE 0x00
28#define XHC_CAP_USB_LEGACY 0x01
29#define XHC_CAP_USB_DEBUG 0x0A
30#define XHC_CAP_USB_SUPPORTED_PROTOCOL 0x02
39#define XHC_CAPLENGTH_OFFSET 0x00
40#define XHC_HCIVERSION_OFFSET 0x02
41#define XHC_HCSPARAMS1_OFFSET 0x04
42#define XHC_HCSPARAMS2_OFFSET 0x08
43#define XHC_HCSPARAMS3_OFFSET 0x0c
44#define XHC_HCCPARAMS_OFFSET 0x10
45#define XHC_DBOFF_OFFSET 0x14
46#define XHC_RTSOFF_OFFSET 0x18
51#define XHC_USBCMD_OFFSET 0x0000
52#define XHC_USBSTS_OFFSET 0x0004
53#define XHC_PAGESIZE_OFFSET 0x0008
54#define XHC_DNCTRL_OFFSET 0x0014
55#define XHC_CRCR_OFFSET 0x0018
56#define XHC_DCBAAP_OFFSET 0x0030
57#define XHC_CONFIG_OFFSET 0x0038
58#define XHC_PORTSC_OFFSET 0x0400
63#define XHC_MFINDEX_OFFSET 0x00
64#define XHC_IMAN_OFFSET 0x20
65#define XHC_IMOD_OFFSET 0x24
66#define XHC_ERSTSZ_OFFSET 0x28
67#define XHC_ERSTBA_OFFSET 0x30
68#define XHC_ERDP_OFFSET 0x38
73#define XHC_DC_DCCTRL 0x20
75#define USBLEGSP_BIOS_SEMAPHORE BIT16
76#define USBLEGSP_OS_SEMAPHORE BIT24
81#define XHC_SUPPORTED_PROTOCOL_DW0_MAJOR_REVISION_USB2 0x02
82#define XHC_SUPPORTED_PROTOCOL_DW0_MAJOR_REVISION_USB3 0x03
83#define XHC_SUPPORTED_PROTOCOL_NAME_STRING_OFFSET 0x04
84#define XHC_SUPPORTED_PROTOCOL_NAME_STRING_VALUE 0x20425355
85#define XHC_SUPPORTED_PROTOCOL_DW2_OFFSET 0x08
86#define XHC_SUPPORTED_PROTOCOL_PSI_OFFSET 0x10
87#define XHC_SUPPORTED_PROTOCOL_USB2_HIGH_SPEED_PSIM 480
88#define XHC_SUPPORTED_PROTOCOL_USB2_LOW_SPEED_PSIM 1500
110 UINT32 ScratchBufHi : 5;
112 UINT32 ScratchBufLo : 5;
134 UINT16 MaxPsaSize : 4;
166 UINT8 CompPortOffset;
168 UINT16 ProtocolDef : 12;
197#define XHC_USBCMD_RUN BIT0
198#define XHC_USBCMD_RESET BIT1
199#define XHC_USBCMD_INTE BIT2
200#define XHC_USBCMD_HSEE BIT3
202#define XHC_USBSTS_HALT BIT0
203#define XHC_USBSTS_HSE BIT2
204#define XHC_USBSTS_EINT BIT3
205#define XHC_USBSTS_PCD BIT4
206#define XHC_USBSTS_SSS BIT8
207#define XHC_USBSTS_RSS BIT9
208#define XHC_USBSTS_SRE BIT10
209#define XHC_USBSTS_CNR BIT11
210#define XHC_USBSTS_HCE BIT12
212#define XHC_PAGESIZE_MASK 0xFFFF
214#define XHC_CRCR_RCS BIT0
215#define XHC_CRCR_CS BIT1
216#define XHC_CRCR_CA BIT2
217#define XHC_CRCR_CRR BIT3
219#define XHC_CONFIG_MASK 0xFF
221#define XHC_PORTSC_CCS BIT0
222#define XHC_PORTSC_PED BIT1
223#define XHC_PORTSC_OCA BIT3
224#define XHC_PORTSC_RESET BIT4
225#define XHC_PORTSC_PLS (BIT5|BIT6|BIT7|BIT8)
226#define XHC_PORTSC_PP BIT9
227#define XHC_PORTSC_PS (BIT10|BIT11|BIT12|BIT13)
228#define XHC_PORTSC_LWS BIT16
229#define XHC_PORTSC_CSC BIT17
230#define XHC_PORTSC_PEC BIT18
231#define XHC_PORTSC_WRC BIT19
232#define XHC_PORTSC_OCC BIT20
233#define XHC_PORTSC_PRC BIT21
234#define XHC_PORTSC_PLC BIT22
235#define XHC_PORTSC_CEC BIT23
236#define XHC_PORTSC_CAS BIT24
238#define XHC_HUB_PORTSC_CCS BIT0
239#define XHC_HUB_PORTSC_PED BIT1
240#define XHC_HUB_PORTSC_OCA BIT3
241#define XHC_HUB_PORTSC_RESET BIT4
242#define XHC_HUB_PORTSC_PP BIT9
243#define XHC_HUB_PORTSC_CSC BIT16
244#define XHC_HUB_PORTSC_PEC BIT17
245#define XHC_HUB_PORTSC_OCC BIT19
246#define XHC_HUB_PORTSC_PRC BIT20
247#define XHC_HUB_PORTSC_BHRC BIT21
248#define XHC_IMAN_IP BIT0
249#define XHC_IMAN_IE BIT1
251#define XHC_IMODI_MASK 0x0000FFFF
252#define XHC_IMODC_MASK 0xFFFF0000
260 Usb3PortBHPortReset = 28,
261 Usb3PortBHPortResetChange = 29
438 IN BOOLEAN WaitToSet,
620 IN UINT8 MajorVersion
VOID XhcSetRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit)
EFI_STATUS XhcResetHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
BOOLEAN XhcIsSysError(IN USB_XHCI_INSTANCE *Xhc)
UINT32 XhcReadRuntimeReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
EFI_STATUS XhcRunHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
UINT32 XhcGetCapabilityAddr(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 CapId)
EFI_STATUS XhcHaltHC(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Timeout)
VOID XhcClearRuntimeRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit)
UINT16 XhcCheckUsbPortSpeedUsedPsic(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 PortSpeed, IN UINT8 PortNumber)
VOID XhcWriteRuntimeReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Data)
VOID XhcClearOpRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit)
UINT32 XhcReadExtCapReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
VOID XhcWriteOpReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Data)
UINT32 XhcGetSupportedProtocolCapabilityAddr(IN USB_XHCI_INSTANCE *Xhc, IN UINT8 MajorVersion)
UINT32 XhcReadCapReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
VOID XhcSetOpRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit)
VOID XhcWriteDoorBellReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Data)
UINT32 XhcReadOpReg(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
BOOLEAN XhcIsHalt(IN USB_XHCI_INSTANCE *Xhc)
UINT8 XhcReadCapReg8(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset)
EFI_STATUS XhcWaitOpRegBit(IN USB_XHCI_INSTANCE *Xhc, IN UINT32 Offset, IN UINT32 Bit, IN BOOLEAN WaitToSet, IN UINT32 Timeout)