summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-10-11 17:00:17 +0800
committerJiewen Yao <jiewen.yao@intel.com>2017-10-24 19:42:37 +0800
commitbdcf08f5bc20724155af22059bad6043bdb824b3 (patch)
tree68fb0cc99c17e75ec2b0c416dbbfcad61c1c3e3d
parentec897a89b5bec5d791191e2ea604379301949bc2 (diff)
downloadedk2-platforms-bdcf08f5bc20724155af22059bad6043bdb824b3.tar.xz
Add PciSegmentInfoLibSimple.
This instance will be consumed by TestPointCheckLib. It reports PCI segment information in PEI phase, to let TestPointCheckLib go through the PCI to check BME bit. Cc: Michael A Kubacki <michael.a.kubacki@intel.com> Cc: Amy Chan <amy.chan@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Brett Wang <brett.wang@intel.com> Cc: Daocheng Bu <daocheng.bu@intel.com> Cc: Isaac W Oram <isaac.w.oram@intel.com> Cc: Rangasai V Chaganty <rangasai.v.chaganty@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Amy Chan <amy.chan@intel.com>
-rw-r--r--Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc1
-rw-r--r--Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c60
-rw-r--r--Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf42
3 files changed, 103 insertions, 0 deletions
diff --git a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
index 1b64ed6a87..4d8945244a 100644
--- a/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
+++ b/Platform/Intel/MinPlatformPkg/MinPlatformPkg.dsc
@@ -66,6 +66,7 @@
#
PlatformHookLib|MdeModulePkg/Library/BasePlatformHookLibNull/BasePlatformHookLibNull.inf
PciHostBridgeLib|MinPlatformPkg/Pci/Library/PciHostBridgeLibSimple/PciHostBridgeLibSimple.inf
+ PciSegmentInfoLib|MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf
PlatformBootManagerLib|MinPlatformPkg/Bds/Library/DxePlatformBootManagerLib/DxePlatformBootManagerLib.inf
AslUpdateLib|MinPlatformPkg/Acpi/Library/DxeAslUpdateLib/DxeAslUpdateLib.inf
diff --git a/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
new file mode 100644
index 0000000000..a7e09f16b8
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.c
@@ -0,0 +1,60 @@
+/** @file
+ Default PCI Segment Information Library that returns one segment whose
+ segment base address equals to PcdPciExpressBaseAddress.
+
+ Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are
+ licensed and made available under the terms and conditions of
+ the BSD License which accompanies this distribution. The full
+ text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php.
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#include <Base.h>
+#include <Library/PciSegmentInfoLib.h>
+#include <Library/DebugLib.h>
+#include <Library/HobLib.h>
+#include <Library/PcdLib.h>
+
+#define PCI_SEGMENT_INFO_HOB_GUID { \
+ 0x6eab7169, 0x9b21, 0x450e, 0x99, 0xe8, 0xe, 0xb1, 0x1b, 0x7d, 0xfe, 0xcb \
+ }
+
+EFI_GUID mPciSegmentInfoHobGuid = PCI_SEGMENT_INFO_HOB_GUID;
+
+/**
+ Return an array of PCI_SEGMENT_INFO holding the segment information.
+
+ Note: The returned array/buffer is owned by callee.
+
+ @param Count Return the count of segments.
+
+ @retval A callee owned array holding the segment information.
+**/
+PCI_SEGMENT_INFO *
+EFIAPI
+GetPciSegmentInfo (
+ OUT UINTN *Count
+ )
+{
+ VOID *Hob;
+ PCI_SEGMENT_INFO *PciSegmentInfo;
+
+ *Count = 1;
+ Hob = GetFirstGuidHob (&mPciSegmentInfoHobGuid);
+ if (Hob != NULL) {
+ PciSegmentInfo = GET_GUID_HOB_DATA(Hob);
+ } else {
+ PciSegmentInfo = BuildGuidHob (&mPciSegmentInfoHobGuid, sizeof(PCI_SEGMENT_INFO));
+ ASSERT(PciSegmentInfo != NULL);
+ PciSegmentInfo->SegmentNumber = 0;
+ PciSegmentInfo->BaseAddress = PcdGet64(PcdPciExpressBaseAddress);
+ PciSegmentInfo->StartBusNumber = 0;
+ PciSegmentInfo->EndBusNumber = 0xFF;
+ }
+ return PciSegmentInfo;
+}
diff --git a/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf
new file mode 100644
index 0000000000..081910e5c5
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Pci/Library/PciSegmentInfoLibSimple/PciSegmentInfoLibSimple.inf
@@ -0,0 +1,42 @@
+## @file
+# Instance of PCI SegmentInfo Library.
+#
+# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+#
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution. The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php.
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+#
+##
+
+[Defines]
+ INF_VERSION = 0x00010005
+ BASE_NAME = PciSegmentInfoLibSimple
+ FILE_GUID = ACA4E371-3D0E-47BE-8000-5030F97CF9E7
+ MODULE_TYPE = PEIM
+ VERSION_STRING = 1.0
+ LIBRARY_CLASS = PciSegmentInfoLib
+
+#
+# The following information is for reference only and not required by the build tools.
+#
+# VALID_ARCHITECTURES = IA32 X64 IPF EBC
+#
+
+[Sources]
+ PciSegmentInfoLibSimple.c
+
+[Packages]
+ MdePkg/MdePkg.dec
+
+[LibraryClasses]
+ PcdLib
+ DebugLib
+ HobLib
+
+[Pcd]
+ gEfiMdePkgTokenSpaceGuid.PcdPciExpressBaseAddress