]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Clean up meta data and code scrub for PCI Bus module.
authorvanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Jun 2009 07:19:00 +0000 (07:19 +0000)
committervanjeff <vanjeff@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 23 Jun 2009 07:19:00 +0000 (07:19 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8624 6f19259b-4bc3-4df7-8a09-765794883524

13 files changed:
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBus.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciDeviceSupport.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumerator.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciEnumeratorSupport.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciIo.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciLib.h
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciOptionRomSupport.c
IntelFrameworkModulePkg/Bus/Pci/PciBusDxe/PciRomTable.c

index 2a517448beede860c4b2404963fe1523c6d9d3b0..2feab943e2ece8735fb2d3093528bce23758291e 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-   Driver Binding functions for PCI bus module.\r
+  Driver Binding functions for PCI Bus module.\r
    \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -12,13 +12,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-\r
 #include "PciBus.h"\r
 \r
 //\r
 // PCI Bus Driver Global Variables\r
 //\r
-\r
 EFI_DRIVER_BINDING_PROTOCOL                   gPciBusDriverBinding = {\r
   PciBusDriverBindingSupported,\r
   PciBusDriverBindingStart,\r
@@ -28,26 +26,32 @@ EFI_DRIVER_BINDING_PROTOCOL                   gPciBusDriverBinding = {
   NULL\r
 };\r
 \r
-EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL  *gEfiIncompatiblePciDeviceSupport = NULL;\r
 EFI_HANDLE                                    gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
-UINTN                                         gPciHostBridgeNumber;\r
-BOOLEAN                                       gFullEnumeration;\r
-UINT64                                        gAllOne   = 0xFFFFFFFFFFFFFFFFULL;\r
-UINT64                                        gAllZero  = 0;\r
+EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL  *gEfiIncompatiblePciDeviceSupport = NULL;\r
+UINTN                                         gPciHostBridgeNumber = 0;\r
+BOOLEAN                                       gFullEnumeration     = TRUE;\r
+UINT64                                        gAllOne              = 0xFFFFFFFFFFFFFFFFULL;\r
+UINT64                                        gAllZero             = 0;\r
 \r
 EFI_PCI_PLATFORM_PROTOCOL                     *gPciPlatformProtocol;\r
 \r
-//\r
-// PCI Bus Driver Support Functions\r
-//\r
+GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL mPciHotPlugRequest = {\r
+  PciHotPlugRequestNotify\r
+};\r
+\r
 /**\r
-  Initialize the global variables\r
-  publish the driver binding protocol\r
+  The Entry Point for PCI Bus module. The user code starts with this function.\r
+\r
+  Installs driver module protocols and. Creates virtual device handles for ConIn,\r
+  ConOut, and StdErr. Installs Simple Text In protocol, Simple Text In Ex protocol,\r
+  Simple Pointer protocol, Absolute Pointer protocol on those virtual handlers.\r
+  Installs Graphics Output protocol and/or UGA Draw protocol if needed.\r
 \r
-  @param[in] ImageHandle,\r
-  @param[in] *SystemTable\r
+  @param[in] ImageHandle    The firmware allocated handle for the EFI image.\r
+  @param[in] SystemTable    A pointer to the EFI System Table.\r
 \r
-  @retval status of installing driver binding component name protocol.\r
+  @retval EFI_SUCCESS       The entry point is executed successfully.\r
+  @retval other             Some error occurs when executing this entry point.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -58,13 +62,13 @@ PciBusEntryPoint (
   )\r
 {\r
   EFI_STATUS  Status;\r
-\r
+  EFI_HANDLE  Handle;\r
\r
+  //\r
+  // Initializes PCI devices pool\r
+  //\r
   InitializePciDevicePool ();\r
 \r
-  gFullEnumeration      = TRUE;\r
-\r
-  gPciHostBridgeNumber  = 0;\r
-  \r
   //\r
   // Install driver model protocol(s).\r
   //\r
@@ -78,8 +82,19 @@ PciBusEntryPoint (
              );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  InstallHotPlugRequestProtocol (&Status);\r
-  \r
+  if (FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
+    //  \r
+    // If Hot Plug is supported, install EFI PCI Hot Plug Request protocol.\r
+    //\r
+    Handle = NULL;\r
+    Status = gBS->InstallProtocolInterface (\r
+                    &Handle,\r
+                    &gEfiPciHotPlugRequestProtocolGuid,\r
+                    EFI_NATIVE_INTERFACE,\r
+                    &mPciHotPlugRequest\r
+                    );\r
+  }\r
+\r
   return Status;\r
 }\r
 \r
@@ -88,13 +103,13 @@ PciBusEntryPoint (
   than contains a gEfiPciRootBridgeIoProtocolGuid protocol can be supported.\r
 \r
   @param  This                Protocol instance pointer.\r
-  @param  ControllerHandle    Handle of device to test\r
-  @param  RemainingDevicePath Optional parameter use to pick a specific child\r
+  @param  Controller          Handle of device to test.\r
+  @param  RemainingDevicePath Optional parameter use to pick a specific child.\r
                               device to start.\r
 \r
-  @retval EFI_SUCCESS         This driver supports this device\r
-  @retval EFI_ALREADY_STARTED This driver is already running on this device\r
-  @retval other               This driver does not support this device\r
+  @retval EFI_SUCCESS         This driver supports this device.\r
+  @retval EFI_ALREADY_STARTED This driver is already running on this device.\r
+  @retval other               This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -175,13 +190,13 @@ PciBusDriverBindingSupported (
   all device under PCI bus.\r
 \r
   @param  This                 Protocol instance pointer.\r
-  @param  ControllerHandle     Handle of device to bind driver to\r
-  @param  RemainingDevicePath  Optional parameter use to pick a specific child\r
+  @param  Controller           Handle of device to bind driver to.\r
+  @param  RemainingDevicePath  Optional parameter use to pick a specific child.\r
                                device to start.\r
 \r
-  @retval EFI_SUCCESS          This driver is added to ControllerHandle\r
-  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle\r
-  @retval other                This driver does not support this device\r
+  @retval EFI_SUCCESS          This driver is added to ControllerHandle.\r
+  @retval EFI_ALREADY_STARTED  This driver is already running on ControllerHandle.\r
+  @retval other                This driver does not support this device.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -237,13 +252,13 @@ PciBusDriverBindingStart (
   created by this driver.\r
 \r
   @param  This              Protocol instance pointer.\r
-  @param  ControllerHandle  Handle of device to stop driver on\r
+  @param  Controller        Handle of device to stop driver on.\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
   @param  ChildHandleBuffer List of Child Handles to Stop.\r
 \r
-  @retval EFI_SUCCESS       This driver is removed ControllerHandle\r
-  @retval other             This driver was not removed from this device\r
+  @retval EFI_SUCCESS       This driver is removed ControllerHandle.\r
+  @retval other             This driver was not removed from this device.\r
 \r
 **/\r
 EFI_STATUS\r
index 4e206ff3b11b2c33fdcba42bc93ff9628b65dab2..43ccf83e6775afa555d72bb2c0eb89784d46a6d5 100644 (file)
@@ -1,4 +1,5 @@
 /** @file\r
+  Header files and data structures needed by PCI Bus module.\r
 \r
 Copyright (c) 2006 - 2009, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -15,10 +16,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #ifndef _EFI_PCI_BUS_H_\r
 #define _EFI_PCI_BUS_H_\r
 \r
-\r
 #include <FrameworkDxe.h>\r
 \r
-\r
 #include <Protocol/LoadedImage.h>\r
 #include <Protocol/PciHostBridgeResourceAllocation.h>\r
 #include <Protocol/PciIo.h>\r
@@ -30,7 +29,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Protocol/PciHotPlugInit.h>\r
 #include <Protocol/Decompress.h>\r
 #include <Protocol/BusSpecificDriverOverride.h>\r
-#include <Protocol/UgaIo.h>\r
 #include <Protocol/IncompatiblePciDeviceSupport.h>\r
 \r
 #include <Library/DebugLib.h>\r
@@ -49,20 +47,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <IndustryStandard/Pci.h>\r
 #include <IndustryStandard/PeImage.h>\r
 #include <IndustryStandard/Acpi.h>\r
-#include "ComponentName.h"\r
-\r
 \r
-//\r
-// Global Variables\r
-//\r
-extern EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport;\r
-extern EFI_DRIVER_BINDING_PROTOCOL                  gPciBusDriverBinding;\r
-extern EFI_COMPONENT_NAME_PROTOCOL                  gPciBusComponentName;\r
-extern EFI_COMPONENT_NAME2_PROTOCOL                 gPciBusComponentName2;\r
+typedef struct _PCI_IO_DEVICE              PCI_IO_DEVICE;\r
+typedef struct _PCI_BAR                    PCI_BAR;\r
+typedef enum   _PCI_BAR_TYPE               PCI_BAR_TYPE;\r
 \r
-//\r
-// Driver Produced Protocol Prototypes\r
-//\r
+#include "ComponentName.h"\r
+#include "PciIo.h"\r
+#include "PciCommand.h"\r
+#include "PciDeviceSupport.h"\r
+#include "PciEnumerator.h"\r
+#include "PciEnumeratorSupport.h"\r
+#include "PciDriverOverride.h"\r
+#include "PciRomTable.h"\r
+#include "PciOptionRomSupport.h"\r
+#include "PciPowerManagement.h"\r
+#include "PciHotPlugSupport.h"\r
+#include "PciLib.h"\r
 \r
 #define VGABASE1  0x3B0\r
 #define VGALIMIT1 0x3BB\r
@@ -73,7 +74,7 @@ extern EFI_COMPONENT_NAME2_PROTOCOL                 gPciBusComponentName2;
 #define ISABASE   0x100\r
 #define ISALIMIT  0x3FF\r
 \r
-typedef enum {\r
+enum _PCI_BAR_TYPE {\r
   PciBarTypeUnknown = 0,\r
   PciBarTypeIo16,\r
   PciBarTypeIo32,\r
@@ -84,9 +85,12 @@ typedef enum {
   PciBarTypeIo,\r
   PciBarTypeMem,\r
   PciBarTypeMaxType\r
-} PCI_BAR_TYPE;\r
+};\r
 \r
-typedef struct {\r
+//\r
+// PCI BAR parameters\r
+//\r
+struct _PCI_BAR {\r
   UINT64        BaseAddress;\r
   UINT64        Length;\r
   UINT64        Alignment;\r
@@ -94,7 +98,7 @@ typedef struct {
   BOOLEAN       Prefetchable;\r
   UINT8         MemType;\r
   UINT8         Offset;\r
-} PCI_BAR;\r
+};\r
 \r
 #define PPB_BAR_0                             0\r
 #define PPB_BAR_1                             1\r
@@ -110,8 +114,6 @@ typedef struct {
 #define P2C_IO_1                              3\r
 #define P2C_IO_2                              4\r
 \r
-#define PCI_IO_DEVICE_SIGNATURE               SIGNATURE_32 ('p', 'c', 'i', 'o')\r
-\r
 #define EFI_BRIDGE_IO32_DECODE_SUPPORTED      0x0001\r
 #define EFI_BRIDGE_PMEM32_DECODE_SUPPORTED    0x0002\r
 #define EFI_BRIDGE_PMEM64_DECODE_SUPPORTED    0x0004\r
@@ -128,7 +130,7 @@ typedef struct {
 #define EFI_SET_SUPPORTS    0\r
 #define EFI_SET_ATTRIBUTES  1\r
 \r
-typedef struct _PCI_IO_DEVICE              PCI_IO_DEVICE;\r
+#define PCI_IO_DEVICE_SIGNATURE               SIGNATURE_32 ('p', 'c', 'i', 'o')\r
 \r
 struct _PCI_IO_DEVICE {\r
   UINT32                                    Signature;\r
@@ -215,7 +217,7 @@ struct _PCI_IO_DEVICE {
   BOOLEAN                                   BusOverride;\r
 \r
   //\r
-  //  A list tracking reserved resource on a bridge device\r
+  // A list tracking reserved resource on a bridge device\r
   //\r
   LIST_ENTRY                                ReservedResourceList;\r
 \r
@@ -231,7 +233,6 @@ struct _PCI_IO_DEVICE {
 \r
 };\r
 \r
-\r
 #define PCI_IO_DEVICE_FROM_PCI_IO_THIS(a) \\r
   CR (a, PCI_IO_DEVICE, PciIo, PCI_IO_DEVICE_SIGNATURE)\r
 \r
@@ -244,39 +245,40 @@ struct _PCI_IO_DEVICE {
 #define PCI_IO_DEVICE_FROM_LOAD_FILE2_THIS(a) \\r
   CR (a, PCI_IO_DEVICE, LoadFile2, PCI_IO_DEVICE_SIGNATURE)\r
 \r
+\r
+\r
 //\r
 // Global Variables\r
 //\r
-extern LIST_ENTRY                                   gPciDevicePool;\r
+extern EFI_INCOMPATIBLE_PCI_DEVICE_SUPPORT_PROTOCOL *gEfiIncompatiblePciDeviceSupport;\r
+extern EFI_DRIVER_BINDING_PROTOCOL                  gPciBusDriverBinding;\r
+extern EFI_COMPONENT_NAME_PROTOCOL                  gPciBusComponentName;\r
+extern EFI_COMPONENT_NAME2_PROTOCOL                 gPciBusComponentName2;\r
 extern BOOLEAN                                      gFullEnumeration;\r
 extern UINTN                                        gPciHostBridgeNumber;\r
 extern EFI_HANDLE                                   gPciHostBrigeHandles[PCI_MAX_HOST_BRIDGE_NUM];\r
 extern UINT64                                       gAllOne;\r
 extern UINT64                                       gAllZero;\r
-\r
 extern EFI_PCI_PLATFORM_PROTOCOL                    *gPciPlatformProtocol;\r
 \r
-#include "PciIo.h"\r
-#include "PciCommand.h"\r
-#include "PciDeviceSupport.h"\r
-#include "PciEnumerator.h"\r
-#include "PciEnumeratorSupport.h"\r
-#include "PciDriverOverride.h"\r
-#include "PciRomTable.h"\r
-#include "PciOptionRomSupport.h"\r
-#include "PciPowerManagement.h"\r
-#include "PciHotPlugSupport.h"\r
-#include "PciLib.h"\r
 \r
-//\r
-// PCI Bus Support Function Prototypes\r
-//\r
+/**  \r
+  Macro that checks whether device is a GFX device.\r
+\r
+  @param  _p      Specified device.\r
+\r
+  @retval TRUE    Device is a a GFX device.\r
+  @retval FALSE   Device is not a a GFX device.\r
+\r
+**/\r
+#define IS_PCI_GFX(_p)     IS_CLASS2 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_OTHER)\r
+\r
 /**\r
   Test to see if this driver supports ControllerHandle. Any ControllerHandle\r
   than contains a gEfiPciRootBridgeIoProtocolGuid protocol can be supported.\r
 \r
   @param  This                Protocol instance pointer.\r
-  @param  ControllerHandle    Handle of device to test.\r
+  @param  Controller          Handle of device to test.\r
   @param  RemainingDevicePath Optional parameter use to pick a specific child.\r
                               device to start.\r
 \r
@@ -298,7 +300,7 @@ PciBusDriverBindingSupported (
   all device under PCI bus.\r
 \r
   @param  This                 Protocol instance pointer.\r
-  @param  ControllerHandle     Handle of device to bind driver to.\r
+  @param  Controller           Handle of device to bind driver to.\r
   @param  RemainingDevicePath  Optional parameter use to pick a specific child.\r
                                device to start.\r
 \r
@@ -320,7 +322,7 @@ PciBusDriverBindingStart (
   created by this driver.\r
 \r
   @param  This              Protocol instance pointer.\r
-  @param  ControllerHandle  Handle of device to stop driver on.\r
+  @param  Controller        Handle of device to stop driver on.\r
   @param  NumberOfChildren  Number of Handles in ChildHandleBuffer. If number of\r
                             children is zero stop the entire bus driver.\r
   @param  ChildHandleBuffer List of Child Handles to Stop.\r
@@ -338,6 +340,4 @@ PciBusDriverBindingStop (
   IN  EFI_HANDLE                    *ChildHandleBuffer\r
   );\r
 \r
-#define IS_PCI_GFX(_p)     IS_CLASS2 (_p, PCI_CLASS_DISPLAY, PCI_CLASS_DISPLAY_OTHER)\r
-\r
 #endif\r
index 6808cfd53c14ff6d7f0a4ffb57fe10af6145fd43..3cdab7e8d65cd3c7a5d5a51784b372f26eb6ab4f 100644 (file)
@@ -3,7 +3,8 @@
 #\r
 #  PCI bus driver. This module will probe all PCI devices and allocate MMIO and IO\r
 #  space for these devices. Please use PCD feature flag PcdPciBusHotplugDeviceSupport to enable\r
-#  support hot plug.\r
+#  hot plug supporting.\r
+#\r
 #  Copyright (c) 2006 - 2009, Intel Corporation\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
   PeCoffLib\r
 \r
 [Protocols]\r
-  gEfiPciHotPlugRequestProtocolGuid             # PROTOCOL ALWAYS_PRODUCED\r
-  gEfiBusSpecificDriverOverrideProtocolGuid     # PROTOCOL BY_START\r
-  gEfiPciIoProtocolGuid                         # PROTOCOL BY_START\r
-  gEfiLoadedImageProtocolGuid                   # PROTOCOL TO_START\r
-  gEfiDecompressProtocolGuid                    # PROTOCOL TO_START\r
-  gEfiPciHotPlugInitProtocolGuid                # PROTOCOL TO_START\r
-  gEfiPciHostBridgeResourceAllocationProtocolGuid # PROTOCOL TO_START\r
-  gEfiPciPlatformProtocolGuid                   # PROTOCOL TO_START\r
-  gEfiPciRootBridgeIoProtocolGuid               # PROTOCOL TO_START\r
-  gEfiDevicePathProtocolGuid                    # PROTOCOL TO_START\r
-  gEfiIncompatiblePciDeviceSupportProtocolGuid  # PROTOCOL TO_START\r
-  gEfiLoadFile2ProtocolGuid                                                      # SOMETIMES_CONSUMED\r
+  gEfiPciHotPlugRequestProtocolGuid               ## BY_START\r
+  gEfiPciIoProtocolGuid                           ## BY_START\r
+  gEfiDevicePathProtocolGuid                      ## BY_START   \r
+  gEfiBusSpecificDriverOverrideProtocolGuid       ## CONSUMED\r
+  gEfiLoadedImageProtocolGuid                     ## CONSUMED\r
+  gEfiDecompressProtocolGuid                      ## CONSUMED\r
+  gEfiPciHotPlugInitProtocolGuid                  ## CONSUMED\r
+  gEfiPciHostBridgeResourceAllocationProtocolGuid ## CONSUMED\r
+  gEfiPciPlatformProtocolGuid                     ## CONSUMED\r
+  gEfiPciRootBridgeIoProtocolGuid                 ## CONSUMED\r
+  gEfiIncompatiblePciDeviceSupportProtocolGuid    ## CONSUMED\r
+  gEfiLoadFile2ProtocolGuid                       ## CONSUMED\r
 \r
 [FeaturePcd.common]\r
   gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPciBusHotplugDeviceSupport\r
index e205fe9dc88cb696d32f9b4dcbb350f18aee7f73..4872e2206e34a87da1af4bf2d7140ab0d4fb317a 100644 (file)
@@ -1,4 +1,5 @@
 /** @file\r
+  Supporting functions implementaion for PCI devices management.\r
 \r
 Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
@@ -11,124 +12,112 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 **/\r
 \r
-\r
 #include "PciBus.h"\r
-#include "PciDeviceSupport.h"\r
 \r
 //\r
 // This device structure is serviced as a header.\r
-// Its Next field points to the first root bridge device node\r
+// Its next field points to the first root bridge device node.\r
 //\r
-LIST_ENTRY  gPciDevicePool;\r
+LIST_ENTRY  mPciDevicePool;\r
 \r
 /**\r
-  Initialize the gPciDevicePool.\r
+  Initialize the PCI devices pool.\r
+\r
 **/\r
-EFI_STATUS\r
+VOID\r
 InitializePciDevicePool (\r
   VOID\r
   )\r
 {\r
-  InitializeListHead (&gPciDevicePool);\r
-\r
-  return EFI_SUCCESS;\r
+  InitializeListHead (&mPciDevicePool);\r
 }\r
 \r
 /**\r
-  Insert a root bridge into PCI device pool\r
+  Insert a root bridge into PCI device pool.\r
 \r
-  @param RootBridge    - A pointer to the PCI_IO_DEVICE.\r
+  @param RootBridge     A pointer to the PCI_IO_DEVICE.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 InsertRootBridge (\r
-  PCI_IO_DEVICE *RootBridge\r
+  IN PCI_IO_DEVICE      *RootBridge\r
   )\r
 {\r
-\r
-  InsertTailList (&gPciDevicePool, &(RootBridge->Link));\r
-\r
-  return EFI_SUCCESS;\r
+  InsertTailList (&mPciDevicePool, &(RootBridge->Link));\r
 }\r
 \r
 /**\r
   This function is used to insert a PCI device node under\r
-  a bridge\r
+  a bridge.\r
 \r
-  @param Bridge         A pointer to the PCI_IO_DEVICE.\r
-  @param PciDeviceNode  A pointer to the PCI_IO_DEVICE.\r
+  @param Bridge         The PCI bridge.\r
+  @param PciDeviceNode  The PCI device needs inserting.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 InsertPciDevice (\r
-  PCI_IO_DEVICE *Bridge,\r
-  PCI_IO_DEVICE *PciDeviceNode\r
+  IN PCI_IO_DEVICE      *Bridge,\r
+  IN PCI_IO_DEVICE      *PciDeviceNode\r
   )\r
 {\r
-\r
   InsertTailList (&Bridge->ChildList, &(PciDeviceNode->Link));\r
   PciDeviceNode->Parent = Bridge;\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   Destroy root bridge and remove it from deivce tree.\r
   \r
-  @param RootBridge   The bridge want to be removed.\r
+  @param RootBridge     The bridge want to be removed.\r
   \r
 **/\r
-EFI_STATUS\r
+VOID\r
 DestroyRootBridge (\r
-  IN PCI_IO_DEVICE *RootBridge\r
+  IN PCI_IO_DEVICE      *RootBridge\r
   )\r
 {\r
   DestroyPciDeviceTree (RootBridge);\r
 \r
   FreePciDevice (RootBridge);\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   Destroy a pci device node.\r
-  Also all direct or indirect allocated resource for this node will be freed.\r
 \r
-  @param PciIoDevice  A pointer to the PCI_IO_DEVICE.\r
+  All direct or indirect allocated resource for this node will be freed.\r
+\r
+  @param PciIoDevice  A pointer to the PCI_IO_DEVICE to be destoried.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 FreePciDevice (\r
-  IN PCI_IO_DEVICE *PciIoDevice\r
+  IN PCI_IO_DEVICE    *PciIoDevice\r
   )\r
 {\r
-\r
+  ASSERT (PciIoDevice != NULL);\r
   //\r
   // Assume all children have been removed underneath this device\r
   //\r
   if (PciIoDevice->ResourcePaddingDescriptors != NULL) {\r
-    gBS->FreePool (PciIoDevice->ResourcePaddingDescriptors);\r
+    FreePool (PciIoDevice->ResourcePaddingDescriptors);\r
   }\r
 \r
   if (PciIoDevice->DevicePath != NULL) {\r
-    gBS->FreePool (PciIoDevice->DevicePath);\r
+    FreePool (PciIoDevice->DevicePath);\r
   }\r
 \r
-  gBS->FreePool (PciIoDevice);\r
-\r
-  return EFI_SUCCESS;\r
+  FreePool (PciIoDevice);\r
 }\r
 \r
 /**\r
   Destroy all the pci device node under the bridge.\r
   Bridge itself is not included.\r
 \r
-  @param Bridge   A pointer to the PCI_IO_DEVICE.\r
+  @param Bridge      A pointer to the PCI_IO_DEVICE.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 DestroyPciDeviceTree (\r
-  IN PCI_IO_DEVICE *Bridge\r
+  IN PCI_IO_DEVICE      *Bridge\r
   )\r
 {\r
   LIST_ENTRY      *CurrentLink;\r
@@ -151,30 +140,33 @@ DestroyPciDeviceTree (
 \r
     FreePciDevice (Temp);\r
   }\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
   Destroy all device nodes under the root bridge\r
   specified by Controller.\r
+\r
   The root bridge itself is also included.\r
 \r
-  @param Controller   An efi handle.\r
+  @param  Controller    Root bridge handle.\r
+\r
+  @retval EFI_SUCCESS   Destory all devcie nodes successfully.\r
+  @retval EFI_NOT_FOUND Cannot find any PCI device under specified\r
+                        root bridge.\r
 \r
 **/\r
 EFI_STATUS\r
 DestroyRootBridgeByHandle (\r
-  EFI_HANDLE Controller\r
+  IN EFI_HANDLE        Controller\r
   )\r
 {\r
 \r
   LIST_ENTRY      *CurrentLink;\r
   PCI_IO_DEVICE   *Temp;\r
 \r
-  CurrentLink = gPciDevicePool.ForwardLink;\r
+  CurrentLink = mPciDevicePool.ForwardLink;\r
 \r
-  while (CurrentLink != NULL && CurrentLink != &gPciDevicePool) {\r
+  while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {\r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
 \r
     if (Temp->Handle == Controller) {\r
@@ -195,23 +187,25 @@ DestroyRootBridgeByHandle (
 }\r
 \r
 /**\r
-  This function registers the PCI IO device. It creates a handle for this PCI IO device\r
-  (if the handle does not exist), attaches appropriate protocols onto the handle, does\r
-  necessary initialization, and sets up parent/child relationship with its bus controller.\r
+  This function registers the PCI IO device. \r
 \r
-  @param Controller    - An EFI handle for the PCI bus controller.\r
-  @param PciIoDevice   - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
-  @param Handle        - A pointer to hold the EFI handle for the PCI IO device.\r
+  It creates a handle for this PCI IO device (if the handle does not exist), attaches \r
+  appropriate protocols onto the handle, does necessary initialization, and sets up \r
+  parent/child relationship with its bus controller.\r
 \r
-  @retval EFI_SUCCESS   - The PCI device is successfully registered.\r
-  @retval Others        - An error occurred when registering the PCI device.\r
+  @param Controller     An EFI handle for the PCI bus controller.\r
+  @param PciIoDevice    A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
+  @param Handle         A pointer to hold the returned EFI handle for the PCI IO device.\r
+\r
+  @retval EFI_SUCCESS   The PCI device is successfully registered.\r
+  @retval Others        An error occurred when registering the PCI device.\r
 \r
 **/\r
 EFI_STATUS\r
 RegisterPciDevice (\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  PCI_IO_DEVICE                  *PciIoDevice,\r
-  OUT EFI_HANDLE                     *Handle OPTIONAL\r
+  IN  EFI_HANDLE          Controller,\r
+  IN  PCI_IO_DEVICE       *PciIoDevice,\r
+  OUT EFI_HANDLE          *Handle      OPTIONAL\r
   )\r
 {\r
   EFI_STATUS          Status;\r
@@ -391,21 +385,19 @@ RegisterPciDevice (
 }\r
 \r
 /**\r
-  This function is used to remove the whole PCI devices from the bridge.\r
+  This function is used to remove the whole PCI devices on the specified bridge from\r
+  the root bridge.\r
 \r
-  @param RootBridgeHandle   An efi handle.\r
-  @param Bridge             A pointer to the PCI_IO_DEVICE.\r
+  @param RootBridgeHandle   The root bridge device handle.\r
+  @param Bridge             The bridge device to be removed.\r
 \r
-  @retval EFI_SUCCESS\r
 **/\r
-EFI_STATUS\r
+VOID\r
 RemoveAllPciDeviceOnBridge (\r
   EFI_HANDLE               RootBridgeHandle,\r
   PCI_IO_DEVICE            *Bridge\r
   )\r
-\r
 {\r
-\r
   LIST_ENTRY      *CurrentLink;\r
   PCI_IO_DEVICE   *Temp;\r
 \r
@@ -433,20 +425,20 @@ RemoveAllPciDeviceOnBridge (
 \r
     FreePciDevice (Temp);\r
   }\r
-\r
-  return EFI_SUCCESS;\r
 }\r
 \r
 /**\r
+  This function is used to de-register the PCI IO device.\r
 \r
-  This function is used to de-register the PCI device from the EFI,\r
   That includes un-installing PciIo protocol from the specified PCI\r
   device handle.\r
 \r
-  @param Controller   - controller handle\r
-  @param Handle       - device handle\r
+  @param Controller    An EFI handle for the PCI bus controller.\r
+  @param Handle        PCI device handle.\r
+\r
+  @retval EFI_SUCCESS  The PCI device is successfully de-registered.\r
+  @retval Others       An error occurred when de-registering the PCI device.\r
 \r
-  @return Status of de-register pci device\r
 **/\r
 EFI_STATUS\r
 DeRegisterPciDevice (\r
@@ -595,13 +587,13 @@ DeRegisterPciDevice (
 /**\r
   Start to manage the PCI device on specified the root bridge or PCI-PCI Bridge\r
 \r
-  @param Controller          An efi handle.\r
+  @param Controller          The root bridge handle.\r
   @param RootBridge          A pointer to the PCI_IO_DEVICE.\r
   @param RemainingDevicePath A pointer to the EFI_DEVICE_PATH_PROTOCOL.\r
   @param NumberOfChildren    Children number.\r
   @param ChildHandleBuffer   A pointer to the child handle buffer.\r
 \r
-  @retval EFI_NOT_READY   Device is not allocated\r
+  @retval EFI_NOT_READY   Device is not allocated.\r
   @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r
   @retval EFI_NOT_FOUND   Can not find the specific device\r
   @retval EFI_SUCCESS     Success to start Pci device on bridge\r
@@ -713,7 +705,6 @@ StartPciDevicesOnBridge (
       // If remaining device path is NULL,\r
       // try to enable all the pci devices under this bridge\r
       //\r
-\r
       if (!PciIoDevice->Registered && PciIoDevice->Allocated) {\r
         Status = RegisterPciDevice (\r
                    Controller,\r
@@ -764,7 +755,7 @@ StartPciDevicesOnBridge (
   Start to manage all the PCI devices it found previously under \r
   the entire host bridge.\r
 \r
-  @param Controller          - root bridge handle.\r
+  @param Controller          The root bridge handle.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -781,9 +772,9 @@ StartPciDevices (
   ASSERT (RootBridge != NULL);\r
   ThisHostBridge = RootBridge->PciRootBridgeIo->ParentHandle;\r
 \r
-  CurrentLink = gPciDevicePool.ForwardLink;\r
+  CurrentLink = mPciDevicePool.ForwardLink;\r
 \r
-  while (CurrentLink != NULL && CurrentLink != &gPciDevicePool) {\r
+  while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {\r
 \r
     RootBridge = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     //\r
@@ -806,35 +797,29 @@ StartPciDevices (
 }\r
 \r
 /**\r
-  Create root bridge device\r
+  Create root bridge device.\r
 \r
-  @param RootBridgeHandle   - Parent bridge handle.\r
+  @param RootBridgeHandle    Specified root bridge hanle.\r
+\r
+  @return The crated root bridge device instance, NULL means no\r
+          root bridge device instance created.\r
 \r
-  @return pointer to new root bridge \r
 **/\r
 PCI_IO_DEVICE *\r
 CreateRootBridge (\r
-  IN EFI_HANDLE RootBridgeHandle\r
+  IN EFI_HANDLE                   RootBridgeHandle\r
   )\r
 {\r
-\r
   EFI_STATUS                      Status;\r
   PCI_IO_DEVICE                   *Dev;\r
   EFI_DEVICE_PATH_PROTOCOL        *ParentDevicePath;\r
   EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL *PciRootBridgeIo;\r
 \r
-  Dev = NULL;\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (PCI_IO_DEVICE),\r
-                  (VOID **) &Dev\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
+  Dev = AllocateZeroPool (sizeof (PCI_IO_DEVICE));\r
+  if (Dev == NULL) {\r
     return NULL;\r
   }\r
 \r
-  ZeroMem (Dev, sizeof (PCI_IO_DEVICE));\r
   Dev->Signature  = PCI_IO_DEVICE_SIGNATURE;\r
   Dev->Handle     = RootBridgeHandle;\r
   InitializeListHead (&Dev->ChildList);\r
@@ -849,7 +834,7 @@ CreateRootBridge (
                   );\r
 \r
   if (EFI_ERROR (Status)) {\r
-    gBS->FreePool (Dev);\r
+    FreePool (Dev);\r
     return NULL;\r
   }\r
 \r
@@ -895,11 +880,13 @@ CreateRootBridge (
 }\r
 \r
 /**\r
-  Get root bridge device instance by specific handle.\r
+  Get root bridge device instance by specific root bridge handle.\r
 \r
   @param RootBridgeHandle    Given root bridge handle.\r
 \r
-  @return root bridge device instance.\r
+  @return The root bridge device instance, NULL means no root bridge\r
+          device instance found.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 GetRootBridgeByHandle (\r
@@ -909,9 +896,9 @@ GetRootBridgeByHandle (
   PCI_IO_DEVICE   *RootBridgeDev;\r
   LIST_ENTRY      *CurrentLink;\r
 \r
-  CurrentLink = gPciDevicePool.ForwardLink;\r
+  CurrentLink = mPciDevicePool.ForwardLink;\r
 \r
-  while (CurrentLink != NULL && CurrentLink != &gPciDevicePool) {\r
+  while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {\r
 \r
     RootBridgeDev = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
     if (RootBridgeDev->Handle == RootBridgeHandle) {\r
@@ -930,7 +917,9 @@ GetRootBridgeByHandle (
   @param Bridge       Parent bridege instance.\r
   @param PciIoDevice  Device instance.\r
   \r
-  @return whether Pci device existed.\r
+  @retval TRUE        Pci device existed.\r
+  @retval FALSE       Pci device did not exist.\r
+\r
 **/\r
 BOOLEAN\r
 PciDeviceExisted (\r
@@ -965,11 +954,12 @@ PciDeviceExisted (
 }\r
 \r
 /**\r
-  Active VGA device.\r
+  Get the active VGA device on the same segment.\r
   \r
-  @param VgaDevice device instance for VGA.\r
+  @param VgaDevice    PCI IO instance for the VGA device.\r
   \r
-  @return device instance.\r
+  @return The active VGA device on the same segment.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 ActiveVGADeviceOnTheSameSegment (\r
@@ -979,9 +969,9 @@ ActiveVGADeviceOnTheSameSegment (
   LIST_ENTRY      *CurrentLink;\r
   PCI_IO_DEVICE   *Temp;\r
 \r
-  CurrentLink = gPciDevicePool.ForwardLink;\r
+  CurrentLink = mPciDevicePool.ForwardLink;\r
 \r
-  while (CurrentLink != NULL && CurrentLink != &gPciDevicePool) {\r
+  while (CurrentLink != NULL && CurrentLink != &mPciDevicePool) {\r
 \r
     Temp = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
 \r
@@ -1001,11 +991,12 @@ ActiveVGADeviceOnTheSameSegment (
 }\r
 \r
 /**\r
-  Active VGA device on root bridge.\r
+  Get the active VGA device on the root bridge.\r
   \r
-  @param RootBridge  Root bridge device instance.\r
+  @param RootBridge  PCI IO instance for the root bridge.\r
   \r
-  @return VGA device instance.\r
+  @return The active VGA device.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 ActiveVGADeviceOnTheRootBridge (\r
@@ -1044,92 +1035,17 @@ ActiveVGADeviceOnTheRootBridge (
   return NULL;\r
 }\r
 \r
-/**\r
-  Get HPC PCI address according to its device path.\r
-  @param PciRootBridgeIo   Root bridege Io instance.\r
-  @param HpcDevicePath     Given searching device path.\r
-  @param PciAddress        Buffer holding searched result.\r
-  \r
-  @retval EFI_NOT_FOUND Can not find the specific device path.\r
-  @retval EFI_SUCCESS   Success to get the device path.\r
-**/\r
-EFI_STATUS\r
-GetHpcPciAddress (\r
-  IN  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRootBridgeIo,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL         *HpcDevicePath,\r
-  OUT UINT64                           *PciAddress\r
-  )\r
-{\r
-  EFI_DEVICE_PATH_PROTOCOL  *CurrentDevicePath;\r
-  EFI_DEV_PATH_PTR          Node;\r
-  LIST_ENTRY                *CurrentLink;\r
-  PCI_IO_DEVICE             *RootBridge;\r
-  EFI_STATUS                Status;\r
-\r
-  CurrentDevicePath = HpcDevicePath;\r
-\r
-  //\r
-  // Get the remaining device path for this PCI device, if it is a PCI device\r
-  //\r
-  while (!IsDevicePathEnd (CurrentDevicePath)) {\r
-\r
-    Node.DevPath = CurrentDevicePath;\r
-\r
-    //\r
-    // Check if it is PCI device Path?\r
-    //\r
-    if ((Node.DevPath->Type != HARDWARE_DEVICE_PATH) ||\r
-        ((Node.DevPath->SubType != HW_PCI_DP)         &&\r
-         (DevicePathNodeLength (Node.DevPath) != sizeof (PCI_DEVICE_PATH)))) {\r
-      CurrentDevicePath = NextDevicePathNode (CurrentDevicePath);\r
-      continue;\r
-    }\r
-\r
-    break;\r
-  }\r
-\r
-  //\r
-  // Check if it is not PCI device path\r
-  //\r
-  if (IsDevicePathEnd (CurrentDevicePath)) {\r
-    return EFI_NOT_FOUND;\r
-  }\r
-\r
-  CurrentLink = gPciDevicePool.ForwardLink;\r
-\r
-  while (CurrentLink != NULL && CurrentLink != &gPciDevicePool) {\r
-\r
-    RootBridge = PCI_IO_DEVICE_FROM_LINK (CurrentLink);\r
-    //\r
-    // Locate the right root bridge to start\r
-    //\r
-    if (RootBridge->PciRootBridgeIo == PciRootBridgeIo) {\r
-      Status = GetHpcPciAddressFromRootBridge (\r
-                RootBridge,\r
-                CurrentDevicePath,\r
-                PciAddress\r
-                );\r
-      if (EFI_ERROR (Status)) {\r
-        return EFI_NOT_FOUND;\r
-      }\r
-\r
-      return EFI_SUCCESS;\r
-\r
-    }\r
-\r
-    CurrentLink = CurrentLink->ForwardLink;\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
 \r
 /**\r
   Get HPC PCI address according to its device path.\r
+\r
   @param RootBridge           Root bridege Io instance.\r
   @param RemainingDevicePath  Given searching device path.\r
   @param PciAddress           Buffer holding searched result.\r
   \r
-  @retval EFI_NOT_FOUND Can not find the specific device path.\r
+  @retval EFI_SUCCESS         PCI address was stored in PciAddress\r
+  @retval EFI_NOT_FOUND       Can not find the specific device path.\r
+  \r
 **/\r
 EFI_STATUS\r
 GetHpcPciAddressFromRootBridge (\r
index af162dc198c3423323545af182abb70c03a0b4ae..afe1edddc62641c88097f6340b658b09e146e93b 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+  Supporting functions declaration for PCI devices management.\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -15,118 +16,128 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #define _EFI_PCI_DEVICE_SUPPORT_H_\r
 \r
 /**\r
-  Initialize the gPciDevicePool.\r
+  Initialize the PCI devices pool.\r
+\r
 **/\r
-EFI_STATUS\r
+VOID\r
 InitializePciDevicePool (\r
   VOID\r
   );\r
 \r
 /**\r
-  Insert a root bridge into PCI device pool\r
+  Insert a root bridge into PCI device pool.\r
 \r
-  @param RootBridge    - A pointer to the PCI_IO_DEVICE.\r
+  @param RootBridge     A pointer to the PCI_IO_DEVICE.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 InsertRootBridge (\r
-  PCI_IO_DEVICE *RootBridge\r
+  IN PCI_IO_DEVICE      *RootBridge\r
   );\r
 \r
 /**\r
   This function is used to insert a PCI device node under\r
-  a bridge\r
+  a bridge.\r
 \r
-  @param Bridge         A pointer to the PCI_IO_DEVICE.\r
-  @param PciDeviceNode  A pointer to the PCI_IO_DEVICE.\r
+  @param Bridge         The PCI bridge.\r
+  @param PciDeviceNode  The PCI device needs inserting.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 InsertPciDevice (\r
-  PCI_IO_DEVICE *Bridge,\r
-  PCI_IO_DEVICE *PciDeviceNode\r
+  IN PCI_IO_DEVICE      *Bridge,\r
+  IN PCI_IO_DEVICE      *PciDeviceNode\r
   );\r
 \r
 /**\r
   Destroy root bridge and remove it from deivce tree.\r
   \r
-  @param RootBridge   The bridge want to be removed\r
+  @param RootBridge     The bridge want to be removed.\r
   \r
 **/\r
-EFI_STATUS\r
+VOID\r
 DestroyRootBridge (\r
-  IN PCI_IO_DEVICE *RootBridge\r
+  IN PCI_IO_DEVICE      *RootBridge\r
   );\r
 \r
 /**\r
   Destroy all the pci device node under the bridge.\r
   Bridge itself is not included.\r
 \r
-  @param Bridge   A pointer to the PCI_IO_DEVICE.\r
+  @param Bridge         A pointer to the PCI_IO_DEVICE.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 DestroyPciDeviceTree (\r
-  IN PCI_IO_DEVICE *Bridge\r
+  IN PCI_IO_DEVICE      *Bridge\r
   );\r
 \r
 /**\r
   Destroy all device nodes under the root bridge\r
   specified by Controller.\r
+\r
   The root bridge itself is also included.\r
 \r
-  @param Controller   An efi handle.\r
+  @param  Controller    Root bridge handle.\r
+\r
+  @retval EFI_SUCCESS   Destory all devcie nodes successfully.\r
+  @retval EFI_NOT_FOUND Cannot find any PCI device under specified\r
+                        root bridge.\r
 \r
 **/\r
 EFI_STATUS\r
 DestroyRootBridgeByHandle (\r
-  EFI_HANDLE Controller\r
+  IN EFI_HANDLE        Controller\r
   );\r
 \r
 /**\r
-  This function registers the PCI IO device. It creates a handle for this PCI IO device\r
-  (if the handle does not exist), attaches appropriate protocols onto the handle, does\r
-  necessary initialization, and sets up parent/child relationship with its bus controller.\r
+  This function registers the PCI IO device. \r
 \r
-  @param Controller    - An EFI handle for the PCI bus controller.\r
-  @param PciIoDevice   - A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
-  @param Handle        - A pointer to hold the EFI handle for the PCI IO device.\r
+  It creates a handle for this PCI IO device (if the handle does not exist), attaches \r
+  appropriate protocols onto the handle, does necessary initialization, and sets up \r
+  parent/child relationship with its bus controller.\r
 \r
-  @retval EFI_SUCCESS   - The PCI device is successfully registered.\r
-  @retval Others        - An error occurred when registering the PCI device.\r
+  @param Controller     An EFI handle for the PCI bus controller.\r
+  @param PciIoDevice    A PCI_IO_DEVICE pointer to the PCI IO device to be registered.\r
+  @param Handle         A pointer to hold the returned EFI handle for the PCI IO device.\r
+\r
+  @retval EFI_SUCCESS   The PCI device is successfully registered.\r
+  @retval Others        An error occurred when registering the PCI device.\r
 \r
 **/\r
 EFI_STATUS\r
 RegisterPciDevice (\r
-  IN  EFI_HANDLE                     Controller,\r
-  IN  PCI_IO_DEVICE                  *PciIoDevice,\r
-  OUT EFI_HANDLE                     *Handle OPTIONAL\r
+  IN  EFI_HANDLE          Controller,\r
+  IN  PCI_IO_DEVICE       *PciIoDevice,\r
+  OUT EFI_HANDLE          *Handle      OPTIONAL\r
   );\r
 \r
 /**\r
-  This function is used to remove the whole PCI devices from the bridge.\r
+  This function is used to remove the whole PCI devices on the specified bridge from\r
+  the root bridge.\r
 \r
-  @param RootBridgeHandle   An efi handle.\r
-  @param Bridge             A pointer to the PCI_IO_DEVICE.\r
+  @param RootBridgeHandle   The root bridge device handle.\r
+  @param Bridge             The bridge device to be removed.\r
 \r
-  @retval EFI_SUCCESS\r
 **/\r
-EFI_STATUS\r
+VOID\r
 RemoveAllPciDeviceOnBridge (\r
   EFI_HANDLE               RootBridgeHandle,\r
   PCI_IO_DEVICE            *Bridge\r
   );\r
 \r
 /**\r
+  This function is used to de-register the PCI IO device.\r
 \r
-  This function is used to de-register the PCI device from the EFI,\r
   That includes un-installing PciIo protocol from the specified PCI\r
   device handle.\r
 \r
-  @param Controller   - controller handle\r
-  @param Handle       - device handle\r
+  @param Controller    An EFI handle for the PCI bus controller.\r
+  @param Handle        PCI device handle.\r
+\r
+  @retval EFI_SUCCESS  The PCI device is successfully de-registered.\r
+  @retval Others       An error occurred when de-registering the PCI device.\r
 \r
-  @return Status of de-register pci device\r
 **/\r
 EFI_STATUS\r
 DeRegisterPciDevice (\r
@@ -143,7 +154,7 @@ DeRegisterPciDevice (
   @param NumberOfChildren    Children number.\r
   @param ChildHandleBuffer   A pointer to the child handle buffer.\r
 \r
-  @retval EFI_NOT_READY   Device is not allocated\r
+  @retval EFI_NOT_READY   Device is not allocated.\r
   @retval EFI_UNSUPPORTED Device only support PCI-PCI bridge.\r
   @retval EFI_NOT_FOUND   Can not find the specific device\r
   @retval EFI_SUCCESS     Success to start Pci device on bridge\r
@@ -171,48 +182,43 @@ StartPciDevices (
   );\r
 \r
 /**\r
-  Create root bridge device\r
+  Create root bridge device.\r
+\r
+  @param RootBridgeHandle    Specified root bridge hanle.\r
 \r
-  @param RootBridgeHandle   - Parent bridge handle.\r
+  @return The crated root bridge device instance, NULL means no\r
+          root bridge device instance created.\r
 \r
-  @return pointer to new root bridge \r
 **/\r
 PCI_IO_DEVICE *\r
 CreateRootBridge (\r
-  IN EFI_HANDLE RootBridgeHandle\r
+  IN EFI_HANDLE                   RootBridgeHandle\r
   );\r
 \r
 /**\r
-  Get root bridge device instance by specific handle.\r
+  Get root bridge device instance by specific root bridge handle.\r
 \r
   @param RootBridgeHandle    Given root bridge handle.\r
 \r
-  @return root bridge device instance.\r
+  @return The root bridge device instance, NULL means no root bridge\r
+          device instance found.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 GetRootBridgeByHandle (\r
   EFI_HANDLE RootBridgeHandle\r
   );\r
 \r
-/**\r
-  Check root bridge device is existed or not.\r
-\r
-  @param RootBridgeHandle    Given root bridge handle.\r
-\r
-  @return root bridge device is existed or not.\r
-**/\r
-BOOLEAN\r
-RootBridgeExisted (\r
-  IN EFI_HANDLE RootBridgeHandle\r
-  );\r
 \r
 /**\r
   Judege whether Pci device existed.\r
   \r
-  @param Bridge       Parent bridege instance. \r
+  @param Bridge       Parent bridege instance.\r
   @param PciIoDevice  Device instance.\r
   \r
-  @return whether Pci device existed.\r
+  @retval TRUE        Pci device existed.\r
+  @retval FALSE       Pci device did not exist.\r
+\r
 **/\r
 BOOLEAN\r
 PciDeviceExisted (\r
@@ -221,11 +227,12 @@ PciDeviceExisted (
   );\r
 \r
 /**\r
-  Active VGA device.\r
+  Get the active VGA device on the same segment.\r
   \r
-  @param VgaDevice device instance for VGA.\r
+  @param VgaDevice    PCI IO instance for the VGA device.\r
   \r
-  @return device instance.\r
+  @return The active VGA device on the same segment.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 ActiveVGADeviceOnTheSameSegment (\r
@@ -233,11 +240,12 @@ ActiveVGADeviceOnTheSameSegment (
   );\r
 \r
 /**\r
-  Active VGA device on root bridge.\r
+  Get the active VGA device on the root bridge.\r
   \r
-  @param RootBridge  Root bridge device instance.\r
+  @param RootBridge  PCI IO instance for the root bridge.\r
   \r
-  @return VGA device instance.\r
+  @return The active VGA device.\r
+\r
 **/\r
 PCI_IO_DEVICE *\r
 ActiveVGADeviceOnTheRootBridge (\r
@@ -246,27 +254,14 @@ ActiveVGADeviceOnTheRootBridge (
 \r
 /**\r
   Get HPC PCI address according to its device path.\r
-  @param PciRootBridgeIo   Root bridege Io instance.\r
-  @param HpcDevicePath     Given searching device path.\r
-  @param PciAddress        Buffer holding searched result.\r
-  \r
-  @retval EFI_NOT_FOUND Can not find the specific device path.\r
-  @retval EFI_SUCCESS   Success to get the device path.\r
-**/\r
-EFI_STATUS\r
-GetHpcPciAddress (\r
-  IN  EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL  *PciRootBridgeIo,\r
-  IN  EFI_DEVICE_PATH_PROTOCOL         *HpcDevicePath,\r
-  OUT UINT64                           *PciAddress\r
-  );\r
 \r
-/**\r
-  Get HPC PCI address according to its device path.\r
   @param RootBridge           Root bridege Io instance.\r
   @param RemainingDevicePath  Given searching device path.\r
   @param PciAddress           Buffer holding searched result.\r
   \r
-  @retval EFI_NOT_FOUND Can not find the specific device path.\r
+  @retval EFI_SUCCESS         PCI address was stored in PciAddress.\r
+  @retval EFI_NOT_FOUND       Can not find the specific device path.\r
+  \r
 **/\r
 EFI_STATUS\r
 GetHpcPciAddressFromRootBridge (\r
@@ -277,14 +272,15 @@ GetHpcPciAddressFromRootBridge (
 \r
 /**\r
   Destroy a pci device node.\r
-  Also all direct or indirect allocated resource for this node will be freed.\r
 \r
-  @param PciIoDevice  A pointer to the PCI_IO_DEVICE.\r
+  All direct or indirect allocated resource for this node will be freed.\r
+\r
+  @param PciIoDevice  A pointer to the PCI_IO_DEVICE to be destoried.\r
 \r
 **/\r
-EFI_STATUS\r
+VOID\r
 FreePciDevice (\r
-  IN PCI_IO_DEVICE *PciIoDevice\r
+  IN PCI_IO_DEVICE    *PciIoDevice\r
   );\r
 \r
 #endif\r
index b14a018994f0a943be36ee4564305151ed91accd..0939244c107637b47ec3d66cdaca56727ad74672 100644 (file)
@@ -223,7 +223,7 @@ PciRootBridgeEnumerator (
                           Configuration\r
                           );\r
   \r
-  gBS->FreePool (Configuration);\r
+  FreePool (Configuration);\r
   \r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
@@ -683,9 +683,9 @@ RejectPciDevice (
   //\r
   // Remove the padding resource from a bridge\r
   //\r
-  if ( IS_PCI_BRIDGE(&PciDevice->Pci) && \\r
+  if ( IS_PCI_BRIDGE(&PciDevice->Pci) && \r
        PciDevice->ResourcePaddingDescriptors != NULL ) {\r
-    gBS->FreePool (PciDevice->ResourcePaddingDescriptors);\r
+    FreePool (PciDevice->ResourcePaddingDescriptors);\r
     PciDevice->ResourcePaddingDescriptors = NULL;\r
     return EFI_SUCCESS;\r
   }\r
@@ -1950,7 +1950,7 @@ PciHotPlugRequestNotify (
               ChildHandleBuffer\r
               );\r
 \r
-    return EFI_SUCCESS;\r
+    return Status;\r
   }\r
 \r
   if (Operation == EfiPciHotplugRequestRemove) {\r
@@ -1959,8 +1959,8 @@ PciHotPlugRequestNotify (
       //\r
       // Remove all devices on the bridge\r
       //\r
-      Status = RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);\r
-      return Status;\r
+      RemoveAllPciDeviceOnBridge (RootBridgeHandle, Bridge);\r
+      return EFI_SUCCESS;\r
 \r
     }\r
 \r
index 08c785a23be8893ed11b18e0e308a7ac66889dc6..ea848d4f8359a16be6f20f7045da1be9ffb933de 100644 (file)
@@ -1224,7 +1224,9 @@ UpdatePciInfo (
     Ptr++;\r
   }\r
 \r
-  gBS->FreePool (Configuration);\r
+  if (Configuration != NULL) {\r
+    FreePool (Configuration);\r
+  }\r
   return Status;\r
 \r
 }\r
@@ -1618,24 +1620,13 @@ CreatePciIoDevice (
   UINT8                               Func\r
   )\r
 {\r
-\r
-  EFI_STATUS    Status;\r
   PCI_IO_DEVICE *PciIoDevice;\r
 \r
-  PciIoDevice = NULL;\r
-\r
-  Status = gBS->AllocatePool (\r
-                  EfiBootServicesData,\r
-                  sizeof (PCI_IO_DEVICE),\r
-                  (VOID **) &PciIoDevice\r
-                  );\r
-\r
-  if (EFI_ERROR (Status)) {\r
+  PciIoDevice = AllocateZeroPool (sizeof (PCI_IO_DEVICE));\r
+  if (PciIoDevice == NULL) {\r
     return NULL;\r
   }\r
 \r
-  ZeroMem (PciIoDevice, sizeof (PCI_IO_DEVICE));\r
-\r
   PciIoDevice->Signature        = PCI_IO_DEVICE_SIGNATURE;\r
   PciIoDevice->Handle           = NULL;\r
   PciIoDevice->PciRootBridgeIo  = PciRootBridgeIo;\r
@@ -1644,6 +1635,7 @@ CreatePciIoDevice (
   PciIoDevice->DeviceNumber     = Device;\r
   PciIoDevice->FunctionNumber   = Func;\r
   PciIoDevice->Decodes          = 0;\r
+\r
   if (gFullEnumeration) {\r
     PciIoDevice->Allocated = FALSE;\r
   } else {\r
@@ -1663,7 +1655,6 @@ CreatePciIoDevice (
   //\r
   // Initialize the PCI I/O instance structure\r
   //\r
-\r
   InitializePciIoInstance (PciIoDevice);\r
   InitializePciDriverOverrideInstance (PciIoDevice);\r
   InitializePciLoadFile2 (PciIoDevice);\r
index f2cc373b986cf5492452704fb25eb20ec83a27a4..3cf7318faab71042364b4191f95e4bf61e23cd88 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  Implement all interfaces for EFI_PCI_IO_PROTOCOL.\r
+  Implements all interfaces for EFI_PCI_IO_PROTOCOL.\r
   \r
 Copyright (c) 2006 - 2008, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
@@ -15,14 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "PciBus.h"\r
 \r
-//\r
-// Internal use only\r
-//\r
-\r
 //\r
 // Pci Io Protocol Interface\r
 //\r
-EFI_PCI_IO_PROTOCOL  PciIoInterface = {\r
+EFI_PCI_IO_PROTOCOL  mPciIoInterface = {\r
   PciIoPollMem,\r
   PciIoPollIo,\r
   {\r
@@ -56,6 +52,7 @@ EFI_PCI_IO_PROTOCOL  PciIoInterface = {
   \r
   @param PciIoDevice Pci device instance.\r
   @param Code        status code.\r
+\r
 **/\r
 EFI_STATUS\r
 ReportErrorStatusCode (\r
@@ -98,7 +95,7 @@ InitializePciIoInstance (
   PCI_IO_DEVICE  *PciIoDevice\r
   )\r
 {\r
-  CopyMem (&PciIoDevice->PciIo, &PciIoInterface, sizeof (EFI_PCI_IO_PROTOCOL));\r
+  CopyMem (&PciIoDevice->PciIo, &mPciIoInterface, sizeof (EFI_PCI_IO_PROTOCOL));\r
 }\r
 \r
 /**\r
index 43612d7e1c7b0543435ccd88a2ee337a7295ce91..6143675b78ce39f90c515764144b63f9ffd76331 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
+  Header file of EFI PCI IO protocol.\r
 \r
-Copyright (c) 2006, Intel Corporation                                                         \r
+Copyright (c) 2006 - 2009, Intel Corporation                                                         \r
 All rights reserved. This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
index 486e318fca070644bf1ab6b09f1f589dc22d5835..de9ecefa7b4eefca9ce27c2324c6575718d9b19d 100644 (file)
@@ -17,33 +17,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "PciBus.h"\r
 \r
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PCI_HOTPLUG_REQUEST_PROTOCOL gPciHotPlugRequest = {\r
-  PciHotPlugRequestNotify\r
-};\r
-\r
-/**\r
-  Install protocol gEfiPciHotPlugRequestProtocolGuid\r
-  @param Status    return status of protocol installation.\r
-**/\r
-VOID\r
-InstallHotPlugRequestProtocol (\r
-  IN EFI_STATUS *Status\r
-  )\r
-{\r
-  EFI_HANDLE  Handle;\r
-\r
-  if (!FeaturePcdGet (PcdPciBusHotplugDeviceSupport)) {\r
-    return;\r
-  }\r
-\r
-  Handle = NULL;\r
-  *Status = gBS->InstallProtocolInterface (\r
-                  &Handle,\r
-                  &gEfiPciHotPlugRequestProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &gPciHotPlugRequest\r
-                  );\r
-}\r
 \r
 /**\r
   Retrieve the BAR information via PciIo interface.\r
@@ -68,12 +41,12 @@ GetBackPcCardBar (
 \r
     Address = 0;\r
     PciIoRead (\r
-                            &(PciIoDevice->PciIo),\r
-                            EfiPciIoWidthUint32,\r
-                            0x1c,\r
-                            1,\r
-                            &Address\r
-                            );\r
+      &(PciIoDevice->PciIo),\r
+      EfiPciIoWidthUint32,\r
+      0x1c,\r
+      1,\r
+      &Address\r
+      );\r
 \r
     (PciIoDevice->PciBar)[P2C_MEM_1].BaseAddress  = (UINT64) (Address);\r
     (PciIoDevice->PciBar)[P2C_MEM_1].Length       = 0x2000000;\r
@@ -81,36 +54,36 @@ GetBackPcCardBar (
 \r
     Address = 0;\r
     PciIoRead (\r
-                            &(PciIoDevice->PciIo),\r
-                            EfiPciIoWidthUint32,\r
-                            0x20,\r
-                            1,\r
-                            &Address\r
-                            );\r
+      &(PciIoDevice->PciIo),\r
+      EfiPciIoWidthUint32,\r
+      0x20,\r
+      1,\r
+      &Address\r
+      );\r
     (PciIoDevice->PciBar)[P2C_MEM_2].BaseAddress  = (UINT64) (Address);\r
     (PciIoDevice->PciBar)[P2C_MEM_2].Length       = 0x2000000;\r
     (PciIoDevice->PciBar)[P2C_MEM_2].BarType      = PciBarTypePMem32;\r
 \r
     Address = 0;\r
     PciIoRead (\r
-                            &(PciIoDevice->PciIo),\r
-                            EfiPciIoWidthUint32,\r
-                            0x2c,\r
-                            1,\r
-                            &Address\r
-                            );\r
+      &(PciIoDevice->PciIo),\r
+      EfiPciIoWidthUint32,\r
+      0x2c,\r
+      1,\r
+      &Address\r
+      );\r
     (PciIoDevice->PciBar)[P2C_IO_1].BaseAddress = (UINT64) (Address);\r
     (PciIoDevice->PciBar)[P2C_IO_1].Length      = 0x100;\r
     (PciIoDevice->PciBar)[P2C_IO_1].BarType     = PciBarTypeIo16;\r
 \r
     Address = 0;\r
     PciIoRead (\r
-                            &(PciIoDevice->PciIo),\r
-                            EfiPciIoWidthUint32,\r
-                            0x34,\r
-                            1,\r
-                            &Address\r
-                            );\r
+      &(PciIoDevice->PciIo),\r
+      EfiPciIoWidthUint32,\r
+      0x34,\r
+      1,\r
+      &Address\r
+      );\r
     (PciIoDevice->PciBar)[P2C_IO_2].BaseAddress = (UINT64) (Address);\r
     (PciIoDevice->PciBar)[P2C_IO_2].Length      = 0x100;\r
     (PciIoDevice->PciBar)[P2C_IO_2].BarType     = PciBarTypeIo16;\r
@@ -165,7 +138,6 @@ RemoveRejectedPciDevices (
         //\r
         // For P2C, remove all devices on it\r
         //\r
-\r
         if (!IsListEmpty (&Temp->ChildList)) {\r
           RemoveAllPciDeviceOnBridge (RootBridgeHandle, Temp);\r
         }\r
@@ -173,7 +145,6 @@ RemoveRejectedPciDevices (
         //\r
         // Finally remove itself\r
         //\r
-\r
         LastLink = CurrentLink->BackLink;\r
         RemoveEntryList (CurrentLink);\r
         FreePciDevice (Temp);\r
@@ -278,13 +249,13 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
     //\r
 \r
     IoBridge = CreateResourceNode (\r
-                RootBridgeDev,\r
-                0,\r
-                0xFFF,\r
-                0,\r
-                PciBarTypeIo16,\r
-                PciResUsageTypical\r
-                );\r
+                 RootBridgeDev,\r
+                 0,\r
+                 0xFFF,\r
+                 0,\r
+                 PciBarTypeIo16,\r
+                 PciResUsageTypical\r
+                 );\r
 \r
     Mem32Bridge = CreateResourceNode (\r
                     RootBridgeDev,\r
@@ -296,13 +267,13 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
                     );\r
 \r
     PMem32Bridge = CreateResourceNode (\r
-                    RootBridgeDev,\r
-                    0,\r
-                    0xFFFFF,\r
-                    0,\r
-                    PciBarTypePMem32,\r
-                    PciResUsageTypical\r
-                    );\r
+                     RootBridgeDev,\r
+                     0,\r
+                     0xFFFFF,\r
+                     0,\r
+                     PciBarTypePMem32,\r
+                     PciResUsageTypical\r
+                     );\r
 \r
     Mem64Bridge = CreateResourceNode (\r
                     RootBridgeDev,\r
@@ -314,25 +285,25 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
                     );\r
 \r
     PMem64Bridge = CreateResourceNode (\r
-                    RootBridgeDev,\r
-                    0,\r
-                    0xFFFFF,\r
-                    0,\r
-                    PciBarTypePMem64,\r
-                    PciResUsageTypical\r
-                    );\r
+                     RootBridgeDev,\r
+                     0,\r
+                     0xFFFFF,\r
+                     0,\r
+                     PciBarTypePMem64,\r
+                     PciResUsageTypical\r
+                     );\r
 \r
     //\r
     // Create resourcemap by going through all the devices subject to this root bridge\r
     //\r
     Status = CreateResourceMap (\r
-              RootBridgeDev,\r
-              IoBridge,\r
-              Mem32Bridge,\r
-              PMem32Bridge,\r
-              Mem64Bridge,\r
-              PMem64Bridge\r
-              );\r
+               RootBridgeDev,\r
+               IoBridge,\r
+               Mem32Bridge,\r
+               PMem32Bridge,\r
+               Mem64Bridge,\r
+               PMem64Bridge\r
+               );\r
 \r
     //\r
     // Get the max ROM size that the root bridge can process\r
@@ -366,14 +337,14 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
     // submit the resource aperture to pci host bridge protocol\r
     //\r
     Status = ConstructAcpiResourceRequestor (\r
-              RootBridgeDev,\r
-              IoBridge,\r
-              Mem32Bridge,\r
-              PMem32Bridge,\r
-              Mem64Bridge,\r
-              PMem64Bridge,\r
-              &AcpiConfig\r
-              );\r
+               RootBridgeDev,\r
+               IoBridge,\r
+               Mem32Bridge,\r
+               PMem32Bridge,\r
+               Mem64Bridge,\r
+               PMem64Bridge,\r
+               &AcpiConfig\r
+               );\r
 \r
     //\r
     // Insert these resource nodes into the database\r
@@ -493,18 +464,18 @@ PciHostBridgeResourceAllocator_WithoutHotPlugDeviceSupport (
     // enumerator. Several resource tree was created\r
     //\r
     Status = GetResourceMap (\r
-              RootBridgeDev,\r
-              &IoBridge,\r
-              &Mem32Bridge,\r
-              &PMem32Bridge,\r
-              &Mem64Bridge,\r
-              &PMem64Bridge,\r
-              &IoPool,\r
-              &Mem32Pool,\r
-              &PMem32Pool,\r
-              &Mem64Pool,\r
-              &PMem64Pool\r
-              );\r
+               RootBridgeDev,\r
+               &IoBridge,\r
+               &Mem32Bridge,\r
+               &PMem32Bridge,\r
+               &Mem64Bridge,\r
+               &PMem64Bridge,\r
+               &IoPool,\r
+               &Mem32Pool,\r
+               &PMem32Pool,\r
+               &Mem64Pool,\r
+               &PMem64Pool\r
+               );\r
 \r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
@@ -650,13 +621,13 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
       //\r
 \r
       IoBridge = CreateResourceNode (\r
-                  RootBridgeDev,\r
-                  0,\r
-                  0xFFF,\r
-                  0,\r
-                  PciBarTypeIo16,\r
-                  PciResUsageTypical\r
-                  );\r
+                   RootBridgeDev,\r
+                   0,\r
+                   0xFFF,\r
+                   0,\r
+                   PciBarTypeIo16,\r
+                   PciResUsageTypical\r
+                   );\r
 \r
       Mem32Bridge = CreateResourceNode (\r
                       RootBridgeDev,\r
@@ -668,13 +639,13 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
                       );\r
 \r
       PMem32Bridge = CreateResourceNode (\r
-                      RootBridgeDev,\r
-                      0,\r
-                      0xFFFFF,\r
-                      0,\r
-                      PciBarTypePMem32,\r
-                      PciResUsageTypical\r
-                      );\r
+                       RootBridgeDev,\r
+                       0,\r
+                       0xFFFFF,\r
+                       0,\r
+                       PciBarTypePMem32,\r
+                       PciResUsageTypical\r
+                       );\r
 \r
       Mem64Bridge = CreateResourceNode (\r
                       RootBridgeDev,\r
@@ -686,25 +657,25 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
                       );\r
 \r
       PMem64Bridge = CreateResourceNode (\r
-                      RootBridgeDev,\r
-                      0,\r
-                      0xFFFFF,\r
-                      0,\r
-                      PciBarTypePMem64,\r
-                      PciResUsageTypical\r
-                      );\r
+                       RootBridgeDev,\r
+                       0,\r
+                       0xFFFFF,\r
+                       0,\r
+                       PciBarTypePMem64,\r
+                       PciResUsageTypical\r
+                       );\r
 \r
       //\r
       // Create resourcemap by going through all the devices subject to this root bridge\r
       //\r
       Status = CreateResourceMap (\r
-                RootBridgeDev,\r
-                IoBridge,\r
-                Mem32Bridge,\r
-                PMem32Bridge,\r
-                Mem64Bridge,\r
-                PMem64Bridge\r
-                );\r
+                 RootBridgeDev,\r
+                 IoBridge,\r
+                 Mem32Bridge,\r
+                 PMem32Bridge,\r
+                 Mem64Bridge,\r
+                 PMem64Bridge\r
+                 );\r
 \r
       //\r
       // Get the max ROM size that the root bridge can process\r
@@ -743,14 +714,14 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
       // submit the resource aperture to pci host bridge protocol\r
       //\r
       Status = ConstructAcpiResourceRequestor (\r
-                RootBridgeDev,\r
-                IoBridge,\r
-                Mem32Bridge,\r
-                PMem32Bridge,\r
-                Mem64Bridge,\r
-                PMem64Bridge,\r
-                &AcpiConfig\r
-                );\r
+                 RootBridgeDev,\r
+                 IoBridge,\r
+                 Mem32Bridge,\r
+                 PMem32Bridge,\r
+                 Mem64Bridge,\r
+                 PMem64Bridge,\r
+                 &AcpiConfig\r
+                 );\r
 \r
       //\r
       // Insert these resource nodes into the database\r
@@ -883,17 +854,17 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
           );\r
 \r
     Status = PciHostBridgeAdjustAllocation (\r
-              &IoPool,\r
-              &Mem32Pool,\r
-              &PMem32Pool,\r
-              &Mem64Pool,\r
-              &PMem64Pool,\r
-              IoResStatus,\r
-              Mem32ResStatus,\r
-              PMem32ResStatus,\r
-              Mem64ResStatus,\r
-              PMem64ResStatus\r
-              );\r
+               &IoPool,\r
+               &Mem32Pool,\r
+               &PMem32Pool,\r
+               &Mem64Pool,\r
+               &PMem64Pool,\r
+               IoResStatus,\r
+               Mem32ResStatus,\r
+               PMem32ResStatus,\r
+               Mem64ResStatus,\r
+               PMem64ResStatus\r
+               );\r
 \r
     //\r
     // Destroy all the resource tree\r
@@ -984,18 +955,18 @@ PciHostBridgeResourceAllocator_WithHotPlugDeviceSupport (
     // enumerator. Several resource tree was created\r
     //\r
     Status = GetResourceMap (\r
-              RootBridgeDev,\r
-              &IoBridge,\r
-              &Mem32Bridge,\r
-              &PMem32Bridge,\r
-              &Mem64Bridge,\r
-              &PMem64Bridge,\r
-              &IoPool,\r
-              &Mem32Pool,\r
-              &PMem32Pool,\r
-              &Mem64Pool,\r
-              &PMem64Pool\r
-              );\r
+               RootBridgeDev,\r
+               &IoBridge,\r
+               &Mem32Bridge,\r
+               &PMem32Bridge,\r
+               &Mem64Bridge,\r
+               &PMem64Bridge,\r
+               &IoPool,\r
+               &Mem32Pool,\r
+               &PMem32Pool,\r
+               &Mem64Pool,\r
+               &PMem64Pool\r
+               );\r
 \r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
@@ -1447,7 +1418,7 @@ PciScanBus_WithHotPlugDeviceSupport (
                       &BusRange\r
                       );\r
 \r
-            gBS->FreePool (Descriptors);\r
+            FreePool (Descriptors);\r
 \r
             if (EFI_ERROR (Status)) {\r
               return Status;\r
@@ -1787,7 +1758,7 @@ PciHostBridgeEnumerator (
           StartBusNumber\r
         );\r
 \r
-        gBS->FreePool (Configuration);\r
+        FreePool (Configuration);\r
         Link = GetNextNode (&RootBridgeList, Link);\r
         DestroyRootBridge (RootBridgeDev);\r
       }\r
index 91ff03159d5a4d42cd30c31e7340f287202b0dbf..5eeedb222a4dfca8d791f44abcca160745b373a5 100644 (file)
@@ -49,14 +49,6 @@ typedef struct {
   UINT8                              *AllocRes;\r
 } EFI_RESOURCE_ALLOC_FAILURE_ERROR_DATA_PAYLOAD;\r
 \r
-/**\r
-  Install protocol gEfiPciHotPlugRequestProtocolGuid\r
-  @param Status    return status of protocol installation.\r
-**/\r
-VOID\r
-InstallHotPlugRequestProtocol (\r
-  IN  EFI_STATUS                    *Status\r
-  );\r
 \r
 /**\r
   Retrieve the BAR information via PciIo interface.\r
index f81bb92e3f295e7dfc95ee2d02dc4843a80c2e10..788bbe52ee9da4e311c47cfd0669acc9cde08765 100644 (file)
@@ -140,7 +140,7 @@ LocalLoadFile2 (
                              Scratch,\r
                              ScratchSize\r
                              );\r
-      gBS->FreePool (Scratch);\r
+      FreePool (Scratch);\r
       \r
       if (EFI_ERROR (Status)) {\r
         return EFI_DEVICE_ERROR;\r
@@ -432,7 +432,7 @@ LoadOpRomImage (
 \r
   RomPcir = AllocatePool (sizeof (PCI_DATA_STRUCTURE));\r
   if (RomPcir == NULL) {\r
-    gBS->FreePool (RomHeader);\r
+    FreePool (RomHeader);\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
 \r
@@ -496,8 +496,8 @@ LoadOpRomImage (
     Image     = AllocatePool ((UINT32) RomImageSize);\r
     if (Image == NULL) {\r
       RomDecode (PciDevice, RomBarIndex, RomBar, FALSE);\r
-      gBS->FreePool (RomHeader);\r
-      gBS->FreePool (RomPcir);\r
+      FreePool (RomHeader);\r
+      FreePool (RomPcir);\r
       return EFI_OUT_OF_RESOURCES;\r
     }\r
 \r
@@ -536,8 +536,8 @@ LoadOpRomImage (
   //\r
   // Free allocated memory\r
   //\r
-  gBS->FreePool (RomHeader);\r
-  gBS->FreePool (RomPcir);\r
+  FreePool (RomHeader);\r
+  FreePool (RomPcir);\r
 \r
   return RetStatus;\r
 }\r
@@ -725,7 +725,7 @@ ProcessOpRomImage (
                       );\r
     }\r
 \r
-    gBS->FreePool (PciOptionRomImageDevicePath);\r
+    FreePool (PciOptionRomImageDevicePath);\r
 \r
     if (!EFI_ERROR (Status)) {\r
       Status = gBS->StartImage (ImageHandle, NULL, NULL);\r
index aef3e956c380512b20e6ed283f094b62aa4f4788..1a7fef7dfbaae462a2c069cdbd23c9a2066b0f6c 100644 (file)
@@ -66,7 +66,7 @@ PciRomAddImageMapping (
     CopyMem (TempMapping, mRomImageTable, mNumberOfPciRomImages * sizeof (EFI_PCI_ROM_IMAGE_MAPPING));\r
 \r
     if (mRomImageTable != NULL) {\r
-      gBS->FreePool (mRomImageTable);\r
+      FreePool (mRomImageTable);\r
     }\r
 \r
     mRomImageTable = TempMapping;\r