Refine some internal functions of PCD Driver.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@314 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qwang12 2006-05-29 12:56:03 +00:00
parent 0653eb895d
commit 9d6d8b24f3
6 changed files with 221 additions and 329 deletions

View File

@ -116,9 +116,7 @@ DxePcdGet8 (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
ASSERT (sizeof (UINT8) == DxePcdGetSize (TokenNumber));
return *((UINT8 *) GetWorker (TokenNumber));
return *((UINT8 *) GetWorker (TokenNumber, sizeof (UINT8)));
}
@ -129,9 +127,7 @@ DxePcdGet16 (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
ASSERT (sizeof (UINT16) == DxePcdGetSize (TokenNumber));
return ReadUnaligned16 (GetWorker (TokenNumber));
return ReadUnaligned16 (GetWorker (TokenNumber, sizeof (UINT16)));
}
@ -142,9 +138,7 @@ DxePcdGet32 (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
ASSERT (sizeof (UINT32) == DxePcdGetSize (TokenNumber));
return ReadUnaligned32 (GetWorker (TokenNumber));
return ReadUnaligned32 (GetWorker (TokenNumber, sizeof (UINT32)));
}
@ -155,9 +149,7 @@ DxePcdGet64 (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
ASSERT (sizeof (UINT64) == DxePcdGetSize (TokenNumber));
return ReadUnaligned64(GetWorker (TokenNumber));
return ReadUnaligned64(GetWorker (TokenNumber, sizeof (UINT64)));
}
@ -168,7 +160,7 @@ DxePcdGetPtr (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
return GetWorker (TokenNumber);
return GetWorker (TokenNumber, 0);
}
@ -179,9 +171,7 @@ DxePcdGetBool (
IN PCD_TOKEN_NUMBER TokenNumber
)
{
ASSERT (sizeof (BOOLEAN) == DxePcdGetSize (TokenNumber));
return *((BOOLEAN *) GetWorker (TokenNumber));
return *((BOOLEAN *) GetWorker (TokenNumber, sizeof (BOOLEAN)));
}
@ -224,7 +214,7 @@ DxePcdGet16Ex (
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
return *((UINT16 *) ExGetWorker (Guid, ExTokenNumber, sizeof(UINT16)));
return ReadUnaligned16 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT16)));
}
@ -236,7 +226,7 @@ DxePcdGet32Ex (
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
return *((UINT32 *) ExGetWorker (Guid, ExTokenNumber, sizeof(UINT32)));
return ReadUnaligned32 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT32)));
}
@ -248,10 +238,7 @@ DxePcdGet64Ex (
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
//
// BugBug: Must be changed to ReadUnaligned64
//
return *((UINT64 *) ExGetWorker (Guid, ExTokenNumber, sizeof(UINT64)));
return ReadUnaligned64 (ExGetWorker (Guid, ExTokenNumber, sizeof(UINT64)));
}
@ -287,11 +274,7 @@ DxePcdGetSizeEx (
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
EX_PCD_ENTRY_ATTRIBUTE Attr;
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
return Attr.Size;
return DxePcdGetSize(GetExPcdTokenNumber (Guid, ExTokenNumber));
}

View File

