The dynamic type PCD is used for a configuration/setting whose value is to be determined dynamic. In contrast, the value of static type PCD (FeatureFlag, FixedPcd, PatchablePcd) is fixed in the final generated FD image during build time.
The "dynamic" determination means one of three things:
The PCD setting value is produced and consumed by drivers during execution.
The PCD setting value is user configurable from setup.
The PCD setting value is produced by the platform OEM vendor in a specified area.
A.1.1 Class of Dynamic Type
According to module distribution way, dynamic PCD could be classified as:
If module is released in source code and will be built with platform DSC, the dynamic PCD used by this module can be accessed as:
In building platform, the build tools translate PcdSampleDynamicPcd to the parameters Token Space Guid: Token Number for this PCD.
If a module is released as binary and is not included in the platform build, the dynamic PCD used by this module must be accessed as:
Note: Developers need to explicitly pass Token SpaceGuid and TokenNumber as the parameters.
According to PCD value's storage method, dynamic PCD may be classified three ways:
The PCD value is stored in PCD database maintained by PCD driver in boot-time memory.
This type is used for communication between PEIM/DXE drivers and DXE/DXE drivers. All set/get value are lost after boot-time memory is turn off.
[PcdsDynamicDefault] is used as the section name for this type of PCD in the platform DSC file.
[PcdsDynamicExDefault] is used for dynamicEx types of PCDs.
The PCD value is stored in a variable area. As the default storage type, this type of PCD could be used for PEI/DXE driver communication. Beside that, this type PCD could also be used to store the value associate with a HII setting via variable interface.
In PEI phase, the PCD value can be obtained but not set because the variable area is read only.
[PcdsDynamicHii] is used as section name for this type of PCD in the platform DSC file.
[PcdsDynamicExHii] is for the dynamicEx type of PCD.
OEM specified storage area:
The PCD value is stored in an OEM-specified area whose base address is specified by the FixedAtBuild PCD setting PcdVpdBaseAddress.
The area is read only for PEI and DXE phases.
[PcdsDynamicVpd] is used as section name for this type PCD in the platform DSC file.
[PcdsDynamicExVpd] is for a dynamicex type of PCD.
A.1.2 When and how to use dynamic PCD
Module developers do not care if the PCD is dynamic or static when writing source code/INF. Dynamic PCD and dynamic type are indicated by the platform integrator in the platform DSC file.