Fixed EDKT532 and EDKT533
authorjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 12 Mar 2007 06:57:33 +0000 (06:57 +0000)
committerjwang36 <jwang36@6f19259b-4bc3-4df7-8a09-765794883524>
Mon, 12 Mar 2007 06:57:33 +0000 (06:57 +0000)
- Support GUID CName in <Events>, <SystemTables>, <DataHubs>, <HiiPackages>, <Hobs> in msa file
- Support auto-insert related header file of DebugLib and UefiBootServicesTableLib according to module type

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2440 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
Tools/Java/Source/GenBuild/org/tianocore/build/global/GlobalData.java
Tools/Java/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java

index 7953f5c..e3e6ff5 100644 (file)
@@ -82,22 +82,10 @@ public class AutoGen {
     private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;\r
 \r
     ///\r
-    /// The protocl list which records in module or library surface area and\r
-    /// it's dependence on library instance surface area.\r
+    /// The Guid CName list which recoreded in module or library surface area \r
+    /// and it's dependence on library instance surface area.\r
     ///\r
-    private Set<String> mProtocolList = new HashSet<String>();\r
-\r
-    ///\r
-    /// The Ppi list which recorded in module or library surface area and its\r
-    /// dependency on library instance surface area.\r
-    ///\r
-    private Set<String> mPpiList = new HashSet<String>();\r
-\r
-    ///\r
-    /// The Guid list which recoreded in module or library surface area and it's\r
-    /// dependence on library instance surface area.\r
-    ///\r
-    private Set<String> mGuidList = new HashSet<String>();\r
+    private Set<String> mGuidCNameList = new HashSet<String>();\r
 \r
     ///\r
     /// The dependence package list which recoreded in module or library surface\r
@@ -348,23 +336,37 @@ public class AutoGen {
         //\r
         // Write library class's related *.h file to autogen.h.\r
         //\r
+        List<String> libClasses = new ArrayList<String>(100);\r
         String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
-        if (libClassList.length > 0) {\r
-            libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
-            item = libClassIncludeH.iterator();\r
-            while (item.hasNext()) {\r
-                fileBuffer.append(item.next().toString());\r
-            }\r
+        for (int i = 0; i < libClassList.length; ++i) {\r
+            libClasses.add(libClassList[i]);\r
         }\r
 \r
         libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
-        if (libClassList.length > 0) {\r
-            libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
-            item = libClassIncludeH.iterator();\r
-            while (item.hasNext()) {\r
-                fileBuffer.append(item.next().toString());\r
+        for (int i = 0; i < libClassList.length; ++i) {\r
+            libClasses.add(libClassList[i]);\r
+        }\r
+        //\r
+        // Add AutoGen used library class\r
+        // \r
+        int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
+        if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
+            && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
+            libClasses.add("DebugLib");\r
+        }\r
+        switch (moduleTypeId) {\r
+        case CommonDefinition.ModuleTypeDxeDriver:\r
+        case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+        case CommonDefinition.ModuleTypeDxeSalDriver:\r
+        case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+        case CommonDefinition.ModuleTypeUefiDriver:\r
+        case CommonDefinition.ModuleTypeUefiApplication:\r
+            if (!libClasses.contains("UefiBootServicesTableLib")) {\r
+                libClasses.add("UefiBootServicesTableLib");\r
             }\r
+            break;\r
         }\r
+        LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
         fileBuffer.append("\r\n");\r
 \r
         //\r
@@ -458,8 +460,10 @@ public class AutoGen {
         //\r
         String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());\r
         if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+            globalDeclarations.append("extern GUID gEfiCallerIdGuid;\r\n");\r
             fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");\r
-        } else {\r
+        } else if (!this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_USER_DEFINED)) {\r
+            globalDeclarations.append("extern EFI_GUID gEfiCallerIdGuid;\r\n");\r
             fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");\r
         }\r
 \r
@@ -496,11 +500,9 @@ public class AutoGen {
         }\r
 \r
         //\r
-        // Write consumed ppi, guid, protocol to autogen.c\r
+        // Write consumed ppi, guid, protocol, etc to autogen.c\r
         //\r
-        ProtocolGuidToAutogenC(fileBuffer);\r
-        PpiGuidToAutogenC(fileBuffer);\r
-        GuidGuidToAutogenC(fileBuffer);\r
+        CNameToAutogenC(fileBuffer);\r
 \r
         //\r
         // Call pcd autogen.\r
@@ -586,23 +588,37 @@ public class AutoGen {
         //\r
         // Write library class's related *.h file to autogen.h\r
         //\r
+        List<String> libClasses = new ArrayList<String>(100);\r
         String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
-        if (libClassList != null) {\r
-            libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
-            item = libClassIncludeH.iterator();\r
-            while (item.hasNext()) {\r
-                fileBuffer.append(item.next().toString());\r
-            }\r
+        for (int i = 0; i < libClassList.length; ++i) {\r
+            libClasses.add(libClassList[i]);\r
         }\r
 \r
         libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
-        if (libClassList != null) {\r
-            libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
-            item = libClassIncludeH.iterator();\r
-            while (item.hasNext()) {\r
-                fileBuffer.append(item.next().toString());\r
+        for (int i = 0; i < libClassList.length; ++i) {\r
+            libClasses.add(libClassList[i]);\r
+        }\r
+        //\r
+        // Add AutoGen used library class\r
+        // \r
+        int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
+        if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
+            && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
+            libClasses.add("DebugLib");\r
+        }\r
+        switch (moduleTypeId) {\r
+        case CommonDefinition.ModuleTypeDxeDriver:\r
+        case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+        case CommonDefinition.ModuleTypeDxeSalDriver:\r
+        case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+        case CommonDefinition.ModuleTypeUefiDriver:\r
+        case CommonDefinition.ModuleTypeUefiApplication:\r
+            if (!libClasses.contains("UefiBootServicesTableLib")) {\r
+                libClasses.add("UefiBootServicesTableLib");\r
             }\r
+            break;\r
         }\r
+        LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
         fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
 \r
         //\r
@@ -688,9 +704,8 @@ public class AutoGen {
                  build module or library.\r
       @return includeStrList List of *.h file.\r
     **/\r
-    Set<String> LibraryClassToAutogenH(String[] libClassList)\r
+    void LibraryClassToAutogenH(StringBuffer fileBuffer, String[] libClassList)\r
     throws EdkException {\r
-        Set<String> includeStrList = new LinkedHashSet<String>();\r
         String includeName[];\r
         String str = "";\r
 \r
@@ -709,14 +724,14 @@ public class AutoGen {
             for (int j = 0; j < includeName.length; j++) {\r
                 String includeNameStr = includeName[j];\r
                 if (includeNameStr != null) {\r
-                    str = CommonDefinition.INCLUDE + " " + "<";\r
-                    str = str + includeNameStr + ">\r\n";\r
-                    includeStrList.add(str);\r
+                    fileBuffer.append(CommonDefinition.INCLUDE);\r
+                    fileBuffer.append(" <");\r
+                    fileBuffer.append(includeNameStr);\r
+                    fileBuffer.append(">\r\n");\r
                     includeNameStr = null;\r
                 }\r
             }\r
         }\r
-        return includeStrList;\r
     }\r
 \r
     /**\r
@@ -1185,153 +1200,50 @@ public class AutoGen {
     }\r
 \r
     /**\r
-      PpiGuidToAutogenc\r
-     \r
-      This function gets GUIDs from SPD file accrodeing to <PPIs> information\r
-      and write those GUIDs to AutoGen.c.\r
-     \r
-      @param fileBuffer\r
-                 String Buffer for Autogen.c file.\r
-      @throws BuildException\r
-                  Guid must set value!\r
-    **/\r
-    void PpiGuidToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
-        String[] cNameGuid = null;\r
-\r
-        //\r
-        // Get the all PPI adn PPI Notify from MSA file,\r
-        // then add those PPI ,and PPI Notify name to list.\r
-        //\r
-\r
-        String[] ppiList = saq.getPpiArray(this.arch);\r
-        for (int i = 0; i < ppiList.length; i++) {\r
-            this.mPpiList.add(ppiList[i]);\r
-        }\r
-\r
-        String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
-        for (int i = 0; i < ppiNotifyList.length; i++) {\r
-            this.mPpiList.add(ppiNotifyList[i]);\r
-        }\r
-\r
-        //\r
-        // Find CNAME and GUID from dependence SPD file and write to Autogen.c\r
-        //\r
-        Iterator ppiIterator = this.mPpiList.iterator();\r
-        String ppiKeyWord = null;\r
-        while (ppiIterator.hasNext()) {\r
-            ppiKeyWord = ppiIterator.next().toString();\r
-            cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, ppiKeyWord);\r
-            if (cNameGuid != null) {\r
-                fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
-                fileBuffer.append(cNameGuid[0]);\r
-                fileBuffer.append(" =     { ");\r
-                fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
-                fileBuffer.append(" } ;");\r
-            } else {\r
-                //\r
-                // If can't find Ppi GUID declaration in every package\r
-                //\r
-                throw new AutoGenException("Can not find Ppi GUID ["\r
-                                           + ppiKeyWord + "] declaration in any SPD package!");\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-      ProtocolGuidToAutogenc\r
+      CNameToAutogenc\r
      \r
-      This function gets GUIDs from SPD file accrodeing to <Protocol>\r
-      information and write those GUIDs to AutoGen.c.\r
-     \r
-      @param fileBuffer\r
-                 String Buffer for Autogen.c file.\r
-      @throws BuildException\r
-                  Protocol name must set.\r
-    **/\r
-    void ProtocolGuidToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
-        String[] cNameGuid = null;\r
-\r
-        String[] protocolList = saq.getProtocolArray(this.arch);\r
-\r
-        //\r
-        // Add result to Autogen global list.\r
-        //\r
-        for (int i = 0; i < protocolList.length; i++) {\r
-            this.mProtocolList.add(protocolList[i]);\r
-        }\r
-\r
-        String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
-\r
-        for (int i = 0; i < protocolNotifyList.length; i++) {\r
-            this.mProtocolList.add(protocolNotifyList[i]);\r
-        }\r
-\r
-        //\r
-        // Get the NAME and GUID from dependence SPD and write to Autogen.c\r
-        //\r
-        Iterator protocolIterator = this.mProtocolList.iterator();\r
-        String protocolKeyWord = null;\r
-\r
-\r
-        while (protocolIterator.hasNext()) {\r
-            protocolKeyWord = protocolIterator.next().toString();\r
-            cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, protocolKeyWord);\r
-            if (cNameGuid != null) {\r
-                fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
-                fileBuffer.append(cNameGuid[0]);\r
-                fileBuffer.append(" =     { ");\r
-                fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
-                fileBuffer.append(" } ;");\r
-            } else {\r
-                //\r
-                // If can't find protocol GUID declaration in every package\r
-                //\r
-                throw new AutoGenException("Can not find protocol Guid ["\r
-                                           + protocolKeyWord + "] declaration in any SPD package!");\r
-            }\r
-        }\r
-    }\r
-\r
-    /**\r
-      GuidGuidToAutogenc\r
-     \r
-      This function gets GUIDs from SPD file accrodeing to <Guids> information\r
-      and write those GUIDs to AutoGen.c.\r
+      This function gets GUIDs from SPD file accrodeing to <Protocols> <Ppis> \r
+      <Guids> information and write those GUIDs to AutoGen.c.\r
      \r
       @param fileBuffer\r
                  String Buffer for Autogen.c file.\r
      \r
     **/\r
-    void GuidGuidToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
+    void CNameToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
         String[] cNameGuid = null;\r
         String guidKeyWord = null;\r
 \r
-        String[] guidList = saq.getGuidEntryArray(this.arch);\r
-\r
-        for (int i = 0; i < guidList.length; i++) {\r
-            this.mGuidList.add(guidList[i]);\r
+        String[] cnameList = saq.getCNameArray(this.arch);\r
+        for (int i = 0; i < cnameList.length; i++) {\r
+            this.mGuidCNameList.add(cnameList[i]);\r
         }\r
 \r
 \r
-        Iterator guidIterator = this.mGuidList.iterator();\r
+        Iterator guidIterator = this.mGuidCNameList.iterator();\r
         while (guidIterator.hasNext()) {\r
             guidKeyWord = guidIterator.next().toString();\r
             cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);\r
-\r
-            if (cNameGuid != null) {\r
-                fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
-                fileBuffer.append(cNameGuid[0]);\r
-                fileBuffer.append(" =     { ");\r
-                fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
-                fileBuffer.append("} ;");\r
-            } else {\r
-                //\r
-                // If can't find GUID declaration in every package\r
-                //\r
-                throw new AutoGenException("Can not find Guid [" + guidKeyWord\r
-                                           + "] declaration in any SPD package. ");\r
+            if (cNameGuid == null) {\r
+                cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, guidKeyWord);\r
+                if (cNameGuid == null) {\r
+                    cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, guidKeyWord);\r
+                    if (cNameGuid == null) {\r
+                        //\r
+                        // If can't find GUID declaration in every package, stop the build\r
+                        //\r
+                        EdkLog.log(EdkLog.EDK_INFO,"WARN: Can not find Guid [" + guidKeyWord + "] declaration in any SPD file.");\r
+                        continue;\r
+                        //throw new AutoGenException("Can not find Guid [" + guidKeyWord\r
+                        //                           + "] declaration in any SPD package. ");\r
+                    }\r
+                }\r
             }\r
 \r
+            fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
+            fileBuffer.append(cNameGuid[0]);\r
+            fileBuffer.append(" =     { ");\r
+            fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
+            fileBuffer.append("} ;");\r
         }\r
     }\r
 \r
@@ -2144,14 +2056,10 @@ public class AutoGen {
                                        + " doesn't support module type " + moduleType);\r
             }\r
             //\r
-            // Get <PPis>, <Protocols>, <Guids> list of this library\r
+            // Get CName list from <PPis>, <Protocols>, <Guids>, etc. of this library\r
             // instance.\r
             //\r
-            String[] ppiList = saq.getPpiArray(this.arch);\r
-            String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
-            String[] protocolList = saq.getProtocolArray(this.arch);\r
-            String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
-            String[] guidList = saq.getGuidEntryArray(this.arch);\r
+            String[] guidCNameList = saq.getCNameArray(this.arch);            \r
             PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
 \r
             //\r
@@ -2159,25 +2067,10 @@ public class AutoGen {
             // protocol, guid\r
             // list.\r
             //\r
-            for (index = 0; index < ppiList.length; index++) {\r
-                this.mPpiList.add(ppiList[index]);\r
-            }\r
-\r
-            for (index = 0; index < ppiNotifyList.length; index++) {\r
-                this.mPpiList.add(ppiNotifyList[index]);\r
-            }\r
-\r
-            for (index = 0; index < protocolList.length; index++) {\r
-                this.mProtocolList.add(protocolList[index]);\r
+            for (index = 0; index < guidCNameList.length; index++) {\r
+                this.mGuidCNameList.add(guidCNameList[index]);\r
             }\r
 \r
-            for (index = 0; index < protocolNotifyList.length; index++) {\r
-                this.mProtocolList.add(protocolNotifyList[index]);\r
-            }\r
-\r
-            for (index = 0; index < guidList.length; index++) {\r
-                this.mGuidList.add(guidList[index]);\r
-            }\r
             for (index = 0; index < pkgList.length; index++) {\r
                 if (!this.mDepPkgList.contains(pkgList[index])) {\r
                     this.mDepPkgList.add(pkgList[index]);\r
index f941f4d..b5605d4 100644 (file)
@@ -434,6 +434,12 @@ public class GlobalData {
             msaMap.put("Protocols", cloneXmlObject(msa.getProtocols(), true));\r
             msaMap.put("PPIs", cloneXmlObject(msa.getPPIs(), true));\r
             msaMap.put("Guids", cloneXmlObject(msa.getGuids(), true));\r
+            msaMap.put("Events", cloneXmlObject(msa.getEvents(), true));\r
+            msaMap.put("Hobs", cloneXmlObject(msa.getHobs(), true));\r
+            msaMap.put("Variables", cloneXmlObject(msa.getVariables(), true));\r
+            msaMap.put("SystemTables", cloneXmlObject(msa.getSystemTables(), true));\r
+            msaMap.put("DataHubs", cloneXmlObject(msa.getDataHubs(), true));\r
+            msaMap.put("HiiPackages", cloneXmlObject(msa.getHiiPackages(), true));\r
             msaMap.put("Externs", cloneXmlObject(msa.getExterns(), true));\r
             msaMap.put("PcdCoded", cloneXmlObject(msa.getPcdCoded(), true));\r
             msaMap.put("ModuleBuildOptions", cloneXmlObject(msa.getModuleBuildOptions(), true));\r
index 933b5d4..acd8182 100644 (file)
@@ -1088,7 +1088,7 @@ public class SurfaceAreaQuery {
                 usageXpath = "/GuidEntry[@Usage='" + arch + "']";\r
                 xPath = new String[] { archXpath, usageXpath };\r
             } else {\r
-                return getProtocolNotifyArray(arch);\r
+                return getGuidEntryArray(arch);\r
             }\r
         }\r
 \r
@@ -1105,6 +1105,234 @@ public class SurfaceAreaQuery {
         return guidList;\r
     }\r
 \r
+    public String[] getEventCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{\r
+                "/CreateEvents/EventTypes[@EventGuidCName]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName]",\r
+            };\r
+        } else {\r
+            xPath = new String[]{\r
+                "/CreateEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName and not(@SupArchList)]",\r
+                "/CreateEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+                "/SignalEvents/EventTypes[@EventGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("Events", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            if (returns[i] instanceof EventsDocument.Events.CreateEvents.EventTypes) {\r
+                cnameList[i] = ((EventsDocument.Events.CreateEvents.EventTypes) returns[i]).getEventGuidCName();\r
+            } else {\r
+                cnameList[i] = ((EventsDocument.Events.SignalEvents.EventTypes) returns[i]).getEventGuidCName();\r
+            }\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getHobCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/HobTypes[@HobGuidCName]"};\r
+        } else {\r
+            xPath = new String[]{\r
+                "/HobTypes[@HobGuidCName and not(@SupArchList)]",\r
+                "/HobTypes[@HobGuidCName and contains(@SupArchList,'" + arch + "')]",\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("Hobs", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((HobsDocument.Hobs.HobTypes) returns[i]).getHobGuidCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getVariableCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/Variable"};\r
+        } else {\r
+            xPath = new String[]{"/Variable[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("Variables", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((VariablesDocument.Variables.Variable) returns[i]).getGuidCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getSystemTableCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/SystemTableCNames"};\r
+        } else {\r
+            xPath = new String[]{\r
+                "/SystemTableCNames[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"\r
+            };\r
+        }\r
+\r
+        Object[] returns = get("SystemTables", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((SystemTablesDocument.SystemTables.SystemTableCNames) returns[i]).getSystemTableCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getDataHubCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/DataHubRecord"};\r
+        } else {\r
+            xPath = new String[]{"/DataHubRecord[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("DataHubs", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((DataHubsDocument.DataHubs.DataHubRecord) returns[i]).getDataHubCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getHiiPackageCNameArray(String arch) {\r
+        String[] xPath = null;\r
+\r
+        if (arch == null || arch.equals("")) {\r
+            xPath = new String[]{"/HiiPackage"};\r
+        } else {\r
+            xPath = new String[]{"/HiiPackage[not(@SupArchList) or contains(@SupArchList,'" + arch + "')]"};\r
+        }\r
+\r
+        Object[] returns = get("HiiPackages", xPath);\r
+        if (returns == null) {\r
+            return new String[0];\r
+        }\r
+\r
+        String[] cnameList = new String[returns.length];\r
+        for (int i = 0; i < returns.length; i++) {\r
+            cnameList[i] = ((HiiPackagesDocument.HiiPackages.HiiPackage) returns[i]).getHiiCName();\r
+        }\r
+        return cnameList;\r
+    }\r
+\r
+    public String[] getCNameArray(String arch) {\r
+        List<String> cnameList = new ArrayList<String>(100);\r
+        String[] result = null;\r
+        // \r
+        // "/Guids/GuidCNames/GuidCName",\r
+        // \r
+        result = getGuidEntryArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Protocols/Protocol/ProtocolCName",\r
+        // \r
+        result = getProtocolArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        //  "/Protocols/ProtocolNotify/ProtocolNotifyCName",\r
+        // \r
+        result = getProtocolNotifyArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Events/CreateEvents/EventTypes[@EventGuidCName]",\r
+        // "/Events/SignalEvents/EventTypes[@EventGuidCName]",\r
+        // \r
+        result = getEventCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        // "/Hobs/HobTypes[@HobGuidCName]",\r
+        // \r
+        result = getHobCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/PPIs/Ppi/PpiCName",\r
+        //\r
+        result = getPpiArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/PPIs/PpiNotify/PpiNotifyCName",\r
+        // \r
+        result = getPpiNotifyArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/Variables/Variable/GuidC_Name",\r
+        // \r
+        result = getVariableCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        // \r
+        // "/SystemTables/SystemTableCNames/SystemTableCName",\r
+        // \r
+        result = getSystemTableCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        //  "/DataHubs/DataHubRecord/DataHubCName",\r
+        // \r
+        result = getDataHubCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+        //\r
+        // "/HiiPackages/HiiPackage/HiiCName",\r
+        // \r
+        result = getHiiPackageCNameArray(arch);\r
+        for (int i = 0; i < result.length; ++i) {\r
+            cnameList.add(result[i]);\r
+        }\r
+\r
+        return cnameList.toArray(new String[cnameList.size()]);\r
+    }\r
+\r
     /**\r
      * Retrieve Library instance information\r
      *\r