@ -27,12 +27,15 @@ PCD_DATABASE * mPcdDatabase;
LIST_ENTRY mCallbackFnTable[PCD_TOTAL_TOKEN_NUMBER];
VOID *
GetWorkerByLocalTokenNumber (
UINT32 LocalTokenNumber,
BOOLEAN IsPeiDb,
UINTN Size
)
GetWorker (
PCD_TOKEN_NUMBER TokenNumber,
UINTN GetSize
)
{
UINT32 *LocalTokenNumberTable;
UINT16 *SizeTable;
BOOLEAN IsPeiDb;
UINTN Size;
UINT32 Offset;
EFI_GUID *GuidTable;
UINT16 *StringTable;
@ -45,7 +48,28 @@ GetWorkerByLocalTokenNumber (
VPD_HEAD *VpdHead;
UINT8 *PcdDb;
UINT16 StringTableIdx;
UINT32 LocalTokenNumber;
ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
Size = DxePcdGetSize (TokenNumber);
ASSERT (GetSize == Size || GetSize == 0);
IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
SizeTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SizeTable:
mPcdDatabase->DxeDb.Init.SizeTable;
TokenNumber = IsPeiDb ? TokenNumber :
TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);
}
@ -93,49 +117,24 @@ GetWorkerByLocalTokenNumber (
ASSERT (FALSE);
return NULL;
}
VOID *
GetWorker (
UINTN TokenNumber
)
{
UINT32 *LocalTokenNumberTable;
UINT16 *SizeTable;
BOOLEAN IsPeiDb;
ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
IsPeiDb = (TokenNumber <= PEI_LOCAL_TOKEN_NUMBER) ? TRUE : FALSE;
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
SizeTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SizeTable:
mPcdDatabase->DxeDb.Init.SizeTable;
TokenNumber = IsPeiDb ? TokenNumber :
TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
return GetWorkerByLocalTokenNumber (LocalTokenNumberTable[TokenNumber], IsPeiDb, SizeTable[TokenNumber]);
}
EFI_STATUS
DxeRegisterCallBackWorker (
IN UINTN TokenNumber,
IN PCD_TOKEN_NUMBER TokenNumber,
IN CONST GUID *Guid, OPTIONAL
IN PCD_PROTOCOL_CALLBACK CallBackFunction
)
{
CALLBACK_FN_ENTRY *FnTableEntry;
EX_PCD_ENTRY_ATTRIBUTE ExAttr;
LIST_ENTRY *ListHead;
LIST_ENTRY *ListNode;
if (Guid != NULL) {
GetExPcdTokenAttributes (Guid, TokenNumber, &ExAttr);
TokenNumber = ExAttr.LocalTokenNumberAlias;
TokenNumber = GetExPcdTokenNumber (Guid, TokenNumber);
}
ListHead = &mCallbackFnTable[TokenNumber];
@ -168,19 +167,17 @@ DxeRegisterCallBackWorker (
EFI_STATUS
DxeUnRegisterCallBackWorker (
IN UINTN TokenNumber,
IN PCD_TOKEN_NUMBER TokenNumber,
IN CONST GUID *Guid, OPTIONAL
IN PCD_PROTOCOL_CALLBACK CallBackFunction
)
{
CALLBACK_FN_ENTRY *FnTableEntry;
EX_PCD_ENTRY_ATTRIBUTE ExAttr;
LIST_ENTRY *ListHead;
LIST_ENTRY *ListNode;
if (Guid != NULL) {
GetExPcdTokenAttributes (Guid, TokenNumber, &ExAttr);
TokenNumber = ExAttr.LocalTokenNumberAlias;
TokenNumber = GetExPcdTokenNumber (Guid, TokenNumber);
}
ListHead = &mCallbackFnTable[TokenNumber];
@ -452,6 +449,15 @@ SetWorker (
{
UINT32 *LocalTokenNumberTable;
BOOLEAN IsPeiDb;
UINT32 LocalTokenNumber;
EFI_GUID *GuidTable;
UINT16 *StringTable;
EFI_GUID *Guid;
UINT16 *Name;
VOID *InternalData;
VARIABLE_HEAD *VariableHead;
UINTN Offset;
UINT8 *PcdDb;
ASSERT (TokenNumber < PCD_TOTAL_TOKEN_NUMBER);
@ -467,89 +473,16 @@ SetWorker (
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
if ((TokenNumber < PEI_NEX_TOKEN_NUMBER) ||
(TokenNumber >= PEI_LOCAL_TOKEN_NUMBER || TokenNumber < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER))) {
InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
}
TokenNumber = IsPeiDb ? TokenNumber
: TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
return SetWorkerByLocalTokenNumber (LocalTokenNumberTable[TokenNumber], Data, Size, PtrType, IsPeiDb);
}
VOID *
ExGetWorker (
IN CONST EFI_GUID *Guid,
IN UINTN ExTokenNumber,
IN UINTN GetSize
)
{
EX_PCD_ENTRY_ATTRIBUTE Attr;
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
ASSERT ((GetSize == Attr.Size) || (GetSize == 0));
return GetWorkerByLocalTokenNumber (Attr.LocalTokenNumberAlias,
Attr.IsPeiDb,
Attr.Size
);
}
EFI_STATUS
ExSetWorker (
IN PCD_TOKEN_NUMBER ExTokenNumber,
IN CONST EFI_GUID *Guid,
VOID *Data,
UINTN SetSize,
BOOLEAN PtrType
)
{
EX_PCD_ENTRY_ATTRIBUTE Attr;
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
ASSERT (!PtrType && (SetSize == Attr.Size));
ASSERT (PtrType && (SetSize <= Attr.Size));
InvokeCallbackOnSet (ExTokenNumber, Guid, Attr.TokenNumber, Data, Attr.Size);
SetWorkerByLocalTokenNumber (Attr.LocalTokenNumberAlias, Data, Attr.Size, PtrType, Attr.IsPeiDb);
return EFI_SUCCESS;
}
EFI_STATUS
SetWorkerByLocalTokenNumber (
UINT32 LocalTokenNumber,
VOID *Data,
UINTN Size,
BOOLEAN PtrType,
BOOLEAN IsPeiDb
)
{
EFI_GUID *GuidTable;
UINT16 *StringTable;
EFI_GUID *Guid;
UINT16 *Name;
VOID *InternalData;
VARIABLE_HEAD *VariableHead;
UINTN Offset;
UINT8 *PcdDb;
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size, IsPeiDb);
}
@ -625,6 +558,46 @@ SetWorkerByLocalTokenNumber (
VOID *
ExGetWorker (
IN CONST EFI_GUID *Guid,
IN UINTN ExTokenNumber,
IN UINTN GetSize
)
{
return GetWorker(GetExPcdTokenNumber (Guid, ExTokenNumber), GetSize);
}
EFI_STATUS
ExSetWorker (
IN PCD_TOKEN_NUMBER ExTokenNumber,
IN CONST EFI_GUID *Guid,
VOID *Data,
UINTN SetSize,
BOOLEAN PtrType
)
{
PCD_TOKEN_NUMBER TokenNumber;
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, SetSize);
SetWorker (TokenNumber, Data, SetSize, PtrType);
return EFI_SUCCESS;
}
EFI_STATUS
SetHiiVariable (
IN EFI_GUID *VariableGuid,
@ -680,56 +653,51 @@ SetHiiVariable (
VOID
GetExPcdTokenAttributes (
PCD_TOKEN_NUMBER
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
IN PCD_TOKEN_NUMBER ExTokenNumber,
OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
UINT32 i;
DYNAMICEX_MAPPING *ExMap;
EFI_GUID *GuidTable;
UINT16 *SizeTable;
EFI_GUID *MatchGuid;
UINTN MatchGuidIdx;
ExMap = mPcdDatabase->PeiDb.Init.ExMapTable;
GuidTable = mPcdDatabase->PeiDb.Init.GuidTable;
SizeTable = mPcdDatabase->PeiDb.Init.SizeTable;
MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid);
ASSERT (MatchGuid != NULL);
MatchGuidIdx = MatchGuid - GuidTable;
for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
CompareGuid (Guid, (CONST EFI_GUID *) &GuidTable[ExMap[i].ExGuidIndex])
) {
ExAttr->IsPeiDb = TRUE;
ExAttr->Size = SizeTable[i + PEI_NEX_TOKEN_NUMBER];
ExAttr->TokenNumber = i + PEI_NEX_TOKEN_NUMBER;
ExAttr->LocalTokenNumberAlias = ExMap[i].LocalTokenNumber;
return;
(MatchGuidIdx == ExMap[i].ExGuidIndex)) {
return ExMap[i].LocalTokenNumber;
}
}
ExMap = mPcdDatabase->DxeDb.Init.ExMapTable;
GuidTable = mPcdDatabase->DxeDb.Init.GuidTable;
SizeTable = mPcdDatabase->DxeDb.Init.SizeTable;
MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->DxeDb.Init.GuidTable), Guid);
ASSERT (MatchGuid != NULL);
MatchGuidIdx = MatchGuid - GuidTable;
for (i = 0; i < DXE_EXMAPPING_TABLE_SIZE; i++) {
if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
CompareGuid (Guid, (CONST EFI_GUID *) &GuidTable[ExMap[i].ExGuidIndex])
) {
ExAttr->IsPeiDb = FALSE;
ExAttr->Size = SizeTable[i + DXE_NEX_TOKEN_NUMBER];
ExAttr->TokenNumber = i + PEI_LOCAL_TOKEN_NUMBER;
ExAttr->LocalTokenNumberAlias = ExMap[i].LocalTokenNumber;
return;
(MatchGuidIdx == ExMap[i].ExGuidIndex)) {
return ExMap[i].LocalTokenNumber + PEI_LOCAL_TOKEN_NUMBER;
}
}
ASSERT (FALSE);
return;
return 0;
}

