summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 8a3e8cd..4828af2 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 3a41bf5..a9e1ca4 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;
}