mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-29 08:34:07 +02:00
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:
parent
e8a47801a1
commit
419db80bef
147
MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h
Normal file
147
MdeModulePkg/Include/Guid/PcdDataBaseSignatureGuid.h
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
/** @file
|
||||||
|
Guid for Pcd DataBase Signature.
|
||||||
|
|
||||||
|
Copyright (c) 2012 - 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 that accompanies this distribution.
|
||||||
|
The full text of the license may be found at
|
||||||
|
http://opensource.org/licenses/bsd-license.php.
|
||||||
|
|
||||||
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _PCD_DATABASE_SIGNATURE_GUID_H_
|
||||||
|
#define _PCD_DATABASE_SIGNATURE_GUID_H_
|
||||||
|
|
||||||
|
#define PCD_DATA_BASE_SIGNATURE_GUID \
|
||||||
|
{ 0x3c7d193c, 0x682c, 0x4c14, { 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e } }
|
||||||
|
|
||||||
|
extern EFI_GUID gPcdDataBaseSignatureGuid;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Common definitions
|
||||||
|
//
|
||||||
|
typedef UINT8 SKU_ID;
|
||||||
|
|
||||||
|
#define PCD_TYPE_SHIFT 28
|
||||||
|
|
||||||
|
#define PCD_TYPE_DATA (0x0U << PCD_TYPE_SHIFT)
|
||||||
|
#define PCD_TYPE_HII (0x8U << PCD_TYPE_SHIFT)
|
||||||
|
#define PCD_TYPE_VPD (0x4U << PCD_TYPE_SHIFT)
|
||||||
|
#define PCD_TYPE_SKU_ENABLED (0x2U << PCD_TYPE_SHIFT)
|
||||||
|
#define PCD_TYPE_STRING (0x1U << PCD_TYPE_SHIFT)
|
||||||
|
|
||||||
|
#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)
|
||||||
|
|
||||||
|
#define PCD_DATUM_TYPE_SHIFT 24
|
||||||
|
|
||||||
|
#define PCD_DATUM_TYPE_POINTER (0x0U << PCD_DATUM_TYPE_SHIFT)
|
||||||
|
#define PCD_DATUM_TYPE_UINT8 (0x1U << PCD_DATUM_TYPE_SHIFT)
|
||||||
|
#define PCD_DATUM_TYPE_UINT16 (0x2U << PCD_DATUM_TYPE_SHIFT)
|
||||||
|
#define PCD_DATUM_TYPE_UINT32 (0x4U << PCD_DATUM_TYPE_SHIFT)
|
||||||
|
#define PCD_DATUM_TYPE_UINT64 (0x8U << PCD_DATUM_TYPE_SHIFT)
|
||||||
|
|
||||||
|
#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \
|
||||||
|
PCD_DATUM_TYPE_UINT8 | \
|
||||||
|
PCD_DATUM_TYPE_UINT16 | \
|
||||||
|
PCD_DATUM_TYPE_UINT32 | \
|
||||||
|
PCD_DATUM_TYPE_UINT64)
|
||||||
|
|
||||||
|
#define PCD_DATUM_TYPE_SHIFT2 20
|
||||||
|
|
||||||
|
#define PCD_DATUM_TYPE_UINT8_BOOLEAN (0x1U << PCD_DATUM_TYPE_SHIFT2)
|
||||||
|
|
||||||
|
#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET | PCD_DATUM_TYPE_UINT8_BOOLEAN))
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 ExTokenNumber;
|
||||||
|
UINT16 TokenNumber; // Token Number for Dynamic-Ex PCD.
|
||||||
|
UINT16 ExGuidIndex; // Index of GuidTable in units of GUID.
|
||||||
|
} DYNAMICEX_MAPPING;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 SkuDataStartOffset; // Offset(with TYPE info) from the PCD_DB.
|
||||||
|
UINT32 SkuIdTableOffset; // Offset from the PCD_DB.
|
||||||
|
} SKU_HEAD;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 StringIndex; // Offset in String Table in units of UINT8.
|
||||||
|
UINT32 DefaultValueOffset; // Offset of the Default Value.
|
||||||
|
UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
|
||||||
|
UINT16 Offset; // Offset in Variable.
|
||||||
|
} VARIABLE_HEAD;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 Offset;
|
||||||
|
} VPD_HEAD;
|
||||||
|
|
||||||
|
typedef UINT32 STRING_HEAD;
|
||||||
|
|
||||||
|
typedef UINT16 SIZE_INFO;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT32 TokenSpaceCNameIndex; // Offset in String Table in units of UINT8.
|
||||||
|
UINT32 PcdCNameIndex; // Offset in String Table in units of UINT8.
|
||||||
|
} PCD_NAME_INDEX;
|
||||||
|
|
||||||
|
typedef UINT32 TABLE_OFFSET;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
GUID Signature; // PcdDataBaseGuid.
|
||||||
|
UINT32 BuildVersion;
|
||||||
|
UINT32 Length;
|
||||||
|
UINT32 UninitDataBaseSize; // Total size for PCD those default value with 0.
|
||||||
|
TABLE_OFFSET LocalTokenNumberTableOffset;
|
||||||
|
TABLE_OFFSET ExMapTableOffset;
|
||||||
|
TABLE_OFFSET GuidTableOffset;
|
||||||
|
TABLE_OFFSET StringTableOffset;
|
||||||
|
TABLE_OFFSET SizeTableOffset;
|
||||||
|
TABLE_OFFSET SkuIdTableOffset;
|
||||||
|
TABLE_OFFSET PcdNameTableOffset;
|
||||||
|
UINT16 LocalTokenCount; // LOCAL_TOKEN_NUMBER for all.
|
||||||
|
UINT16 ExTokenCount; // EX_TOKEN_NUMBER for DynamicEx.
|
||||||
|
UINT16 GuidTableCount; // The Number of Guid in GuidTable.
|
||||||
|
SKU_ID SystemSkuId; // Current SkuId value.
|
||||||
|
UINT8 Pad; // Pad bytes to satisfy the alignment.
|
||||||
|
|
||||||
|
//
|
||||||
|
// Default initialized external PCD database binary structure
|
||||||
|
//
|
||||||
|
// Padding is needed to keep necessary alignment
|
||||||
|
//
|
||||||
|
//UINT64 ValueUint64[];
|
||||||
|
//UINT32 ValueUint32[];
|
||||||
|
//VPD_HEAD VpdHead[]; // VPD Offset
|
||||||
|
//DYNAMICEX_MAPPING ExMapTable[]; // DynamicEx PCD mapped to LocalIndex in LocalTokenNumberTable. It can be accessed by the ExMapTableOffset.
|
||||||
|
//UINT32 LocalTokenNumberTable[]; // Offset | DataType | PCD Type. It can be accessed by LocalTokenNumberTableOffset.
|
||||||
|
//GUID GuidTable[]; // GUID for DynamicEx and HII PCD variable Guid. It can be accessed by the GuidTableOffset.
|
||||||
|
//STRING_HEAD StringHead[]; // String PCD
|
||||||
|
//PCD_NAME_INDEX PcdNameTable[]; // PCD name index info. It can be accessed by the PcdNameTableOffset.
|
||||||
|
//VARIABLE_HEAD VariableHead[]; // HII PCD
|
||||||
|
//SKU_HEAD SkuHead[]; // Store SKU info for each PCD with SKU enable.
|
||||||
|
//UINT8 StringTable[]; // String for String PCD value and HII PCD Variable Name. It can be accessed by StringTableOffset.
|
||||||
|
//SIZE_INFO SizeTable[]; // MaxSize and CurSize for String PCD. It can be accessed by SizeTableOffset.
|
||||||
|
//UINT16 ValueUint16[];
|
||||||
|
//UINT8 ValueUint8[];
|
||||||
|
//BOOLEAN ValueBoolean[];
|
||||||
|
//UINT8 SkuIdTable[]; // SkuIds system supports.
|
||||||
|
//UINT8 SkuIndexTable[]; // SkuIds for each PCD with SKU enable.
|
||||||
|
|
||||||
|
} PCD_DATABASE_INIT;
|
||||||
|
|
||||||
|
//
|
||||||
|
// PEI and DXE Pcd driver use the same PCD database
|
||||||
|
//
|
||||||
|
typedef PCD_DATABASE_INIT PEI_PCD_DATABASE;
|
||||||
|
typedef PCD_DATABASE_INIT DXE_PCD_DATABASE;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
PEI_PCD_DATABASE *PeiDb;
|
||||||
|
DXE_PCD_DATABASE *DxeDb;
|
||||||
|
} PCD_DATABASE;
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -111,6 +111,10 @@
|
|||||||
# Include/Guid/PcdDataBaseHobGuid.h
|
# Include/Guid/PcdDataBaseHobGuid.h
|
||||||
gPcdDataBaseHobGuid = { 0xEA296D92, 0x0B69, 0x423C, { 0x8C, 0x28, 0x33, 0xB4, 0xE0, 0xA9, 0x12, 0x68 }}
|
gPcdDataBaseHobGuid = { 0xEA296D92, 0x0B69, 0x423C, { 0x8C, 0x28, 0x33, 0xB4, 0xE0, 0xA9, 0x12, 0x68 }}
|
||||||
|
|
||||||
|
## Guid for PCD DataBase signature.
|
||||||
|
# Include/Guid/PcdDataBaseSignatureGuid.h
|
||||||
|
gPcdDataBaseSignatureGuid = { 0x3c7d193c, 0x682c, 0x4c14, { 0xa6, 0x8f, 0x55, 0x2d, 0xea, 0x4f, 0x43, 0x7e }}
|
||||||
|
|
||||||
## Guid for EDKII implementation GUIDed opcodes
|
## Guid for EDKII implementation GUIDed opcodes
|
||||||
# Include/Guid/MdeModuleHii.h
|
# Include/Guid/MdeModuleHii.h
|
||||||
gEfiIfrTianoGuid = { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce }}
|
gEfiIfrTianoGuid = { 0xf0b1735, 0x87a0, 0x4193, {0xb2, 0x66, 0x53, 0x8c, 0x38, 0xaf, 0x48, 0xce }}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
produce the implementation of native PCD protocol and EFI_PCD_PROTOCOL defined in
|
produce the implementation of native PCD protocol and EFI_PCD_PROTOCOL defined in
|
||||||
PI 1.2 Vol3.
|
PI 1.2 Vol3.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -16,13 +16,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#include "Service.h"
|
#include "Service.h"
|
||||||
|
|
||||||
//
|
|
||||||
// Just pre-allocate a memory buffer that is big enough to
|
|
||||||
// host all distinct TokenSpace guid in both
|
|
||||||
// PEI ExMap and DXE ExMap.
|
|
||||||
//
|
|
||||||
EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE] = { 0 };
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// PCD database lock.
|
/// PCD database lock.
|
||||||
///
|
///
|
||||||
@ -170,7 +163,7 @@ DxePcdSetSku (
|
|||||||
IN UINTN SkuId
|
IN UINTN SkuId
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
mPcdDatabase->PeiDb.Init.SystemSkuId = (SKU_ID) SkuId;
|
mPcdDatabase.PeiDb->SystemSkuId = (SKU_ID) SkuId;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -336,18 +329,18 @@ DxePcdGetSize (
|
|||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < mPcdTotalTokenCount + 1);
|
||||||
|
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
IsPeiDb = (BOOLEAN) (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
IsPeiDb = (BOOLEAN) (TokenNumber + 1 < mPeiLocalTokenCount + 1);
|
||||||
|
|
||||||
TokenNumber = IsPeiDb ? TokenNumber :
|
TokenNumber = IsPeiDb ? TokenNumber :
|
||||||
(TokenNumber - PEI_LOCAL_TOKEN_NUMBER);
|
(TokenNumber - mPeiLocalTokenCount);
|
||||||
|
|
||||||
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable
|
LocalTokenNumberTable = IsPeiDb ? (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset)
|
||||||
: mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
: (UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);
|
||||||
|
|
||||||
Size = (LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
|
Size = (LocalTokenNumberTable[TokenNumber] & PCD_DATUM_TYPE_ALL_SET) >> PCD_DATUM_TYPE_SHIFT;
|
||||||
|
|
||||||
@ -971,10 +964,8 @@ DxeUnRegisterCallBackOnSet (
|
|||||||
@param[in, out] TokenNumber
|
@param[in, out] TokenNumber
|
||||||
A pointer to the PCD token number to use to find the subsequent token number.
|
A pointer to the PCD token number to use to find the subsequent token number.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
|
@retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
|
||||||
is already the last valid token number in the PCD database.
|
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -989,8 +980,8 @@ DxePcdGetNextToken (
|
|||||||
BOOLEAN DxeExMapTableEmpty;
|
BOOLEAN DxeExMapTableEmpty;
|
||||||
|
|
||||||
Status = EFI_NOT_FOUND;
|
Status = EFI_NOT_FOUND;
|
||||||
PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
|
PeiExMapTableEmpty = mPeiExMapTableEmpty;
|
||||||
DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;
|
DxeExMapTableEmpty = mDxeExMapTableEmpty;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Scan the local token space
|
// Scan the local token space
|
||||||
@ -999,27 +990,32 @@ DxePcdGetNextToken (
|
|||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
if (((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) && (*TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1)) ||
|
if (((*TokenNumber + 1 > mPeiNexTokenCount + 1) && (*TokenNumber + 1 <= mPeiLocalTokenCount + 1)) ||
|
||||||
((*TokenNumber + 1 > (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1)))) {
|
((*TokenNumber + 1 > (mPeiLocalTokenCount + mDxeNexTokenCount + 1)))) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
(*TokenNumber)++;
|
(*TokenNumber)++;
|
||||||
if ((*TokenNumber + 1 > PEI_NEX_TOKEN_NUMBER + 1) &&
|
if ((*TokenNumber + 1 > mPeiNexTokenCount + 1) &&
|
||||||
(*TokenNumber <= PEI_LOCAL_TOKEN_NUMBER)) {
|
(*TokenNumber + 1 <= mPeiLocalTokenCount + 1)) {
|
||||||
//
|
//
|
||||||
// The first Non-Ex type Token Number for DXE PCD
|
// The first Non-Ex type Token Number for DXE PCD
|
||||||
// database is PEI_LOCAL_TOKEN_NUMBER
|
// database is mPeiLocalTokenCount + 1
|
||||||
//
|
//
|
||||||
*TokenNumber = PEI_LOCAL_TOKEN_NUMBER;
|
if (mDxeNexTokenCount > 0) {
|
||||||
} else if (*TokenNumber + 1 > DXE_NEX_TOKEN_NUMBER + PEI_LOCAL_TOKEN_NUMBER + 1) {
|
*TokenNumber = mPeiLocalTokenCount + 1;
|
||||||
|
} else {
|
||||||
|
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
} else if (*TokenNumber + 1 > mDxeNexTokenCount + mPeiLocalTokenCount + 1) {
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
|
if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1027,10 +1023,10 @@ DxePcdGetNextToken (
|
|||||||
Status = ExGetNextTokeNumber (
|
Status = ExGetNextTokeNumber (
|
||||||
Guid,
|
Guid,
|
||||||
TokenNumber,
|
TokenNumber,
|
||||||
mPcdDatabase->PeiDb.Init.GuidTable,
|
(EFI_GUID *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset),
|
||||||
sizeof(mPcdDatabase->PeiDb.Init.GuidTable),
|
mPeiGuidTableSize,
|
||||||
mPcdDatabase->PeiDb.Init.ExMapTable,
|
(DYNAMICEX_MAPPING *)((UINT8 *) mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->ExMapTableOffset),
|
||||||
sizeof(mPcdDatabase->PeiDb.Init.ExMapTable)
|
mPeiExMapppingTableSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1042,10 +1038,10 @@ DxePcdGetNextToken (
|
|||||||
Status = ExGetNextTokeNumber (
|
Status = ExGetNextTokeNumber (
|
||||||
Guid,
|
Guid,
|
||||||
TokenNumber,
|
TokenNumber,
|
||||||
mPcdDatabase->DxeDb.Init.GuidTable,
|
(EFI_GUID *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->GuidTableOffset),
|
||||||
sizeof(mPcdDatabase->DxeDb.Init.GuidTable),
|
mDxeGuidTableSize,
|
||||||
mPcdDatabase->DxeDb.Init.ExMapTable,
|
(DYNAMICEX_MAPPING *)((UINT8 *) mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->ExMapTableOffset),
|
||||||
sizeof(mPcdDatabase->DxeDb.Init.ExMapTable)
|
mDxeExMapppingTableSize
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1055,7 +1051,7 @@ DxePcdGetNextToken (
|
|||||||
/**
|
/**
|
||||||
Get all token space guid table which is different with given token space guid.
|
Get all token space guid table which is different with given token space guid.
|
||||||
|
|
||||||
@param ExMapTableSize The size of guid table
|
@param ExMapTableSize The size of ExMapTable in item
|
||||||
@param ExMapTable Token space guid table that want to be scaned.
|
@param ExMapTable Token space guid table that want to be scaned.
|
||||||
@param GuidTable Guid table
|
@param GuidTable Guid table
|
||||||
|
|
||||||
@ -1072,8 +1068,9 @@ GetDistinctTokenSpace (
|
|||||||
EFI_GUID **DistinctTokenSpace;
|
EFI_GUID **DistinctTokenSpace;
|
||||||
UINTN OldGuidIndex;
|
UINTN OldGuidIndex;
|
||||||
UINTN TsIdx;
|
UINTN TsIdx;
|
||||||
|
UINTN TempTsIdx;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
|
BOOLEAN Match;
|
||||||
|
|
||||||
DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));
|
DistinctTokenSpace = AllocateZeroPool (*ExMapTableSize * sizeof (EFI_GUID *));
|
||||||
ASSERT (DistinctTokenSpace != NULL);
|
ASSERT (DistinctTokenSpace != NULL);
|
||||||
@ -1082,8 +1079,18 @@ GetDistinctTokenSpace (
|
|||||||
OldGuidIndex = ExMapTable[0].ExGuidIndex;
|
OldGuidIndex = ExMapTable[0].ExGuidIndex;
|
||||||
DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];
|
DistinctTokenSpace[TsIdx] = &GuidTable[OldGuidIndex];
|
||||||
for (Idx = 1; Idx < *ExMapTableSize; Idx++) {
|
for (Idx = 1; Idx < *ExMapTableSize; Idx++) {
|
||||||
if (ExMapTable[Idx].ExGuidIndex != OldGuidIndex) {
|
Match = FALSE;
|
||||||
OldGuidIndex = ExMapTable[Idx].ExGuidIndex;
|
OldGuidIndex = ExMapTable[Idx].ExGuidIndex;
|
||||||
|
for (TempTsIdx = 0; TempTsIdx <= TsIdx; TempTsIdx++) {
|
||||||
|
if (&GuidTable[OldGuidIndex] == DistinctTokenSpace[TempTsIdx]) {
|
||||||
|
//
|
||||||
|
// Have recorded this GUID.
|
||||||
|
//
|
||||||
|
Match = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!Match) {
|
||||||
DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];
|
DistinctTokenSpace[++TsIdx] = &GuidTable[OldGuidIndex];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1099,16 +1106,20 @@ GetDistinctTokenSpace (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get next token space in PCD database according to given token space guid.
|
Retrieves the next valid PCD token namespace for a given namespace.
|
||||||
|
|
||||||
@param Guid Given token space guid. If NULL, then Guid will be set to
|
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
|
||||||
the first PCD token space in PCD database, If not NULL, then
|
token namespaces on a platform.
|
||||||
Guid will be set to next PCD token space.
|
|
||||||
|
@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.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED
|
|
||||||
@retval EFI_NOT_FOUND If PCD database has no token space table or can not find given
|
|
||||||
token space in PCD database.
|
|
||||||
@retval EFI_SUCCESS Success to get next token space guid.
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
@ -1129,35 +1140,31 @@ DxePcdGetNextTokenSpace (
|
|||||||
|
|
||||||
ASSERT (Guid != NULL);
|
ASSERT (Guid != NULL);
|
||||||
|
|
||||||
PeiExMapTableEmpty = PEI_EXMAP_TABLE_EMPTY;
|
PeiExMapTableEmpty = mPeiExMapTableEmpty;
|
||||||
DxeExMapTableEmpty = DXE_EXMAP_TABLE_EMPTY;
|
DxeExMapTableEmpty = mDxeExMapTableEmpty;
|
||||||
|
|
||||||
if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
|
if (PeiExMapTableEmpty && DxeExMapTableEmpty) {
|
||||||
if (*Guid != NULL) {
|
return EFI_NOT_FOUND;
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
} else {
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (TmpTokenSpaceBuffer[0] == NULL) {
|
if (TmpTokenSpaceBuffer[0] == NULL) {
|
||||||
PeiTokenSpaceTableSize = 0;
|
PeiTokenSpaceTableSize = 0;
|
||||||
|
|
||||||
if (!PeiExMapTableEmpty) {
|
if (!PeiExMapTableEmpty) {
|
||||||
PeiTokenSpaceTableSize = PEI_EXMAPPING_TABLE_SIZE;
|
PeiTokenSpaceTableSize = mPeiExMapppingTableSize / sizeof(DYNAMICEX_MAPPING);
|
||||||
PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,
|
PeiTokenSpaceTable = GetDistinctTokenSpace (&PeiTokenSpaceTableSize,
|
||||||
mPcdDatabase->PeiDb.Init.ExMapTable,
|
(DYNAMICEX_MAPPING *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->ExMapTableOffset),
|
||||||
mPcdDatabase->PeiDb.Init.GuidTable
|
(EFI_GUID *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset)
|
||||||
);
|
);
|
||||||
CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
|
CopyMem (TmpTokenSpaceBuffer, PeiTokenSpaceTable, sizeof (EFI_GUID*) * PeiTokenSpaceTableSize);
|
||||||
|
FreePool (PeiTokenSpaceTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DxeExMapTableEmpty) {
|
if (!DxeExMapTableEmpty) {
|
||||||
DxeTokenSpaceTableSize = DXE_EXMAPPING_TABLE_SIZE;
|
DxeTokenSpaceTableSize = mDxeExMapppingTableSize / sizeof(DYNAMICEX_MAPPING);
|
||||||
DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,
|
DxeTokenSpaceTable = GetDistinctTokenSpace (&DxeTokenSpaceTableSize,
|
||||||
mPcdDatabase->DxeDb.Init.ExMapTable,
|
(DYNAMICEX_MAPPING *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->ExMapTableOffset),
|
||||||
mPcdDatabase->DxeDb.Init.GuidTable
|
(EFI_GUID *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->GuidTableOffset)
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -1175,6 +1182,9 @@ DxePcdGetNextTokenSpace (
|
|||||||
TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];
|
TmpTokenSpaceBuffer[Idx3++] = DxeTokenSpaceTable[Idx2];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TmpTokenSpaceBufferCount = Idx3;
|
||||||
|
FreePool (DxeTokenSpaceTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,11 +1193,19 @@ DxePcdGetNextTokenSpace (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Idx = 0; Idx < (PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZE); Idx++) {
|
for (Idx = 0; Idx < TmpTokenSpaceBufferCount; Idx++) {
|
||||||
if(CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {
|
if (CompareGuid (*Guid, TmpTokenSpaceBuffer[Idx])) {
|
||||||
Idx++;
|
if (Idx == TmpTokenSpaceBufferCount - 1) {
|
||||||
*Guid = TmpTokenSpaceBuffer[Idx];
|
//
|
||||||
return EFI_SUCCESS;
|
// It has been the last token namespace.
|
||||||
|
//
|
||||||
|
*Guid = NULL;
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
} else {
|
||||||
|
Idx++;
|
||||||
|
*Guid = TmpTokenSpaceBuffer[Idx];
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
## @file
|
## @file
|
||||||
# PCD DXE driver manage database contains all dynamic PCD entries initialized in
|
# PCD DXE driver manage database contains all dynamic PCD entries and produce the implementation of PCD protocol.
|
||||||
# PEI phase, DXE phase and produce the implementation of PCD protocol.
|
|
||||||
#
|
#
|
||||||
|
# This version PCD DXE depends on the external PCD database binary file, not built in PCD data base.
|
||||||
# There are two PCD Protocols as follows:
|
# There are two PCD Protocols as follows:
|
||||||
# 1) PCD_PROTOCOL
|
# 1) PCD_PROTOCOL
|
||||||
# It is EDKII implementation which support Dynamic/DynamicEx type Pcds.
|
# It is EDKII implementation which support Dynamic/DynamicEx type Pcds.
|
||||||
# 2) EFI_PCD_PROTOCOL_PPI
|
# 2) EFI_PCD_PROTOCOL
|
||||||
# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
|
# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
|
||||||
# type Pcd.
|
# type Pcd.
|
||||||
#
|
#
|
||||||
# For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI.
|
# For dynamicEx type PCD, it is compatible between PCD_PROTOCOL and EFI_PCD_PROTOCOL.
|
||||||
# PCD DXE driver will produce above two protocols at same time.
|
# PCD DXE driver will produce above two protocols at same time.
|
||||||
#
|
#
|
||||||
# PCD database structure is generated at autogen.h/autogen.c in build 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.
|
||||||
#
|
#
|
||||||
# ////////////////////////////////////////////////////////////////////////////////
|
# ////////////////////////////////////////////////////////////////////////////////
|
||||||
# // //
|
# // //
|
||||||
@ -63,7 +64,7 @@
|
|||||||
# b) Variable Storage:
|
# b) Variable Storage:
|
||||||
# - The PCD value is stored in variable area.
|
# - The PCD value is stored in variable area.
|
||||||
# - As default storage type, this type PCD could be used for PEI/DXE driver
|
# - 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.
|
# 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
|
# - In PEI phase, the PCD value could only be got but can not be set due
|
||||||
# to variable area is readonly.
|
# to variable area is readonly.
|
||||||
@ -94,12 +95,12 @@
|
|||||||
# PCD information used in PEI phase or use in both PEI/DXE phase. And DXE PCD
|
# 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.
|
# 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.
|
# PEI/DXE PCD driver according to dynamic PCD section in platform DSC file.
|
||||||
#
|
#
|
||||||
# 3.1 PcdPeim and PcdDxe
|
# 3.1 PcdPeim and PcdDxe
|
||||||
# PEI PCD database is maintained by PcdPeim driver run from flash. PcdPeim driver
|
# 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.
|
# to temporary memory for PEI PCD database.
|
||||||
# DXE PCD database is maintained by PcdDxe driver.At entry point of PcdDxe driver,
|
# 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
|
# a new PCD database is allocated in boot-time memory which including all
|
||||||
@ -185,8 +186,10 @@
|
|||||||
# Based on local token number, PCD driver could fast determine PCD type, value
|
# Based on local token number, PCD driver could fast determine PCD type, value
|
||||||
# type and get PCD entry from PCD database.
|
# type and get PCD entry from PCD database.
|
||||||
#
|
#
|
||||||
# 3.3 PCD Database C structure.
|
# 3.3 PCD Database binary file
|
||||||
# PCD Database C structure is generated by build tools in PCD driver's autogen.h/
|
# 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:
|
# autogen.c file. In generated C structure, following information is stored:
|
||||||
# - ExMapTable: This table is used translate a binary dynamicex type PCD's
|
# - ExMapTable: This table is used translate a binary dynamicex type PCD's
|
||||||
# "tokenguid + token" to local token number.
|
# "tokenguid + token" to local token number.
|
||||||
@ -195,7 +198,7 @@
|
|||||||
# token number" as array index to get PCD entry's offset fastly.
|
# token number" as array index to get PCD entry's offset fastly.
|
||||||
# - SizeTable: This table stores the size information for all PCD entry.
|
# - SizeTable: This table stores the size information for all PCD entry.
|
||||||
# - GuidTable: This table stores guid value for DynamicEx's token space,
|
# - GuidTable: This table stores guid value for DynamicEx's token space,
|
||||||
# HII type PCD's variable.
|
# HII type PCD's variable GUID.
|
||||||
# - SkuIdTable: TBD
|
# - SkuIdTable: TBD
|
||||||
# - SystemSkuId: TBD
|
# - SystemSkuId: TBD
|
||||||
# - PCD value structure:
|
# - PCD value structure:
|
||||||
@ -275,8 +278,8 @@
|
|||||||
# GuidTable array is used to store all related GUID value in PCD database:
|
# GuidTable array is used to store all related GUID value in PCD database:
|
||||||
# - Variable GUID for HII type PCD
|
# - Variable GUID for HII type PCD
|
||||||
# - Token space GUID for dynamicex type PCD
|
# - Token space GUID for dynamicex type PCD
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
# Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
#
|
#
|
||||||
# This program and the accompanying materials
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -293,7 +296,7 @@
|
|||||||
BASE_NAME = PcdDxe
|
BASE_NAME = PcdDxe
|
||||||
FILE_GUID = 80CF7257-87AB-47f9-A3FE-D50B76D89541
|
FILE_GUID = 80CF7257-87AB-47f9-A3FE-D50B76D89541
|
||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = DXE_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 4.0
|
||||||
PCD_IS_DRIVER = DXE_PCD_DRIVER
|
PCD_IS_DRIVER = DXE_PCD_DRIVER
|
||||||
ENTRY_POINT = PcdDxeInit
|
ENTRY_POINT = PcdDxeInit
|
||||||
|
|
||||||
@ -323,16 +326,18 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
BaseLib
|
BaseLib
|
||||||
PcdLib
|
PcdLib
|
||||||
|
DxeServicesLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gPcdDataBaseHobGuid ## CONSUMES ## Hob: GUID_EXTENSION
|
gPcdDataBaseHobGuid ## SOMETIMES_CONSUMES ## HOB
|
||||||
|
gPcdDataBaseSignatureGuid ## CONSUMES ## UNDEFINED # PCD database signature GUID.
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gPcdProtocolGuid ## PRODUCES
|
gPcdProtocolGuid ## PRODUCES
|
||||||
gEfiPcdProtocolGuid ## PRODUCES
|
gEfiPcdProtocolGuid ## PRODUCES
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress
|
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
||||||
|
@ -13,10 +13,28 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
**/
|
**/
|
||||||
|
|
||||||
#include "Service.h"
|
#include "Service.h"
|
||||||
|
#include <Library/DxeServicesLib.h>
|
||||||
|
|
||||||
PCD_DATABASE *mPcdDatabase;
|
PCD_DATABASE mPcdDatabase;
|
||||||
|
|
||||||
|
UINT32 mPcdTotalTokenCount;
|
||||||
|
UINT32 mPeiLocalTokenCount;
|
||||||
|
UINT32 mDxeLocalTokenCount;
|
||||||
|
UINT32 mPeiNexTokenCount;
|
||||||
|
UINT32 mDxeNexTokenCount;
|
||||||
|
UINT32 mPeiExMapppingTableSize;
|
||||||
|
UINT32 mDxeExMapppingTableSize;
|
||||||
|
UINT32 mPeiGuidTableSize;
|
||||||
|
UINT32 mDxeGuidTableSize;
|
||||||
|
|
||||||
|
BOOLEAN mPeiExMapTableEmpty;
|
||||||
|
BOOLEAN mDxeExMapTableEmpty;
|
||||||
|
BOOLEAN mPeiDatabaseEmpty;
|
||||||
|
|
||||||
LIST_ENTRY *mCallbackFnTable;
|
LIST_ENTRY *mCallbackFnTable;
|
||||||
|
EFI_GUID **TmpTokenSpaceBuffer;
|
||||||
|
UINTN TmpTokenSpaceBufferCount;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the PCD entry pointer in PCD database.
|
Get the PCD entry pointer in PCD database.
|
||||||
@ -64,6 +82,8 @@ GetWorker (
|
|||||||
EfiAcquireLock (&mPcdDatabaseLock);
|
EfiAcquireLock (&mPcdDatabaseLock);
|
||||||
|
|
||||||
RetPtr = NULL;
|
RetPtr = NULL;
|
||||||
|
|
||||||
|
ASSERT (TokenNumber > 0);
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// We have to decrement TokenNumber by 1 to make it usable
|
||||||
@ -72,27 +92,26 @@ GetWorker (
|
|||||||
TokenNumber--;
|
TokenNumber--;
|
||||||
|
|
||||||
TmpTokenNumber = TokenNumber;
|
TmpTokenNumber = TokenNumber;
|
||||||
|
|
||||||
//
|
//
|
||||||
// PCD_TOTAL_TOKEN_NUMBER is a auto-generated constant.
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// It could be zero. EBC compiler is very choosy. It may
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// report warning. So we add 1 in each size of the
|
|
||||||
// comparison.
|
// comparison.
|
||||||
//
|
//
|
||||||
ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < mPcdTotalTokenCount + 1);
|
||||||
|
|
||||||
ASSERT ((GetSize == DxePcdGetSize (TokenNumber + 1)) || (GetSize == 0));
|
ASSERT ((GetSize == DxePcdGetSize (TokenNumber + 1)) || (GetSize == 0));
|
||||||
|
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE);
|
IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < mPeiLocalTokenCount + 1) ? TRUE : FALSE);
|
||||||
|
|
||||||
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
|
LocalTokenNumberTable = IsPeiDb ? (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset) :
|
||||||
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
(UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);
|
||||||
|
|
||||||
TokenNumber = IsPeiDb ? TokenNumber :
|
TokenNumber = IsPeiDb ? TokenNumber :
|
||||||
TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
|
TokenNumber - mPeiLocalTokenCount;
|
||||||
|
|
||||||
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
|
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
|
||||||
|
|
||||||
@ -105,82 +124,64 @@ GetWorker (
|
|||||||
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize, IsPeiDb);
|
LocalTokenNumber = GetSkuEnabledTokenNumber (LocalTokenNumber & ~PCD_TYPE_SKU_ENABLED, MaxSize, IsPeiDb);
|
||||||
}
|
}
|
||||||
|
|
||||||
PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
|
PcdDb = IsPeiDb ? ((UINT8 *) mPcdDatabase.PeiDb) : ((UINT8 *) mPcdDatabase.DxeDb);
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
StringTable = (UINT8 *) (&mPcdDatabase->PeiDb.Init.StringTable[0]);
|
StringTable = (UINT8 *) ((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->StringTableOffset);
|
||||||
} else {
|
} else {
|
||||||
StringTable = (UINT8 *) (&mPcdDatabase->DxeDb.Init.StringTable[0]);
|
StringTable = (UINT8 *) ((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->StringTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
||||||
|
|
||||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||||
case PCD_TYPE_VPD:
|
case PCD_TYPE_VPD:
|
||||||
VpdHead = (VPD_HEAD *) ((UINT8 *) PcdDb + Offset);
|
VpdHead = (VPD_HEAD *) ((UINT8 *) PcdDb + Offset);
|
||||||
RetPtr = (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
RetPtr = (VOID *) (UINTN) (PcdGet32 (PcdVpdBaseAddress) + VpdHead->Offset);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->PeiDb.Init.GuidTable[0]);
|
GuidTable = (EFI_GUID *) ((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset);
|
||||||
} else {
|
} else {
|
||||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->DxeDb.Init.GuidTable[0]);
|
GuidTable = (EFI_GUID *) ((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->GuidTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
||||||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||||
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
|
Name = (UINT16*)(StringTable + VariableHead->StringIndex);
|
||||||
|
|
||||||
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
||||||
//
|
//
|
||||||
// If a HII type PCD's datum type is VOID*, the DefaultValueOffset is the index of
|
// If a HII type PCD's datum type is VOID*, the DefaultValueOffset is the index of
|
||||||
// string array in string table.
|
// string array in string table.
|
||||||
//
|
//
|
||||||
StringTableIdx = *(STRING_HEAD*)((UINT8 *) PcdDb + VariableHead->DefaultValueOffset);
|
StringTableIdx = *(STRING_HEAD*)((UINT8 *) PcdDb + VariableHead->DefaultValueOffset);
|
||||||
VaraiableDefaultBuffer = (VOID *) (StringTable + StringTableIdx);
|
VaraiableDefaultBuffer = (VOID *) (StringTable + StringTableIdx);
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
|
||||||
if (Status == EFI_SUCCESS) {
|
|
||||||
if (GetSize == 0) {
|
|
||||||
//
|
|
||||||
// It is a pointer type. So get the MaxSize reserved for
|
|
||||||
// this PCD entry.
|
|
||||||
//
|
|
||||||
GetPtrTypeSize (TmpTokenNumber, &GetSize);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// If the operation is successful, we copy the data
|
|
||||||
// to the default value buffer in the PCD Database.
|
|
||||||
// So that we can free the Data allocated in GetHiiVariable.
|
|
||||||
//
|
|
||||||
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
|
|
||||||
FreePool (Data);
|
|
||||||
}
|
|
||||||
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
|
||||||
} else {
|
} else {
|
||||||
VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
|
VaraiableDefaultBuffer = (UINT8 *) PcdDb + VariableHead->DefaultValueOffset;
|
||||||
|
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
|
||||||
if (Status == EFI_SUCCESS) {
|
|
||||||
if (GetSize == 0) {
|
|
||||||
//
|
|
||||||
// It is a pointer type. So get the MaxSize reserved for
|
|
||||||
// this PCD entry.
|
|
||||||
//
|
|
||||||
GetPtrTypeSize (TmpTokenNumber, &GetSize);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// If the operation is successful, we copy the data
|
|
||||||
// to the default value buffer in the PCD Database.
|
|
||||||
// So that we can free the Data allocated in GetHiiVariable.
|
|
||||||
//
|
|
||||||
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
|
|
||||||
FreePool (Data);
|
|
||||||
}
|
|
||||||
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
|
||||||
}
|
}
|
||||||
|
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
||||||
|
if (Status == EFI_SUCCESS) {
|
||||||
|
if (GetSize == 0) {
|
||||||
|
//
|
||||||
|
// It is a pointer type. So get the MaxSize reserved for
|
||||||
|
// this PCD entry.
|
||||||
|
//
|
||||||
|
GetPtrTypeSize (TmpTokenNumber, &GetSize);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// If the operation is successful, we copy the data
|
||||||
|
// to the default value buffer in the PCD Database.
|
||||||
|
// So that we can free the Data allocated in GetHiiVariable.
|
||||||
|
//
|
||||||
|
CopyMem (VaraiableDefaultBuffer, Data + VariableHead->Offset, GetSize);
|
||||||
|
FreePool (Data);
|
||||||
|
}
|
||||||
|
RetPtr = (VOID *) VaraiableDefaultBuffer;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
@ -199,9 +200,9 @@ GetWorker (
|
|||||||
}
|
}
|
||||||
|
|
||||||
EfiReleaseLock (&mPcdDatabaseLock);
|
EfiReleaseLock (&mPcdDatabaseLock);
|
||||||
|
|
||||||
return RetPtr;
|
return RetPtr;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -359,6 +360,7 @@ ExGetNextTokeNumber (
|
|||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN GuidTableIdx;
|
UINTN GuidTableIdx;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
|
UINTN ExMapTableCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Scan token space guid
|
// Scan token space guid
|
||||||
@ -373,7 +375,8 @@ ExGetNextTokeNumber (
|
|||||||
//
|
//
|
||||||
Found = FALSE;
|
Found = FALSE;
|
||||||
GuidTableIdx = MatchGuid - GuidTable;
|
GuidTableIdx = MatchGuid - GuidTable;
|
||||||
for (Index = 0; Index < SizeOfExMapTable; Index++) {
|
ExMapTableCount = SizeOfExMapTable / sizeof(ExMapTable[0]);
|
||||||
|
for (Index = 0; Index < ExMapTableCount; Index++) {
|
||||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -390,36 +393,71 @@ ExGetNextTokeNumber (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; Index < SizeOfExMapTable; Index++) {
|
for ( ; Index < ExMapTableCount; Index++) {
|
||||||
if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {
|
if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {
|
||||||
Index ++;
|
break;
|
||||||
if (Index == SizeOfExMapTable) {
|
}
|
||||||
//
|
}
|
||||||
// Exceed the length of ExMap Table
|
|
||||||
//
|
while (Index < ExMapTableCount) {
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
Index++;
|
||||||
return EFI_SUCCESS;
|
if (Index == ExMapTableCount) {
|
||||||
} else if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
//
|
||||||
//
|
// Exceed the length of ExMap Table
|
||||||
// Found the next match
|
//
|
||||||
//
|
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||||
*TokenNumber = ExMapTable[Index].ExTokenNumber;
|
return EFI_NOT_FOUND;
|
||||||
return EFI_SUCCESS;
|
} else if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||||
} else {
|
//
|
||||||
//
|
// Found the next match
|
||||||
// Guid has been changed. It is the next Token Space Guid.
|
//
|
||||||
// We should flag no more TokenNumber.
|
*TokenNumber = ExMapTable[Index].ExTokenNumber;
|
||||||
//
|
return EFI_SUCCESS;
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Find the PCD database.
|
||||||
|
|
||||||
|
@retval The base address of external PCD database binary.
|
||||||
|
@retval NULL Return NULL if not find.
|
||||||
|
**/
|
||||||
|
DXE_PCD_DATABASE *
|
||||||
|
LocateExPcdBinary (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
DXE_PCD_DATABASE *DxePcdDbBinary;
|
||||||
|
UINTN DxePcdDbSize;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
|
||||||
|
DxePcdDbBinary = NULL;
|
||||||
|
//
|
||||||
|
// Search the External Pcd database from one section of current FFS,
|
||||||
|
// and read it to memory
|
||||||
|
//
|
||||||
|
Status = GetSectionFromFfs (
|
||||||
|
EFI_SECTION_RAW,
|
||||||
|
0,
|
||||||
|
(VOID **) &DxePcdDbBinary,
|
||||||
|
&DxePcdDbSize
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Check the first bytes (Header Signature Guid) and build version.
|
||||||
|
//
|
||||||
|
if (!CompareGuid ((VOID *)DxePcdDbBinary, &gPcdDataBaseSignatureGuid) ||
|
||||||
|
(DxePcdDbBinary->BuildVersion != PCD_SERVICE_DXE_VERSION)) {
|
||||||
|
ASSERT (FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return DxePcdDbBinary;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Initialize the PCD database in DXE phase.
|
Initialize the PCD database in DXE phase.
|
||||||
@ -436,15 +474,12 @@ BuildPcdDxeDataBase (
|
|||||||
PEI_PCD_DATABASE *PeiDatabase;
|
PEI_PCD_DATABASE *PeiDatabase;
|
||||||
EFI_HOB_GUID_TYPE *GuidHob;
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
UINT32 PcdDxeDbLen;
|
||||||
mPcdDatabase = AllocateZeroPool (sizeof(PCD_DATABASE));
|
VOID *PcdDxeDb;
|
||||||
ASSERT (mPcdDatabase != NULL);
|
|
||||||
|
|
||||||
GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
|
GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
|
||||||
if (GuidHob != NULL) {
|
if (GuidHob != NULL) {
|
||||||
|
|
||||||
//
|
|
||||||
// We will copy over the PEI phase's PCD Database.
|
|
||||||
//
|
//
|
||||||
// If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM
|
// If no PEIMs use dynamic Pcd Entry, the Pcd Service PEIM
|
||||||
// should not be included at all. So the GuidHob could
|
// should not be included at all. So the GuidHob could
|
||||||
@ -454,28 +489,56 @@ BuildPcdDxeDataBase (
|
|||||||
|
|
||||||
PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
|
PeiDatabase = (PEI_PCD_DATABASE *) GET_GUID_HOB_DATA (GuidHob);
|
||||||
//
|
//
|
||||||
// Copy PCD Entries refereneced in PEI phase to PCD DATABASE
|
// Assign PCD Entries refereneced in PEI phase to PCD DATABASE
|
||||||
//
|
//
|
||||||
CopyMem (&mPcdDatabase->PeiDb, PeiDatabase, sizeof (PEI_PCD_DATABASE));
|
mPcdDatabase.PeiDb = PeiDatabase;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Copy PCD Entries with default value to PCD DATABASE
|
// Assign PCD Entries with default value to PCD DATABASE
|
||||||
//
|
//
|
||||||
CopyMem (&mPcdDatabase->DxeDb.Init, &gDXEPcdDbInit, sizeof(DXE_PCD_DATABASE_INIT));
|
mPcdDatabase.DxeDb = LocateExPcdBinary ();
|
||||||
|
ASSERT(mPcdDatabase.DxeDb != NULL);
|
||||||
|
PcdDxeDbLen = mPcdDatabase.DxeDb->Length + mPcdDatabase.DxeDb->UninitDataBaseSize;
|
||||||
|
PcdDxeDb = AllocateZeroPool (PcdDxeDbLen);
|
||||||
|
CopyMem (PcdDxeDb, mPcdDatabase.DxeDb, mPcdDatabase.DxeDb->Length);
|
||||||
|
FreePool (mPcdDatabase.DxeDb);
|
||||||
|
mPcdDatabase.DxeDb = PcdDxeDb;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Initialized the external PCD database local variables
|
||||||
|
//
|
||||||
|
mPeiLocalTokenCount = mPcdDatabase.PeiDb->LocalTokenCount;
|
||||||
|
mDxeLocalTokenCount = mPcdDatabase.DxeDb->LocalTokenCount;
|
||||||
|
|
||||||
|
mPeiExMapppingTableSize = mPcdDatabase.PeiDb->ExTokenCount * sizeof (DYNAMICEX_MAPPING);
|
||||||
|
mDxeExMapppingTableSize = mPcdDatabase.DxeDb->ExTokenCount * sizeof (DYNAMICEX_MAPPING);
|
||||||
|
mPeiGuidTableSize = mPcdDatabase.PeiDb->GuidTableCount * sizeof(GUID);
|
||||||
|
mDxeGuidTableSize = mPcdDatabase.DxeDb->GuidTableCount * sizeof (GUID);
|
||||||
|
|
||||||
|
mPcdTotalTokenCount = mPeiLocalTokenCount + mDxeLocalTokenCount;
|
||||||
|
mPeiNexTokenCount = mPeiLocalTokenCount - mPcdDatabase.PeiDb->ExTokenCount;
|
||||||
|
mDxeNexTokenCount = mDxeLocalTokenCount - mPcdDatabase.DxeDb->ExTokenCount;
|
||||||
|
|
||||||
|
mPeiExMapTableEmpty = (mPcdDatabase.PeiDb->ExTokenCount == 0) ? TRUE : FALSE;
|
||||||
|
mDxeExMapTableEmpty = (mPcdDatabase.DxeDb->ExTokenCount == 0) ? TRUE : FALSE;
|
||||||
|
mPeiDatabaseEmpty = (mPeiLocalTokenCount == 0) ? TRUE : FALSE;
|
||||||
|
|
||||||
|
TmpTokenSpaceBufferCount = mPcdDatabase.PeiDb->ExTokenCount + mPcdDatabase.DxeDb->ExTokenCount;
|
||||||
|
TmpTokenSpaceBuffer = (EFI_GUID **)AllocateZeroPool(TmpTokenSpaceBufferCount * sizeof (EFI_GUID *));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Initialized the Callback Function Table
|
// Initialized the Callback Function Table
|
||||||
//
|
//
|
||||||
|
mCallbackFnTable = AllocateZeroPool (mPcdTotalTokenCount * sizeof (LIST_ENTRY));
|
||||||
mCallbackFnTable = AllocateZeroPool (PCD_TOTAL_TOKEN_NUMBER * sizeof (LIST_ENTRY));
|
|
||||||
ASSERT(mCallbackFnTable != NULL);
|
ASSERT(mCallbackFnTable != NULL);
|
||||||
|
|
||||||
|
//
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
for (Index = 0; Index + 1 < PCD_TOTAL_TOKEN_NUMBER + 1; Index++) {
|
//
|
||||||
|
for (Index = 0; Index + 1 < mPcdTotalTokenCount + 1; Index++) {
|
||||||
InitializeListHead (&mCallbackFnTable[Index]);
|
InitializeListHead (&mCallbackFnTable[Index]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,29 +631,39 @@ GetSkuEnabledTokenNumber (
|
|||||||
SKU_ID *SkuIdTable;
|
SKU_ID *SkuIdTable;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
UINT8 *Value;
|
UINT8 *Value;
|
||||||
SKU_ID *PhaseSkuIdTable;
|
|
||||||
UINT8 *PcdDb;
|
UINT8 *PcdDb;
|
||||||
|
BOOLEAN FoundSku;
|
||||||
|
|
||||||
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);
|
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0);
|
||||||
|
|
||||||
PcdDb = IsPeiDb ? (UINT8 *) &mPcdDatabase->PeiDb : (UINT8 *) &mPcdDatabase->DxeDb;
|
PcdDb = IsPeiDb ? (UINT8 *) mPcdDatabase.PeiDb : (UINT8 *) mPcdDatabase.DxeDb;
|
||||||
|
|
||||||
SkuHead = (SKU_HEAD *) (PcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
|
SkuHead = (SKU_HEAD *) (PcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
|
||||||
Value = (UINT8 *) (PcdDb + SkuHead->SkuDataStartOffset);
|
Value = (UINT8 *) (PcdDb + SkuHead->SkuDataStartOffset);
|
||||||
|
|
||||||
PhaseSkuIdTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.SkuIdTable :
|
SkuIdTable = (SKU_ID *)(PcdDb + SkuHead->SkuIdTableOffset);
|
||||||
mPcdDatabase->DxeDb.Init.SkuIdTable;
|
|
||||||
|
|
||||||
SkuIdTable = &PhaseSkuIdTable[SkuHead->SkuIdTableOffset];
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Find the current system's SKU ID entry in SKU ID table.
|
// Find the current system's SKU ID entry in SKU ID table.
|
||||||
//
|
//
|
||||||
|
FoundSku = FALSE;
|
||||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
if (mPcdDatabase->PeiDb.Init.SystemSkuId == SkuIdTable[Index + 1]) {
|
if (mPcdDatabase.PeiDb->SystemSkuId == SkuIdTable[Index + 1]) {
|
||||||
|
FoundSku = TRUE;
|
||||||
break;
|
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]);
|
ASSERT (Index < SkuIdTable[0]);
|
||||||
|
|
||||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||||
@ -602,13 +675,17 @@ GetSkuEnabledTokenNumber (
|
|||||||
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
||||||
return (UINT32) ((Value - PcdDb) | PCD_TYPE_HII);
|
return (UINT32) ((Value - PcdDb) | PCD_TYPE_HII);
|
||||||
|
|
||||||
|
case PCD_TYPE_HII|PCD_TYPE_STRING:
|
||||||
|
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
||||||
|
return (UINT32) ((Value - PcdDb) | PCD_TYPE_HII | PCD_TYPE_STRING);
|
||||||
|
|
||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
Value = (UINT8 *) &(((STRING_HEAD *) Value)[Index]);
|
Value = (UINT8 *) &(((STRING_HEAD *) Value)[Index]);
|
||||||
return (UINT32) ((Value - PcdDb) | PCD_TYPE_STRING);
|
return (UINT32) ((Value - PcdDb) | PCD_TYPE_STRING);
|
||||||
|
|
||||||
case PCD_TYPE_DATA:
|
case PCD_TYPE_DATA:
|
||||||
Value += Size * Index;
|
Value += Size * Index;
|
||||||
return (UINT32) (Value - PcdDb);
|
return (UINT32) ((Value - PcdDb) | PCD_TYPE_DATA);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -744,7 +821,7 @@ SetWorker (
|
|||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
//
|
//
|
||||||
ASSERT (TokenNumber + 1 < PCD_TOTAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < mPcdTotalTokenCount + 1);
|
||||||
|
|
||||||
if (PtrType) {
|
if (PtrType) {
|
||||||
//
|
//
|
||||||
@ -766,8 +843,8 @@ SetWorker (
|
|||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
//
|
//
|
||||||
if ((TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1) ||
|
if ((TokenNumber + 1 < mPeiNexTokenCount + 1) ||
|
||||||
(TokenNumber + 1 >= PEI_LOCAL_TOKEN_NUMBER + 1 || TokenNumber + 1 < (PEI_LOCAL_TOKEN_NUMBER + DXE_NEX_TOKEN_NUMBER + 1))) {
|
(TokenNumber + 1 >= mPeiLocalTokenCount + 1 && TokenNumber + 1 < (mPeiLocalTokenCount + mDxeNexTokenCount + 1))) {
|
||||||
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
|
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -781,13 +858,13 @@ SetWorker (
|
|||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
//
|
//
|
||||||
IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1) ? TRUE : FALSE);
|
IsPeiDb = (BOOLEAN) ((TokenNumber + 1 < mPeiLocalTokenCount + 1) ? TRUE : FALSE);
|
||||||
|
|
||||||
LocalTokenNumberTable = IsPeiDb ? mPcdDatabase->PeiDb.Init.LocalTokenNumberTable :
|
LocalTokenNumberTable = IsPeiDb ? (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset) :
|
||||||
mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
(UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset) ;
|
||||||
|
|
||||||
TokenNumber = IsPeiDb ? TokenNumber
|
TokenNumber = IsPeiDb ? TokenNumber
|
||||||
: TokenNumber - PEI_LOCAL_TOKEN_NUMBER;
|
: TokenNumber - mPeiLocalTokenCount;
|
||||||
|
|
||||||
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
|
LocalTokenNumber = LocalTokenNumberTable[TokenNumber];
|
||||||
|
|
||||||
@ -802,12 +879,12 @@ SetWorker (
|
|||||||
|
|
||||||
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
||||||
|
|
||||||
PcdDb = IsPeiDb ? ((UINT8 *) &mPcdDatabase->PeiDb) : ((UINT8 *) &mPcdDatabase->DxeDb);
|
PcdDb = IsPeiDb ? ((UINT8 *) mPcdDatabase.PeiDb) : ((UINT8 *) mPcdDatabase.DxeDb);
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
StringTable = (UINT8 *) (&mPcdDatabase->PeiDb.Init.StringTable[0]);
|
StringTable = (UINT8 *) ((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->StringTableOffset);
|
||||||
} else {
|
} else {
|
||||||
StringTable = (UINT8 *) (&mPcdDatabase->DxeDb.Init.StringTable[0]);
|
StringTable = (UINT8 *) ((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->StringTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -836,20 +913,20 @@ SetWorker (
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->PeiDb.Init.GuidTable[0]);
|
GuidTable = (EFI_GUID *) ((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset);
|
||||||
} else {
|
} else {
|
||||||
GuidTable = (EFI_GUID *) (&mPcdDatabase->DxeDb.Init.GuidTable[0]);
|
GuidTable = (EFI_GUID *) ((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->GuidTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
VariableHead = (VARIABLE_HEAD *) (PcdDb + Offset);
|
||||||
|
|
||||||
Guid = GuidTable + VariableHead->GuidTableIndex;
|
Guid = GuidTable + VariableHead->GuidTableIndex;
|
||||||
Name = (UINT16*) (StringTable + VariableHead->StringIndex);
|
Name = (UINT16*) (StringTable + VariableHead->StringIndex);
|
||||||
VariableOffset = VariableHead->Offset;
|
VariableOffset = VariableHead->Offset;
|
||||||
Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
|
Status = SetHiiVariable (Guid, Name, Data, *Size, VariableOffset);
|
||||||
|
|
||||||
if (EFI_NOT_FOUND == Status) {
|
if (EFI_NOT_FOUND == Status) {
|
||||||
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
if ((LocalTokenNumber & PCD_TYPE_ALL_SET) == (PCD_TYPE_HII|PCD_TYPE_STRING)) {
|
||||||
CopyMem (
|
CopyMem (
|
||||||
@ -954,7 +1031,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
|
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
|
space guid and token number firstly, and invoke callback function if this PCD
|
||||||
@ -1100,16 +1177,16 @@ SetHiiVariable (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
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
|
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 Guid Token space guid for dynamic-ex PCD entry.
|
||||||
@param ExTokenNumber Dynamic-ex PCD token number.
|
@param ExTokenNumber Dynamic-ex PCD token number.
|
||||||
|
|
||||||
@return local token number for dynamic-ex PCD.
|
@return Token Number for dynamic-ex PCD.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
@ -1124,29 +1201,29 @@ GetExPcdTokenNumber (
|
|||||||
EFI_GUID *MatchGuid;
|
EFI_GUID *MatchGuid;
|
||||||
UINTN MatchGuidIdx;
|
UINTN MatchGuidIdx;
|
||||||
|
|
||||||
if (!PEI_DATABASE_EMPTY) {
|
if (!mPeiDatabaseEmpty) {
|
||||||
ExMap = mPcdDatabase->PeiDb.Init.ExMapTable;
|
ExMap = (DYNAMICEX_MAPPING *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->ExMapTableOffset);
|
||||||
GuidTable = mPcdDatabase->PeiDb.Init.GuidTable;
|
GuidTable = (EFI_GUID *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->GuidTableOffset);
|
||||||
|
|
||||||
MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->PeiDb.Init.GuidTable), Guid);
|
MatchGuid = ScanGuid (GuidTable, mPeiGuidTableSize, Guid);
|
||||||
|
|
||||||
if (MatchGuid != NULL) {
|
if (MatchGuid != NULL) {
|
||||||
|
|
||||||
MatchGuidIdx = MatchGuid - GuidTable;
|
MatchGuidIdx = MatchGuid - GuidTable;
|
||||||
|
|
||||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
for (Index = 0; Index < mPeiExMapppingTableSize; Index++) {
|
||||||
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
||||||
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
||||||
return ExMap[Index].LocalTokenNumber;
|
return ExMap[Index].TokenNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExMap = mPcdDatabase->DxeDb.Init.ExMapTable;
|
|
||||||
GuidTable = mPcdDatabase->DxeDb.Init.GuidTable;
|
|
||||||
|
|
||||||
MatchGuid = ScanGuid (GuidTable, sizeof(mPcdDatabase->DxeDb.Init.GuidTable), Guid);
|
ExMap = (DYNAMICEX_MAPPING *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->ExMapTableOffset);
|
||||||
|
GuidTable = (EFI_GUID *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->GuidTableOffset);
|
||||||
|
|
||||||
|
MatchGuid = ScanGuid (GuidTable, mDxeGuidTableSize, Guid);
|
||||||
//
|
//
|
||||||
// We need to ASSERT here. If GUID can't be found in GuidTable, this is a
|
// We need to ASSERT here. If GUID can't be found in GuidTable, this is a
|
||||||
// error in the BUILD system.
|
// error in the BUILD system.
|
||||||
@ -1154,11 +1231,11 @@ GetExPcdTokenNumber (
|
|||||||
ASSERT (MatchGuid != NULL);
|
ASSERT (MatchGuid != NULL);
|
||||||
|
|
||||||
MatchGuidIdx = MatchGuid - GuidTable;
|
MatchGuidIdx = MatchGuid - GuidTable;
|
||||||
|
|
||||||
for (Index = 0; Index < DXE_EXMAPPING_TABLE_SIZE; Index++) {
|
for (Index = 0; Index < mDxeExMapppingTableSize; Index++) {
|
||||||
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
||||||
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
||||||
return ExMap[Index].LocalTokenNumber;
|
return ExMap[Index].TokenNumber;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1171,27 +1248,27 @@ GetExPcdTokenNumber (
|
|||||||
Get SKU ID table from PCD database.
|
Get SKU ID table from PCD database.
|
||||||
|
|
||||||
@param LocalTokenNumberTableIdx Index of local token number in token number table.
|
@param LocalTokenNumberTableIdx Index of local token number in token number table.
|
||||||
@param IsPeiPcd If TRUE,
|
@param IsPeiDb If TRUE, the pcd entry is initialized in PEI phase,
|
||||||
|
If FALSE, the pcd entry is initialized in DXE phase.
|
||||||
@return Pointer to SKU ID array table
|
@return Pointer to SKU ID array table
|
||||||
|
|
||||||
**/
|
**/
|
||||||
SKU_ID *
|
SKU_ID *
|
||||||
GetSkuIdArray (
|
GetSkuIdArray (
|
||||||
IN UINTN LocalTokenNumberTableIdx,
|
IN UINTN LocalTokenNumberTableIdx,
|
||||||
IN BOOLEAN IsPeiPcd
|
IN BOOLEAN IsPeiDb
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SKU_HEAD *SkuHead;
|
SKU_HEAD *SkuHead;
|
||||||
UINTN LocalTokenNumber;
|
UINTN LocalTokenNumber;
|
||||||
UINT8 *Database;
|
UINT8 *Database;
|
||||||
|
|
||||||
if (IsPeiPcd) {
|
if (IsPeiDb) {
|
||||||
LocalTokenNumber = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||||
Database = (UINT8 *) &mPcdDatabase->PeiDb;
|
Database = (UINT8 *) mPcdDatabase.PeiDb;
|
||||||
} else {
|
} else {
|
||||||
LocalTokenNumber = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable[LocalTokenNumberTableIdx - PEI_LOCAL_TOKEN_NUMBER];
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||||
Database = (UINT8 *) &mPcdDatabase->DxeDb;
|
Database = (UINT8 *) mPcdDatabase.DxeDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
|
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
|
||||||
@ -1224,9 +1301,9 @@ GetSizeTableIndex (
|
|||||||
SKU_ID *SkuIdTable;
|
SKU_ID *SkuIdTable;
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset);
|
||||||
} else {
|
} else {
|
||||||
LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
SizeTableIdx = 0;
|
SizeTableIdx = 0;
|
||||||
@ -1241,11 +1318,12 @@ GetSizeTableIndex (
|
|||||||
//
|
//
|
||||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
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.
|
// 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 {
|
} else {
|
||||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
|
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
|
||||||
//
|
//
|
||||||
@ -1297,16 +1375,16 @@ GetPtrTypeSize (
|
|||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < mPeiLocalTokenCount + 1);
|
||||||
|
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset);
|
||||||
SizeTable = mPcdDatabase->PeiDb.Init.SizeTable;
|
SizeTable = (SIZE_INFO *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->SizeTableOffset);
|
||||||
} else {
|
} else {
|
||||||
LocalTokenNumberTableIdx -= PEI_LOCAL_TOKEN_NUMBER;
|
LocalTokenNumberTableIdx -= mPeiLocalTokenCount;
|
||||||
LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);
|
||||||
SizeTable = mPcdDatabase->DxeDb.Init.SizeTable;
|
SizeTable = (SIZE_INFO *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->SizeTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
||||||
@ -1322,8 +1400,9 @@ GetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
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.
|
// 1) MAX Size.
|
||||||
|
// 2) Current Size
|
||||||
// We consider current size is equal to MAX size.
|
// We consider current size is equal to MAX size.
|
||||||
//
|
//
|
||||||
return *MaxSize;
|
return *MaxSize;
|
||||||
@ -1343,7 +1422,7 @@ GetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
|
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
|
||||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
if (SkuIdTable[1 + Index] == mPcdDatabase->PeiDb.Init.SystemSkuId) {
|
if (SkuIdTable[1 + Index] == mPcdDatabase.PeiDb->SystemSkuId) {
|
||||||
return SizeTable[SizeTableIdx + 1 + Index];
|
return SizeTable[SizeTableIdx + 1 + Index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1382,15 +1461,15 @@ SetPtrTypeSize (
|
|||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
//
|
//
|
||||||
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
IsPeiDb = (BOOLEAN) (LocalTokenNumberTableIdx + 1 < mPeiLocalTokenCount + 1);
|
||||||
|
|
||||||
if (IsPeiDb) {
|
if (IsPeiDb) {
|
||||||
LocalTokenNumberTable = mPcdDatabase->PeiDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->LocalTokenNumberTableOffset);
|
||||||
SizeTable = mPcdDatabase->PeiDb.Init.SizeTable;
|
SizeTable = (SIZE_INFO *)((UINT8 *)mPcdDatabase.PeiDb + mPcdDatabase.PeiDb->SizeTableOffset);
|
||||||
} else {
|
} else {
|
||||||
LocalTokenNumberTableIdx -= PEI_LOCAL_TOKEN_NUMBER;
|
LocalTokenNumberTableIdx -= mPeiLocalTokenCount;
|
||||||
LocalTokenNumberTable = mPcdDatabase->DxeDb.Init.LocalTokenNumberTable;
|
LocalTokenNumberTable = (UINT32 *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->LocalTokenNumberTableOffset);
|
||||||
SizeTable = mPcdDatabase->DxeDb.Init.SizeTable;
|
SizeTable = (SIZE_INFO *)((UINT8 *)mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->SizeTableOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
LocalTokenNumber = LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
||||||
@ -1433,7 +1512,7 @@ SetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
|
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
|
||||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
if (SkuIdTable[1 + Index] == mPcdDatabase->PeiDb.Init.SystemSkuId) {
|
if (SkuIdTable[1 + Index] == mPcdDatabase.PeiDb->SystemSkuId) {
|
||||||
SizeTable[SizeTableIdx + 1 + Index] = (SIZE_INFO) *CurrentSize;
|
SizeTable[SizeTableIdx + 1 + Index] = (SIZE_INFO) *CurrentSize;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Private functions used by PCD DXE driver.
|
Private functions used by PCD DXE 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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
#include <PiDxe.h>
|
#include <PiDxe.h>
|
||||||
#include <Guid/PcdDataBaseHobGuid.h>
|
#include <Guid/PcdDataBaseHobGuid.h>
|
||||||
|
#include <Guid/PcdDataBaseSignatureGuid.h>
|
||||||
#include <Protocol/Pcd.h>
|
#include <Protocol/Pcd.h>
|
||||||
#include <Protocol/PiPcd.h>
|
#include <Protocol/PiPcd.h>
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
@ -34,7 +35,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
// Please make sure the PCD Serivce DXE Version is consistent with
|
// Please make sure the PCD Serivce DXE Version is consistent with
|
||||||
// the version of the generated DXE PCD Database by build tool.
|
// the version of the generated DXE PCD Database by build tool.
|
||||||
//
|
//
|
||||||
#define PCD_SERVICE_DXE_VERSION 2
|
#define PCD_SERVICE_DXE_VERSION 4
|
||||||
|
|
||||||
//
|
//
|
||||||
// PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
|
// PCD_DXE_SERVICE_DRIVER_VERSION is defined in Autogen.h.
|
||||||
@ -995,16 +996,16 @@ BuildPcdDxeDataBase (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
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
|
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
|
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 Guid Token space guid for dynamic-ex PCD entry.
|
||||||
@param ExTokenNumber Dynamic-ex PCD token number.
|
@param ExTokenNumber Dynamic-ex PCD token number.
|
||||||
|
|
||||||
@return local token number for dynamic-ex PCD.
|
@return Token Number for dynamic-ex PCD.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
@ -1079,9 +1080,24 @@ SetPtrTypeSize (
|
|||||||
IN OUT UINTN *CurrentSize
|
IN OUT UINTN *CurrentSize
|
||||||
);
|
);
|
||||||
|
|
||||||
extern PCD_DATABASE * mPcdDatabase;
|
extern PCD_DATABASE mPcdDatabase;
|
||||||
|
|
||||||
extern DXE_PCD_DATABASE_INIT gDXEPcdDbInit;
|
extern UINT32 mPcdTotalTokenCount;
|
||||||
|
extern UINT32 mPeiLocalTokenCount;
|
||||||
|
extern UINT32 mDxeLocalTokenCount;
|
||||||
|
extern UINT32 mPeiNexTokenCount;
|
||||||
|
extern UINT32 mDxeNexTokenCount;
|
||||||
|
extern UINT32 mPeiExMapppingTableSize;
|
||||||
|
extern UINT32 mDxeExMapppingTableSize;
|
||||||
|
extern UINT32 mPeiGuidTableSize;
|
||||||
|
extern UINT32 mDxeGuidTableSize;
|
||||||
|
|
||||||
|
extern BOOLEAN mPeiExMapTableEmpty;
|
||||||
|
extern BOOLEAN mDxeExMapTableEmpty;
|
||||||
|
extern BOOLEAN mPeiDatabaseEmpty;
|
||||||
|
|
||||||
|
extern EFI_GUID **TmpTokenSpaceBuffer;
|
||||||
|
extern UINTN TmpTokenSpaceBufferCount;
|
||||||
|
|
||||||
extern EFI_LOCK mPcdDatabaseLock;
|
extern EFI_LOCK mPcdDatabaseLock;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
All Pcd Ppi services are implemented here.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -116,7 +116,7 @@ PcdPeimInit (
|
|||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
BuildPcdDatabase ();
|
BuildPcdDatabase (FileHandle);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Install PCD_PPI and EFI_PEI_PCD_PPI.
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
@ -304,8 +304,10 @@ PeiPcdGetSize (
|
|||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
UINTN Size;
|
UINTN Size;
|
||||||
UINTN MaxSize;
|
UINTN MaxSize;
|
||||||
|
UINT32 LocalTokenCount;
|
||||||
|
|
||||||
PeiPcdDb = GetPcdDatabase ();
|
PeiPcdDb = GetPcdDatabase ();
|
||||||
|
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// 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
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// 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) {
|
if (Size == 0) {
|
||||||
//
|
//
|
||||||
@ -926,10 +928,8 @@ PcdUnRegisterCallBackOnSet (
|
|||||||
is being made to retrieve tokens from the default token space.
|
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.
|
@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.
|
@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.
|
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
@ -942,55 +942,56 @@ PeiPcdGetNextToken (
|
|||||||
UINTN GuidTableIdx;
|
UINTN GuidTableIdx;
|
||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
EFI_GUID *MatchGuid;
|
EFI_GUID *MatchGuid;
|
||||||
|
EFI_GUID *GuidTable;
|
||||||
DYNAMICEX_MAPPING *ExMapTable;
|
DYNAMICEX_MAPPING *ExMapTable;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
BOOLEAN PeiExMapTableEmpty;
|
BOOLEAN PeiExMapTableEmpty;
|
||||||
|
UINTN PeiNexTokenNumber;
|
||||||
|
|
||||||
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
||||||
return EFI_UNSUPPORTED;
|
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 (Guid == NULL) {
|
||||||
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
|
if (*TokenNumber > PeiNexTokenNumber) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
(*TokenNumber)++;
|
(*TokenNumber)++;
|
||||||
if (*TokenNumber > PEI_NEX_TOKEN_NUMBER) {
|
if (*TokenNumber > PeiNexTokenNumber) {
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
if (PeiExMapTableEmpty) {
|
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;
|
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;
|
Found = FALSE;
|
||||||
//
|
//
|
||||||
// Locate the GUID in ExMapTable first.
|
// 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) {
|
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -1003,26 +1004,28 @@ PeiPcdGetNextToken (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ( ; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
for ( ; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||||
if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {
|
if (ExMapTable[Index].ExTokenNumber == *TokenNumber) {
|
||||||
Index++;
|
break;
|
||||||
if (Index == PEI_EXMAPPING_TABLE_SIZE) {
|
}
|
||||||
//
|
}
|
||||||
// Exceed the length of ExMap Table
|
|
||||||
//
|
while (Index < PeiPcdDb->ExTokenCount) {
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
Index++;
|
||||||
return EFI_SUCCESS;
|
if (Index == PeiPcdDb->ExTokenCount) {
|
||||||
}
|
//
|
||||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
// Exceed the length of ExMap Table
|
||||||
*TokenNumber = ExMapTable[Index].ExTokenNumber;
|
//
|
||||||
return EFI_SUCCESS;
|
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
||||||
} else {
|
return EFI_NOT_FOUND;
|
||||||
*TokenNumber = PCD_INVALID_TOKEN_NUMBER;
|
} else if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||||
return EFI_SUCCESS;
|
//
|
||||||
}
|
// 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.
|
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
|
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
|
||||||
a known token namespace from which the search will start. On output,
|
token namespaces on a platform.
|
||||||
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.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
|
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
|
||||||
Or the input token space Guid is already the last valid token space Guid
|
namespace from which the search will start. On output, it designates the next valid
|
||||||
in the PCD database. In the later case, *Guid is updated with the value of NULL.
|
token namespace on the platform. If *Guid is NULL, then the GUID of the first token
|
||||||
@retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
|
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
|
EFI_STATUS
|
||||||
@ -1061,8 +1059,10 @@ PeiPcdGetNextTokenSpace (
|
|||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
DYNAMICEX_MAPPING *ExMapTable;
|
DYNAMICEX_MAPPING *ExMapTable;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
UINTN Index2;
|
||||||
BOOLEAN Found;
|
BOOLEAN Found;
|
||||||
BOOLEAN PeiExMapTableEmpty;
|
BOOLEAN PeiExMapTableEmpty;
|
||||||
|
EFI_GUID *GuidTable;
|
||||||
|
|
||||||
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
if (!FeaturePcdGet (PcdPeiFullPcdDatabaseEnable)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
@ -1070,43 +1070,39 @@ PeiPcdGetNextTokenSpace (
|
|||||||
|
|
||||||
ASSERT (Guid != NULL);
|
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 ();
|
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) {
|
if (*Guid == NULL) {
|
||||||
//
|
//
|
||||||
// return the first Token Space Guid.
|
// return the first Token Space Guid.
|
||||||
//
|
//
|
||||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[0].ExGuidIndex];
|
*Guid = GuidTable + ExMapTable[0].ExGuidIndex;
|
||||||
return EFI_SUCCESS;
|
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) {
|
if (MatchGuid == NULL) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
GuidTableIdx = MatchGuid - PeiPcdDb->Init.GuidTable;
|
GuidTableIdx = MatchGuid - GuidTable;
|
||||||
|
|
||||||
Found = FALSE;
|
Found = FALSE;
|
||||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
for (Index = 0; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||||
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) {
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -1115,14 +1111,25 @@ PeiPcdGetNextTokenSpace (
|
|||||||
|
|
||||||
if (Found) {
|
if (Found) {
|
||||||
Index++;
|
Index++;
|
||||||
for ( ; Index < PEI_EXMAPPING_TABLE_SIZE; Index++ ) {
|
for ( ; Index < PeiPcdDb->ExTokenCount; Index++ ) {
|
||||||
if (ExMapTable[Index].ExGuidIndex != GuidTableIdx ) {
|
if (ExMapTable[Index].ExGuidIndex != GuidTableIdx) {
|
||||||
*Guid = &PeiPcdDb->Init.GuidTable[ExMapTable[Index].ExGuidIndex];
|
Found = FALSE;
|
||||||
return EFI_SUCCESS;
|
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;
|
*Guid = NULL;
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
@ -1132,7 +1139,7 @@ PeiPcdGetNextTokenSpace (
|
|||||||
/**
|
/**
|
||||||
Get PCD value's size for POINTER type PCD.
|
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.
|
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
|
@param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
|
||||||
@ -1157,11 +1164,11 @@ GetPtrTypeSize (
|
|||||||
|
|
||||||
SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
|
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);
|
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];
|
*MaxSize = SizeTable[SizeTableIdx];
|
||||||
//
|
//
|
||||||
@ -1170,8 +1177,9 @@ GetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
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.
|
// 1) MAX Size.
|
||||||
|
// 2) Current Size
|
||||||
// We consider current size is equal to MAX size.
|
// We consider current size is equal to MAX size.
|
||||||
//
|
//
|
||||||
return *MaxSize;
|
return *MaxSize;
|
||||||
@ -1191,7 +1199,7 @@ GetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
||||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
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];
|
return SizeTable[SizeTableIdx + 1 + Index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1203,7 +1211,7 @@ GetPtrTypeSize (
|
|||||||
/**
|
/**
|
||||||
Set PCD value's size for POINTER type PCD.
|
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.
|
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
|
@param LocalTokenNumberTableIdx Index of PCD token number in PCD token table
|
||||||
@ -1230,11 +1238,11 @@ SetPtrTypeSize (
|
|||||||
|
|
||||||
SizeTableIdx = GetSizeTableIndex (LocalTokenNumberTableIdx, Database);
|
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);
|
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];
|
MaxSize = SizeTable[SizeTableIdx];
|
||||||
//
|
//
|
||||||
@ -1270,7 +1278,7 @@ SetPtrTypeSize (
|
|||||||
//
|
//
|
||||||
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, Database);
|
||||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
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;
|
SizeTable[SizeTableIdx + 1 + Index] = (SIZE_INFO) *CurrentSize;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
## @file
|
## @file
|
||||||
# PCD PEIM produces PCD database to manage all dynamic PCD in PEI phase and install Pcd Ppi service.
|
# 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:
|
# There are two PCD PPIs as follows:
|
||||||
# 1) PCD_PPI
|
# 1) PCD_PPI
|
||||||
# It is EDKII implementation which support Dynamic/DynamicEx Pcds.
|
# 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
|
# It is defined by PI specification 1.2, Vol 3 which only support dynamicEx
|
||||||
# type Pcd.
|
# type Pcd.
|
||||||
# For dynamicEx type PCD, it is compatible between PCD_PPI and EFI_PEI_PCD_PPI.
|
# 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:
|
# b) Variable Storage:
|
||||||
# - The PCD value is stored in variable area.
|
# - The PCD value is stored in variable area.
|
||||||
# - As default storage type, this type PCD could be used for PEI/DXE driver
|
# - 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.
|
# 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
|
# - In PEI phase, the PCD value could only be got but can not be set due
|
||||||
# to variable area is readonly.
|
# 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
|
# 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.
|
# 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.
|
# PEI/DXE PCD driver according to dynamic PCD section in platform DSC file.
|
||||||
#
|
#
|
||||||
# 3.1 PcdPeim and PcdDxe
|
# 3.1 PcdPeim and PcdDxe
|
||||||
# PEI PCD database is maintained by PcdPeim driver run from flash. PcdPeim driver
|
# 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.
|
# to temporary memory for PEI PCD database.
|
||||||
# DXE PCD database is maintained by PcdDxe driver.At entry point of PcdDxe driver,
|
# 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
|
# 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
|
# Based on local token number, PCD driver could fast determine PCD type, value
|
||||||
# type and get PCD entry from PCD database.
|
# type and get PCD entry from PCD database.
|
||||||
#
|
#
|
||||||
# 3.3 PCD Database C structure.
|
# 3.3 PCD Database binary file
|
||||||
# PCD Database C structure is generated by build tools in PCD driver's autogen.h/
|
# 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:
|
# autogen.c file. In generated C structure, following information is stored:
|
||||||
# - ExMapTable: This table is used translate a binary dynamicex type PCD's
|
# - ExMapTable: This table is used translate a binary dynamicex type PCD's
|
||||||
# "tokenguid + token" to local token number.
|
# "tokenguid + token" to local token number.
|
||||||
@ -190,7 +197,7 @@
|
|||||||
# token number" as array index to get PCD entry's offset fastly.
|
# token number" as array index to get PCD entry's offset fastly.
|
||||||
# - SizeTable: This table stores the size information for all PCD entry.
|
# - SizeTable: This table stores the size information for all PCD entry.
|
||||||
# - GuidTable: This table stores guid value for DynamicEx's token space,
|
# - GuidTable: This table stores guid value for DynamicEx's token space,
|
||||||
# HII type PCD's variable.
|
# HII type PCD's variable GUID.
|
||||||
# - SkuIdTable: TBD
|
# - SkuIdTable: TBD
|
||||||
# - SystemSkuId: TBD
|
# - SystemSkuId: TBD
|
||||||
# - PCD value structure:
|
# - PCD value structure:
|
||||||
@ -271,7 +278,7 @@
|
|||||||
# - Variable GUID for HII type PCD
|
# - Variable GUID for HII type PCD
|
||||||
# - Token space GUID for dynamicex 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
|
# This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -288,7 +295,7 @@
|
|||||||
BASE_NAME = PcdPeim
|
BASE_NAME = PcdPeim
|
||||||
FILE_GUID = 9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50
|
FILE_GUID = 9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50
|
||||||
MODULE_TYPE = PEIM
|
MODULE_TYPE = PEIM
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 4.0
|
||||||
PCD_IS_DRIVER = PEI_PCD_DRIVER
|
PCD_IS_DRIVER = PEI_PCD_DRIVER
|
||||||
ENTRY_POINT = PcdPeimInit
|
ENTRY_POINT = PcdPeimInit
|
||||||
|
|
||||||
@ -317,20 +324,22 @@
|
|||||||
DebugLib
|
DebugLib
|
||||||
|
|
||||||
[Guids]
|
[Guids]
|
||||||
gPcdDataBaseHobGuid ## PRODUCES ## Hob
|
## PRODUCES ## HOB
|
||||||
gPcdDataBaseHobGuid ## CONSUMES ## Hob
|
## SOMETIMES_CONSUMES ## HOB
|
||||||
|
gPcdDataBaseHobGuid
|
||||||
|
gPcdDataBaseSignatureGuid ## CONSUMES ## UNDEFINED # PCD database signature GUID.
|
||||||
|
|
||||||
[Ppis]
|
[Ppis]
|
||||||
gEfiPeiReadOnlyVariable2PpiGuid ## CONSUMES
|
gEfiPeiReadOnlyVariable2PpiGuid ## SOMETIMES_CONSUMES
|
||||||
gPcdPpiGuid ## PRODUCES
|
gPcdPpiGuid ## PRODUCES
|
||||||
gEfiPeiPcdPpiGuid ## PRODUCES
|
gEfiPeiPcdPpiGuid ## PRODUCES
|
||||||
|
|
||||||
[FeaturePcd]
|
[FeaturePcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable
|
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable ## CONSUMES
|
||||||
|
|
||||||
[Pcd]
|
[Pcd]
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress
|
gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress ## SOMETIMES_CONSUMES
|
||||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry || gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable
|
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxPeiPcdCallBackNumberPerPcdEntry || gEfiMdeModulePkgTokenSpaceGuid.PcdPeiFullPcdDatabaseEnable ## SOMETIMES_CONSUMES
|
||||||
|
|
||||||
[Depex]
|
[Depex]
|
||||||
TRUE
|
TRUE
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
The driver internal functions are implmented here.
|
The driver internal functions are implmented here.
|
||||||
They build Pei PCD database, and provide access service to PCD database.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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 Compare;
|
||||||
PCD_PPI_CALLBACK Assign;
|
PCD_PPI_CALLBACK Assign;
|
||||||
UINT32 LocalTokenNumber;
|
UINT32 LocalTokenNumber;
|
||||||
|
UINT32 LocalTokenCount;
|
||||||
|
UINTN PeiNexTokenNumber;
|
||||||
UINTN TokenNumber;
|
UINTN TokenNumber;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
|
|
||||||
|
PeiPcdDb = GetPcdDatabase();
|
||||||
|
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||||
|
PeiNexTokenNumber = PeiPcdDb->LocalTokenCount - PeiPcdDb->ExTokenCount;
|
||||||
|
|
||||||
if (Guid == NULL) {
|
if (Guid == NULL) {
|
||||||
TokenNumber = ExTokenNumber;
|
TokenNumber = ExTokenNumber;
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// We have to decrement TokenNumber by 1 to make it usable
|
||||||
// as the array index.
|
// as the array index.
|
||||||
//
|
//
|
||||||
TokenNumber--;
|
TokenNumber--;
|
||||||
ASSERT (TokenNumber + 1 < PEI_NEX_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < (PeiNexTokenNumber + 1));
|
||||||
} else {
|
} else {
|
||||||
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
|
TokenNumber = GetExPcdTokenNumber (Guid, ExTokenNumber);
|
||||||
if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
|
if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
// We have to decrement TokenNumber by 1 to make it usable
|
// 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
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// 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.
|
// 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.
|
The function builds the PCD database.
|
||||||
|
|
||||||
|
@param FileHandle Handle of the file the external PCD database binary located.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
BuildPcdDatabase (
|
BuildPcdDatabase (
|
||||||
VOID
|
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
PEI_PCD_DATABASE *Database;
|
PEI_PCD_DATABASE *Database;
|
||||||
VOID *CallbackFnTable;
|
PEI_PCD_DATABASE *PeiPcdDbBinary;
|
||||||
UINTN SizeOfCallbackFnTable;
|
VOID *CallbackFnTable;
|
||||||
|
UINTN SizeOfCallbackFnTable;
|
||||||
Database = BuildGuidHob (&gPcdDataBaseHobGuid, sizeof (PEI_PCD_DATABASE));
|
|
||||||
|
|
||||||
ZeroMem (Database, sizeof (PEI_PCD_DATABASE));
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// gPEIPcdDbInit is smaller than PEI_PCD_DATABASE
|
// Locate the external PCD database binary for one section of current FFS
|
||||||
//
|
//
|
||||||
|
PeiPcdDbBinary = LocateExPcdBinary (FileHandle);
|
||||||
CopyMem (&Database->Init, &gPEIPcdDbInit, sizeof (gPEIPcdDbInit));
|
|
||||||
|
|
||||||
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);
|
CallbackFnTable = BuildGuidHob (&gEfiCallerIdGuid, SizeOfCallbackFnTable);
|
||||||
|
|
||||||
@ -215,6 +265,7 @@ GetSkuEnabledTokenNumber (
|
|||||||
SKU_ID *SkuIdTable;
|
SKU_ID *SkuIdTable;
|
||||||
INTN Index;
|
INTN Index;
|
||||||
UINT8 *Value;
|
UINT8 *Value;
|
||||||
|
BOOLEAN FoundSku;
|
||||||
|
|
||||||
PeiPcdDb = GetPcdDatabase ();
|
PeiPcdDb = GetPcdDatabase ();
|
||||||
|
|
||||||
@ -223,13 +274,30 @@ GetSkuEnabledTokenNumber (
|
|||||||
SkuHead = (SKU_HEAD *) ((UINT8 *)PeiPcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
|
SkuHead = (SKU_HEAD *) ((UINT8 *)PeiPcdDb + (LocalTokenNumber & PCD_DATABASE_OFFSET_MASK));
|
||||||
Value = (UINT8 *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuDataStartOffset));
|
Value = (UINT8 *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuDataStartOffset));
|
||||||
SkuIdTable = (SKU_ID *) ((UINT8 *)PeiPcdDb + (SkuHead->SkuIdTableOffset));
|
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++) {
|
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||||
if (PeiPcdDb->Init.SystemSkuId == SkuIdTable[Index + 1]) {
|
if (PeiPcdDb->SystemSkuId == SkuIdTable[Index + 1]) {
|
||||||
|
FoundSku = TRUE;
|
||||||
break;
|
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) {
|
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||||
case PCD_TYPE_VPD:
|
case PCD_TYPE_VPD:
|
||||||
Value = (UINT8 *) &(((VPD_HEAD *) Value)[Index]);
|
Value = (UINT8 *) &(((VPD_HEAD *) Value)[Index]);
|
||||||
@ -238,14 +306,18 @@ GetSkuEnabledTokenNumber (
|
|||||||
case PCD_TYPE_HII:
|
case PCD_TYPE_HII:
|
||||||
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
Value = (UINT8 *) &(((VARIABLE_HEAD *) Value)[Index]);
|
||||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_HII);
|
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:
|
case PCD_TYPE_STRING:
|
||||||
Value = (UINT8 *) &(((STRING_HEAD *) Value)[Index]);
|
Value = (UINT8 *) &(((STRING_HEAD *) Value)[Index]);
|
||||||
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
|
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_STRING);
|
||||||
|
|
||||||
case PCD_TYPE_DATA:
|
case PCD_TYPE_DATA:
|
||||||
Value += Size * Index;
|
Value += Size * Index;
|
||||||
return (UINT32) (Value - (UINT8 *) PeiPcdDb);
|
return (UINT32) ((Value - (UINT8 *) PeiPcdDb) | PCD_TYPE_DATA);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
ASSERT (FALSE);
|
ASSERT (FALSE);
|
||||||
@ -281,6 +353,8 @@ InvokeCallbackOnSet (
|
|||||||
EFI_HOB_GUID_TYPE *GuidHob;
|
EFI_HOB_GUID_TYPE *GuidHob;
|
||||||
PCD_PPI_CALLBACK *CallbackTable;
|
PCD_PPI_CALLBACK *CallbackTable;
|
||||||
UINTN Idx;
|
UINTN Idx;
|
||||||
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
|
UINT32 LocalTokenCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
@ -288,12 +362,15 @@ InvokeCallbackOnSet (
|
|||||||
// as the array index.
|
// as the array index.
|
||||||
//
|
//
|
||||||
TokenNumber--;
|
TokenNumber--;
|
||||||
|
|
||||||
|
PeiPcdDb = GetPcdDatabase ();
|
||||||
|
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||||
|
|
||||||
if (Guid == NULL) {
|
if (Guid == NULL) {
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
|
GuidHob = GetFirstGuidHob (&gEfiCallerIdGuid);
|
||||||
@ -359,11 +436,13 @@ SetWorker (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINT32 LocalTokenNumber;
|
UINT32 LocalTokenNumber;
|
||||||
|
UINTN PeiNexTokenNumber;
|
||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
STRING_HEAD StringTableIdx;
|
STRING_HEAD StringTableIdx;
|
||||||
UINTN Offset;
|
UINTN Offset;
|
||||||
VOID *InternalData;
|
VOID *InternalData;
|
||||||
UINTN MaxSize;
|
UINTN MaxSize;
|
||||||
|
UINT32 LocalTokenCount;
|
||||||
|
|
||||||
if (!FeaturePcdGet(PcdPeiFullPcdDatabaseEnable)) {
|
if (!FeaturePcdGet(PcdPeiFullPcdDatabaseEnable)) {
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
@ -375,15 +454,15 @@ SetWorker (
|
|||||||
// as the array index.
|
// as the array index.
|
||||||
//
|
//
|
||||||
TokenNumber--;
|
TokenNumber--;
|
||||||
|
PeiPcdDb = GetPcdDatabase ();
|
||||||
|
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||||
|
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||||
|
|
||||||
PeiPcdDb = GetPcdDatabase ();
|
|
||||||
|
|
||||||
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber);
|
||||||
|
|
||||||
if (PtrType) {
|
if (PtrType) {
|
||||||
//
|
//
|
||||||
@ -405,7 +484,8 @@ SetWorker (
|
|||||||
// For Dynamic EX PCD entry, we have invoked the callback function for Dynamic EX
|
// For Dynamic EX PCD entry, we have invoked the callback function for Dynamic EX
|
||||||
// type PCD entry in ExSetWorker.
|
// 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);
|
InvokeCallbackOnSet (0, NULL, TokenNumber + 1, Data, *Size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -433,7 +513,7 @@ SetWorker (
|
|||||||
case PCD_TYPE_STRING:
|
case PCD_TYPE_STRING:
|
||||||
if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
|
if (SetPtrTypeSize (TokenNumber, Size, PeiPcdDb)) {
|
||||||
StringTableIdx = *((STRING_HEAD *)InternalData);
|
StringTableIdx = *((STRING_HEAD *)InternalData);
|
||||||
CopyMem (&PeiPcdDb->Init.StringTable[StringTableIdx], Data, *Size);
|
CopyMem ((UINT8 *)PeiPcdDb + PeiPcdDb->StringTableOffset + StringTableIdx, Data, *Size);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
} else {
|
} else {
|
||||||
return EFI_INVALID_PARAMETER;
|
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
|
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
|
space guid and token number firstly, and invoke callback function if this PCD
|
||||||
@ -598,6 +678,7 @@ GetWorker (
|
|||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
UINT32 LocalTokenNumber;
|
UINT32 LocalTokenNumber;
|
||||||
UINTN MaxSize;
|
UINTN MaxSize;
|
||||||
|
UINT32 LocalTokenCount;
|
||||||
|
|
||||||
//
|
//
|
||||||
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
// TokenNumber Zero is reserved as PCD_INVALID_TOKEN_NUMBER.
|
||||||
@ -606,16 +687,17 @@ GetWorker (
|
|||||||
//
|
//
|
||||||
TokenNumber--;
|
TokenNumber--;
|
||||||
|
|
||||||
|
PeiPcdDb = GetPcdDatabase ();
|
||||||
|
LocalTokenCount = PeiPcdDb->LocalTokenCount;
|
||||||
|
|
||||||
// EBC compiler is very choosy. It may report warning about comparison
|
// EBC compiler is very choosy. It may report warning about comparison
|
||||||
// between UINTN and 0 . So we add 1 in each size of the
|
// between UINTN and 0 . So we add 1 in each size of the
|
||||||
// comparison.
|
// comparison.
|
||||||
ASSERT (TokenNumber + 1 < PEI_LOCAL_TOKEN_NUMBER + 1);
|
ASSERT (TokenNumber + 1 < (LocalTokenCount + 1));
|
||||||
|
|
||||||
ASSERT ((GetSize == PeiPcdGetSize(TokenNumber + 1)) || (GetSize == 0));
|
ASSERT ((GetSize == PeiPcdGetSize(TokenNumber + 1)) || (GetSize == 0));
|
||||||
|
|
||||||
PeiPcdDb = GetPcdDatabase ();
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)PeiPcdDb + PeiPcdDb->LocalTokenNumberTableOffset) + TokenNumber);
|
||||||
|
|
||||||
LocalTokenNumber = PeiPcdDb->Init.LocalTokenNumberTable[TokenNumber];
|
|
||||||
|
|
||||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == PCD_TYPE_SKU_ENABLED) {
|
||||||
if (GetSize == 0) {
|
if (GetSize == 0) {
|
||||||
@ -627,8 +709,8 @@ GetWorker (
|
|||||||
}
|
}
|
||||||
|
|
||||||
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
Offset = LocalTokenNumber & PCD_DATABASE_OFFSET_MASK;
|
||||||
StringTable = PeiPcdDb->Init.StringTable;
|
StringTable = (UINT8 *)PeiPcdDb + PeiPcdDb->StringTableOffset;
|
||||||
|
|
||||||
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
switch (LocalTokenNumber & PCD_TYPE_ALL_SET) {
|
||||||
case PCD_TYPE_VPD:
|
case PCD_TYPE_VPD:
|
||||||
{
|
{
|
||||||
@ -642,7 +724,7 @@ GetWorker (
|
|||||||
{
|
{
|
||||||
VariableHead = (VARIABLE_HEAD *) ((UINT8 *)PeiPcdDb + Offset);
|
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];
|
Name = (UINT16*)&StringTable[VariableHead->StringIndex];
|
||||||
|
|
||||||
Status = GetHiiVariable (Guid, Name, &Data, &DataSize);
|
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
|
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
|
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 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
|
UINTN
|
||||||
@ -707,11 +789,11 @@ GetExPcdTokenNumber (
|
|||||||
PEI_PCD_DATABASE *PeiPcdDb;
|
PEI_PCD_DATABASE *PeiPcdDb;
|
||||||
|
|
||||||
PeiPcdDb = GetPcdDatabase();
|
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
|
// We need to ASSERT here. If GUID can't be found in GuidTable, this is a
|
||||||
// error in the BUILD system.
|
// error in the BUILD system.
|
||||||
@ -720,10 +802,10 @@ GetExPcdTokenNumber (
|
|||||||
|
|
||||||
MatchGuidIdx = MatchGuid - GuidTable;
|
MatchGuidIdx = MatchGuid - GuidTable;
|
||||||
|
|
||||||
for (Index = 0; Index < PEI_EXMAPPING_TABLE_SIZE; Index++) {
|
for (Index = 0; Index < PeiPcdDb->ExTokenCount; Index++) {
|
||||||
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
if ((ExTokenNumber == ExMap[Index].ExTokenNumber) &&
|
||||||
(MatchGuidIdx == ExMap[Index].ExGuidIndex)) {
|
(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 LocalTokenNumberTableIdx Index of local token number in token number table.
|
||||||
@param Database PCD database.
|
@param Database PCD database.
|
||||||
@ -767,7 +849,7 @@ GetSkuIdArray (
|
|||||||
SKU_HEAD *SkuHead;
|
SKU_HEAD *SkuHead;
|
||||||
UINTN LocalTokenNumber;
|
UINTN LocalTokenNumber;
|
||||||
|
|
||||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[LocalTokenNumberTableIdx];
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + LocalTokenNumberTableIdx);
|
||||||
|
|
||||||
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
|
ASSERT ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) != 0);
|
||||||
|
|
||||||
@ -793,14 +875,14 @@ GetSizeTableIndex (
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
UINTN SizeTableIdx;
|
UINTN SizeTableIdx;
|
||||||
UINTN LocalTokenNumber;
|
UINTN LocalTokenNumber;
|
||||||
SKU_ID *SkuIdTable;
|
SKU_ID *SkuIdTable;
|
||||||
|
|
||||||
SizeTableIdx = 0;
|
SizeTableIdx = 0;
|
||||||
|
|
||||||
for (Index=0; Index<LocalTokenNumberTableIdx; Index++) {
|
for (Index = 0; Index < LocalTokenNumberTableIdx; Index++) {
|
||||||
LocalTokenNumber = Database->Init.LocalTokenNumberTable[Index];
|
LocalTokenNumber = *((UINT32 *)((UINT8 *)Database + Database->LocalTokenNumberTableOffset) + Index);
|
||||||
|
|
||||||
if ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER) {
|
if ((LocalTokenNumber & PCD_DATUM_TYPE_ALL_SET) == PCD_DATUM_TYPE_POINTER) {
|
||||||
//
|
//
|
||||||
@ -809,11 +891,12 @@ GetSizeTableIndex (
|
|||||||
//
|
//
|
||||||
if ((LocalTokenNumber & PCD_TYPE_VPD) != 0) {
|
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.
|
// 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 {
|
} else {
|
||||||
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
|
if ((LocalTokenNumber & PCD_TYPE_SKU_ENABLED) == 0) {
|
||||||
//
|
//
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
The internal header file declares the private functions used by PeiPcd driver.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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/Pcd.h>
|
||||||
#include <Ppi/PiPcd.h>
|
#include <Ppi/PiPcd.h>
|
||||||
#include <Guid/PcdDataBaseHobGuid.h>
|
#include <Guid/PcdDataBaseHobGuid.h>
|
||||||
|
#include <Guid/PcdDataBaseSignatureGuid.h>
|
||||||
#include <Library/DebugLib.h>
|
#include <Library/DebugLib.h>
|
||||||
#include <Library/PeimEntryPoint.h>
|
#include <Library/PeimEntryPoint.h>
|
||||||
#include <Library/BaseLib.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
|
// Please make sure the PCD Serivce PEIM Version is consistent with
|
||||||
// the version of the generated PEIM PCD Database by build tool.
|
// 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.
|
// PCD_PEI_SERVICE_DRIVER_VERSION is defined in Autogen.h.
|
||||||
@ -896,16 +897,16 @@ typedef struct {
|
|||||||
} EX_PCD_ENTRY_ATTRIBUTE;
|
} 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
|
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
|
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 Guid Token space guid for dynamic-ex PCD entry.
|
||||||
@param ExTokenNumber Token number for dynamic-ex PCD.
|
@param ExTokenNumber Token number for dynamic-ex PCD.
|
||||||
|
|
||||||
@return local token number for dynamic-ex PCD.
|
@return Token Number for dynamic-ex PCD.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
UINTN
|
UINTN
|
||||||
@ -938,10 +939,13 @@ PeiRegisterCallBackWorker (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
The function builds the PCD database.
|
The function builds the PCD database.
|
||||||
|
|
||||||
|
@param FileHandle Handle of the file the external PCD database binary located.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
VOID
|
VOID
|
||||||
BuildPcdDatabase (
|
BuildPcdDatabase (
|
||||||
VOID
|
IN EFI_PEI_FILE_HANDLE FileHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1015,10 +1019,5 @@ SetPtrTypeSize (
|
|||||||
IN PEI_PCD_DATABASE *Database
|
IN PEI_PCD_DATABASE *Database
|
||||||
);
|
);
|
||||||
|
|
||||||
//
|
|
||||||
// The init Database created by PCD Database generation tool
|
|
||||||
//
|
|
||||||
extern PEI_PCD_DATABASE_INIT gPEIPcdDbInit;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
|
There are no restrictions on the use of FeaturePcd(), FixedPcdGetXX(),
|
||||||
PatchPcdGetXX(), and PatchPcdSetXX().
|
PatchPcdGetXX(), and PatchPcdSetXX().
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -532,6 +532,20 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
|
#define PcdSetBool(TokenName, Value) _PCD_SET_MODE_BOOL_##TokenName ((Value))
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
Retrieves a token number based on a GUID and a token name.
|
||||||
|
|
||||||
|
Returns the token number for the token specified by Guid and TokenName.
|
||||||
|
|
||||||
|
@param Guid Pointer to a 128-bit unique value that designates
|
||||||
|
which namespace to retrieve a value from.
|
||||||
|
@param TokenName The name of the PCD token to retrieve a current value for.
|
||||||
|
|
||||||
|
@return Return the token number.
|
||||||
|
|
||||||
|
**/
|
||||||
|
#define PcdTokenEx(Guid,TokenName) _PCD_TOKEN_EX_##TokenName(Guid)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves an 8-bit PCD token value based on a GUID and a token name.
|
Retrieves an 8-bit PCD token value based on a GUID and a token name.
|
||||||
|
|
||||||
@ -548,8 +562,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return An 8-bit PCD token value.
|
@return An 8-bit PCD token value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves a 16-bit PCD token value based on a GUID and a token name.
|
Retrieves a 16-bit PCD token value based on a GUID and a token name.
|
||||||
@ -567,7 +580,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return A 16-bit PCD token value.
|
@return A 16-bit PCD token value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -586,7 +599,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return A 32-bit PCD token value.
|
@return A 32-bit PCD token value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -605,7 +618,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return A 64-bit PCD token value.
|
@return A 64-bit PCD token value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -624,7 +637,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return A pointer to a PCD token buffer.
|
@return A pointer to a PCD token buffer.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -643,7 +656,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return A Boolean PCD token value.
|
@return A Boolean PCD token value.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), _PCD_TOKEN_##TokenName)
|
#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool ((Guid), PcdTokenEx(Guid,TokenName))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -663,7 +676,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return Return the Value that was set.
|
@return Return the Value that was set.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -683,7 +696,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return Return the Value that was set.
|
@return Return the Value that was set.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -703,7 +716,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return Return the Value that was set.
|
@return Return the Value that was set.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -723,7 +736,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
@return Return the Value that was set.
|
@return Return the Value that was set.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), _PCD_TOKEN_##TokenName, (Value))
|
#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 ((Guid), PcdTokenEx(Guid,TokenName), (Value))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -752,7 +765,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
|
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) \
|
||||||
LibPcdSetExPtr ((Guid), _PCD_TOKEN_##TokenName, (SizeOfBuffer), (Buffer))
|
LibPcdSetExPtr ((Guid), PcdTokenEx(Guid,TokenName), (SizeOfBuffer), (Buffer))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -773,7 +786,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
**/
|
**/
|
||||||
#define PcdSetExBool(Guid, TokenName, Value) \
|
#define PcdSetExBool(Guid, TokenName, Value) \
|
||||||
LibPcdSetExBool((Guid), _PCD_TOKEN_##TokenName, (Value))
|
LibPcdSetExBool((Guid), PcdTokenEx(Guid,TokenName), (Value))
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
The interfaces for dynamic type PCD do not require the token space guid as parameter,
|
The interfaces for dynamic type PCD do not require the token space guid as parameter,
|
||||||
but interfaces for dynamic-ex type PCD require token space guid as parameter.
|
but interfaces for dynamic-ex type PCD require token space guid as parameter.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, 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
|
This program and the accompanying materials are licensed and made available under
|
||||||
the terms and conditions of the BSD License that accompanies this distribution.
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
@ -775,10 +775,8 @@ EFI_STATUS
|
|||||||
is being made to retrieve tokens from the default token space.
|
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.
|
@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.
|
@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.
|
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
@ -793,25 +791,17 @@ EFI_STATUS
|
|||||||
/**
|
/**
|
||||||
Retrieves the next valid PCD token namespace for a given namespace.
|
Retrieves the next valid PCD token namespace for a given namespace.
|
||||||
|
|
||||||
If *Guid is NULL, then the GUID of the first token space of the
|
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
|
||||||
current platform is assigned to *Guid the function return EFI_SUCCESS.
|
token namespaces on a platform.
|
||||||
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.
|
|
||||||
|
|
||||||
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known
|
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token
|
||||||
token namespace from which the search will start. On output, it designates
|
namespace from which the search will start. On output, it designates the next valid
|
||||||
the next valid token namespace on the platform. If the input token namespace
|
token namespace on the platform. If *Guid is NULL, then the GUID of the first token
|
||||||
does not exist on the platform, an error is returned, and the value of *Guid is
|
space of the current platform is returned. If the search cannot locate the next valid
|
||||||
undefined.
|
token namespace, an error is returned and the value of *Guid is undefined.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service has retrieved the next valid token namespace.
|
@retval EFI_SUCCESS The PCD service retrieved the value requested.
|
||||||
Or the input token namespace is already the last valid token
|
@retval EFI_NOT_FOUND The PCD service could not find the next valid token namespace.
|
||||||
number in the PCD database. In the later case, *Guid is updated
|
|
||||||
with the value of NULL. Or the input token name space is NULL and there
|
|
||||||
is no valid token namespace other than the default namespace (NULL).
|
|
||||||
@retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Platform Configuration Database (PCD) Protocol defined in PI 1.2 Vol3
|
Platform Configuration Database (PCD) PPI defined in PI 1.2 Vol3
|
||||||
|
|
||||||
A platform database that contains a variety of current platform settings or
|
A platform database that contains a variety of current platform settings or
|
||||||
directives that can be accessed by a driver or application.
|
directives that can be accessed by a driver or application.
|
||||||
PI PCD protocol only provide the accessing interfaces for Dynamic-Ex type PCD.
|
PI PCD ppi only provide the accessing interfaces for Dynamic-Ex type PCD.
|
||||||
|
|
||||||
Callers to this protocol must be at a TPL_APPLICATION task priority level.
|
|
||||||
This is the base PCD service API that provides an abstraction for accessing configuration content in
|
This is the base PCD service API that provides an abstraction for accessing configuration content in
|
||||||
the platform. It a seamless mechanism for extracting information regardless of where the
|
the platform. It a seamless mechanism for extracting information regardless of where the
|
||||||
information is stored (such as in Read-only data, or an EFI Variable).
|
information is stored (such as in Read-only data, or an EFI Variable).
|
||||||
This protocol allows access to data through size-granular APIs and provides a mechanism for a
|
This protocol allows access to data through size-granular APIs and provides a mechanism for a
|
||||||
firmware component to monitor specific settings and be alerted when a setting is changed.
|
firmware component to monitor specific settings and be alerted when a setting is changed.
|
||||||
|
|
||||||
Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -73,7 +72,7 @@ UINT8
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the current byte-sized value for a PCD token number. If the TokenNumber is invalid,
|
Retrieves the current word-sized value for a PCD token number. If the TokenNumber is invalid,
|
||||||
the results are unpredictable.
|
the results are unpredictable.
|
||||||
|
|
||||||
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
|
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
|
||||||
@ -375,7 +374,8 @@ EFI_STATUS
|
|||||||
know what token numbers are valid in the database.
|
know what token numbers are valid in the database.
|
||||||
|
|
||||||
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
|
@param[in] Guid The 128-bit unique value that designates which namespace to extract the value from.
|
||||||
@param[in] TokenNumber The PCD token number.
|
@param[in] TokenNumber A pointer to the PCD token number to use to find the subsequent token number. To
|
||||||
|
retrieve the "first" token, have the pointer reference a TokenNumber value of 0.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service has retrieved the value requested.
|
@retval EFI_SUCCESS The PCD service has retrieved the value requested.
|
||||||
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
The interfaces in dynamic type PCD do not require the token space guid as parameter,
|
The interfaces in dynamic type PCD do not require the token space guid as parameter,
|
||||||
but interfaces in dynamic-ex type PCD require token space guid as parameter.
|
but interfaces in dynamic-ex type PCD require token space guid as parameter.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, 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
|
This program and the accompanying materials are licensed and made available under
|
||||||
the terms and conditions of the BSD License that accompanies this distribution.
|
the terms and conditions of the BSD License that accompanies this distribution.
|
||||||
The full text of the license may be found at
|
The full text of the license may be found at
|
||||||
@ -766,7 +766,7 @@ EFI_STATUS
|
|||||||
Retrieves the next valid token number in a given namespace.
|
Retrieves the next valid token number in a given namespace.
|
||||||
|
|
||||||
This is useful since the PCD infrastructure contains a sparse list of token numbers,
|
This is useful since the PCD infrastructure contains a sparse list of token numbers,
|
||||||
and one cannot know without examination or by deduction what token numbers are valid in the database.
|
and one cannot a priori know what token numbers are valid in the database.
|
||||||
|
|
||||||
If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
|
If TokenNumber is 0 and Guid is not NULL, then the first token from the token space specified by Guid is returned.
|
||||||
If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
|
If TokenNumber is not 0 and Guid is not NULL, then the next token in the token space specified by Guid is returned.
|
||||||
@ -784,10 +784,8 @@ EFI_STATUS
|
|||||||
@param[in,out] TokenNumber
|
@param[in,out] TokenNumber
|
||||||
A pointer to the PCD token number to use to find the subsequent token number.
|
A pointer to the PCD token number to use to find the subsequent token number.
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service retrieved the next valid token number. Or the input token number
|
@retval EFI_SUCCESS The PCD service has retrieved the next valid token number.
|
||||||
is already the last valid token number in the PCD database.
|
@retval EFI_NOT_FOUND The PCD service could not find data from the requested token number.
|
||||||
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.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
@ -802,22 +800,17 @@ EFI_STATUS
|
|||||||
/**
|
/**
|
||||||
Retrieves the next valid PCD token namespace for a given namespace.
|
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
|
Gets the next valid token namespace for a given namespace. This is useful to traverse the valid
|
||||||
a known token namespace from which the search will start. On output,
|
token namespaces on a platform.
|
||||||
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) token namespace, *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.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The PCD service retrieved the next valid token space Guid.
|
@param[in, out] Guid An indirect pointer to EFI_GUID. On input it designates a known token namespace
|
||||||
Or, the input token space Guid is already the last valid token space Guid
|
from which the search will start. On output, it designates the next valid token
|
||||||
in the PCD database. In the later case, *Guid is updated with the value of NULL.
|
namespace on the platform. If *Guid is NULL, then the GUID of the first token
|
||||||
@retval EFI_NOT_FOUND If the input token namespace does not exist on the platform.
|
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.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
typedef
|
typedef
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of PcdLib class library for DXE phase.
|
Implementation of PcdLib class library for DXE phase.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -955,10 +955,7 @@ LibPcdGetNextToken (
|
|||||||
IN UINTN TokenNumber
|
IN UINTN TokenNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
|
||||||
|
|
||||||
Status = GetPiPcdProtocol()->GetNextToken (Guid, &TokenNumber);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return TokenNumber;
|
return TokenNumber;
|
||||||
}
|
}
|
||||||
@ -984,10 +981,7 @@ LibPcdGetNextTokenSpace (
|
|||||||
IN CONST GUID *TokenSpaceGuid
|
IN CONST GUID *TokenSpaceGuid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
|
||||||
|
|
||||||
Status = GetPiPcdProtocol()->GetNextTokenSpace (&TokenSpaceGuid);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return (GUID *)TokenSpaceGuid;
|
return (GUID *)TokenSpaceGuid;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Implementation of PcdLib class library for PEI phase.
|
Implementation of PcdLib class library for PEI phase.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -962,11 +962,7 @@ LibPcdGetNextToken (
|
|||||||
IN UINTN TokenNumber
|
IN UINTN TokenNumber
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
(GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
|
||||||
|
|
||||||
Status = (GetPiPcdPpiPointer ())->GetNextToken (Guid, &TokenNumber);
|
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return TokenNumber;
|
return TokenNumber;
|
||||||
}
|
}
|
||||||
@ -991,11 +987,7 @@ LibPcdGetNextTokenSpace (
|
|||||||
IN CONST GUID *TokenSpaceGuid
|
IN CONST GUID *TokenSpaceGuid
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
(GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
|
||||||
|
|
||||||
Status = (GetPiPcdPpiPointer ())->GetNextTokenSpace (&TokenSpaceGuid);
|
|
||||||
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
|
|
||||||
return (GUID *) TokenSpaceGuid;
|
return (GUID *) TokenSpaceGuid;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user