summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2015-04-14 08:54:11 +0000
committerlzeng14 <lzeng14@Edk2>2015-04-14 08:54:11 +0000
commit85d0b97d8d60fdcc740ae21f19c06ab0eeba9950 (patch)
tree2a4580a05bc2f5962c50145f48a329266d743eec /MdeModulePkg/Universal/PCD/Dxe/Pcd.c
parenta4d42c22d23fe19634e10f6c1a2ce1badccd6233 (diff)
downloadedk2-85d0b97d8d60fdcc740ae21f19c06ab0eeba9950.zip
edk2-85d0b97d8d60fdcc740ae21f19c06ab0eeba9950.tar.gz
edk2-85d0b97d8d60fdcc740ae21f19c06ab0eeba9950.tar.bz2
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
Diffstat (limited to 'MdeModulePkg/Universal/PCD/Dxe/Pcd.c')
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Pcd.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
index 6afcd18..14d4784 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
@@ -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;
}