public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] Edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c:XhcCreateUsbHc: check return value of XHC_PAGESIZE_OFFSET
@ 2022-06-18  2:37 lee.m.hamel
  2022-06-20  1:46 ` Wu, Hao A
  0 siblings, 1 reply; 2+ messages in thread
From: lee.m.hamel @ 2022-06-18  2:37 UTC (permalink / raw)
  To: devel@edk2.groups.io; +Cc: Wu, Hao A, Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3954

--- C:\Edk2\MdeModulePkg\Bus\Pci\XhciDxe\Xhci.c         Tue Jun 14 21:29:21 2022 UTC
+++ C:\myEdk2\MdeModulePkg\Bus\Pci\XhciDxe\Xhci.c Tue Jun 14 21:26:57 2022 UTC
@@ -1,7 +1,7 @@
/** @file
   The XHCI controller driver.
-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
@@ -1813,7 +1813,12 @@
   // This xHC supports a page size of 2^(n+12) if bit n is Set. For example,
   // if bit 0 is Set, the xHC supports 4k byte page sizes.
   //
-  PageSize      = XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET) & XHC_PAGESIZE_MASK;
+  PageSize      = XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET);
+  if(PageSize == 0xFFFFFFFF) {
+  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: error reading XHC_PAGESIZE_OFFSET\n"));
+    goto ON_ERROR;
+  }
+  PageSize      &= XHC_PAGESIZE_MASK;
   Xhc->PageSize = 1 << (HighBitSet32 (PageSize) + 12);
   ExtCapReg              = (UINT16)(Xhc->HcCParams.Data.ExtCapReg);


[-- Attachment #2: Type: text/html, Size: 4099 bytes --]

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

* Re: [PATCH] Edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c:XhcCreateUsbHc: check return value of XHC_PAGESIZE_OFFSET
  2022-06-18  2:37 [PATCH] Edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c:XhcCreateUsbHc: check return value of XHC_PAGESIZE_OFFSET lee.m.hamel
@ 2022-06-20  1:46 ` Wu, Hao A
  0 siblings, 0 replies; 2+ messages in thread
From: Wu, Hao A @ 2022-06-20  1:46 UTC (permalink / raw)
  To: Hamel, Lee M, devel@edk2.groups.io; +Cc: Ni, Ray

[-- Attachment #1: Type: text/plain, Size: 2313 bytes --]

Hello Hamel, Lee M

Could you help to resend the patch? I found that I cannot extract the patch from your mail. Please help to check if you follow the instructions in step 12 to generate the patch in the below link:
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Development-Process#the-developer-process-for-the-edk-ii-project
Thanks in advance.

Also, I would like to get more information on the problematic XHC.
Do all the XHCI operational registers & capability registers (i.e. registers in MMIO space) return a value of all 1s after read or the issue just happens to the Page Size register?
If the issue occurs to all the MMIO registers, my guess is that the MMIO resource allocation/configuration might not be done properly for the XHC.

One more inline comment below marked as "[Hao]:"


From: Hamel, Lee M <lee.m.hamel@intel.com>
Sent: Saturday, June 18, 2022 10:38 AM
To: devel@edk2.groups.io
Cc: Wu, Hao A <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>
Subject: [PATCH] Edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c:XhcCreateUsbHc: check return value of XHC_PAGESIZE_OFFSET

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3954

--- C:\Edk2\MdeModulePkg\Bus\Pci\XhciDxe\Xhci.c         Tue Jun 14 21:29:21 2022 UTC
+++ C:\myEdk2\MdeModulePkg\Bus\Pci\XhciDxe\Xhci.c Tue Jun 14 21:26:57 2022 UTC
@@ -1,7 +1,7 @@
/** @file
   The XHCI controller driver.

-Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2011 - 2022, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

 **/
@@ -1813,7 +1813,12 @@
   // This xHC supports a page size of 2^(n+12) if bit n is Set. For example,
   // if bit 0 is Set, the xHC supports 4k byte page sizes.
   //
-  PageSize      = XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET) & XHC_PAGESIZE_MASK;
+  PageSize      = XhcReadOpReg (Xhc, XHC_PAGESIZE_OFFSET);
+  if(PageSize == 0xFFFFFFFF) {
+  DEBUG ((DEBUG_INFO, "XhcCreateUsb3Hc: error reading XHC_PAGESIZE_OFFSET\n"));


[Hao]: Please use DEBUG_ERROR for error handling.

Best Regards,
Hao Wu


+    goto ON_ERROR;
+  }
+  PageSize      &= XHC_PAGESIZE_MASK;
   Xhc->PageSize = 1 << (HighBitSet32 (PageSize) + 12);

   ExtCapReg              = (UINT16)(Xhc->HcCParams.Data.ExtCapReg);


[-- Attachment #2: Type: text/html, Size: 6709 bytes --]

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

end of thread, other threads:[~2022-06-20  1:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-18  2:37 [PATCH] Edk2/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c:XhcCreateUsbHc: check return value of XHC_PAGESIZE_OFFSET lee.m.hamel
2022-06-20  1:46 ` Wu, Hao A

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