**/\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
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
//\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
//\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
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
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
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