BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2194

The code changes are made to integrate the setup infrastructure for the
PCI feature enumeration, in the last phase of the PCI Bus driver, after
its registration and its option ROM loading phase is complete.

Signed-off-by: Ashraf Javeed <ashraf.jav...@intel.com>
Cc: Jian J Wang <jian.j.w...@intel.com>
Cc: Hao A Wu <hao.a...@intel.com>
Cc: Ray Ni <ray...@intel.com>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c  | 11 +++++++++++
 MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c | 15 ++++++++++++++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h | 11 +++++++++++
 3 files changed, 36 insertions(+), 1 deletion(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
index 33a0e94..b839102 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
@@ -8,6 +8,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 **/
 
 #include "PciBus.h"
+#include "PciFeatureSupport.h"
 
 //
 // This device structure is serviced as a header.
@@ -170,6 +171,8 @@ DestroyRootBridgeByHandle (
 
     if (Temp->Handle == Controller) {
 
+      DestroyRootBridgePciFeaturesConfigCompletionList (Temp);
+
       RemoveEntryList (CurrentLink);
 
       DestroyPciDeviceTree (Temp);
@@ -818,6 +821,14 @@ StartPciDevicesOnBridge (
   if (EFI_ERROR (Status) == EFI_NOT_FOUND) {
     return Status;
   } else {
+    if (CheckOtherPciFeaturesPcd ()) {
+      //
+      // the late configuration of PCI features
+      //
+      Status = EnumerateOtherPciFeatures (
+                  RootBridge
+                );
+    }
     //
     // finally start those PCI bridge port devices only
     //
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c
index ab0e096..9e6671d 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.c
@@ -25,6 +25,19 @@ PRIMARY_ROOT_PORT_NODE                      
*mPrimaryRootPortList;
 **/
 PCI_FEATURE_CONFIGURATION_COMPLETION_LIST   
*mPciFeaturesConfigurationCompletionList = NULL;
 
+/**
+  Main routine to indicate platform selection of any of the other PCI features
+  to be configured by this driver
+
+  @retval TRUE    platform has selected the other PCI features to be configured
+          FALSE   platform has not selected any of the other PCI features
+**/
+BOOLEAN
+CheckOtherPciFeaturesPcd (
+  )
+{
+  return PcdGet32 (PcdOtherPciFeatures) ? TRUE : FALSE;
+}
 
 /**
   Main routine to indicate whether the platform has selected the 
Max_Payload_Size
@@ -699,7 +712,7 @@ ProgramDevicePciFeatures (
   IN PCI_IO_DEVICE          *PciDevice
   )
 {
-  EFI_STATUS           Status;
+  EFI_STATUS           Status = EFI_SUCCESS;
 
   return Status;
 }
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h 
b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h
index b06c140..f92d008 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciFeatureSupport.h
@@ -138,6 +138,17 @@ typedef enum {
 }PCI_FEATURE_CONFIGURATION_PHASE;
 
 
+/**
+  Main routine to indicate platform selection of any of the other PCI features
+  to be configured by this driver
+
+  @retval TRUE    platform has selected the other PCI features to be configured
+          FALSE   platform has not selected any of the other PCI features
+**/
+BOOLEAN
+CheckOtherPciFeaturesPcd (
+  );
+
 /**
   Enumerate all the nodes of the specified root bridge or PCI-PCI Bridge, to
   configure the other PCI features.
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#49810): https://edk2.groups.io/g/devel/message/49810
Mute This Topic: https://groups.io/mt/40419700/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to