public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1 0/1] MdeModulePkg:Avoid Xhc cross 64K boundary
@ 2022-03-03  3:35 zhoucheng
  2022-03-03  3:35 ` [PATCH v1 1/1] " zhoucheng
  0 siblings, 1 reply; 2+ messages in thread
From: zhoucheng @ 2022-03-03  3:35 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Liming Gao, Wang Jian J

The current xhc implementation may exceed the 64K boundary,
so must restrictions need to be added.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Wang Jian J <jian.j.wang@intel.com>
Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>

zhoucheng (1):
  MdeModulePkg:Avoid Xhc cross 64K boundary

 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 6 ++++++
 1 file changed, 6 insertions(+)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v1 1/1] MdeModulePkg:Avoid Xhc cross 64K boundary
  2022-03-03  3:35 [PATCH v1 0/1] MdeModulePkg:Avoid Xhc cross 64K boundary zhoucheng
@ 2022-03-03  3:35 ` zhoucheng
  0 siblings, 0 replies; 2+ messages in thread
From: zhoucheng @ 2022-03-03  3:35 UTC (permalink / raw)
  To: devel; +Cc: Ray Ni, Liming Gao, Wang Jian J

The current xhc implementation may exceed the 64K boundary,
so must restrictions need to be added.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Wang Jian J <jian.j.wang@intel.com>
Reviewed-by: Wu Hao A <hao.a.wu@intel.com>
Signed-off-by: Cheng Zhou <zhoucheng@phytium.com.cn>
---
 MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
index c2906e06fd84..0fedc8cfced5 100644
--- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
+++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciSched.c
@@ -891,8 +891,14 @@ CreateTransferRing (
   VOID                  *Buf;
   LINK_TRB              *EndTrb;
   EFI_PHYSICAL_ADDRESS  PhyAddr;
+  VOID                  *NewBuf;
 
   Buf = UsbHcAllocateMem (Xhc->MemPool, sizeof (TRB_TEMPLATE) * TrbNum);
+  if((((UINTN)Buf & ((1<<16)-1)) + sizeof (TRB_TEMPLATE) * TrbNum) & (1<<16)) {
+    NewBuf = UsbHcAllocateMem (Xhc->MemPool,sizeof(TRB_TEMPLATE) * TrbNum);
+    UsbHcFreeMem(Xhc->MemPool,Buf,sizeof(TRB_TEMPLATE)*TrbNum);
+    Buf = NewBuf;
+  }
   ASSERT (Buf != NULL);
   ASSERT (((UINTN)Buf & 0x3F) == 0);
   ZeroMem (Buf, sizeof (TRB_TEMPLATE) * TrbNum);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-03  3:35 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-03  3:35 [PATCH v1 0/1] MdeModulePkg:Avoid Xhc cross 64K boundary zhoucheng
2022-03-03  3:35 ` [PATCH v1 1/1] " zhoucheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox