modules = getComponentsFromFPD();\r
\r
if (modules == null) {\r
- throw new EntityException("No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
+ throw new EntityException("[FPD file error] No modules in FPD file, Please check whether there are elements in <FrameworkModules> in FPD file!");\r
}\r
\r
//\r
// Value is required.\r
// \r
if (datum == null) {\r
- exceptionString = String.format("There is no value for PCD entry %s in module %s!",\r
+ exceptionString = String.format("[FPD file error] There is no value for PCD entry %s in module %s!",\r
pcdBuildData.getCName(),\r
moduleName);\r
throw new EntityException(exceptionString);\r
// modules.\r
// \r
if (token.datumType != datumType) {\r
- exceptionString = String.format("The datum type of PCD entry %s is %s, which is different with %s defined in before!",\r
+ exceptionString = String.format("[FPD file error] The datum type of PCD entry %s is %s, which is different with %s defined in before!",\r
pcdBuildData.getCName(), \r
pcdBuildData.getDatumType().toString(), \r
Token.getStringOfdatumType(token.datumType));\r
// Check token number is valid\r
// \r
if (tokenNumber != token.tokenNumber) {\r
- exceptionString = String.format("The token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
+ exceptionString = String.format("[FPD file error] The token number of PCD entry %s in module %s is different with same PCD entry in other modules!",\r
pcdBuildData.getCName(),\r
moduleName);\r
throw new EntityException(exceptionString);\r
// For same PCD used in different modules, the PCD type should all be dynamic or non-dynamic.\r
// \r
if (token.isDynamicPCD != Token.isDynamic(pcdType)) {\r
- exceptionString = String.format("For PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
+ exceptionString = String.format("[FPD file error] For PCD entry %s in module %s, you define dynamic or non-dynamic PCD type which"+\r
"is different with others module's",\r
token.cName,\r
moduleName);\r
// But if you write, the <Value> must be same as the value in <DynamicPcdBuildDefinitions>.\r
// \r
if (!token.isSkuEnable() && \r
- (token.skuData.get(0).value.type == DynamicTokenValue.VALUE_TYPE.DEFAULT_TYPE)) {\r
- if (!datum.equalsIgnoreCase(token.skuData.get(0).value.value)) {\r
- exceptionString = String.format("For dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
+ (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.DEFAULT_TYPE) &&\r
+ (datum != null)) {\r
+ if (!datum.equalsIgnoreCase(token.getDefaultSku().value)) {\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the datum in <ModuleSA> is "+\r
"not equal to the datum in <DynamicPcdBuildDefinitions>, it is "+\r
- "illega! You can choose no <Value> in <ModuleSA>!",\r
+ "illega! You could no set <Value> in <ModuleSA> for a dynamic PCD!",\r
token.cName,\r
moduleName);\r
+ throw new EntityException(exceptionString);\r
}\r
}\r
+\r
+ if ((maxDatumSize != 0) &&\r
+ (maxDatumSize != token.datumSize)){\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in module %s, the max datum size is %d which "+\r
+ "is different with <MaxDatumSize> %d defined in <DynamicPcdBuildDefinitions>!",\r
+ token.cName,\r
+ moduleName,\r
+ maxDatumSize,\r
+ token.datumSize);\r
+ throw new EntityException(exceptionString);\r
+ }\r
}\r
\r
} else {\r
\r
dynamicPcdBuildDefinitions = fpdDocInstance.getFrameworkPlatformDescription().getDynamicPcdBuildDefinitions();\r
if (dynamicPcdBuildDefinitions == null) {\r
- exceptionString = String.format("There are no <PcdDynamicBuildDescriptions> in FPD file but contains Dynamic type "+\r
+ exceptionString = String.format("[FPD file error] There are no <PcdDynamicBuildDescriptions> in FPD file but contains Dynamic type "+\r
"PCD entry %s in module %s!",\r
token.cName,\r
moduleName);\r
int maxDatumSize, \r
Token.DATUM_TYPE datumType) {\r
String exceptionString = null;\r
+\r
+ if (maxDatumSize == 0) {\r
+ exceptionString = String.format("[FPD file error] You maybe miss <MaxDatumSize> for PCD %s in module %s",\r
+ cName,\r
+ moduleName);\r
+ return exceptionString;\r
+ }\r
+\r
switch (datumType) {\r
case UINT8:\r
if (maxDatumSize != 1) {\r
- exceptionString = String.format("In FPD file, the datum type of PCD data %s in module %s "+\r
+ exceptionString = String.format("[FPD file error] The datum type of PCD data %s in module %s "+\r
"is UINT8, but datum size is %d, they are not matched!",\r
cName,\r
moduleName,\r
break;\r
case UINT16:\r
if (maxDatumSize != 2) {\r
- exceptionString = String.format("In FPD file, the datum type of PCD data %s in module %s "+\r
+ exceptionString = String.format("[FPD file error] The datum type of PCD data %s in module %s "+\r
"is UINT16, but datum size is %d, they are not matched!",\r
cName,\r
moduleName,\r
break;\r
case UINT32:\r
if (maxDatumSize != 4) {\r
- exceptionString = String.format("In FPD file, the datum type of PCD data %s in module %s "+\r
+ exceptionString = String.format("[FPD file error] the datum type of PCD data %s in module %s "+\r
"is UINT32, but datum size is %d, they are not matched!",\r
cName,\r
moduleName,\r
break;\r
case UINT64:\r
if (maxDatumSize != 8) {\r
- exceptionString = String.format("In FPD file, the datum type of PCD data %s in module %s "+\r
+ exceptionString = String.format("[FPD file error] the datum type of PCD data %s in module %s "+\r
"is UINT64, but datum size is %d, they are not matched!",\r
cName,\r
moduleName,\r
break;\r
case BOOLEAN:\r
if (maxDatumSize != 1) {\r
- exceptionString = String.format("In FPD file, the datum type of PCD data %s in module %s "+\r
+ exceptionString = String.format("[FPD file error] the datum type of PCD data %s in module %s "+\r
"is BOOLEAN, but datum size is %d, they are not matched!",\r
cName,\r
moduleName,\r
\r
dynamicInfo = getDynamicInfoFromFPD(token, moduleName);\r
if (dynamicInfo == null) {\r
- exceptionString = String.format("For Dynamic PCD %s used by module %s, "+\r
+ exceptionString = String.format("[FPD file error] For Dynamic PCD %s used by module %s, "+\r
"there is no dynamic information in <DynamicPcdBuildDefinitions> "+\r
"in FPD file, but it is required!",\r
token.cName,\r
throw new EntityException(exceptionString);\r
}\r
\r
+ token.datumSize = dynamicInfo.getMaxDatumSize();\r
+\r
+ exceptionString = verifyDatumSize(token.cName, moduleName, token.datumSize, token.datumType);\r
+ if (exceptionString != null) {\r
+ throw new EntityException(exceptionString);\r
+ }\r
+\r
+ if ((maxDatumSize != 0) && \r
+ (maxDatumSize != token.datumSize)) {\r
+ exceptionString = String.format("FPD file error] For dynamic PCD %s, the datum size in module %s is %d, but "+\r
+ "the datum size in <DynamicPcdBuildDefinitions> is %d, they are not match!",\r
+ token.cName,\r
+ moduleName, \r
+ maxDatumSize,\r
+ dynamicInfo.getMaxDatumSize());\r
+ throw new EntityException(exceptionString);\r
+ }\r
+\r
skuInfoList = dynamicInfo.getSkuInfoList();\r
\r
//\r
// \r
temp = skuInfoList.get(index).getSkuId().toString();\r
skuInstance.id = Integer.decode(temp);\r
-\r
if (skuInstance.id == 0) {\r
hasSkuId0 = true;\r
}\r
if (datum != null) {\r
if ((skuInstance.id == 0) &&\r
!datum.equalsIgnoreCase(skuInfoList.get(index).getValue())) {\r
- exceptionString = String.format("For dynamic PCD %s, module %s give <datum> as %s which is different with "+\r
- "Sku 0's <datum> %s defined in <DynamicPcdBuildDefinitions>! Please sync them at first!",\r
- token.cName,\r
- datum,\r
- skuInfoList.get(index).getValue());\r
+ exceptionString = "[FPD file error] For dynamic PCD " + token.cName + ", the value in module is " + datum.toString() + " but the "+\r
+ "value of sku 0 data in <DynamicPcdBuildDefinition> is " + skuInstance.value.value + ". They are must be same!"+\r
+ " or you could not define value for a dynamic PCD in every <ModuleSA>!"; \r
throw new EntityException(exceptionString);\r
}\r
}\r
if (skuInfoList.get(index).getVariableName() != null) {\r
exceptionString = null;\r
if (skuInfoList.get(index).getVariableGuid() == null) {\r
- exceptionString = String.format("For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableGuid> defined for Sku %d data!",\r
token.cName,\r
index);\r
}\r
\r
if (skuInfoList.get(index).getVariableOffset() == null) {\r
- exceptionString = String.format("For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <VariableOffset> defined for Sku %d data!",\r
token.cName,\r
index);\r
}\r
\r
if (skuInfoList.get(index).getHiiDefaultValue() == null) {\r
- exceptionString = String.format("For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions> section in FPD "+\r
"file, who use HII, but there is no <HiiDefaultValue> defined for Sku %d data!",\r
token.cName,\r
index);\r
}\r
offset = Integer.decode(skuInfoList.get(index).getVariableOffset());\r
if (offset > 0xFFFF) {\r
- throw new EntityException(String.format("For dynamic PCD %s , the variable offset defined in sku %d data "+\r
+ throw new EntityException(String.format("[FPD file error] For dynamic PCD %s , the variable offset defined in sku %d data "+\r
"exceed 64K, it is not allowed!",\r
token.cName,\r
index));\r
continue;\r
}\r
\r
- exceptionString = String.format("For dynamic PCD %s, the dynamic info must "+\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s, the dynamic info must "+\r
"be one of 'DefaultGroup', 'HIIGroup', 'VpdGroup'.",\r
token.cName);\r
throw new EntityException(exceptionString);\r
}\r
\r
if (!hasSkuId0) {\r
- exceptionString = String.format("For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
+ exceptionString = String.format("[FPD file error] For dynamic PCD %s in <DynamicPcdBuildDefinitions>, there are "+\r
"no sku id = 0 data, which is required for every dynamic PCD",\r
token.cName);\r
+ throw new EntityException(exceptionString);\r
}\r
\r
return token;\r
if ((uuidString.charAt(0) == '0') && ((uuidString.charAt(1) == 'x') || (uuidString.charAt(1) == 'X'))) {\r
splitStringArray = uuidString.split("," );\r
if (splitStringArray.length != 11) {\r
- throw new EntityException ("Wrong format for UUID string: " + uuidString);\r
+ throw new EntityException ("[FPD file error] Wrong format for UUID string: " + uuidString);\r
}\r
\r
//\r