From: Star Zeng <star.zeng@intel.com>
To: edk2-devel@lists.01.org
Cc: Star Zeng <star.zeng@intel.com>,
Michael Kinney <michael.d.kinney@intel.com>,
Liming Gao <liming.gao@intel.com>,
Tim Lewis <tim.lewis@insyde.com>,
Yonghong Zhu <yonghong.zhu@intel.com>
Subject: [RFC V2] PCD: Extended SKU support 1 - inheritance
Date: Mon, 15 May 2017 17:37:35 +0800 [thread overview]
Message-ID: <1494841055-26920-1-git-send-email-star.zeng@intel.com> (raw)
- 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 from another non-DEFAULT SKU.
For example below, SkuA and SkuB could only derive from DEFAULT, but SkuB could not derive from SkuA.
[SkuIds]
0 | DEFAULT
1 | SkuA
2 | SkuB
- Proposal: One non-DEFAULT SKU could be a derivative of another non-DEFAULT SKU.
This proposal extends DSC [SkuIds] section syntax and the extension is optional.
This proposal keeps the backward compatibility with current SKU usage.
This proposal provides interface to get the relationship between multiple SKUs for runtime usage.
BaseTools update is needed to support the extension, and no any change in PCD 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 proposal and defines which SKU the PCD value will derive from for this SKU. The PCD value will derive from DEFAULT SKU for this SKU if the ParentSkuName is absent.
AutoGen.h:
extern UINT64 *_gPcd_SkuId_Array;
AutoGen.c:
// SkuId array with relationship information for SkuIds listed in SKUID_IDENTIFIER
GLOBAL_REMOVE_IF_UNREFERENCED UINT64 *_gPcd_SkuId_Array = { SkuId, ParentSkuId, ParentParentSkuId, …, 0x0, SkuId, ParentSkuId, ParentSkuId, …, 0x0, …, 0x0 };
For the example below, _gPcd_SkuId_Array = { 0x2, 0x1, 0x0, 0x1, 0x0, 0x0 }.
PcdLib.h:
LibPcdGetParentSkuId function and PcdGetParentSkuId macro, the patch below 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”
gXXXPkgTokenSpaceGuid.PcdXXXConfig1|FALSE
gXXXPkgTokenSpaceGuid.PcdXXXConfig2|FALSE
gXXXPkgTokenSpaceGuid.PcdXXXConfig3|FALSE
[PcdsDynamicDefault.Common.SkuA]
gXXXPkgTokenSpaceGuid.PcdXXXSignature|“SkuA”
gXXXPkgTokenSpaceGuid.PcdXXXConfig1|TRUE
gXXXPkgTokenSpaceGuid.PcdXXXConfig2|TRUE
# No need statement for PcdXXXConfig3 whose value will derive from DEFAULT SKU and be FLASE.
[PcdsDynamicDefault.Common.SkuB]
gXXXPkgTokenSpaceGuid.PcdXXXSignature|“SkuB”
# No need statement for PcdXXXConfig1 and PcdXXXConfig2 whose values will derive from SkuA SKU and be TRUE.
gXXXPkgTokenSpaceGuid.PcdXXXConfig3|TRUE
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Tim Lewis <tim.lewis@insyde.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
---
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/PcdLib.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, EITHER 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.
@@ -2039,7 +2057,6 @@ LibPcdGetNextTokenSpace (
IN CONST GUID *TokenSpaceGuid
);
-
/**
Sets a value of a patchable PCD entry that is type pointer.
@@ -2174,6 +2191,25 @@ LibPatchPcdSetPtrAndSizeS (
IN CONST VOID *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] SkuIdArray Pointer to SkuId array with relationship information.
+ @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/BasePcdLibNull/PcdLib.c
index 4fc3672b7a36..434508cfc26c 100644
--- a/MdePkg/Library/BasePcdLibNull/PcdLib.c
+++ b/MdePkg/Library/BasePcdLibNull/PcdLib.c
@@ -1415,6 +1415,49 @@ LibPatchPcdSetPtrAndSizeS (
}
/**
+ 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 information.
+ @param[in] SkuId SKU ID.
+
+ @return Return the parent SkuId.
+
+**/
+UINT64
+EFIAPI
+LibPcdGetParentSkuId (
+ IN UINT64 *SkuIdArray,
+ IN UINT64 SkuId
+ )
+{
+ UINT64 *TempSkuId;
+
+ if (SkuId == 0) {
+ return 0;
+ }
+
+ TempSkuId = SkuIdArray;
+ while (*TempSkuId != 0) {
+ if (*TempSkuId == SkuId) {
+ TempSkuId++;
+ return (*TempSkuId);
+ }
+ while (*TempSkuId != 0) {
+ TempSkuId++;
+ }
+ TempSkuId++;
+ }
+
+ //
+ // Not found the input SkuId, return it without change.
+ //
+ return SkuId;
+}
+
+/**
Retrieve additional information associated with a PCD token.
This includes information such as the type of value the TokenNumber is associated with as well as possible
--
2.7.0.windows.1
reply other threads:[~2017-05-15 9:37 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1494841055-26920-1-git-send-email-star.zeng@intel.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox