summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-17 09:57:06 +0000
committerklu2 <klu2@6f19259b-4bc3-4df7-8a09-765794883524>2006-06-17 09:57:06 +0000
commit38ee8d9e660ef04e03a86dab008355b5c4f2ab62 (patch)
tree0864d7db9e975e174e02ab03e54f7177db6ac76a
parent5179dda3f8b027ccf3d75a0168c9dae412ba16e8 (diff)
downloadedk2-38ee8d9e660ef04e03a86dab008355b5c4f2ab62.zip
edk2-38ee8d9e660ef04e03a86dab008355b5c4f2ab62.tar.gz
edk2-38ee8d9e660ef04e03a86dab008355b5c4f2ab62.tar.bz2
Change the macro for dynamicEx type PCD and modify autogen tools to auto generate TokenSpaceGuid. After modification, you can use two method access DynamicPCD,
1) PcdGet8/PcdGet32/... to get a value of DynamicEx PCD, same as PcdSetxx 2) PcdGet8Ex/PcdGet32Ex to get a value of DynamicEx PCD, same as PcdSetxxEx. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@549 6f19259b-4bc3-4df7-8a09-765794883524
-rw-r--r--MdePkg/Include/Library/PcdLib.h24
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java17
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java9
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java598
4 files changed, 354 insertions, 294 deletions
diff --git a/MdePkg/Include/Library/PcdLib.h b/MdePkg/Include/Library/PcdLib.h
index c4e5502..2cc0dbb 100644
--- a/MdePkg/Include/Library/PcdLib.h
+++ b/MdePkg/Include/Library/PcdLib.h
@@ -77,12 +77,12 @@ Module Name: PcdLib.h
//
// Dynamic Ex is to support binary distribution
//
-#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName)
-#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName)
-#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName)
-#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName)
-#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName)
-#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _PCD_TOKEN_##TokenName)
+#define PcdGetEx8(TokenName) LibPcdGetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
+#define PcdGetEx16(TokenName) LibPcdGetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
+#define PcdGetEx32(TokenName) LibPcdGetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
+#define PcdGetEx64(TokenName) LibPcdGetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
+#define PcdGetExPtr(TokenName) LibPcdGetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
+#define PcdGetExBool(TokenName) LibPcdGetExBool (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
//
@@ -99,12 +99,12 @@ Module Name: PcdLib.h
//
// Dynamic Set Ex
//
-#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 (Guid, _PCD_TOKEN_##TokenName, Value)
-#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 (Guid, _PCD_TOKEN_##TokenName, Value)
-#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 (Guid, _PCD_TOKEN_##TokenName, Value)
-#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 (Guid, _PCD_TOKEN_##TokenName, Value)
-#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
-#define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value)
+#define PcdSetEx8(TokenName, Value) LibPcdSetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
+#define PcdSetEx16(TokenName, Value) LibPcdSetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
+#define PcdSetEx32(TokenName, Value) LibPcdSetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
+#define PcdSetEx64(TokenName, Value) LibPcdSetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
+#define PcdSetExPtr(TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
+#define PcdSetExBool(TokenName, Value) LibPcdSetExBool(&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
/**
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
index 0ba5ec4..d6b0c9c 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
@@ -2117,6 +2117,8 @@ public class CollectPCDAction {
SkuInstance skuInstance = null;
String temp;
boolean hasSkuId0 = false;
+ Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
+ int tokenNumber = 0;
List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;
@@ -2152,6 +2154,21 @@ public class CollectPCDAction {
dynamicInfo.getMaxDatumSize());
throw new EntityException(exceptionString);
}
+ tokenNumber = Integer.decode(dynamicInfo.getToken().toString());
+ if (tokenNumber != token.tokenNumber) {
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s, the token number in module %s is 0x%x, but"+
+ "in <DynamicPcdBuildDefinictions>, the token number is 0x%x, they are not match!",
+ token.cName,
+ moduleName,
+ token.tokenNumber,
+ tokenNumber);
+ throw new EntityException(exceptionString);
+ }
+
+ pcdType = Token.getpcdTypeFromString(dynamicInfo.getItemType().toString());
+ if (pcdType == Token.PCD_TYPE.DYNAMIC_EX) {
+ token.dynamicExTokenNumber = tokenNumber;
+ }
skuInfoList = dynamicInfo.getSkuInfoList();
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
index bce2ec9..d901336 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
@@ -65,12 +65,17 @@ public class Token {
///
/// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
- /// platform token space.
- /// tokenNumber is defined in SPD, FPD.
+ /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
+ /// PCD run-time database autogen tools.
///
public int tokenNumber;
///
+ /// This token number is retrieved from FPD file for DynamicEx type.
+ ///
+ public int dynamicExTokenNumber;
+
+ ///
/// All supported PCD type, this value can be retrieved from SPD
/// Currently, only record all PCD type for this token in FPD file.
///
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java
index 378f26f..40dd3b9 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/UsageInstance.java
@@ -30,288 +30,326 @@ import org.tianocore.build.pcd.exception.EntityException;
is an usage instance for this PCD token.
**/
public class UsageInstance {
- ///
- /// The module type of usage instance.
- ///
- public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS}
-
- ///
- /// This parent that this usage instance belongs to.
- ///
- public Token parentToken;
-
- ///
- /// The name of the module who contains this PCD.
- ///
- public String moduleName;
-
- ///
- /// The GUID of the module who contains this PCD.
- ///
- public UUID moduleGUID;
-
- ///
- /// The name of the package whose module contains this PCD.
- ///
- public String packageName;
-
- ///
- /// The GUID of the package whose module contains this PCD.
- ///
- public UUID packageGUID;
-
- ///
- /// The PCD type defined for module
- ///
- public Token.PCD_TYPE modulePcdType;
-
- ///
- /// The arch string of module contains this PCD
- ///
- public String arch;
-
- ///
- /// The version of module contains this PCD
- ///
- public String version;
-
- ///
- /// The module type for this usage instance.
- ///
- public MODULE_TYPE moduleType;
-
- ///
- /// The value of the PCD in this usage instance.
- ///
- public String datum;
-
- ///
- /// The maxDatumSize could be different for same PCD in different module
- /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule
- /// type.
- ///
- public int maxDatumSize;
-
- ///
- /// Autogen string for header file.
- ///
- public String hAutogenStr;
-
- ///
- /// Auotgen string for C code file.
- ///
- public String cAutogenStr;
-
- /**
- Constructure function
-
- @param parentToken Member variable.
- @param moduleName Member variable.
- @param moduleGUID Member variable.
- @param packageName Member variable.
- @param packageGUID Member variable.
- @param moduleType Member variable.
- @param modulePcdType Member variable.
- @param arch Member variable.
- @param version Member variable.
- @param value Member variable.
- @param maxDatumSize Member variable.
- */
- public UsageInstance (Token parentToken,
- String moduleName,
- UUID moduleGUID,
- String packageName,
- UUID packageGUID,
- MODULE_TYPE moduleType,
- Token.PCD_TYPE modulePcdType,
- String arch,
- String version,
- String value,
- int maxDatumSize) {
- this.parentToken = parentToken;
- this.moduleName = moduleName;
- this.moduleGUID = moduleGUID;
- this.packageName = packageName;
- this.packageGUID = packageGUID;
- this.moduleType = moduleType;
- this.modulePcdType = modulePcdType;
- this.arch = arch;
- this.version = version;
- this.datum = value;
- this.maxDatumSize = maxDatumSize;
- }
-
- /**
- Get the primary key for usage instance array for every token.
-
- @param moduleName the name of module
- @param moduleGUID the GUID name of module
- @param packageName the name of package who contains this module
- @param packageGUID the GUID name of package
- @param arch the archtecture string
- @param version the version of this module
-
- @return String primary key
- */
- public static String getPrimaryKey(String moduleName,
- UUID moduleGUID,
- String packageName,
- UUID packageGUID,
- String arch,
- String version) {
- //
- // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
- // <ModuleSA> section, So currently no expect all paramter must be valid.
- return (moduleName + "_" +
- ((moduleGUID != null) ? moduleGUID.toString() : "NullModuleGuid") + "_" +
- ((packageName != null) ? packageName : "NullPackageName") + "_" +
- ((packageGUID != null) ? packageGUID.toString() : "NullPackageGuid") + "_" +
- ((arch != null) ? arch : "NullArch") + "_" +
- ((version != null) ? version : "NullVersion"));
- }
-
- /**
- Get primary key string for this usage instance
-
- @return String primary key string
- **/
- public String getPrimaryKey() {
- return UsageInstance.getPrimaryKey(moduleName, moduleGUID, packageName, packageGUID, arch, version);
- }
-
- /**
- Judget whether current module is PEI driver
-
- @return boolean
- */
- public boolean isPeiPhaseComponent() {
- if ((moduleType == MODULE_TYPE.PEI_CORE) ||
- (moduleType == MODULE_TYPE.PEIM)) {
- return true;
- }
- return false;
- }
-
- /**
- Generate autogen string for header file and C code file.
-
- @throws EntityException Fail to generate.
-
- @param isBuildUsedLibrary whether the autogen is for library.
- */
- public void generateAutoGen(boolean isBuildUsedLibrary)
+ ///
+ /// The module type of usage instance.
+ ///
+ public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS}
+
+ ///
+ /// This parent that this usage instance belongs to.
+ ///
+ public Token parentToken;
+
+ ///
+ /// The name of the module who contains this PCD.
+ ///
+ public String moduleName;
+
+ ///
+ /// The GUID of the module who contains this PCD.
+ ///
+ public UUID moduleGUID;
+
+ ///
+ /// The name of the package whose module contains this PCD.
+ ///
+ public String packageName;
+
+ ///
+ /// The GUID of the package whose module contains this PCD.
+ ///
+ public UUID packageGUID;
+
+ ///
+ /// The PCD type defined for module
+ ///
+ public Token.PCD_TYPE modulePcdType;
+
+ ///
+ /// The arch string of module contains this PCD
+ ///
+ public String arch;
+
+ ///
+ /// The version of module contains this PCD
+ ///
+ public String version;
+
+ ///
+ /// The module type for this usage instance.
+ ///
+ public MODULE_TYPE moduleType;
+
+ ///
+ /// The value of the PCD in this usage instance.
+ ///
+ public String datum;
+
+ ///
+ /// The maxDatumSize could be different for same PCD in different module
+ /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule
+ /// type.
+ ///
+ public int maxDatumSize;
+
+ ///
+ /// Autogen string for header file.
+ ///
+ public String hAutogenStr;
+
+ ///
+ /// Auotgen string for C code file.
+ ///
+ public String cAutogenStr;
+
+ /**
+ Constructure function
+
+ @param parentToken Member variable.
+ @param moduleName Member variable.
+ @param moduleGUID Member variable.
+ @param packageName Member variable.
+ @param packageGUID Member variable.
+ @param moduleType Member variable.
+ @param modulePcdType Member variable.
+ @param arch Member variable.
+ @param version Member variable.
+ @param value Member variable.
+ @param maxDatumSize Member variable.
+ */
+ public UsageInstance (Token parentToken,
+ String moduleName,
+ UUID moduleGUID,
+ String packageName,
+ UUID packageGUID,
+ MODULE_TYPE moduleType,
+ Token.PCD_TYPE modulePcdType,
+ String arch,
+ String version,
+ String value,
+ int maxDatumSize) {
+ this.parentToken = parentToken;
+ this.moduleName = moduleName;
+ this.moduleGUID = moduleGUID;
+ this.packageName = packageName;
+ this.packageGUID = packageGUID;
+ this.moduleType = moduleType;
+ this.modulePcdType = modulePcdType;
+ this.arch = arch;
+ this.version = version;
+ this.datum = value;
+ this.maxDatumSize = maxDatumSize;
+ }
+
+ /**
+ Get the primary key for usage instance array for every token.
+
+ @param moduleName the name of module
+ @param moduleGUID the GUID name of module
+ @param packageName the name of package who contains this module
+ @param packageGUID the GUID name of package
+ @param arch the archtecture string
+ @param version the version of this module
+
+ @return String primary key
+ */
+ public static String getPrimaryKey(String moduleName,
+ UUID moduleGUID,
+ String packageName,
+ UUID packageGUID,
+ String arch,
+ String version) {
+ //
+ // Because currently transition schema not require write moduleGuid, package Name, Packge GUID in
+ // <ModuleSA> section, So currently no expect all paramter must be valid.
+ return(moduleName + "_" +
+ ((moduleGUID != null) ? moduleGUID.toString() : "NullModuleGuid") + "_" +
+ ((packageName != null) ? packageName : "NullPackageName") + "_" +
+ ((packageGUID != null) ? packageGUID.toString() : "NullPackageGuid") + "_" +
+ ((arch != null) ? arch : "NullArch") + "_" +
+ ((version != null) ? version : "NullVersion"));
+ }
+
+ /**
+ Get primary key string for this usage instance
+
+ @return String primary key string
+ **/
+ public String getPrimaryKey() {
+ return UsageInstance.getPrimaryKey(moduleName, moduleGUID, packageName, packageGUID, arch, version);
+ }
+
+ /**
+ Judget whether current module is PEI driver
+
+ @return boolean
+ */
+ public boolean isPeiPhaseComponent() {
+ if ((moduleType == MODULE_TYPE.PEI_CORE) ||
+ (moduleType == MODULE_TYPE.PEIM)) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ Generate autogen string for header file and C code file.
+
+ @throws EntityException Fail to generate.
+
+ @param isBuildUsedLibrary whether the autogen is for library.
+ */
+ public void generateAutoGen(boolean isBuildUsedLibrary)
throws EntityException {
+ String guidStringArray[] = null;
+ String guidString = null;
+
+ hAutogenStr = "";
+ cAutogenStr = "";
+
+ if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
+ hAutogenStr += String.format("#define _PCD_LOCAL_TOKEN_%s 0x%016x\r\n",
+ parentToken.cName, parentToken.tokenNumber);
+ hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
+ parentToken.cName, parentToken.dynamicExTokenNumber);
+ } else {
+ hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
+ parentToken.cName, parentToken.tokenNumber);
+ }
+
+ switch (modulePcdType) {
+ case FEATURE_FLAG:
+ if (isBuildUsedLibrary) {
+ hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
+ parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ } else {
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
+ parentToken.cName,
+ datum.toString());
+ hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
+ parentToken.cName);
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ }
+ break;
+ case FIXED_AT_BUILD:
+ if (isBuildUsedLibrary) {
+ hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ } else {
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
+ parentToken.cName,
+ datum.toString());
+ hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ }
+ break;
+ case PATCHABLE_IN_MODULE:
+ if (isBuildUsedLibrary) {
+ hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ } else {
+ hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
+ parentToken.cName,
+ datum.toString());
+ hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
+ Token.getAutogendatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+ }
+
+ break;
+ case DYNAMIC:
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_TOKEN_%s)\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
+ parentToken.cName);
+ break;
+ case DYNAMIC_EX:
+ guidStringArray = parentToken.tokenSpaceName.toString().split("-");
+ guidString = String.format("{ 0x%s, 0x%s, 0x%s, {0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s, 0x%s}}",
+ guidStringArray[0],
+ guidStringArray[1],
+ guidStringArray[2],
+ (guidStringArray[3].substring(0, 2)),
+ (guidStringArray[3].substring(2, 4)),
+ (guidStringArray[4].substring(0, 2)),
+ (guidStringArray[4].substring(2, 4)),
+ (guidStringArray[4].substring(4, 6)),
+ (guidStringArray[4].substring(6, 8)),
+ (guidStringArray[4].substring(8, 10)),
+ (guidStringArray[4].substring(10, 12)));
+
+ hAutogenStr += String.format("extern EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s;\r\n",
+ parentToken.cName);
+ hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_LOCAL_TOKEN_%s)\r\n",
+ Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
+ parentToken.cName,
+ parentToken.cName);
+
+ if (!isBuildUsedLibrary) {
+ cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID _gPcd_DynamicEx_TokenSpaceGuid_%s = %s;\r\n",
+ parentToken.cName,
+ guidString);
+ }
+ break;
+ }
+ }
+
+ /**
+ Get the autogen string for header file.
+
+ @return The string of header file.
+ **/
+ public String getHAutogenStr() {
+ return hAutogenStr;
+ }
- hAutogenStr = "";
- cAutogenStr = "";
-
- hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
- parentToken.cName, parentToken.tokenNumber);
- switch(modulePcdType) {
- case FEATURE_FLAG:
- if(isBuildUsedLibrary) {
- hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- parentToken.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- datum.toString());
- hAutogenStr += String.format("extern const BOOLEAN _gPcd_FixedAtBuild_%s;\r\n",
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const BOOLEAN _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- break;
- case FIXED_AT_BUILD:
- if(isBuildUsedLibrary) {
- hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_FixedAtBuild_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- datum.toString());
- hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
- break;
- case PATCHABLE_IN_MODULE:
- if(isBuildUsedLibrary) {
- hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- } else {
- hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
- parentToken.cName,
- datum.toString());
- hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName);
- cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
- Token.getAutogendatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- parentToken.cName);
- }
-
- break;
- case DYNAMIC:
- hAutogenStr += String.format("#define _PCD_MODE_%s_%s LibPcdGet%s(_PCD_TOKEN_%s)\r\n",
- Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
- parentToken.cName,
- Token.getAutogenLibrarydatumTypeString(parentToken.datumType),
- parentToken.cName);
- break;
- case DYNAMIC_EX:
- break;
+ /**
+ Get the autogen string for C code file.
+
+ @return The string of C Code file.
+ **/
+ public String getCAutogenStr() {
+ return cAutogenStr;
}
- }
-
- /**
- Get the autogen string for header file.
-
- @return The string of header file.
- **/
- public String getHAutogenStr() {
- return hAutogenStr;
- }
-
- /**
- Get the autogen string for C code file.
-
- @return The string of C Code file.
- **/
- public String getCAutogenStr() {
- return cAutogenStr;
- }
}