]> git.proxmox.com Git - mirror_edk2.git/commitdiff
1, Correct the PCD PEIM to produce gEfiPcdPpi and gPcdPpi at same time;
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Nov 2009 07:52:09 +0000 (07:52 +0000)
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 23 Nov 2009 07:52:09 +0000 (07:52 +0000)
2, Combine two action of InstallProtocolInstance for gEfiPcdProtocol and gPcdProtocol into InstallMultipleProtocolInstances.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9468 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Universal/PCD/Dxe/Pcd.c
MdeModulePkg/Universal/PCD/Pei/Pcd.c

index 0bb44ff81c1f82d2e156c7cfbdcf1562ec37f46a..c8dab145af74238cdcdebb4931e74325419981d9 100644 (file)
@@ -1,6 +1,7 @@
 /** @file\r
   PCD DXE driver manage all PCD entry initialized in PEI phase and DXE phase, and\r
-  produce the implementation of PCD protocol.\r
+  produce the implementation of native PCD protocol and EFI_PCD_PROTOCOL defined in\r
+  PI 1.2 Vol3.\r
 \r
 Copyright (c) 2006 - 2009, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
@@ -27,6 +28,10 @@ EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZ
 ///\r
 EFI_LOCK mPcdDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE(TPL_NOTIFY);\r
 \r
+//\r
+// PCD_PROTOCOL the native implementation provided by MdePkg which support dynamic \r
+// type and dynamicEx type PCD.\r
+//\r
 PCD_PROTOCOL mPcdInstance = {\r
   DxePcdSetSku,\r
 \r
@@ -66,6 +71,10 @@ PCD_PROTOCOL mPcdInstance = {
   DxePcdGetNextTokenSpace\r
 };\r
 \r
+//\r
+// EFI_PCD_PROTOCOL is defined in PI 1.2 Vol 3 which only support dynamicEx type\r
+// PCD.\r
+//\r
 EFI_PCD_PROTOCOL mEfiPcdInstance = {\r
   DxePcdSetSku,\r
   DxePcdGet8Ex,\r
@@ -87,10 +96,8 @@ EFI_PCD_PROTOCOL mEfiPcdInstance = {
   DxePcdGetNextTokenSpace\r
 };\r
 \r
-//\r
-// Static global to reduce the code size\r
-//\r
-EFI_HANDLE mNewHandle = NULL;\r
+\r
+\r
 \r
 /**\r
   Main entry for PCD DXE driver.\r
@@ -110,8 +117,9 @@ PcdDxeInit (
   IN EFI_SYSTEM_TABLE     *SystemTable\r
   )\r
 {\r
-  EFI_STATUS          Status;\r
-\r
+  EFI_STATUS Status;\r
+  EFI_HANDLE mNewHandle;\r
+  \r
   //\r
   // Make sure the Pcd Protocol is not already installed in the system\r
   //\r
@@ -120,26 +128,20 @@ PcdDxeInit (
 \r
   BuildPcdDxeDataBase ();\r
 \r
-  Status = gBS->InstallProtocolInterface (\r
-                  &mNewHandle,\r
-                  &gPcdProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &mPcdInstance\r
-                  );\r
-\r
+  mNewHandle = NULL;\r
   \r
   //\r
-  // Also install gEfiPcdProtocolGuid which is only support dynamic-ex type \r
-  // PCD.\r
+  // Install PCD_PROTOCOL to handle dynamic type PCD\r
+  // Install EFI_PCD_PROTOCOL to handle dynamicEx type PCD\r
   //\r
-  mNewHandle = NULL;\r
-  Status = gBS->InstallProtocolInterface (\r
+  Status = gBS->InstallMultipleProtocolInterfaces (\r
                   &mNewHandle,\r
+                  &gPcdProtocolGuid,\r
+                  &mPcdInstance,\r
                   &gEfiPcdProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
                   &mEfiPcdInstance\r
                   );\r
-                  \r
+                 \r
   ASSERT_EFI_ERROR (Status);\r
 \r
   return EFI_SUCCESS;\r
index 08a18c111eb1435d3e0df0ecabeb134c4b4e3032..783dd2d7a72bd8472da2917dff9133b64df9fed8 100644 (file)
@@ -14,6 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "Service.h"\r
 \r
+//\r
+// Instance of PCD_PPI protocol is native implementation by MdePkg.\r
+// This protocol instance support dynamic and dynamicEx type PCDs.\r
+//\r
 PCD_PPI mPcdPpiInstance = {\r
   PeiPcdSetSku,\r
 \r
@@ -53,6 +57,10 @@ PCD_PPI mPcdPpiInstance = {
   PeiPcdGetNextTokenSpace\r
 };\r
 \r
+//\r
+// Instance of EFI_PEI_PCD_PPI which is defined in PI 1.2 Vol 3.\r
+// This PPI instance only support dyanmicEx type PCD.\r
+//\r
 EFI_PEI_PCD_PPI  mEfiPcdPpiInstance = {\r
   PeiPcdSetSku,\r
   \r
@@ -90,7 +98,7 @@ EFI_PEI_PPI_DESCRIPTOR  mEfiPpiPCD = {
 /**\r
   Main entry for PCD PEIM driver.\r
   \r
-  This routine initialize the PCD database for PEI phase and install PCD_PPI.\r
+  This routine initialize the PCD database for PEI phase and install PCD_PPI/EFI_PEI_PCD_PPI.\r
 \r
   @param  FileHandle  Handle of the file being invoked.\r
   @param  PeiServices Describes the list of possible PEI Services.\r
@@ -105,9 +113,24 @@ PcdPeimInit (
   IN CONST EFI_PEI_SERVICES     **PeiServices\r
   )\r
 {\r
+  EFI_STATUS Status;\r
+  \r
   BuildPcdDatabase ();\r
 \r
-  return PeiServicesInstallPpi (&mPpiPCD);\r
+  //\r
+  // Install PCD_PPI which produce support for dynamic and dynamicEx PCD\r
+  //\r
+  Status = PeiServicesInstallPpi (&mPpiPCD);\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  //\r
+  // Install EFI_PCD_PPI which produce support for dynamicEx PCD which is defined\r
+  // in PI 1.2 Vol 3 specification.\r
+  //\r
+  Status = PeiServicesInstallPpi (&mEfiPpiPCD);\r
+  ASSERT_EFI_ERROR (Status);\r
+  \r
+  return Status;\r
 }\r
 \r
 /**\r