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
This commit is contained in:
klu2
2006-06-17 09:57:06 +00:00
parent 5179dda3f8
commit 38ee8d9e66
4 changed files with 340 additions and 280 deletions

View File

@@ -77,12 +77,12 @@ Module Name: PcdLib.h
// //
// Dynamic Ex is to support binary distribution // Dynamic Ex is to support binary distribution
// //
#define PcdGetEx8(Guid, TokenName) LibPcdGetEx8 (Guid, _PCD_TOKEN_##TokenName) #define PcdGetEx8(TokenName) LibPcdGetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
#define PcdGetEx16(Guid, TokenName) LibPcdGetEx16 (Guid, _PCD_TOKEN_##TokenName) #define PcdGetEx16(TokenName) LibPcdGetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
#define PcdGetEx32(Guid, TokenName) LibPcdGetEx32 (Guid, _PCD_TOKEN_##TokenName) #define PcdGetEx32(TokenName) LibPcdGetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
#define PcdGetEx64(Guid, TokenName) LibPcdGetEx64 (Guid, _PCD_TOKEN_##TokenName) #define PcdGetEx64(TokenName) LibPcdGetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
#define PcdGetExPtr(Guid, TokenName) LibPcdGetExPtr (Guid, _PCD_TOKEN_##TokenName) #define PcdGetExPtr(TokenName) LibPcdGetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName)
#define PcdGetExBool(Guid, TokenName) LibPcdGetExBool (Guid, _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 // Dynamic Set Ex
// //
#define PcdSetEx8(Guid, TokenName, Value) LibPcdSetEx8 (Guid, _PCD_TOKEN_##TokenName, Value) #define PcdSetEx8(TokenName, Value) LibPcdSetEx8 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
#define PcdSetEx16(Guid, TokenName, Value) LibPcdSetEx16 (Guid, _PCD_TOKEN_##TokenName, Value) #define PcdSetEx16(TokenName, Value) LibPcdSetEx16 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
#define PcdSetEx32(Guid, TokenName, Value) LibPcdSetEx32 (Guid, _PCD_TOKEN_##TokenName, Value) #define PcdSetEx32(TokenName, Value) LibPcdSetEx32 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
#define PcdSetEx64(Guid, TokenName, Value) LibPcdSetEx64 (Guid, _PCD_TOKEN_##TokenName, Value) #define PcdSetEx64(TokenName, Value) LibPcdSetEx64 (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
#define PcdSetExPtr(Guid, TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (Guid, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer) #define PcdSetExPtr(TokenName, SizeOfBuffer, Buffer) LibPcdSetExPtr (&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, SizeOfBuffer, Buffer)
#define PcdSetExBool(Guid, TokenName, Value) LibPcdSetExBool(Guid, _PCD_TOKEN_##TokenName, Value) #define PcdSetExBool(TokenName, Value) LibPcdSetExBool(&_gPcd_DynamicEx_TokenSpaceGuid_##TokenName, _PCD_TOKEN_##TokenName, Value)
/** /**

View File

@@ -2117,6 +2117,8 @@ public class CollectPCDAction {
SkuInstance skuInstance = null; SkuInstance skuInstance = null;
String temp; String temp;
boolean hasSkuId0 = false; boolean hasSkuId0 = false;
Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
int tokenNumber = 0;
List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null; List<DynamicPcdBuildDefinitions.PcdBuildData.SkuInfo> skuInfoList = null;
DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null; DynamicPcdBuildDefinitions.PcdBuildData dynamicInfo = null;
@@ -2152,6 +2154,21 @@ public class CollectPCDAction {
dynamicInfo.getMaxDatumSize()); dynamicInfo.getMaxDatumSize());
throw new EntityException(exceptionString); 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(); skuInfoList = dynamicInfo.getSkuInfoList();

View File

@@ -65,11 +65,16 @@ public class Token {
/// ///
/// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in /// tokenNumber is allocated by platform. tokenNumber indicate an index for this token in
/// platform token space. /// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
/// tokenNumber is defined in SPD, FPD. /// PCD run-time database autogen tools.
/// ///
public int tokenNumber; 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 /// All supported PCD type, this value can be retrieved from SPD
/// Currently, only record all PCD type for this token in FPD file. /// Currently, only record all PCD type for this token in FPD file.

View File

@@ -30,288 +30,326 @@ import org.tianocore.build.pcd.exception.EntityException;
is an usage instance for this PCD token. is an usage instance for this PCD token.
**/ **/
public class UsageInstance { public class UsageInstance {
/// ///
/// The module type of usage instance. /// The module type of usage instance.
/// ///
public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS} public enum MODULE_TYPE {SEC, PEI_CORE, PEIM, DXE_CORE, DXE_DRIVERS, OTHER_COMPONENTS}
/// ///
/// This parent that this usage instance belongs to. /// This parent that this usage instance belongs to.
/// ///
public Token parentToken; public Token parentToken;
/// ///
/// The name of the module who contains this PCD. /// The name of the module who contains this PCD.
/// ///
public String moduleName; public String moduleName;
/// ///
/// The GUID of the module who contains this PCD. /// The GUID of the module who contains this PCD.
/// ///
public UUID moduleGUID; public UUID moduleGUID;
/// ///
/// The name of the package whose module contains this PCD. /// The name of the package whose module contains this PCD.
/// ///
public String packageName; public String packageName;
/// ///
/// The GUID of the package whose module contains this PCD. /// The GUID of the package whose module contains this PCD.
/// ///
public UUID packageGUID; public UUID packageGUID;
/// ///
/// The PCD type defined for module /// The PCD type defined for module
/// ///
public Token.PCD_TYPE modulePcdType; public Token.PCD_TYPE modulePcdType;
/// ///
/// The arch string of module contains this PCD /// The arch string of module contains this PCD
/// ///
public String arch; public String arch;
/// ///
/// The version of module contains this PCD /// The version of module contains this PCD
/// ///
public String version; public String version;
/// ///
/// The module type for this usage instance. /// The module type for this usage instance.
/// ///
public MODULE_TYPE moduleType; public MODULE_TYPE moduleType;
/// ///
/// The value of the PCD in this usage instance. /// The value of the PCD in this usage instance.
/// ///
public String datum; public String datum;
/// ///
/// The maxDatumSize could be different for same PCD in different module /// The maxDatumSize could be different for same PCD in different module
/// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule /// But this case is allow for FeatureFlag, FixedAtBuild, PatchableInModule
/// type. /// type.
/// ///
public int maxDatumSize; public int maxDatumSize;
/// ///
/// Autogen string for header file. /// Autogen string for header file.
/// ///
public String hAutogenStr; public String hAutogenStr;
/// ///
/// Auotgen string for C code file. /// Auotgen string for C code file.
/// ///
public String cAutogenStr; public String cAutogenStr;
/** /**
Constructure function Constructure function
@param parentToken Member variable. @param parentToken Member variable.
@param moduleName Member variable. @param moduleName Member variable.
@param moduleGUID Member variable. @param moduleGUID Member variable.
@param packageName Member variable. @param packageName Member variable.
@param packageGUID Member variable. @param packageGUID Member variable.
@param moduleType Member variable. @param moduleType Member variable.
@param modulePcdType Member variable. @param modulePcdType Member variable.
@param arch Member variable. @param arch Member variable.
@param version Member variable. @param version Member variable.
@param value Member variable. @param value Member variable.
@param maxDatumSize Member variable. @param maxDatumSize Member variable.
*/ */
public UsageInstance (Token parentToken, public UsageInstance (Token parentToken,
String moduleName, String moduleName,
UUID moduleGUID, UUID moduleGUID,
String packageName, String packageName,
UUID packageGUID, UUID packageGUID,
MODULE_TYPE moduleType, MODULE_TYPE moduleType,
Token.PCD_TYPE modulePcdType, Token.PCD_TYPE modulePcdType,
String arch, String arch,
String version, String version,
String value, String value,
int maxDatumSize) { int maxDatumSize) {
this.parentToken = parentToken; this.parentToken = parentToken;
this.moduleName = moduleName; this.moduleName = moduleName;
this.moduleGUID = moduleGUID; this.moduleGUID = moduleGUID;
this.packageName = packageName; this.packageName = packageName;
this.packageGUID = packageGUID; this.packageGUID = packageGUID;
this.moduleType = moduleType; this.moduleType = moduleType;
this.modulePcdType = modulePcdType; this.modulePcdType = modulePcdType;
this.arch = arch; this.arch = arch;
this.version = version; this.version = version;
this.datum = value; this.datum = value;
this.maxDatumSize = maxDatumSize; 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 {
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 header file. Get the primary key for usage instance array for every token.
@return The string of header file. @param moduleName the name of module
**/ @param moduleGUID the GUID name of module
public String getHAutogenStr() { @param packageName the name of package who contains this module
return hAutogenStr; @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 the autogen string for C code file. Get primary key string for this usage instance
@return The string of C Code file. @return String primary key string
**/ **/
public String getCAutogenStr() { public String getPrimaryKey() {
return cAutogenStr; 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;
}
/**
Get the autogen string for C code file.
@return The string of C Code file.
**/
public String getCAutogenStr() {
return cAutogenStr;
}
} }