Hi Ray, I will add a similar check, but the one that you propose exits the enumeration early. I will get a new patch posted in about 30 minutes.
Lee Leahy (425) 881-4919 Intel Corporation Suite 125 2700 - 156th Ave NE Bellevue, WA 98007-6554 -----Original Message----- From: Ni, Ruiyu Sent: Thursday, February 25, 2016 5:33 PM To: Leahy, Leroy P <[email protected]>; Bjorge, Erik C <[email protected]>; [email protected] Subject: RE: [PATCH v3] DuetPkg-PciBusNoEnumerationDxe: Fix stack overflow Leroy, Sorry for the late response. Why not take "SecBus == 0" as a false condition? If (EFI_ERROR (Status) || SecBus == 0) { // <-- adds "SecBus == 0" check return Status; } So that bridges with MEM/IO decode disabled can still be enumerated. Regards, Ray >-----Original Message----- >From: Leahy, Leroy P >Sent: Friday, February 26, 2016 3:17 AM >To: Ni, Ruiyu <[email protected]>; Bjorge, Erik C ><[email protected]>; [email protected] >Cc: Leahy, Leroy P <[email protected]> >Subject: [PATCH v3] DuetPkg-PciBusNoEnumerationDxe: Fix stack overflow > >When a PCI bridge is not enabled, the secondary bus may still be zero. >This causes an infinite recursive call to enumerate bus 0 which results >in a stack overflow. The easy fix is to skip the recursive bus >enumeration for devices which are not enabled either for memory or I/O >accesses. > >TEST=Build and run CorebootPayloadPkg on Quark/Galileo Gen2 > >Contributed-under: TianoCore Contribution Agreement 1.0 >Signed-off-by: Lee Leahy <[email protected]> >--- > DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c >b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c >index 80b2b6b..7f8393a 100644 >--- a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c >+++ b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c >@@ -243,7 +243,9 @@ Returns: > // > // > >- if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE >(&Pci))) { >+ if (!EFI_ERROR (Status) && (Pci.Hdr.Command & >(EFI_PCI_COMMAND_IO_SPACE >+ | EFI_PCI_COMMAND_MEMORY_SPACE)) >+ && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) { > > // > // If it is PPB, we need to get the secondary bus to >continue the enumeration >-- >1.9.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

