Embeded autogenerated code in Java code instead of getting them from a real file.
authorqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Aug 2006 10:51:01 +0000 (10:51 +0000)
committerqwang12 <qwang12@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 16 Aug 2006 10:51:01 +0000 (10:51 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1294 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/GenBuild/org/tianocore/build/pcd/action/PcdDatabase.java

index 0460efd..9f90ba7 100644 (file)
@@ -13,9 +13,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 **/\r
 package org.tianocore.build.pcd.action;\r
 \r
-import java.io.BufferedReader;\r
 import java.io.File;\r
-import java.io.FileReader;\r
 import java.util.ArrayList;\r
 import java.util.Comparator;\r
 import java.util.HashMap;\r
@@ -1469,48 +1467,105 @@ public class PcdDatabase {
         return s;\r
     }\r
 \r
-    public static String getPcdDatabaseCommonDefinitions ()\r
-        throws EntityException {\r
-\r
-        String retStr = "";\r
-        try {\r
-            File file = new File(GlobalData.getWorkspacePath() + File.separator +\r
-                                 "Tools" + File.separator +\r
-                                 "Conf" + File.separator +\r
-                                 "Pcd" + File.separator +\r
-                                 "PcdDatabaseCommonDefinitions.sample");\r
-            FileReader reader = new FileReader(file);\r
-            BufferedReader  in = new BufferedReader(reader);\r
-            String str;\r
-            while ((str = in.readLine()) != null) {\r
-                retStr = retStr +"\r\n" + str;\r
-            }\r
-        } catch (Exception ex) {\r
-            throw new EntityException("Fatal error when generating PcdDatabase Common Definitions!");\r
-        }\r
-\r
-        return retStr;\r
+    public static String getPcdDatabaseCommonDefinitions () {\r
+\r
+               String retStr;\r
+\r
+               retStr  = "//\r\n";\r
+               retStr += "// The following definition will be generated by build tool\r\n";\r
+               retStr += "//\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "//\r\n";\r
+               retStr += "// Common definitions\r\n";\r
+               retStr += "//\r\n";\r
+               retStr += "typedef UINT8 SKU_ID;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_TYPE_SHIFT        28\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_TYPE_DATA         (0x0 << PCD_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_TYPE_HII             (0x8 << PCD_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_TYPE_VPD             (0x4 << PCD_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_TYPE_SKU_ENABLED         (0x2 << PCD_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_TYPE_STRING       (0x1 << PCD_TYPE_SHIFT)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_TYPE_ALL_SET      (PCD_TYPE_DATA | PCD_TYPE_HII | PCD_TYPE_VPD | PCD_TYPE_SKU_ENABLED | PCD_TYPE_STRING)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_SHIFT  24\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_POINTER        (0x0 << PCD_DATUM_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_UINT8          (0x1 << PCD_DATUM_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_UINT16            (0x2 << PCD_DATUM_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_UINT32            (0x4 << PCD_DATUM_TYPE_SHIFT)\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_UINT64                (0x8 << PCD_DATUM_TYPE_SHIFT)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_DATUM_TYPE_ALL_SET    (PCD_DATUM_TYPE_POINTER | \\\r\n";\r
+               retStr += "                                    PCD_DATUM_TYPE_UINT8  | \\\r\n";\r
+               retStr += "                                    PCD_DATUM_TYPE_UINT16 | \\\r\n";\r
+               retStr += "                                    PCD_DATUM_TYPE_UINT32 | \\\r\n";\r
+               retStr += "                                    PCD_DATUM_TYPE_UINT64)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_DATABASE_OFFSET_MASK (~(PCD_TYPE_ALL_SET | PCD_DATUM_TYPE_ALL_SET))\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef struct  {\r\n";\r
+               retStr += "  UINT32                ExTokenNumber;\r\n";\r
+               retStr += "  UINT16                LocalTokenNumber;   // PCD Number of this particular platform build\r\n";\r
+               retStr += "  UINT16                ExGuidIndex;        // Index of GuidTable\r\n";\r
+               retStr += "} DYNAMICEX_MAPPING;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef struct {\r\n";\r
+               retStr += "  UINT32  SkuDataStartOffset; //We have to use offsetof MACRO as we don't know padding done by compiler\r\n";\r
+               retStr += "  UINT32  SkuIdTableOffset;   //Offset from the PCD_DB\r\n";\r
+               retStr += "} SKU_HEAD;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef struct {\r\n";\r
+               retStr += "  UINT16  GuidTableIndex;     // Offset in Guid Table in units of GUID.\r\n";\r
+               retStr += "  UINT16  StringIndex;        // Offset in String Table in units of UINT16.\r\n";\r
+               retStr += "  UINT16  Offset;             // Offset in Variable\r\n";\r
+               retStr += "  UINT16  DefaultValueOffset; // Offset of the Default Value\r\n";\r
+               retStr += "} VARIABLE_HEAD  ;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef  struct {\r\n";\r
+               retStr += "  UINT32  Offset;\r\n";\r
+               retStr += "} VPD_HEAD;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef UINT16 STRING_HEAD;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef UINT16 SIZE_INFO;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define offsetof(s,m)                 (UINT32) (UINTN) &(((s *)0)->m)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               \r
+               return retStr;\r
     }\r
 \r
     public static String getPcdDxeDatabaseDefinitions ()\r
         throws EntityException {\r
 \r
         String retStr = "";\r
-        try {\r
-            File file = new File(GlobalData.getWorkspacePath() + File.separator +\r
-                                 "Tools" + File.separator +\r
-                                 "Conf" + File.separator +\r
-                                 "Pcd" + File.separator +\r
-                                 "PcdDatabaseDxeDefinitions.sample");\r
-            FileReader reader = new FileReader(file);\r
-            BufferedReader  in = new BufferedReader(reader);\r
-            String str;\r
-            while ((str = in.readLine()) != null) {\r
-                retStr = retStr +"\r\n" + str;\r
-            }\r
-        } catch (Exception ex) {\r
-            throw new EntityException("Fatal error when generating PcdDatabase Dxe Definitions!");\r
-        }\r
+               \r
+               retStr += "\r\n";\r
+               retStr += "typedef struct {\r\n";\r
+               retStr += "  DXE_PCD_DATABASE_INIT Init;\r\n";\r
+               retStr += "  DXE_PCD_DATABASE_UNINIT Uninit;\r\n";\r
+               retStr += "} DXE_PCD_DATABASE;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "typedef struct {\r\n";\r
+               retStr += "  PEI_PCD_DATABASE PeiDb;\r\n";\r
+               retStr += "  DXE_PCD_DATABASE DxeDb;\r\n";\r
+               retStr += "} PCD_DATABASE;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define DXE_NEX_TOKEN_NUMBER (DXE_LOCAL_TOKEN_NUMBER - DXE_EX_TOKEN_NUMBER)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PCD_TOTAL_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER + DXE_LOCAL_TOKEN_NUMBER)\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "\r\n";\r
 \r
         return retStr;\r
     }\r
@@ -1518,22 +1573,16 @@ public class PcdDatabase {
     public static String getPcdPeiDatabaseDefinitions ()\r
         throws EntityException {\r
 \r
-        String retStr = "";\r
-        try {\r
-            File file = new File(GlobalData.getWorkspacePath() + File.separator +\r
-                                 "Tools" + File.separator +\r
-                                 "Conf" + File.separator +\r
-                                 "Pcd" + File.separator +\r
-                                 "PcdDatabasePeiDefinitions.sample");\r
-            FileReader reader = new FileReader(file);\r
-            BufferedReader  in = new BufferedReader(reader);\r
-            String str;\r
-            while ((str = in.readLine()) != null) {\r
-                retStr = retStr +"\r\n" + str;\r
-            }\r
-        } catch (Exception ex) {\r
-            throw new EntityException("Fatal error when generating PcdDatabase Pei Definitions!");\r
-        }\r
+               String retStr = "";\r
+               \r
+               retStr += "\r\n";\r
+               retStr += "typedef struct {\r\n";\r
+               retStr += "  PEI_PCD_DATABASE_INIT Init;\r\n";\r
+               retStr += "  PEI_PCD_DATABASE_UNINIT Uninit;\r\n";\r
+               retStr += "} PEI_PCD_DATABASE;\r\n";\r
+               retStr += "\r\n";\r
+               retStr += "#define PEI_NEX_TOKEN_NUMBER (PEI_LOCAL_TOKEN_NUMBER - PEI_EX_TOKEN_NUMBER)\r\n";\r
+               retStr += "\r\n";\r
 \r
         return retStr;\r
     }\r