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
This commit is contained in:
qwang12
2006-07-08 14:37:30 +00:00
parent 3c367f9de6
commit 4f914125e8
10 changed files with 5111 additions and 4340 deletions

View File

@@ -200,9 +200,15 @@ DxePcdGetSize (
//
TmpTokenNumber = TokenNumber;
ASSERT (TokenNumber < PCD_TOTAL_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 < PCD_TOTAL_TOKEN_NUMBER + 1);
IsPeiDb = (BOOLEAN) (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.
IsPeiDb = (BOOLEAN) (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
TokenNumber = IsPeiDb ? TokenNumber :
(TokenNumber - PEI_LOCAL_TOKEN_NUMBER);
@@ -501,25 +507,32 @@ DxePcdGetNextToken (
{
EFI_STATUS Status;
if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {
return EFI_UNSUPPORTED;
}
Status = EFI_NOT_FOUND;
//
// Scan the local token space
//
if (Guid == NULL) {
if (((*TokenNumber > PEI_NEX_TOKEN_NUMBER) && (*TokenNumber < PEI_LOCAL_TOKEN_NUMBER)) ||
((*TokenNumber > (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_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.
if (((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) && (*TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1)) ||
((*TokenNumber + 1 > (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1)))) {
return EFI_NOT_FOUND;
}
(*TokenNumber)++;
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER &&
*TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) {
if ((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) &&
(*TokenNumber <= PEI_LOCAL_TOKEN_NUMBER)) {
//
// The first Non-Ex type Token Number for DXE PCD
// database is PEI_LOCAL_TOKEN_NUMBER
//
*TokenNumber = PEI_LOCAL_TOKEN_NUMBER;
} else if (*TokenNumber > DXE_NEX_TOKEN_NUMBER + PEI_LOCAL_TOKEN_NUMBER) {
} else if (*TokenNumber + 1 > DXE_NEX_TOKEN_NUMBER + PEI_LOCAL_TOKEN_NUMBER + 1) {
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
}
return EFI_SUCCESS;
@@ -618,6 +631,10 @@ DxePcdGetNextTokenSpace (
EFI_GUID **DxeTokenSpaceTable;
BOOLEAN Match;
if (!FeaturePcdGet (PcdDxePcdDatabaseTraverseEnabled)) {
return EFI_UNSUPPORTED;
}
ASSERT (Guid != NULL);
if (PEI_EXMAP_TABLE_EMPTY && DXE_EXMAP_TABLE_EMPTY) {

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!--Copyright (c) 2006, 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
@@ -61,7 +61,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<Keyword>BaseMemoryLib</Keyword>
</LibraryClass>
<LibraryClass Usage="ALWAYS_CONSUMED">
<Keyword>DxeRuntimeDriverLib</Keyword>
<Keyword>UefiRuntimeServicesTableLib</Keyword>
</LibraryClass>
</LibraryClassDefinitions>
<SourceFiles>
@@ -106,5 +106,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.-->
<HelpText/>
</PcdEntry>
<PcdEntry PcdItemType="FEATURE_FLAG">
<C_Name>PcdDxePcdDatabaseTraverseEnabled</C_Name>
<TokenSpaceGuidCName>gEfiEdkModulePkgTokenSpaceGuid</TokenSpaceGuidCName>
<HelpText/>
</PcdEntry>
</PcdCoded>
</ModuleSurfaceArea>
</ModuleSurfaceArea>

View File

@@ -61,12 +61,20 @@ GetWorker (
TmpTokenNumber = TokenNumber;
ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
//
// PCD_TOTAL_TOKEN_NUMBER is a auto-generated constant.
// It could be zero. EBC compiler is very choosy. It may
// report warning. So we add 1 in each size of the
// comparison.
//
ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
ASSERT ((GetSize == DxePcdGetSize (TokenNumber + 1)) || (GetSize == 0));
IsPeiDb = (TokenNumber < PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
// 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.
IsPeiDb = (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE;
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
@@ -362,11 +370,12 @@ BuildPcdDxeDataBase (
// Initialized the Callback Function Table
//
if (PCD_TOTAL_TOKEN_NUMBER != 0) {
mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));
}
mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));
for (Idx = 0; Idx < PCD_TOTAL_TOKEN_NUMBER; Idx++) {
// 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.
for (Idx = 0; Idx + 1 < PCD_TOTAL_TOKEN_NUMBER + 1; Idx++) {
InitializeListHead (&mCallbackFnTable[Idx]);
}
@@ -390,7 +399,7 @@ GetHiiVariable (
Size = 0;
Buffer = NULL;
Status = EfiGetVariable (
Status = gRT->GetVariable (
(UINT16 *)VariableName,
VariableGuid,
NULL,
@@ -403,7 +412,7 @@ GetHiiVariable (
ASSERT (Buffer != NULL);
Status = EfiGetVariable (
Status = gRT->GetVariable (
VariableName,
VariableGuid,
NULL,
@@ -566,19 +575,29 @@ SetWorker (
TmpTokenNumber = TokenNumber;
ASSERT (TokenNumber < PCD_TOTAL_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 < PCD_TOTAL_TOKEN_NUMBER + 1);
if (!PtrType) {
ASSERT (*Size == DxePcdGetSize (TokenNumber + 1));
}
IsPeiDb = (TokenNumber < PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
// 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.
IsPeiDb = (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE;
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
if ((TokenNumber < PEI_NEX_TOKEN_NUMBER) ||
(TokenNumber >= PEI_LOCAL_TOKEN_NUMBER || TokenNumber < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_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.
if ((TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) ||
(TokenNumber + 1 >= PEI_LOCAL_TOKEN_NUMBER + 1 || TokenNumber + 1 < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1))) {
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
}
@@ -755,7 +774,7 @@ SetHiiVariable (
Size = 0;
Status = EfiGetVariable (
Status = gRT->GetVariable (
(UINT16 *)VariableName,
VariableGuid,
&Attribute,
@@ -769,7 +788,7 @@ SetHiiVariable (
ASSERT (Buffer != NULL);
Status = EfiGetVariable (
Status = gRT->GetVariable (
VariableName,
VariableGuid,
&Attribute,
@@ -781,7 +800,7 @@ SetHiiVariable (
CopyMem ((UINT8 *)Buffer + Offset, Data, DataSize);
Status = EfiSetVariable (
Status = gRT->SetVariable (
VariableName,
VariableGuid,
Attribute,
@@ -983,7 +1002,10 @@ GetPtrTypeSize (
BOOLEAN IsPeiDb;
UINT32 *LocalTokenNumberTable;
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx < 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.
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
if (IsPeiDb) {
@@ -1055,7 +1077,10 @@ SetPtrTypeSize (
BOOLEAN IsPeiDb;
UINT32 *LocalTokenNumberTable;
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx < 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.
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
if (IsPeiDb) {
LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;