MdeModulePkg Pcd: Check the input SkuId in SetSku()
then GetSku() could return the currently active SkuId. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17173 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -152,21 +152,16 @@ PcdDxeInit (
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Only install PcdInfo PROTOCOL when PCD info content is present.
|
||||
// Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
|
||||
// Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type PCD
|
||||
//
|
||||
if (mPcdDatabase.DxeDb->PcdNameTableOffset != 0) {
|
||||
//
|
||||
// Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
|
||||
// Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type PCD
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mPcdHandle,
|
||||
&gGetPcdInfoProtocolGuid, &mGetPcdInfoInstance,
|
||||
&gEfiGetPcdInfoProtocolGuid, &mEfiGetPcdInfoInstance,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
}
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mPcdHandle,
|
||||
&gGetPcdInfoProtocolGuid, &mGetPcdInfoInstance,
|
||||
&gEfiGetPcdInfoProtocolGuid, &mEfiGetPcdInfoInstance,
|
||||
NULL
|
||||
);
|
||||
ASSERT_EFI_ERROR (Status);
|
||||
|
||||
//
|
||||
// Register callback function upon VariableLockProtocol
|
||||
@@ -274,8 +269,22 @@ DxePcdSetSku (
|
||||
IN UINTN SkuId
|
||||
)
|
||||
{
|
||||
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
|
||||
|
||||
SKU_ID *SkuIdTable;
|
||||
UINTN Index;
|
||||
|
||||
SkuIdTable = (SKU_ID *) ((UINT8 *) mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->SkuIdTableOffset);
|
||||
for (Index = 0; Index < SkuIdTable[0]; Index++) {
|
||||
if (SkuId == SkuIdTable[Index + 1]) {
|
||||
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Invalid input SkuId, the default SKU Id will be used for the system.
|
||||
//
|
||||
DEBUG ((EFI_D_INFO, "PcdDxe - Invalid input SkuId, the default SKU Id will be used.\n"));
|
||||
mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user