]> git.proxmox.com Git - mirror_edk2.git/commitdiff
MdePkg/PciSegmentInfoLib: Add PciSegmentInfoLib class and instance.
authorRuiyu Ni <ruiyu.ni@intel.com>
Fri, 4 Aug 2017 05:10:59 +0000 (13:10 +0800)
committerRuiyu Ni <ruiyu.ni@intel.com>
Mon, 28 Aug 2017 08:47:04 +0000 (16:47 +0800)
The patch adds PciSegmentInfoLib library class which is used
by PciSegmentLib (commit in next patch) to support multiple
segment PCI configuration access.

BasePciSegmentInfoLibNull instance is added but it shouldn't be
used by any real platform.
Any single segment platform that wants to use PciSegmentLib could
use BasePciSegmentLibPci instance.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
MdePkg/Include/Library/PciSegmentInfoLib.h [new file with mode: 0644]
MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf [new file with mode: 0644]
MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni [new file with mode: 0644]
MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c [new file with mode: 0644]
MdePkg/MdePkg.dec
MdePkg/MdePkg.dsc

diff --git a/MdePkg/Include/Library/PciSegmentInfoLib.h b/MdePkg/Include/Library/PciSegmentInfoLib.h
new file mode 100644 (file)
index 0000000..588269a
--- /dev/null
@@ -0,0 +1,41 @@
+/** @file\r
+  Provides services to return segment information on a platform with multiple PCI segments.\r
+\r
+  This library is consumed by PciSegmentLib to support multiple segment PCI configuration access.\r
+\r
+  Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+  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
+  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
+\r
+#ifndef __PCI_SEGMENT_INFO_LIB__\r
+#define __PCI_SEGMENT_INFO_LIB__\r
+\r
+typedef struct {\r
+  UINT16               SegmentNumber;   ///< Segment number.\r
+  UINT64               BaseAddress;     ///< ECAM Base address.\r
+  UINT8                StartBusNumber;  ///< Start BUS number, for verifying the PCI Segment address.\r
+  UINT8                EndBusNumber;    ///< End BUS number, for verifying the PCI Segment address.\r
+} PCI_SEGMENT_INFO;\r
+\r
+/**\r
+  Return an array of PCI_SEGMENT_INFO holding the segment information.\r
+\r
+  Note: The returned array/buffer is owned by callee.\r
+\r
+  @param  Count  Return the count of segments.\r
+\r
+  @retval A callee owned array holding the segment information.\r
+**/\r
+PCI_SEGMENT_INFO *\r
+GetPciSegmentInfo (\r
+  UINTN  *Count\r
+  );\r
+\r
+#endif\r
diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf
new file mode 100644 (file)
index 0000000..5ae59fb
--- /dev/null
@@ -0,0 +1,41 @@
+## @file\r
+# Instance of PCI SegmentInfo Library.\r
+#\r
+# Default PCI Segment Information Library that shouldn't be used by real platform.\r
+#\r
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+#\r
+#  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
+#  http://opensource.org/licenses/bsd-license.php.\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
+##\r
+\r
+[Defines]\r
+  INF_VERSION                    = 0x00010005\r
+  BASE_NAME                      = BasePciSegmentInfoLibNull\r
+  MODULE_UNI_FILE                = BasePciSegmentInfoLibNull.uni\r
+  FILE_GUID                      = 36B28584-C6AE-4B1B-A473-A51618EE525A\r
+  MODULE_TYPE                    = BASE\r
+  VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = PciSegmentInfoLib\r
+\r
+#\r
+# The following information is for reference only and not required by the build tools.\r
+#\r
+#  VALID_ARCHITECTURES           = IA32 X64 IPF EBC\r
+#\r
+\r
+[Sources]\r
+  PciSegmentInfoLib.c\r
+\r
+[Packages]\r
+  MdePkg/MdePkg.dec\r
+\r
+[LibraryClasses]\r
+  PcdLib\r
+  DebugLib\r
diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni
new file mode 100644 (file)
index 0000000..a956787
--- /dev/null
@@ -0,0 +1,20 @@
+// /** @file\r
+// Instance of PCI SegmentInfo Library.\r
+//\r
+// Default PCI Segment Information Library that shouldn't be used by real platform.\r
+//\r
+// Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>\r
+//\r
+// 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
+// http://opensource.org/licenses/bsd-license.php.\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
+\r
+\r
+#string STR_MODULE_ABSTRACT             #language en-US "Default instance of PCI SegmentInfo Library."\r
+\r
+#string STR_MODULE_DESCRIPTION          #language en-US "Default PCI Segment Information Library that shouldn't be used by real platform."\r
diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c b/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c
new file mode 100644 (file)
index 0000000..011a414
--- /dev/null
@@ -0,0 +1,38 @@
+/** @file\r
+  Default PCI Segment Information Library that returns one segment whose\r
+  segment base address equals to PcdPciExpressBaseAddress.\r
+\r
+  Copyright (c) 2017, 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
+\r
+#include <Base.h>\r
+#include <Library/PciSegmentInfoLib.h>\r
+#include <Library/DebugLib.h>\r
+\r
+/**\r
+  Return an array of PCI_SEGMENT_INFO holding the segment information.\r
+\r
+  Note: The returned array/buffer is owned by callee.\r
+\r
+  @param  Count  Return the count of segments.\r
+\r
+  @retval A callee owned array holding the segment information.\r
+**/\r
+PCI_SEGMENT_INFO *\r
+GetPciSegmentInfo (\r
+  UINTN  *Count\r
+  )\r
+{\r
+  ASSERT (FALSE);\r
+  *Count = 0;\r
+  return NULL;\r
+}\r
index 425004f9d80b09813828f185737cbd1e7672dafc..ad13185ed6d50f0d24302ebd0b3e2be5201f6855 100644 (file)
   ##  @libraryclass  Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.\r
   PeCoffGetEntryPointLib|Include/Library/PeCoffGetEntryPointLib.h\r
 \r
   ##  @libraryclass  Provides a service to retrieve the PE/COFF entry point from a PE/COFF image.\r
   PeCoffGetEntryPointLib|Include/Library/PeCoffGetEntryPointLib.h\r
 \r
+  ##  @libraryclass  Provides services to return the PCI segment information.\r
+  PciSegmentInfoLib|Include/Library/PciSegmentInfoLib.h\r
+\r
   ##  @libraryclass  Provides services to access PCI Configuration Space on a platform with multiple PCI segments.\r
   PciSegmentLib|Include/Library/PciSegmentLib.h\r
 \r
   ##  @libraryclass  Provides services to access PCI Configuration Space on a platform with multiple PCI segments.\r
   PciSegmentLib|Include/Library/PciSegmentLib.h\r
 \r
index 010ce533d7ea70c3e880224d320b3e58e847172b..e553a702a3ca624e70f44a1bdfc5ff7545cfc55d 100644 (file)
@@ -69,6 +69,7 @@
   MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf\r
   MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf\r
   MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
   MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf\r
   MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf\r
   MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf\r
+  MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf\r
   MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
   MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf\r
   MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf\r
   MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf\r
   MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf\r
   MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf\r