Fixed EDKT469
authorqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 14 Nov 2006 09:03:19 +0000 (09:03 +0000)
committerqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 14 Nov 2006 09:03:19 +0000 (09:03 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1951 6f19259b-4bc3-4df7-8a09-765794883524

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

index 3c2652e..68254e2 100644 (file)
@@ -108,7 +108,7 @@ public class AutoGen {
     ///\r
     ///  For non library module, add its library instance's construct and destructor to\r
     ///  list. String[0] recode LibConstructor name, String[1] recode Lib instance \r
-       ///  module type.\r
+    ///  module type.\r
     ///\r
     private List<String[]> libConstructList = new ArrayList<String[]>();\r
     private List<String[]> libDestructList = new ArrayList<String[]>();\r
@@ -119,6 +119,15 @@ public class AutoGen {
     private List<String> setVirtalAddList = new ArrayList<String>();\r
     private List<String> exitBootServiceList = new ArrayList<String>();\r
 \r
+    //\r
+    // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable \r
+    //\r
+    private boolean componentNamePcd = false;\r
+    private boolean driverDiagnostPcd = false;\r
+    \r
+    //\r
+    // Instance of SurfaceAreaQuery\r
+    //\r
     private SurfaceAreaQuery saq = null;\r
     \r
     private ModuleIdentification parentId = null;\r
@@ -163,22 +172,22 @@ public class AutoGen {
         \r
         File autoGenH = new File(fileName);\r
 \r
-            //\r
-            // if the file exists, compare their content\r
-            //\r
+        //\r
+        // if the file exists, compare their content\r
+        //\r
         if (autoGenH.exists()) {\r
             char[] oldFileBuffer = new char[(int) autoGenH.length()];\r
-                       try {\r
-                               FileReader fIn = new FileReader(autoGenH);\r
-                               fIn.read(oldFileBuffer, 0, (int) autoGenH.length());\r
+            try {\r
+                FileReader fIn = new FileReader(autoGenH);\r
+                fIn.read(oldFileBuffer, 0, (int) autoGenH.length());\r
                 fIn.close();\r
-                       } catch (IOException e) {\r
-                               EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
-                                                               + "'s " \r
-                                                               + fileName \r
-                                                               + " is exist, but can't be open!!");\r
-                               return false;\r
-                       }\r
+            } catch (IOException e) {\r
+                EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
+                                            + "'s " \r
+                                            + fileName \r
+                                            + " is exist, but can't be open!!");\r
+                return false;\r
+            }\r
 \r
             //\r
             // if we got the same file, don't re-generate it to prevent\r
@@ -189,18 +198,18 @@ public class AutoGen {
             }\r
         }\r
         \r
-               try {\r
-                       FileWriter fOut = new FileWriter(autoGenH);\r
+        try {\r
+            FileWriter fOut = new FileWriter(autoGenH);\r
             fOut.write(fileBuffer.toString());\r
-                       fOut.flush();\r
+            fOut.flush();\r
             fOut.close();\r
-               } catch (IOException e) {\r
-                       EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
-                                                               + "'s " \r
-                                                               + fileName \r
-                                                               + " can't be create!!");\r
-                       return false;\r
-               \r
+        } catch (IOException e) {\r
+            EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
+                                        + "'s " \r
+                                        + fileName \r
+                                        + " can't be create!!");\r
+            return false;\r
+        } \r
         return true;\r
     }\r
 \r
