* [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present @ 2022-12-16 8:58 Sean Rhodes 2022-12-16 8:58 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes ` (2 more replies) 0 siblings, 3 replies; 23+ messages in thread From: Sean Rhodes @ 2022-12-16 8:58 UTC (permalink / raw) To: devel Cc: Matt DeVillier, Hao A Wu, Jian J Wang, Liming Gao, Zhichao Gao, Ray Ni, Sean Rhodes From: Matt DeVillier <matt.devillier@gmail.com> Only enumerate devices that have media present. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8 --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 962892d38f..bde22fa659 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2218,6 +2218,15 @@ BmEnumerateBootOptions ( continue; } + // + // Skip removable media if not present + // + if ((BlkIo->Media->RemovableMedia == TRUE) && + (BlkIo->Media->MediaPresent == FALSE)) + { + continue; + } + Description = BmGetBootDescription (Handles[Index]); BootOptions = ReallocatePool ( sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount), -- 2.37.2 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV 2022-12-16 8:58 [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Sean Rhodes @ 2022-12-16 8:58 ` Sean Rhodes 2022-12-19 6:16 ` Wu, Hao A 2022-12-16 8:58 ` [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV Sean Rhodes 2022-12-16 9:03 ` [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Ni, Ray 2 siblings, 1 reply; 23+ messages in thread From: Sean Rhodes @ 2022-12-16 8:58 UTC (permalink / raw) To: devel; +Cc: Matt DeVillier, Hao A Wu, Ray Ni, Sean Rhodes From: Matt DeVillier <matt.devillier@gmail.com> PSID matching relies on comparing the PSIV against the PortSpeed value. This patch stops edk2 from checking for a PSIV of 0, as it is not valid; this reduces the number of register access by approximately 6 per second. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 ++++++++++++++++------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 15fb49f28f..8dd7a8fbb7 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -371,6 +371,7 @@ XhcGetRootHubPortStatus ( UINT32 TotalPort; UINTN Index; UINTN MapSize; + UINT8 PortSpeed; EFI_STATUS Status; USB_DEV_ROUTE ParentRouteChart; EFI_TPL OldTpl; @@ -397,32 +398,37 @@ XhcGetRootHubPortStatus ( State = XhcReadOpReg (Xhc, Offset); + PortSpeed = (State & XHC_PORTSC_PS) >> 10; + // // According to XHCI 1.1 spec November 2017, // Section 7.2 xHCI Support Protocol Capability // - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & XHC_PORTSC_PS) >> 10)); - if (PortStatus->PortStatus == 0) { - // - // According to XHCI 1.1 spec November 2017, - // bit 10~13 of the root port status register identifies the speed of the attached device. - // - switch ((State & XHC_PORTSC_PS) >> 10) { - case 2: - PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; - break; + if (PortSpeed > 0) { + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed); + // If no match found in ext cap reg, fall back to PORTSC + if (PortStatus->PortStatus == 0) { + // + // According to XHCI 1.1 spec November 2017, + // bit 10~13 of the root port status register identifies the speed of the attached device. + // + switch (PortSpeed) { + case 2: + PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; + break; - case 3: - PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; - break; + case 3: + PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; + break; - case 4: - case 5: - PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; - break; + case 4: + case 5: + PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; + break; - default: - break; + default: + break; + } } } -- 2.37.2 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV 2022-12-16 8:58 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes @ 2022-12-19 6:16 ` Wu, Hao A 2022-12-21 0:48 ` [edk2-devel] " Wu, Hao A 0 siblings, 1 reply; 23+ messages in thread From: Wu, Hao A @ 2022-12-19 6:16 UTC (permalink / raw) To: Rhodes, Sean, devel@edk2.groups.io; +Cc: Matt DeVillier, Ni, Ray, Rhodes, Sean Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Best Regards, Hao Wu > -----Original Message----- > From: Sean Rhodes <sean@starlabs.systems> > Sent: Friday, December 16, 2022 4:58 PM > To: devel@edk2.groups.io > Cc: Matt DeVillier <matt.devillier@gmail.com>; Wu, Hao A > <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean > <sean@starlabs.systems> > Subject: [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid > PSIV > > From: Matt DeVillier <matt.devillier@gmail.com> > > PSID matching relies on comparing the PSIV against the PortSpeed > value. This patch stops edk2 from checking for a PSIV of 0, as it > is not valid; this reduces the number of register access by > approximately 6 per second. > > Cc: Hao A Wu <hao.a.wu@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Reviewed-by: Sean Rhodes <sean@starlabs.systems> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> > Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a > --- > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 ++++++++++++++++------------- > 1 file changed, 25 insertions(+), 19 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > index 15fb49f28f..8dd7a8fbb7 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > @@ -371,6 +371,7 @@ XhcGetRootHubPortStatus ( > UINT32 TotalPort; > > UINTN Index; > > UINTN MapSize; > > + UINT8 PortSpeed; > > EFI_STATUS Status; > > USB_DEV_ROUTE ParentRouteChart; > > EFI_TPL OldTpl; > > @@ -397,32 +398,37 @@ XhcGetRootHubPortStatus ( > > > State = XhcReadOpReg (Xhc, Offset); > > > > + PortSpeed = (State & XHC_PORTSC_PS) >> 10; > > + > > // > > // According to XHCI 1.1 spec November 2017, > > // Section 7.2 xHCI Support Protocol Capability > > // > > - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & > XHC_PORTSC_PS) >> 10)); > > - if (PortStatus->PortStatus == 0) { > > - // > > - // According to XHCI 1.1 spec November 2017, > > - // bit 10~13 of the root port status register identifies the speed of the > attached device. > > - // > > - switch ((State & XHC_PORTSC_PS) >> 10) { > > - case 2: > > - PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > - break; > > + if (PortSpeed > 0) { > > + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > PortSpeed); > > + // If no match found in ext cap reg, fall back to PORTSC > > + if (PortStatus->PortStatus == 0) { > > + // > > + // According to XHCI 1.1 spec November 2017, > > + // bit 10~13 of the root port status register identifies the speed of the > attached device. > > + // > > + switch (PortSpeed) { > > + case 2: > > + PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > + break; > > > > - case 3: > > - PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > - break; > > + case 3: > > + PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > + break; > > > > - case 4: > > - case 5: > > - PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > - break; > > + case 4: > > + case 5: > > + PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > + break; > > > > - default: > > - break; > > + default: > > + break; > > + } > > } > > } > > > > -- > 2.37.2 ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV 2022-12-19 6:16 ` Wu, Hao A @ 2022-12-21 0:48 ` Wu, Hao A 0 siblings, 0 replies; 23+ messages in thread From: Wu, Hao A @ 2022-12-21 0:48 UTC (permalink / raw) To: devel@edk2.groups.io, Wu, Hao A, Rhodes, Sean; +Cc: Matt DeVillier, Ni, Ray Merged via: PR - https://github.com/tianocore/edk2/pull/3806 Commit - https://github.com/tianocore/edk2/commit/01c2fb0d2260d4de898e4e91e48770ffa5510153 Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao > A > Sent: Monday, December 19, 2022 2:16 PM > To: Rhodes, Sean <sean@starlabs.systems>; devel@edk2.groups.io > Cc: Matt DeVillier <matt.devillier@gmail.com>; Ni, Ray <ray.ni@intel.com>; > Rhodes, Sean <sean@starlabs.systems> > Subject: Re: [edk2-devel] [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't > check for invalid PSIV > > Reviewed-by: Hao A Wu <hao.a.wu@intel.com> > > Best Regards, > Hao Wu > > > -----Original Message----- > > From: Sean Rhodes <sean@starlabs.systems> > > Sent: Friday, December 16, 2022 4:58 PM > > To: devel@edk2.groups.io > > Cc: Matt DeVillier <matt.devillier@gmail.com>; Wu, Hao A > > <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean > > <sean@starlabs.systems> > > Subject: [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for > > invalid PSIV > > > > From: Matt DeVillier <matt.devillier@gmail.com> > > > > PSID matching relies on comparing the PSIV against the PortSpeed > > value. This patch stops edk2 from checking for a PSIV of 0, as it is > > not valid; this reduces the number of register access by approximately > > 6 per second. > > > > Cc: Hao A Wu <hao.a.wu@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Reviewed-by: Sean Rhodes <sean@starlabs.systems> > > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> > > Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a > > --- > > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 > > ++++++++++++++++------------- > > 1 file changed, 25 insertions(+), 19 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > index 15fb49f28f..8dd7a8fbb7 100644 > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > @@ -371,6 +371,7 @@ XhcGetRootHubPortStatus ( > > UINT32 TotalPort; > > > > UINTN Index; > > > > UINTN MapSize; > > > > + UINT8 PortSpeed; > > > > EFI_STATUS Status; > > > > USB_DEV_ROUTE ParentRouteChart; > > > > EFI_TPL OldTpl; > > > > @@ -397,32 +398,37 @@ XhcGetRootHubPortStatus ( > > > > > > State = XhcReadOpReg (Xhc, Offset); > > > > > > > > + PortSpeed = (State & XHC_PORTSC_PS) >> 10; > > > > + > > > > // > > > > // According to XHCI 1.1 spec November 2017, > > > > // Section 7.2 xHCI Support Protocol Capability > > > > // > > > > - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State > > & > > XHC_PORTSC_PS) >> 10)); > > > > - if (PortStatus->PortStatus == 0) { > > > > - // > > > > - // According to XHCI 1.1 spec November 2017, > > > > - // bit 10~13 of the root port status register identifies the speed of the > > attached device. > > > > - // > > > > - switch ((State & XHC_PORTSC_PS) >> 10) { > > > > - case 2: > > > > - PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > > > - break; > > > > + if (PortSpeed > 0) { > > > > + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > > PortSpeed); > > > > + // If no match found in ext cap reg, fall back to PORTSC > > > > + if (PortStatus->PortStatus == 0) { > > > > + // > > > > + // According to XHCI 1.1 spec November 2017, > > > > + // bit 10~13 of the root port status register identifies the > > + speed of the > > attached device. > > > > + // > > > > + switch (PortSpeed) { > > > > + case 2: > > > > + PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > > > + break; > > > > > > > > - case 3: > > > > - PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > > > - break; > > > > + case 3: > > > > + PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > > > + break; > > > > > > > > - case 4: > > > > - case 5: > > > > - PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > > > - break; > > > > + case 4: > > > > + case 5: > > > > + PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > > > + break; > > > > > > > > - default: > > > > - break; > > > > + default: > > > > + break; > > > > + } > > > > } > > > > } > > > > > > > > -- > > 2.37.2 > > > > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV 2022-12-16 8:58 [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Sean Rhodes 2022-12-16 8:58 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes @ 2022-12-16 8:58 ` Sean Rhodes 2022-12-19 7:46 ` [edk2-devel] " Wu, Hao A 2022-12-16 9:03 ` [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Ni, Ray 2 siblings, 1 reply; 23+ messages in thread From: Sean Rhodes @ 2022-12-16 8:58 UTC (permalink / raw) To: devel; +Cc: Sean Rhodes On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol Speed ID Value) indices are shared between Protocol Speed ID DWORD' in the extended capabilities registers for both USB2 (Full Speed) and USB3 (Super Speed). An example can be found below: XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps XhciPsivGetPsid: found 3 PSID entries XhciPsivGetPsid: looking for port speed 1 XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12 XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500 XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480 XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps XhciPsivGetPsid: found 3 PSID entries XhciPsivGetPsid: looking for port speed 1 XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5 XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10 XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248 The result is edk2 detecting USB2 devices as USB3 devices, which consequently causes enumeration to fail. To avoid incorrect detection, check the Compatible Port Offset to find the starting Port of Root Hubs that support the protocol. Signed-off-by: Sean Rhodes <sean@starlabs.systems> --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 35 +++++++++++++++++++++----- MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h | 8 +++--- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 8dd7a8fbb7..461b2cd9b5 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -405,7 +405,7 @@ XhcGetRootHubPortStatus ( // Section 7.2 xHCI Support Protocol Capability // if (PortSpeed > 0) { - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed); + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed, PortNumber); // If no match found in ext cap reg, fall back to PORTSC if (PortStatus->PortStatus == 0) { // diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c index 2b4a4b2444..5700fc5fb8 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c @@ -636,6 +636,7 @@ XhcGetSupportedProtocolCapabilityAddr ( @param Xhc The XHCI Instance. @param ExtCapOffset The USB Major Version in xHCI Support Protocol Capability Field @param PortSpeed The Port Speed Field in USB PortSc register + @param PortNumber The Port Number (0-indexed) @return The Protocol Speed ID (PSI) from xHCI Supported Protocol capability register. @@ -644,12 +645,15 @@ UINT32 XhciPsivGetPsid ( IN USB_XHCI_INSTANCE *Xhc, IN UINT32 ExtCapOffset, - IN UINT8 PortSpeed + IN UINT8 PortSpeed, + IN UINT8 PortNumber ) { XHC_SUPPORTED_PROTOCOL_DW2 PortId; XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID Reg; UINT32 Count; + UINT32 MinPortIndex; + UINT32 MaxPortIndex; if ((Xhc == NULL) || (ExtCapOffset == 0xFFFFFFFF)) { return 0; @@ -663,6 +667,23 @@ XhciPsivGetPsid ( // PortId.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + XHC_SUPPORTED_PROTOCOL_DW2_OFFSET); + // + // According to XHCI 1.1 spec November 2017, valid values + // for CompPortOffset are 1 to CompPortCount - 1. + // + // PortNumber is zero-indexed, so subtract 1. + // + if ((PortId.Data.CompPortOffset == 0) || (PortId.Data.CompPortCount == 0)) { + return 0; + } + + MinPortIndex = PortId.Data.CompPortOffset - 1; + MaxPortIndex = MinPortIndex + PortId.Data.CompPortCount - 1; + + if ((PortNumber < MinPortIndex) || (PortNumber > MaxPortIndex)) { + return 0; + } + for (Count = 0; Count < PortId.Data.Psic; Count++) { Reg.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + XHC_SUPPORTED_PROTOCOL_PSI_OFFSET + (Count << 2)); if (Reg.Data.Psiv == PortSpeed) { @@ -676,8 +697,9 @@ XhciPsivGetPsid ( /** Find PortSpeed value match case in XHCI Supported Protocol Capability - @param Xhc The XHCI Instance. - @param PortSpeed The Port Speed Field in USB PortSc register + @param Xhc The XHCI Instance. + @param PortSpeed The Port Speed Field in USB PortSc register + @param PortNumber The Port Number (0-indexed) @return The USB Port Speed. @@ -685,7 +707,8 @@ XhciPsivGetPsid ( UINT16 XhcCheckUsbPortSpeedUsedPsic ( IN USB_XHCI_INSTANCE *Xhc, - IN UINT8 PortSpeed + IN UINT8 PortSpeed, + IN UINT8 PortNumber ) { XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID SpField; @@ -703,7 +726,7 @@ XhcCheckUsbPortSpeedUsedPsic ( // PortSpeed definition when the Major Revision is 03h. // if (Xhc->Usb3SupOffset != 0xFFFFFFFF) { - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed); + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed, PortNumber); if (SpField.Dword != 0) { // // Found the corresponding PORTSC value in PSIV field of USB3 offset. @@ -717,7 +740,7 @@ XhcCheckUsbPortSpeedUsedPsic ( // PortSpeed definition when the Major Revision is 02h. // if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0xFFFFFFFF)) { - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed); + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed, PortNumber); if (SpField.Dword != 0) { // // Found the corresponding PORTSC value in PSIV field of USB2 offset. diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h index 5fe2ba4f0e..2e4f95f8ac 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h @@ -623,8 +623,9 @@ XhcGetSupportedProtocolCapabilityAddr ( /** Find SpeedField value match with Port Speed ID value. - @param Xhc The XHCI Instance. - @param Speed The Port Speed filed in USB PortSc register + @param Xhc The XHCI Instance. + @param Speed The Port Speed filed in USB PortSc register + @param PortNumber The Port Number (0-indexed) @return The USB Port Speed. @@ -632,7 +633,8 @@ XhcGetSupportedProtocolCapabilityAddr ( UINT16 XhcCheckUsbPortSpeedUsedPsic ( IN USB_XHCI_INSTANCE *Xhc, - IN UINT8 Speed + IN UINT8 Speed, + IN UINT8 PortNumber ); #endif -- 2.37.2 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV 2022-12-16 8:58 ` [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV Sean Rhodes @ 2022-12-19 7:46 ` Wu, Hao A 2022-12-21 0:49 ` Wu, Hao A 0 siblings, 1 reply; 23+ messages in thread From: Wu, Hao A @ 2022-12-19 7:46 UTC (permalink / raw) To: devel@edk2.groups.io, Rhodes, Sean Reviewed-by: Hao A Wu <hao.a.wu@intel.com> I will make minor modification to: * Function description comment * Input parameter name of XhcCheckUsbPortSpeedUsedPsic() to make the declaration (in .H) and the definition (in .C) match. Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean > Rhodes > Sent: Friday, December 16, 2022 4:58 PM > To: devel@edk2.groups.io > Cc: Rhodes, Sean <sean@starlabs.systems> > Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check > port is compatible before getting PSIV > > On some platforms, including Sky Lake and Kaby Lake, the PSIV (Protocol > Speed ID Value) indices are shared between Protocol Speed ID DWORD' in > the extended capabilities registers for both USB2 (Full Speed) and USB3 > (Super Speed). > > An example can be found below: > > XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps > XhciPsivGetPsid: found 3 PSID entries > XhciPsivGetPsid: looking for port speed 1 > XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12 > XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500 > XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480 > XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps > XhciPsivGetPsid: found 3 PSID entries > XhciPsivGetPsid: looking for port speed 1 > XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5 > XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10 > XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248 > > The result is edk2 detecting USB2 devices as USB3 devices, which > consequently causes enumeration to fail. > > To avoid incorrect detection, check the Compatible Port Offset to find > the starting Port of Root Hubs that support the protocol. > > Signed-off-by: Sean Rhodes <sean@starlabs.systems> > --- > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 35 +++++++++++++++++++++-- > --- > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h | 8 +++--- > 3 files changed, 35 insertions(+), 10 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > index 8dd7a8fbb7..461b2cd9b5 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > @@ -405,7 +405,7 @@ XhcGetRootHubPortStatus ( > // Section 7.2 xHCI Support Protocol Capability > > // > > if (PortSpeed > 0) { > > - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > PortSpeed); > > + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > PortSpeed, PortNumber); > > // If no match found in ext cap reg, fall back to PORTSC > > if (PortStatus->PortStatus == 0) { > > // > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > index 2b4a4b2444..5700fc5fb8 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > @@ -636,6 +636,7 @@ XhcGetSupportedProtocolCapabilityAddr ( > @param Xhc The XHCI Instance. > > @param ExtCapOffset The USB Major Version in xHCI Support Protocol > Capability Field > > @param PortSpeed The Port Speed Field in USB PortSc register > > + @param PortNumber The Port Number (0-indexed) > > > > @return The Protocol Speed ID (PSI) from xHCI Supported Protocol > capability register. > > > > @@ -644,12 +645,15 @@ UINT32 > XhciPsivGetPsid ( > > IN USB_XHCI_INSTANCE *Xhc, > > IN UINT32 ExtCapOffset, > > - IN UINT8 PortSpeed > > + IN UINT8 PortSpeed, > > + IN UINT8 PortNumber > > ) > > { > > XHC_SUPPORTED_PROTOCOL_DW2 PortId; > > XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID Reg; > > UINT32 Count; > > + UINT32 MinPortIndex; > > + UINT32 MaxPortIndex; > > > > if ((Xhc == NULL) || (ExtCapOffset == 0xFFFFFFFF)) { > > return 0; > > @@ -663,6 +667,23 @@ XhciPsivGetPsid ( > // > > PortId.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + > XHC_SUPPORTED_PROTOCOL_DW2_OFFSET); > > > > + // > > + // According to XHCI 1.1 spec November 2017, valid values > > + // for CompPortOffset are 1 to CompPortCount - 1. > > + // > > + // PortNumber is zero-indexed, so subtract 1. > > + // > > + if ((PortId.Data.CompPortOffset == 0) || (PortId.Data.CompPortCount == > 0)) { > > + return 0; > > + } > > + > > + MinPortIndex = PortId.Data.CompPortOffset - 1; > > + MaxPortIndex = MinPortIndex + PortId.Data.CompPortCount - 1; > > + > > + if ((PortNumber < MinPortIndex) || (PortNumber > MaxPortIndex)) { > > + return 0; > > + } > > + > > for (Count = 0; Count < PortId.Data.Psic; Count++) { > > Reg.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + > XHC_SUPPORTED_PROTOCOL_PSI_OFFSET + (Count << 2)); > > if (Reg.Data.Psiv == PortSpeed) { > > @@ -676,8 +697,9 @@ XhciPsivGetPsid ( > /** > > Find PortSpeed value match case in XHCI Supported Protocol Capability > > > > - @param Xhc The XHCI Instance. > > - @param PortSpeed The Port Speed Field in USB PortSc register > > + @param Xhc The XHCI Instance. > > + @param PortSpeed The Port Speed Field in USB PortSc register > > + @param PortNumber The Port Number (0-indexed) > > > > @return The USB Port Speed. > > > > @@ -685,7 +707,8 @@ XhciPsivGetPsid ( > UINT16 > > XhcCheckUsbPortSpeedUsedPsic ( > > IN USB_XHCI_INSTANCE *Xhc, > > - IN UINT8 PortSpeed > > + IN UINT8 PortSpeed, > > + IN UINT8 PortNumber > > ) > > { > > XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID SpField; > > @@ -703,7 +726,7 @@ XhcCheckUsbPortSpeedUsedPsic ( > // PortSpeed definition when the Major Revision is 03h. > > // > > if (Xhc->Usb3SupOffset != 0xFFFFFFFF) { > > - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed); > > + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed, > PortNumber); > > if (SpField.Dword != 0) { > > // > > // Found the corresponding PORTSC value in PSIV field of USB3 offset. > > @@ -717,7 +740,7 @@ XhcCheckUsbPortSpeedUsedPsic ( > // PortSpeed definition when the Major Revision is 02h. > > // > > if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0xFFFFFFFF)) { > > - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed); > > + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed, > PortNumber); > > if (SpField.Dword != 0) { > > // > > // Found the corresponding PORTSC value in PSIV field of USB2 offset. > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > index 5fe2ba4f0e..2e4f95f8ac 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > @@ -623,8 +623,9 @@ XhcGetSupportedProtocolCapabilityAddr ( > /** > > Find SpeedField value match with Port Speed ID value. > > > > - @param Xhc The XHCI Instance. > > - @param Speed The Port Speed filed in USB PortSc register > > + @param Xhc The XHCI Instance. > > + @param Speed The Port Speed filed in USB PortSc register > > + @param PortNumber The Port Number (0-indexed) > > > > @return The USB Port Speed. > > > > @@ -632,7 +633,8 @@ XhcGetSupportedProtocolCapabilityAddr ( > UINT16 > > XhcCheckUsbPortSpeedUsedPsic ( > > IN USB_XHCI_INSTANCE *Xhc, > > - IN UINT8 Speed > > + IN UINT8 Speed, > > + IN UINT8 PortNumber > > ); > > > > #endif > > -- > 2.37.2 > > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#97497): https://edk2.groups.io/g/devel/message/97497 > Mute This Topic: https://groups.io/mt/95706436/1768737 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com] > -=-=-=-=-=-= > ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV 2022-12-19 7:46 ` [edk2-devel] " Wu, Hao A @ 2022-12-21 0:49 ` Wu, Hao A 0 siblings, 0 replies; 23+ messages in thread From: Wu, Hao A @ 2022-12-21 0:49 UTC (permalink / raw) To: devel@edk2.groups.io, Wu, Hao A, Rhodes, Sean Merged via: PR - https://github.com/tianocore/edk2/pull/3806 Commit - https://github.com/tianocore/edk2/commit/ec25e904c7da70302f2725e2005e3762f1ae891e Best Regards, Hao Wu > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu, Hao > A > Sent: Monday, December 19, 2022 3:46 PM > To: devel@edk2.groups.io; Rhodes, Sean <sean@starlabs.systems> > Subject: Re: [edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: > Check port is compatible before getting PSIV > > Reviewed-by: Hao A Wu <hao.a.wu@intel.com> > > I will make minor modification to: > * Function description comment > * Input parameter name > of XhcCheckUsbPortSpeedUsedPsic() to make the declaration (in .H) and the > definition (in .C) match. > > Best Regards, > Hao Wu > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean > > Rhodes > > Sent: Friday, December 16, 2022 4:58 PM > > To: devel@edk2.groups.io > > Cc: Rhodes, Sean <sean@starlabs.systems> > > Subject: [edk2-devel] [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check > > port is compatible before getting PSIV > > > > On some platforms, including Sky Lake and Kaby Lake, the PSIV > > (Protocol Speed ID Value) indices are shared between Protocol Speed ID > > DWORD' in the extended capabilities registers for both USB2 (Full > > Speed) and USB3 (Super Speed). > > > > An example can be found below: > > > > XhcCheckUsbPortSpeedUsedPsic: checking for USB2 ext caps > > XhciPsivGetPsid: found 3 PSID entries > > XhciPsivGetPsid: looking for port speed 1 > > XhciPsivGetPsid: PSIV 1 PSIE 2 PLT 0 PSIM 12 > > XhciPsivGetPsid: PSIV 2 PSIE 1 PLT 0 PSIM 1500 > > XhciPsivGetPsid: PSIV 3 PSIE 2 PLT 0 PSIM 480 > > XhcCheckUsbPortSpeedUsedPsic: checking for USB3 ext caps > > XhciPsivGetPsid: found 3 PSID entries > > XhciPsivGetPsid: looking for port speed 1 > > XhciPsivGetPsid: PSIV 1 PSIE 3 PLT 0 PSIM 5 > > XhciPsivGetPsid: PSIV 2 PSIE 3 PLT 0 PSIM 10 > > XhciPsivGetPsid: PSIV 34 PSIE 2 PLT 0 PSIM 1248 > > > > The result is edk2 detecting USB2 devices as USB3 devices, which > > consequently causes enumeration to fail. > > > > To avoid incorrect detection, check the Compatible Port Offset to find > > the starting Port of Root Hubs that support the protocol. > > > > Signed-off-by: Sean Rhodes <sean@starlabs.systems> > > --- > > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 2 +- > > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c | 35 +++++++++++++++++++++-- > > --- > > MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h | 8 +++--- > > 3 files changed, 35 insertions(+), 10 deletions(-) > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > index 8dd7a8fbb7..461b2cd9b5 100644 > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > > @@ -405,7 +405,7 @@ XhcGetRootHubPortStatus ( > > // Section 7.2 xHCI Support Protocol Capability > > > > // > > > > if (PortSpeed > 0) { > > > > - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > > PortSpeed); > > > > + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > > PortSpeed, PortNumber); > > > > // If no match found in ext cap reg, fall back to PORTSC > > > > if (PortStatus->PortStatus == 0) { > > > > // > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > > index 2b4a4b2444..5700fc5fb8 100644 > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.c > > @@ -636,6 +636,7 @@ XhcGetSupportedProtocolCapabilityAddr ( > > @param Xhc The XHCI Instance. > > > > @param ExtCapOffset The USB Major Version in xHCI Support Protocol > > Capability Field > > > > @param PortSpeed The Port Speed Field in USB PortSc register > > > > + @param PortNumber The Port Number (0-indexed) > > > > > > > > @return The Protocol Speed ID (PSI) from xHCI Supported Protocol > > capability register. > > > > > > > > @@ -644,12 +645,15 @@ UINT32 > > XhciPsivGetPsid ( > > > > IN USB_XHCI_INSTANCE *Xhc, > > > > IN UINT32 ExtCapOffset, > > > > - IN UINT8 PortSpeed > > > > + IN UINT8 PortSpeed, > > > > + IN UINT8 PortNumber > > > > ) > > > > { > > > > XHC_SUPPORTED_PROTOCOL_DW2 PortId; > > > > XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID Reg; > > > > UINT32 Count; > > > > + UINT32 MinPortIndex; > > > > + UINT32 MaxPortIndex; > > > > > > > > if ((Xhc == NULL) || (ExtCapOffset == 0xFFFFFFFF)) { > > > > return 0; > > > > @@ -663,6 +667,23 @@ XhciPsivGetPsid ( > > // > > > > PortId.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + > > XHC_SUPPORTED_PROTOCOL_DW2_OFFSET); > > > > > > > > + // > > > > + // According to XHCI 1.1 spec November 2017, valid values > > > > + // for CompPortOffset are 1 to CompPortCount - 1. > > > > + // > > > > + // PortNumber is zero-indexed, so subtract 1. > > > > + // > > > > + if ((PortId.Data.CompPortOffset == 0) || (PortId.Data.CompPortCount > > + == > > 0)) { > > > > + return 0; > > > > + } > > > > + > > > > + MinPortIndex = PortId.Data.CompPortOffset - 1; > > > > + MaxPortIndex = MinPortIndex + PortId.Data.CompPortCount - 1; > > > > + > > > > + if ((PortNumber < MinPortIndex) || (PortNumber > MaxPortIndex)) { > > > > + return 0; > > > > + } > > > > + > > > > for (Count = 0; Count < PortId.Data.Psic; Count++) { > > > > Reg.Dword = XhcReadExtCapReg (Xhc, ExtCapOffset + > > XHC_SUPPORTED_PROTOCOL_PSI_OFFSET + (Count << 2)); > > > > if (Reg.Data.Psiv == PortSpeed) { > > > > @@ -676,8 +697,9 @@ XhciPsivGetPsid ( > > /** > > > > Find PortSpeed value match case in XHCI Supported Protocol > > Capability > > > > > > > > - @param Xhc The XHCI Instance. > > > > - @param PortSpeed The Port Speed Field in USB PortSc register > > > > + @param Xhc The XHCI Instance. > > > > + @param PortSpeed The Port Speed Field in USB PortSc register > > > > + @param PortNumber The Port Number (0-indexed) > > > > > > > > @return The USB Port Speed. > > > > > > > > @@ -685,7 +707,8 @@ XhciPsivGetPsid ( > > UINT16 > > > > XhcCheckUsbPortSpeedUsedPsic ( > > > > IN USB_XHCI_INSTANCE *Xhc, > > > > - IN UINT8 PortSpeed > > > > + IN UINT8 PortSpeed, > > > > + IN UINT8 PortNumber > > > > ) > > > > { > > > > XHC_SUPPORTED_PROTOCOL_PROTOCOL_SPEED_ID SpField; > > > > @@ -703,7 +726,7 @@ XhcCheckUsbPortSpeedUsedPsic ( > > // PortSpeed definition when the Major Revision is 03h. > > > > // > > > > if (Xhc->Usb3SupOffset != 0xFFFFFFFF) { > > > > - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, PortSpeed); > > > > + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb3SupOffset, > > + PortSpeed, > > PortNumber); > > > > if (SpField.Dword != 0) { > > > > // > > > > // Found the corresponding PORTSC value in PSIV field of USB3 offset. > > > > @@ -717,7 +740,7 @@ XhcCheckUsbPortSpeedUsedPsic ( > > // PortSpeed definition when the Major Revision is 02h. > > > > // > > > > if ((UsbSpeedIdMap == 0) && (Xhc->Usb2SupOffset != 0xFFFFFFFF)) { > > > > - SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, PortSpeed); > > > > + SpField.Dword = XhciPsivGetPsid (Xhc, Xhc->Usb2SupOffset, > > + PortSpeed, > > PortNumber); > > > > if (SpField.Dword != 0) { > > > > // > > > > // Found the corresponding PORTSC value in PSIV field of USB2 offset. > > > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > > b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > > index 5fe2ba4f0e..2e4f95f8ac 100644 > > --- a/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/XhciReg.h > > @@ -623,8 +623,9 @@ XhcGetSupportedProtocolCapabilityAddr ( > > /** > > > > Find SpeedField value match with Port Speed ID value. > > > > > > > > - @param Xhc The XHCI Instance. > > > > - @param Speed The Port Speed filed in USB PortSc register > > > > + @param Xhc The XHCI Instance. > > > > + @param Speed The Port Speed filed in USB PortSc register > > > > + @param PortNumber The Port Number (0-indexed) > > > > > > > > @return The USB Port Speed. > > > > > > > > @@ -632,7 +633,8 @@ XhcGetSupportedProtocolCapabilityAddr ( > > UINT16 > > > > XhcCheckUsbPortSpeedUsedPsic ( > > > > IN USB_XHCI_INSTANCE *Xhc, > > > > - IN UINT8 Speed > > > > + IN UINT8 Speed, > > > > + IN UINT8 PortNumber > > > > ); > > > > > > > > #endif > > > > -- > > 2.37.2 > > > > > > > > -=-=-=-=-=-= > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#97497): > > https://edk2.groups.io/g/devel/message/97497 > > Mute This Topic: https://groups.io/mt/95706436/1768737 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub [hao.a.wu@intel.com] > > -=-=-=-=-=-= > > > > > > > ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2022-12-16 8:58 [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Sean Rhodes 2022-12-16 8:58 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes 2022-12-16 8:58 ` [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV Sean Rhodes @ 2022-12-16 9:03 ` Ni, Ray 2023-01-28 19:01 ` Sean Rhodes 2 siblings, 1 reply; 23+ messages in thread From: Ni, Ray @ 2022-12-16 9:03 UTC (permalink / raw) To: devel@edk2.groups.io, Rhodes, Sean Cc: Matt DeVillier, Wu, Hao A, Wang, Jian J, Gao, Liming, Gao, Zhichao Reviewed-by: Ray Ni <ray.ni@intel.com> > -----Original Message----- > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean Rhodes > Sent: Friday, December 16, 2022 4:58 PM > To: devel@edk2.groups.io > Cc: Matt DeVillier <matt.devillier@gmail.com>; Wu, Hao A <hao.a.wu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; > Gao, Liming <gaoliming@byosoft.com.cn>; Gao, Zhichao <zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, > Sean <sean@starlabs.systems> > Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present > > From: Matt DeVillier <matt.devillier@gmail.com> > > Only enumerate devices that have media present. > > Cc: Hao A Wu <hao.a.wu@intel.com> > Cc: Jian J Wang <jian.j.wang@intel.com> > Cc: Liming Gao <gaoliming@byosoft.com.cn> > Cc: Zhichao Gao <zhichao.gao@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Reviewed-by: Sean Rhodes <sean@starlabs.systems> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> > Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8 > --- > MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > index 962892d38f..bde22fa659 100644 > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > @@ -2218,6 +2218,15 @@ BmEnumerateBootOptions ( > continue; > > } > > > > + // > > + // Skip removable media if not present > > + // > > + if ((BlkIo->Media->RemovableMedia == TRUE) && > > + (BlkIo->Media->MediaPresent == FALSE)) > > + { > > + continue; > > + } > > + > > Description = BmGetBootDescription (Handles[Index]); > > BootOptions = ReallocatePool ( > > sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount), > > -- > 2.37.2 > > > > -=-=-=-=-=-= > Groups.io Links: You receive all messages sent to this group. > View/Reply Online (#97498): https://edk2.groups.io/g/devel/message/97498 > Mute This Topic: https://groups.io/mt/95706437/1712937 > Group Owner: devel+owner@edk2.groups.io > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] > -=-=-=-=-=-= > ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2022-12-16 9:03 ` [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Ni, Ray @ 2023-01-28 19:01 ` Sean Rhodes 2023-02-13 10:01 ` Sheng Lean Tan 0 siblings, 1 reply; 23+ messages in thread From: Sean Rhodes @ 2023-01-28 19:01 UTC (permalink / raw) To: devel, Ni, Ray [-- Attachment #1: Type: text/plain, Size: 2615 bytes --] Hi Ray Would it be possible to merge this? Thanks Sean On Fri, 16 Dec 2022, 09:03 Ni, Ray, <ray.ni@intel.com> wrote: > Reviewed-by: Ray Ni <ray.ni@intel.com> > > > > -----Original Message----- > > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sean > Rhodes > > Sent: Friday, December 16, 2022 4:58 PM > > To: devel@edk2.groups.io > > Cc: Matt DeVillier <matt.devillier@gmail.com>; Wu, Hao A < > hao.a.wu@intel.com>; Wang, Jian J <jian.j.wang@intel.com>; > > Gao, Liming <gaoliming@byosoft.com.cn>; Gao, Zhichao < > zhichao.gao@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, > > Sean <sean@starlabs.systems> > > Subject: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable > media if it is not present > > > > From: Matt DeVillier <matt.devillier@gmail.com> > > > > Only enumerate devices that have media present. > > > > Cc: Hao A Wu <hao.a.wu@intel.com> > > Cc: Jian J Wang <jian.j.wang@intel.com> > > Cc: Liming Gao <gaoliming@byosoft.com.cn> > > Cc: Zhichao Gao <zhichao.gao@intel.com> > > Cc: Ray Ni <ray.ni@intel.com> > > Reviewed-by: Sean Rhodes <sean@starlabs.systems> > > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> > > Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8 > > --- > > MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > index 962892d38f..bde22fa659 100644 > > --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c > > @@ -2218,6 +2218,15 @@ BmEnumerateBootOptions ( > > continue; > > > > } > > > > > > > > + // > > > > + // Skip removable media if not present > > > > + // > > > > + if ((BlkIo->Media->RemovableMedia == TRUE) && > > > > + (BlkIo->Media->MediaPresent == FALSE)) > > > > + { > > > > + continue; > > > > + } > > > > + > > > > Description = BmGetBootDescription (Handles[Index]); > > > > BootOptions = ReallocatePool ( > > > > sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * > (*BootOptionCount), > > > > -- > > 2.37.2 > > > > > > > > -=-=-=-=-=-= > > Groups.io Links: You receive all messages sent to this group. > > View/Reply Online (#97498): https://edk2.groups.io/g/devel/message/97498 > > Mute This Topic: https://groups.io/mt/95706437/1712937 > > Group Owner: devel+owner@edk2.groups.io > > Unsubscribe: https://edk2.groups.io/g/devel/unsub [ray.ni@intel.com] > > -=-=-=-=-=-= > > > > > > > > > [-- Attachment #2: Type: text/html, Size: 5410 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-01-28 19:01 ` Sean Rhodes @ 2023-02-13 10:01 ` Sheng Lean Tan 2023-02-13 11:56 ` Ni, Ray 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-02-13 10:01 UTC (permalink / raw) To: Sean Rhodes, devel [-- Attachment #1: Type: text/plain, Size: 99 bytes --] Hi Ray, This patch has been hanging along since last year. Has it been merged? Thanks, Sheng [-- Attachment #2: Type: text/html, Size: 115 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-02-13 10:01 ` Sheng Lean Tan @ 2023-02-13 11:56 ` Ni, Ray 2023-02-17 12:56 ` Sheng Lean Tan [not found] ` <17449DF2E9A4F10E.28744@groups.io> 0 siblings, 2 replies; 23+ messages in thread From: Ni, Ray @ 2023-02-13 11:56 UTC (permalink / raw) To: devel@edk2.groups.io, Tan, Lean Sheng, Rhodes, Sean, Wang, Jian J [-- Attachment #1: Type: text/plain, Size: 536 bytes --] @Wang, Jian J<mailto:jian.j.wang@intel.com> thanks, ray ________________________________ From: devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Sheng Lean Tan <sheng.tan@9elements.com> Sent: Monday, February 13, 2023 6:01:21 PM To: Rhodes, Sean <sean@starlabs.systems>; devel@edk2.groups.io <devel@edk2.groups.io> Subject: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Hi Ray, This patch has been hanging along since last year. Has it been merged? Thanks, Sheng [-- Attachment #2: Type: text/html, Size: 1157 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-02-13 11:56 ` Ni, Ray @ 2023-02-17 12:56 ` Sheng Lean Tan [not found] ` <17449DF2E9A4F10E.28744@groups.io> 1 sibling, 0 replies; 23+ messages in thread From: Sheng Lean Tan @ 2023-02-17 12:56 UTC (permalink / raw) To: Ni, Ray; +Cc: devel@edk2.groups.io, Rhodes, Sean, Wang, Jian J [-- Attachment #1: Type: text/plain, Size: 1132 bytes --] Hi, A kind reminder - has this been merged? Best Regards, *Lean Sheng Tan* 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany Email: sheng.tan@9elements.com Phone: *+49 234 68 94 188 <+492346894188>* Mobile: *+49 176 76 113842 <+4917676113842>* Registered office: Bochum Commercial register: Amtsgericht Bochum, HRB 17519 Management: Sebastian German, Eray Bazaar Data protection information according to Art. 13 GDPR <https://9elements.com/privacy> On Mon, 13 Feb 2023 at 12:57, Ni, Ray <ray.ni@intel.com> wrote: > @Wang, Jian J <jian.j.wang@intel.com> > > thanks, > ray > ------------------------------ > *From:* devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Sheng > Lean Tan <sheng.tan@9elements.com> > *Sent:* Monday, February 13, 2023 6:01:21 PM > *To:* Rhodes, Sean <sean@starlabs.systems>; devel@edk2.groups.io < > devel@edk2.groups.io> > *Subject:* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip > removable media if it is not present > > Hi Ray, > This patch has been hanging along since last year. Has it been merged? > > Thanks, > Sheng > > [-- Attachment #2: Type: text/html, Size: 4227 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
[parent not found: <17449DF2E9A4F10E.28744@groups.io>]
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present [not found] ` <17449DF2E9A4F10E.28744@groups.io> @ 2023-03-06 9:57 ` Sheng Lean Tan 2023-03-07 11:32 ` Sheng Lean Tan 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-03-06 9:57 UTC (permalink / raw) To: devel, sheng.tan; +Cc: Ni, Ray, Rhodes, Sean, Wang, Jian J [-- Attachment #1: Type: text/plain, Size: 1851 bytes --] @Jian J Wang <jian.j.wang@intel.com> Any update on this? Anything needs to be done from our side? Thanks. Best Regards, *Lean Sheng Tan* 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany Email: sheng.tan@9elements.com Phone: *+49 234 68 94 188 <+492346894188>* Mobile: *+49 176 76 113842 <+4917676113842>* Registered office: Bochum Commercial register: Amtsgericht Bochum, HRB 17519 Management: Sebastian German, Eray Bazaar Data protection information according to Art. 13 GDPR <https://9elements.com/privacy> On Fri, 17 Feb 2023 at 13:57, Sheng Lean Tan via groups.io <sheng.tan= 9elements.com@groups.io> wrote: > Hi, > A kind reminder - has this been merged? > > Best Regards, > *Lean Sheng Tan* > > > > 9elements GmbH, Kortumstraße 19-21, 44787 Bochum, Germany > Email: sheng.tan@9elements.com > Phone: *+49 234 68 94 188 <+492346894188>* > Mobile: *+49 176 76 113842 <+4917676113842>* > > Registered office: Bochum > Commercial register: Amtsgericht Bochum, HRB 17519 > Management: Sebastian German, Eray Bazaar > > Data protection information according to Art. 13 GDPR > <https://9elements.com/privacy> > > > On Mon, 13 Feb 2023 at 12:57, Ni, Ray <ray.ni@intel.com> wrote: > >> @Wang, Jian J <jian.j.wang@intel.com> >> >> thanks, >> ray >> ------------------------------ >> *From:* devel@edk2.groups.io <devel@edk2.groups.io> on behalf of Sheng >> Lean Tan <sheng.tan@9elements.com> >> *Sent:* Monday, February 13, 2023 6:01:21 PM >> *To:* Rhodes, Sean <sean@starlabs.systems>; devel@edk2.groups.io < >> devel@edk2.groups.io> >> *Subject:* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip >> removable media if it is not present >> >> Hi Ray, >> This patch has been hanging along since last year. Has it been merged? >> >> Thanks, >> Sheng >> > > > [-- Attachment #2: Type: text/html, Size: 7322 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-06 9:57 ` Sheng Lean Tan @ 2023-03-07 11:32 ` Sheng Lean Tan 2023-03-08 8:54 ` Sheng Lean Tan 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-03-07 11:32 UTC (permalink / raw) To: Sheng Lean Tan, devel [-- Attachment #1: Type: text/plain, Size: 32 bytes --] Another kind reminder, thanks. [-- Attachment #2: Type: text/html, Size: 32 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-07 11:32 ` Sheng Lean Tan @ 2023-03-08 8:54 ` Sheng Lean Tan 2023-03-08 8:57 ` Ni, Ray 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-03-08 8:54 UTC (permalink / raw) To: Sheng Lean Tan, devel [-- Attachment #1: Type: text/plain, Size: 225 bytes --] Seriously, what is the hold up here? did Sean not following the process? Did he miss anything? it just doesn’t make sense to keep ignoring this patch for half year for no reason. Is there a way to voice up a about this? [-- Attachment #2: Type: text/html, Size: 237 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-08 8:54 ` Sheng Lean Tan @ 2023-03-08 8:57 ` Ni, Ray 2023-03-09 0:54 ` 回复: " gaoliming [not found] ` <174A9A2823F47D61.24021@groups.io> 0 siblings, 2 replies; 23+ messages in thread From: Ni, Ray @ 2023-03-08 8:57 UTC (permalink / raw) To: devel@edk2.groups.io, Tan, Lean Sheng; +Cc: Wang, Jian J, Gao, Liming [-- Attachment #1: Type: text/plain, Size: 904 bytes --] M: Jian J Wang jian.j.wang@intel.com<mailto:jian.j.wang@intel.com> [jwang36] M: Liming Gao gaoliming@byosoft.com.cn<mailto:gaoliming@byosoft.com.cn> [lgao4] Jian and Liming are maintainers of MdeModulePkg. The patch passed my review. Either of them can help to merge the patch. I guess Liming might not see this patch. I am sure he can help on merging it. Thanks, Ray From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Sheng Lean Tan Sent: Wednesday, March 8, 2023 4:55 PM To: Tan, Lean Sheng <sheng.tan@9elements.com>; devel@edk2.groups.io Subject: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Seriously, what is the hold up here? did Sean not following the process? Did he miss anything? it just doesn’t make sense to keep ignoring this patch for half year for no reason. Is there a way to voice up a about this? [-- Attachment #2: Type: text/html, Size: 3653 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-08 8:57 ` Ni, Ray @ 2023-03-09 0:54 ` gaoliming 2023-03-10 11:29 ` [edk2-devel] " Sheng Lean Tan [not found] ` <174A9A2823F47D61.24021@groups.io> 1 sibling, 1 reply; 23+ messages in thread From: gaoliming @ 2023-03-09 0:54 UTC (permalink / raw) To: devel, ray.ni, 'Tan, Lean Sheng'; +Cc: 'Wang, Jian J' [-- Attachment #1: Type: text/plain, Size: 1566 bytes --] Ray: You also have access to merge the patch. Sure, I can help merge this patch. Thanks Liming 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Ni, Ray 发送时间: 2023年3月8日 16:58 收件人: devel@edk2.groups.io; Tan, Lean Sheng <sheng.tan@9elements.com> 抄送: Wang, Jian J <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn> 主题: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present M: Jian J Wang jian.j.wang@intel.com <mailto:jian.j.wang@intel.com> [jwang36] M: Liming Gao gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> [lgao4] Jian and Liming are maintainers of MdeModulePkg. The patch passed my review. Either of them can help to merge the patch. I guess Liming might not see this patch. I am sure he can help on merging it. Thanks, Ray From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Sheng Lean Tan Sent: Wednesday, March 8, 2023 4:55 PM To: Tan, Lean Sheng <sheng.tan@9elements.com <mailto:sheng.tan@9elements.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> Subject: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Seriously, what is the hold up here? did Sean not following the process? Did he miss anything? it just doesn’t make sense to keep ignoring this patch for half year for no reason. Is there a way to voice up a about this? [-- Attachment #2: Type: text/html, Size: 6024 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-09 0:54 ` 回复: " gaoliming @ 2023-03-10 11:29 ` Sheng Lean Tan 2023-03-15 16:41 ` Sheng Lean Tan 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-03-10 11:29 UTC (permalink / raw) To: gaoliming, devel [-- Attachment #1: Type: text/plain, Size: 132 bytes --] Thanks Liming and Ray for looking into this. It was really frustrating that no one bothers to reply after keep pinging for months. [-- Attachment #2: Type: text/html, Size: 132 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [edk2-devel] 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-10 11:29 ` [edk2-devel] " Sheng Lean Tan @ 2023-03-15 16:41 ` Sheng Lean Tan 2023-03-17 3:03 ` 回复: " gaoliming 0 siblings, 1 reply; 23+ messages in thread From: Sheng Lean Tan @ 2023-03-15 16:41 UTC (permalink / raw) To: devel, Ni, Ray; +Cc: gaoliming [-- Attachment #1: Type: text/plain, Size: 49 bytes --] Hi Liming/ Ray, Could you help to merge? Thanks. [-- Attachment #2: Type: text/html, Size: 90 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* 回复: [edk2-devel] 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present 2023-03-15 16:41 ` Sheng Lean Tan @ 2023-03-17 3:03 ` gaoliming 0 siblings, 0 replies; 23+ messages in thread From: gaoliming @ 2023-03-17 3:03 UTC (permalink / raw) To: devel, sheng.tan, 'Ni, Ray' [-- Attachment #1: Type: text/plain, Size: 542 bytes --] Tan: I rebase this PR https://github.com/tianocore/edk2/pull/4127 again. It will be merged now. Thanks Liming 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Sheng Lean Tan 发送时间: 2023年3月16日 0:41 收件人: devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com> 抄送: gaoliming <gaoliming@byosoft.com.cn> 主题: Re: [edk2-devel] 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Hi Liming/ Ray, Could you help to merge? Thanks. [-- Attachment #2: Type: text/html, Size: 4358 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
[parent not found: <174A9A2823F47D61.24021@groups.io>]
* 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present [not found] ` <174A9A2823F47D61.24021@groups.io> @ 2023-03-10 2:20 ` gaoliming 0 siblings, 0 replies; 23+ messages in thread From: gaoliming @ 2023-03-10 2:20 UTC (permalink / raw) To: devel, gaoliming, ray.ni, 'Tan, Lean Sheng' Cc: 'Wang, Jian J' [-- Attachment #1: Type: text/plain, Size: 2242 bytes --] PR https://github.com/tianocore/edk2/pull/4127 is created for this patch. Thanks Liming 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 gaoliming via groups.io 发送时间: 2023年3月9日 8:55 收件人: devel@edk2.groups.io; ray.ni@intel.com; 'Tan, Lean Sheng' <sheng.tan@9elements.com> 抄送: 'Wang, Jian J' <jian.j.wang@intel.com> 主题: 回复: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Ray: You also have access to merge the patch. Sure, I can help merge this patch. Thanks Liming 发件人: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > 代表 Ni, Ray 发送时间: 2023年3月8日 16:58 收件人: devel@edk2.groups.io <mailto:devel@edk2.groups.io> ; Tan, Lean Sheng <sheng.tan@9elements.com <mailto:sheng.tan@9elements.com> > 抄送: Wang, Jian J <jian.j.wang@intel.com <mailto:jian.j.wang@intel.com> >; Gao, Liming <gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> > 主题: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present M: Jian J Wang jian.j.wang@intel.com <mailto:jian.j.wang@intel.com> [jwang36] M: Liming Gao gaoliming@byosoft.com.cn <mailto:gaoliming@byosoft.com.cn> [lgao4] Jian and Liming are maintainers of MdeModulePkg. The patch passed my review. Either of them can help to merge the patch. I guess Liming might not see this patch. I am sure he can help on merging it. Thanks, Ray From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> <devel@edk2.groups.io <mailto:devel@edk2.groups.io> > On Behalf Of Sheng Lean Tan Sent: Wednesday, March 8, 2023 4:55 PM To: Tan, Lean Sheng <sheng.tan@9elements.com <mailto:sheng.tan@9elements.com> >; devel@edk2.groups.io <mailto:devel@edk2.groups.io> Subject: Re: [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Seriously, what is the hold up here? did Sean not following the process? Did he miss anything? it just doesn’t make sense to keep ignoring this patch for half year for no reason. Is there a way to voice up a about this? [-- Attachment #2: Type: text/html, Size: 8081 bytes --] ^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present @ 2022-12-09 20:45 Sean Rhodes 2022-12-09 20:45 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes 0 siblings, 1 reply; 23+ messages in thread From: Sean Rhodes @ 2022-12-09 20:45 UTC (permalink / raw) To: devel Cc: Matt DeVillier, Hao A Wu, Jian J Wang, Liming Gao, Zhichao Gao, Ray Ni, Sean Rhodes From: Matt DeVillier <matt.devillier@gmail.com> Only enumerate devices that have media present. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Change-Id: I78a0b8be3e2f33edce2d43bbdd7670e6174d0ff8 --- MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c index 962892d38f..bde22fa659 100644 --- a/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmBoot.c @@ -2218,6 +2218,15 @@ BmEnumerateBootOptions ( continue; } + // + // Skip removable media if not present + // + if ((BlkIo->Media->RemovableMedia == TRUE) && + (BlkIo->Media->MediaPresent == FALSE)) + { + continue; + } + Description = BmGetBootDescription (Handles[Index]); BootOptions = ReallocatePool ( sizeof (EFI_BOOT_MANAGER_LOAD_OPTION) * (*BootOptionCount), -- 2.37.2 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV 2022-12-09 20:45 Sean Rhodes @ 2022-12-09 20:45 ` Sean Rhodes 2022-12-15 0:26 ` Wu, Hao A 0 siblings, 1 reply; 23+ messages in thread From: Sean Rhodes @ 2022-12-09 20:45 UTC (permalink / raw) To: devel; +Cc: Matt DeVillier, Hao A Wu, Ray Ni, Sean Rhodes From: Matt DeVillier <matt.devillier@gmail.com> PSID matching relies on comparing the PSIV against the PortSpeed value. This patch stops edk2 from checking for a PSIV of 0, as it is not valid; this reduces the number of register access by approximately 6 per second. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Sean Rhodes <sean@starlabs.systems> Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a --- MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 ++++++++++++++++------------- 1 file changed, 25 insertions(+), 19 deletions(-) diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c index 15fb49f28f..8dd7a8fbb7 100644 --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c @@ -371,6 +371,7 @@ XhcGetRootHubPortStatus ( UINT32 TotalPort; UINTN Index; UINTN MapSize; + UINT8 PortSpeed; EFI_STATUS Status; USB_DEV_ROUTE ParentRouteChart; EFI_TPL OldTpl; @@ -397,32 +398,37 @@ XhcGetRootHubPortStatus ( State = XhcReadOpReg (Xhc, Offset); + PortSpeed = (State & XHC_PORTSC_PS) >> 10; + // // According to XHCI 1.1 spec November 2017, // Section 7.2 xHCI Support Protocol Capability // - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & XHC_PORTSC_PS) >> 10)); - if (PortStatus->PortStatus == 0) { - // - // According to XHCI 1.1 spec November 2017, - // bit 10~13 of the root port status register identifies the speed of the attached device. - // - switch ((State & XHC_PORTSC_PS) >> 10) { - case 2: - PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; - break; + if (PortSpeed > 0) { + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, PortSpeed); + // If no match found in ext cap reg, fall back to PORTSC + if (PortStatus->PortStatus == 0) { + // + // According to XHCI 1.1 spec November 2017, + // bit 10~13 of the root port status register identifies the speed of the attached device. + // + switch (PortSpeed) { + case 2: + PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; + break; - case 3: - PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; - break; + case 3: + PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; + break; - case 4: - case 5: - PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; - break; + case 4: + case 5: + PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; + break; - default: - break; + default: + break; + } } } -- 2.37.2 ^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV 2022-12-09 20:45 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes @ 2022-12-15 0:26 ` Wu, Hao A 0 siblings, 0 replies; 23+ messages in thread From: Wu, Hao A @ 2022-12-15 0:26 UTC (permalink / raw) To: Rhodes, Sean, devel@edk2.groups.io Cc: Matt DeVillier, Ni, Ray, Rhodes, Sean, Chiu, Ian Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Best Regards, Hao Wu > -----Original Message----- > From: Sean Rhodes <sean@starlabs.systems> > Sent: Saturday, December 10, 2022 4:46 AM > To: devel@edk2.groups.io > Cc: Matt DeVillier <matt.devillier@gmail.com>; Wu, Hao A > <hao.a.wu@intel.com>; Ni, Ray <ray.ni@intel.com>; Rhodes, Sean > <sean@starlabs.systems> > Subject: [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid > PSIV > > From: Matt DeVillier <matt.devillier@gmail.com> > > PSID matching relies on comparing the PSIV against the PortSpeed > value. This patch stops edk2 from checking for a PSIV of 0, as it > is not valid; this reduces the number of register access by > approximately 6 per second. > > Cc: Hao A Wu <hao.a.wu@intel.com> > Cc: Ray Ni <ray.ni@intel.com> > Reviewed-by: Sean Rhodes <sean@starlabs.systems> > Signed-off-by: Matt DeVillier <matt.devillier@gmail.com> > Change-Id: If15c55ab66d2e7faa832ce8576d2e5b47157cc9a > --- > MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c | 44 ++++++++++++++++------------- > 1 file changed, 25 insertions(+), 19 deletions(-) > > diff --git a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > index 15fb49f28f..8dd7a8fbb7 100644 > --- a/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > +++ b/MdeModulePkg/Bus/Pci/XhciDxe/Xhci.c > @@ -371,6 +371,7 @@ XhcGetRootHubPortStatus ( > UINT32 TotalPort; > > UINTN Index; > > UINTN MapSize; > > + UINT8 PortSpeed; > > EFI_STATUS Status; > > USB_DEV_ROUTE ParentRouteChart; > > EFI_TPL OldTpl; > > @@ -397,32 +398,37 @@ XhcGetRootHubPortStatus ( > > > State = XhcReadOpReg (Xhc, Offset); > > > > + PortSpeed = (State & XHC_PORTSC_PS) >> 10; > > + > > // > > // According to XHCI 1.1 spec November 2017, > > // Section 7.2 xHCI Support Protocol Capability > > // > > - PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, ((State & > XHC_PORTSC_PS) >> 10)); > > - if (PortStatus->PortStatus == 0) { > > - // > > - // According to XHCI 1.1 spec November 2017, > > - // bit 10~13 of the root port status register identifies the speed of the > attached device. > > - // > > - switch ((State & XHC_PORTSC_PS) >> 10) { > > - case 2: > > - PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > - break; > > + if (PortSpeed > 0) { > > + PortStatus->PortStatus = XhcCheckUsbPortSpeedUsedPsic (Xhc, > PortSpeed); > > + // If no match found in ext cap reg, fall back to PORTSC > > + if (PortStatus->PortStatus == 0) { > > + // > > + // According to XHCI 1.1 spec November 2017, > > + // bit 10~13 of the root port status register identifies the speed of the > attached device. > > + // > > + switch (PortSpeed) { > > + case 2: > > + PortStatus->PortStatus |= USB_PORT_STAT_LOW_SPEED; > > + break; > > > > - case 3: > > - PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > - break; > > + case 3: > > + PortStatus->PortStatus |= USB_PORT_STAT_HIGH_SPEED; > > + break; > > > > - case 4: > > - case 5: > > - PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > - break; > > + case 4: > > + case 5: > > + PortStatus->PortStatus |= USB_PORT_STAT_SUPER_SPEED; > > + break; > > > > - default: > > - break; > > + default: > > + break; > > + } > > } > > } > > > > -- > 2.37.2 ^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2023-03-17 3:03 UTC | newest] Thread overview: 23+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-12-16 8:58 [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Sean Rhodes 2022-12-16 8:58 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes 2022-12-19 6:16 ` Wu, Hao A 2022-12-21 0:48 ` [edk2-devel] " Wu, Hao A 2022-12-16 8:58 ` [PATCH 3/3] MdeModulePkg/Bus/Pci/XhciDxe: Check port is compatible before getting PSIV Sean Rhodes 2022-12-19 7:46 ` [edk2-devel] " Wu, Hao A 2022-12-21 0:49 ` Wu, Hao A 2022-12-16 9:03 ` [edk2-devel] [PATCH 1/3] MdeModulePkg/BmBoot: Skip removable media if it is not present Ni, Ray 2023-01-28 19:01 ` Sean Rhodes 2023-02-13 10:01 ` Sheng Lean Tan 2023-02-13 11:56 ` Ni, Ray 2023-02-17 12:56 ` Sheng Lean Tan [not found] ` <17449DF2E9A4F10E.28744@groups.io> 2023-03-06 9:57 ` Sheng Lean Tan 2023-03-07 11:32 ` Sheng Lean Tan 2023-03-08 8:54 ` Sheng Lean Tan 2023-03-08 8:57 ` Ni, Ray 2023-03-09 0:54 ` 回复: " gaoliming 2023-03-10 11:29 ` [edk2-devel] " Sheng Lean Tan 2023-03-15 16:41 ` Sheng Lean Tan 2023-03-17 3:03 ` 回复: " gaoliming [not found] ` <174A9A2823F47D61.24021@groups.io> 2023-03-10 2:20 ` gaoliming -- strict thread matches above, loose matches on Subject: below -- 2022-12-09 20:45 Sean Rhodes 2022-12-09 20:45 ` [PATCH 2/3] MdeModulePkg/XhciDxe/Xhci: Don't check for invalid PSIV Sean Rhodes 2022-12-15 0:26 ` 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