diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c index c8dab145af..83cbcdc3b2 100644 --- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c +++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c @@ -28,10 +28,10 @@ EFI_GUID *TmpTokenSpaceBuffer[PEI_EXMAPPING_TABLE_SIZE + DXE_EXMAPPING_TABLE_SIZ /// EFI_LOCK mPcdDatabaseLock = EFI_INITIALIZE_LOCK_VARIABLE(TPL_NOTIFY); -// -// PCD_PROTOCOL the native implementation provided by MdePkg which support dynamic -// type and dynamicEx type PCD. -// +/// +/// PCD_PROTOCOL the EDKII native implementation which support dynamic +/// type and dynamicEx type PCDs. +/// PCD_PROTOCOL mPcdInstance = { DxePcdSetSku, @@ -71,10 +71,10 @@ PCD_PROTOCOL mPcdInstance = { DxePcdGetNextTokenSpace }; -// -// EFI_PCD_PROTOCOL is defined in PI 1.2 Vol 3 which only support dynamicEx type -// PCD. -// +/// +/// EFI_PCD_PROTOCOL is defined in PI 1.2 Vol 3 which only support dynamicEx type +/// PCD. +/// EFI_PCD_PROTOCOL mEfiPcdInstance = { DxePcdSetSku, DxePcdGet8Ex, @@ -96,8 +96,7 @@ EFI_PCD_PROTOCOL mEfiPcdInstance = { DxePcdGetNextTokenSpace }; - - +EFI_HANDLE mPcdHandle = NULL; /** Main entry for PCD DXE driver. @@ -118,7 +117,6 @@ PcdDxeInit ( ) { EFI_STATUS Status; - EFI_HANDLE mNewHandle; // // Make sure the Pcd Protocol is not already installed in the system @@ -128,23 +126,20 @@ PcdDxeInit ( BuildPcdDxeDataBase (); - mNewHandle = NULL; - // // Install PCD_PROTOCOL to handle dynamic type PCD // Install EFI_PCD_PROTOCOL to handle dynamicEx type PCD // Status = gBS->InstallMultipleProtocolInterfaces ( - &mNewHandle, - &gPcdProtocolGuid, - &mPcdInstance, - &gEfiPcdProtocolGuid, - &mEfiPcdInstance + &mPcdHandle, + &gPcdProtocolGuid, &mPcdInstance, + &gEfiPcdProtocolGuid, &mEfiPcdInstance, + NULL ); ASSERT_EFI_ERROR (Status); - return EFI_SUCCESS; + return Status; } diff --git a/MdeModulePkg/Universal/PCD/Pei/Pcd.c b/MdeModulePkg/Universal/PCD/Pei/Pcd.c index 783dd2d7a7..b2d5aaf2d3 100644 --- a/MdeModulePkg/Universal/PCD/Pei/Pcd.c +++ b/MdeModulePkg/Universal/PCD/Pei/Pcd.c @@ -14,10 +14,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "Service.h" -// -// Instance of PCD_PPI protocol is native implementation by MdePkg. -// This protocol instance support dynamic and dynamicEx type PCDs. -// +/// +/// Instance of PCD_PPI protocol is EDKII native implementation. +/// This protocol instance support dynamic and dynamicEx type PCDs. +/// PCD_PPI mPcdPpiInstance = { PeiPcdSetSku, @@ -57,10 +57,10 @@ PCD_PPI mPcdPpiInstance = { PeiPcdGetNextTokenSpace }; -// -// Instance of EFI_PEI_PCD_PPI which is defined in PI 1.2 Vol 3. -// This PPI instance only support dyanmicEx type PCD. -// +/// +/// Instance of EFI_PEI_PCD_PPI which is defined in PI 1.2 Vol 3. +/// This PPI instance only support dyanmicEx type PCD. +/// EFI_PEI_PCD_PPI mEfiPcdPpiInstance = { PeiPcdSetSku, @@ -83,16 +83,17 @@ EFI_PEI_PCD_PPI mEfiPcdPpiInstance = { PeiPcdGetNextTokenSpace }; -EFI_PEI_PPI_DESCRIPTOR mPpiPCD = { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gPcdPpiGuid, - &mPcdPpiInstance -}; - -EFI_PEI_PPI_DESCRIPTOR mEfiPpiPCD = { - (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), - &gEfiPeiPcdPpiGuid, - &mEfiPcdPpiInstance +EFI_PEI_PPI_DESCRIPTOR mPpiList[] = { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gPcdPpiGuid, + &mPcdPpiInstance + }, + { + (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST), + &gEfiPeiPcdPpiGuid, + &mEfiPcdPpiInstance + } }; /** @@ -118,16 +119,9 @@ PcdPeimInit ( BuildPcdDatabase (); // - // Install PCD_PPI which produce support for dynamic and dynamicEx PCD + // Install PCD_PPI and EFI_PEI_PCD_PPI. // - Status = PeiServicesInstallPpi (&mPpiPCD); - ASSERT_EFI_ERROR (Status); - - // - // Install EFI_PCD_PPI which produce support for dynamicEx PCD which is defined - // in PI 1.2 Vol 3 specification. - // - Status = PeiServicesInstallPpi (&mEfiPpiPCD); + Status = PeiServicesInstallPpi (&mPpiList[0]); ASSERT_EFI_ERROR (Status); return Status;