@@ -220,15 +229,15 @@ public class AutoGen {
         File path = new File(outputPath);\r
         path.mkdirs();\r
         \r
-               //\r
-               // Check current is library or not, then call the corresponding\r
-               // function.\r
-               //\r
-               if (this.moduleId.isLibrary()) {\r
-                       libGenAutogen();\r
-               } else {\r
-                       moduleGenAutogen();\r
-               }\r
+        //\r
+        // Check current is library or not, then call the corresponding\r
+        // function.\r
+        //\r
+        if (this.moduleId.isLibrary()) {\r
+            libGenAutogen();\r
+        } else {\r
+            moduleGenAutogen();\r
+        }\r
     }\r
 \r
     /**\r
@@ -240,9 +249,11 @@ public class AutoGen {
                   Faile to create module AutoGen.c & AutoGen.h.\r
     **/\r
     void moduleGenAutogen() throws EdkException {\r
-               collectLibInstanceInfo();\r
-               moduleGenAutogenC();\r
-               moduleGenAutogenH();\r
+       setPcdComponentName();\r
+       setPcdDriverDiagnostic();\r
+        collectLibInstanceInfo();\r
+        moduleGenAutogenC();\r
+        moduleGenAutogenH();\r
     }\r
 \r
     /**\r
@@ -254,8 +265,8 @@ public class AutoGen {
                   Faile to create library AutoGen.c & AutoGen.h\r
     **/\r
     void libGenAutogen() throws EdkException {\r
-               libGenAutogenC();\r
-               libGenAutogenH();\r
+        libGenAutogenC();\r
+        libGenAutogenH();\r
     }\r
 \r
     /**\r
@@ -285,14 +296,14 @@ public class AutoGen {
         // #def ${BseeName}_AUTOGENH\r
         //\r
         fileBuffer.append(CommonDefinition.IFNDEF \r
-                                     + CommonDefinition.AUTOGENH\r
-                                     + this.moduleId.getGuid().replaceAll("-", "_") \r
-                                     + ToolDefinitions.LINE_SEPARATOR);\r
+                                      + CommonDefinition.AUTOGENH\r
+                                      + this.moduleId.getGuid().replaceAll("-", "_") \r
+                                      + ToolDefinitions.LINE_SEPARATOR);\r
         fileBuffer.append(CommonDefinition.DEFINE \r
-                                     + CommonDefinition.AUTOGENH\r
-                                     + this.moduleId.getGuid().replaceAll("-", "_") \r
-                                     + ToolDefinitions.LINE_SEPARATOR \r
-                                     + ToolDefinitions.LINE_SEPARATOR);\r
+                                      + CommonDefinition.AUTOGENH\r
+                                      + this.moduleId.getGuid().replaceAll("-", "_") \r
+                                      + ToolDefinitions.LINE_SEPARATOR \r
+                                      + ToolDefinitions.LINE_SEPARATOR);\r
 \r
         //\r
         // Write the specification version and release version at the begine\r
@@ -430,10 +441,10 @@ public class AutoGen {
         // Write EntryPoint to autgoGen.c\r
         //\r
         String[] entryPointList = saq.getModuleEntryPointArray();\r
-               String[] unloadImageList = saq.getModuleUnloadImageArray();\r
+        String[] unloadImageList = saq.getModuleUnloadImageArray();\r
         EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), \r
-                                       CommonDefinition.remDupString(unloadImageList),\r
-                                       fileBuffer);\r
+                                        CommonDefinition.remDupString(unloadImageList),\r
+                                        fileBuffer);\r
 \r
         pcdDriverType = saq.getPcdDriverType();\r
 \r
@@ -447,12 +458,12 @@ public class AutoGen {
         //\r
         String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());\r
         if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
-                       fileBuffer\r
+                        fileBuffer\r
             .append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");\r
-               } else {\r
-                       fileBuffer\r
+                } else {\r
+                        fileBuffer\r
             .append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");\r
-               }\r
+                }\r
         \r
         if (guid == null) {\r
             throw new AutoGenException("Guid value must set!\n");\r
@@ -541,14 +552,14 @@ public class AutoGen {
         // #def ${BseeName}_AUTOGENH\r
         //\r
         fileBuffer.append(CommonDefinition.IFNDEF \r
-                                     + CommonDefinition.AUTOGENH\r
-                                     + this.moduleId.getGuid().replaceAll("-", "_") \r
-                                     + ToolDefinitions.LINE_SEPARATOR);\r
+                                      + CommonDefinition.AUTOGENH\r
+                                      + this.moduleId.getGuid().replaceAll("-", "_") \r
+                                      + ToolDefinitions.LINE_SEPARATOR);\r
         fileBuffer.append(CommonDefinition.DEFINE \r
-                                     + CommonDefinition.AUTOGENH\r
-                                     + this.moduleId.getGuid().replaceAll("-", "_") \r
-                                     + ToolDefinitions.LINE_SEPARATOR \r
-                                     + ToolDefinitions.LINE_SEPARATOR);\r
+                                      + CommonDefinition.AUTOGENH\r
+                                      + this.moduleId.getGuid().replaceAll("-", "_") \r
+                                      + ToolDefinitions.LINE_SEPARATOR \r
+                                      + ToolDefinitions.LINE_SEPARATOR);\r
 \r
         //\r
         // Write EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION\r
@@ -694,10 +705,10 @@ public class AutoGen {
         //\r
         for (int i = 0; i < libClassList.length; i++) {\r
             includeName = GlobalData.getLibraryClassHeaderFiles(\r
-                            saq.getDependencePkg(this.arch),\r
+                                                                saq.getDependencePkg(this.arch),\r
                                                                 libClassList[i]);\r
-            if (includeName == null) {\r
-                throw new AutoGenException("Can not find library class ["\r
+        if (includeName == null) {\r
+            throw new AutoGenException("Can not find library class ["\r
                                            + libClassList[i] + "] declaration in any SPD package. ");\r
             }\r
             for (int j = 0; j < includeName.length; j++) {\r
@@ -767,7 +778,7 @@ public class AutoGen {
     throws EdkException {\r
 \r
         String typeStr = saq.getModuleType();\r
-               int unloadImageCount = 0;\r
+                int unloadImageCount = 0;\r
         int entryPointCount  = 0;\r
 \r
         //\r
@@ -980,7 +991,7 @@ public class AutoGen {
             //entryPointList = CommonDefinition.remDupString(entryPointList);\r
             //entryPointCount = 0;\r
 \r
-                       unloadImageCount = 0;\r
+                        unloadImageCount = 0;\r
             if (unloadImageList != null) {\r
                 for (int i = 0; i < unloadImageList.length; i++) {\r
                     fileBuffer.append("EFI_STATUS\r\n");\r
@@ -1147,7 +1158,7 @@ public class AutoGen {
             //\r
             //entryPointList = CommonDefinition.remDupString(entryPointList);\r
             //entryPointCount = 0;\r
-                       unloadImageCount = 0;\r
+                        unloadImageCount = 0;\r
             if (unloadImageList != null) {\r
                 for (int i = 0; i < unloadImageList.length; i++) {\r
                     fileBuffer.append("EFI_STATUS\r\n");\r
@@ -1373,16 +1384,16 @@ public class AutoGen {
       @throws BuildException\r
     **/\r
     void LibInstanceToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
