Dear MdeModulePkg maintainer,

please find the attached patch that ensures the PCI Host Bridge succeeds the 
transitions into the different PCI enumeration phases.
The PCI host bridge can signal failures in its initialization to the PCI Bus 
driver by returning a status error code from its 
EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.NotifyPhase() callback.

Regards,
Olivier

-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.
From bdc97787e1ceae44214031d525619fc47e9c51a7 Mon Sep 17 00:00:00 2001
From: Olivier Martin <[email protected]>
Date: Tue, 16 Jul 2013 06:03:45 +0100
Subject: [PATCH] MdeModulePkg/PciBusDxe: Ensure the PCI host bridge succeeded the transitions into the different PCI enumeration phases

The PCI host bridge can signal failures in its initialization to
the PCI Bus driver through the function call NotifyPhase().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <[email protected]>
---
 MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c |   12 ++++++++-
 MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c        |   28 ++++++++++++++++++-----
 2 files changed, 32 insertions(+), 8 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
index bd1e680..ee6656d 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
@@ -82,7 +82,11 @@ PciEnumerator (
   //
   // Notify the pci bus enumeration is about to begin
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginEnumeration);
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   //
   // Start the bus allocation phase
@@ -105,7 +109,11 @@ PciEnumerator (
   //
   // Notify the pci bus enumeration is about to complete
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeEndEnumeration);
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   //
   // Process P2C
diff --git a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
index 9e1184e..a5cea9e 100644
--- a/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
+++ b/MdeModulePkg/Bus/Pci/PciBusDxe/PciLib.c
@@ -759,7 +759,11 @@ PciHostBridgeResourceAllocator (
   //
   // Notify pci bus driver starts to program the resource
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeSetResources);
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   RootBridgeDev     = NULL;
 
@@ -898,9 +902,9 @@ PciHostBridgeResourceAllocator (
   //
   // Notify the resource allocation phase is to end
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeEndResourceAllocation);
 
-  return EFI_SUCCESS;
+  return Status;
 }
 
 /**
@@ -1443,7 +1447,11 @@ PciHostBridgeEnumerator (
   //
   // Notify the bus allocation phase is about to start
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   DEBUG((EFI_D_INFO, "PCI Bus First Scanning\n"));
   RootBridgeHandle = NULL;
@@ -1531,7 +1539,11 @@ PciHostBridgeEnumerator (
     //
     // Notify the bus allocation phase is about to start for the 2nd time
     //
-    NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
+    Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginBusAllocation);
+
+    if (EFI_ERROR (Status)) {
+      return Status;
+    }
 
     DEBUG((EFI_D_INFO, "PCI Bus Second Scanning\n"));
     RootBridgeHandle = NULL;
@@ -1569,7 +1581,11 @@ PciHostBridgeEnumerator (
   //
   // Notify the resource allocation phase is to start
   //
-  NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginResourceAllocation);
+  Status = NotifyPhase (PciResAlloc, EfiPciHostBridgeBeginResourceAllocation);
+
+  if (EFI_ERROR (Status)) {
+    return Status;
+  }
 
   RootBridgeHandle = NULL;
   while (PciResAlloc->GetNextRootBridge (PciResAlloc, &RootBridgeHandle) == EFI_SUCCESS) {
-- 
1.7.4.1

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to