10#ifndef _RECOVERY_XHC_H_
11#define _RECOVERY_XHC_H_
35#define CMD_RING_TRB_NUMBER 0x100
36#define TR_RING_TRB_NUMBER 0x100
37#define ERST_NUMBER 0x01
38#define EVENT_RING_TRB_NUMBER 0x200
40#define XHC_1_MICROSECOND 1
41#define XHC_1_MILLISECOND (1000 * XHC_1_MICROSECOND)
42#define XHC_1_SECOND (1000 * XHC_1_MILLISECOND)
48#define XHC_RESET_TIMEOUT (1000)
54#define XHC_RESET_RECOVERY_DELAY (10 * 1000)
59#define XHC_ROOT_PORT_STATE_STABLE (200 * XHC_1_MILLISECOND)
65#define XHC_GENERIC_TIMEOUT (10 * 1000)
67#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0XFFFFFFFF))
68#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINTN)(Addr64), 32) & 0XFFFFFFFF))
69#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
71#define XHC_REG_BIT_IS_SET(XHC, Offset, Bit) \
72 (XHC_BIT_IS_SET(XhcPeiReadOpReg ((XHC), (Offset)), (Bit)))
74#define USB_DESC_TYPE_HUB 0x29
75#define USB_DESC_TYPE_HUB_SUPER_SPEED 0x2a
82#define USB_REQUEST_TYPE(Dir, Type, Target) \
83 ((UINT8)((((Dir) == EfiUsbDataIn ? 0x01 : 0) << 7) | (Type) | (Target)))
126 VOID *EndpointTransferRing[31];
141#define USB_XHC_DEV_SIGNATURE SIGNATURE_32 ('x', 'h', 'c', 'i')
147 UINT32 UsbHostControllerBaseAddress;
166 UINT32 MaxScratchpadBufs;
169 UINT64 *ScratchEntry;
170 UINTN *ScratchEntryMap;
189#define PEI_RECOVERY_USB_XHC_DEV_FROM_THIS(a) CR (a, PEI_XHC_DEV, Usb2HostControllerPpi, USB_XHC_DEV_SIGNATURE)
190#define PEI_RECOVERY_USB_XHC_DEV_FROM_THIS_NOTIFY(a) CR (a, PEI_XHC_DEV, EndOfPeiNotifyList, USB_XHC_DEV_SIGNATURE)
279 IN VOID *HostAddress,
320 OUT VOID **HostAddress,
340 IN VOID *HostAddress,
367 OUT VOID **HostAddress,
UINT64 EFI_PHYSICAL_ADDRESS
VOID UsbHcFreeMemPool(IN USBHC_MEM_POOL *Pool)
EFI_STATUS IoMmuUnmap(IN VOID *Mapping)
EFI_STATUS IoMmuAllocateBuffer(IN UINTN Pages, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS IoMmuMap(IN EDKII_IOMMU_OPERATION Operation, IN VOID *HostAddress, IN OUT UINTN *NumberOfBytes, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
EFI_STATUS IoMmuAllocateAlignedBuffer(IN UINTN Pages, IN UINTN Alignment, OUT VOID **HostAddress, OUT EFI_PHYSICAL_ADDRESS *DeviceAddress, OUT VOID **Mapping)
VOID UsbHcFreeMem(IN USBHC_MEM_POOL *Pool, IN VOID *Mem, IN UINTN Size)
VOID * UsbHcAllocateMem(IN USBHC_MEM_POOL *Pool, IN UINTN Size)
EFI_STATUS IoMmuFreeBuffer(IN UINTN Pages, IN VOID *HostAddress, IN VOID *Mapping)
USBHC_MEM_POOL * UsbHcInitMemPool(VOID)
XHC_HCSPARAMS1 HcSParams1
Structural Parameters 1.
UINT32 DBOff
Doorbell Offset.
UINT32 RTSOff
Runtime Register Space Offset.
UINT8 CapLength
Capability Register Length.
XHC_HCSPARAMS2 HcSParams2
Structural Parameters 2.
XHC_HCCPARAMS HcCParams
Capability Parameters.