-               String moduleType = this.moduleId.getModuleType();\r
-               //\r
-               // Add library constructor to AutoGen.c\r
-               //\r
-               LibConstructorToAutogenC(libConstructList, moduleType,\r
-                                                                fileBuffer/* autogenC */);\r
-               //\r
-               // Add library destructor to AutoGen.c\r
-               //\r
-               LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
+                String moduleType = this.moduleId.getModuleType();\r
+                //\r
+                // Add library constructor to AutoGen.c\r
+                //\r
+                LibConstructorToAutogenC(libConstructList, moduleType,\r
+                                                                 fileBuffer/* autogenC */);\r
+                //\r
+                // Add library destructor to AutoGen.c\r
+                //\r
+                LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
     }\r
 \r
     /**\r
@@ -1408,15 +1419,15 @@ public class AutoGen {
         // module type.\r
         //\r
         for (int i = 0; i < libInstanceList.size(); i++) {\r
-                       if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
-                               fileBuffer.append("RETURN_STATUS\r\n");\r
+                        if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+                                fileBuffer.append("RETURN_STATUS\r\n");\r
                 fileBuffer.append("EFIAPI\r\n");\r
                 fileBuffer.append(libInstanceList.get(i)[0]);\r
                 fileBuffer.append(" (\r\n");\r
                 fileBuffer.append("  VOID\r\n");\r
                 fileBuffer.append("  );\r\n");\r
-                       } else {\r
-                               switch (CommonDefinition.getModuleType(moduleType)) {\r
+                        } else {\r
+                                switch (CommonDefinition.getModuleType(moduleType)) {\r
                 case CommonDefinition.ModuleTypeBase:\r
                     fileBuffer.append("RETURN_STATUS\r\n");\r
                     fileBuffer.append("EFIAPI\r\n");\r
@@ -1428,34 +1439,34 @@ public class AutoGen {
 \r
                 case CommonDefinition.ModuleTypePeiCore:\r
                 case CommonDefinition.ModuleTypePeim:\r
-                                       fileBuffer.append("EFI_STATUS\r\n");\r
-                                       fileBuffer.append("EFIAPI\r\n");\r
-                                       fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                       fileBuffer.append(" (\r\n");\r
-                                       fileBuffer\r
-                                       .append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r\n");\r
-                                       fileBuffer\r
-                                       .append("  IN EFI_PEI_SERVICES          **PeiServices\r\n");\r
-                                       fileBuffer.append("  );\r\n");\r
-                                       break;\r
-       \r
-                               case CommonDefinition.ModuleTypeDxeCore:\r
-                               case CommonDefinition.ModuleTypeDxeDriver:\r
-                               case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
-                               case CommonDefinition.ModuleTypeDxeSmmDriver:\r
-                               case CommonDefinition.ModuleTypeDxeSalDriver:\r
-                               case CommonDefinition.ModuleTypeUefiDriver:\r
-                               case CommonDefinition.ModuleTypeUefiApplication:\r
-                                       fileBuffer.append("EFI_STATUS\r\n");\r
-                                       fileBuffer.append("EFIAPI\r\n");\r
-                                       fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                       fileBuffer.append(" (\r\n");\r
-                                       fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\r\n");\r
-                                       fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\r\n");\r
-                                       fileBuffer.append("  );\r\n");\r
-                                       break;\r
-\r
-                           }\r
+                                        fileBuffer.append("EFI_STATUS\r\n");\r
+                                        fileBuffer.append("EFIAPI\r\n");\r
+                                        fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                        fileBuffer.append(" (\r\n");\r
+                                        fileBuffer\r
+                                        .append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r\n");\r
+                                        fileBuffer\r
+                                        .append("  IN EFI_PEI_SERVICES          **PeiServices\r\n");\r
+                                        fileBuffer.append("  );\r\n");\r
+                                        break;\r
+        \r
+                                case CommonDefinition.ModuleTypeDxeCore:\r
+                                case CommonDefinition.ModuleTypeDxeDriver:\r
+                                case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+                                case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+                                case CommonDefinition.ModuleTypeDxeSalDriver:\r
+                                case CommonDefinition.ModuleTypeUefiDriver:\r
+                                case CommonDefinition.ModuleTypeUefiApplication:\r
+                                        fileBuffer.append("EFI_STATUS\r\n");\r
+                                        fileBuffer.append("EFIAPI\r\n");\r
+                                        fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                        fileBuffer.append(" (\r\n");\r
+                                        fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\r\n");\r
+                                        fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\r\n");\r
+                                        fileBuffer.append("  );\r\n");\r
+                                        break;\r
+\r
+                            }\r
             }\r
         }\r
 \r
@@ -1504,37 +1515,37 @@ public class AutoGen {
                 fileBuffer.append("\r\n");\r
                 isFirst = false;\r
             }\r
-                       if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+                        if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
                 fileBuffer.append("  Status = ");\r
                 fileBuffer.append(libInstanceList.get(i)[0]);\r
                 fileBuffer.append("();\r\n");\r
-                       } else {\r
-                               switch (CommonDefinition.getModuleType(moduleType)) {\r
-                                       case CommonDefinition.ModuleTypeBase:\r
-                                               fileBuffer.append("  Status = ");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append("();\r\n");\r
-                                               break;\r
-                                       case CommonDefinition.ModuleTypePeiCore:\r
-                                       case CommonDefinition.ModuleTypePeim:\r
-                                               fileBuffer.append("  Status = ");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
-                                               break;\r
-                                       case CommonDefinition.ModuleTypeDxeCore:\r
-                                       case CommonDefinition.ModuleTypeDxeDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeSmmDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeSalDriver:\r
-                                       case CommonDefinition.ModuleTypeUefiDriver:\r
-                                       case CommonDefinition.ModuleTypeUefiApplication:\r
-                                               fileBuffer.append("  Status = ");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append(" (ImageHandle, SystemTable);\r\n");\r
-                                               break;\r
-                                       default:\r
-                                               EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!");\r
-                          }\r
+                        } else {\r
+                                switch (CommonDefinition.getModuleType(moduleType)) {\r
+                                        case CommonDefinition.ModuleTypeBase:\r
+                                                fileBuffer.append("  Status = ");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append("();\r\n");\r
+                                                break;\r
+                                        case CommonDefinition.ModuleTypePeiCore:\r
+                                        case CommonDefinition.ModuleTypePeim:\r
+                                                fileBuffer.append("  Status = ");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
+                                                break;\r
+                                        case CommonDefinition.ModuleTypeDxeCore:\r
+                                        case CommonDefinition.ModuleTypeDxeDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeSalDriver:\r
+                                        case CommonDefinition.ModuleTypeUefiDriver:\r
+                                        case CommonDefinition.ModuleTypeUefiApplication:\r
+                                                fileBuffer.append("  Status = ");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append(" (ImageHandle, SystemTable);\r\n");\r
+                                                break;\r
+                                        default:\r
+                                                EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!");\r
+                           }\r
             \r
             }\r
             fileBuffer.append("  ASSERT_EFI_ERROR (Status);\r\n");\r
@@ -1560,51 +1571,51 @@ public class AutoGen {
                                  String moduleType, StringBuffer fileBuffer) throws EdkException {\r
         boolean isFirst = true;\r
         for (int i = 0; i < libInstanceList.size(); i++) {\r
-                       if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+                        if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
                 fileBuffer.append("RETURN_STATUS\r\n");\r
                 fileBuffer.append("EFIAPI\r\n");\r
                 fileBuffer.append(libInstanceList.get(i)[0]);\r
                 fileBuffer.append(" (\r\n");\r
                 fileBuffer.append("  VOID\r\n");\r
                 fileBuffer.append("  );\r\n");\r
-                       } else {\r
-                               switch (CommonDefinition.getModuleType(moduleType)) {\r
-                                       case CommonDefinition.ModuleTypeBase:\r
-                                               fileBuffer.append("RETURN_STATUS\r\n");\r
-                                               fileBuffer.append("EFIAPI\r\n");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append(" (\r\n");\r
-                                               fileBuffer.append("  VOID\r\n");\r
-                                               fileBuffer.append("  );\r\n");\r
-                                               break;\r
-                                       case CommonDefinition.ModuleTypePeiCore:\r
-                                       case CommonDefinition.ModuleTypePeim:\r
-                                               fileBuffer.append("EFI_STATUS\r\n");\r
-                                               fileBuffer.append("EFIAPI\r\n");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append(" (\r\n");\r
-                                               fileBuffer\r
-                                               .append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r\n");\r
-                                               fileBuffer\r
-                                               .append("  IN EFI_PEI_SERVICES          **PeiServices\r\n");\r
-                                               fileBuffer.append("  );\r\n");\r
-                                               break;\r
-                                       case CommonDefinition.ModuleTypeDxeCore:\r
-                                       case CommonDefinition.ModuleTypeDxeDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeSmmDriver:\r
-                                       case CommonDefinition.ModuleTypeDxeSalDriver:\r
-                                       case CommonDefinition.ModuleTypeUefiDriver:\r
-                                       case CommonDefinition.ModuleTypeUefiApplication:\r
-                                               fileBuffer.append("EFI_STATUS\r\n");\r
-                                               fileBuffer.append("EFIAPI\r\n");\r
-                                               fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                               fileBuffer.append(" (\r\n");\r
-                                               fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\r\n");\r
-                                               fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\r\n");\r
-                                               fileBuffer.append("  );\r\n");\r
-                                               break;\r
-                           }\r
+                        } else {\r
+                                switch (CommonDefinition.getModuleType(moduleType)) {\r
+                                        case CommonDefinition.ModuleTypeBase:\r
+                                                fileBuffer.append("RETURN_STATUS\r\n");\r
+                                                fileBuffer.append("EFIAPI\r\n");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append(" (\r\n");\r
+                                                fileBuffer.append("  VOID\r\n");\r
+                                                fileBuffer.append("  );\r\n");\r
+                                                break;\r
+                                        case CommonDefinition.ModuleTypePeiCore:\r
+                                        case CommonDefinition.ModuleTypePeim:\r
+                                                fileBuffer.append("EFI_STATUS\r\n");\r
+                                                fileBuffer.append("EFIAPI\r\n");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append(" (\r\n");\r
+                                                fileBuffer\r
+                                                .append("  IN EFI_FFS_FILE_HEADER       *FfsHeader,\r\n");\r
+                                                fileBuffer\r
+                                                .append("  IN EFI_PEI_SERVICES          **PeiServices\r\n");\r
+                                                fileBuffer.append("  );\r\n");\r
+                                                break;\r
+                                        case CommonDefinition.ModuleTypeDxeCore:\r
+                                        case CommonDefinition.ModuleTypeDxeDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+                                        case CommonDefinition.ModuleTypeDxeSalDriver:\r
+                                        case CommonDefinition.ModuleTypeUefiDriver:\r
+                                        case CommonDefinition.ModuleTypeUefiApplication:\r
+                                                fileBuffer.append("EFI_STATUS\r\n");\r
+                                                fileBuffer.append("EFIAPI\r\n");\r
+                                                fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                                fileBuffer.append(" (\r\n");\r
+                                                fileBuffer.append("  IN EFI_HANDLE        ImageHandle,\r\n");\r
+                                                fileBuffer.append("  IN EFI_SYSTEM_TABLE  *SystemTable\r\n");\r
+                                                fileBuffer.append("  );\r\n");\r
+                                                break;\r
+                            }\r
             }\r
         }\r
 \r
@@ -1641,17 +1652,17 @@ public class AutoGen {
                     fileBuffer.append("\r\n");\r
                     isFirst = false;\r
                 }\r
-                               if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
+                                if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
                     fileBuffer.append("  Status = ");\r
                     fileBuffer.append(libInstanceList.get(i)[0]);\r
                     fileBuffer.append("();\r\n");\r
                     fileBuffer.append("  VOID\r\n");\r
-                               } else {\r
-                                       fileBuffer.append("  Status = ");\r
-                                       fileBuffer.append(libInstanceList.get(i)[0]);\r
-                                       fileBuffer.append("(ImageHandle, SystemTable);\r\n");\r
-                                       fileBuffer.append("  ASSERT_EFI_ERROR (Status);\r\n");\r
-                               }\r
+                                } else {\r
+                                        fileBuffer.append("  Status = ");\r
+                                        fileBuffer.append(libInstanceList.get(i)[0]);\r
+                                        fileBuffer.append("(ImageHandle, SystemTable);\r\n");\r
+                                        fileBuffer.append("  ASSERT_EFI_ERROR (Status);\r\n");\r
+                                }\r
             }\r
             fileBuffer.append("}\r\n");\r
             break;\r
@@ -1669,104 +1680,82 @@ public class AutoGen {
     **/\r
     void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)\r
     throws EdkException {\r
-        //\r
-               // Flag to indicate whether need to replace cmponentName/DriverDiagnostic\r
-               // to NULL.\r
-               // \r
-        boolean componentNamePcd = false;\r
-               boolean driverDiagnostPcd = false;\r
         //\r
         // Get the arry of extern. The driverBindingGroup is a 2 dimension array.\r
-               // The second dimension is include following element: DriverBinding, \r
-               // ComponentName, DriverConfiguration, DriverDiag;\r
-               // \r
+        // The second dimension is include following element: DriverBinding, \r
+        // ComponentName, DriverConfiguration, DriverDiag;\r
+        // \r
         String[][] driverBindingGroup = this.saq.getExternProtocolGroup();\r
 \r
-               //\r
-               // Get the Pcd Value of ComponentName and DriverDiagnostic to \r
-               // decide whether need to disable the componentName and \r
-               // DriverDiagnostic.\r
-               // \r
-               \r
-               String pcdValue = null;\r
-               pcdValue = saq.getPcdValueBycName("PcdComponentNameDisable");\r
-               if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
-            componentNamePcd = true;\r
-               }\r
-\r
-               pcdValue  = saq.getPcdValueBycName("PcdDriverDiagnosticsDisable");\r
-               if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
-            driverDiagnostPcd = true;\r
-               }\r
 \r