View File

@ -66,7 +66,8 @@ ExSetWorker (
VOID *
GetWorker (
PCD_TOKEN_NUMBER TokenNumber
PCD_TOKEN_NUMBER TokenNumber,
UINTN GetSize
)
;
@ -115,21 +116,12 @@ BuildPcdDxeDataBase (
);
typedef struct {
UINTN TokenNumber;
UINTN Size;
UINT32 LocalTokenNumberAlias;
BOOLEAN IsPeiDb;
} EX_PCD_ENTRY_ATTRIBUTE;
VOID
GetExPcdTokenAttributes (
PCD_TOKEN_NUMBER
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
IN PCD_TOKEN_NUMBER ExTokenNumber,
OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr
IN PCD_TOKEN_NUMBER ExTokenNumber
)
;
//
// Protocol Interface function declaration.
//
@ -407,16 +399,6 @@ DxePcdGetNextToken (
)
;
EFI_STATUS
SetWorkerByLocalTokenNumber (
UINT32 LocalTokenNumber,
VOID *Data,
UINTN Size,
BOOLEAN PtrType,
BOOLEAN IsPeiDb
)
;
PCD_TOKEN_NUMBER
ExGetNextTokeNumber (
IN CONST EFI_GUID *Guid,

View File

@ -255,11 +255,7 @@ PeiPcdGetSizeEx (
IN PCD_TOKEN_NUMBER ExTokenNumber
)
{
EX_PCD_ENTRY_ATTRIBUTE Attr;
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
return Attr.Size;
return PeiPcdGetSize (GetExPcdTokenNumber (Guid, ExTokenNumber));
}

View File

@ -30,7 +30,7 @@ Module Name: Service.c
--*/
EFI_STATUS
PeiRegisterCallBackWorker (
IN UINTN ExTokenNumber,
IN PCD_TOKEN_NUMBER ExTokenNumber,
IN CONST EFI_GUID *Guid, OPTIONAL
IN PCD_PPI_CALLBACK CallBackFunction,
IN BOOLEAN Register
@ -41,20 +41,19 @@ PeiRegisterCallBackWorker (
PCD_PPI_CALLBACK Compare;
PCD_PPI_CALLBACK Assign;
UINT32 LocalTokenNumber;
UINTN TokenNumber;
PCD_TOKEN_NUMBER TokenNumber;
UINTN Idx;
EX_PCD_ENTRY_ATTRIBUTE Attr;
if (Guid == NULL) {
TokenNumber = ExTokenNumber;
ASSERT (TokenNumber < PEI_NEX_TOKEN_NUMBER);
LocalTokenNumber = GetPcdDatabase()->Init.LocalTokenNumberTable[TokenNumber];
} else {
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
TokenNumber = Attr.TokenNumber;
LocalTokenNumber = Attr.LocalTokenNumberAlias;
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
}
LocalTokenNumber = GetPcdDatabase()->Init.LocalTokenNumberTable[TokenNumber];
ASSERT ((LocalTokenNumber & PCD_TYPE_HII) == 0);
ASSERT ((LocalTokenNumber & PCD_TYPE_VPD) == 0);
@ -267,16 +266,22 @@ InvokeCallbackOnSet (
}
EFI_STATUS
SetWorker (
UINTN TokenNumber,
VOID *Data,
UINTN Size,
BOOLEAN PtrType
PCD_TOKEN_NUMBER TokenNumber,
VOID *Data,
UINTN Size,
BOOLEAN PtrType
)
{
UINT32 LocalTokenNumber;
PEI_PCD_DATABASE *PeiPcdDb;
UINT16 StringTableIdx;
UINTN Offset;
VOID *InternalData;
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
@ -290,71 +295,21 @@ SetWorker (
ASSERT (PeiPcdDb->Init.SizeTable[TokenNumber] == Size);
}
InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
//
// We only invoke the callback function for Dynamic Type PCD Entry.
// 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) {
InvokeCallbackOnSet (0, NULL, TokenNumber, Data, Size);
}
return SetWorkerByLocalTokenNumber (LocalTokenNumber, Data, Size, PtrType);
}
EFI_STATUS
ExSetWorker (
IN UINT32 ExTokenNumber,
IN CONST EFI_GUID *Guid,
VOID *Data,
UINTN Size,
BOOLEAN PtrType
)
{
PEI_PCD_DATABASE *PeiPcdDb;
EX_PCD_ENTRY_ATTRIBUTE Attr;
PeiPcdDb = GetPcdDatabase ();
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
ASSERT (!PtrType && Attr.Size);
ASSERT (PtrType && Attr.Size >= Size);
InvokeCallbackOnSet (ExTokenNumber, Guid, Attr.TokenNumber, Data, Size);
SetWorkerByLocalTokenNumber (Attr.LocalTokenNumberAlias, Data, Size, PtrType);
return EFI_SUCCESS;
}
EFI_STATUS
SetWorkerByLocalTokenNumber (
UINT32 LocalTokenNumber,
VOID *Data,
UINTN Size,
BOOLEAN PtrType
)
{
PEI_PCD_DATABASE *PeiPcdDb;
UINT8 *PeiPcdDbRaw;
UINT16 StringTableIdx;
UINTN Offset;
VOID *InternalData;
PeiPcdDb = GetPcdDatabase ();
PeiPcdDbRaw = (UINT8 *) PeiPcdDb;
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size);
}
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
InternalData = (VOID *) (PeiPcdDbRaw + Offset);
InternalData = (VOID *) ((UINT8 *) PeiPcdDb + Offset);
switch (LocalTokenNumber & ~PCD_DATABASE_OFFSET_MASK) {
case PCD_TYPE_VPD:
@ -404,14 +359,53 @@ SetWorkerByLocalTokenNumber (
ASSERT (FALSE);
return EFI_NOT_FOUND;
}
EFI_STATUS
ExSetWorker (
IN PCD_TOKEN_NUMBER ExTokenNumber,
IN CONST EFI_GUID *Guid,
VOID *Data,
UINTN Size,
BOOLEAN PtrType
)
{
PCD_TOKEN_NUMBER TokenNumber;
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
InvokeCallbackOnSet (ExTokenNumber, Guid, TokenNumber, Data, Size);
SetWorker (TokenNumber, Data, Size, PtrType);
return EFI_SUCCESS;
}
VOID *
GetWorkerByLocalTokenNumber (
PEI_PCD_DATABASE *PeiPcdDb,
UINT32 LocalTokenNumber,
UINTN Size
ExGetWorker (
IN CONST EFI_GUID *Guid,
IN PCD_TOKEN_NUMBER ExTokenNumber,
IN UINTN GetSize
)
{
return GetWorker (GetExPcdTokenNumber (Guid, ExTokenNumber), GetSize);
}
VOID *
GetWorker (
PCD_TOKEN_NUMBER TokenNumber,
UINTN GetSize
)
{
UINT32 Offset;
@ -423,9 +417,20 @@ GetWorkerByLocalTokenNumber (
VOID *Data;
UINT16 *StringTable;
UINT16 StringTableIdx;
PEI_PCD_DATABASE *PeiPcdDb;
UINT32 LocalTokenNumber;
UINTN Size;
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
Size = PeiPcdGetSize(TokenNumber);
ASSERT (GetSize == Size || GetSize == 0);
PeiPcdDb = GetPcdDatabase ();
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, Size);
}
@ -476,72 +481,39 @@ GetWorkerByLocalTokenNumber (
}
VOID *
ExGetWorker (
IN CONST EFI_GUID *Guid,
IN UINT32 ExTokenNumber,
IN UINTN GetSize
)
{
EX_PCD_ENTRY_ATTRIBUTE Attr;
GetExPcdTokenAttributes (Guid, ExTokenNumber, &Attr);
ASSERT ((GetSize == Attr.Size) || (GetSize == 0));
return GetWorkerByLocalTokenNumber (GetPcdDatabase(),
Attr.LocalTokenNumberAlias,
Attr.Size
);
}
VOID *
GetWorker (
UINTN TokenNumber,
UINTN GetSize
)
{
PEI_PCD_DATABASE *PeiPcdDb;
ASSERT (TokenNumber < PEI_LOCAL_TOKEN_NUMBER);
ASSERT (GetSize == PeiPcdGetSize (TokenNumber) || GetSize == 0);
PeiPcdDb = GetPcdDatabase ();
return GetWorkerByLocalTokenNumber (PeiPcdDb, PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber], GetSize);
}
VOID
GetExPcdTokenAttributes (
PCD_TOKEN_NUMBER
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
IN UINT32 ExTokenNumber,
OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr
IN UINT32 ExTokenNumber
)
{
UINT32 i;
DYNAMICEX_MAPPING *ExMap;
EFI_GUID *GuidTable;
EFI_GUID *MatchGuid;
UINTN MatchGuidIdx;
PEI_PCD_DATABASE *PeiPcdDb;
PeiPcdDb = GetPcdDatabase();
ExMap = PeiPcdDb->Init.ExMapTable;
GuidTable = PeiPcdDb->Init.GuidTable;
MatchGuid = ScanGuid (GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
ASSERT (MatchGuid != NULL);
MatchGuidIdx = MatchGuid - GuidTable;
for (i = 0; i < PEI_EXMAPPING_TABLE_SIZE; i++) {
if ((ExTokenNumber == ExMap[i].ExTokenNumber) &&
CompareGuid (Guid, (CONST EFI_GUID *) &GuidTable[ExMap[i].ExGuidIndex])) {
ExAttr->TokenNumber = i + PEI_NEX_TOKEN_NUMBER;
ExAttr->Size = PeiPcdDb->Init.SizeTable[i + PEI_NEX_TOKEN_NUMBER];
ExAttr->LocalTokenNumberAlias = ExMap[i].LocalTokenNumber;
(MatchGuidIdx == ExMap[i].ExGuidIndex)) {
return ExMap[i].LocalTokenNumber;
}
}
ASSERT (FALSE);
return;
return 0;
}

View File

@ -49,15 +49,6 @@ SetWorker (
)
;
EFI_STATUS
SetWorkerByLocalTokenNumber (
IN UINT32 LocalTokenNumber,
IN VOID *Data,
IN UINTN Size,
IN BOOLEAN PtrType
)
;
EFI_STATUS
ExSetWorker (
IN PCD_TOKEN_NUMBER ExTokenNumber,
@ -89,11 +80,11 @@ typedef struct {
UINT32 LocalTokenNumberAlias;
} EX_PCD_ENTRY_ATTRIBUTE;
VOID
GetExPcdTokenAttributes (
PCD_TOKEN_NUMBER
GetExPcdTokenNumber (
IN CONST EFI_GUID *Guid,
IN PCD_TOKEN_NUMBER ExTokenNumber,
OUT EX_PCD_ENTRY_ATTRIBUTE *ExAttr
IN PCD_TOKEN_NUMBER ExTokenNumber
)
;