mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
Fix a bug when generate default value for byte array for FIXED_AT_BUILD, PATCHABLE_IN_MODULE type PCD.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@551 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
38ee8d9e66
commit
2435723ad9
@ -1978,7 +1978,7 @@ public class CollectPCDAction {
|
|||||||
strValueArray = strValue.split(",");
|
strValueArray = strValue.split(",");
|
||||||
for (index = 0; index < strValueArray.length; index ++) {
|
for (index = 0; index < strValueArray.length; index ++) {
|
||||||
try{
|
try{
|
||||||
value = Integer.decode(strValueArray[index]);
|
value = Integer.decode(strValueArray[index].trim());
|
||||||
} catch (NumberFormatException nfeEx) {
|
} catch (NumberFormatException nfeEx) {
|
||||||
exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*, and "+
|
exceptionString = String.format("[FPD file error] The datum type of PCD %s in %s is VOID*, and "+
|
||||||
"it is byte array in fact. For every byte in array should be a valid"+
|
"it is byte array in fact. For every byte in array should be a valid"+
|
||||||
|
@ -203,6 +203,7 @@ public class UsageInstance {
|
|||||||
throws EntityException {
|
throws EntityException {
|
||||||
String guidStringArray[] = null;
|
String guidStringArray[] = null;
|
||||||
String guidString = null;
|
String guidString = null;
|
||||||
|
boolean isByteArray = false;
|
||||||
|
|
||||||
hAutogenStr = "";
|
hAutogenStr = "";
|
||||||
cAutogenStr = "";
|
cAutogenStr = "";
|
||||||
@ -217,6 +218,12 @@ public class UsageInstance {
|
|||||||
parentToken.cName, parentToken.tokenNumber);
|
parentToken.cName, parentToken.tokenNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {
|
||||||
|
if (datum.trim().charAt(0) == '{') {
|
||||||
|
isByteArray = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch (modulePcdType) {
|
switch (modulePcdType) {
|
||||||
case FEATURE_FLAG:
|
case FEATURE_FLAG:
|
||||||
if (isBuildUsedLibrary) {
|
if (isBuildUsedLibrary) {
|
||||||
@ -254,18 +261,30 @@ public class UsageInstance {
|
|||||||
hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
|
hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
datum.toString());
|
datum.toString());
|
||||||
hAutogenStr += String.format("extern const %s _gPcd_FixedAtBuild_%s;\r\n",
|
if (isByteArray) {
|
||||||
Token.getAutogendatumTypeString(parentToken.datumType),
|
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gPcd_FixedAtBuild_%s[] = _PCD_VALUE_%s;\r\n",
|
||||||
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
|
hAutogenStr += String.format("extern const UINT8 _gPcd_FixedAtBuild_%s[];\r\n",
|
||||||
|
parentToken.cName);
|
||||||
|
hAutogenStr += String.format("#define _PCD_MODE_%s_%s &_gPcd_FixedAtBuild_%s\r\n",
|
||||||
|
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||||
|
parentToken.cName,
|
||||||
|
parentToken.cName);
|
||||||
|
} else {
|
||||||
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
|
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED const %s _gPcd_FixedAtBuild_%s = _PCD_VALUE_%s;\r\n",
|
||||||
Token.getAutogendatumTypeString(parentToken.datumType),
|
Token.getAutogendatumTypeString(parentToken.datumType),
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
|
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 _PCD_VALUE_%s\r\n",
|
hAutogenStr += String.format("#define _PCD_MODE_%s_%s _PCD_VALUE_%s\r\n",
|
||||||
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PATCHABLE_IN_MODULE:
|
case PATCHABLE_IN_MODULE:
|
||||||
if (isBuildUsedLibrary) {
|
if (isBuildUsedLibrary) {
|
||||||
@ -280,18 +299,30 @@ public class UsageInstance {
|
|||||||
hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
|
hAutogenStr += String.format("#define _PCD_VALUE_%s %s\r\n",
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
datum.toString());
|
datum.toString());
|
||||||
hAutogenStr += String.format("extern %s _gPcd_BinaryPatch_%s;\r\n",
|
if (isByteArray) {
|
||||||
Token.getAutogendatumTypeString(parentToken.datumType),
|
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED UINT8 _gPcd_BinaryPatch_%s[] = _PCD_VALUE_%s;\r\n",
|
||||||
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
|
hAutogenStr += String.format("extern UINT8 _gPcd_BinaryPatch_%s[];\r\n",
|
||||||
|
parentToken.cName);
|
||||||
|
hAutogenStr += String.format("#define _PCD_MODE_%s_%s &_gPcd_BinaryPatch_%s\r\n",
|
||||||
|
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||||
|
parentToken.cName,
|
||||||
|
parentToken.cName);
|
||||||
|
} else {
|
||||||
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
|
cAutogenStr += String.format("GLOBAL_REMOVE_IF_UNREFERENCED %s _gPcd_BinaryPatch_%s = _PCD_VALUE_%s;\r\n",
|
||||||
Token.getAutogendatumTypeString(parentToken.datumType),
|
Token.getAutogendatumTypeString(parentToken.datumType),
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
|
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",
|
hAutogenStr += String.format("#define _PCD_MODE_%s_%s _gPcd_BinaryPatch_%s\r\n",
|
||||||
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
Token.GetAutogenDefinedatumTypeString(parentToken.datumType),
|
||||||
parentToken.cName,
|
parentToken.cName,
|
||||||
parentToken.cName);
|
parentToken.cName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case DYNAMIC:
|
case DYNAMIC:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user