MdePkg and MdeModulePkg Pcd: Implement PCD Driver for External PCD Database and SKU enable Feature.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Bob C Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14857 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
All Pcd Ppi services are implemented here.
|
||||
|
||||
Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -116,7 +116,7 @@ PcdPeimInit (
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
BuildPcdDatabase ();
|
||||
BuildPcdDatabase (FileHandle);
|
||||
|
||||
//
|
||||
// Install PCD_PPI and EFI_PEI_PCD_PPI.
|
||||
@@ -155,7 +155,7 @@ PeiPcdSetSku (
|
||||
)
|
||||
{
|
||||
|
||||
GetPcdDatabase()->Init.SystemSkuId = (SKU_ID) SkuId;
|
||||
GetPcdDatabase()->SystemSkuId = (SKU_ID) SkuId;
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -304,8 +304,10 @@ PeiPcdGetSize (
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
UINTN Size;
|
||||
UINTN MaxSize;
|
||||
UINT32 LocalTokenCount;
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
@@ -316,9 +318,9 @@ PeiPcdGetSize (
|
||||
// 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 (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||
|
||||
Size = (PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
|
||||
Size = (*((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber) & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
|
||||
|
||||
if (Size == 0) {
|
||||
//
|
||||
@@ -926,10 +928,8 @@ PcdUnRegisterCallBackOnSet (
|
||||
is being made to retrieve tokens from the default token space.
|
||||
@param[in, out] TokenNumber A pointer to the PCD token number to use to find the subsequent token number.
|
||||
|
||||
@retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
|
||||
Or the input token number is already the last valid token number in the PCD database.
|
||||
In the later case, *TokenNumber is updated with the value of 0.
|
||||
@retval EFI_NOT_FOUND If this input token number and token namespace does not exist on the platform.
|
||||
@retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
|
||||
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -942,55 +942,56 @@ PeiPcdGetNextToken (
|
||||
UINTN GuidTableIdx;
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
EFI_GUID *MatchGuid;
|
||||
EFI_GUID *GuidTable;
|
||||
DYNAMICEX_MAPPING *ExMapTable;
|
||||
UINTN Index;
|
||||
BOOLEAN Found;
|
||||
BOOLEAN PeiExMapTableEmpty;
|
||||
UINTN PeiNexTokenNumber;
|
||||
|
||||
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
PeiNexTokenNumber = PeiPcdDb->LocalTokenCount - PeiPcdDb->ExTokenCount;
|
||||
GuidTable = (EFI_GUID *)((UINT8 *)PeiPcdDb + PeiPcdDb->GuidTableOffset);
|
||||
|
||||
if (PeiPcdDb->ExTokenCount == 0) {
|
||||
PeiExMapTableEmpty = TRUE;
|
||||
} else {
|
||||
PeiExMapTableEmpty = FALSE;
|
||||
}
|
||||
if (Guid == NULL) {
|
||||
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
|
||||
if (*TokenNumber > PeiNexTokenNumber) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
(*TokenNumber)++;
|
||||
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
|
||||
if (*TokenNumber > PeiNexTokenNumber) {
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
if (PeiExMapTableEmpty) {
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
|
||||
// 1) ExGuid
|
||||
// 2) ExTokenNumber
|
||||
//
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
|
||||
MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
|
||||
|
||||
if (MatchGuid == NULL) {
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
|
||||
MatchGuid = ScanGuid (GuidTable, PeiPcdDb->GuidTableCount * sizeof(EFI_GUID), Guid);
|
||||
|
||||
ExMapTable = PeiPcdDb->Init.ExMapTable;
|
||||
if (MatchGuid == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
GuidTableIdx = MatchGuid - GuidTable;
|
||||
|
||||
ExMapTable = (DYNAMICEX_MAPPING *)((UINT8 *)PeiPcdDb + PeiPcdDb->ExMapTableOffset);
|
||||
|
||||
Found = FALSE;
|
||||
//
|
||||
// Locate the GUID in ExMapTable first.
|
||||
//
|
||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
||||
for (Index = 0; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||
Found = TRUE;
|
||||
break;
|
||||
@@ -1003,26 +1004,28 @@ PeiPcdGetNextToken (
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
for ( ; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
||||
for ( ; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||
if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {
|
||||
Index++;
|
||||
if (Index == PEI_EXMAPPING_TABLE_SIZE) {
|
||||
//
|
||||
// Exceed the length of ExMap Table
|
||||
//
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||
*TokenNumber = ExMapTable[Index].ExTokenNumber;
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (Index < PeiPcdDb->ExTokenCount) {
|
||||
Index++;
|
||||
if (Index == PeiPcdDb->ExTokenCount) {
|
||||
//
|
||||
// Exceed the length of ExMap Table
|
||||
//
|
||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||
return EFI_NOT_FOUND;
|
||||
} else if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||
//
|
||||
// Found the next match
|
||||
//
|
||||
*TokenNumber = ExMapTable[Index].ExTokenNumber;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1032,22 +1035,17 @@ PeiPcdGetNextToken (
|
||||
/**
|
||||
Retrieves the next valid PCD token namespace for a given namespace.
|
||||
|
||||
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates
|
||||
a known token namespace from which the search will start. On output,
|
||||
it designates the next valid token namespace on the platform. If the input
|
||||
token namespace does not exist on the platform, an error is returned and
|
||||
the value of *Guid is undefined. If *Guid is NULL, then the GUID of the
|
||||
first token space of the current platform is assigned to *Guid the function
|
||||
return EFI_SUCCESS. If *Guid is NULL and there is no namespace exist in
|
||||
the platform other than the default (NULL) tokennamespace, *Guid is unchanged
|
||||
and the function return EFI_SUCCESS. If this input token namespace is the last
|
||||
namespace on the platform, *Guid will be assigned to NULL and the function return
|
||||
EFI_SUCCESS.
|
||||
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
|
||||
token namespaces on a platform.
|
||||
|
||||
@retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
|
||||
Or the input token space Guid is already the last valid token space Guid
|
||||
in the PCD database. In the later case, *Guid is updated with the value of NULL.
|
||||
@retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
|
||||
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
|
||||
namespace from which the search will start. On output, it designates the next valid
|
||||
token namespace on the platform. If *Guid is NULL, then the GUID of the first token
|
||||
space of the current platform is returned. If the search cannot locate the next valid
|
||||
token namespace, an error is returned and the value of *Guid is undefined.
|
||||
|
||||
@retval EFI_SUCCESS The PCD service retrieved the value requested.
|
||||
@retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
@@ -1061,8 +1059,10 @@ PeiPcdGetNextTokenSpace (
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
DYNAMICEX_MAPPING *ExMapTable;
|
||||
UINTN Index;
|
||||
UINTN Index2;
|
||||
BOOLEAN Found;
|
||||
BOOLEAN PeiExMapTableEmpty;
|
||||
EFI_GUID *GuidTable;
|
||||
|
||||
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
@@ -1070,43 +1070,39 @@ PeiPcdGetNextTokenSpace (
|
||||
|
||||
ASSERT (Guid != NULL);
|
||||
|
||||
PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
|
||||
|
||||
if (PeiExMapTableEmpty) {
|
||||
if (*Guid != NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
} else {
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Assume PCD Database AutoGen tool is sorting the ExMap based on the following order
|
||||
// 1) ExGuid
|
||||
// 2) ExTokenNumber
|
||||
//
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
|
||||
ExMapTable = PeiPcdDb->Init.ExMapTable;
|
||||
if (PeiPcdDb->ExTokenCount == 0) {
|
||||
PeiExMapTableEmpty = TRUE;
|
||||
} else {
|
||||
PeiExMapTableEmpty = FALSE;
|
||||
}
|
||||
|
||||
if (PeiExMapTableEmpty) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
ExMapTable = (DYNAMICEX_MAPPING *)((UINT8 *)PeiPcdDb + PeiPcdDb->ExMapTableOffset);
|
||||
GuidTable = (EFI_GUID *)((UINT8 *)PeiPcdDb + PeiPcdDb->GuidTableOffset);
|
||||
|
||||
if (*Guid == NULL) {
|
||||
//
|
||||
// return the first Token Space Guid.
|
||||
//
|
||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
|
||||
*Guid = GuidTable + ExMapTable[0].ExGuidIndex;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
MatchGuid = ScanGuid (PeiPcdDb->Init.GuidTable, sizeof(PeiPcdDb->Init.GuidTable), *Guid);
|
||||
MatchGuid = ScanGuid (GuidTable, PeiPcdDb->GuidTableCount * sizeof(GuidTable[0]), *Guid);
|
||||
|
||||
if (MatchGuid == NULL) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
|
||||
GuidTableIdx = MatchGuid - GuidTable;
|
||||
|
||||
Found = FALSE;
|
||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
||||
for (Index = 0; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||
Found = TRUE;
|
||||
break;
|
||||
@@ -1115,14 +1111,25 @@ PeiPcdGetNextTokenSpace (
|
||||
|
||||
if (Found) {
|
||||
Index++;
|
||||
for ( ; Index < PEI_EXMAPPING_TABLE_SIZE; Index++ ) {
|
||||
if (ExMapTable[Index].ExGuidIndex != GuidTableIdx ) {
|
||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[Index].ExGuidIndex];
|
||||
return EFI_SUCCESS;
|
||||
for ( ; Index < PeiPcdDb->ExTokenCount; Index++ ) {
|
||||
if (ExMapTable[Index].ExGuidIndex != GuidTableIdx) {
|
||||
Found = FALSE;
|
||||
for (Index2 = 0 ; Index2 < Index; Index2++) {
|
||||
if (ExMapTable[Index2].ExGuidIndex == ExMapTable[Index].ExGuidIndex) {
|
||||
//
|
||||
// This token namespace should have been found and output at preceding getting.
|
||||
//
|
||||
Found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!Found) {
|
||||
*Guid = (EFI_GUID *)((UINT8 *)PeiPcdDb + PeiPcdDb->GuidTableOffset) + ExMapTable[Index].ExGuidIndex;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
*Guid = NULL;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
return EFI_NOT_FOUND;
|
||||
@@ -1132,7 +1139,7 @@ PeiPcdGetNextTokenSpace (
|
||||
/**
|
||||
Get PCD value's size for POINTER type PCD.
|
||||
|
||||
The POINTER type PCD's value will be stored into a buffer in specificed size.
|
||||
The POINTER type PCD's value will be stored into a buffer in specified size.
|
||||
The max size of this PCD's value is described in PCD's definition in DEC file.
|
||||
|
||||
@param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
|
||||
@@ -1157,11 +1164,11 @@ GetPtrTypeSize (
|
||||
|
||||
SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
|
||||
|
||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||
|
||||
ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
|
||||
|
||||
SizeTable = Database->Init.SizeTable;
|
||||
SizeTable = (SIZE_INFO *)((UINT8 *)Database + Database->SizeTableOffset);
|
||||
|
||||
*MaxSize = SizeTable[SizeTableIdx];
|
||||
//
|
||||
@@ -1170,8 +1177,9 @@ GetPtrTypeSize (
|
||||
//
|
||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
||||
//
|
||||
// We have only one entry for VPD enabled PCD entry:
|
||||
// We have only two entry for VPD enabled PCD entry:
|
||||
// 1) MAX Size.
|
||||
// 2) Current Size
|
||||
// We consider current size is equal to MAX size.
|
||||
//
|
||||
return *MaxSize;
|
||||
@@ -1191,7 +1199,7 @@ GetPtrTypeSize (
|
||||
//
|
||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||
if (SkuIdTable[1 + Index] == Database->Init.SystemSkuId) {
|
||||
if (SkuIdTable[1 + Index] == Database->SystemSkuId) {
|
||||
return SizeTable[SizeTableIdx + 1 + Index];
|
||||
}
|
||||
}
|
||||
@@ -1203,7 +1211,7 @@ GetPtrTypeSize (
|
||||
/**
|
||||
Set PCD value's size for POINTER type PCD.
|
||||
|
||||
The POINTER type PCD's value will be stored into a buffer in specificed size.
|
||||
The POINTER type PCD's value will be stored into a buffer in specified size.
|
||||
The max size of this PCD's value is described in PCD's definition in DEC file.
|
||||
|
||||
@param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
|
||||
@@ -1230,11 +1238,11 @@ SetPtrTypeSize (
|
||||
|
||||
SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
|
||||
|
||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||
|
||||
ASSERT ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER);
|
||||
|
||||
SizeTable = Database->Init.SizeTable;
|
||||
|
||||
SizeTable = (SIZE_INFO *)((UINT8 *)Database + Database->SizeTableOffset);
|
||||
|
||||
MaxSize = SizeTable[SizeTableIdx];
|
||||
//
|
||||
@@ -1270,7 +1278,7 @@ SetPtrTypeSize (
|
||||
//
|
||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||
if (SkuIdTable[1 + Index] == Database->Init.SystemSkuId) {
|
||||
if (SkuIdTable[1 + Index] == Database->SystemSkuId) {
|
||||
SizeTable[SizeTableIdx + 1 + Index] = (SIZE_INFO) *CurrentSize;
|
||||
return TRUE;
|
||||
}
|
||||
|
@@ -1,6 +1,7 @@
|
||||
## @file
|
||||
# PCD PEIM produces PCD database to manage all dynamic PCD in PEI phase and install Pcd Ppi service.
|
||||
#
|
||||
# This version PCD PEIM depends on the external PCD database binary file, not built in PCD data base.
|
||||
# There are two PCD PPIs as follows:
|
||||
# 1) PCD_PPI
|
||||
# It is EDKII implementation which support Dynamic/DynamicEx Pcds.
|
||||
@@ -8,6 +9,10 @@
|
||||
# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
|
||||
# type Pcd.
|
||||
# For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI.
|
||||
# PCD PEIM driver will produce above two PPIs at same time.
|
||||
#
|
||||
# PCD database is generated as the separate binary image at build time. The binary image
|
||||
# will be intergrated into Firmware volume together with PCD driver.
|
||||
#
|
||||
# ////////////////////////////////////////////////////////////////////////////////
|
||||
# // //
|
||||
@@ -58,7 +63,7 @@
|
||||
# b) Variable Storage:
|
||||
# - The PCD value is stored in variable area.
|
||||
# - As default storage type, this type PCD could be used for PEI/DXE driver
|
||||
# communication. But beside it, this type PCD could alsp be used to store
|
||||
# communication. But beside it, this type PCD could also be used to store
|
||||
# the value associate with a HII setting via variable interface.
|
||||
# - In PEI phase, the PCD value could only be got but can not be set due
|
||||
# to variable area is readonly.
|
||||
@@ -89,12 +94,12 @@
|
||||
# PCD information used in PEI phase or use in both PEI/DXE phase. And DXE PCD
|
||||
# database contains all PCDs used in PEI/DXE phase in memory.
|
||||
#
|
||||
# Build tool will generate PCD database into some C structure and variable for
|
||||
# Build tool will generate PCD database into the separate binary file for
|
||||
# PEI/DXE PCD driver according to dynamic PCD section in platform DSC file.
|
||||
#
|
||||
# 3.1 PcdPeim and PcdDxe
|
||||
# PEI PCD database is maintained by PcdPeim driver run from flash. PcdPeim driver
|
||||
# build guid hob in temporary memory and copy auto-generated C structure
|
||||
# build guid hob in temporary memory and copy the binary data base from flash
|
||||
# to temporary memory for PEI PCD database.
|
||||
# DXE PCD database is maintained by PcdDxe driver.At entry point of PcdDxe driver,
|
||||
# a new PCD database is allocated in boot-time memory which including all
|
||||
@@ -180,8 +185,10 @@
|
||||
# Based on local token number, PCD driver could fast determine PCD type, value
|
||||
# type and get PCD entry from PCD database.
|
||||
#
|
||||
# 3.3 PCD Database C structure.
|
||||
# PCD Database C structure is generated by build tools in PCD driver's autogen.h/
|
||||
# 3.3 PCD Database binary file
|
||||
# PCD Database binary file will be created at build time as the standalone binary image.
|
||||
# To understand the binary image layout, PCD Database C structure is still generated
|
||||
# as comments by build tools in PCD driver's autogen.h/
|
||||
# autogen.c file. In generated C structure, following information is stored:
|
||||
# - ExMapTable: This table is used translate a binary dynamicex type PCD's
|
||||
# "tokenguid + token" to local token number.
|
||||
@@ -190,7 +197,7 @@
|
||||
# token number" as array index to get PCD entry's offset fastly.
|
||||
# - SizeTable: This table stores the size information for all PCD entry.
|
||||
# - GuidTable: This table stores guid value for DynamicEx's token space,
|
||||
# HII type PCD's variable.
|
||||
# HII type PCD's variable GUID.
|
||||
# - SkuIdTable: TBD
|
||||
# - SystemSkuId: TBD
|
||||
# - PCD value structure:
|
||||
@@ -271,7 +278,7 @@
|
||||
# - Variable GUID for HII type PCD
|
||||
# - Token space GUID for dynamicex type PCD
|
||||
#
|
||||
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -288,7 +295,7 @@
|
||||
BASE_NAME = PcdPeim
|
||||
FILE_GUID = 9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50
|
||||
MODULE_TYPE = PEIM
|
||||
VERSION_STRING = 1.0
|
||||
VERSION_STRING = 4.0
|
||||
PCD_IS_DRIVER = PEI_PCD_DRIVER
|
||||
ENTRY_POINT = PcdPeimInit
|
||||
|
||||
@@ -317,20 +324,22 @@
|
||||
DebugLib
|
||||
|
||||
[Guids]
|
||||
gPcdDataBaseHobGuid ## PRODUCES ## Hob
|
||||
gPcdDataBaseHobGuid ## CONSUMES ## Hob
|
||||
## PRODUCES ## HOB
|
||||
## SOMETIMES_CONSUMES ## HOB
|
||||
gPcdDataBaseHobGuid
|
||||
gPcdDataBaseSignatureGuid ## CONSUMES ## UNDEFINED # PCD database signature GUID.
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES
|
||||
gEfiPeiReadOnlyVariable2PpiGuid ## SOMETIMES_CONSUMES
|
||||
gPcdPpiGuid ## PRODUCES
|
||||
gEfiPeiPcdPpiGuid ## PRODUCES
|
||||
|
||||
[FeaturePcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable ## CONSUMES
|
||||
|
||||
[Pcd]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry || gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry || gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable ## SOMETIMES_CONSUMES
|
||||
|
||||
[Depex]
|
||||
TRUE
|
||||
|
@@ -2,7 +2,7 @@
|
||||
The driver internal functions are implmented here.
|
||||
They build Pei PCD database, and provide access service to PCD database.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -43,25 +43,30 @@ PeiRegisterCallBackWorker (
|
||||
PCD_PPI_CALLBACK Compare;
|
||||
PCD_PPI_CALLBACK Assign;
|
||||
UINT32 LocalTokenNumber;
|
||||
UINT32 LocalTokenCount;
|
||||
UINTN PeiNexTokenNumber;
|
||||
UINTN TokenNumber;
|
||||
UINTN Idx;
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
|
||||
PeiPcdDb = GetPcdDatabase();
|
||||
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||
PeiNexTokenNumber = PeiPcdDb->LocalTokenCount - PeiPcdDb->ExTokenCount;
|
||||
|
||||
if (Guid == NULL) {
|
||||
TokenNumber = ExTokenNumber;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
ASSERT (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1);
|
||||
ASSERT (TokenNumber + 1 < (PeiNexTokenNumber + 1));
|
||||
} else {
|
||||
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
|
||||
if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
// We have to decrement TokenNumber by 1 to make it usable
|
||||
@@ -71,11 +76,11 @@ PeiRegisterCallBackWorker (
|
||||
// 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 ((TokenNumber + 1) < (LocalTokenCount + 1));
|
||||
}
|
||||
|
||||
|
||||
LocalTokenNumber = GetPcdDatabase()->Init.LocalTokenNumberTable[TokenNumber];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber);
|
||||
|
||||
//
|
||||
// We don't support SET for HII and VPD type PCD entry in PEI phase.
|
||||
@@ -105,29 +110,74 @@ PeiRegisterCallBackWorker (
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Find the Pcd database.
|
||||
|
||||
@param FileHandle Handle of the file the external PCD database binary located.
|
||||
|
||||
@retval The base address of external PCD database binary.
|
||||
@retval NULL Return NULL if not find.
|
||||
**/
|
||||
VOID *
|
||||
LocateExPcdBinary (
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
VOID *PcdDb;
|
||||
|
||||
PcdDb = NULL;
|
||||
|
||||
ASSERT (FileHandle != NULL);
|
||||
|
||||
Status = PeiServicesFfsFindSectionData (EFI_SECTION_RAW, FileHandle, &PcdDb);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Check the first bytes (Header Signature Guid) and build version.
|
||||
//
|
||||
if (!CompareGuid (PcdDb, &gPcdDataBaseSignatureGuid) ||
|
||||
(((PEI_PCD_DATABASE *) PcdDb)->BuildVersion != PCD_SERVICE_PEIM_VERSION)) {
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
return PcdDb;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
The function builds the PCD database.
|
||||
|
||||
@param FileHandle Handle of the file the external PCD database binary located.
|
||||
|
||||
**/
|
||||
VOID
|
||||
BuildPcdDatabase (
|
||||
VOID
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||
)
|
||||
{
|
||||
PEI_PCD_DATABASE *Database;
|
||||
VOID *CallbackFnTable;
|
||||
UINTN SizeOfCallbackFnTable;
|
||||
|
||||
Database = BuildGuidHob (&gPcdDataBaseHobGuid, sizeof (PEI_PCD_DATABASE));
|
||||
|
||||
ZeroMem (Database, sizeof (PEI_PCD_DATABASE));
|
||||
PEI_PCD_DATABASE *Database;
|
||||
PEI_PCD_DATABASE *PeiPcdDbBinary;
|
||||
VOID *CallbackFnTable;
|
||||
UINTN SizeOfCallbackFnTable;
|
||||
|
||||
//
|
||||
// gPEIPcdDbInit is smaller than PEI_PCD_DATABASE
|
||||
// Locate the external PCD database binary for one section of current FFS
|
||||
//
|
||||
|
||||
CopyMem (&Database->Init, &gPEIPcdDbInit, sizeof (gPEIPcdDbInit));
|
||||
PeiPcdDbBinary = LocateExPcdBinary (FileHandle);
|
||||
|
||||
SizeOfCallbackFnTable = PEI_LOCAL_TOKEN_NUMBER * sizeof (PCD_PPI_CALLBACK) * PcdGet32 (PcdMaxPeiPcdCallBackNumberPerPcdEntry);
|
||||
ASSERT(PeiPcdDbBinary != NULL);
|
||||
|
||||
Database = BuildGuidHob (&gPcdDataBaseHobGuid, PeiPcdDbBinary->Length + PeiPcdDbBinary->UninitDataBaseSize);
|
||||
|
||||
ZeroMem (Database, PeiPcdDbBinary->Length + PeiPcdDbBinary->UninitDataBaseSize);
|
||||
|
||||
//
|
||||
// PeiPcdDbBinary is smaller than Database
|
||||
//
|
||||
CopyMem (Database, PeiPcdDbBinary, PeiPcdDbBinary->Length);
|
||||
|
||||
SizeOfCallbackFnTable = Database->LocalTokenCount * sizeof (PCD_PPI_CALLBACK) * PcdGet32 (PcdMaxPeiPcdCallBackNumberPerPcdEntry);
|
||||
|
||||
CallbackFnTable = BuildGuidHob (&gEfiCallerIdGuid, SizeOfCallbackFnTable);
|
||||
|
||||
@@ -215,6 +265,7 @@ GetSkuEnabledTokenNumber (
|
||||
SKU_ID *SkuIdTable;
|
||||
INTN Index;
|
||||
UINT8 *Value;
|
||||
BOOLEAN FoundSku;
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
|
||||
@@ -223,13 +274,30 @@ GetSkuEnabledTokenNumber (
|
||||
SkuHead = (SKU_HEAD *) ((UINT8 *)PeiPcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
|
||||
Value = (UINT8 *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuDataStartOffset));
|
||||
SkuIdTable = (SKU_ID *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuIdTableOffset));
|
||||
|
||||
|
||||
//
|
||||
// Find the current system's SKU ID entry in SKU ID table.
|
||||
//
|
||||
FoundSku = FALSE;
|
||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||
if (PeiPcdDb->Init.SystemSkuId == SkuIdTable[Index + 1]) {
|
||||
if (PeiPcdDb->SystemSkuId == SkuIdTable[Index + 1]) {
|
||||
FoundSku = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Find the default SKU ID entry in SKU ID table.
|
||||
//
|
||||
if(!FoundSku) {
|
||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||
if (0 == SkuIdTable[Index + 1]) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ASSERT (Index < SkuIdTable[0]);
|
||||
|
||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||
case PCD_TYPE_VPD:
|
||||
Value = (UINT8 *) &(((VPD_HEAD *) Value)[Index]);
|
||||
@@ -238,14 +306,18 @@ GetSkuEnabledTokenNumber (
|
||||
case PCD_TYPE_HII:
|
||||
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII);
|
||||
|
||||
|
||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII | PCD_TYPE_STRING);
|
||||
|
||||
case PCD_TYPE_STRING:
|
||||
Value = (UINT8 *) &(((STRING_HEAD *) Value)[Index]);
|
||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
|
||||
|
||||
case PCD_TYPE_DATA:
|
||||
Value += Size * Index;
|
||||
return (UINT32) (Value - (UINT8 *) PeiPcdDb);
|
||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_DATA);
|
||||
|
||||
default:
|
||||
ASSERT (FALSE);
|
||||
@@ -281,6 +353,8 @@ InvokeCallbackOnSet (
|
||||
EFI_HOB_GUID_TYPE *GuidHob;
|
||||
PCD_PPI_CALLBACK *CallbackTable;
|
||||
UINTN Idx;
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
UINT32 LocalTokenCount;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
@@ -288,12 +362,15 @@ InvokeCallbackOnSet (
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||
|
||||
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);
|
||||
ASSERT (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||
}
|
||||
|
||||
GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
|
||||
@@ -359,11 +436,13 @@ SetWorker (
|
||||
)
|
||||
{
|
||||
UINT32 LocalTokenNumber;
|
||||
UINTN PeiNexTokenNumber;
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
STRING_HEAD StringTableIdx;
|
||||
UINTN Offset;
|
||||
VOID *InternalData;
|
||||
UINTN MaxSize;
|
||||
UINT32 LocalTokenCount;
|
||||
|
||||
if (!FeaturePcdGet(PcdPeiFullPcdDatabaseEnable)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
@@ -375,15 +454,15 @@ SetWorker (
|
||||
// as the array index.
|
||||
//
|
||||
TokenNumber--;
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||
|
||||
// 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 ();
|
||||
ASSERT (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||
|
||||
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber);
|
||||
|
||||
if (PtrType) {
|
||||
//
|
||||
@@ -405,7 +484,8 @@ SetWorker (
|
||||
// For Dynamic EX PCD entry, we have invoked the callback function for Dynamic EX
|
||||
// type PCD entry in ExSetWorker.
|
||||
//
|
||||
if (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) {
|
||||
PeiNexTokenNumber = PeiPcdDb->LocalTokenCount - PeiPcdDb->ExTokenCount;
|
||||
if (TokenNumber + 1 < PeiNexTokenNumber + 1) {
|
||||
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
|
||||
}
|
||||
|
||||
@@ -433,7 +513,7 @@ SetWorker (
|
||||
case PCD_TYPE_STRING:
|
||||
if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
|
||||
StringTableIdx = *((STRING_HEAD *)InternalData);
|
||||
CopyMem (&PeiPcdDb->Init.StringTable[StringTableIdx], Data, *Size);
|
||||
CopyMem ((UINT8 *)PeiPcdDb + PeiPcdDb->StringTableOffset + StringTableIdx, Data, *Size);
|
||||
return EFI_SUCCESS;
|
||||
} else {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
@@ -503,7 +583,7 @@ ExSetValueWorker (
|
||||
}
|
||||
|
||||
/**
|
||||
Set value for a dynamic PCD entry.
|
||||
Set value for a dynamic-ex PCD entry.
|
||||
|
||||
This routine find the local token number according to dynamic-ex PCD's token
|
||||
space guid and token number firstly, and invoke callback function if this PCD
|
||||
@@ -598,6 +678,7 @@ GetWorker (
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
UINT32 LocalTokenNumber;
|
||||
UINTN MaxSize;
|
||||
UINT32 LocalTokenCount;
|
||||
|
||||
//
|
||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||
@@ -606,16 +687,17 @@ GetWorker (
|
||||
//
|
||||
TokenNumber--;
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||
|
||||
// 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 (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||
|
||||
ASSERT ((GetSize == PeiPcdGetSize(TokenNumber + 1)) || (GetSize == 0));
|
||||
|
||||
PeiPcdDb = GetPcdDatabase ();
|
||||
|
||||
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber);
|
||||
|
||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
||||
if (GetSize == 0) {
|
||||
@@ -627,8 +709,8 @@ GetWorker (
|
||||
}
|
||||
|
||||
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
||||
StringTable = PeiPcdDb->Init.StringTable;
|
||||
|
||||
StringTable = (UINT8 *)PeiPcdDb + PeiPcdDb->StringTableOffset;
|
||||
|
||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||
case PCD_TYPE_VPD:
|
||||
{
|
||||
@@ -642,7 +724,7 @@ GetWorker (
|
||||
{
|
||||
VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
|
||||
|
||||
Guid = &(PeiPcdDb->Init.GuidTable[VariableHead->GuidTableIndex]);
|
||||
Guid = (EFI_GUID *) ((UINT8 *)PeiPcdDb + PeiPcdDb->GuidTableOffset) + VariableHead->GuidTableIndex;
|
||||
Name = (UINT16*)&StringTable[VariableHead->StringIndex];
|
||||
|
||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||
@@ -681,16 +763,16 @@ GetWorker (
|
||||
}
|
||||
|
||||
/**
|
||||
Get local token number according to dynamic-ex PCD's {token space guid:token number}
|
||||
Get Token Number according to dynamic-ex PCD's {token space guid:token number}
|
||||
|
||||
A dynamic-ex type PCD, developer must provide pair of token space guid: token number
|
||||
in DEC file. PCD database maintain a mapping table that translate pair of {token
|
||||
space guid: token number} to local token number.
|
||||
space guid: token number} to Token Number.
|
||||
|
||||
@param Guid Token space guid for dynamic-ex PCD entry.
|
||||
@param ExTokenNumber EDES_TODO: Add parameter description
|
||||
@param ExTokenNumber Dynamic-ex PCD token number.
|
||||
|
||||
@return local token number for dynamic-ex PCD.
|
||||
@return Token Number for dynamic-ex PCD.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -707,11 +789,11 @@ GetExPcdTokenNumber (
|
||||
PEI_PCD_DATABASE *PeiPcdDb;
|
||||
|
||||
PeiPcdDb = GetPcdDatabase();
|
||||
|
||||
ExMap = PeiPcdDb->Init.ExMapTable;
|
||||
GuidTable = PeiPcdDb->Init.GuidTable;
|
||||
|
||||
MatchGuid = ScanGuid (GuidTable, sizeof(PeiPcdDb->Init.GuidTable), Guid);
|
||||
ExMap = (DYNAMICEX_MAPPING *)((UINT8 *)PeiPcdDb + PeiPcdDb->ExMapTableOffset);
|
||||
GuidTable = (EFI_GUID *)((UINT8 *)PeiPcdDb + PeiPcdDb->GuidTableOffset);
|
||||
|
||||
MatchGuid = ScanGuid (GuidTable, PeiPcdDb->GuidTableCount * sizeof(EFI_GUID), Guid);
|
||||
//
|
||||
// We need to ASSERT here. If GUID can't be found in GuidTable, this is a
|
||||
// error in the BUILD system.
|
||||
@@ -720,10 +802,10 @@ GetExPcdTokenNumber (
|
||||
|
||||
MatchGuidIdx = MatchGuid - GuidTable;
|
||||
|
||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
||||
for (Index = 0; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
||||
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
||||
return ExMap[Index].LocalTokenNumber;
|
||||
return ExMap[Index].TokenNumber;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -750,7 +832,7 @@ GetPcdDatabase (
|
||||
}
|
||||
|
||||
/**
|
||||
Get SKU ID tabble from PCD database.
|
||||
Get SKU ID table from PCD database.
|
||||
|
||||
@param LocalTokenNumberTableIdx Index of local token number in token number table.
|
||||
@param Database PCD database.
|
||||
@@ -767,7 +849,7 @@ GetSkuIdArray (
|
||||
SKU_HEAD *SkuHead;
|
||||
UINTN LocalTokenNumber;
|
||||
|
||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||
|
||||
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
|
||||
|
||||
@@ -793,14 +875,14 @@ GetSizeTableIndex (
|
||||
)
|
||||
{
|
||||
UINTN Index;
|
||||
UINTN SizeTableIdx;
|
||||
UINTN SizeTableIdx;
|
||||
UINTN LocalTokenNumber;
|
||||
SKU_ID *SkuIdTable;
|
||||
|
||||
SizeTableIdx = 0;
|
||||
|
||||
for (Index=0; Index<LocalTokenNumberTableIdx; Index++) {
|
||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[Index];
|
||||
for (Index = 0; Index < LocalTokenNumberTableIdx; Index++) {
|
||||
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + Index);
|
||||
|
||||
if ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER) {
|
||||
//
|
||||
@@ -809,11 +891,12 @@ GetSizeTableIndex (
|
||||
//
|
||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
||||
//
|
||||
// We have only one entry for VPD enabled PCD entry:
|
||||
// We have only two entry for VPD enabled PCD entry:
|
||||
// 1) MAX Size.
|
||||
// We consider current size is equal to MAX size.
|
||||
// 2) Current Size
|
||||
// Current size is equal to MAX size.
|
||||
//
|
||||
SizeTableIdx++;
|
||||
SizeTableIdx += 2;
|
||||
} else {
|
||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
|
||||
//
|
||||
|
@@ -1,7 +1,7 @@
|
||||
/** @file
|
||||
The internal header file declares the private functions used by PeiPcd driver.
|
||||
|
||||
Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||
This program and the accompanying materials
|
||||
are licensed and made available under the terms and conditions of the BSD License
|
||||
which accompanies this distribution. The full text of the license may be found at
|
||||
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#include <Ppi/Pcd.h>
|
||||
#include <Ppi/PiPcd.h>
|
||||
#include <Guid/PcdDataBaseHobGuid.h>
|
||||
#include <Guid/PcdDataBaseSignatureGuid.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/PeimEntryPoint.h>
|
||||
#include <Library/BaseLib.h>
|
||||
@@ -33,7 +34,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
// Please make sure the PCD Serivce PEIM Version is consistent with
|
||||
// the version of the generated PEIM PCD Database by build tool.
|
||||
//
|
||||
#define PCD_SERVICE_PEIM_VERSION 2
|
||||
#define PCD_SERVICE_PEIM_VERSION 4
|
||||
|
||||
//
|
||||
// PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.
|
||||
@@ -896,16 +897,16 @@ typedef struct {
|
||||
} EX_PCD_ENTRY_ATTRIBUTE;
|
||||
|
||||
/**
|
||||
Get local token number according to dynamic-ex PCD's {token space guid:token number}
|
||||
Get Token Number according to dynamic-ex PCD's {token space guid:token number}
|
||||
|
||||
A dynamic-ex type PCD, developer must provide pair of token space guid: token number
|
||||
in DEC file. PCD database maintain a mapping table that translate pair of {token
|
||||
space guid: token number} to local token number.
|
||||
space guid: token number} to Token Number.
|
||||
|
||||
@param Guid Token space guid for dynamic-ex PCD entry.
|
||||
@param ExTokenNumber Token number for dynamic-ex PCD.
|
||||
|
||||
@return local token number for dynamic-ex PCD.
|
||||
@return Token Number for dynamic-ex PCD.
|
||||
|
||||
**/
|
||||
UINTN
|
||||
@@ -938,10 +939,13 @@ PeiRegisterCallBackWorker (
|
||||
|
||||
/**
|
||||
The function builds the PCD database.
|
||||
|
||||
@param FileHandle Handle of the file the external PCD database binary located.
|
||||
|
||||
**/
|
||||
VOID
|
||||
BuildPcdDatabase (
|
||||
VOID
|
||||
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -1015,10 +1019,5 @@ SetPtrTypeSize (
|
||||
IN PEI_PCD_DATABASE *Database
|
||||
);
|
||||
|
||||
//
|
||||
// The init Database created by PCD Database generation tool
|
||||
//
|
||||
extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;
|
||||
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user