From 74b04490da9dcb90de61e31db51b8e137f9e6e3d Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Tue, 15 Oct 2013 06:13:14 +0000 Subject: [PATCH] =?utf8?q?MdeModulePkg/XhciDxe:=20Usb=20legacy=20support?= =?utf8?q?=20feature=20is=20optional.=20For=20those=20usb=203.0=20devices?= =?utf8?q?=20which=20doesn=E2=80=99t=20support=20this=20feature,=20should?= =?utf8?q?=20directly=20return=20and=20not=20touch=20corresponding=20regis?= =?utf8?q?ters?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Sergey Isakov Signed-off-by: Tian, Feng Reviewed-by: Li, Elvin git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14776 6f19259b-4bc3-4df7-8a09-765794883524 --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 8debc4c18c..443df729d2 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -164,7 +164,7 @@ XhcReset ( // Flow through, same behavior as Host Controller Reset // case EFI_USB_HC_RESET_HOST_CONTROLLER: - if (((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) == XHC_CAP_USB_DEBUG) && + if ((Xhc->DebugCapSupOffset != 0xFFFFFFFF) && ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) == XHC_CAP_USB_DEBUG) && ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) != 0)) { Status = EFI_SUCCESS; goto ON_EXIT; diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c index c863f22d25..a66d7cd95b 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c @@ -543,6 +543,10 @@ XhcSetBiosOwnership ( { UINT32 Buffer; + if (Xhc->UsbLegSupOffset == 0xFFFFFFFF) { + return; + } + DEBUG ((EFI_D_INFO, "XhcSetBiosOwnership: called to set BIOS ownership\n")); Buffer = XhcReadExtCapReg (Xhc, Xhc->UsbLegSupOffset); @@ -563,6 +567,10 @@ XhcClearBiosOwnership ( { UINT32 Buffer; + if (Xhc->UsbLegSupOffset == 0xFFFFFFFF) { + return; + } + DEBUG ((EFI_D_INFO, "XhcClearBiosOwnership: called to clear BIOS ownership\n")); Buffer = XhcReadExtCapReg (Xhc, Xhc->UsbLegSupOffset); @@ -606,7 +614,7 @@ XhcGetCapabilityAddr ( ExtCapOffset += (NextExtCapReg << 2); } while (NextExtCapReg != 0); - return 0; + return 0xFFFFFFFF; } /** @@ -676,7 +684,7 @@ XhcResetHC ( } } - if (((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) != XHC_CAP_USB_DEBUG) || + if ((Xhc->DebugCapSupOffset == 0xFFFFFFFF) || ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset) & 0xFF) != XHC_CAP_USB_DEBUG) || ((XhcReadExtCapReg (Xhc, Xhc->DebugCapSupOffset + XHC_DC_DCCTRL) & BIT0) == 0)) { XhcSetOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET); Status = XhcWaitOpRegBit (Xhc, XHC_USBCMD_OFFSET, XHC_USBCMD_RESET, FALSE, Timeout); -- 2.39.2