]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Source/GenBuild/org/tianocore/build/pcd/entity/MemoryDatabaseManager.java
Remove a private class to remove the error message.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / pcd / entity / MemoryDatabaseManager.java
index 6f4f8949ef06a7bc3bb78b5b2057ac21c2ddc428..7b22b271f9e5b09f13279913fadbbc66cecd423d 100644 (file)
@@ -20,7 +20,10 @@ import java.io.File;
 import java.io.FileWriter;\r
 import java.io.IOException;\r
 import java.util.ArrayList;\r
+import java.util.Collections;\r
+import java.util.Comparator;\r
 import java.util.HashMap;\r
+import java.util.Hashtable;\r
 import java.util.List;\r
 import java.util.Map;\r
 \r
@@ -40,6 +43,11 @@ public class MemoryDatabaseManager {
     ///\r
     private static String              logFileName    = null;\r
 \r
+    public static String PcdPeimHString       = "";\r
+               public static String PcdPeimCString                             = "";\r
+    public static String PcdDxeHString                         = "";\r
+    public static String PcdDxeCString                         = "";\r
+\r
     /**\r
       Constructure function\r
     **/\r
@@ -135,7 +143,81 @@ public class MemoryDatabaseManager {
         return tokenArray;\r
     }\r
 \r
+\r
+    private ArrayList getDynamicRecordArray() {\r
+        Token[]     tokenArray  =   getRecordArray();\r
+        int         index       =   0;\r
+        int         count       =   0;\r
+        ArrayList   al          =   new ArrayList();\r
+\r
+        for (index = 0; index < tokenArray.length; index++) {\r
+            if (tokenArray[index].pcdType == Token.PCD_TYPE.DYNAMIC ||\r
+                tokenArray[index].pcdType == Token.PCD_TYPE.DYNAMIC_EX) {\r
+                al.add(tokenArray[index]);\r
+            }\r
+        }\r
+\r
+        return al;\r
+    }\r
+\r
+\r
     /**\r
+      Get the token record array contained all PCD token referenced by PEI phase.\r
+          The output array is sorted based on descending order of the size of alignment for each feilds.\r
+\r
+      @return the token record array contained all PCD token referenced in PEI phase.\r
+    **/\r
+    public void getTwoPhaseDynamicRecordArray(ArrayList<Token> pei, ArrayList<Token> dxe) {\r
+        int                     usageInstanceIndex  =   0;\r
+        int                     index               =   0;\r
+        ArrayList               tokenArrayList      =   getDynamicRecordArray();\r
+        List<UsageInstance>     usageInstanceArray  =   null;\r
+        UsageInstance           usageInstance       =   null;\r
+\r
+                               //pei = new ArrayList<Token>();\r
+                               //dxe = new ArrayList<Token>();\r
+\r
+        for (index = 0; index < tokenArrayList.size(); index++) {\r
+            boolean found   =   false;\r
+            Token       token = (Token) tokenArrayList.get(index);\r
+            if (token.producers != null) {\r
+                usageInstanceArray = token.producers;\r
+                for (usageInstanceIndex = 0; usageInstanceIndex < usageInstanceArray.size(); usageInstanceIndex++) {\r
+                    usageInstance = (UsageInstance) usageInstanceArray.get(usageInstanceIndex);\r
+                    if (CommonDefinition.isPeiPhaseComponent(usageInstance.componentType)) {\r
+                        pei.add(token);\r
+                        found = true;\r
+                        break;\r
+                    }\r
+                }\r
+\r
+            }\r
+            if (!found) {\r
+                if (token.consumers != null) {\r
+                    usageInstanceArray = token.consumers;\r
+                    for (usageInstanceIndex = 0; usageInstanceIndex < usageInstanceArray.size(); usageInstanceIndex ++) {\r
+                        usageInstance =(UsageInstance) usageInstanceArray.get(usageInstanceIndex);\r
+                        if (CommonDefinition.isPeiPhaseComponent(usageInstance.componentType)) {\r
+                            pei.add(token);\r
+                                                                                                               found = true;\r
+                            break;\r
+                        }\r
+                    }\r
+                }\r
+            }\r
+\r
+                                               //\r
+                                               // If no PEI components reference the PCD entry, we insert it to DXE list\r
+                                               //\r
+                                               if (!found) {\r
+                                                               dxe.add(token);\r
+                                               }\r
+        }\r
+\r
+                               return;\r
+    }\r
+\r
+               /**\r
       Get all PCD record for a module according to module's name.\r
      \r
       @param moduleName  the name of module.\r