summaryrefslogtreecommitdiff
path: root/Tools
diff options
context:
space:
mode:
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-16 10:51:01 +0000
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-16 10:51:01 +0000
commit2c0e2bcf495e4288a4d2547661dc8588a9c77337 (patch)
treebe072f2badba24a3c9ef70c5237e8e465f06f458 /Tools
parentd2059d0594816ba3a159554b2e720bc9a3985f4a (diff)
downloadedk2-platforms-2c0e2bcf495e4288a4d2547661dc8588a9c77337.tar.xz
Embeded autogenerated code in Java code instead of getting them from a real file.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1294 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools')
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java157
1 files changed, 103 insertions, 54 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java
index 0460efd9ee..9f90ba7680 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java
@@ -13,9 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.build.pcd.action;
-import java.io.BufferedReader;
import java.io.File;
-import java.io.FileReader;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
@@ -1469,48 +1467,105 @@ public class PcdDatabase {
return s;
}
- public static String getPcdDatabaseCommonDefinitions ()
- throws EntityException {
-
- String retStr = "";
- try {
- File file = new File(GlobalData.getWorkspacePath() + File.separator +
- "Tools" + File.separator +
- "Conf" + File.separator +
- "Pcd" + File.separator +
- "PcdDatabaseCommonDefinitions.sample");
- FileReader reader = new FileReader(file);
- BufferedReader in = new BufferedReader(reader);
- String str;
- while ((str = in.readLine()) != null) {
- retStr = retStr +"\r\n" + str;
- }
- } catch (Exception ex) {
- throw new EntityException("Fatal error when generating PcdDatabase Common Definitions!");
- }
-
- return retStr;
+ public static String getPcdDatabaseCommonDefinitions () {
+
+ String retStr;
+
+ retStr = "//\r\n";
+ retStr += "// The following definition will be generated by build tool\r\n";
+ retStr += "//\r\n";
+ retStr += "\r\n";
+ retStr += "//\r\n";
+ retStr += "// Common definitions\r\n";
+ retStr += "//\r\n";
+ retStr += "typedef UINT8 SKU_ID;\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_TYPE_SHIFT 28\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_TYPE_DATA (0x0 << PCD_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_TYPE_HII (0x8 << PCD_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_TYPE_VPD (0x4 << PCD_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_TYPE_SKU_ENABLED (0x2 << PCD_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_TYPE_STRING (0x1 << PCD_TYPE_SHIFT)\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_TYPE_ALL_SET (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_DATUM_TYPE_SHIFT 24\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_DATUM_TYPE_POINTER (0x0 << PCD_DATUM_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_DATUM_TYPE_UINT8 (0x1 << PCD_DATUM_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_DATUM_TYPE_UINT16 (0x2 << PCD_DATUM_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_DATUM_TYPE_UINT32 (0x4 << PCD_DATUM_TYPE_SHIFT)\r\n";
+ retStr += "#define PCD_DATUM_TYPE_UINT64 (0x8 << PCD_DATUM_TYPE_SHIFT)\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_DATUM_TYPE_ALL_SET (PCD_DATUM_TYPE_POINTER | \\\r\n";
+ retStr += " PCD_DATUM_TYPE_UINT8 | \\\r\n";
+ retStr += " PCD_DATUM_TYPE_UINT16 | \\\r\n";
+ retStr += " PCD_DATUM_TYPE_UINT32 | \\\r\n";
+ retStr += " PCD_DATUM_TYPE_UINT64)\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET))\r\n";
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " UINT32 ExTokenNumber;\r\n";
+ retStr += " UINT16 LocalTokenNumber; // PCD Number of this particular platform build\r\n";
+ retStr += " UINT16 ExGuidIndex; // Index of GuidTable\r\n";
+ retStr += "} DYNAMICEX_MAPPING;\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " UINT32 SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler\r\n";
+ retStr += " UINT32 SkuIdTableOffset; //Offset from the PCD_DB\r\n";
+ retStr += "} SKU_HEAD;\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " UINT16 GuidTableIndex; // Offset in Guid Table in units of GUID.\r\n";
+ retStr += " UINT16 StringIndex; // Offset in String Table in units of UINT16.\r\n";
+ retStr += " UINT16 Offset; // Offset in Variable\r\n";
+ retStr += " UINT16 DefaultValueOffset; // Offset of the Default Value\r\n";
+ retStr += "} VARIABLE_HEAD ;\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " UINT32 Offset;\r\n";
+ retStr += "} VPD_HEAD;\r\n";
+ retStr += "\r\n";
+ retStr += "typedef UINT16 STRING_HEAD;\r\n";
+ retStr += "\r\n";
+ retStr += "typedef UINT16 SIZE_INFO;\r\n";
+ retStr += "\r\n";
+ retStr += "#define offsetof(s,m) (UINT32) (UINTN) &(((s *)0)->m)\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+
+ return retStr;
}
public static String getPcdDxeDatabaseDefinitions ()
throws EntityException {
String retStr = "";
- try {
- File file = new File(GlobalData.getWorkspacePath() + File.separator +
- "Tools" + File.separator +
- "Conf" + File.separator +
- "Pcd" + File.separator +
- "PcdDatabaseDxeDefinitions.sample");
- FileReader reader = new FileReader(file);
- BufferedReader in = new BufferedReader(reader);
- String str;
- while ((str = in.readLine()) != null) {
- retStr = retStr +"\r\n" + str;
- }
- } catch (Exception ex) {
- throw new EntityException("Fatal error when generating PcdDatabase Dxe Definitions!");
- }
+
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " DXE_PCD_DATABASE_INIT Init;\r\n";
+ retStr += " DXE_PCD_DATABASE_UNINIT Uninit;\r\n";
+ retStr += "} DXE_PCD_DATABASE;\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " PEI_PCD_DATABASE PeiDb;\r\n";
+ retStr += " DXE_PCD_DATABASE DxeDb;\r\n";
+ retStr += "} PCD_DATABASE;\r\n";
+ retStr += "\r\n";
+ retStr += "#define DXE_NEX_TOKEN_NUMBER (DXE_LOCAL_TOKEN_NUMBER - DXE_EX_TOKEN_NUMBER)\r\n";
+ retStr += "\r\n";
+ retStr += "#define PCD_TOTAL_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)\r\n";
+ retStr += "\r\n";
+ retStr += "\r\n";
return retStr;
}
@@ -1518,22 +1573,16 @@ public class PcdDatabase {
public static String getPcdPeiDatabaseDefinitions ()
throws EntityException {
- String retStr = "";
- try {
- File file = new File(GlobalData.getWorkspacePath() + File.separator +
- "Tools" + File.separator +
- "Conf" + File.separator +
- "Pcd" + File.separator +
- "PcdDatabasePeiDefinitions.sample");
- FileReader reader = new FileReader(file);
- BufferedReader in = new BufferedReader(reader);
- String str;
- while ((str = in.readLine()) != null) {
- retStr = retStr +"\r\n" + str;
- }
- } catch (Exception ex) {
- throw new EntityException("Fatal error when generating PcdDatabase Pei Definitions!");
- }
+ String retStr = "";
+
+ retStr += "\r\n";
+ retStr += "typedef struct {\r\n";
+ retStr += " PEI_PCD_DATABASE_INIT Init;\r\n";
+ retStr += " PEI_PCD_DATABASE_UNINIT Uninit;\r\n";
+ retStr += "} PEI_PCD_DATABASE;\r\n";
+ retStr += "\r\n";
+ retStr += "#define PEI_NEX_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER - PEI_EX_TOKEN_NUMBER)\r\n";
+ retStr += "\r\n";
return retStr;
}