-               //\r
-        // inital BitMask;\r
-               // \r
-        int BitMask = 0;\r
+       //\r
+       // inital BitMask;\r
+       // \r
+       int BitMask = 0;\r
 \r
         //\r
         // Write driver binding protocol extern to autogen.c\r
         //\r
         for (int i = 0; i < driverBindingGroup.length; i++) {\r
-                       if (driverBindingGroup[i][0] != null) {\r
-                               fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
+            if (driverBindingGroup[i][0] != null) {\r
+                fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
                 fileBuffer.append(driverBindingGroup[i][0]);\r
                 fileBuffer.append(";\r\n");\r
-                       \r
+            } \r
         }\r
 \r
         //\r
         // Write component name protocol extern to autogen.c\r
         //\r
-               if (componentNamePcd) {\r
-                   for (int i = 0; i < driverBindingGroup.length; i++) {\r
-                           if (driverBindingGroup[i][1]!= null) {\r
-                                   if (driverBindingGroup[i][0] != null) {\r
-                                           BitMask |= 0x01;\r
-                                       fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
+        if (!componentNamePcd) {\r
+            for (int i = 0; i < driverBindingGroup.length; i++) {\r
+                if (driverBindingGroup[i][1]!= null) {\r
+                    if (driverBindingGroup[i][0] != null) {\r
+                        BitMask |= 0x01;\r
+                        fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
                         fileBuffer.append(driverBindingGroup[i][1]);\r
                         fileBuffer.append(";\r\n");\r
-                                   } else {\r
+                    } else {\r
                         throw new AutoGenException("DriverBinding can't be empty!!");\r
-                                   }\r
-                           }\r
-                   }\r
-               }\r
+                    }\r
+                 }\r
+             }\r
+         }\r
         \r
         //\r
         // Write driver configration protocol extern to autogen.c\r
         //\r
-               for (int i = 0; i < driverBindingGroup.length; i++) {\r
-                   if (driverBindingGroup[i][2] != null) {\r
-                           if (driverBindingGroup[i][0] != null) {\r
+        for (int i = 0; i < driverBindingGroup.length; i++) {\r
+            if (driverBindingGroup[i][2] != null) {\r
+                if (driverBindingGroup[i][0] != null) {\r
                     BitMask |= 0x02;\r
-                           fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
+                    fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
                     fileBuffer.append(driverBindingGroup[i][2]);\r
                     fileBuffer.append(";\r\n");\r
-                           } else {\r
+                } else {\r
                     throw new AutoGenException("DriverBinding can't be empty!!");\r
-                               }\r
-                       }\r
-               }\r
+                }\r
+            }\r
+        }\r
         \r
         //\r
         // Write driver dignastic protocol extern to autogen.c\r
         //\r
-               if (driverDiagnostPcd) {\r
-                       for (int i = 0; i < driverBindingGroup.length; i++) {\r
-                           if (driverBindingGroup[i][3] != null) {\r
-                                   if (driverBindingGroup[i][0] != null) {\r
+        if (!driverDiagnostPcd) {\r
+            for (int i = 0; i < driverBindingGroup.length; i++) {\r
+                if (driverBindingGroup[i][3] != null) {\r
+                    if (driverBindingGroup[i][0] != null) {\r
                         BitMask |= 0x04;\r
                         fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
                         fileBuffer.append(driverBindingGroup[i][3]);\r
                         fileBuffer.append(";\r\n");\r
-                                   } else {\r
+                    } else {\r
                         throw new AutoGenException("DriverBinding can't be empty!!");\r
-                                   }\r
-                           }\r
-                   }\r
-               }\r
-               \r
+                    }\r
+                }\r
+            }\r
+        }\r
+                \r
       \r
         //\r
         // Write driver module protocol bitmask.\r
@@ -1788,28 +1777,28 @@ public class AutoGen {
         //\r
         // Write drive module protocol list to autogen.c\r
         //\r
-               if (driverBindingGroup.length > 0) {\r
-                       fileBuffer\r
+        if (driverBindingGroup.length > 0) {\r
+                        fileBuffer\r
         .append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST  _gDriverModelProtocolList[] = {");\r
-               }\r
+                }\r
         \r
-               \r
+                \r
         for (int i = 0; i < driverBindingGroup.length; i++) {\r
             if (i != 0) {\r
                 fileBuffer.append(",");\r
             }\r
-                       //\r
-                       //  DriverBinding\r
-                       // \r
-                       fileBuffer.append("\r\n {\r\n");\r
+            //\r
+            //  DriverBinding\r
+            // \r
+            fileBuffer.append("\r\n {\r\n");\r
             fileBuffer.append("  &");\r
             fileBuffer.append(driverBindingGroup[i][0]);\r
             fileBuffer.append(", \r\n");\r
-                       \r
+                        \r
             //\r
-                       //  ComponentName\r
-                       // \r
-            if (driverBindingGroup[i][1] != null && componentNamePcd) {\r
+            //  ComponentName\r
+            // \r
+            if (driverBindingGroup[i][1] != null && componentNamePcd != true) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][1]);\r
                 fileBuffer.append(", \r\n");\r
@@ -1817,9 +1806,9 @@ public class AutoGen {
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
-                       //\r
-                       // DriverConfiguration\r
-                       // \r
+            //\r
+            // DriverConfiguration\r
+            // \r
             if (driverBindingGroup[i][2] != null) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][2]);\r
@@ -1828,10 +1817,10 @@ public class AutoGen {
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
-                       //\r
-                       // DriverDiagnostic\r
-                       // \r
-            if (driverBindingGroup[i][3] != null && driverDiagnostPcd) {\r
+            //\r
+            // DriverDiagnostic\r
+            // \r
+            if (driverBindingGroup[i][3] != null && driverDiagnostPcd != true) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][3]);\r
                 fileBuffer.append(", \r\n");\r
@@ -1841,9 +1830,9 @@ public class AutoGen {
             fileBuffer.append("  }");\r
         }\r
 \r
-               if (driverBindingGroup.length > 0) {\r
-                       fileBuffer.append("\r\n};\r\n");\r
-               }\r
+        if (driverBindingGroup.length > 0) {\r
+             fileBuffer.append("\r\n};\r\n");\r
+        }\r
     }\r
 \r
     /**\r
@@ -1885,13 +1874,13 @@ public class AutoGen {
         case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
         case CommonDefinition.ModuleTypeDxeSalDriver:\r
         case CommonDefinition.ModuleTypeUefiDriver:\r
-               case CommonDefinition.ModuleTypeUefiApplication:\r
-                       //\r
-                       //  If moduleType is one of above, call setVirtualAddressToAutogenC,\r
-                       //  and setExitBootServiceToAutogenC.\r
-                       // \r
+        case CommonDefinition.ModuleTypeUefiApplication:\r
+            //\r
+            //  If moduleType is one of above, call setVirtualAddressToAutogenC,\r
+            //  and setExitBootServiceToAutogenC.\r
+            // \r
             setVirtualAddressToAutogenC(fileBuffer);\r
-                       setExitBootServiceToAutogenC(fileBuffer);\r
+            setExitBootServiceToAutogenC(fileBuffer);\r
             break;\r
         default:\r
             break;\r
@@ -1918,21 +1907,21 @@ public class AutoGen {
         //  do nothing.\r
         //\r
         if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {\r
-                       if (inFile.exists()) {\r
-                               try{\r
-                                       FileInputStream fis = new FileInputStream (inFile);\r
-                                   fis.read(buffer);\r
-                                   FileOutputStream fos = new FileOutputStream(outFile);\r
-                                   fos.write(buffer);\r
-                                   fis.close();\r
-                                   fos.close();\r
-                               } catch (IOException e){\r
+            if (inFile.exists()) {\r
+                try{\r
+                    FileInputStream fis = new FileInputStream (inFile);\r
+                    fis.read(buffer);\r
+                    FileOutputStream fos = new FileOutputStream(outFile);\r
+                    fos.write(buffer);\r
+                    fis.close();\r
+                    fos.close();\r
+                } catch (IOException e){\r
                     throw new AutoGenException("The file, flashMap.h can't be open!");\r
-                               }\r
-                               \r
-                       } else {\r
-                               throw new AutoGenException("The file, flashMap.h doesn't exist!");\r
-                       }\r
+                }\r
+                                \r
+            } else {\r
+                throw new AutoGenException("The file, flashMap.h doesn't exist!");\r
+            }\r
         }\r
     }\r
 \r
@@ -1950,270 +1939,296 @@ public class AutoGen {
 \r
         String libConstructName = null;\r
         String libDestructName = null;\r
-               String libModuleType   = null;\r
+                String libModuleType   = null;\r
         String[] setVirtuals = null;\r
         String[] exitBoots = null;\r
 \r
         ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);\r
 \r
-               if (libraryIdList != null) {\r
-                       //\r
-                       // Reorder library instance sequence.\r
-                       //\r
-                       AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
-                                                                                                                  this.arch);\r
-                       List<ModuleIdentification> orderList = libOrder\r
-                                                                                                  .orderLibInstance();\r
-\r
-                       if (orderList != null) {\r
-                               //\r
-                               // Process library instance one by one.\r
-                               //\r
-                               for (int i = 0; i < orderList.size(); i++) {\r
-\r
-                                       //\r
-                                       // Get library instance basename.\r
-                                       //\r
-                                       ModuleIdentification libInstanceId = orderList.get(i);\r
-\r
-                                       //\r
-                                       // Get override map\r
-                                       //\r
-\r
-                                       Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
-                                       saq.push(libDoc);\r
-                                       //\r
-                                       // Get <PPis>, <Protocols>, <Guids> list 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
-                                       PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
-\r
-                                       //\r
-                                       // Add those ppi, protocol, guid in global ppi,\r
-                                       // 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
-                                       }\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
-                                               }\r
-                                       }\r
-\r
-                                       //\r
-                                       // If not yet parse this library instance's constructor\r
-                                       // element,parse it.\r
-                                       //\r
-                                       libConstructName = saq.getLibConstructorName();\r
-                                       libDestructName = saq.getLibDestructorName();\r
-                                       libModuleType = saq.getModuleType();\r
-\r
-                                       //\r
-                                       // Collect SetVirtualAddressMapCallBack and\r
-                                       // ExitBootServiceCallBack.\r
-                                       //\r
-                                       setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
-                                       exitBoots = saq.getExitBootServicesCallBackArray();\r
-                                       if (setVirtuals != null) {\r
-                                               for (int j = 0; j < setVirtuals.length; j++) {\r
-                                                       this.setVirtalAddList.add(setVirtuals[j]);\r
-                                               }\r
-                                       }\r
-                                       if (exitBoots != null) {\r
-                                               for (int k = 0; k < exitBoots.length; k++) {\r
-                                                       this.exitBootServiceList.add(exitBoots[k]);\r
-                                               }\r
-                                       }\r
-                                       saq.pop();\r
-                                       //\r
-                                       // Add dependent library instance constructor function.\r
-                                       //\r
-                                       if (libConstructName != null) {\r
-                                               this.libConstructList.add(new String[] {libConstructName, libModuleType});\r
-                                       }\r
-                                       //\r
-                                       // Add dependent library instance destructor fuction.\r
-                                       //\r
-                                       if (libDestructName != null) {\r
-                                               this.libDestructList.add(new String[] {libDestructName, libModuleType});\r
-                                       }\r
-                               }\r
-                       }\r
-\r
-               }\r
+           if (libraryIdList != null) {\r
+               //\r
+               // Reorder library instance sequence.\r
+               //\r
+               AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
+                                                              this.arch);\r
+               List<ModuleIdentification> orderList = libOrder\r
+                                                            .orderLibInstance();\r
+       \r
+               if (orderList != null) {\r
+                   //\r
+                   // Process library instance one by one.\r
+                   //\r
+                   for (int i = 0; i < orderList.size(); i++) {\r
+                       //\r
+                       // Get library instance basename.\r
+                       //\r
+                       ModuleIdentification libInstanceId = orderList.get(i);\r
+       \r
+                       //\r
+                       // Get override map\r
+                       //\r
+       \r
+                       Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
+                       saq.push(libDoc);\r
+                       //\r
+                       // Get <PPis>, <Protocols>, <Guids> list 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
+                       PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
+       \r
+                       //\r
+                       // Add those ppi, protocol, guid in global ppi,\r
+                       // 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
+                       }\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
+                           }\r
+                       }\r
+       \r
+                       //\r
+                       // If not yet parse this library instance's constructor\r
+                       // element,parse it.\r
+                       //\r
+                           libConstructName = saq.getLibConstructorName();\r
+                           libDestructName = saq.getLibDestructorName();\r
+                           libModuleType = saq.getModuleType();\r
+                       \r
+                           //\r
+                           // Collect SetVirtualAddressMapCallBack and\r
+                           // ExitBootServiceCallBack.\r
+                           //\r
+                           setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
+                           exitBoots = saq.getExitBootServicesCallBackArray();\r
+                           if (setVirtuals != null) {\r
+                                   for (int j = 0; j < setVirtuals.length; j++) {\r
+                                           this.setVirtalAddList.add(setVirtuals[j]);\r
+                                   }\r
+                           }\r
+                           if (exitBoots != null) {\r
+                                   for (int k = 0; k < exitBoots.length; k++) {\r
+                                           this.exitBootServiceList.add(exitBoots[k]);\r
+                                   }\r
+                           }\r
+                           saq.pop();\r
+                           //\r
+                           // Add dependent library instance constructor function.\r
+                           //\r
+                           if (libConstructName != null) {\r
+                                   this.libConstructList.add(new String[] {libConstructName, libModuleType});\r
+                           }\r
+                           //\r
+                           // Add dependent library instance destructor fuction.\r
+                           //\r
+                           if (libDestructName != null) {\r
+                                   this.libDestructList.add(new String[] {libDestructName, libModuleType});\r
+                           }\r
+                       }\r
+               }\r
+           }\r
     }\r
-       private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){\r
+    private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){\r
         //\r
         // Entry point lib for these module types needs to know the count\r
         // of entryPoint.\r
         //\r
-               fileBuffer\r
+        fileBuffer\r
             .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED  const UINTN _gDriverSetVirtualAddressMapEventCount = ");\r
 \r
-            //\r
-            // If the list is not valid or has no entries set count to zero else\r
-            // set count to the number of valid entries\r
-            //\r
-            int Count = 0;\r
-                       int i = 0;\r
-            if (this.setVirtalAddList != null) {\r
-                for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
-                    if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
-                        break;\r
-                    }\r
-                }\r
-                Count = i;\r
-            }\r
-\r
-            fileBuffer.append(Integer.toString(Count));\r
-            fileBuffer.append(";\r\n\r\n");\r
-            if (this.setVirtalAddList == null || this.setVirtalAddList.size() == 0) {\r
-                //\r
-                // No data so make a NULL list\r
-                //\r
-                fileBuffer\r
-                .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");\r
-                fileBuffer.append("  NULL\r\n");\r
-                fileBuffer.append("};\r\n\r\n");\r
-            } else {\r
-                //\r
-                // Write SetVirtualAddressMap function definition.\r
-                //\r
-                for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
-                    if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
-                        break;\r
-                    }\r
-                    fileBuffer.append("VOID\r\n");\r
-                    fileBuffer.append("EFIAPI\r\n");\r
-                    fileBuffer.append(this.setVirtalAddList.get(i));\r
-                    fileBuffer.append(" (\r\n");\r
-                    fileBuffer.append("  IN EFI_EVENT  Event,\r\n");\r
-                    fileBuffer.append("  IN VOID       *Context\r\n");\r
-                    fileBuffer.append("  );\r\n\r\n");\r
-                 }\r
-\r
-                //\r
-                // Write SetVirtualAddressMap entry point array.\r
-                //\r
-                fileBuffer\r
-                .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");\r
-                for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
-                    if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
-                        break;\r
-                    }\r
-\r
-                    if (i == 0) {\r
-                        fileBuffer.append("\r\n  ");\r
-                    } else {\r
-                        fileBuffer.append(",\r\n  ");\r
-                    }\r
-\r
-                    fileBuffer.append(this.setVirtalAddList.get(i));\r
-                }\r
-                //\r
-                // add the NULL at the end of _gDriverSetVirtualAddressMapEvent list.\r
-                //\r
-                fileBuffer.append(",\r\n  NULL");\r
-                fileBuffer.append("\r\n};\r\n\r\n");\r
-                       }\r
+           //\r
+           // If the list is not valid or has no entries set count to zero else\r
+           // set count to the number of valid entries\r
+           //\r
+           int Count = 0;\r
+           int i = 0;\r
+           if (this.setVirtalAddList != null) {\r
+               for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
+                   if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
+                       break;\r
+                   }\r
+               }\r
+               Count = i;\r
+           }\r
+       \r
+           fileBuffer.append(Integer.toString(Count));\r
+           fileBuffer.append(";\r\n\r\n");\r
+           if (this.setVirtalAddList == null || this.setVirtalAddList.size() == 0) {\r
+               //\r
+               // No data so make a NULL list\r
+               //\r
+               fileBuffer\r
+               .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");\r
+               fileBuffer.append("  NULL\r\n");\r
+               fileBuffer.append("};\r\n\r\n");\r
+           } else {\r
+               //\r
+               // Write SetVirtualAddressMap function definition.\r
+               //\r
+               for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
+                   if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
+                       break;\r
+                   }\r
+                   fileBuffer.append("VOID\r\n");\r
+                   fileBuffer.append("EFIAPI\r\n");\r
+                   fileBuffer.append(this.setVirtalAddList.get(i));\r
+                   fileBuffer.append(" (\r\n");\r
+                   fileBuffer.append("  IN EFI_EVENT  Event,\r\n");\r
+                   fileBuffer.append("  IN VOID       *Context\r\n");\r
+                   fileBuffer.append("  );\r\n\r\n");\r
+                }\r
+       \r
+               //\r
+               // Write SetVirtualAddressMap entry point array.\r
+               //\r
+               fileBuffer\r
+               .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");\r
+               for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
+                   if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
+                       break;\r
+                   }\r
+       \r
+                   if (i == 0) {\r
+                       fileBuffer.append("\r\n  ");\r
+                   } else {\r
+                       fileBuffer.append(",\r\n  ");\r
+                   }\r
+       \r
+                   fileBuffer.append(this.setVirtalAddList.get(i));\r
+               }\r
+               //\r
+               // add the NULL at the end of _gDriverSetVirtualAddressMapEvent list.\r
+               //\r
+               fileBuffer.append(",\r\n  NULL");\r
+               fileBuffer.append("\r\n};\r\n\r\n");\r
+           }\r
        }\r
 \r
 \r
        private void setExitBootServiceToAutogenC(StringBuffer fileBuffer){\r
                //\r
-        // Entry point lib for these module types needs to know the count.\r
-        //\r
-        fileBuffer\r
-        .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED  const UINTN _gDriverExitBootServicesEventCount = ");\r
-\r
-        //\r
-        // If the list is not valid or has no entries set count to zero else\r
-        // set count to the number of valid entries.\r
-        //\r
-        int Count = 0;\r
+               // Entry point lib for these module types needs to know the count.\r
+               //\r
+               fileBuffer\r
+               .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED  const UINTN _gDriverExitBootServicesEventCount = ");\r
+               \r
+               //\r
+               // If the list is not valid or has no entries set count to zero else\r
+               // set count to the number of valid entries.\r
+               //\r
+               int Count = 0;\r
                int i = 0; \r
-        if (this.exitBootServiceList != null) {\r
-            for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
-                if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
-                    break;\r
-                }\r
-            }\r
-            Count = i;\r
-        }\r
-        fileBuffer.append(Integer.toString(Count));\r
-        fileBuffer.append(";\r\n\r\n");\r
-\r
+               if (this.exitBootServiceList != null) {\r
+                   for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
+                       if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
+                           break;\r
+                       }\r
+                   }\r
+                   Count = i;\r
+               }\r
+               fileBuffer.append(Integer.toString(Count));\r
+               fileBuffer.append(";\r\n\r\n");\r
+               \r
                if (this.exitBootServiceList == null || this.exitBootServiceList.size() == 0) {\r
-            //      \r
-            // No data so make a NULL list.\r
-            //\r
-            fileBuffer\r
-            .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");\r
-            fileBuffer.append("  NULL\r\n");\r
-            fileBuffer.append("};\r\n\r\n");\r
-        } else {\r
-            //\r
-            // Write DriverExitBootServices function definition.\r
-            //\r
-            for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
-                if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
-                    break;\r
-                }\r
-\r
-                fileBuffer.append("VOID\r\n");\r
-                fileBuffer.append("EFIAPI\r\n");\r
-                fileBuffer.append(this.exitBootServiceList.get(i));\r
-                fileBuffer.append(" (\r\n");\r
-                fileBuffer.append("  IN EFI_EVENT  Event,\r\n");\r
-                fileBuffer.append("  IN VOID       *Context\r\n");\r
-                fileBuffer.append("  );\r\n\r\n");\r
-            }\r
-\r
-            //\r
-            // Write DriverExitBootServices entry point array.\r
-            //\r
-            fileBuffer\r
-            .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");\r
-            for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
-                if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
-                    break;\r
-                }\r
-\r
-                if (i == 0) {\r
-                    fileBuffer.append("\r\n  ");\r
-                } else {\r
-                    fileBuffer.append(",\r\n  ");\r
-                }\r
-                fileBuffer.append(this.exitBootServiceList.get(i));\r
-            }\r
-            \r
-            fileBuffer.append(",\r\n  NULL");\r
-            fileBuffer.append("\r\n};\r\n\r\n");\r
-        }\r
-\r
-       }\r
-\r
+                   //      \r
+                   // No data so make a NULL list.\r
+                   //\r
+                   fileBuffer\r
+                   .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");\r
+                   fileBuffer.append("  NULL\r\n");\r
+                   fileBuffer.append("};\r\n\r\n");\r
+               } else {\r
+                   //\r
+                   // Write DriverExitBootServices function definition.\r
+                   //\r
+                   for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
+                       if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
+                           break;\r
+                       }\r
+               \r
+                       fileBuffer.append("VOID\r\n");\r
+                       fileBuffer.append("EFIAPI\r\n");\r
+                       fileBuffer.append(this.exitBootServiceList.get(i));\r
+                       fileBuffer.append(" (\r\n");\r
+                       fileBuffer.append("  IN EFI_EVENT  Event,\r\n");\r
+                       fileBuffer.append("  IN VOID       *Context\r\n");\r
+                       fileBuffer.append("  );\r\n\r\n");\r
+                   }\r
+               \r
+                   //\r
+                   // Write DriverExitBootServices entry point array.\r
+                   //\r
+                   fileBuffer\r
+                   .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");\r
+                   for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
+                       if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
+                           break;\r
+                       }\r
+               \r
+                       if (i == 0) {\r
+                           fileBuffer.append("\r\n  ");\r
+                       } else {\r
+                           fileBuffer.append(",\r\n  ");\r
+                       }\r
+                       fileBuffer.append(this.exitBootServiceList.get(i));\r
+                   }\r
+                   \r
+                   fileBuffer.append(",\r\n  NULL");\r
+                   fileBuffer.append("\r\n};\r\n\r\n");\r
+               }               \r
+    }\r
+    /**\r
+      setPcdComponentName\r
+      \r
+         Get the Pcd Value of ComponentName to \r
+         decide whether need to disable the componentName.         \r
+         \r
+    **/\r
+    public void setPcdComponentName (){\r
+       String pcdValue = null;\r
+               pcdValue = saq.getPcdValueBycName("PcdComponentNameDisable");\r
+               if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
+            this.componentNamePcd = true;\r
+               }\r
+    }\r
+    \r
+    /**\r
+      setPcdDriverDiagnostic \r
+      \r
+        Get the Pcd Value of DriverDiagnostic to \r
+        decide whether need to disable DriverDiagnostic.\r
+         \r
+    **/\r
+    public void setPcdDriverDiagnostic (){\r
+       String pcdValue = null;\r
+        pcdValue  = saq.getPcdValueBycName("PcdDriverDiagnosticsDisable");\r
+               if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
+            this.driverDiagnostPcd = true;\r
+               }    \r
+    }  \r
+    \r
 }\r
index 9e4c445..b6cb329 100644 (file)
@@ -76,8 +76,7 @@ public class SurfaceAreaQuery {
     //\r
     // keep the namep declaration for xmlbeans Xpath query\r
     //\r
-    private String queryDeclaration = null;\r
-\r
+    private String queryDeclaration = null;    \r
     private StringBuffer normQueryString = new StringBuffer(4096);\r
     private Pattern xPathPattern = Pattern.compile("([^/]*)(/|//)([^/]+)");\r
 \r