MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
This commit is contained in:
committed by
mergify[bot]
parent
7c7184e201
commit
1436aea4d5
@@ -21,15 +21,15 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName =
|
||||
//
|
||||
// EFI Component Name 2 Protocol
|
||||
//
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME) XhciComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME) XhciComponentNameGetControllerName,
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2 = {
|
||||
(EFI_COMPONENT_NAME2_GET_DRIVER_NAME)XhciComponentNameGetDriverName,
|
||||
(EFI_COMPONENT_NAME2_GET_CONTROLLER_NAME)XhciComponentNameGetControllerName,
|
||||
"en"
|
||||
};
|
||||
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mXhciDriverNameTable[] = {
|
||||
GLOBAL_REMOVE_IF_UNREFERENCED EFI_UNICODE_STRING_TABLE mXhciDriverNameTable[] = {
|
||||
{ "eng;en", L"Usb Xhci Driver" },
|
||||
{ NULL , NULL }
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -166,9 +166,9 @@ XhciComponentNameGetControllerName (
|
||||
OUT CHAR16 **ControllerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_USB2_HC_PROTOCOL *Usb2Hc;
|
||||
USB_XHCI_INSTANCE *XhciDev;
|
||||
EFI_STATUS Status;
|
||||
EFI_USB2_HC_PROTOCOL *Usb2Hc;
|
||||
USB_XHCI_INSTANCE *XhciDev;
|
||||
|
||||
//
|
||||
// This is a device driver, so ChildHandle must be NULL.
|
||||
@@ -195,7 +195,7 @@ XhciComponentNameGetControllerName (
|
||||
Status = gBS->OpenProtocol (
|
||||
ControllerHandle,
|
||||
&gEfiUsb2HcProtocolGuid,
|
||||
(VOID **) &Usb2Hc,
|
||||
(VOID **)&Usb2Hc,
|
||||
gXhciDriverBinding.DriverBindingHandle,
|
||||
ControllerHandle,
|
||||
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||
@@ -213,5 +213,4 @@ XhciComponentNameGetControllerName (
|
||||
ControllerName,
|
||||
(BOOLEAN)(This == &gXhciComponentName)
|
||||
);
|
||||
|
||||
}
|
||||
|
@@ -57,7 +57,6 @@ XhciComponentNameGetDriverName (
|
||||
OUT CHAR16 **DriverName
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Retrieves a Unicode string that is the user readable name of the controller
|
||||
that is being managed by a driver.
|
||||
@@ -137,4 +136,3 @@ XhciComponentNameGetControllerName (
|
||||
);
|
||||
|
||||
#endif
|
||||
|
||||
|
@@ -7,10 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "Xhci.h"
|
||||
|
||||
|
||||
/**
|
||||
Allocate a block of memory to be used by the buffer pool.
|
||||
|
||||
@@ -22,17 +20,17 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
USBHC_MEM_BLOCK *
|
||||
UsbHcAllocMemBlock (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Pages
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Pages
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
VOID *BufHost;
|
||||
VOID *Mapping;
|
||||
EFI_PHYSICAL_ADDRESS MappedAddr;
|
||||
UINTN Bytes;
|
||||
EFI_STATUS Status;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
VOID *BufHost;
|
||||
VOID *Mapping;
|
||||
EFI_PHYSICAL_ADDRESS MappedAddr;
|
||||
UINTN Bytes;
|
||||
EFI_STATUS Status;
|
||||
|
||||
PciIo = Pool->PciIo;
|
||||
|
||||
@@ -47,9 +45,9 @@ UsbHcAllocMemBlock (
|
||||
//
|
||||
ASSERT (USBHC_MEM_UNIT * 8 <= EFI_PAGE_SIZE);
|
||||
|
||||
Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
|
||||
Block->BitsLen = Block->BufLen / (USBHC_MEM_UNIT * 8);
|
||||
Block->Bits = AllocateZeroPool (Block->BitsLen);
|
||||
Block->BufLen = EFI_PAGES_TO_SIZE (Pages);
|
||||
Block->BitsLen = Block->BufLen / (USBHC_MEM_UNIT * 8);
|
||||
Block->Bits = AllocateZeroPool (Block->BitsLen);
|
||||
|
||||
if (Block->Bits == NULL) {
|
||||
gBS->FreePool (Block);
|
||||
@@ -73,7 +71,7 @@ UsbHcAllocMemBlock (
|
||||
goto FREE_BITARRAY;
|
||||
}
|
||||
|
||||
Bytes = EFI_PAGES_TO_SIZE (Pages);
|
||||
Bytes = EFI_PAGES_TO_SIZE (Pages);
|
||||
Status = PciIo->Map (
|
||||
PciIo,
|
||||
EfiPciIoOperationBusMasterCommonBuffer,
|
||||
@@ -87,9 +85,9 @@ UsbHcAllocMemBlock (
|
||||
goto FREE_BUFFER;
|
||||
}
|
||||
|
||||
Block->BufHost = BufHost;
|
||||
Block->Buf = (UINT8 *) ((UINTN) MappedAddr);
|
||||
Block->Mapping = Mapping;
|
||||
Block->BufHost = BufHost;
|
||||
Block->Buf = (UINT8 *)((UINTN)MappedAddr);
|
||||
Block->Mapping = Mapping;
|
||||
|
||||
return Block;
|
||||
|
||||
@@ -102,7 +100,6 @@ FREE_BITARRAY:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the memory block from the memory pool.
|
||||
|
||||
@@ -112,11 +109,11 @@ FREE_BITARRAY:
|
||||
**/
|
||||
VOID
|
||||
UsbHcFreeMemBlock (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
)
|
||||
{
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
|
||||
ASSERT ((Pool != NULL) && (Block != NULL));
|
||||
|
||||
@@ -132,7 +129,6 @@ UsbHcFreeMemBlock (
|
||||
gBS->FreePool (Block);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Alloc some memory from the block.
|
||||
|
||||
@@ -145,22 +141,22 @@ UsbHcFreeMemBlock (
|
||||
**/
|
||||
VOID *
|
||||
UsbHcAllocMemFromBlock (
|
||||
IN USBHC_MEM_BLOCK *Block,
|
||||
IN UINTN Units
|
||||
IN USBHC_MEM_BLOCK *Block,
|
||||
IN UINTN Units
|
||||
)
|
||||
{
|
||||
UINTN Byte;
|
||||
UINT8 Bit;
|
||||
UINTN StartByte;
|
||||
UINT8 StartBit;
|
||||
UINTN Available;
|
||||
UINTN Count;
|
||||
UINTN Byte;
|
||||
UINT8 Bit;
|
||||
UINTN StartByte;
|
||||
UINT8 StartBit;
|
||||
UINTN Available;
|
||||
UINTN Count;
|
||||
|
||||
ASSERT ((Block != 0) && (Units != 0));
|
||||
|
||||
StartByte = 0;
|
||||
StartBit = 0;
|
||||
Available = 0;
|
||||
StartByte = 0;
|
||||
StartBit = 0;
|
||||
Available = 0;
|
||||
|
||||
for (Byte = 0, Bit = 0; Byte < Block->BitsLen;) {
|
||||
//
|
||||
@@ -176,13 +172,12 @@ UsbHcAllocMemFromBlock (
|
||||
}
|
||||
|
||||
NEXT_BIT (Byte, Bit);
|
||||
|
||||
} else {
|
||||
NEXT_BIT (Byte, Bit);
|
||||
|
||||
Available = 0;
|
||||
StartByte = Byte;
|
||||
StartBit = Bit;
|
||||
Available = 0;
|
||||
StartByte = Byte;
|
||||
StartBit = Bit;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -193,13 +188,13 @@ UsbHcAllocMemFromBlock (
|
||||
//
|
||||
// Mark the memory as allocated
|
||||
//
|
||||
Byte = StartByte;
|
||||
Bit = StartBit;
|
||||
Byte = StartByte;
|
||||
Bit = StartBit;
|
||||
|
||||
for (Count = 0; Count < Units; Count++) {
|
||||
ASSERT (!USB_HC_BIT_IS_SET (Block->Bits[Byte], Bit));
|
||||
|
||||
Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] | USB_HC_BIT (Bit));
|
||||
Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] | USB_HC_BIT (Bit));
|
||||
NEXT_BIT (Byte, Bit);
|
||||
}
|
||||
|
||||
@@ -218,16 +213,16 @@ UsbHcAllocMemFromBlock (
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
UsbHcGetPciAddrForHostAddr (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINTN AllocSize;
|
||||
EFI_PHYSICAL_ADDRESS PhyAddr;
|
||||
UINTN Offset;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINTN AllocSize;
|
||||
EFI_PHYSICAL_ADDRESS PhyAddr;
|
||||
UINTN Offset;
|
||||
|
||||
Head = Pool->Head;
|
||||
AllocSize = USBHC_MEM_ROUND (Size);
|
||||
@@ -241,7 +236,7 @@ UsbHcGetPciAddrForHostAddr (
|
||||
// scan the memory block list for the memory block that
|
||||
// completely contains the allocated memory.
|
||||
//
|
||||
if ((Block->BufHost <= (UINT8 *) Mem) && (((UINT8 *) Mem + AllocSize) <= (Block->BufHost + Block->BufLen))) {
|
||||
if ((Block->BufHost <= (UINT8 *)Mem) && (((UINT8 *)Mem + AllocSize) <= (Block->BufHost + Block->BufLen))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -250,8 +245,8 @@ UsbHcGetPciAddrForHostAddr (
|
||||
//
|
||||
// calculate the pci memory address for host memory address.
|
||||
//
|
||||
Offset = (UINT8 *)Mem - Block->BufHost;
|
||||
PhyAddr = (EFI_PHYSICAL_ADDRESS)(UINTN) (Block->Buf + Offset);
|
||||
Offset = (UINT8 *)Mem - Block->BufHost;
|
||||
PhyAddr = (EFI_PHYSICAL_ADDRESS)(UINTN)(Block->Buf + Offset);
|
||||
return PhyAddr;
|
||||
}
|
||||
|
||||
@@ -267,16 +262,16 @@ UsbHcGetPciAddrForHostAddr (
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
UsbHcGetHostAddrForPciAddr (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINTN AllocSize;
|
||||
EFI_PHYSICAL_ADDRESS HostAddr;
|
||||
UINTN Offset;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINTN AllocSize;
|
||||
EFI_PHYSICAL_ADDRESS HostAddr;
|
||||
UINTN Offset;
|
||||
|
||||
Head = Pool->Head;
|
||||
AllocSize = USBHC_MEM_ROUND (Size);
|
||||
@@ -290,7 +285,7 @@ UsbHcGetHostAddrForPciAddr (
|
||||
// scan the memory block list for the memory block that
|
||||
// completely contains the allocated memory.
|
||||
//
|
||||
if ((Block->Buf <= (UINT8 *) Mem) && (((UINT8 *) Mem + AllocSize) <= (Block->Buf + Block->BufLen))) {
|
||||
if ((Block->Buf <= (UINT8 *)Mem) && (((UINT8 *)Mem + AllocSize) <= (Block->Buf + Block->BufLen))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -299,8 +294,8 @@ UsbHcGetHostAddrForPciAddr (
|
||||
//
|
||||
// calculate the pci memory address for host memory address.
|
||||
//
|
||||
Offset = (UINT8 *)Mem - Block->Buf;
|
||||
HostAddr = (EFI_PHYSICAL_ADDRESS)(UINTN) (Block->BufHost + Offset);
|
||||
Offset = (UINT8 *)Mem - Block->Buf;
|
||||
HostAddr = (EFI_PHYSICAL_ADDRESS)(UINTN)(Block->BufHost + Offset);
|
||||
return HostAddr;
|
||||
}
|
||||
|
||||
@@ -313,8 +308,8 @@ UsbHcGetHostAddrForPciAddr (
|
||||
**/
|
||||
VOID
|
||||
UsbHcInsertMemBlockToPool (
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
)
|
||||
{
|
||||
ASSERT ((Head != NULL) && (Block != NULL));
|
||||
@@ -322,7 +317,6 @@ UsbHcInsertMemBlockToPool (
|
||||
Head->Next = Block;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Is the memory block empty?
|
||||
|
||||
@@ -334,10 +328,10 @@ UsbHcInsertMemBlockToPool (
|
||||
**/
|
||||
BOOLEAN
|
||||
UsbHcIsMemBlockEmpty (
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
IN USBHC_MEM_BLOCK *Block
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN Index;
|
||||
|
||||
for (Index = 0; Index < Block->BitsLen; Index++) {
|
||||
if (Block->Bits[Index] != 0) {
|
||||
@@ -348,7 +342,6 @@ UsbHcIsMemBlockEmpty (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Unlink the memory block from the pool's list.
|
||||
|
||||
@@ -358,11 +351,11 @@ UsbHcIsMemBlockEmpty (
|
||||
**/
|
||||
VOID
|
||||
UsbHcUnlinkMemBlock (
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
IN USBHC_MEM_BLOCK *BlockToUnlink
|
||||
IN USBHC_MEM_BLOCK *Head,
|
||||
IN USBHC_MEM_BLOCK *BlockToUnlink
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
|
||||
ASSERT ((Head != NULL) && (BlockToUnlink != NULL));
|
||||
|
||||
@@ -375,7 +368,6 @@ UsbHcUnlinkMemBlock (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Initialize the memory management pool for the host controller.
|
||||
|
||||
@@ -390,7 +382,7 @@ UsbHcInitMemPool (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo
|
||||
)
|
||||
{
|
||||
USBHC_MEM_POOL *Pool;
|
||||
USBHC_MEM_POOL *Pool;
|
||||
|
||||
Pool = AllocatePool (sizeof (USBHC_MEM_POOL));
|
||||
|
||||
@@ -398,8 +390,8 @@ UsbHcInitMemPool (
|
||||
return Pool;
|
||||
}
|
||||
|
||||
Pool->PciIo = PciIo;
|
||||
Pool->Head = UsbHcAllocMemBlock (Pool, USBHC_MEM_DEFAULT_PAGES);
|
||||
Pool->PciIo = PciIo;
|
||||
Pool->Head = UsbHcAllocMemBlock (Pool, USBHC_MEM_DEFAULT_PAGES);
|
||||
|
||||
if (Pool->Head == NULL) {
|
||||
gBS->FreePool (Pool);
|
||||
@@ -409,7 +401,6 @@ UsbHcInitMemPool (
|
||||
return Pool;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Release the memory management pool.
|
||||
|
||||
@@ -421,10 +412,10 @@ UsbHcInitMemPool (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbHcFreeMemPool (
|
||||
IN USBHC_MEM_POOL *Pool
|
||||
IN USBHC_MEM_POOL *Pool
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
|
||||
ASSERT (Pool->Head != NULL);
|
||||
|
||||
@@ -443,7 +434,6 @@ UsbHcFreeMemPool (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocate some memory from the host controller's memory pool
|
||||
which can be used to communicate with host controller.
|
||||
@@ -456,16 +446,16 @@ UsbHcFreeMemPool (
|
||||
**/
|
||||
VOID *
|
||||
UsbHcAllocateMem (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
USBHC_MEM_BLOCK *NewBlock;
|
||||
VOID *Mem;
|
||||
UINTN AllocSize;
|
||||
UINTN Pages;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
USBHC_MEM_BLOCK *NewBlock;
|
||||
VOID *Mem;
|
||||
UINTN AllocSize;
|
||||
UINTN Pages;
|
||||
|
||||
Mem = NULL;
|
||||
AllocSize = USBHC_MEM_ROUND (Size);
|
||||
@@ -520,7 +510,6 @@ UsbHcAllocateMem (
|
||||
return Mem;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Free the allocated memory back to the memory pool.
|
||||
|
||||
@@ -531,22 +520,22 @@ UsbHcAllocateMem (
|
||||
**/
|
||||
VOID
|
||||
UsbHcFreeMem (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINT8 *ToFree;
|
||||
UINTN AllocSize;
|
||||
UINTN Byte;
|
||||
UINTN Bit;
|
||||
UINTN Count;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
USBHC_MEM_BLOCK *Block;
|
||||
UINT8 *ToFree;
|
||||
UINTN AllocSize;
|
||||
UINTN Byte;
|
||||
UINTN Bit;
|
||||
UINTN Count;
|
||||
|
||||
Head = Pool->Head;
|
||||
AllocSize = USBHC_MEM_ROUND (Size);
|
||||
ToFree = (UINT8 *) Mem;
|
||||
ToFree = (UINT8 *)Mem;
|
||||
|
||||
for (Block = Head; Block != NULL; Block = Block->Next) {
|
||||
//
|
||||
@@ -557,8 +546,8 @@ UsbHcFreeMem (
|
||||
//
|
||||
// compute the start byte and bit in the bit array
|
||||
//
|
||||
Byte = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) / 8;
|
||||
Bit = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) % 8;
|
||||
Byte = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) / 8;
|
||||
Bit = ((ToFree - Block->BufHost) / USBHC_MEM_UNIT) % 8;
|
||||
|
||||
//
|
||||
// reset associated bits in bit array
|
||||
@@ -566,7 +555,7 @@ UsbHcFreeMem (
|
||||
for (Count = 0; Count < (AllocSize / USBHC_MEM_UNIT); Count++) {
|
||||
ASSERT (USB_HC_BIT_IS_SET (Block->Bits[Byte], Bit));
|
||||
|
||||
Block->Bits[Byte] = (UINT8) (Block->Bits[Byte] ^ USB_HC_BIT (Bit));
|
||||
Block->Bits[Byte] = (UINT8)(Block->Bits[Byte] ^ USB_HC_BIT (Bit));
|
||||
NEXT_BIT (Byte, Bit);
|
||||
}
|
||||
|
||||
@@ -589,7 +578,7 @@ UsbHcFreeMem (
|
||||
UsbHcFreeMemBlock (Pool, Block);
|
||||
}
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -621,13 +610,13 @@ UsbHcAllocateAlignedPages (
|
||||
OUT VOID **Mapping
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *Memory;
|
||||
UINTN AlignedMemory;
|
||||
UINTN AlignmentMask;
|
||||
UINTN UnalignedPages;
|
||||
UINTN RealPages;
|
||||
UINTN Bytes;
|
||||
EFI_STATUS Status;
|
||||
VOID *Memory;
|
||||
UINTN AlignedMemory;
|
||||
UINTN AlignmentMask;
|
||||
UINTN UnalignedPages;
|
||||
UINTN RealPages;
|
||||
UINTN Bytes;
|
||||
|
||||
//
|
||||
// Alignment must be a power of two or zero.
|
||||
@@ -641,12 +630,13 @@ UsbHcAllocateAlignedPages (
|
||||
if (Pages == 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (Alignment > EFI_PAGE_SIZE) {
|
||||
//
|
||||
// Calculate the total number of pages since alignment is larger than page size.
|
||||
//
|
||||
AlignmentMask = Alignment - 1;
|
||||
RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
|
||||
AlignmentMask = Alignment - 1;
|
||||
RealPages = Pages + EFI_SIZE_TO_PAGES (Alignment);
|
||||
//
|
||||
// Make sure that Pages plus EFI_SIZE_TO_PAGES (Alignment) does not overflow.
|
||||
//
|
||||
@@ -663,8 +653,9 @@ UsbHcAllocateAlignedPages (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
AlignedMemory = ((UINTN) Memory + AlignmentMask) & ~AlignmentMask;
|
||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN) Memory);
|
||||
|
||||
AlignedMemory = ((UINTN)Memory + AlignmentMask) & ~AlignmentMask;
|
||||
UnalignedPages = EFI_SIZE_TO_PAGES (AlignedMemory - (UINTN)Memory);
|
||||
if (UnalignedPages > 0) {
|
||||
//
|
||||
// Free first unaligned page(s).
|
||||
@@ -672,6 +663,7 @@ UsbHcAllocateAlignedPages (
|
||||
Status = PciIo->FreeBuffer (PciIo, UnalignedPages, Memory);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
|
||||
Memory = (VOID *)(UINTN)(AlignedMemory + EFI_PAGES_TO_SIZE (Pages));
|
||||
UnalignedPages = RealPages - Pages - UnalignedPages;
|
||||
if (UnalignedPages > 0) {
|
||||
@@ -696,25 +688,26 @@ UsbHcAllocateAlignedPages (
|
||||
if (EFI_ERROR (Status)) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
AlignedMemory = (UINTN) Memory;
|
||||
|
||||
AlignedMemory = (UINTN)Memory;
|
||||
}
|
||||
|
||||
Bytes = EFI_PAGES_TO_SIZE (Pages);
|
||||
Bytes = EFI_PAGES_TO_SIZE (Pages);
|
||||
Status = PciIo->Map (
|
||||
PciIo,
|
||||
EfiPciIoOperationBusMasterCommonBuffer,
|
||||
(VOID *) AlignedMemory,
|
||||
(VOID *)AlignedMemory,
|
||||
&Bytes,
|
||||
DeviceAddress,
|
||||
Mapping
|
||||
);
|
||||
|
||||
if (EFI_ERROR (Status) || (Bytes != EFI_PAGES_TO_SIZE (Pages))) {
|
||||
Status = PciIo->FreeBuffer (PciIo, Pages, (VOID *) AlignedMemory);
|
||||
Status = PciIo->FreeBuffer (PciIo, Pages, (VOID *)AlignedMemory);
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
*HostAddress = (VOID *) AlignedMemory;
|
||||
*HostAddress = (VOID *)AlignedMemory;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
@@ -730,13 +723,13 @@ UsbHcAllocateAlignedPages (
|
||||
**/
|
||||
VOID
|
||||
UsbHcFreeAlignedPages (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN VOID *HostAddress,
|
||||
IN UINTN Pages,
|
||||
VOID *Mapping
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN VOID *HostAddress,
|
||||
IN UINTN Pages,
|
||||
VOID *Mapping
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Pages != 0);
|
||||
|
||||
|
@@ -10,20 +10,20 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _EFI_XHCI_MEM_H_
|
||||
#define _EFI_XHCI_MEM_H_
|
||||
|
||||
#define USB_HC_BIT(a) ((UINTN)(1 << (a)))
|
||||
#define USB_HC_BIT(a) ((UINTN)(1 << (a)))
|
||||
|
||||
#define USB_HC_BIT_IS_SET(Data, Bit) \
|
||||
((BOOLEAN)(((Data) & USB_HC_BIT(Bit)) == USB_HC_BIT(Bit)))
|
||||
|
||||
typedef struct _USBHC_MEM_BLOCK USBHC_MEM_BLOCK;
|
||||
struct _USBHC_MEM_BLOCK {
|
||||
UINT8 *Bits; // Bit array to record which unit is allocated
|
||||
UINTN BitsLen;
|
||||
UINT8 *Buf;
|
||||
UINT8 *BufHost;
|
||||
UINTN BufLen; // Memory size in bytes
|
||||
VOID *Mapping;
|
||||
USBHC_MEM_BLOCK *Next;
|
||||
UINT8 *Bits; // Bit array to record which unit is allocated
|
||||
UINTN BitsLen;
|
||||
UINT8 *Buf;
|
||||
UINT8 *BufHost;
|
||||
UINTN BufLen; // Memory size in bytes
|
||||
VOID *Mapping;
|
||||
USBHC_MEM_BLOCK *Next;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -32,16 +32,16 @@ struct _USBHC_MEM_BLOCK {
|
||||
// data to be on the same 4G memory.
|
||||
//
|
||||
typedef struct _USBHC_MEM_POOL {
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
BOOLEAN Check4G;
|
||||
UINT32 Which4G;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
BOOLEAN Check4G;
|
||||
UINT32 Which4G;
|
||||
USBHC_MEM_BLOCK *Head;
|
||||
} USBHC_MEM_POOL;
|
||||
|
||||
//
|
||||
// Memory allocation unit, must be 2^n, n>4
|
||||
//
|
||||
#define USBHC_MEM_UNIT 64
|
||||
#define USBHC_MEM_UNIT 64
|
||||
|
||||
#define USBHC_MEM_UNIT_MASK (USBHC_MEM_UNIT - 1)
|
||||
#define USBHC_MEM_DEFAULT_PAGES 16
|
||||
@@ -60,8 +60,6 @@ typedef struct _USBHC_MEM_POOL {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Initialize the memory management pool for the host controller.
|
||||
|
||||
@@ -76,7 +74,6 @@ UsbHcInitMemPool (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Release the memory management pool.
|
||||
|
||||
@@ -88,10 +85,9 @@ UsbHcInitMemPool (
|
||||
**/
|
||||
EFI_STATUS
|
||||
UsbHcFreeMemPool (
|
||||
IN USBHC_MEM_POOL *Pool
|
||||
IN USBHC_MEM_POOL *Pool
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Allocate some memory from the host controller's memory pool
|
||||
which can be used to communicate with host controller.
|
||||
@@ -104,11 +100,10 @@ UsbHcFreeMemPool (
|
||||
**/
|
||||
VOID *
|
||||
UsbHcAllocateMem (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Free the allocated memory back to the memory pool.
|
||||
|
||||
@@ -119,9 +114,9 @@ UsbHcAllocateMem (
|
||||
**/
|
||||
VOID
|
||||
UsbHcFreeMem (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -136,9 +131,9 @@ UsbHcFreeMem (
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
UsbHcGetPciAddrForHostAddr (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -153,9 +148,9 @@ UsbHcGetPciAddrForHostAddr (
|
||||
**/
|
||||
EFI_PHYSICAL_ADDRESS
|
||||
UsbHcGetHostAddrForPciAddr (
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
IN USBHC_MEM_POOL *Pool,
|
||||
IN VOID *Mem,
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -198,10 +193,10 @@ UsbHcAllocateAlignedPages (
|
||||
**/
|
||||
VOID
|
||||
UsbHcFreeAlignedPages (
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN VOID *HostAddress,
|
||||
IN UINTN Pages,
|
||||
VOID *Mapping
|
||||
IN EFI_PCI_IO_PROTOCOL *PciIo,
|
||||
IN VOID *HostAddress,
|
||||
IN UINTN Pages,
|
||||
VOID *Mapping
|
||||
);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -29,8 +29,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
|
||||
#include <IndustryStandard/Pci.h>
|
||||
|
||||
typedef struct _USB_XHCI_INSTANCE USB_XHCI_INSTANCE;
|
||||
typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
typedef struct _USB_XHCI_INSTANCE USB_XHCI_INSTANCE;
|
||||
typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
|
||||
#include "XhciReg.h"
|
||||
#include "XhciSched.h"
|
||||
@@ -40,62 +40,62 @@ typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
//
|
||||
// The unit is microsecond, setting it as 1us.
|
||||
//
|
||||
#define XHC_1_MICROSECOND (1)
|
||||
#define XHC_1_MICROSECOND (1)
|
||||
//
|
||||
// The unit is microsecond, setting it as 1ms.
|
||||
//
|
||||
#define XHC_1_MILLISECOND (1000)
|
||||
#define XHC_1_MILLISECOND (1000)
|
||||
//
|
||||
// XHC generic timeout experience values.
|
||||
// The unit is millisecond, setting it as 10s.
|
||||
//
|
||||
#define XHC_GENERIC_TIMEOUT (10 * 1000)
|
||||
#define XHC_GENERIC_TIMEOUT (10 * 1000)
|
||||
//
|
||||
// XHC reset timeout experience values.
|
||||
// The unit is millisecond, setting it as 1s.
|
||||
//
|
||||
#define XHC_RESET_TIMEOUT (1000)
|
||||
#define XHC_RESET_TIMEOUT (1000)
|
||||
//
|
||||
// TRSTRCY delay requirement in usb 2.0 spec chapter 7.1.7.5.
|
||||
// The unit is microsecond, setting it as 10ms.
|
||||
//
|
||||
#define XHC_RESET_RECOVERY_DELAY (10 * 1000)
|
||||
#define XHC_RESET_RECOVERY_DELAY (10 * 1000)
|
||||
//
|
||||
// XHC async transfer timer interval, set by experience.
|
||||
// The unit is 100us, takes 1ms as interval.
|
||||
//
|
||||
#define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)
|
||||
#define XHC_ASYNC_TIMER_INTERVAL EFI_TIMER_PERIOD_MILLISECONDS(1)
|
||||
|
||||
//
|
||||
// XHC raises TPL to TPL_NOTIFY to serialize all its operations
|
||||
// to protect shared data structures.
|
||||
//
|
||||
#define XHC_TPL TPL_NOTIFY
|
||||
#define XHC_TPL TPL_NOTIFY
|
||||
|
||||
#define CMD_RING_TRB_NUMBER 0x100
|
||||
#define TR_RING_TRB_NUMBER 0x100
|
||||
#define ERST_NUMBER 0x01
|
||||
#define EVENT_RING_TRB_NUMBER 0x200
|
||||
#define CMD_RING_TRB_NUMBER 0x100
|
||||
#define TR_RING_TRB_NUMBER 0x100
|
||||
#define ERST_NUMBER 0x01
|
||||
#define EVENT_RING_TRB_NUMBER 0x200
|
||||
|
||||
#define CMD_INTER 0
|
||||
#define CTRL_INTER 1
|
||||
#define BULK_INTER 2
|
||||
#define INT_INTER 3
|
||||
#define INT_INTER_ASYNC 4
|
||||
#define CMD_INTER 0
|
||||
#define CTRL_INTER 1
|
||||
#define BULK_INTER 2
|
||||
#define INT_INTER 3
|
||||
#define INT_INTER_ASYNC 4
|
||||
|
||||
#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)
|
||||
#define EFI_LIST_CONTAINER(Entry, Type, Field) BASE_CR(Entry, Type, Field)
|
||||
|
||||
#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
|
||||
#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)(Addr64), 32) & 0xFFFFFFFF))
|
||||
#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
|
||||
#define XHC_LOW_32BIT(Addr64) ((UINT32)(((UINTN)(Addr64)) & 0xFFFFFFFF))
|
||||
#define XHC_HIGH_32BIT(Addr64) ((UINT32)(RShiftU64((UINT64)(UINTN)(Addr64), 32) & 0xFFFFFFFF))
|
||||
#define XHC_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
|
||||
|
||||
#define XHC_REG_BIT_IS_SET(Xhc, Offset, Bit) \
|
||||
(XHC_BIT_IS_SET(XhcReadOpReg ((Xhc), (Offset)), (Bit)))
|
||||
|
||||
#define XHCI_IS_DATAIN(EndpointAddr) XHC_BIT_IS_SET((EndpointAddr), 0x80)
|
||||
#define XHCI_IS_DATAIN(EndpointAddr) XHC_BIT_IS_SET((EndpointAddr), 0x80)
|
||||
|
||||
#define XHCI_INSTANCE_SIG SIGNATURE_32 ('x', 'h', 'c', 'i')
|
||||
#define XHC_FROM_THIS(a) CR(a, USB_XHCI_INSTANCE, Usb2Hc, XHCI_INSTANCE_SIG)
|
||||
#define XHCI_INSTANCE_SIG SIGNATURE_32 ('x', 'h', 'c', 'i')
|
||||
#define XHC_FROM_THIS(a) CR(a, USB_XHCI_INSTANCE, Usb2Hc, XHCI_INSTANCE_SIG)
|
||||
|
||||
#define USB_DESC_TYPE_HUB 0x29
|
||||
#define USB_DESC_TYPE_HUB_SUPER_SPEED 0x2a
|
||||
@@ -113,19 +113,19 @@ typedef struct _USB_DEV_CONTEXT USB_DEV_CONTEXT;
|
||||
//
|
||||
#pragma pack(1)
|
||||
typedef struct {
|
||||
UINT8 ProgInterface;
|
||||
UINT8 SubClassCode;
|
||||
UINT8 BaseCode;
|
||||
UINT8 ProgInterface;
|
||||
UINT8 SubClassCode;
|
||||
UINT8 BaseCode;
|
||||
} USB_CLASSC;
|
||||
|
||||
typedef struct {
|
||||
UINT8 Length;
|
||||
UINT8 DescType;
|
||||
UINT8 NumPorts;
|
||||
UINT16 HubCharacter;
|
||||
UINT8 PwrOn2PwrGood;
|
||||
UINT8 HubContrCurrent;
|
||||
UINT8 Filler[16];
|
||||
UINT8 Length;
|
||||
UINT8 DescType;
|
||||
UINT8 NumPorts;
|
||||
UINT16 HubCharacter;
|
||||
UINT8 PwrOn2PwrGood;
|
||||
UINT8 HubContrCurrent;
|
||||
UINT8 Filler[16];
|
||||
} EFI_USB_HUB_DESCRIPTOR;
|
||||
#pragma pack()
|
||||
|
||||
@@ -133,23 +133,23 @@ struct _USB_DEV_CONTEXT {
|
||||
//
|
||||
// Whether this entry in UsbDevContext array is used or not.
|
||||
//
|
||||
BOOLEAN Enabled;
|
||||
BOOLEAN Enabled;
|
||||
//
|
||||
// The slot id assigned to the new device through XHCI's Enable_Slot cmd.
|
||||
//
|
||||
UINT8 SlotId;
|
||||
UINT8 SlotId;
|
||||
//
|
||||
// The route string presented an attached usb device.
|
||||
//
|
||||
USB_DEV_ROUTE RouteString;
|
||||
USB_DEV_ROUTE RouteString;
|
||||
//
|
||||
// The route string of parent device if it exists. Otherwise it's zero.
|
||||
//
|
||||
USB_DEV_ROUTE ParentRouteString;
|
||||
USB_DEV_ROUTE ParentRouteString;
|
||||
//
|
||||
// The actual device address assigned by XHCI through Address_Device command.
|
||||
//
|
||||
UINT8 XhciDevAddr;
|
||||
UINT8 XhciDevAddr;
|
||||
//
|
||||
// The requested device address from UsbBus driver through Set_Address standard usb request.
|
||||
// As XHCI spec replaces this request with Address_Device command, we have to record the
|
||||
@@ -158,23 +158,23 @@ struct _USB_DEV_CONTEXT {
|
||||
// through EFI_USB2_HC_PROTOCOL. Xhci driver would be responsible for translating it to actual
|
||||
// device address and access the actual device.
|
||||
//
|
||||
UINT8 BusDevAddr;
|
||||
UINT8 BusDevAddr;
|
||||
//
|
||||
// The pointer to the input device context.
|
||||
//
|
||||
VOID *InputContext;
|
||||
VOID *InputContext;
|
||||
//
|
||||
// The pointer to the output device context.
|
||||
//
|
||||
VOID *OutputContext;
|
||||
VOID *OutputContext;
|
||||
//
|
||||
// The transfer queue for every endpoint.
|
||||
//
|
||||
VOID *EndpointTransferRing[31];
|
||||
VOID *EndpointTransferRing[31];
|
||||
//
|
||||
// The device descriptor which is stored to support XHCI's Evaluate_Context cmd.
|
||||
//
|
||||
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||
EFI_USB_DEVICE_DESCRIPTOR DevDesc;
|
||||
//
|
||||
// As a usb device may include multiple configuration descriptors, we dynamically allocate an array
|
||||
// to store them.
|
||||
@@ -182,81 +182,80 @@ struct _USB_DEV_CONTEXT {
|
||||
// such as Interface descriptor, Endpoint descriptor, and so on.
|
||||
// These information is used to support XHCI's Config_Endpoint cmd.
|
||||
//
|
||||
EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;
|
||||
EFI_USB_CONFIG_DESCRIPTOR **ConfDesc;
|
||||
//
|
||||
// A device has an active Configuration.
|
||||
//
|
||||
UINT8 ActiveConfiguration;
|
||||
UINT8 ActiveConfiguration;
|
||||
//
|
||||
// Every interface has an active AlternateSetting.
|
||||
//
|
||||
UINT8 *ActiveAlternateSetting;
|
||||
UINT8 *ActiveAlternateSetting;
|
||||
};
|
||||
|
||||
struct _USB_XHCI_INSTANCE {
|
||||
UINT32 Signature;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 OriginalPciAttributes;
|
||||
USBHC_MEM_POOL *MemPool;
|
||||
UINT32 Signature;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT64 OriginalPciAttributes;
|
||||
USBHC_MEM_POOL *MemPool;
|
||||
|
||||
EFI_USB2_HC_PROTOCOL Usb2Hc;
|
||||
EFI_USB2_HC_PROTOCOL Usb2Hc;
|
||||
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
|
||||
//
|
||||
// ExitBootServicesEvent is used to set OS semaphore and
|
||||
// stop the XHC DMA operation after exit boot service.
|
||||
//
|
||||
EFI_EVENT ExitBootServiceEvent;
|
||||
EFI_EVENT PollTimer;
|
||||
LIST_ENTRY AsyncIntTransfers;
|
||||
EFI_EVENT ExitBootServiceEvent;
|
||||
EFI_EVENT PollTimer;
|
||||
LIST_ENTRY AsyncIntTransfers;
|
||||
|
||||
UINT8 CapLength; ///< Capability Register Length
|
||||
XHC_HCSPARAMS1 HcSParams1; ///< Structural Parameters 1
|
||||
XHC_HCSPARAMS2 HcSParams2; ///< Structural Parameters 2
|
||||
XHC_HCCPARAMS HcCParams; ///< Capability Parameters
|
||||
UINT32 DBOff; ///< Doorbell Offset
|
||||
UINT32 RTSOff; ///< Runtime Register Space Offset
|
||||
UINT16 MaxInterrupt;
|
||||
UINT32 PageSize;
|
||||
UINT64 *ScratchBuf;
|
||||
VOID *ScratchMap;
|
||||
UINT32 MaxScratchpadBufs;
|
||||
UINT64 *ScratchEntry;
|
||||
UINTN *ScratchEntryMap;
|
||||
UINT32 ExtCapRegBase;
|
||||
UINT32 UsbLegSupOffset;
|
||||
UINT32 DebugCapSupOffset;
|
||||
UINT64 *DCBAA;
|
||||
VOID *DCBAAMap;
|
||||
UINT32 MaxSlotsEn;
|
||||
URB *PendingUrb;
|
||||
UINT8 CapLength; ///< Capability Register Length
|
||||
XHC_HCSPARAMS1 HcSParams1; ///< Structural Parameters 1
|
||||
XHC_HCSPARAMS2 HcSParams2; ///< Structural Parameters 2
|
||||
XHC_HCCPARAMS HcCParams; ///< Capability Parameters
|
||||
UINT32 DBOff; ///< Doorbell Offset
|
||||
UINT32 RTSOff; ///< Runtime Register Space Offset
|
||||
UINT16 MaxInterrupt;
|
||||
UINT32 PageSize;
|
||||
UINT64 *ScratchBuf;
|
||||
VOID *ScratchMap;
|
||||
UINT32 MaxScratchpadBufs;
|
||||
UINT64 *ScratchEntry;
|
||||
UINTN *ScratchEntryMap;
|
||||
UINT32 ExtCapRegBase;
|
||||
UINT32 UsbLegSupOffset;
|
||||
UINT32 DebugCapSupOffset;
|
||||
UINT64 *DCBAA;
|
||||
VOID *DCBAAMap;
|
||||
UINT32 MaxSlotsEn;
|
||||
URB *PendingUrb;
|
||||
//
|
||||
// Cmd Transfer Ring
|
||||
//
|
||||
TRANSFER_RING CmdRing;
|
||||
TRANSFER_RING CmdRing;
|
||||
//
|
||||
// EventRing
|
||||
//
|
||||
EVENT_RING EventRing;
|
||||
EVENT_RING EventRing;
|
||||
//
|
||||
// Misc
|
||||
//
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
EFI_UNICODE_STRING_TABLE *ControllerNameTable;
|
||||
|
||||
//
|
||||
// Store device contexts managed by XHCI instance
|
||||
// The array supports up to 255 devices, entry 0 is reserved and should not be used.
|
||||
//
|
||||
USB_DEV_CONTEXT UsbDevContext[256];
|
||||
USB_DEV_CONTEXT UsbDevContext[256];
|
||||
|
||||
BOOLEAN Support64BitDma; // Whether 64 bit DMA may be used with this device
|
||||
BOOLEAN Support64BitDma; // Whether 64 bit DMA may be used with this device
|
||||
};
|
||||
|
||||
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
|
||||
extern EFI_DRIVER_BINDING_PROTOCOL gXhciDriverBinding;
|
||||
extern EFI_COMPONENT_NAME_PROTOCOL gXhciComponentName;
|
||||
extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
|
||||
|
||||
/**
|
||||
Test to see if this driver supports ControllerHandle. Any
|
||||
@@ -274,9 +273,9 @@ extern EFI_COMPONENT_NAME2_PROTOCOL gXhciComponentName2;
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcDriverBindingSupported (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -295,9 +294,9 @@ XhcDriverBindingSupported (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcDriverBindingStart (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -316,10 +315,10 @@ XhcDriverBindingStart (
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
XhcDriverBindingStop (
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
IN EFI_DRIVER_BINDING_PROTOCOL *This,
|
||||
IN EFI_HANDLE Controller,
|
||||
IN UINTN NumberOfChildren,
|
||||
IN EFI_HANDLE *ChildHandleBuffer
|
||||
);
|
||||
|
||||
/**
|
||||
|
@@ -21,18 +21,18 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
**/
|
||||
UINT8
|
||||
XhcReadCapReg8 (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
)
|
||||
{
|
||||
UINT8 Data;
|
||||
EFI_STATUS Status;
|
||||
UINT8 Data;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = Xhc->PciIo->Mem.Read (
|
||||
Xhc->PciIo,
|
||||
EfiPciIoWidthUint8,
|
||||
XHC_BAR_INDEX,
|
||||
(UINT64) Offset,
|
||||
(UINT64)Offset,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
@@ -57,18 +57,18 @@ XhcReadCapReg8 (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadCapReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = Xhc->PciIo->Mem.Read (
|
||||
Xhc->PciIo,
|
||||
EfiPciIoWidthUint32,
|
||||
XHC_BAR_INDEX,
|
||||
(UINT64) Offset,
|
||||
(UINT64)Offset,
|
||||
1,
|
||||
&Data
|
||||
);
|
||||
@@ -93,12 +93,12 @@ XhcReadCapReg (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadOpReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->CapLength != 0);
|
||||
|
||||
@@ -129,12 +129,12 @@ XhcReadOpReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteOpReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->CapLength != 0);
|
||||
|
||||
@@ -152,10 +152,6 @@ XhcWriteOpReg (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Write the data to the XHCI door bell register.
|
||||
|
||||
@@ -166,12 +162,12 @@ XhcWriteOpReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteDoorBellReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->DBOff != 0);
|
||||
|
||||
@@ -200,12 +196,12 @@ XhcWriteDoorBellReg (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->RTSOff != 0);
|
||||
|
||||
@@ -236,12 +232,12 @@ XhcReadRuntimeReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->RTSOff != 0);
|
||||
|
||||
@@ -270,12 +266,12 @@ XhcWriteRuntimeReg (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadExtCapReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
UINT32 Data;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->ExtCapRegBase != 0);
|
||||
|
||||
@@ -306,12 +302,12 @@ XhcReadExtCapReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteExtCapReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
ASSERT (Xhc->ExtCapRegBase != 0);
|
||||
|
||||
@@ -329,7 +325,6 @@ XhcWriteExtCapReg (
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set one bit of the runtime register while keeping other bits.
|
||||
|
||||
@@ -340,12 +335,12 @@ XhcWriteExtCapReg (
|
||||
**/
|
||||
VOID
|
||||
XhcSetRuntimeRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
UINT32 Data;
|
||||
|
||||
Data = XhcReadRuntimeReg (Xhc, Offset);
|
||||
Data |= Bit;
|
||||
@@ -362,12 +357,12 @@ XhcSetRuntimeRegBit (
|
||||
**/
|
||||
VOID
|
||||
XhcClearRuntimeRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
UINT32 Data;
|
||||
|
||||
Data = XhcReadRuntimeReg (Xhc, Offset);
|
||||
Data &= ~Bit;
|
||||
@@ -384,19 +379,18 @@ XhcClearRuntimeRegBit (
|
||||
**/
|
||||
VOID
|
||||
XhcSetOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
UINT32 Data;
|
||||
|
||||
Data = XhcReadOpReg (Xhc, Offset);
|
||||
Data |= Bit;
|
||||
XhcWriteOpReg (Xhc, Offset, Data);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Clear one bit of the operational register while keeping other bits.
|
||||
|
||||
@@ -407,12 +401,12 @@ XhcSetOpRegBit (
|
||||
**/
|
||||
VOID
|
||||
XhcClearOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
)
|
||||
{
|
||||
UINT32 Data;
|
||||
UINT32 Data;
|
||||
|
||||
Data = XhcReadOpReg (Xhc, Offset);
|
||||
Data &= ~Bit;
|
||||
@@ -436,15 +430,15 @@ XhcClearOpRegBit (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcWaitOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit,
|
||||
IN BOOLEAN WaitToSet,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit,
|
||||
IN BOOLEAN WaitToSet,
|
||||
IN UINT32 Timeout
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT TimeoutEvent;
|
||||
EFI_STATUS Status;
|
||||
EFI_EVENT TimeoutEvent;
|
||||
|
||||
TimeoutEvent = NULL;
|
||||
|
||||
@@ -460,15 +454,17 @@ XhcWaitOpRegBit (
|
||||
&TimeoutEvent
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
Status = gBS->SetTimer (TimeoutEvent,
|
||||
TimerRelative,
|
||||
EFI_TIMER_PERIOD_MILLISECONDS(Timeout));
|
||||
Status = gBS->SetTimer (
|
||||
TimeoutEvent,
|
||||
TimerRelative,
|
||||
EFI_TIMER_PERIOD_MILLISECONDS (Timeout)
|
||||
);
|
||||
|
||||
if (EFI_ERROR(Status)) {
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto DONE;
|
||||
}
|
||||
|
||||
@@ -479,7 +475,7 @@ XhcWaitOpRegBit (
|
||||
}
|
||||
|
||||
gBS->Stall (XHC_1_MICROSECOND);
|
||||
} while (EFI_ERROR(gBS->CheckEvent (TimeoutEvent)));
|
||||
} while (EFI_ERROR (gBS->CheckEvent (TimeoutEvent)));
|
||||
|
||||
Status = EFI_TIMEOUT;
|
||||
|
||||
@@ -499,10 +495,10 @@ DONE:
|
||||
**/
|
||||
VOID
|
||||
XhcSetBiosOwnership (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
)
|
||||
{
|
||||
UINT32 Buffer;
|
||||
UINT32 Buffer;
|
||||
|
||||
if (Xhc->UsbLegSupOffset == 0xFFFFFFFF) {
|
||||
return;
|
||||
@@ -523,10 +519,10 @@ XhcSetBiosOwnership (
|
||||
**/
|
||||
VOID
|
||||
XhcClearBiosOwnership (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
)
|
||||
{
|
||||
UINT32 Buffer;
|
||||
UINT32 Buffer;
|
||||
|
||||
if (Xhc->UsbLegSupOffset == 0xFFFFFFFF) {
|
||||
return;
|
||||
@@ -550,13 +546,13 @@ XhcClearBiosOwnership (
|
||||
**/
|
||||
UINT32
|
||||
XhcGetCapabilityAddr (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 CapId
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 CapId
|
||||
)
|
||||
{
|
||||
UINT32 ExtCapOffset;
|
||||
UINT8 NextExtCapReg;
|
||||
UINT32 Data;
|
||||
UINT32 ExtCapOffset;
|
||||
UINT8 NextExtCapReg;
|
||||
UINT32 Data;
|
||||
|
||||
ExtCapOffset = 0;
|
||||
|
||||
@@ -568,6 +564,7 @@ XhcGetCapabilityAddr (
|
||||
if ((Data & 0xFF) == CapId) {
|
||||
return ExtCapOffset;
|
||||
}
|
||||
|
||||
//
|
||||
// If not, then traverse all of the ext capability registers till finding out it.
|
||||
//
|
||||
@@ -589,13 +586,12 @@ XhcGetCapabilityAddr (
|
||||
**/
|
||||
BOOLEAN
|
||||
XhcIsHalt (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
)
|
||||
{
|
||||
return XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Whether system error occurred.
|
||||
|
||||
@@ -607,7 +603,7 @@ XhcIsHalt (
|
||||
**/
|
||||
BOOLEAN
|
||||
XhcIsSysError (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
)
|
||||
{
|
||||
return XHC_REG_BIT_IS_SET (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HSE);
|
||||
@@ -627,11 +623,11 @@ XhcSetHsee (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT16 XhciCmd;
|
||||
EFI_STATUS Status;
|
||||
EFI_PCI_IO_PROTOCOL *PciIo;
|
||||
UINT16 XhciCmd;
|
||||
|
||||
PciIo = Xhc->PciIo;
|
||||
PciIo = Xhc->PciIo;
|
||||
Status = PciIo->Pci.Read (
|
||||
PciIo,
|
||||
EfiPciIoWidthUint16,
|
||||
@@ -658,11 +654,11 @@ XhcSetHsee (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcResetHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
@@ -679,7 +675,8 @@ XhcResetHC (
|
||||
}
|
||||
|
||||
if ((Xhc->DebugCapSupOffset == 0xFFFFFFFF) || ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) != XHC_CAP_USB_DEBUG) ||
|
||||
((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) == 0)) {
|
||||
((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) == 0))
|
||||
{
|
||||
XhcSetOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET);
|
||||
//
|
||||
// Some XHCI host controllers require to have extra 1ms delay before accessing any MMIO register during reset.
|
||||
@@ -701,7 +698,6 @@ XhcResetHC (
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Halt the XHCI host controller.
|
||||
|
||||
@@ -714,18 +710,17 @@ XhcResetHC (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcHaltHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
XhcClearOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RUN);
|
||||
Status = XhcWaitOpRegBit (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT, TRUE, Timeout);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Set the XHCI host controller to run.
|
||||
|
||||
@@ -738,11 +733,11 @@ XhcHaltHC (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcRunHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_STATUS Status;
|
||||
|
||||
XhcSetOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RUN);
|
||||
Status = XhcWaitOpRegBit (Xhc, XHC_USBSTS_OFFSET, XHC_USBSTS_HALT, FALSE, Timeout);
|
||||
|
@@ -10,124 +10,124 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
|
||||
#ifndef _EFI_XHCI_REG_H_
|
||||
#define _EFI_XHCI_REG_H_
|
||||
|
||||
#define PCI_IF_XHCI 0x30
|
||||
#define PCI_IF_XHCI 0x30
|
||||
|
||||
//
|
||||
// PCI Configuration Registers
|
||||
//
|
||||
#define XHC_BAR_INDEX 0x00
|
||||
#define XHC_BAR_INDEX 0x00
|
||||
|
||||
#define XHC_PCI_BAR_OFFSET 0x10 // Memory Bar Register Offset
|
||||
#define XHC_PCI_BAR_MASK 0xFFFF // Memory Base Address Mask
|
||||
#define XHC_PCI_BAR_OFFSET 0x10 // Memory Bar Register Offset
|
||||
#define XHC_PCI_BAR_MASK 0xFFFF // Memory Base Address Mask
|
||||
|
||||
#define XHC_PCI_SBRN_OFFSET 0x60 // Serial Bus Release Number Register Offset
|
||||
#define XHC_PCI_SBRN_OFFSET 0x60 // Serial Bus Release Number Register Offset
|
||||
|
||||
#define USB_HUB_CLASS_CODE 0x09
|
||||
#define USB_HUB_SUBCLASS_CODE 0x00
|
||||
#define USB_HUB_CLASS_CODE 0x09
|
||||
#define USB_HUB_SUBCLASS_CODE 0x00
|
||||
|
||||
#define XHC_CAP_USB_LEGACY 0x01
|
||||
#define XHC_CAP_USB_DEBUG 0x0A
|
||||
#define XHC_CAP_USB_LEGACY 0x01
|
||||
#define XHC_CAP_USB_DEBUG 0x0A
|
||||
|
||||
//============================================//
|
||||
// ============================================//
|
||||
// XHCI register offset //
|
||||
//============================================//
|
||||
// ============================================//
|
||||
|
||||
//
|
||||
// Capability registers offset
|
||||
//
|
||||
#define XHC_CAPLENGTH_OFFSET 0x00 // Capability register length offset
|
||||
#define XHC_HCIVERSION_OFFSET 0x02 // Interface Version Number 02-03h
|
||||
#define XHC_HCSPARAMS1_OFFSET 0x04 // Structural Parameters 1
|
||||
#define XHC_HCSPARAMS2_OFFSET 0x08 // Structural Parameters 2
|
||||
#define XHC_HCSPARAMS3_OFFSET 0x0c // Structural Parameters 3
|
||||
#define XHC_HCCPARAMS_OFFSET 0x10 // Capability Parameters
|
||||
#define XHC_DBOFF_OFFSET 0x14 // Doorbell Offset
|
||||
#define XHC_RTSOFF_OFFSET 0x18 // Runtime Register Space Offset
|
||||
#define XHC_CAPLENGTH_OFFSET 0x00 // Capability register length offset
|
||||
#define XHC_HCIVERSION_OFFSET 0x02 // Interface Version Number 02-03h
|
||||
#define XHC_HCSPARAMS1_OFFSET 0x04 // Structural Parameters 1
|
||||
#define XHC_HCSPARAMS2_OFFSET 0x08 // Structural Parameters 2
|
||||
#define XHC_HCSPARAMS3_OFFSET 0x0c // Structural Parameters 3
|
||||
#define XHC_HCCPARAMS_OFFSET 0x10 // Capability Parameters
|
||||
#define XHC_DBOFF_OFFSET 0x14 // Doorbell Offset
|
||||
#define XHC_RTSOFF_OFFSET 0x18 // Runtime Register Space Offset
|
||||
|
||||
//
|
||||
// Operational registers offset
|
||||
//
|
||||
#define XHC_USBCMD_OFFSET 0x0000 // USB Command Register Offset
|
||||
#define XHC_USBSTS_OFFSET 0x0004 // USB Status Register Offset
|
||||
#define XHC_PAGESIZE_OFFSET 0x0008 // USB Page Size Register Offset
|
||||
#define XHC_DNCTRL_OFFSET 0x0014 // Device Notification Control Register Offset
|
||||
#define XHC_CRCR_OFFSET 0x0018 // Command Ring Control Register Offset
|
||||
#define XHC_DCBAAP_OFFSET 0x0030 // Device Context Base Address Array Pointer Register Offset
|
||||
#define XHC_CONFIG_OFFSET 0x0038 // Configure Register Offset
|
||||
#define XHC_PORTSC_OFFSET 0x0400 // Port Status and Control Register Offset
|
||||
#define XHC_USBCMD_OFFSET 0x0000 // USB Command Register Offset
|
||||
#define XHC_USBSTS_OFFSET 0x0004 // USB Status Register Offset
|
||||
#define XHC_PAGESIZE_OFFSET 0x0008 // USB Page Size Register Offset
|
||||
#define XHC_DNCTRL_OFFSET 0x0014 // Device Notification Control Register Offset
|
||||
#define XHC_CRCR_OFFSET 0x0018 // Command Ring Control Register Offset
|
||||
#define XHC_DCBAAP_OFFSET 0x0030 // Device Context Base Address Array Pointer Register Offset
|
||||
#define XHC_CONFIG_OFFSET 0x0038 // Configure Register Offset
|
||||
#define XHC_PORTSC_OFFSET 0x0400 // Port Status and Control Register Offset
|
||||
|
||||
//
|
||||
// Runtime registers offset
|
||||
//
|
||||
#define XHC_MFINDEX_OFFSET 0x00 // Microframe Index Register Offset
|
||||
#define XHC_IMAN_OFFSET 0x20 // Interrupter X Management Register Offset
|
||||
#define XHC_IMOD_OFFSET 0x24 // Interrupter X Moderation Register Offset
|
||||
#define XHC_ERSTSZ_OFFSET 0x28 // Event Ring Segment Table Size Register Offset
|
||||
#define XHC_ERSTBA_OFFSET 0x30 // Event Ring Segment Table Base Address Register Offset
|
||||
#define XHC_ERDP_OFFSET 0x38 // Event Ring Dequeue Pointer Register Offset
|
||||
#define XHC_MFINDEX_OFFSET 0x00 // Microframe Index Register Offset
|
||||
#define XHC_IMAN_OFFSET 0x20 // Interrupter X Management Register Offset
|
||||
#define XHC_IMOD_OFFSET 0x24 // Interrupter X Moderation Register Offset
|
||||
#define XHC_ERSTSZ_OFFSET 0x28 // Event Ring Segment Table Size Register Offset
|
||||
#define XHC_ERSTBA_OFFSET 0x30 // Event Ring Segment Table Base Address Register Offset
|
||||
#define XHC_ERDP_OFFSET 0x38 // Event Ring Dequeue Pointer Register Offset
|
||||
|
||||
//
|
||||
// Debug registers offset
|
||||
//
|
||||
#define XHC_DC_DCCTRL 0x20
|
||||
#define XHC_DC_DCCTRL 0x20
|
||||
|
||||
#define USBLEGSP_BIOS_SEMAPHORE BIT16 // HC BIOS Owned Semaphore
|
||||
#define USBLEGSP_OS_SEMAPHORE BIT24 // HC OS Owned Semaphore
|
||||
#define USBLEGSP_BIOS_SEMAPHORE BIT16 // HC BIOS Owned Semaphore
|
||||
#define USBLEGSP_OS_SEMAPHORE BIT24 // HC OS Owned Semaphore
|
||||
|
||||
#pragma pack (1)
|
||||
typedef struct {
|
||||
UINT8 MaxSlots; // Number of Device Slots
|
||||
UINT16 MaxIntrs:11; // Number of Interrupters
|
||||
UINT16 Rsvd:5;
|
||||
UINT8 MaxPorts; // Number of Ports
|
||||
UINT8 MaxSlots; // Number of Device Slots
|
||||
UINT16 MaxIntrs : 11; // Number of Interrupters
|
||||
UINT16 Rsvd : 5;
|
||||
UINT8 MaxPorts; // Number of Ports
|
||||
} HCSPARAMS1;
|
||||
|
||||
//
|
||||
// Structural Parameters 1 Register Bitmap Definition
|
||||
//
|
||||
typedef union {
|
||||
UINT32 Dword;
|
||||
HCSPARAMS1 Data;
|
||||
UINT32 Dword;
|
||||
HCSPARAMS1 Data;
|
||||
} XHC_HCSPARAMS1;
|
||||
|
||||
typedef struct {
|
||||
UINT32 Ist:4; // Isochronous Scheduling Threshold
|
||||
UINT32 Erst:4; // Event Ring Segment Table Max
|
||||
UINT32 Rsvd:13;
|
||||
UINT32 ScratchBufHi:5; // Max Scratchpad Buffers Hi
|
||||
UINT32 Spr:1; // Scratchpad Restore
|
||||
UINT32 ScratchBufLo:5; // Max Scratchpad Buffers Lo
|
||||
UINT32 Ist : 4; // Isochronous Scheduling Threshold
|
||||
UINT32 Erst : 4; // Event Ring Segment Table Max
|
||||
UINT32 Rsvd : 13;
|
||||
UINT32 ScratchBufHi : 5; // Max Scratchpad Buffers Hi
|
||||
UINT32 Spr : 1; // Scratchpad Restore
|
||||
UINT32 ScratchBufLo : 5; // Max Scratchpad Buffers Lo
|
||||
} HCSPARAMS2;
|
||||
|
||||
//
|
||||
// Structural Parameters 2 Register Bitmap Definition
|
||||
//
|
||||
typedef union {
|
||||
UINT32 Dword;
|
||||
HCSPARAMS2 Data;
|
||||
UINT32 Dword;
|
||||
HCSPARAMS2 Data;
|
||||
} XHC_HCSPARAMS2;
|
||||
|
||||
typedef struct {
|
||||
UINT16 Ac64:1; // 64-bit Addressing Capability
|
||||
UINT16 Bnc:1; // BW Negotiation Capability
|
||||
UINT16 Csz:1; // Context Size
|
||||
UINT16 Ppc:1; // Port Power Control
|
||||
UINT16 Pind:1; // Port Indicators
|
||||
UINT16 Lhrc:1; // Light HC Reset Capability
|
||||
UINT16 Ltc:1; // Latency Tolerance Messaging Capability
|
||||
UINT16 Nss:1; // No Secondary SID Support
|
||||
UINT16 Pae:1; // Parse All Event Data
|
||||
UINT16 Rsvd:3;
|
||||
UINT16 MaxPsaSize:4; // Maximum Primary Stream Array Size
|
||||
UINT16 ExtCapReg; // xHCI Extended Capabilities Pointer
|
||||
UINT16 Ac64 : 1; // 64-bit Addressing Capability
|
||||
UINT16 Bnc : 1; // BW Negotiation Capability
|
||||
UINT16 Csz : 1; // Context Size
|
||||
UINT16 Ppc : 1; // Port Power Control
|
||||
UINT16 Pind : 1; // Port Indicators
|
||||
UINT16 Lhrc : 1; // Light HC Reset Capability
|
||||
UINT16 Ltc : 1; // Latency Tolerance Messaging Capability
|
||||
UINT16 Nss : 1; // No Secondary SID Support
|
||||
UINT16 Pae : 1; // Parse All Event Data
|
||||
UINT16 Rsvd : 3;
|
||||
UINT16 MaxPsaSize : 4; // Maximum Primary Stream Array Size
|
||||
UINT16 ExtCapReg; // xHCI Extended Capabilities Pointer
|
||||
} HCCPARAMS;
|
||||
|
||||
//
|
||||
// Capability Parameters Register Bitmap Definition
|
||||
//
|
||||
typedef union {
|
||||
UINT32 Dword;
|
||||
HCCPARAMS Data;
|
||||
UINT32 Dword;
|
||||
HCCPARAMS Data;
|
||||
} XHC_HCCPARAMS;
|
||||
|
||||
#pragma pack ()
|
||||
@@ -135,62 +135,62 @@ typedef union {
|
||||
//
|
||||
// Register Bit Definition
|
||||
//
|
||||
#define XHC_USBCMD_RUN BIT0 // Run/Stop
|
||||
#define XHC_USBCMD_RESET BIT1 // Host Controller Reset
|
||||
#define XHC_USBCMD_INTE BIT2 // Interrupter Enable
|
||||
#define XHC_USBCMD_HSEE BIT3 // Host System Error Enable
|
||||
#define XHC_USBCMD_RUN BIT0 // Run/Stop
|
||||
#define XHC_USBCMD_RESET BIT1 // Host Controller Reset
|
||||
#define XHC_USBCMD_INTE BIT2 // Interrupter Enable
|
||||
#define XHC_USBCMD_HSEE BIT3 // Host System Error Enable
|
||||
|
||||
#define XHC_USBSTS_HALT BIT0 // Host Controller Halted
|
||||
#define XHC_USBSTS_HSE BIT2 // Host System Error
|
||||
#define XHC_USBSTS_EINT BIT3 // Event Interrupt
|
||||
#define XHC_USBSTS_PCD BIT4 // Port Change Detect
|
||||
#define XHC_USBSTS_SSS BIT8 // Save State Status
|
||||
#define XHC_USBSTS_RSS BIT9 // Restore State Status
|
||||
#define XHC_USBSTS_SRE BIT10 // Save/Restore Error
|
||||
#define XHC_USBSTS_CNR BIT11 // Host Controller Not Ready
|
||||
#define XHC_USBSTS_HCE BIT12 // Host Controller Error
|
||||
#define XHC_USBSTS_HALT BIT0 // Host Controller Halted
|
||||
#define XHC_USBSTS_HSE BIT2 // Host System Error
|
||||
#define XHC_USBSTS_EINT BIT3 // Event Interrupt
|
||||
#define XHC_USBSTS_PCD BIT4 // Port Change Detect
|
||||
#define XHC_USBSTS_SSS BIT8 // Save State Status
|
||||
#define XHC_USBSTS_RSS BIT9 // Restore State Status
|
||||
#define XHC_USBSTS_SRE BIT10 // Save/Restore Error
|
||||
#define XHC_USBSTS_CNR BIT11 // Host Controller Not Ready
|
||||
#define XHC_USBSTS_HCE BIT12 // Host Controller Error
|
||||
|
||||
#define XHC_PAGESIZE_MASK 0xFFFF // Page Size
|
||||
#define XHC_PAGESIZE_MASK 0xFFFF // Page Size
|
||||
|
||||
#define XHC_CRCR_RCS BIT0 // Ring Cycle State
|
||||
#define XHC_CRCR_CS BIT1 // Command Stop
|
||||
#define XHC_CRCR_CA BIT2 // Command Abort
|
||||
#define XHC_CRCR_CRR BIT3 // Command Ring Running
|
||||
#define XHC_CRCR_RCS BIT0 // Ring Cycle State
|
||||
#define XHC_CRCR_CS BIT1 // Command Stop
|
||||
#define XHC_CRCR_CA BIT2 // Command Abort
|
||||
#define XHC_CRCR_CRR BIT3 // Command Ring Running
|
||||
|
||||
#define XHC_CONFIG_MASK 0xFF // Command Ring Running
|
||||
#define XHC_CONFIG_MASK 0xFF // Command Ring Running
|
||||
|
||||
#define XHC_PORTSC_CCS BIT0 // Current Connect Status
|
||||
#define XHC_PORTSC_PED BIT1 // Port Enabled/Disabled
|
||||
#define XHC_PORTSC_OCA BIT3 // Over-current Active
|
||||
#define XHC_PORTSC_RESET BIT4 // Port Reset
|
||||
#define XHC_PORTSC_PLS (BIT5|BIT6|BIT7|BIT8) // Port Link State
|
||||
#define XHC_PORTSC_PP BIT9 // Port Power
|
||||
#define XHC_PORTSC_PS (BIT10|BIT11|BIT12|BIT13) // Port Speed
|
||||
#define XHC_PORTSC_LWS BIT16 // Port Link State Write Strobe
|
||||
#define XHC_PORTSC_CSC BIT17 // Connect Status Change
|
||||
#define XHC_PORTSC_PEC BIT18 // Port Enabled/Disabled Change
|
||||
#define XHC_PORTSC_WRC BIT19 // Warm Port Reset Change
|
||||
#define XHC_PORTSC_OCC BIT20 // Over-Current Change
|
||||
#define XHC_PORTSC_PRC BIT21 // Port Reset Change
|
||||
#define XHC_PORTSC_PLC BIT22 // Port Link State Change
|
||||
#define XHC_PORTSC_CEC BIT23 // Port Config Error Change
|
||||
#define XHC_PORTSC_CAS BIT24 // Cold Attach Status
|
||||
#define XHC_PORTSC_CCS BIT0 // Current Connect Status
|
||||
#define XHC_PORTSC_PED BIT1 // Port Enabled/Disabled
|
||||
#define XHC_PORTSC_OCA BIT3 // Over-current Active
|
||||
#define XHC_PORTSC_RESET BIT4 // Port Reset
|
||||
#define XHC_PORTSC_PLS (BIT5|BIT6|BIT7|BIT8) // Port Link State
|
||||
#define XHC_PORTSC_PP BIT9 // Port Power
|
||||
#define XHC_PORTSC_PS (BIT10|BIT11|BIT12|BIT13) // Port Speed
|
||||
#define XHC_PORTSC_LWS BIT16 // Port Link State Write Strobe
|
||||
#define XHC_PORTSC_CSC BIT17 // Connect Status Change
|
||||
#define XHC_PORTSC_PEC BIT18 // Port Enabled/Disabled Change
|
||||
#define XHC_PORTSC_WRC BIT19 // Warm Port Reset Change
|
||||
#define XHC_PORTSC_OCC BIT20 // Over-Current Change
|
||||
#define XHC_PORTSC_PRC BIT21 // Port Reset Change
|
||||
#define XHC_PORTSC_PLC BIT22 // Port Link State Change
|
||||
#define XHC_PORTSC_CEC BIT23 // Port Config Error Change
|
||||
#define XHC_PORTSC_CAS BIT24 // Cold Attach Status
|
||||
|
||||
#define XHC_HUB_PORTSC_CCS BIT0 // Hub's Current Connect Status
|
||||
#define XHC_HUB_PORTSC_PED BIT1 // Hub's Port Enabled/Disabled
|
||||
#define XHC_HUB_PORTSC_OCA BIT3 // Hub's Over-current Active
|
||||
#define XHC_HUB_PORTSC_RESET BIT4 // Hub's Port Reset
|
||||
#define XHC_HUB_PORTSC_PP BIT9 // Hub's Port Power
|
||||
#define XHC_HUB_PORTSC_CSC BIT16 // Hub's Connect Status Change
|
||||
#define XHC_HUB_PORTSC_PEC BIT17 // Hub's Port Enabled/Disabled Change
|
||||
#define XHC_HUB_PORTSC_OCC BIT19 // Hub's Over-Current Change
|
||||
#define XHC_HUB_PORTSC_PRC BIT20 // Hub's Port Reset Change
|
||||
#define XHC_HUB_PORTSC_BHRC BIT21 // Hub's Port Warm Reset Change
|
||||
#define XHC_IMAN_IP BIT0 // Interrupt Pending
|
||||
#define XHC_IMAN_IE BIT1 // Interrupt Enable
|
||||
#define XHC_HUB_PORTSC_CCS BIT0 // Hub's Current Connect Status
|
||||
#define XHC_HUB_PORTSC_PED BIT1 // Hub's Port Enabled/Disabled
|
||||
#define XHC_HUB_PORTSC_OCA BIT3 // Hub's Over-current Active
|
||||
#define XHC_HUB_PORTSC_RESET BIT4 // Hub's Port Reset
|
||||
#define XHC_HUB_PORTSC_PP BIT9 // Hub's Port Power
|
||||
#define XHC_HUB_PORTSC_CSC BIT16 // Hub's Connect Status Change
|
||||
#define XHC_HUB_PORTSC_PEC BIT17 // Hub's Port Enabled/Disabled Change
|
||||
#define XHC_HUB_PORTSC_OCC BIT19 // Hub's Over-Current Change
|
||||
#define XHC_HUB_PORTSC_PRC BIT20 // Hub's Port Reset Change
|
||||
#define XHC_HUB_PORTSC_BHRC BIT21 // Hub's Port Warm Reset Change
|
||||
#define XHC_IMAN_IP BIT0 // Interrupt Pending
|
||||
#define XHC_IMAN_IE BIT1 // Interrupt Enable
|
||||
|
||||
#define XHC_IMODI_MASK 0x0000FFFF // Interrupt Moderation Interval
|
||||
#define XHC_IMODC_MASK 0xFFFF0000 // Interrupt Moderation Counter
|
||||
#define XHC_IMODI_MASK 0x0000FFFF // Interrupt Moderation Interval
|
||||
#define XHC_IMODC_MASK 0xFFFF0000 // Interrupt Moderation Counter
|
||||
|
||||
//
|
||||
// Hub Class Feature Selector for Clear Port Feature Request
|
||||
@@ -198,8 +198,8 @@ typedef union {
|
||||
// For more details, Please refer to USB 3.0 Spec Table 10-7.
|
||||
//
|
||||
typedef enum {
|
||||
Usb3PortBHPortReset = 28,
|
||||
Usb3PortBHPortResetChange = 29
|
||||
Usb3PortBHPortReset = 28,
|
||||
Usb3PortBHPortResetChange = 29
|
||||
} XHC_PORT_FEATURE;
|
||||
|
||||
//
|
||||
@@ -207,16 +207,16 @@ typedef enum {
|
||||
// UEFI's port states.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 HwState;
|
||||
UINT16 UefiState;
|
||||
UINT32 HwState;
|
||||
UINT16 UefiState;
|
||||
} USB_PORT_STATE_MAP;
|
||||
|
||||
//
|
||||
// Structure to map the hardware port states to feature selector for clear port feature request.
|
||||
//
|
||||
typedef struct {
|
||||
UINT32 HwState;
|
||||
UINT16 Selector;
|
||||
UINT32 HwState;
|
||||
UINT16 Selector;
|
||||
} USB_CLEAR_PORT_MAP;
|
||||
|
||||
/**
|
||||
@@ -231,8 +231,8 @@ typedef struct {
|
||||
**/
|
||||
UINT8
|
||||
XhcReadCapReg8 (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -247,8 +247,8 @@ XhcReadCapReg8 (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadCapReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -263,8 +263,8 @@ XhcReadCapReg (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadOpReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -277,12 +277,11 @@ XhcReadOpReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteOpReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Read XHCI runtime register.
|
||||
|
||||
@@ -294,8 +293,8 @@ XhcWriteOpReg (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -308,12 +307,11 @@ XhcReadRuntimeReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Write the data to the XHCI door bell register.
|
||||
|
||||
@@ -324,9 +322,9 @@ XhcWriteRuntimeReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteDoorBellReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -339,9 +337,9 @@ XhcWriteDoorBellReg (
|
||||
**/
|
||||
VOID
|
||||
XhcSetOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -354,9 +352,9 @@ XhcSetOpRegBit (
|
||||
**/
|
||||
VOID
|
||||
XhcClearOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -375,11 +373,11 @@ XhcClearOpRegBit (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcWaitOpRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit,
|
||||
IN BOOLEAN WaitToSet,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit,
|
||||
IN BOOLEAN WaitToSet,
|
||||
IN UINT32 Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -393,8 +391,8 @@ XhcWaitOpRegBit (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -407,9 +405,9 @@ XhcReadRuntimeReg (
|
||||
**/
|
||||
VOID
|
||||
XhcWriteRuntimeReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Data
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -422,9 +420,9 @@ XhcWriteRuntimeReg (
|
||||
**/
|
||||
VOID
|
||||
XhcSetRuntimeRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -437,9 +435,9 @@ XhcSetRuntimeRegBit (
|
||||
**/
|
||||
VOID
|
||||
XhcClearRuntimeRegBit (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset,
|
||||
IN UINT32 Bit
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -453,8 +451,8 @@ XhcClearRuntimeRegBit (
|
||||
**/
|
||||
UINT32
|
||||
XhcReadExtCapReg (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Offset
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -468,7 +466,7 @@ XhcReadExtCapReg (
|
||||
**/
|
||||
BOOLEAN
|
||||
XhcIsHalt (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -482,7 +480,7 @@ XhcIsHalt (
|
||||
**/
|
||||
BOOLEAN
|
||||
XhcIsSysError (
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
IN USB_XHCI_INSTANCE *Xhc
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -497,8 +495,8 @@ XhcIsSysError (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcResetHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -513,8 +511,8 @@ XhcResetHC (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcHaltHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -529,8 +527,8 @@ XhcHaltHC (
|
||||
**/
|
||||
EFI_STATUS
|
||||
XhcRunHC (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT32 Timeout
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -544,8 +542,8 @@ XhcRunHC (
|
||||
**/
|
||||
UINT32
|
||||
XhcGetCapabilityAddr (
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 CapId
|
||||
IN USB_XHCI_INSTANCE *Xhc,
|
||||
IN UINT8 CapId
|
||||
);
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user