Fix a bug for token number set in FPD can not exceed 2^31. The fixing is using Long instead of int type.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@632 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
klu2 2006-06-26 17:09:08 +00:00
parent 3534cbb7a3
commit 51da9e80d4
3 changed files with 17 additions and 14 deletions

View File

@ -1071,7 +1071,7 @@ class PcdDatabase {
// Add a mapping if this dynamic PCD entry is a EX type
//
if (t.isDynamicEx()) {
exMapTable.add(t.tokenNumber,
exMapTable.add((int)t.tokenNumber,
t.dynamicExTokenNumber,
guidTable.add(t.tokenSpaceName, t.getPrimaryKeyString()),
t.getPrimaryKeyString()
@ -2045,7 +2045,7 @@ public class CollectPCDAction {
boolean isDuplicate = false;
Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
Token.DATUM_TYPE datumType = Token.DATUM_TYPE.UNKNOWN;
int tokenNumber = 0;
long tokenNumber = 0;
String moduleName = null;
String datum = null;
int maxDatumSize = 0;
@ -2117,7 +2117,8 @@ public class CollectPCDAction {
translateSchemaStringToUUID(pcdBuildData.getTokenSpaceGuid()));
pcdType = Token.getpcdTypeFromString(pcdBuildData.getItemType().toString());
datumType = Token.getdatumTypeFromString(pcdBuildData.getDatumType().toString());
tokenNumber = Integer.decode(pcdBuildData.getToken().toString());
tokenNumber = Long.decode(pcdBuildData.getToken().toString());
if (pcdBuildData.getValue() != null) {
datum = pcdBuildData.getValue().toString();
} else {
@ -2719,7 +2720,7 @@ public class CollectPCDAction {
String temp;
boolean hasSkuId0 = false;
Token.PCD_TYPE pcdType = Token.PCD_TYPE.UNKNOWN;
int tokenNumber = 0;
long tokenNumber = 0;
String hiiDefaultValue = null;
String[] variableGuidString = null;
@ -2757,7 +2758,7 @@ public class CollectPCDAction {
dynamicInfo.getMaxDatumSize());
throw new EntityException(exceptionString);
}
tokenNumber = Integer.decode(dynamicInfo.getToken().toString());
tokenNumber = Long.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!",

View File

@ -67,12 +67,12 @@ public class Token {
/// platform token space. For Dynamic, dynamicEx type, this number will be re-adjust by
/// PCD run-time database autogen tools.
///
public int tokenNumber;
public long tokenNumber;
///
/// This token number is retrieved from FPD file for DynamicEx type.
///
public int dynamicExTokenNumber;
public long dynamicExTokenNumber;
///
/// All supported PCD type, this value can be retrieved from SPD

View File

@ -211,21 +211,23 @@ public class UsageInstance {
*/
public void generateAutoGen(boolean isBuildUsedLibrary)
throws EntityException {
String guidStringCName = null;
boolean isByteArray = false;
String printDatum = null;
String guidStringCName = null;
boolean isByteArray = false;
String printDatum = null;
String tokenNumberString = null;
hAutogenStr = "";
cAutogenStr = "";
if (this.modulePcdType == Token.PCD_TYPE.DYNAMIC_EX) {
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
parentToken.cName, parentToken.dynamicExTokenNumber);
tokenNumberString = Long.toString(parentToken.dynamicExTokenNumber, 16);
} else {
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%016x\r\n",
parentToken.cName, parentToken.tokenNumber);
tokenNumberString = Long.toString(parentToken.tokenNumber, 16);
}
hAutogenStr += String.format("#define _PCD_TOKEN_%s 0x%s\r\n",
parentToken.cName, tokenNumberString);
if (!isBuildUsedLibrary && !parentToken.isDynamicPCD) {
if (datum.trim().charAt(0) == '{') {
isByteArray = true;