summaryrefslogtreecommitdiff
path: root/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2017-12-22 13:41:54 +0800
committerLiming Gao <liming.gao@intel.com>2017-12-25 11:05:57 +0800
commit7c73626513238176bdd16dca14fcf3f9e10bcc81 (patch)
tree9a75f70d555811e298a00fbc0db906ec0e8ce6af /MdeModulePkg/Universal/PCD/Dxe/Pcd.c
parent219247e16462d72e3b22db4e21bfaec256cc5fbb (diff)
downloadedk2-7c73626513238176bdd16dca14fcf3f9e10bcc81.zip
edk2-7c73626513238176bdd16dca14fcf3f9e10bcc81.tar.gz
edk2-7c73626513238176bdd16dca14fcf3f9e10bcc81.tar.bz2
MdeModulePkg: Update PCD driver to support the optimized PcdDataBase
https://bugzilla.tianocore.org/show_bug.cgi?id=546 BaseTools will generate the optimized PCD database to save the image size at build time for multiple SKUs. The optimized PCD database layout will be like below, the PCD database will be composed of the full default SKU data (PCD_DATABASE_INIT) and the non-default SKU delta data(PCD_DATABASE_SKU_DELTA). PCD driver will build HOB to store the full default SKU data, and patch HOB data based on non-default SKU delta data for the SKU set by SetSku(), it can save memory resource at boot time. // // PCD database layout: // +---------------------------------+ // | PCD_DATABASE_INIT (DEFAULT SKU) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU A) | // +---------------------------------+ // | PCD_DATABASE_SKU_DELTA (SKU B) | // +---------------------------------+ // | ...... | // +---------------------------------+ // BaseTools, PCD database and driver updates are needed for this proposal. For single SKU (default) case, this proposal is expected to have no impact. For multi-SKU case, PCD database format will be changed. So, PcdDataBase Version is also updated from 6 to 7. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Universal/PCD/Dxe/Pcd.c')
-rw-r--r--MdeModulePkg/Universal/PCD/Dxe/Pcd.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
index 326644c..ee53ae3 100644
--- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
+++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
@@ -269,8 +269,9 @@ DxePcdSetSku (
IN UINTN SkuId
)
{
- SKU_ID *SkuIdTable;
- UINTN Index;
+ SKU_ID *SkuIdTable;
+ UINTN Index;
+ EFI_STATUS Status;
if (SkuId == mPcdDatabase.DxeDb->SystemSkuId) {
//
@@ -294,16 +295,19 @@ DxePcdSetSku (
SkuIdTable = (SKU_ID *) ((UINT8 *) mPcdDatabase.DxeDb + mPcdDatabase.DxeDb->SkuIdTableOffset);
for (Index = 0; Index < SkuIdTable[0]; Index++) {
if (SkuId == SkuIdTable[Index + 1]) {
- DEBUG ((EFI_D_INFO, "PcdDxe - Set current SKU Id to 0x%lx.\n", (SKU_ID) SkuId));
- mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
- return;
+ Status = UpdatePcdDatabase (SkuId, TRUE);
+ if (!EFI_ERROR (Status)) {
+ mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;
+ DEBUG ((DEBUG_INFO, "PcdDxe - Set current SKU Id to 0x%lx.\n", (SKU_ID) SkuId));
+ return;
+ }
}
}
//
// Invalid input SkuId, the default SKU Id will be still used for the system.
//
- DEBUG ((EFI_D_INFO, "PcdDxe - Invalid input SkuId, the default SKU Id will be still used.\n"));
+ DEBUG ((DEBUG_INFO, "PcdDxe - Invalid input SkuId, the default SKU Id will be still used.\n"));
return;
}