From nobody Mon Jul 7 05:38:48 2025 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1503651462341349.4254148948613; Fri, 25 Aug 2017 01:57:42 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5BFB921D1E2EB; Fri, 25 Aug 2017 01:54:56 -0700 (PDT) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BC6D421D1E2E2 for ; Fri, 25 Aug 2017 01:54:54 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Aug 2017 01:57:30 -0700 Received: from ray-dev.ccr.corp.intel.com ([10.239.9.2]) by orsmga004.jf.intel.com with ESMTP; 25 Aug 2017 01:57:29 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,424,1498546800"; d="scan'208";a="122500779" From: Ruiyu Ni To: edk2-devel@lists.01.org Date: Fri, 25 Aug 2017 16:57:21 +0800 Message-Id: <20170825085723.396044-4-ruiyu.ni@intel.com> X-Mailer: git-send-email 2.12.2.windows.2 In-Reply-To: <20170825085723.396044-1-ruiyu.ni@intel.com> References: <20170825085723.396044-1-ruiyu.ni@intel.com> Subject: [edk2] [PATCH v2 3/5] MdePkg/PciSegmentInfoLib: Add PciSegmentInfoLib class and instance. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" 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 Cc: Liming Gao --- MdePkg/Include/Library/PciSegmentInfoLib.h | 41 ++++++++++++++++++= ++++ .../BasePciSegmentInfoLibNull.inf | 41 ++++++++++++++++++= ++++ .../BasePciSegmentInfoLibNull.uni | 20 +++++++++++ .../BasePciSegmentInfoLibNull/PciSegmentInfoLib.c | 38 ++++++++++++++++++= ++ MdePkg/MdePkg.dec | 3 ++ MdePkg/MdePkg.dsc | 1 + 6 files changed, 144 insertions(+) create mode 100644 MdePkg/Include/Library/PciSegmentInfoLib.h create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegment= InfoLibNull.inf create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegment= InfoLibNull.uni create mode 100644 MdePkg/Library/BasePciSegmentInfoLibNull/PciSegmentInfo= Lib.c diff --git a/MdePkg/Include/Library/PciSegmentInfoLib.h b/MdePkg/Include/Li= brary/PciSegmentInfoLib.h new file mode 100644 index 0000000000..588269a9ae --- /dev/null +++ b/MdePkg/Include/Library/PciSegmentInfoLib.h @@ -0,0 +1,41 @@ +/** @file + Provides services to return segment information on a platform with multi= ple PCI segments. + + This library is consumed by PciSegmentLib to support multiple segment PC= I configuration access. + + 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 BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +#ifndef __PCI_SEGMENT_INFO_LIB__ +#define __PCI_SEGMENT_INFO_LIB__ + +typedef struct { + UINT16 SegmentNumber; ///< Segment number. + UINT64 BaseAddress; ///< ECAM Base address. + UINT8 StartBusNumber; ///< Start BUS number, for verifyi= ng the PCI Segment address. + UINT8 EndBusNumber; ///< End BUS number, for verifying= the PCI Segment address. +} PCI_SEGMENT_INFO; + +/** + 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 + ); + +#endif diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLib= Null.inf b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNu= ll.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 p= latform. +# +# 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 B= SD License +# which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BasePciSegmentInfoLibNull + MODULE_UNI_FILE =3D BasePciSegmentInfoLibNull.uni + FILE_GUID =3D 36B28584-C6AE-4B1B-A473-A51618EE525A + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D PciSegmentInfoLib + +# +# The following information is for reference only and not required by the = build tools. +# +# VALID_ARCHITECTURES =3D IA32 X64 IPF EBC +# + +[Sources] + PciSegmentInfoLib.c + +[Packages] + MdePkg/MdePkg.dec + +[LibraryClasses] + PcdLib + DebugLib diff --git a/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLib= Null.uni b/MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNu= ll.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 B= SD License +// which accompanies this distribution. The full text of the license may b= e 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 IM= PLIED. +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Default instance = of PCI SegmentInfo Library." + +#string STR_MODULE_DESCRIPTION #language en-US "Default PCI Segme= nt 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 IMP= LIED. + +**/ + +#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 =3D 0; + return NULL; +} diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec index 425004f9d8..ad13185ed6 100644 --- a/MdePkg/MdePkg.dec +++ b/MdePkg/MdePkg.dec @@ -131,6 +131,9 @@ [LibraryClasses] ## @libraryclass Provides a service to retrieve the PE/COFF entry poin= t from a PE/COFF image. PeCoffGetEntryPointLib|Include/Library/PeCoffGetEntryPointLib.h =20 + ## @libraryclass Provides services to return the PCI segment informati= on. + PciSegmentInfoLib|Include/Library/PciSegmentInfoLib.h + ## @libraryclass Provides services to access PCI Configuration Space o= n a platform with multiple PCI segments. PciSegmentLib|Include/Library/PciSegmentLib.h =20 diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index 010ce533d7..e553a702a3 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -69,6 +69,7 @@ [Components] MdePkg/Library/BasePciLibCf8/BasePciLibCf8.inf MdePkg/Library/BasePciLibPciExpress/BasePciLibPciExpress.inf MdePkg/Library/BasePciSegmentLibPci/BasePciSegmentLibPci.inf + MdePkg/Library/BasePciSegmentInfoLibNull/BasePciSegmentInfoLibNull.inf MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull= .inf --=20 2.12.2.windows.2 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel