From e457c1f65d187f58272c1dc98ae338b4f221ee41 Mon Sep 17 00:00:00 2001 From: Ruiyu Ni Date: Fri, 4 Aug 2017 13:10:59 +0800 Subject: MdePkg/PciSegmentInfoLib: Add PciSegmentInfoLib class and instance. 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 Reviewed-by: Liming Gao --- .../BasePciSegmentInfoLibNull.inf | 41 ++++++++++++++++++++++ .../BasePciSegmentInfoLibNull.uni | 20 +++++++++++ .../BasePciSegmentInfoLibNull/PciSegmentInfoLib.c | 38 ++++++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c (limited to 'MdePkg/Library') diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf new file mode 100644 index 0000000000..5ae59fb2be --- /dev/null +++ b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf @@ -0,0 +1,41 @@ +## @file +# Instance of PCI SegmentInfo Library. +# +# Default PCI Segment Information Library that shouldn't be used by real platform. +# +# Copyright (c) 2017, Intel Corporation. All rights reserved.
+# +# 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 = BasePciSegmentInfoLibNull + MODULE_UNI_FILE = BasePciSegmentInfoLibNull.uni + FILE_GUID = 36B28584-C6AE-4B1B-A473-A51618EE525A + MODULE_TYPE = BASE + 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] + PciSegmentInfoLib.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + PcdLib + DebugLib diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni new file mode 100644 index 0000000000..a956787637 --- /dev/null +++ b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.uni @@ -0,0 +1,20 @@ +// /** @file +// Instance of PCI SegmentInfo Library. +// +// Default PCI Segment Information Library that shouldn't be used by real platform. +// +// Copyright (c) 2017, Intel Corporation. All rights reserved.
+// +// 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. +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Default instance of PCI SegmentInfo Library." + +#string STR_MODULE_DESCRIPTION #language en-US "Default PCI Segment Information Library that shouldn't be used by real platform." diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c b/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c new file mode 100644 index 0000000000..011a41450c --- /dev/null +++ b/MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfoLib.c @@ -0,0 +1,38 @@ +/** @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.
+ 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 +#include +#include + +/** + 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 * +GetPciSegmentInfo ( + UINTN *Count + ) +{ + ASSERT (FALSE); + *Count = 0; + return NULL; +} -- cgit v1.2.3