]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdeModulePkg: Add new library class PciHostBridgeLib
authorRuiyu Ni <ruiyu.ni@intel.com>
Mon, 18 Jan 2016 04:49:22 +0000 (04:49 +0000)
committerniruiyu <niruiyu@Edk2>
Mon, 18 Jan 2016 04:49:22 +0000 (04:49 +0000)
PciHostBridgeDxe driver needs PciHostBridgeLib implemented by platform
to provide the root bridge related information and may call into
PciHostBridgeLib when resource conflicts happen.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19655 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Include/Library/PciHostBridgeLib.h [new file with mode: 0644]
MdeModulePkg/MdeModulePkg.dec

diff --git a/MdeModulePkg/Include/Library/PciHostBridgeLib.h b/MdeModulePkg/Include/Library/PciHostBridgeLib.h
new file mode 100644 (file)
index 0000000..b1dba0f
--- /dev/null
@@ -0,0 +1,97 @@
+/** @file\r
+  PCI Host Bridge Library consumed by PciHostBridgeDxe driver returning\r
+  the platform specific information about the PCI Host Bridge.\r
+\r
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials are\r
+  licensed and made available under the terms and conditions of\r
+  the BSD License which accompanies this distribution.  The full\r
+  text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php.\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+#ifndef __PCI_HOST_BRIDGE_LIB_H__\r
+#define __PCI_HOST_BRIDGE_LIB_H__\r
+\r
+//\r
+// (Base > Limit) indicates an aperture is not available.\r
+//\r
+typedef struct {\r
+  UINT64 Base;\r
+  UINT64 Limit;\r
+} PCI_ROOT_BRIDGE_APERTURE;\r
+\r
+typedef struct {\r
+  UINT32                   Segment;              ///< Segment number.\r
+  UINT64                   Supports;             ///< Supported attributes.\r
+                                                 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()\r
+                                                 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  UINT64                   Attributes;           ///< Initial attributes.\r
+                                                 ///< Refer to EFI_PCI_ATTRIBUTE_xxx used by GetAttributes()\r
+                                                 ///< and SetAttributes() in EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL.\r
+  BOOLEAN                  DmaAbove4G;           ///< DMA above 4GB memory.\r
+                                                 ///< Set to TRUE when root bridge supports DMA above 4GB memory.\r
+  UINT64                   AllocationAttributes; ///< Allocation attributes.\r
+                                                 ///< Refer to EFI_PCI_HOST_BRIDGE_COMBINE_MEM_PMEM and\r
+                                                 ///< EFI_PCI_HOST_BRIDGE_MEM64_DECODE used by GetAllocAttributes()\r
+                                                 ///< in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.\r
+  PCI_ROOT_BRIDGE_APERTURE Bus;                  ///< Bus aperture which can be used by the root bridge.\r
+  PCI_ROOT_BRIDGE_APERTURE Io;                   ///< IO aperture which can be used by the root bridge.\r
+  PCI_ROOT_BRIDGE_APERTURE Mem;                  ///< MMIO aperture below 4GB which can be used by the root bridge.\r
+  PCI_ROOT_BRIDGE_APERTURE MemAbove4G;           ///< MMIO aperture above 4GB which can be used by the root bridge.\r
+  PCI_ROOT_BRIDGE_APERTURE PMem;                 ///< Prefetchable MMIO aperture below 4GB which can be used by the root bridge.\r
+  PCI_ROOT_BRIDGE_APERTURE PMemAbove4G;          ///< Prefetchable MMIO aperture above 4GB which can be used by the root bridge.\r
+  EFI_DEVICE_PATH_PROTOCOL *DevicePath;          ///< Device path.\r
+} PCI_ROOT_BRIDGE;\r
+\r
+/**\r
+  Return all the root bridge instances in an array.\r
+\r
+  @param Count  Return the count of root bridge instances.\r
+\r
+  @return All the root bridge instances in an array.\r
+          The array should be passed into PciHostBridgeFreeRootBridges()\r
+          when it's not used.\r
+**/\r
+PCI_ROOT_BRIDGE *\r
+EFIAPI\r
+PciHostBridgeGetRootBridges (\r
+  UINTN *Count\r
+  );\r
+\r
+/**\r
+  Free the root bridge instances array returned from PciHostBridgeGetRootBridges().\r
+\r
+  @param  The root bridge instances array.\r
+  @param  The count of the array.\r
+**/\r
+VOID\r
+EFIAPI\r
+PciHostBridgeFreeRootBridges (\r
+  PCI_ROOT_BRIDGE *Bridges,\r
+  UINTN           Count\r
+  );\r
+\r
+/**\r
+  Inform the platform that the resource conflict happens.\r
+\r
+  @param HostBridgeHandle Handle of the Host Bridge.\r
+  @param Configuration    Pointer to PCI I/O and PCI memory resource descriptors.\r
+                          The Configuration contains the resources for all the\r
+                          root bridges. The resource for each root bridge is\r
+                          terminated with END descriptor and an additional END\r
+                          is appended indicating the end of the entire resources.\r
+                          The resource descriptor field values follow the description\r
+                          in EFI_PCI_HOST_BRIDGE_RESOURCE_ALLOCATION_PROTOCOL.SubmitResources().\r
+**/\r
+VOID\r
+EFIAPI\r
+PciHostBridgeResourceConflict (\r
+  EFI_HANDLE           HostBridgeHandle,\r
+  VOID                 *Configuration\r
+  );\r
+\r
+#endif\r
index 0d8aedec01b1ed4e39a6ab008e8acfa05a4deb26..5c5a9ee131387494739e1c5049625976149f7d28 100644 (file)
@@ -3,7 +3,7 @@
 # It also provides the definitions(including PPIs/PROTOCOLs/GUIDs and library classes)\r
 # and libraries instances, which are used for those modules.\r
 #\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials are licensed and made available under\r
 # the terms and conditions of the BSD License that accompanies this distribution.\r
 # The full text of the license may be found at\r
   #\r
   IpmiLib|Include/Library/IpmiLib.h\r
 \r
+  ## @libraryclass  Provides interfaces for platform to return root bridge information to PciHostBridgeDxe driver.\r
+  #\r
+  PciHostBridgeLib|Include/Library/PciHostBridgeLib.h\r
+\r
 [Guids]\r
   ## MdeModule package token space guid\r
   # Include/Guid/MdeModulePkgTokenSpace.h\r