summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-03 15:40:49 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-07-03 15:40:49 +0000
commitbb5545b663e1d8ac4fd37003d5ba26fafdad5831 (patch)
treecfc7c990d6c40fa4be7996e1609af57f05edb7b8 /Tools
parenta15bb0d31f5345dd81dde0e978a3cbdc54fa27e7 (diff)
downloadedk2-bb5545b663e1d8ac4fd37003d5ba26fafdad5831.zip
edk2-bb5545b663e1d8ac4fd37003d5ba26fafdad5831.tar.gz
edk2-bb5545b663e1d8ac4fd37003d5ba26fafdad5831.tar.bz2
Add PcdDxe and PcdPEIM to all-arch for EdkModulePkg-All-Archs.fpd
Fix a few bugs in PcdDxe and PcdPEIM git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@722 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Conf/Pcd/PcdDatabaseCommonDefinitions.sample2
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java82
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java25
3 files changed, 83 insertions, 26 deletions
diff --git a/Tools/Conf/Pcd/PcdDatabaseCommonDefinitions.sample b/Tools/Conf/Pcd/PcdDatabaseCommonDefinitions.sample
index eaa692d..7bdb282 100644
--- a/Tools/Conf/Pcd/PcdDatabaseCommonDefinitions.sample
+++ b/Tools/Conf/Pcd/PcdDatabaseCommonDefinitions.sample
@@ -21,7 +21,7 @@ typedef UINT8 SKU_ID;
typedef struct {
UINT32 ExTokenNumber;
- UINT32 LocalTokenNumber; // PCD Number of this particular platform build
+ UINT16 LocalTokenNumber; // PCD Number of this particular platform build
UINT16 ExGuidIndex; // Index of GuidTable
} DYNAMICEX_MAPPING;
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 63d494f..6686de9 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/CollectPCDAction.java
@@ -1008,6 +1008,30 @@ class PcdDatabase {
}
}
+ private int getHiiPtrTypeAlignmentSize(Token token) {
+ switch (token.datumType) {
+ case UINT8:
+ return 1;
+ case UINT16:
+ return 2;
+ case UINT32:
+ return 4;
+ case UINT64:
+ return 8;
+ case POINTER:
+ if (token.isHiiEnable()) {
+ if (token.isHiiDefaultValueUnicodeStringType()) {
+ return 2;
+ }
+ }
+ return 1;
+ case BOOLEAN:
+ return 1;
+ default:
+ return 1;
+ }
+ }
+
private int getAlignmentSize (Token token) {
if (token.getDefaultSku().type == DynamicTokenValue.VALUE_TYPE.HII_TYPE) {
return 2;
@@ -1599,28 +1623,25 @@ class PcdDatabase {
privateGlobalName = t.getPrimaryKeyString();
}
- if (t.isUnicodeStringType()) {
- privateGlobalCCode = String.format("%-20s%s[%d];\r\n", "STRING_HEAD", t.getPrimaryKeyString(), t.getSkuIdCount());
- } else {
- String type = getCType(t);
- if (t.datumType == Token.DATUM_TYPE.POINTER) {
- int bufferSize;
- if (t.isASCIIStringType()) {
- //
- // Build tool will add a NULL string at the end of the ASCII string
- //
- bufferSize = t.datumSize + 1;
- } else {
- bufferSize = t.datumSize;
- }
- privateGlobalCCode = String.format("%-20s%s[%d][%d];\r\n", type, privateGlobalName, t.getSkuIdCount(), bufferSize);
+ String type = getCType(t);
+ if ((t.datumType == Token.DATUM_TYPE.POINTER) && (!t.isHiiEnable())) {
+ int bufferSize;
+ if (t.isASCIIStringType()) {
+ //
+ // Build tool will add a NULL string at the end of the ASCII string
+ //
+ bufferSize = t.datumSize + 1;
} else {
- privateGlobalCCode = String.format("%-20s%s[%d];\r\n", type, privateGlobalName, t.getSkuIdCount());
+ bufferSize = t.datumSize;
}
+ privateGlobalCCode = String.format("%-20s%s[%d][%d];\r\n", type, privateGlobalName, t.getSkuIdCount(), bufferSize);
+ } else {
+ privateGlobalCCode = String.format("%-20s%s[%d];\r\n", type, privateGlobalName, t.getSkuIdCount());
}
}
- private String getDataTypeDeclarationForVariableDefault_new (Token token, String cName, int skuId) {
+ private String getDataTypeDeclarationForVariableDefault_new (Token token, String cName, int skuId)
+ throws EntityException {
String typeStr;
@@ -1635,9 +1656,27 @@ class PcdDatabase {
} else if (token.datumType == Token.DATUM_TYPE.BOOLEAN) {
typeStr = "BOOLEAN";
} else if (token.datumType == Token.DATUM_TYPE.POINTER) {
- return String.format("%-20s%s[%d];\r\n", cName, token.datumSize);
+ int size;
+ if (token.isHiiDefaultValueUnicodeStringType()) {
+ typeStr = "UINT16";
+ //
+ // Include the NULL charactor
+ //
+ size = token.datumSize / 2 + 1;
+ } else {
+ typeStr = "UINT8";
+ if (token.isHiiDefaultValueASCIIStringType()) {
+ //
+ // Include the NULL charactor
+ //
+ size = token.datumSize + 1;
+ } else {
+ size = token.datumSize;
+ }
+ }
+ return String.format("%-20s%s[%d];\r\n", typeStr, cName, size);
} else {
- typeStr = "";
+ throw new EntityException("Unknown DATUM_TYPE type in when generating code for VARIABLE_ENABLED PCD entry");
}
return String.format("%-20s%s;\r\n", typeStr, cName);
@@ -1678,7 +1717,7 @@ class PcdDatabase {
s += tab + "{" + newLine;
for (i = 0; i < t.skuData.size(); i++) {
- if (t.isUnicodeStringType() && !t.isHiiEnable()) {
+ if (t.isUnicodeStringType()) {
s += tab + tab + String.format("{ %d }", stringTable.add(t.skuData.get(i).value.value, t));
} else if (t.isHiiEnable()) {
/* VPD_HEAD definition
@@ -1686,6 +1725,7 @@ class PcdDatabase {
UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.
UINT16 StringIndex; // Offset in String Table in units of UINT16.
UINT16 Offset; // Offset in Variable
+ UINT16 DefaultValueOffset; // Offset of the Default Value
} VARIABLE_HEAD ;
*/
String variableDefaultName = String.format("%s_VariableDefault_%d", t.getPrimaryKeyString(), i);
@@ -1700,7 +1740,7 @@ class PcdDatabase {
// the instantiation for the default value.
//
CStructTypeDeclaration decl = new CStructTypeDeclaration (variableDefaultName,
- getDataTypeAlignmentSize(t),
+ getHiiPtrTypeAlignmentSize(t),
getDataTypeDeclarationForVariableDefault_new(t, variableDefaultName, i),
true
);
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 97c2d29..1ffad91 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/entity/Token.java
@@ -587,8 +587,6 @@ public class Token {
DynamicTokenValue dynamicData = getDefaultSku();
if (hasDefaultValue()) {
switch (dynamicData.type) {
- case HII_TYPE:
- return dynamicData.hiiDefaultValue;
case DEFAULT_TYPE:
return dynamicData.value;
}
@@ -626,7 +624,6 @@ public class Token {
}
public boolean isValidNullValue(String judgedValue) {
- int intValue;
String subStr;
BigInteger bigIntValue;
@@ -687,7 +684,27 @@ public class Token {
}
return false;
}
-
+
+ public boolean isHiiDefaultValueUnicodeStringType() {
+ DynamicTokenValue dynamicData = getDefaultSku();
+
+ if (dynamicData == null)
+ return false;
+
+ return dynamicData.hiiDefaultValue.startsWith("L\"")
+ && dynamicData.hiiDefaultValue.endsWith("\"");
+ }
+
+ public boolean isHiiDefaultValueASCIIStringType() {
+ DynamicTokenValue dynamicData = getDefaultSku();
+
+ if (dynamicData == null)
+ return false;
+
+ return dynamicData.hiiDefaultValue.startsWith("\"")
+ && dynamicData.hiiDefaultValue.endsWith("\"");
+ }
+
/**
Judege whether current value is UNICODE string type.
@return boolean