summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/PCD
diff options
context:
space:
mode:
authorStar Zeng <star.zeng@intel.com>2013-12-29 07:14:57 +0000
committerlzeng14 <lzeng14@6f19259b-4bc3-4df7-8a09-765794883524>2013-12-29 07:14:57 +0000
commitefd6b412c65a157ac040c9ed70024ed5ad77af61 (patch)
tree961153d1c3f265c09310ed372e9961f676c0557f /MdeModulePkg/Universal/PCD
parentb8b86ec6e002f135e3343454f30a951cdb10e1ee (diff)
downloadedk2-platforms-efd6b412c65a157ac040c9ed70024ed5ad77af61.tar.xz
MdeModulePkg Pcd DXE: Handle the case gPcdDataBaseHobGuid HOB is not present.
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@15027 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/PCD')
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Pcd.c4
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Service.c37
2 files changed, 24 insertions, 17 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
index 8a3e8cd500..4828af2b9d 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
@@ -231,7 +231,7 @@ DxeGetPcdInfoGetSku (
VOID
)
{
- return mPcdDatabase.PeiDb->SystemSkuId;
+ return mPcdDatabase.DxeDb->SystemSkuId;
}
/**
@@ -261,7 +261,7 @@ DxePcdSetSku (
IN UINTN SkuId
)
{
- mPcdDatabase.PeiDb->SystemSkuId = (SKU_ID) SkuId;
+ mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
return;
}
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c b/MdeModulePkg/Universal/PCD/Dxe/Service.c
index 3a41bf5316..a9e1ca49a3 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
@@ -774,6 +774,18 @@ BuildPcdDxeDataBase (
UINT32 PcdDxeDbLen;
VOID *PcdDxeDb;
+ //
+ // Assign PCD Entries with default value to PCD DATABASE
+ //
+ mPcdDatabase.DxeDb = LocateExPcdBinary ();
+ ASSERT(mPcdDatabase.DxeDb != NULL);
+ PcdDxeDbLen = mPcdDatabase.DxeDb->Length + mPcdDatabase.DxeDb->UninitDataBaseSize;
+ PcdDxeDb = AllocateZeroPool (PcdDxeDbLen);
+ ASSERT (PcdDxeDb != NULL);
+ CopyMem (PcdDxeDb, mPcdDatabase.DxeDb, mPcdDatabase.DxeDb->Length);
+ FreePool (mPcdDatabase.DxeDb);
+ mPcdDatabase.DxeDb = PcdDxeDb;
+
GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
if (GuidHob != NULL) {
@@ -789,21 +801,16 @@ BuildPcdDxeDataBase (
// Assign PCD Entries refereneced in PEI phase to PCD DATABASE
//
mPcdDatabase.PeiDb = PeiDatabase;
+ //
+ // Inherit the SystemSkuId from PEI phase.
+ //
+ mPcdDatabase.DxeDb->SystemSkuId = mPcdDatabase.PeiDb->SystemSkuId;
+ } else {
+ mPcdDatabase.PeiDb = AllocateZeroPool (sizeof (PEI_PCD_DATABASE));
+ ASSERT(mPcdDatabase.PeiDb != NULL);
}
//
- // Assign PCD Entries with default value to PCD DATABASE
- //
- mPcdDatabase.DxeDb = LocateExPcdBinary ();
- ASSERT(mPcdDatabase.DxeDb != NULL);
- PcdDxeDbLen = mPcdDatabase.DxeDb->Length + mPcdDatabase.DxeDb->UninitDataBaseSize;
- PcdDxeDb = AllocateZeroPool (PcdDxeDbLen);
- ASSERT (PcdDxeDb != NULL);
- CopyMem (PcdDxeDb, mPcdDatabase.DxeDb, mPcdDatabase.DxeDb->Length);
- FreePool (mPcdDatabase.DxeDb);
- mPcdDatabase.DxeDb = PcdDxeDb;
-
- //
// Initialized the external PCD database local variables
//
mPeiLocalTokenCount = mPcdDatabase.PeiDb->LocalTokenCount;
@@ -945,7 +952,7 @@ GetSkuEnabledTokenNumber (
//
FoundSku = FALSE;
for (Index = 0; Index < SkuIdTable[0]; Index++) {
- if (mPcdDatabase.PeiDb->SystemSkuId == SkuIdTable[Index + 1]) {
+ if (mPcdDatabase.DxeDb->SystemSkuId == SkuIdTable[Index + 1]) {
FoundSku = TRUE;
break;
}
@@ -1704,7 +1711,7 @@ GetPtrTypeSize (
//
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
for (Index = 0; Index < SkuIdTable[0]; Index++) {
- if (SkuIdTable[1 + Index] == mPcdDatabase.PeiDb->SystemSkuId) {
+ if (SkuIdTable[1 + Index] == mPcdDatabase.DxeDb->SystemSkuId) {
return SizeTable[SizeTableIdx + 1 + Index];
}
}
@@ -1794,7 +1801,7 @@ SetPtrTypeSize (
//
SkuIdTable = GetSkuIdArray (LocalTokenNumberTableIdx, IsPeiDb);
for (Index = 0; Index < SkuIdTable[0]; Index++) {
- if (SkuIdTable[1 + Index] == mPcdDatabase.PeiDb->SystemSkuId) {
+ if (SkuIdTable[1 + Index] == mPcdDatabase.DxeDb->SystemSkuId) {
SizeTable[SizeTableIdx + 1 + Index] = (SIZE_INFO) *CurrentSize;
return TRUE;
}