From mboxrd@z Thu Jan 1 00:00:00 1970 Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/XhciDxe: Add a parameter to indicate whether the memory allocation is for TRB Ring or not. To: Jiading Zhang ,devel@edk2.groups.io From: "Jiading Zhang" X-Originating-Location: Beijing, CN (218.247.145.3) X-Originating-Platform: Windows Chrome 106 User-Agent: GROUPS.IO Web Poster MIME-Version: 1.0 Date: Mon, 17 Oct 2022 20:06:58 -0700 References: In-Reply-To: Message-ID: <2704.1666062418243055979@groups.io> X-Groupsio-MsgNum: 95305 Content-Type: multipart/mixed; boundary="kNHy80VObEXngus7OCsb" --kNHy80VObEXngus7OCsb Content-Type: multipart/alternative; boundary="QbLaj6dVeJq4QskiKNWy" --QbLaj6dVeJq4QskiKNWy Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Hi, I renamed the parameter from =E2=80=98AllocationForTrbRing=E2=80=99 to =E2= =80=98AllocationForRing=E2=80=99 in UsbHcAllocMemFromBlock, which matchs th= e description comment. And the attachment is the updated patch file. According the Xhci Spec, TRB Rings may be larger than a Page, however they = shall not cross a 64K byte boundary, so add a parameter to indicate whether= the memory allocation is for TRB Rings or not. It will ensure the allocati= on not crossing 64K boundary in UsbHcAllocMemFromBlock if the memory is all= ocated for TRB Rings. Signed-off-by: jdzhang --- MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c=C2=A0 | 37 +++++++++++++++++++----- MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h=C2=A0 | 10 +++++-- MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 16 +++++----- 3 files changed, 44 insertions(+), 19 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c b/MdeModulePkg/Bus/Pci= /XhciDxe/UsbHcMem.c index 99fb3521d5..4373b2c99e 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c @@ -132,8 +132,9 @@ UsbHcFreeMemBlock ( /** Alloc some memory from the block. -=C2=A0 @param=C2=A0 Block=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 The memory blo= ck to allocate memory from. -=C2=A0 @param=C2=A0 Units=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Number of memo= ry units to allocate. +=C2=A0 @param=C2=A0 Block=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 The memory block to allocate memory from. +=C2=A0 @param=C2=A0 Units=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 Number of memory units to allocate. +=C2=A0 @param=C2=A0 AllocationForRing=C2=A0 =C2=A0 The allocated memory is= for Ring or not. @return The pointer to the allocated memory. If couldn't allocate the neede= d memory, the return value is NULL. @@ -142,7 +143,8 @@ UsbHcFreeMemBlock ( VOID * UsbHcAllocMemFromBlock ( IN=C2=A0 USBHC_MEM_BLOCK=C2=A0 *Block, -=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Units +=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Units, +=C2=A0 IN=C2=A0 BOOLEAN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 AllocationForRin= g ) { UINTN=C2=A0 Byte; @@ -151,12 +153,15 @@ UsbHcAllocMemFromBlock ( UINT8=C2=A0 StartBit; UINTN=C2=A0 Available; UINTN=C2=A0 Count; +=C2=A0 UINTN=C2=A0 MemUnitAddr; +=C2=A0 UINTN=C2=A0 AlignmentMask; ASSERT ((Block !=3D 0) && (Units !=3D 0)); StartByte =3D 0; StartBit=C2=A0 =3D 0; Available =3D 0; +=C2=A0 AlignmentMask =3D ~((UINTN)USBHC_MEM_TRB_RINGS_BOUNDARY - 1); for (Byte =3D 0, Bit =3D 0; Byte < Block->BitsLen;) { // @@ -165,6 +170,20 @@ UsbHcAllocMemFromBlock ( // Available counts the consective number of zero bit. // if (!USB_HC_BIT_IS_SET (Block->Bits[Byte], Bit)) { +=C2=A0 =C2=A0 =C2=A0 if (AllocationForRing && (Available !=3D 0)) { +=C2=A0 =C2=A0 =C2=A0 =C2=A0 MemUnitAddr =3D (UINTN)Block->BufHost + (Byte = * 8 + Bit) * USBHC_MEM_UNIT; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((MemUnitAddr & AlignmentMask) !=3D ((MemUn= itAddr - USBHC_MEM_UNIT) & AlignmentMask)) { +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // If the TRB Ring memory cross 64K-byt= e boundary, then restart the +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // search starting at current memory un= it. +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // Doing so is to meet the TRB Ring bou= ndary requirement in XHCI spec. +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 // +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Available =3D 0; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 StartByte =3D Byte; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 StartBit=C2=A0 =3D Bit; +=C2=A0 =C2=A0 =C2=A0 =C2=A0 } +=C2=A0 =C2=A0 =C2=A0 } + Available++; if (Available >=3D Units) { @@ -438,8 +457,9 @@ UsbHcFreeMemPool ( Allocate some memory from the host controller's memory pool which can be used to communicate with host controller. -=C2=A0 @param=C2=A0 Pool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0The host = controller's memory pool. -=C2=A0 @param=C2=A0 Size=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size of t= he memory to allocate. +=C2=A0 @param=C2=A0 Pool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0The host controller's memory pool. +=C2=A0 @param=C2=A0 Size=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0Size of the memory to allocate. +=C2=A0 @param=C2=A0 AllocationForRing=C2=A0 =C2=A0 The allocated memory is= for Ring or not. @return The allocated memory or NULL. @@ -447,7 +467,8 @@ UsbHcFreeMemPool ( VOID * UsbHcAllocateMem ( IN=C2=A0 USBHC_MEM_POOL=C2=A0 *Pool, -=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size +=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size, +=C2=A0 IN=C2=A0 BOOLEAN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AllocationForRing ) { USBHC_MEM_BLOCK=C2=A0 *Head; @@ -466,7 +487,7 @@ UsbHcAllocateMem ( // First check whether current memory blocks can satisfy the allocation. // for (Block =3D Head; Block !=3D NULL; Block =3D Block->Next) { -=C2=A0 =C2=A0 Mem =3D UsbHcAllocMemFromBlock (Block, AllocSize / USBHC_MEM= _UNIT); +=C2=A0 =C2=A0 Mem =3D UsbHcAllocMemFromBlock (Block, AllocSize / USBHC_MEM= _UNIT, AllocationForRing); if (Mem !=3D NULL) { ZeroMem (Mem, Size); @@ -501,7 +522,7 @@ UsbHcAllocateMem ( // Add the new memory block to the pool, then allocate memory from it // UsbHcInsertMemBlockToPool (Head, NewBlock); -=C2=A0 Mem =3D UsbHcAllocMemFromBlock (NewBlock, AllocSize / USBHC_MEM_UNI= T); +=C2=A0 Mem =3D UsbHcAllocMemFromBlock (NewBlock, AllocSize / USBHC_MEM_UNI= T, AllocationForRing); if (Mem !=3D NULL) { ZeroMem (Mem, Size); diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h b/MdeModulePkg/Bus/Pci= /XhciDxe/UsbHcMem.h index 48ae86141c..dfea0e52b3 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h +++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h @@ -48,6 +48,8 @@ typedef struct _USBHC_MEM_POOL { #define USBHC_MEM_ROUND(Len)=C2=A0 (((Len) + USBHC_MEM_UNIT_MASK) & (~USBHC= _MEM_UNIT_MASK)) +#define USBHC_MEM_TRB_RINGS_BOUNDARY=C2=A0 =C2=A0 SIZE_64KB + // // Advance the byte and bit to the next bit, adjust byte accordingly. // @@ -92,8 +94,9 @@ UsbHcFreeMemPool ( Allocate some memory from the host controller's memory pool which can be used to communicate with host controller. -=C2=A0 @param=C2=A0 Pool=C2=A0 The host controller's memory pool. -=C2=A0 @param=C2=A0 Size=C2=A0 Size of the memory to allocate. +=C2=A0 @param=C2=A0 Pool=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0The host controller's memory pool. +=C2=A0 @param=C2=A0 Size=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0Size of the memory to allocate. +=C2=A0 @param=C2=A0 AllocationForRing=C2=A0 =C2=A0 The allocated memory is= for Ring or not. @return The allocated memory or NULL. @@ -101,7 +104,8 @@ UsbHcFreeMemPool ( VOID * UsbHcAllocateMem ( IN=C2=A0 USBHC_MEM_POOL=C2=A0 *Pool, -=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size +=C2=A0 IN=C2=A0 UINTN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Size, +=C2=A0 IN=C2=A0 BOOLEAN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0AllocationForRing ); /** diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pc= i/XhciDxe/XhciSched.c index 4ae0297607..13b0400e83 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c @@ -506,7 +506,7 @@ XhcInitSched ( // Software shall set Device Context Base Address Array entries for unalloc= ated Device Slots to '0'. // Entries =3D (Xhc->MaxSlotsEn + 1) * sizeof (UINT64); -=C2=A0 Dcbaa=C2=A0 =C2=A0=3D UsbHcAllocateMem (Xhc->MemPool, Entries); +=C2=A0 Dcbaa=C2=A0 =C2=A0=3D UsbHcAllocateMem (Xhc->MemPool, Entries, FALS= E); ASSERT (Dcbaa !=3D NULL); ZeroMem (Dcbaa, Entries); @@ -795,7 +795,7 @@ CreateEventRing ( ASSERT (EventRing !=3D NULL); Size =3D sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER; -=C2=A0 Buf=C2=A0 =3D UsbHcAllocateMem (Xhc->MemPool, Size); +=C2=A0 Buf=C2=A0 =3D UsbHcAllocateMem (Xhc->MemPool, Size, TRUE); ASSERT (Buf !=3D NULL); ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0); ZeroMem (Buf, Size); @@ -814,7 +814,7 @@ CreateEventRing ( EventRing->EventRingCCS =3D 1; Size =3D sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBER; -=C2=A0 Buf=C2=A0 =3D UsbHcAllocateMem (Xhc->MemPool, Size); +=C2=A0 Buf=C2=A0 =3D UsbHcAllocateMem (Xhc->MemPool, Size, FALSE); ASSERT (Buf !=3D NULL); ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0); ZeroMem (Buf, Size); @@ -892,7 +892,7 @@ CreateTransferRing ( LINK_TRB=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 *EndTrb; EFI_PHYSICAL_ADDRESS=C2=A0 PhyAddr; -=C2=A0 Buf =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (TRB_TEMPLATE) * Trb= Num); +=C2=A0 Buf =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (TRB_TEMPLATE) * Trb= Num, TRUE); ASSERT (Buf !=3D NULL); ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0); ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum); @@ -2182,7 +2182,7 @@ XhcInitializeDeviceSlot ( // 4.3.3 Device Slot Initialization // 1) Allocate an Input Context data structure (6.2.5) and initialize all f= ields to '0'. // -=C2=A0 InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (INPUT_CONT= EXT)); +=C2=A0 InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (INPUT_CONT= EXT), FALSE); ASSERT (InputContext !=3D NULL); ASSERT (((UINTN)InputContext & 0x3F) =3D=3D 0); ZeroMem (InputContext, sizeof (INPUT_CONTEXT)); @@ -2284,7 +2284,7 @@ XhcInitializeDeviceSlot ( // // 6) Allocate the Output Device Context data structure (6.2.1) and initial= ize it to '0'. // -=C2=A0 OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (DEVICE_CO= NTEXT)); +=C2=A0 OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (DEVICE_CO= NTEXT), FALSE); ASSERT (OutputContext !=3D NULL); ASSERT (((UINTN)OutputContext & 0x3F) =3D=3D 0); ZeroMem (OutputContext, sizeof (DEVICE_CONTEXT)); @@ -2398,7 +2398,7 @@ XhcInitializeDeviceSlot64 ( // 4.3.3 Device Slot Initialization // 1) Allocate an Input Context data structure (6.2.5) and initialize all f= ields to '0'. // -=C2=A0 InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (INPUT_CONT= EXT_64)); +=C2=A0 InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (INPUT_CONT= EXT_64), FALSE); ASSERT (InputContext !=3D NULL); ASSERT (((UINTN)InputContext & 0x3F) =3D=3D 0); ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64)); @@ -2500,7 +2500,7 @@ XhcInitializeDeviceSlot64 ( // // 6) Allocate the Output Device Context data structure (6.2.1) and initial= ize it to '0'. // -=C2=A0 OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (DEVICE_CO= NTEXT_64)); +=C2=A0 OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (DEVICE_CO= NTEXT_64), FALSE); ASSERT (OutputContext !=3D NULL); ASSERT (((UINTN)OutputContext & 0x3F) =3D=3D 0); ZeroMem (OutputContext, sizeof (DEVICE_CONTEXT_64)); -- 2.20.1.windows.1 --QbLaj6dVeJq4QskiKNWy Content-Type: text/html; charset="utf-8" Content-Transfer-Encoding: quoted-printable
Hi, 
   I renamed the parameter from= ‘AllocationForTrbRing’ to ‘AllocationForRing’ in&n= bsp;UsbHcAllocMemFromBlock, which matchs the description co= mment. And the attachment is the updated patch file.


According the Xhci Spec, TRB Rings may be larger than a Page, however the= y shall not cross a 64K byte boundary, so add a parameter to indicate wheth= er the memory allocation is for TRB Rings or not. It will ensure the alloca= tion not crossing 64K boundary in UsbHcAllocMemFromBlock if the memory is a= llocated for TRB Rings.
 
Signed-off-by: jdzhang <jdzhang@kunluntech.com.cn>
---
 MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c  | 37 +++++++++++++= ++++++-----
 MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h  | 10 +++++--
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 16 +++++-----
 3 files changed, 44 insertions(+), 19 deletions(-)
 
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c b/MdeModulePkg/Bu= s/Pci/XhciDxe/UsbHcMem.c
index 99fb3521d5..4373b2c99e 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.c
@@ -132,8 +132,9 @@ UsbHcFreeMemBlock (
 /**
   Alloc some memory from the block.
 
-  @param  Block          The memor= y block to allocate memory from.
-  @param  Units          Number of= memory units to allocate.
+  @param  Block            &n= bsp;   The memory block to allocate memory from.
+  @param  Units            &n= bsp;   Number of memory units to allocate.
+  @param  AllocationForRing    The allocated memo= ry is for Ring or not.
 
   @return The pointer to the allocated memory. If couldn't = allocate the needed memory,
           the return value is NULL.
@@ -142,7 +143,8 @@ UsbHcFreeMemBlock (
 VOID *
 UsbHcAllocMemFromBlock (
   IN  USBHC_MEM_BLOCK  *Block,
-  IN  UINTN            Units<= /div>
+  IN  UINTN            Units,=
+  IN  BOOLEAN          AllocationF= orRing
   )
 {
   UINTN  Byte;
@@ -151,12 +153,15 @@ UsbHcAllocMemFromBlock (
   UINT8  StartBit;
   UINTN  Available;
   UINTN  Count;
+  UINTN  MemUnitAddr;
+  UINTN  AlignmentMask;
 
   ASSERT ((Block !=3D 0) && (Units !=3D 0));
 
   StartByte =3D 0;
   StartBit  =3D 0;
   Available =3D 0;
+  AlignmentMask =3D ~((UINTN)USBHC_MEM_TRB_RINGS_BOUNDARY - 1);<= /div>
 
   for (Byte =3D 0, Bit =3D 0; Byte < Block->BitsLen;)= {
     //
@@ -165,6 +170,20 @@ UsbHcAllocMemFromBlock (
     // Available counts the consective number of zero = bit.
     //
     if (!USB_HC_BIT_IS_SET (Block->Bits[Byte], Bit)= ) {
+      if (AllocationForRing && (Available !=3D= 0)) {
+        MemUnitAddr =3D (UINTN)Block->BufHost = + (Byte * 8 + Bit) * USBHC_MEM_UNIT;
+        if ((MemUnitAddr & AlignmentMask) != =3D ((MemUnitAddr - USBHC_MEM_UNIT) & AlignmentMask)) {
+          //
+          // If the TRB Ring memory cross 64= K-byte boundary, then restart the
+          // search starting at current memo= ry unit.
+          // Doing so is to meet the TRB Rin= g boundary requirement in XHCI spec. 
+          //
+          Available =3D 0;
+          StartByte =3D Byte;
+          StartBit  =3D Bit;
+        }
+      }
+
       Available++;
 
       if (Available >=3D Units) {
@@ -438,8 +457,9 @@ UsbHcFreeMemPool (
   Allocate some memory from the host controller's memory po= ol
   which can be used to communicate with host controller.
 
-  @param  Pool           The = host controller's memory pool.
-  @param  Size           Size= of the memory to allocate.
+  @param  Pool            &nb= sp;    The host controller's memory pool.
+  @param  Size            &nb= sp;    Size of the memory to allocate.
+  @param  AllocationForRing    The allocated memo= ry is for Ring or not.
 
   @return The allocated memory or NULL.
 
@@ -447,7 +467,8 @@ UsbHcFreeMemPool (
 VOID *
 UsbHcAllocateMem (
   IN  USBHC_MEM_POOL  *Pool,
-  IN  UINTN           Size
+  IN  UINTN           Size,
+  IN  BOOLEAN         AllocationFo= rRing
   )
 {
   USBHC_MEM_BLOCK  *Head;
@@ -466,7 +487,7 @@ UsbHcAllocateMem (
   // First check whether current memory blocks can satisfy = the allocation.
   //
   for (Block =3D Head; Block !=3D NULL; Block =3D Block->= ;Next) {
-    Mem =3D UsbHcAllocMemFromBlock (Block, AllocSize / USBH= C_MEM_UNIT);
+    Mem =3D UsbHcAllocMemFromBlock (Block, AllocSize / USBH= C_MEM_UNIT, AllocationForRing);
 
     if (Mem !=3D NULL) {
       ZeroMem (Mem, Size);
@@ -501,7 +522,7 @@ UsbHcAllocateMem (
   // Add the new memory block to the pool, then allocate me= mory from it
   //
   UsbHcInsertMemBlockToPool (Head, NewBlock);
-  Mem =3D UsbHcAllocMemFromBlock (NewBlock, AllocSize / USBHC_ME= M_UNIT);
+  Mem =3D UsbHcAllocMemFromBlock (NewBlock, AllocSize / USBHC_ME= M_UNIT, AllocationForRing);
 
   if (Mem !=3D NULL) {
     ZeroMem (Mem, Size);
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h b/MdeModulePkg/Bu= s/Pci/XhciDxe/UsbHcMem.h
index 48ae86141c..dfea0e52b3 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/UsbHcMem.h
@@ -48,6 +48,8 @@ typedef struct _USBHC_MEM_POOL {
 
 #define USBHC_MEM_ROUND(Len)  (((Len) + USBHC_MEM_UNIT_MASK= ) & (~USBHC_MEM_UNIT_MASK))
 
+#define USBHC_MEM_TRB_RINGS_BOUNDARY    SIZE_64KB
+
 //
 // Advance the byte and bit to the next bit, adjust byte accordi= ngly.
 //
@@ -92,8 +94,9 @@ UsbHcFreeMemPool (
   Allocate some memory from the host controller's memory po= ol
   which can be used to communicate with host controller.
 
-  @param  Pool  The host controller's memory pool.
-  @param  Size  Size of the memory to allocate.
+  @param  Pool            &nb= sp;    The host controller's memory pool.
+  @param  Size            &nb= sp;    Size of the memory to allocate.
+  @param  AllocationForRing    The allocated memo= ry is for Ring or not.
 
   @return The allocated memory or NULL.
 
@@ -101,7 +104,8 @@ UsbHcFreeMemPool (
 VOID *
 UsbHcAllocateMem (
   IN  USBHC_MEM_POOL  *Pool,
-  IN  UINTN           Size
+  IN  UINTN           Size,
+  IN  BOOLEAN         AllocationFo= rRing
   );
 
 /**
diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/B= us/Pci/XhciDxe/XhciSched.c
index 4ae0297607..13b0400e83 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -506,7 +506,7 @@ XhcInitSched (
   // Software shall set Device Context Base Address Array e= ntries for unallocated Device Slots to '0'.
   //
   Entries =3D (Xhc->MaxSlotsEn + 1) * sizeof (UINT64);
-  Dcbaa   =3D UsbHcAllocateMem (Xhc->MemPool, Entri= es);
+  Dcbaa   =3D UsbHcAllocateMem (Xhc->MemPool, Entri= es, FALSE);
   ASSERT (Dcbaa !=3D NULL);
   ZeroMem (Dcbaa, Entries);
 
@@ -795,7 +795,7 @@ CreateEventRing (
   ASSERT (EventRing !=3D NULL);
 
   Size =3D sizeof (TRB_TEMPLATE) * EVENT_RING_TRB_NUMBER;
-  Buf  =3D UsbHcAllocateMem (Xhc->MemPool, Size);
+  Buf  =3D UsbHcAllocateMem (Xhc->MemPool, Size, TRUE);<= /div>
   ASSERT (Buf !=3D NULL);
   ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0);
   ZeroMem (Buf, Size);
@@ -814,7 +814,7 @@ CreateEventRing (
   EventRing->EventRingCCS =3D 1;
 
   Size =3D sizeof (EVENT_RING_SEG_TABLE_ENTRY) * ERST_NUMBE= R;
-  Buf  =3D UsbHcAllocateMem (Xhc->MemPool, Size);
+  Buf  =3D UsbHcAllocateMem (Xhc->MemPool, Size, FALSE);=
   ASSERT (Buf !=3D NULL);
   ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0);
   ZeroMem (Buf, Size);
@@ -892,7 +892,7 @@ CreateTransferRing (
   LINK_TRB              = *EndTrb;
   EFI_PHYSICAL_ADDRESS  PhyAddr;
 
-  Buf =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (TRB_TEMPLAT= E) * TrbNum);
+  Buf =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (TRB_TEMPLAT= E) * TrbNum, TRUE);
   ASSERT (Buf !=3D NULL);
   ASSERT (((UINTN)Buf & 0x3F) =3D=3D 0);
   ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum);
@@ -2182,7 +2182,7 @@ XhcInitializeDeviceSlot (
   // 4.3.3 Device Slot Initialization
   // 1) Allocate an Input Context data structure (6.2.5) an= d initialize all fields to '0'.
   //
-  InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (IN= PUT_CONTEXT));
+  InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (IN= PUT_CONTEXT), FALSE);
   ASSERT (InputContext !=3D NULL);
   ASSERT (((UINTN)InputContext & 0x3F) =3D=3D 0);
   ZeroMem (InputContext, sizeof (INPUT_CONTEXT));
@@ -2284,7 +2284,7 @@ XhcInitializeDeviceSlot (
   //
   // 6) Allocate the Output Device Context data structure (= 6.2.1) and initialize it to '0'.
   //
-  OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (D= EVICE_CONTEXT));
+  OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (D= EVICE_CONTEXT), FALSE);
   ASSERT (OutputContext !=3D NULL);
   ASSERT (((UINTN)OutputContext & 0x3F) =3D=3D 0);
   ZeroMem (OutputContext, sizeof (DEVICE_CONTEXT));
@@ -2398,7 +2398,7 @@ XhcInitializeDeviceSlot64 (
   // 4.3.3 Device Slot Initialization
   // 1) Allocate an Input Context data structure (6.2.5) an= d initialize all fields to '0'.
   //
-  InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (IN= PUT_CONTEXT_64));
+  InputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (IN= PUT_CONTEXT_64), FALSE);
   ASSERT (InputContext !=3D NULL);
   ASSERT (((UINTN)InputContext & 0x3F) =3D=3D 0);
   ZeroMem (InputContext, sizeof (INPUT_CONTEXT_64));
@@ -2500,7 +2500,7 @@ XhcInitializeDeviceSlot64 (
   //
   // 6) Allocate the Output Device Context data structure (= 6.2.1) and initialize it to '0'.
   //
-  OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (D= EVICE_CONTEXT_64));
+  OutputContext =3D UsbHcAllocateMem (Xhc->MemPool, sizeof (D= EVICE_CONTEXT_64), FALSE);
   ASSERT (OutputContext !=3D NULL);
   ASSERT (((UINTN)OutputContext & 0x3F) =3D=3D 0);
   ZeroMem (OutputContext, sizeof (DEVICE_CONTEXT_64));
-- 
2.20.1.windows.1
 
--QbLaj6dVeJq4QskiKNWy-- --kNHy80VObEXngus7OCsb Content-Type: text/plain; name="0001-MdeModulePkg-XhciDxe-Add-a-parameter-to-indicate-whe.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-MdeModulePkg-XhciDxe-Add-a-parameter-to-indicate-whe.patch" RnJvbSBkYmIwZjFmYjc0OTgzOTNlN2FlNTM2YmU5MzMyNzljNGRlZTI1ZDZkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBqZHpoYW5nID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