From nobody Sat Dec 28 12:09:40 2024 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.zoho.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 1494841063407292.2927079741711; Mon, 15 May 2017 02:37:43 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 422A021A0BABE; Mon, 15 May 2017 02:37:41 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 EE0D621A0BABA for ; Mon, 15 May 2017 02:37:39 -0700 (PDT) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 15 May 2017 02:37:39 -0700 Received: from shwdeopenpsi068.ccr.corp.intel.com ([10.239.9.20]) by fmsmga002.fm.intel.com with ESMTP; 15 May 2017 02:37:37 -0700 X-Original-To: edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,344,1491289200"; d="scan'208";a="1169301963" From: Star Zeng To: edk2-devel@lists.01.org Date: Mon, 15 May 2017 17:37:35 +0800 Message-Id: <1494841055-26920-1-git-send-email-star.zeng@intel.com> X-Mailer: git-send-email 2.7.0.windows.1 MIME-Version: 1.0 Subject: [edk2] [RFC V2] PCD: Extended SKU support 1 - inheritance 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: Michael Kinney , Liming Gao , Star Zeng , Tim Lewis Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 - Requirement Simplify the PCDs configuring for multiple SKUs in DSC. Provide interface to get the relationship between multiple SKUs for runtime= usage. - Current limitation Non-DEFAULT SKU could only derive from DEFAULT SKU, but could not derive fr= om another non-DEFAULT SKU. For example below, SkuA and SkuB could only derive from DEFAULT, but SkuB c= ould not derive from SkuA. [SkuIds] 0 | DEFAULT 1 | SkuA 2 | SkuB - Proposal: One non-DEFAULT SKU could be a derivative of another non-DEFAUL= T SKU. This proposal extends DSC [SkuIds] section syntax and the extension is opti= onal. This proposal keeps the backward compatibility with current SKU usage. This proposal provides interface to get the relationship between multiple S= KUs for runtime usage. BaseTools update is needed to support the extension, and no any change in P= CD database and driver is required. DSC syntax: [SkuIds] SkuValue|SkuName[|ParentSkuName] SkuValue: integer, 0 is reserved for DEFAULT SKU. SkuName: string ParentSkuName: string, optional, it is new introduced in this proposa= l and defines which SKU the PCD value will derive from for this SKU. The PC= D value will derive from DEFAULT SKU for this SKU if the ParentSkuName is a= bsent. AutoGen.h: extern UINT64 *_gPcd_SkuId_Array; AutoGen.c: // SkuId array with relationship information for SkuIds listed in SKUID_I= DENTIFIER GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *_gPcd_SkuId_Array =3D { SkuId, Pare= ntSkuId, ParentParentSkuId, =E2=80=A6, 0x0, SkuId, ParentSkuId, ParentSkuId= , =E2=80=A6, 0x0, =E2=80=A6, 0x0 }; For the example below, _gPcd_SkuId_Array =3D { 0x2, 0x1, 0x0, 0x1, 0x0,= 0x0 }. PcdLib.h: LibPcdGetParentSkuId function and PcdGetParentSkuId macro, the patch belo= w shows their implementation. - Example: SkuB is a derivative of SkuA, but not a derivative of DEFAULT. [SkuIds] 0 | DEFAULT 1 | SkuA 2 | SkuB | SkuA [PcdsDynamicDefault.Common.DEFAULT] gXXXPkgTokenSpaceGuid.PcdXXXSignature|"DEFAULT=E2=80=9D gXXXPkgTokenSpaceGuid.PcdXXXConfig1|FALSE gXXXPkgTokenSpaceGuid.PcdXXXConfig2|FALSE gXXXPkgTokenSpaceGuid.PcdXXXConfig3|FALSE [PcdsDynamicDefault.Common.SkuA] gXXXPkgTokenSpaceGuid.PcdXXXSignature|=E2=80=9CSkuA=E2=80=9D gXXXPkgTokenSpaceGuid.PcdXXXConfig1|TRUE gXXXPkgTokenSpaceGuid.PcdXXXConfig2|TRUE # No need statement for PcdXXXConfig3 whose value will derive from DEFA= ULT SKU and be FLASE. [PcdsDynamicDefault.Common.SkuB] gXXXPkgTokenSpaceGuid.PcdXXXSignature|=E2=80=9CSkuB=E2=80=9D # No need statement for PcdXXXConfig1 and PcdXXXConfig2 whose values wi= ll derive from SkuA SKU and be TRUE. gXXXPkgTokenSpaceGuid.PcdXXXConfig3|TRUE Cc: Michael Kinney Cc: Liming Gao Cc: Tim Lewis Cc: Yonghong Zhu --- MdePkg/Include/Library/PcdLib.h | 38 +++++++++++++++++++++++++++++- MdePkg/Library/BasePcdLibNull/PcdLib.c | 43 ++++++++++++++++++++++++++++++= ++++ 2 files changed, 80 insertions(+), 1 deletion(-) diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLi= b.h index 9e7e09f52cdc..409689156c39 100644 --- a/MdePkg/Include/Library/PcdLib.h +++ b/MdePkg/Include/Library/PcdLib.h @@ -346,6 +346,24 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EIT= HER EXPRESS OR IMPLIED. (Size), = \ (Buffer) = \ ) + +/** + Get the parent SkuId for the input SkuId. + + If SkuId is 0, return 0. + If SkuId is invalid, return SkuId without change. + + @param[in] SkuId SKU ID. + + @return Return the parent SkuId. + +**/ +#define PcdGetParentSkuId(SkuId) \ + LibPcdGetParentSkuId ( \ + _gPcd_SkuId_Array, \ + (SkuId) \ + ) + /** Retrieves an 8-bit PCD token value based on a token name. =20 @@ -2039,7 +2057,6 @@ LibPcdGetNextTokenSpace ( IN CONST GUID *TokenSpaceGuid ); =20 - /** Sets a value of a patchable PCD entry that is type pointer. =20 @@ -2174,6 +2191,25 @@ LibPatchPcdSetPtrAndSizeS ( IN CONST VOID *Buffer ); =20 +/** + Get the parent SkuId for the input SkuId. + + If SkuId is 0, return 0. + If SkuId is invalid, return SkuId without change. + + @param[in] SkuIdArray Pointer to SkuId array with relationship informati= on. + @param[in] SkuId SKU ID. + + @return Return the parent SkuId. + +**/ +UINT64 +EFIAPI +LibPcdGetParentSkuId ( + IN UINT64 *SkuIdArray, + IN UINT64 SkuId + ); + typedef enum { PCD_TYPE_8, PCD_TYPE_16, diff --git a/MdePkg/Library/BasePcdLibNull/PcdLib.c b/MdePkg/Library/BasePc= dLibNull/PcdLib.c index 4fc3672b7a36..434508cfc26c 100644 --- a/MdePkg/Library/BasePcdLibNull/PcdLib.c +++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c @@ -1415,6 +1415,49 @@ LibPatchPcdSetPtrAndSizeS ( } =20 /** + Get the parent SkuId for the input SkuId. + + If SkuId is 0, return 0. + If SkuId is invalid, return SkuId without change. + + @param[in] SkuIdArray Pointer to SkuId array with relationship informati= on. + @param[in] SkuId SKU ID. + + @return Return the parent SkuId. + +**/ +UINT64 +EFIAPI +LibPcdGetParentSkuId ( + IN UINT64 *SkuIdArray, + IN UINT64 SkuId + ) +{ + UINT64 *TempSkuId; + + if (SkuId =3D=3D 0) { + return 0; + } + + TempSkuId =3D SkuIdArray; + while (*TempSkuId !=3D 0) { + if (*TempSkuId =3D=3D SkuId) { + TempSkuId++; + return (*TempSkuId); + } + while (*TempSkuId !=3D 0) { + TempSkuId++; + } + TempSkuId++; + } + + // + // Not found the input SkuId, return it without change. + // + return SkuId; +} + +/** Retrieve additional information associated with a PCD token. =20 This includes information such as the type of value the TokenNumber is a= ssociated with as well as possible --=20 2.7.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel