summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/PCD/Pei
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-08 14:37:30 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-08 14:37:30 +0000
commit4f914125e83bc2fa88862432b8194c4e2485189f (patch)
tree80c65207566c23b05893f4ed78f34c864d7bc1eb /EdkModulePkg/Universal/PCD/Pei
parent3c367f9de6345969bbf70453e74f741acb840cb1 (diff)
downloadedk2-platforms-4f914125e83bc2fa88862432b8194c4e2485189f.tar.xz
Add Feature Flag PcdDxePcdDatabaseTraverseEnabled and PcdPeiPcdDatabaseTraverseEnabled
Add Pcd DXE driver and PEIM to all supported ARCH in EdkModulePkg-All-Archs.fpd Make Pcd DXE driver and PEIM compilable under EBC, IPF, X64 Fixed a few other bugs. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@838 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/PCD/Pei')
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.c13
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Pcd.msa7
-rw-r--r--EdkModulePkg/Universal/PCD/Pei/Service.c41
3 files changed, 45 insertions, 16 deletions
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.c b/EdkModulePkg/Universal/PCD/Pei/Pcd.c
index 4ae4b27ef4..fe2fa85f44 100644
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.c
+++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.c
@@ -182,7 +182,10 @@ PeiPcdGetSize (
//
TokenNumber--;
- ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
+ // EBC compiler is very choosy. It may report warning about comparison
+ // between UINTN and 0 . So we add 1 in each size of the
+ // comparison.
+ ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
Size = (PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
@@ -479,6 +482,10 @@ PeiPcdGetNextToken (
UINTN i;
BOOLEAN Found;
+ if (!FeaturePcdGet (PcdPeiPcdDatabaseTraverseEnabled)) {
+ return EFI_UNSUPPORTED;
+ }
+
if (Guid == NULL) {
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
return EFI_NOT_FOUND;
@@ -570,6 +577,10 @@ PeiPcdGetNextTokenSpace (
UINTN i;
BOOLEAN Found;
+ if (!FeaturePcdGet (PcdPeiPcdDatabaseTraverseEnabled)) {
+ return EFI_UNSUPPORTED;
+ }
+
ASSERT (Guid != NULL);
if (PEI_EXMAP_TABLE_EMPTY) {
diff --git a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa b/EdkModulePkg/Universal/PCD/Pei/Pcd.msa
index 14454323df..54acd91561 100644
--- a/EdkModulePkg/Universal/PCD/Pei/Pcd.msa
+++ b/EdkModulePkg/Universal/PCD/Pei/Pcd.msa
@@ -103,5 +103,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<HelpText/>
</PcdEntry>
+ <PcdEntry PcdItemType="FEATURE_FLAG">
+ <C_Name>PcdPeiPcdDatabaseTraverseEnabled</C_Name>
+ <TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
+ <HelpText/>
+ </PcdEntry>
</PcdCoded>
-</ModuleSurfaceArea> \ No newline at end of file
+</ModuleSurfaceArea>
diff --git a/EdkModulePkg/Universal/PCD/Pei/Service.c b/EdkModulePkg/Universal/PCD/Pei/Service.c
index 0004bc6c76..7b13dc2fa0 100644
--- a/EdkModulePkg/Universal/PCD/Pei/Service.c
+++ b/EdkModulePkg/Universal/PCD/Pei/Service.c
@@ -52,7 +52,7 @@ PeiRegisterCallBackWorker (
// as the array index.
//
TokenNumber--;
- ASSERT (TokenNumber < PEI_NEX_TOKEN_NUMBER);
+ ASSERT (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1);
} else {
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
@@ -62,7 +62,10 @@ PeiRegisterCallBackWorker (
// as the array index.
//
TokenNumber--;
- ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
+ // EBC compiler is very choosy. It may report warning about comparison
+ // between UINTN and 0 . So we add 1 in each size of the
+ // comparison.
+ ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
}
@@ -230,19 +233,19 @@ GetSkuEnabledTokenNumber (
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
case PCD_TYPE_VPD:
Value = (UINT8 *) &(((VPD_HEAD *) Value)[i]);
- return ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_VPD);
+ return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_VPD);
case PCD_TYPE_HII:
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[i]);
- return ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII);
+ return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII);
case PCD_TYPE_STRING:
Value = (UINT8 *) &(((STRING_HEAD *) Value)[i]);
- return ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
+ return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
case PCD_TYPE_DATA:
Value += Size * i;
- return (Value - (UINT8 *) PeiPcdDb);
+ return (UINT32) (Value - (UINT8 *) PeiPcdDb);
default:
ASSERT (FALSE);
@@ -259,7 +262,7 @@ GetSkuEnabledTokenNumber (
VOID
InvokeCallbackOnSet (
- UINT32 ExTokenNumber,
+ UINTN ExTokenNumber,
CONST EFI_GUID *Guid, OPTIONAL
UINTN TokenNumber,
VOID *Data,
@@ -277,8 +280,12 @@ InvokeCallbackOnSet (
//
TokenNumber--;
- if (Guid == NULL)
- ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
+ if (Guid == NULL) {
+ // EBC compiler is very choosy. It may report warning about comparison
+ // between UINTN and 0 . So we add 1 in each size of the
+ // comparison.
+ ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
+ }
GuidHob = GetFirstGuidHob (&gPcdPeiCallbackFnTableHobGuid);
ASSERT (GuidHob != NULL);
@@ -335,7 +342,10 @@ SetWorker (
//
TokenNumber--;
- ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
+ // EBC compiler is very choosy. It may report warning about comparison
+ // between UINTN and 0 . So we add 1 in each size of the
+ // comparison.
+ ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
PeiPcdDb = GetPcdDatabase ();
@@ -350,7 +360,7 @@ SetWorker (
// For Dynamic EX PCD entry, we have invoked the callback function for Dynamic EX
// type PCD entry in ExSetWorker.
//
- if (TokenNumber < PEI_NEX_TOKEN_NUMBER) {
+ if (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) {
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
}
@@ -500,7 +510,10 @@ GetWorker (
//
TokenNumber--;
- ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
+ // EBC compiler is very choosy. It may report warning about comparison
+ // between UINTN and 0 . So we add 1 in each size of the
+ // comparison.
+ ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
ASSERT ((GetSize == PeiPcdGetSize(TokenNumber + 1)) || (GetSize == 0));
@@ -525,7 +538,7 @@ GetWorker (
{
VPD_HEAD *VpdHead;
VpdHead = (VPD_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
- return (VOID *) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);
+ return (VOID *) (UINTN) (FixedPcdGet32(PcdVpdBaseAddress) + VpdHead->Offset);
}
case PCD_TYPE_HII:
@@ -570,7 +583,7 @@ GetWorker (
UINTN
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
- IN UINT32 ExTokenNumber
+ IN UINTN ExTokenNumber
)
{
UINT32 i;