Ruiyu, Can you review this please?
Thanks! --Samer -----Original Message----- From: El-Haj-Mahmoud, Samer Sent: Wednesday, September 16, 2015 12:23 PM To: [email protected] Cc: Feng Tian <[email protected]>; Shifflett, Joseph <[email protected]>; El-Haj-Mahmoud, Samer <[email protected]> Subject: [PATCH v2 1/1] When looping through all PCI functions, code should not look for functions 1-7 if function 0 is not present or if function 0 indicates the device is not multifunction. Prior to this fix, the code would use stale data in a buffer to deter... From: "Shifflett, Joseph" <[email protected]> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Samer El-Haj-Mahmoud <[email protected]> --- DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c | 8 ++++++++ MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c | 8 ++++++++ MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c | 16 ++++++++++++++++ MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c | 8 ++++++++ 4 files changed, 40 insertions(+) diff --git a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c index fb41727..80b2b6b 100644 --- a/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c +++ b/DuetPkg/PciBusNoEnumerationDxe/PciEnumeratorSupport.c @@ -1,6 +1,7 @@ /*++ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -216,6 +217,13 @@ Returns: (UINT8) Func ); + if (EFI_ERROR (Status) && Func == 0) { + // + // go to next device if there is no Function 0 + // + break; + } + if (!EFI_ERROR (Status)) { // diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c index 7329143..597c083 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c @@ -2,6 +2,7 @@ PCI eunmeration implementation on entire PCI bus system for PCI Bus module. Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -407,6 +408,13 @@ PciAssignBusNumber ( Func ); + if (EFI_ERROR (Status) && Func == 0) { + // + // go to next device if there is no Function 0 + // + break; + } + if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci) || IS_CARDBUS_BRIDGE (&Pci))) { diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c index f46025e..f7aea4f 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c @@ -2,6 +2,7 @@ PCI emumeration support functions implementation for PCI Bus module. Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -119,6 +120,14 @@ PciPciDeviceInfoCollector ( (UINT8) Device, (UINT8) Func ); + + if (EFI_ERROR (Status) && Func == 0) { + // + // go to next device if there is no Function 0 + // + break; + } + if (!EFI_ERROR (Status)) { // @@ -2597,6 +2606,13 @@ ResetAllPpbBusNumber ( Func ); + if (EFI_ERROR (Status) && Func == 0) { + // + // go to next device if there is no Function 0 + // + break; + } + if (!EFI_ERROR (Status) && (IS_PCI_BRIDGE (&Pci))) { Register = 0; diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c index b3d91a8..3e275e3 100644 --- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c +++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c @@ -2,6 +2,7 @@ Internal library implementation for PCI Bus module. Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR> +(C) Copyright 2015 Hewlett Packard Enterprise Development LP<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -1022,6 +1023,13 @@ PciScanBus ( Func ); + if (EFI_ERROR (Status) && Func == 0) { + // + // go to next device if there is no Function 0 + // + break; + } + if (EFI_ERROR (Status)) { continue; } -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list [email protected] https://lists.01.org/mailman/listinfo/edk2-devel

