]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java
Fixed EDKT469.
[mirror_edk2.git] / Tools / Java / Source / GenBuild / org / tianocore / build / autogen / AutoGen.java
index 505cb87d294ab784d03907898b01f307f531d570..3c2652eaec93d695b1019cbd7b82e256d0d19ced 100644 (file)
@@ -1669,7 +1669,12 @@ public class AutoGen {
     **/\r
     void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)\r
     throws EdkException {\r
     **/\r
     void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)\r
     throws EdkException {\r
-\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
         //\r
         // Get the arry of extern. The driverBindingGroup is a 2 dimension array.\r
                // The second dimension is include following element: DriverBinding, \r
@@ -1677,7 +1682,24 @@ public class AutoGen {
                // \r
         String[][] driverBindingGroup = this.saq.getExternProtocolGroup();\r
 \r
                // \r
         String[][] driverBindingGroup = this.saq.getExternProtocolGroup();\r
 \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
         // inital BitMask;\r
                // \r
         int BitMask = 0;\r
@@ -1696,30 +1718,32 @@ public class AutoGen {
         //\r
         // Write component name protocol extern to autogen.c\r
         //\r
         //\r
         // Write component name protocol extern to autogen.c\r
         //\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
-                    throw new AutoGenException("DriverBinding can't be empty!!");\r
-                               }\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
+                        fileBuffer.append(driverBindingGroup[i][1]);\r
+                        fileBuffer.append(";\r\n");\r
+                                   } else {\r
+                        throw new AutoGenException("DriverBinding can't be empty!!");\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
         //\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
+                   if (driverBindingGroup[i][2] != null) {\r
+                           if (driverBindingGroup[i][0] != null) {\r
                     BitMask |= 0x02;\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
                     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
                     throw new AutoGenException("DriverBinding can't be empty!!");\r
                                }\r
                        }\r
@@ -1728,18 +1752,21 @@ public class AutoGen {
         //\r
         // Write driver dignastic protocol extern to autogen.c\r
         //\r
         //\r
         // Write driver dignastic protocol extern to autogen.c\r
         //\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
-                    throw new AutoGenException("DriverBinding can't be empty!!");\r
-                               }\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
+                        BitMask |= 0x04;\r
+                        fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
+                        fileBuffer.append(driverBindingGroup[i][3]);\r
+                        fileBuffer.append(";\r\n");\r
+                                   } else {\r
+                        throw new AutoGenException("DriverBinding can't be empty!!");\r
+                                   }\r
+                           }\r
+                   }\r
                }\r
                }\r
+               \r
       \r
         //\r
         // Write driver module protocol bitmask.\r
       \r
         //\r
         // Write driver module protocol bitmask.\r
@@ -1771,14 +1798,18 @@ public class AutoGen {
             if (i != 0) {\r
                 fileBuffer.append(",");\r
             }\r
             if (i != 0) {\r
                 fileBuffer.append(",");\r
             }\r
-                       \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
                        fileBuffer.append("\r\n {\r\n");\r
             fileBuffer.append("  &");\r
             fileBuffer.append(driverBindingGroup[i][0]);\r
             fileBuffer.append(", \r\n");\r
                        \r
-\r
-            if (driverBindingGroup[i][1] != null) {\r
+            //\r
+                       //  ComponentName\r
+                       // \r
+            if (driverBindingGroup[i][1] != null && componentNamePcd) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][1]);\r
                 fileBuffer.append(", \r\n");\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][1]);\r
                 fileBuffer.append(", \r\n");\r
@@ -1786,6 +1817,9 @@ public class AutoGen {
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
+                       //\r
+                       // DriverConfiguration\r
+                       // \r
             if (driverBindingGroup[i][2] != null) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][2]);\r
             if (driverBindingGroup[i][2] != null) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][2]);\r
@@ -1794,7 +1828,10 @@ public class AutoGen {
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
                 fileBuffer.append("  NULL, \r\n");\r
             }\r
 \r
-            if (driverBindingGroup[i][3] != null) {\r
+                       //\r
+                       // DriverDiagnostic\r
+                       // \r
+            if (driverBindingGroup[i][3] != null && driverDiagnostPcd) {\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][3]);\r
                 fileBuffer.append(", \r\n");\r
                 fileBuffer.append("  &");\r
                 fileBuffer.append(driverBindingGroup[i][3]);\r
                 fileBuffer.append(", \r\n");\r