[edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver

Michael D Kinney michael.d.kinney at intel.com
Wed May 26 17:47:54 UTC 2021


Hi Ray,

Can we work through these phases in the edk2-staging repo and avoid making temp changes to the edk2 repo?

Thanks,

Mike

> -----Original Message-----
> From: Ni, Ray <ray.ni at intel.com>
> Sent: Tuesday, May 25, 2021 7:03 PM
> To: Kinney, Michael D <michael.d.kinney at intel.com>; devel at edk2.groups.io; Liu, Zhiguang <zhiguang.liu at intel.com>
> Cc: Liming Gao <gaoliming at byosoft.com.cn>
> Subject: RE: [edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver
> 
> Mike,
> I totally agree with you on the restriction: Drivers in universal payload don't use dynamic(ex) PCDs.
> That's the final state.
> 
> In phase #1, we need to separate the PCD database so that drivers inside universal payload don't consume any dynamic(ex)
> PCDs outside. For example, PciHostBridgeDxe produces the *PcdPciDisableBusEnumeration* and PciBusDxe consumes it.
> Both drivers are inside universal payload. PCD value is produced based on the information got from universal payload
> interfaces.
> 
> In phase #2, we will update all drivers inside universal payload to avoid relying on dynamic PCDs. For example, we will
> update PciBusDxe to directly consume the https://universalpayload.github.io/documentation/payload-
> interfaces/index.html#pci-root-bridges to decide whether bus enumeration should be performed.
> 
> We are in phase #1 now.  In this phase, using of dynamic PCD is an implementation choice of the universal payload. And we
> need to make sure that any new universal payload module developed should not rely on dynamic PCD.
> 
> To move to phase #2, I think we need all platforms to align to universal payload. Otherwise, PciBusDxe cannot get the
> PLD_PCI_ROOT_BRIDGE.ResourceAssigned from HOB.
> 
> Is this week's TianoCore open design meeting ok for discussion?
> 
> Thanks,
> Ray
> 
> 
> > -----Original Message-----
> > From: Kinney, Michael D <michael.d.kinney at intel.com>
> > Sent: Tuesday, May 25, 2021 10:35 PM
> > To: Ni, Ray <ray.ni at intel.com>; devel at edk2.groups.io; Liu, Zhiguang
> > <zhiguang.liu at intel.com>; Kinney, Michael D <michael.d.kinney at intel.com>
> > Cc: Liming Gao <gaoliming at byosoft.com.cn>
> > Subject: RE: [edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver
> >
> > Hi Ray,
> >
> > The PCD Database is intended to be owned by the platform FW.
> >
> > The concept of a universal payload that is loaded after the platform FW is
> > similar in
> > concept to loading a UEFI app/driver/osloader.  Those types of loadable UEFI
> > components
> > are not allowed to use the PCD services
> >
> > The only time the PCD PPI/Protocol are accessed is if the PCD type is Dynamic
> > or
> > DynamicEx.
> >
> > Why do components in the Universal Payload need to access PCDs of type
> > Dynamic
> > or DynamicEx?  Can we restrict components in the Universal Payload to only
> > use
> > PCDs of type FeatureFlag/FixedAtBuild/PatchableInModule?
> >
> > Thanks,
> >
> > Mike
> >
> > > -----Original Message-----
> > > From: Ni, Ray <ray.ni at intel.com>
> > > Sent: Monday, May 24, 2021 6:33 PM
> > > To: devel at edk2.groups.io; Kinney, Michael D
> > <michael.d.kinney at intel.com>; Liu, Zhiguang <zhiguang.liu at intel.com>
> > > Cc: Liming Gao <gaoliming at byosoft.com.cn>
> > > Subject: RE: [edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver
> > >
> > > Mike,
> > > In payload phase, there are two kinds of payloads:
> > > 1. the universal payloads that conform to universal payload spec. These
> > payloads cannot depend on any PCD produced from
> > > bootloader phase.
> > > 2. the platform payloads. These payloads are developed by the same
> > vendor as the bootloader. So, they can depend on the
> > > PCD produced by the bootloader. The ultimate goal is these platform
> > payloads can be eliminated.
> > >
> > > Thanks,
> > > Ray
> > >
> > > > -----Original Message-----
> > > > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of
> > Michael D Kinney
> > > > Sent: Tuesday, May 25, 2021 4:30 AM
> > > > To: devel at edk2.groups.io; Liu, Zhiguang <zhiguang.liu at intel.com>;
> > Kinney, Michael D <michael.d.kinney at intel.com>
> > > > Cc: Liming Gao <gaoliming at byosoft.com.cn>
> > > > Subject: Re: [edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver
> > > >
> > > > Why do we need a new PCD?
> > > >
> > > > Can't we make this the default behavior to only install one instance?
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > > > -----Original Message-----
> > > > > From: devel at edk2.groups.io <devel at edk2.groups.io> On Behalf Of
> > Zhiguang Liu
> > > > > Sent: Monday, May 24, 2021 2:25 AM
> > > > > To: devel at edk2.groups.io
> > > > > Cc: Kinney, Michael D <michael.d.kinney at intel.com>; Liming Gao
> > <gaoliming at byosoft.com.cn>
> > > > > Subject: [edk2-devel] [PATCH 1/2] MdePkg: Standalone PCD driver
> > > > >
> > > > > Add a feature PCD to control if the PCD driver is build as standalone
> > mode.
> > > > > This way, two mode PCD driver won't share the data base.
> > > > >
> > > > > Cc: Michael D Kinney <michael.d.kinney at intel.com>
> > > > > Cc: Liming Gao <gaoliming at byosoft.com.cn>
> > > > > Signed-off-by: Zhiguang Liu <zhiguang.liu at intel.com>
> > > > > ---
> > > > >  MdeModulePkg/Universal/PCD/Dxe/Pcd.c       | 75
> > +++++++++++++++++++++++++++++++++++++++++++++++++++------------
> > ---
> > > > -------
> > > > > --
> > > > >  MdeModulePkg/Universal/PCD/Dxe/Pcd.inf     | 16 ++++++++++++----
> > > > >  MdeModulePkg/Universal/PCD/Dxe/Service.c   |  7 ++++++-
> > > > >  MdePkg/Include/Protocol/Pcd.h              |  5 -----
> > > > >  MdePkg/Include/Protocol/PcdInfo.h          |  5 -----
> > > > >  MdePkg/Library/DxePcdLib/DxePcdLib.c       | 24
> > ++++++++++++++++++++----
> > > > >  MdePkg/Library/DxePcdLib/DxePcdLib.inf     | 16 ++++++++++++----
> > > > >  MdePkg/Library/DxePcdLib/PayloadPcdLib.inf | 71
> > > >
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > +++++++++++++
> > > > >  MdePkg/MdePkg.dec                          | 12 ++++++++++++
> > > > >  9 files changed, 184 insertions(+), 47 deletions(-)
> > > > >
> > > > > diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
> > b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
> > > > > index cdb9b4fac1..dc9c4be022 100644
> > > > > --- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
> > > > > +++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.c
> > > > > @@ -129,34 +129,61 @@ PcdDxeInit (
> > > > >    //
> > > > >
> > > > >    // Make sure the Pcd Protocol is not already installed in the system
> > > > >
> > > > >    //
> > > > >
> > > > > +  if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +    ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL,
> > &gEdkiiPayloadStandalonePcdProtocolGuid);
> > > > >
> > > > > +    BuildPcdDxeDataBase ();
> > > > >
> > > > >
> > > > >
> > > > > -  ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL,
> > &gPcdProtocolGuid);
> > > > >
> > > > > +    //
> > > > >
> > > > > +    // Install PCD_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > +    // Install EFI_PCD_PROTOCOL to handle dynamicEx type PCD
> > > > >
> > > > > +    //
> > > > >
> > > > > +    Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > +                    &mPcdHandle,
> > > > >
> > > > > +                    &gEdkiiPayloadStandalonePcdProtocolGuid,
> > &mPcdInstance,
> > > > >
> > > > > +                    &gEdkiiEfiPayloadStandalonePcdProtocolGuid,
> > &mEfiPcdInstance,
> > > > >
> > > > > +                    NULL
> > > > >
> > > > > +                    );
> > > > >
> > > > > +    ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >
> > > > >
> > > > > -  BuildPcdDxeDataBase ();
> > > > >
> > > > > +    //
> > > > >
> > > > > +    // Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > +    // Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type
> > PCD
> > > > >
> > > > > +    //
> > > > >
> > > > > +    Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > +                    &mPcdHandle,
> > > > >
> > > > > +                    &gEdkiiPayloadGetStandalonePcdInfoProtocolGuid,
> > &mGetPcdInfoInstance,
> > > > >
> > > > > +                    &gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid,
> > &mEfiGetPcdInfoInstance,
> > > > >
> > > > > +                    NULL
> > > > >
> > > > > +                    );
> > > > >
> > > > > +    ASSERT_EFI_ERROR (Status);
> > > > >
> > > > > +  } else {
> > > > >
> > > > > +    ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL,
> > &gPcdProtocolGuid);
> > > > >
> > > > > +    BuildPcdDxeDataBase ();
> > > > >
> > > > >
> > > > >
> > > > > -  //
> > > > >
> > > > > -  // Install PCD_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > -  // Install EFI_PCD_PROTOCOL to handle dynamicEx type PCD
> > > > >
> > > > > -  //
> > > > >
> > > > > -  Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > -                  &mPcdHandle,
> > > > >
> > > > > -                  &gPcdProtocolGuid,     &mPcdInstance,
> > > > >
> > > > > -                  &gEfiPcdProtocolGuid,  &mEfiPcdInstance,
> > > > >
> > > > > -                  NULL
> > > > >
> > > > > -                  );
> > > > >
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > >
> > > > > +    //
> > > > >
> > > > > +    // Install PCD_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > +    // Install EFI_PCD_PROTOCOL to handle dynamicEx type PCD
> > > > >
> > > > > +    //
> > > > >
> > > > > +    Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > +                    &mPcdHandle,
> > > > >
> > > > > +                    &gPcdProtocolGuid,     &mPcdInstance,
> > > > >
> > > > > +                    &gEfiPcdProtocolGuid,  &mEfiPcdInstance,
> > > > >
> > > > > +                    NULL
> > > > >
> > > > > +                    );
> > > > >
> > > > > +    ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >
> > > > >
> > > > > -  //
> > > > >
> > > > > -  // Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > -  // Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type
> > PCD
> > > > >
> > > > > -  //
> > > > >
> > > > > -  Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > -                  &mPcdHandle,
> > > > >
> > > > > -                  &gGetPcdInfoProtocolGuid,     &mGetPcdInfoInstance,
> > > > >
> > > > > -                  &gEfiGetPcdInfoProtocolGuid,  &mEfiGetPcdInfoInstance,
> > > > >
> > > > > -                  NULL
> > > > >
> > > > > -                  );
> > > > >
> > > > > -  ASSERT_EFI_ERROR (Status);
> > > > >
> > > > > +    //
> > > > >
> > > > > +    // Install GET_PCD_INFO_PROTOCOL to handle dynamic type PCD
> > > > >
> > > > > +    // Install EFI_GET_PCD_INFO_PROTOCOL to handle dynamicEx type
> > PCD
> > > > >
> > > > > +    //
> > > > >
> > > > > +    Status = gBS->InstallMultipleProtocolInterfaces (
> > > > >
> > > > > +                    &mPcdHandle,
> > > > >
> > > > > +                    &gGetPcdInfoProtocolGuid,     &mGetPcdInfoInstance,
> > > > >
> > > > > +                    &gEfiGetPcdInfoProtocolGuid,  &mEfiGetPcdInfoInstance,
> > > > >
> > > > > +                    NULL
> > > > >
> > > > > +                    );
> > > > >
> > > > > +    ASSERT_EFI_ERROR (Status);
> > > > >
> > > > > +  }
> > > > >
> > > > >
> > > > >
> > > > >    //
> > > > >
> > > > >    // Register callback function upon VariableLockProtocol
> > > > >
> > > > > diff --git a/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > b/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > > > > index eb9f757f14..f3e704f083 100644
> > > > > --- a/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > > > > +++ b/MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
> > > > > @@ -329,10 +329,15 @@
> > > > >    gEfiMdeModulePkgTokenSpaceGuid                ##
> > SOMETIMES_CONSUMES  ## GUID
> > > > >
> > > > >
> > > > >
> > > > >  [Protocols]
> > > > >
> > > > > -  gPcdProtocolGuid                              ## PRODUCES
> > > > >
> > > > > -  gEfiPcdProtocolGuid                           ## PRODUCES
> > > > >
> > > > > -  gGetPcdInfoProtocolGuid                       ## SOMETIMES_PRODUCES
> > > > >
> > > > > -  gEfiGetPcdInfoProtocolGuid                    ## SOMETIMES_PRODUCES
> > > > >
> > > > > +  gPcdProtocolGuid                                 ## PRODUCES
> > > > >
> > > > > +  gEfiPcdProtocolGuid                              ## PRODUCES
> > > > >
> > > > > +  gGetPcdInfoProtocolGuid                          ## SOMETIMES_PRODUCES
> > > > >
> > > > > +  gEfiGetPcdInfoProtocolGuid                       ## SOMETIMES_PRODUCES
> > > > >
> > > > > +
> > > > >
> > > > > +  gEdkiiPayloadStandalonePcdProtocolGuid           ## PRODUCES
> > > > >
> > > > > +  gEdkiiEfiPayloadStandalonePcdProtocolGuid        ## PRODUCES
> > > > >
> > > > > +  gEdkiiPayloadGetStandalonePcdInfoProtocolGuid    ##
> > SOMETIMES_PRODUCES
> > > > >
> > > > > +  gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid ##
> > SOMETIMES_PRODUCES
> > > > >
> > > > >    ## NOTIFY
> > > > >
> > > > >    ## SOMETIMES_CONSUMES
> > > > >
> > > > >    gEdkiiVariableLockProtocolGuid
> > > > >
> > > > > @@ -342,6 +347,9 @@
> > > > >    gEfiMdeModulePkgTokenSpaceGuid.PcdVpdBaseAddress64    ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > >    gEfiMdeModulePkgTokenSpaceGuid.PcdSetNvStoreDefaultId ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > >
> > > > >
> > > > > +[FeaturePcd]
> > > > >
> > > > > +  gEfiMdePkgTokenSpaceGuid.PcdStandalonePcdDatabaseEnable ##
> > CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > >  [Depex]
> > > > >
> > > > >    TRUE
> > > > >
> > > > >
> > > > >
> > > > > diff --git a/MdeModulePkg/Universal/PCD/Dxe/Service.c
> > b/MdeModulePkg/Universal/PCD/Dxe/Service.c
> > > > > index ea7edc3cbb..fe16ba713b 100644
> > > > > --- a/MdeModulePkg/Universal/PCD/Dxe/Service.c
> > > > > +++ b/MdeModulePkg/Universal/PCD/Dxe/Service.c
> > > > > @@ -861,7 +861,12 @@ BuildPcdDxeDataBase (
> > > > >    CopyMem (PcdDxeDb, mPcdDatabase.DxeDb, mPcdDatabase.DxeDb-
> > >Length);
> > > > >
> > > > >    mPcdDatabase.DxeDb = PcdDxeDb;
> > > > >
> > > > >
> > > > >
> > > > > -  GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
> > > > >
> > > > > +  if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +    GuidHob = NULL;
> > > > >
> > > > > +  } else {
> > > > >
> > > > > +    GuidHob = GetFirstGuidHob (&gPcdDataBaseHobGuid);
> > > > >
> > > > > +  }
> > > > >
> > > > > +
> > > > >
> > > > >    if (GuidHob != NULL) {
> > > > >
> > > > >
> > > > >
> > > > >      //
> > > > >
> > > > > diff --git a/MdePkg/Include/Protocol/Pcd.h
> > b/MdePkg/Include/Protocol/Pcd.h
> > > > > index 9cd1a998f8..cfa6ac2360 100644
> > > > > --- a/MdePkg/Include/Protocol/Pcd.h
> > > > > +++ b/MdePkg/Include/Protocol/Pcd.h
> > > > > @@ -17,11 +17,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > >  #ifndef __PCD_H__
> > > > >
> > > > >  #define __PCD_H__
> > > > >
> > > > >
> > > > >
> > > > > -extern EFI_GUID gPcdProtocolGuid;
> > > > >
> > > > > -
> > > > >
> > > > > -#define PCD_PROTOCOL_GUID \
> > > > >
> > > > > -  { 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31,
> > 0xe, 0xf7 } }
> > > > >
> > > > > -
> > > > >
> > > > >  #define PCD_INVALID_TOKEN_NUMBER ((UINTN) 0)
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > diff --git a/MdePkg/Include/Protocol/PcdInfo.h
> > b/MdePkg/Include/Protocol/PcdInfo.h
> > > > > index b0ec7f6770..5691215c42 100644
> > > > > --- a/MdePkg/Include/Protocol/PcdInfo.h
> > > > > +++ b/MdePkg/Include/Protocol/PcdInfo.h
> > > > > @@ -19,11 +19,6 @@
> > > > >  #ifndef __PCD_INFO_H__
> > > > >
> > > > >  #define __PCD_INFO_H__
> > > > >
> > > > >
> > > > >
> > > > > -extern EFI_GUID gGetPcdInfoProtocolGuid;
> > > > >
> > > > > -
> > > > >
> > > > > -#define GET_PCD_INFO_PROTOCOL_GUID \
> > > > >
> > > > > -  { 0x5be40f57, 0xfa68, 0x4610, { 0xbb, 0xbf, 0xe9, 0xc5, 0xfc, 0xda,
> > 0xd3, 0x65 } }
> > > > >
> > > > > -
> > > > >
> > > > >  ///
> > > > >
> > > > >  /// The forward declaration for GET_PCD_INFO_PROTOCOL.
> > > > >
> > > > >  ///
> > > > >
> > > > > diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.c
> > b/MdePkg/Library/DxePcdLib/DxePcdLib.c
> > > > > index 2accaeda2c..8a61486832 100644
> > > > > --- a/MdePkg/Library/DxePcdLib/DxePcdLib.c
> > > > > +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.c
> > > > > @@ -43,7 +43,11 @@ GetPiPcdProtocol (
> > > > >      // PI Pcd protocol defined in PI 1.2 vol3 should be installed before the
> > module
> > > > >
> > > > >      // access DynamicEx type PCD.
> > > > >
> > > > >      //
> > > > >
> > > > > -    Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID
> > **) &mPiPcd);
> > > > >
> > > > > +    if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +      Status = gBS->LocateProtocol
> > (&gEdkiiEfiPayloadStandalonePcdProtocolGuid, NULL, (VOID **) &mPiPcd);
> > > > >
> > > > > +    } else {
> > > > >
> > > > > +      Status = gBS->LocateProtocol (&gEfiPcdProtocolGuid, NULL, (VOID
> > **) &mPiPcd);
> > > > >
> > > > > +    }
> > > > >
> > > > >      ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >      ASSERT (mPiPcd != NULL);
> > > > >
> > > > >    }
> > > > >
> > > > > @@ -68,7 +72,11 @@ GetPcdProtocol (
> > > > >      // PCD protocol need to be installed before the module access
> > Dynamic type PCD.
> > > > >
> > > > >      // But dynamic type PCD is not required in PI 1.2 specification.
> > > > >
> > > > >      //
> > > > >
> > > > > -    Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID
> > **)&mPcd);
> > > > >
> > > > > +    if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +      Status = gBS->LocateProtocol
> > (&gEdkiiPayloadStandalonePcdProtocolGuid, NULL, (VOID **)&mPcd);
> > > > >
> > > > > +    } else {
> > > > >
> > > > > +      Status = gBS->LocateProtocol (&gPcdProtocolGuid, NULL, (VOID
> > **)&mPcd);
> > > > >
> > > > > +    }
> > > > >
> > > > >      ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >      ASSERT (mPcd != NULL);
> > > > >
> > > > >    }
> > > > >
> > > > > @@ -88,7 +96,11 @@ GetPiPcdInfoProtocolPointer (
> > > > >    EFI_STATUS  Status;
> > > > >
> > > > >
> > > > >
> > > > >    if (mPiPcdInfo == NULL) {
> > > > >
> > > > > -    Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL,
> > (VOID **)&mPiPcdInfo);
> > > > >
> > > > > +    if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +      Status = gBS->LocateProtocol
> > (&gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid, NULL, (VOID
> > **)&mPiPcdInfo);
> > > > >
> > > > > +    } else{
> > > > >
> > > > > +      Status = gBS->LocateProtocol (&gEfiGetPcdInfoProtocolGuid, NULL,
> > (VOID **)&mPiPcdInfo);
> > > > >
> > > > > +    }
> > > > >
> > > > >      ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >      ASSERT (mPiPcdInfo != NULL);
> > > > >
> > > > >    }
> > > > >
> > > > > @@ -108,7 +120,11 @@ GetPcdInfoProtocolPointer (
> > > > >    EFI_STATUS  Status;
> > > > >
> > > > >
> > > > >
> > > > >    if (mPcdInfo == NULL) {
> > > > >
> > > > > -    Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL,
> > (VOID **)&mPcdInfo);
> > > > >
> > > > > +    if (FeaturePcdGet (PcdStandalonePcdDatabaseEnable)) {
> > > > >
> > > > > +      Status = gBS->LocateProtocol
> > (&gEdkiiPayloadGetStandalonePcdInfoProtocolGuid, NULL, (VOID
> > **)&mPcdInfo);
> > > > >
> > > > > +    } else {
> > > > >
> > > > > +      Status = gBS->LocateProtocol (&gGetPcdInfoProtocolGuid, NULL,
> > (VOID **)&mPcdInfo);
> > > > >
> > > > > +    }
> > > > >
> > > > >      ASSERT_EFI_ERROR (Status);
> > > > >
> > > > >      ASSERT (mPcdInfo != NULL);
> > > > >
> > > > >    }
> > > > >
> > > > > diff --git a/MdePkg/Library/DxePcdLib/DxePcdLib.inf
> > b/MdePkg/Library/DxePcdLib/DxePcdLib.inf
> > > > > index 3d4d21b442..59d9fe4f11 100644
> > > > > --- a/MdePkg/Library/DxePcdLib/DxePcdLib.inf
> > > > > +++ b/MdePkg/Library/DxePcdLib/DxePcdLib.inf
> > > > > @@ -53,10 +53,18 @@
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >  [Protocols]
> > > > >
> > > > > -  gPcdProtocolGuid                              ## SOMETIMES_CONSUMES
> > > > >
> > > > > -  gEfiPcdProtocolGuid                           ## CONSUMES
> > > > >
> > > > > -  gGetPcdInfoProtocolGuid                       ## SOMETIMES_CONSUMES
> > > > >
> > > > > -  gEfiGetPcdInfoProtocolGuid                    ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gPcdProtocolGuid                                 ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEfiPcdProtocolGuid                              ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gGetPcdInfoProtocolGuid                          ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEfiGetPcdInfoProtocolGuid                       ## SOMETIMES_CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > > +  gEdkiiPayloadStandalonePcdProtocolGuid           ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiEfiPayloadStandalonePcdProtocolGuid        ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiPayloadGetStandalonePcdInfoProtocolGuid    ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > > +[FeaturePcd]
> > > > >
> > > > > +  gEfiMdePkgTokenSpaceGuid.PcdStandalonePcdDatabaseEnable ##
> > CONSUMES
> > > > >
> > > > >
> > > > >
> > > > >  [Depex.common.DXE_DRIVER,
> > Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER,
> > > > Depex.common.DXE_SMM_DRIVER]
> > > > >
> > > > >    gEfiPcdProtocolGuid
> > > > >
> > > > > diff --git a/MdePkg/Library/DxePcdLib/PayloadPcdLib.inf
> > b/MdePkg/Library/DxePcdLib/PayloadPcdLib.inf
> > > > > new file mode 100644
> > > > > index 0000000000..e61296e11a
> > > > > --- /dev/null
> > > > > +++ b/MdePkg/Library/DxePcdLib/PayloadPcdLib.inf
> > > > > @@ -0,0 +1,71 @@
> > > > > +## @file
> > > > >
> > > > > +# Instance of PCD Library using PCD Protocol.
> > > > >
> > > > > +#
> > > > >
> > > > > +# There are two PCD protocols as follows:
> > > > >
> > > > > +#   1) PCD_PROTOCOL
> > > > >
> > > > > +#      It is EDKII implementation which support Dynamic/DynamicEx
> > Pcds.
> > > > >
> > > > > +#   2) EFI_PCD_PROTOCOL
> > > > >
> > > > > +#      It is defined by PI specification 1.2, Vol 3 which only support
> > dynamicEx
> > > > >
> > > > > +#      type Pcd.
> > > > >
> > > > > +#
> > > > >
> > > > > +# For dynamicEx type PCD, it is compatible between PCD_PROTOCOL
> > and EFI_PCD_PROTOCOL.
> > > > >
> > > > > +#
> > > > >
> > > > > +# This library instance uses the PCD_PROTOCOL to handle dynamic
> > PCD request and use
> > > > >
> > > > > +# EFI_PCD_PROTOCOL to handle dynamicEx type PCD.
> > > > >
> > > > > +#
> > > > >
> > > > > +# Note: A driver of type DXE_RUNTIME_DRIVER and
> > DXE_SMM_DRIVER can only use this DxePcdLib
> > > > >
> > > > > +#  in their initialization without any issues to access Dynamic and
> > DynamicEx PCD. They can't
> > > > >
> > > > > +#  access Dynamic and DynamicEx PCD in the implementation of
> > runtime services and SMI handlers.
> > > > >
> > > > > +#  Because EFI_PCD_PROTOCOL is DXE protocol that is not available in
> > OS runtime phase.
> > > > >
> > > > > +#
> > > > >
> > > > > +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
> > > > >
> > > > > +#
> > > > >
> > > > > +#  SPDX-License-Identifier: BSD-2-Clause-Patent
> > > > >
> > > > > +#
> > > > >
> > > > > +#
> > > > >
> > > > > +##
> > > > >
> > > > > +
> > > > >
> > > > > +[Defines]
> > > > >
> > > > > +  INF_VERSION                    = 0x00010005
> > > > >
> > > > > +  BASE_NAME                      = DxePcdLib
> > > > >
> > > > > +  MODULE_UNI_FILE                = DxePcdLib.uni
> > > > >
> > > > > +  FILE_GUID                      = f9af2f38-09e2-4ff1-b661-5d1c19d9f75c
> > > > >
> > > > > +  MODULE_TYPE                    = DXE_DRIVER
> > > > >
> > > > > +  VERSION_STRING                 = 1.0
> > > > >
> > > > > +  LIBRARY_CLASS                  = PcdLib|DXE_CORE DXE_DRIVER
> > DXE_RUNTIME_DRIVER DXE_SMM_DRIVER SMM_CORE
> > > > UEFI_APPLICATION
> > > > > UEFI_DRIVER
> > > > >
> > > > > +
> > > > >
> > > > > +#
> > > > >
> > > > > +#  VALID_ARCHITECTURES           = IA32 X64 EBC
> > > > >
> > > > > +#
> > > > >
> > > > > +
> > > > >
> > > > > +[Sources]
> > > > >
> > > > > +  DxePcdLib.c
> > > > >
> > > > > +
> > > > >
> > > > > +
> > > > >
> > > > > +[Packages]
> > > > >
> > > > > +  MdePkg/MdePkg.dec
> > > > >
> > > > > +
> > > > >
> > > > > +
> > > > >
> > > > > +[LibraryClasses]
> > > > >
> > > > > +  BaseMemoryLib
> > > > >
> > > > > +  UefiBootServicesTableLib
> > > > >
> > > > > +  DebugLib
> > > > >
> > > > > +
> > > > >
> > > > > +
> > > > >
> > > > > +[Protocols]
> > > > >
> > > > > +  gPcdProtocolGuid                                 ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEfiPcdProtocolGuid                              ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gGetPcdInfoProtocolGuid                          ## SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEfiGetPcdInfoProtocolGuid                       ## SOMETIMES_CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > > +  gEdkiiPayloadStandalonePcdProtocolGuid           ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiEfiPayloadStandalonePcdProtocolGuid        ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiPayloadGetStandalonePcdInfoProtocolGuid    ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +  gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid ##
> > SOMETIMES_CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > > +[FeaturePcd]
> > > > >
> > > > > +  gEfiMdePkgTokenSpaceGuid.PcdStandalonePcdDatabaseEnable ##
> > CONSUMES
> > > > >
> > > > > +
> > > > >
> > > > > +[Depex.common.DXE_DRIVER,
> > Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DXE_SAL_DRIVER,
> > > > Depex.common.DXE_SMM_DRIVER]
> > > > >
> > > > > +  gEdkiiEfiPayloadStandalonePcdProtocolGuid
> > > > >
> > > > > +
> > > > >
> > > > > diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
> > > > > index b49f88d8e1..44f60e2086 100644
> > > > > --- a/MdePkg/MdePkg.dec
> > > > > +++ b/MdePkg/MdePkg.dec
> > > > > @@ -1000,6 +1000,12 @@
> > > > >    ## Include/Protocol/PcdInfo.h
> > > > >
> > > > >    gGetPcdInfoProtocolGuid        = { 0x5be40f57, 0xfa68, 0x4610, { 0xbb,
> > 0xbf, 0xe9, 0xc5, 0xfc, 0xda, 0xd3, 0x65 } }
> > > > >
> > > > >
> > > > >
> > > > > +  ## Payload Standalone Pcd Protocol
> > > > >
> > > > > +  gEdkiiPayloadStandalonePcdProtocolGuid            = {0x8ef6ff48, 0x2260,
> > 0x5407, {0x0d, 0x18, 0x2e, 0x2c, 0xaa,
> > > 0x7d,
> > > > > 0xc9, 0x1f}}
> > > > >
> > > > > +  gEdkiiEfiPayloadStandalonePcdProtocolGuid         = {0x7e50c422,
> > 0xae76, 0xbdc9, {0x16, 0x66, 0xca, 0x67, 0x95,
> > > 0x04,
> > > > > 0x4d, 0xea}}
> > > > >
> > > > > +  gEdkiiPayloadGetStandalonePcdInfoProtocolGuid     = {0xd7214c03,
> > 0x27e0, 0x5b35, {0xd5, 0xb1, 0xeb, 0x1a, 0x50,
> > > 0x14,
> > > > > 0x5e, 0x15}}
> > > > >
> > > > > +  gEdkiiEfiPayloadGetStandalonePcdInfoProtocolGuid  = {0x1039ecdf,
> > 0x5908, 0xf76c, {0x51, 0xf9, 0xae, 0x09, 0xc5,
> > > 0xa9,
> > > > > 0x68, 0x9e}}
> > > > >
> > > > > +
> > > > >
> > > > >    #
> > > > >
> > > > >    # Protocols defined in PI1.0.
> > > > >
> > > > >    #
> > > > >
> > > > > @@ -1945,6 +1951,12 @@
> > > > >    # @Prompt Validate ORDERED_COLLECTION structure
> > > > >
> > > > >
> > gEfiMdePkgTokenSpaceGuid.PcdValidateOrderedCollection|FALSE|BOOLEA
> > N|0x0000002a
> > > > >
> > > > >
> > > > >
> > > > > +  ## Indicates if the standalone PCD database is enabled for
> > Payload.<BR><BR>
> > > > >
> > > > > +  #   TRUE  - Enable tandalone PCD database is enabled for Payload.<BR>
> > > > >
> > > > > +  #   FALSE - Disable tandalone PCD database is enabled for
> > Payload.<BR>
> > > > >
> > > > > +  # @Prompt Enable tandalone PCD database is enabled for Payload.
> > > > >
> > > > > +
> > gEfiMdePkgTokenSpaceGuid.PcdStandalonePcdDatabaseEnable|FALSE|BOO
> > LEAN|0x0000002e
> > > > >
> > > > > +
> > > > >
> > > > >  [PcdsFixedAtBuild]
> > > > >
> > > > >    ## Status code value for indicating a watchdog timer has expired.
> > > > >
> > > > >    # EFI_COMPUTING_UNIT_HOST_PROCESSOR |
> > EFI_CU_HP_EC_TIMER_EXPIRED
> > > > >
> > > > > --
> > > > > 2.30.0.windows.2
> > > > >
> > > > >
> > > > >
> > > > > -=-=-=-=-=-=
> > > > > Groups.io Links: You receive all messages sent to this group.
> > > > > View/Reply Online (#75502):
> > https://edk2.groups.io/g/devel/message/75502
> > > > > Mute This Topic: https://groups.io/mt/83046935/1643496
> > > > > Group Owner: devel+owner at edk2.groups.io
> > > > > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [michael.d.kinney at intel.com]
> > > > > -=-=-=-=-=-=
> > > > >
> > > >
> > > >
> > > >
> > > > 
> > > >



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#75664): https://edk2.groups.io/g/devel/message/75664
Mute This Topic: https://groups.io/mt/83046935/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-






More information about the edk2-devel-archive mailing list