]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/PCD/Dxe/Pcd.c
MdeModulePkg: Add ATTRIBUTE (+/-RT, RO) support in PCD declaration in DSC file.
[mirror_edk2.git] / MdeModulePkg / Universal / PCD / Dxe / Pcd.c
index afe925c5e2e18594b7d1d13214ab4023ffd704a9..6afcd18dff828063fdf1a5a87a926431ac30aac2 100644 (file)
@@ -3,7 +3,7 @@
   produce the implementation of native PCD protocol and EFI_PCD_PROTOCOL defined in\r
   PI 1.2 Vol3.\r
 \r
-Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -129,7 +129,8 @@ PcdDxeInit (
   )\r
 {\r
   EFI_STATUS Status;\r
-  \r
+  VOID       *Registration;\r
+\r
   //\r
   // Make sure the Pcd Protocol is not already installed in the system\r
   //\r
@@ -150,7 +151,10 @@ PcdDxeInit (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  if (FeaturePcdGet (PcdPcdInfoGeneration) && mPcdDatabase.DxeDb->PcdNameTableOffset != 0) {\r
+  //\r
+  // Only install PcdInfo PROTOCOL when PCD info content is present. \r
+  //\r
+  if (mPcdDatabase.DxeDb->PcdNameTableOffset != 0) {\r
     //\r
     // Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD\r
     // Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type PCD\r
@@ -164,6 +168,18 @@ PcdDxeInit (
     ASSERT_EFI_ERROR (Status);\r
   }\r
 \r
+  //\r
+  // Register callback function upon VariableLockProtocol\r
+  // to lock the variables referenced by DynamicHii PCDs with RO property set in *.dsc.\r
+  //\r
+  EfiCreateProtocolNotifyEvent (\r
+    &gEdkiiVariableLockProtocolGuid,\r
+    TPL_CALLBACK,\r
+    VariableLockCallBack,\r
+    NULL,\r
+    &Registration\r
+    );\r
+\r
   return Status;\r
 }\r
 \r
@@ -228,10 +244,7 @@ DxeGetPcdInfoGetSku (
   VOID\r
   )\r
 {\r
-  if (!FeaturePcdGet (PcdPcdInfoGeneration)) {\r
-    return EFI_UNSUPPORTED;\r
-  }\r
-  return mPcdDatabase.PeiDb->SystemSkuId;\r
+  return mPcdDatabase.DxeDb->SystemSkuId;\r
 }\r
 \r
 /**\r
@@ -261,7 +274,7 @@ DxePcdSetSku (
   IN  UINTN         SkuId\r
   )\r
 {\r
-  mPcdDatabase.PeiDb->SystemSkuId = (SKU_ID) SkuId;\r
+  mPcdDatabase.DxeDb->SystemSkuId = (SKU_ID) SkuId;\r
   \r
   return;\r
 }\r