Fixed EDKT469.

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
This commit is contained in:
qouyang
2006-11-14 06:12:26 +00:00
parent 6d864b7a91
commit e87022aa87
2 changed files with 91 additions and 33 deletions

View File

@ -1669,7 +1669,12 @@ public class AutoGen {
**/ **/
void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer) void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)
throws EdkException { throws EdkException {
//
// Flag to indicate whether need to replace cmponentName/DriverDiagnostic
// to NULL.
//
boolean componentNamePcd = false;
boolean driverDiagnostPcd = false;
// //
// Get the arry of extern. The driverBindingGroup is a 2 dimension array. // Get the arry of extern. The driverBindingGroup is a 2 dimension array.
// The second dimension is include following element: DriverBinding, // The second dimension is include following element: DriverBinding,
@ -1677,7 +1682,24 @@ public class AutoGen {
// //
String[][] driverBindingGroup = this.saq.getExternProtocolGroup(); String[][] driverBindingGroup = this.saq.getExternProtocolGroup();
// //
// Get the Pcd Value of ComponentName and DriverDiagnostic to
// decide whether need to disable the componentName and
// DriverDiagnostic.
//
String pcdValue = null;
pcdValue = saq.getPcdValueBycName("PcdComponentNameDisable");
if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {
componentNamePcd = true;
}
pcdValue = saq.getPcdValueBycName("PcdDriverDiagnosticsDisable");
if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {
driverDiagnostPcd = true;
}
//
// inital BitMask; // inital BitMask;
// //
int BitMask = 0; int BitMask = 0;
@ -1696,30 +1718,32 @@ public class AutoGen {
// //
// Write component name protocol extern to autogen.c // Write component name protocol extern to autogen.c
// //
for (int i = 0; i < driverBindingGroup.length; i++) { if (componentNamePcd) {
if (driverBindingGroup[i][1]!= null) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][1]!= null) {
BitMask |= 0x01; if (driverBindingGroup[i][0] != null) {
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL "); BitMask |= 0x01;
fileBuffer.append(driverBindingGroup[i][1]); fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
fileBuffer.append(";\r\n"); fileBuffer.append(driverBindingGroup[i][1]);
} else { fileBuffer.append(";\r\n");
throw new AutoGenException("DriverBinding can't be empty!!"); } else {
} throw new AutoGenException("DriverBinding can't be empty!!");
} }
}
}
} }
// //
// Write driver configration protocol extern to autogen.c // Write driver configration protocol extern to autogen.c
// //
for (int i = 0; i < driverBindingGroup.length; i++) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][2] != null) { if (driverBindingGroup[i][2] != null) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][0] != null) {
BitMask |= 0x02; BitMask |= 0x02;
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][2]); fileBuffer.append(driverBindingGroup[i][2]);
fileBuffer.append(";\r\n"); fileBuffer.append(";\r\n");
} else { } else {
throw new AutoGenException("DriverBinding can't be empty!!"); throw new AutoGenException("DriverBinding can't be empty!!");
} }
} }
@ -1728,18 +1752,21 @@ public class AutoGen {
// //
// Write driver dignastic protocol extern to autogen.c // Write driver dignastic protocol extern to autogen.c
// //
for (int i = 0; i < driverBindingGroup.length; i++) { if (driverDiagnostPcd) {
if (driverBindingGroup[i][3] != null) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][0] != null) { if (driverBindingGroup[i][3] != null) {
BitMask |= 0x04; if (driverBindingGroup[i][0] != null) {
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); BitMask |= 0x04;
fileBuffer.append(driverBindingGroup[i][3]); fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
fileBuffer.append(";\r\n"); fileBuffer.append(driverBindingGroup[i][3]);
} else { fileBuffer.append(";\r\n");
throw new AutoGenException("DriverBinding can't be empty!!"); } else {
} throw new AutoGenException("DriverBinding can't be empty!!");
} }
}
}
} }
// //
// Write driver module protocol bitmask. // Write driver module protocol bitmask.
@ -1771,14 +1798,18 @@ public class AutoGen {
if (i != 0) { if (i != 0) {
fileBuffer.append(","); fileBuffer.append(",");
} }
//
// DriverBinding
//
fileBuffer.append("\r\n {\r\n"); fileBuffer.append("\r\n {\r\n");
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(driverBindingGroup[i][0]); fileBuffer.append(driverBindingGroup[i][0]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
//
if (driverBindingGroup[i][1] != null) { // ComponentName
//
if (driverBindingGroup[i][1] != null && componentNamePcd) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(driverBindingGroup[i][1]); fileBuffer.append(driverBindingGroup[i][1]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
@ -1786,6 +1817,9 @@ public class AutoGen {
fileBuffer.append(" NULL, \r\n"); fileBuffer.append(" NULL, \r\n");
} }
//
// DriverConfiguration
//
if (driverBindingGroup[i][2] != null) { if (driverBindingGroup[i][2] != null) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(driverBindingGroup[i][2]); fileBuffer.append(driverBindingGroup[i][2]);
@ -1794,7 +1828,10 @@ public class AutoGen {
fileBuffer.append(" NULL, \r\n"); fileBuffer.append(" NULL, \r\n");
} }
if (driverBindingGroup[i][3] != null) { //
// DriverDiagnostic
//
if (driverBindingGroup[i][3] != null && driverDiagnostPcd) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(driverBindingGroup[i][3]); fileBuffer.append(driverBindingGroup[i][3]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");

View File

@ -2023,4 +2023,25 @@ public class SurfaceAreaQuery {
return a.getDomNode(); return a.getDomNode();
} }
/**
Get the value of PCD by PCD cName
@return PcdValue String of PcdComponentName
null If don't find ComponentName Pcd
**/
public String getPcdValueBycName(String cName){
String[] xPath = new String[] { "/PcdData" };
Object[] returns = get("PcdBuildDefinition", xPath);
if (returns == null || returns.length == 0) {
return null;
}
for (int i = 0; i < returns.length; i++) {
PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData pcdData = (PcdBuildDefinitionDocument.PcdBuildDefinition.PcdData)returns[i];
if (pcdData.getCName().equalsIgnoreCase(cName)){
return pcdData.getValue();
}
}
return null;
}
} }