Fixed EDKT469.
authorqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 14 Nov 2006 06:12:26 +0000 (06:12 +0000)
committerqouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524>
Tue, 14 Nov 2006 06:12:26 +0000 (06:12 +0000)
Add the PCD control for "_gDriverModelProtocolList" list in Autogen.c.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1944 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 505cb87..3c2652e 100644 (file)
@@ -1669,7 +1669,12 @@ public class AutoGen {
     **/\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
@@ -1677,7 +1682,24 @@ public class AutoGen {
                // \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
@@ -1696,30 +1718,32 @@ public class AutoGen {
         //\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
         // 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
-                                   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
@@ -1728,18 +1752,21 @@ public class AutoGen {
         //\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
         // Write driver module protocol bitmask.\r
@@ -1771,14 +1798,18 @@ public class AutoGen {
             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
-\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
@@ -1786,6 +1817,9 @@ public class AutoGen {
                 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
@@ -1794,7 +1828,10 @@ public class AutoGen {
                 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
index b927560..cf31873 100644 (file)
@@ -2023,4 +2023,25 @@ public class SurfaceAreaQuery {
         \r
         return a.getDomNode();\r
     }\r
+\r
+    /**\r
+     Get the value of PCD by PCD cName\r
+\r
+     @return PcdValue         String of PcdComponentName\r
+                null         If don't find ComponentName Pcd\r
+    **/\r
+    public String getPcdValueBycName(String cName){\r
+        String[] xPath = new String[] { "/PcdData" };\r
+        Object[] returns = get("PcdBuildDefinition", xPath);\r
+       if (returns == null || returns.length == 0) {\r
+           return  null;\r
+       } \r
+       for (int i = 0; i < returns.length; i++) {\r
+            PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)returns[i];\r
+           if (pcdData.getCName().equalsIgnoreCase(cName)){\r
+               return pcdData.getValue();\r
+            }\r
+        }\r
+        return null;\r
+    }\r
 }\r