Fix EDKT272.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1589 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qouyang 2006-09-21 08:01:14 +00:00
parent df87de9bdf
commit d8f1335e23
2 changed files with 143 additions and 119 deletions

View File

@ -781,7 +781,6 @@ public class AutoGen {
"Module type = 'PEI_CORE', can have only one module entry point!"); "Module type = 'PEI_CORE', can have only one module entry point!");
} else { } else {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[0]); fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer
@ -814,7 +813,6 @@ public class AutoGen {
} else { } else {
fileBuffer.append("VOID\r\n"); fileBuffer.append("VOID\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[0]); fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\n"); fileBuffer.append(" (\n");
fileBuffer.append(" IN VOID *HobStart\r\n"); fileBuffer.append(" IN VOID *HobStart\r\n");
@ -851,7 +849,6 @@ public class AutoGen {
} }
for (int i = 0; i < entryPointList.length; i++) { for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]); fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer
@ -920,7 +917,6 @@ public class AutoGen {
} else { } else {
for (int i = 0; i < entryPointList.length; i++) { for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]); fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n"); fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
@ -987,7 +983,6 @@ public class AutoGen {
if (unloadImageList != null) { if (unloadImageList != null) {
for (int i = 0; i < unloadImageList.length; i++) { for (int i = 0; i < unloadImageList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(unloadImageList[i]); fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer
@ -1067,7 +1062,6 @@ public class AutoGen {
for (int i = 0; i < entryPointList.length; i++) { for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]); fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n"); fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
@ -1146,12 +1140,17 @@ public class AutoGen {
// //
// Add ModuleUnloadImage for DxeDriver and UefiDriver module type. // Add ModuleUnloadImage for DxeDriver and UefiDriver module type.
// //
//entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();
//
// Remover duplicate unload entry point.
//
//entryPointList = CommonDefinition.remDupString(entryPointList);
//entryPointCount = 0;
unloadImageCount = 0; unloadImageCount = 0;
if (unloadImageList != null) { if (unloadImageList != null) {
for (int i = 0; i < unloadImageList.length; i++) { for (int i = 0; i < unloadImageList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(unloadImageList[i]); fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer
@ -1639,87 +1638,75 @@ public class AutoGen {
throws EdkException { throws EdkException {
// //
// Check what <extern> contains. And the number of following elements // Get the arry of extern. The driverBindingGroup is a 2 dimension array.
// under <extern> should be same. 1. DRIVER_BINDING 2. COMPONENT_NAME // The second dimension is include following element: DriverBinding,
// 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC // ComponentName, DriverConfiguration, DriverDiag;
// //
String[][] driverBindingGroup = this.saq.getExternProtocolGroup();
String[] drvBindList = saq.getDriverBindingArray();
// //
// If component name protocol,component configuration protocol, // inital BitMask;
// component diagnostic protocol is not null or empty, check //
// if every one have the same number of the driver binding protocol.
//
if (drvBindList == null || drvBindList.length == 0) {
return;
}
String[] compNamList = saq.getComponentNameArray();
String[] compConfList = saq.getDriverConfigArray();
String[] compDiagList = saq.getDriverDiagArray();
int BitMask = 0; int BitMask = 0;
// //
// Write driver binding protocol extern to autogen.c // Write driver binding protocol extern to autogen.c
// //
for (int i = 0; i < drvBindList.length; i++) { for (int i = 0; i < driverBindingGroup.length; i++) {
fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL "); if (driverBindingGroup[i][0] != null) {
fileBuffer.append(drvBindList[i]); fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
fileBuffer.append(";\r\n"); fileBuffer.append(driverBindingGroup[i][0]);
fileBuffer.append(";\r\n");
}
} }
// //
// Write component name protocol extern to autogen.c // Write component name protocol extern to autogen.c
// //
if (compNamList != null && compNamList.length != 0) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (drvBindList.length != compNamList.length) { if (driverBindingGroup[i][1]!= null) {
throw new AutoGenException( if (driverBindingGroup[i][0] != null) {
"Different number of Driver Binding and Component Name protocols!"); BitMask |= 0x01;
} fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][1]);
BitMask |= 0x01; fileBuffer.append(";\r\n");
for (int i = 0; i < compNamList.length; i++) { } else {
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL "); throw new AutoGenException("DriverBinding can't be empty!!");
fileBuffer.append(compNamList[i]); }
fileBuffer.append(";\r\n"); }
} }
}
// //
// Write driver configration protocol extern to autogen.c // Write driver configration protocol extern to autogen.c
// //
if (compConfList != null && compConfList.length != 0) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (drvBindList.length != compConfList.length) { if (driverBindingGroup[i][2] != null) {
throw new AutoGenException( if (driverBindingGroup[i][0] != null) {
"Different number of Driver Binding and Driver Configuration protocols!"); BitMask |= 0x02;
} fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][2]);
BitMask |= 0x02; fileBuffer.append(";\r\n");
for (int i = 0; i < compConfList.length; i++) { } else {
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); throw new AutoGenException("DriverBinding can't be empty!!");
fileBuffer.append(compConfList[i]); }
fileBuffer.append(";\r\n"); }
} }
}
// //
// Write driver dignastic protocol extern to autogen.c // Write driver dignastic protocol extern to autogen.c
// //
if (compDiagList != null && compDiagList.length != 0) { for (int i = 0; i < driverBindingGroup.length; i++) {
if (drvBindList.length != compDiagList.length) { if (driverBindingGroup[i][3] != null) {
throw new AutoGenException( if (driverBindingGroup[i][0] != null) {
"Different number of Driver Binding and Driver Diagnosis protocols!"); BitMask |= 0x04;
} fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][3]);
BitMask |= 0x04; fileBuffer.append(";\r\n");
for (int i = 0; i < compDiagList.length; i++) { } else {
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); throw new AutoGenException("DriverBinding can't be empty!!");
fileBuffer.append(compDiagList[i]); }
fileBuffer.append(";\r\n"); }
} }
}
// //
// Write driver module protocol bitmask. // Write driver module protocol bitmask.
@ -1735,49 +1722,58 @@ public class AutoGen {
fileBuffer fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = "); .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
fileBuffer.append(Integer.toString(drvBindList.length)); fileBuffer.append(Integer.toString(driverBindingGroup.length));
fileBuffer.append(";\r\n"); fileBuffer.append(";\r\n");
// //
// Write drive module protocol list to autogen.c // Write drive module protocol list to autogen.c
// //
fileBuffer if (driverBindingGroup.length > 0) {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {"); .append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");
for (int i = 0; i < drvBindList.length; i++) { }
for (int i = 0; i < driverBindingGroup.length; i++) {
if (i != 0) { if (i != 0) {
fileBuffer.append(","); fileBuffer.append(",");
} }
fileBuffer.append("\r\n {\r\n");
fileBuffer.append("\r\n {\r\n");
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(drvBindList[i]); fileBuffer.append(driverBindingGroup[i][0]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
if (compNamList != null) {
if (driverBindingGroup[i][1] != null) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(compNamList[i]); fileBuffer.append(driverBindingGroup[i][1]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
} else { } else {
fileBuffer.append(" NULL, \r\n"); fileBuffer.append(" NULL, \r\n");
} }
if (compConfList != null) { if (driverBindingGroup[i][2] != null) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(compConfList[i]); fileBuffer.append(driverBindingGroup[i][2]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
} else { } else {
fileBuffer.append(" NULL, \r\n"); fileBuffer.append(" NULL, \r\n");
} }
if (compDiagList != null) { if (driverBindingGroup[i][3] != null) {
fileBuffer.append(" &"); fileBuffer.append(" &");
fileBuffer.append(compDiagList[i]); fileBuffer.append(driverBindingGroup[i][3]);
fileBuffer.append(", \r\n"); fileBuffer.append(", \r\n");
} else { } else {
fileBuffer.append(" NULL, \r\n"); fileBuffer.append(" NULL, \r\n");
} }
fileBuffer.append(" }"); fileBuffer.append(" }");
} }
fileBuffer.append("\r\n};\r\n");
if (driverBindingGroup.length > 0) {
fileBuffer.append("\r\n};\r\n");
}
} }
/** /**

View File

@ -23,53 +23,25 @@ import java.util.Stack;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.w3c.dom.Node; import org.tianocore.ExternsDocument.Externs.Extern;
import org.apache.xmlbeans.XmlObject; import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlString; import org.apache.xmlbeans.XmlString;
import org.tianocore.*;
import org.tianocore.BuildOptionsDocument; import org.tianocore.ExternsDocument.Externs;
import org.tianocore.CNameType;
import org.tianocore.ExternsDocument;
import org.tianocore.FileNameConvention;
import org.tianocore.FvImagesDocument;
import org.tianocore.GuidDeclarationsDocument;
import org.tianocore.GuidsDocument;
import org.tianocore.LibrariesDocument;
import org.tianocore.LibraryClassDeclarationsDocument;
import org.tianocore.LibraryClassDocument;
import org.tianocore.ModuleDefinitionsDocument;
import org.tianocore.ModuleSADocument;
import org.tianocore.ModuleSaBuildOptionsDocument;
import org.tianocore.ModuleTypeDef;
import org.tianocore.MsaFilesDocument;
import org.tianocore.MsaHeaderDocument;
import org.tianocore.OptionDocument;
import org.tianocore.PPIsDocument;
import org.tianocore.PackageDependenciesDocument;
import org.tianocore.PackageHeadersDocument;
import org.tianocore.PcdCodedDocument;
import org.tianocore.PlatformDefinitionsDocument;
import org.tianocore.PlatformHeaderDocument;
import org.tianocore.PpiDeclarationsDocument;
import org.tianocore.ProtocolDeclarationsDocument;
import org.tianocore.Sentence;
import org.tianocore.SpdHeaderDocument;
import org.tianocore.UserExtensionsDocument;
import org.tianocore.FilenameDocument.Filename; import org.tianocore.FilenameDocument.Filename;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.MsaHeaderDocument.MsaHeader; import org.tianocore.MsaHeaderDocument.MsaHeader;
import org.tianocore.ProtocolsDocument.Protocols.Protocol; import org.tianocore.ProtocolsDocument.Protocols.Protocol;
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify; import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
import org.tianocore.PcdDriverTypes; import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.build.id.FpdModuleIdentification; import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.build.id.ModuleIdentification; import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification; import org.tianocore.build.id.PlatformIdentification;
import org.tianocore.build.toolchain.ToolChainInfo; import org.tianocore.build.toolchain.ToolChainInfo;
import org.tianocore.build.autogen.CommonDefinition; import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
import org.w3c.dom.Node;
/** /**
* SurfaceAreaQuery class is used to query Surface Area information from msa, * SurfaceAreaQuery class is used to query Surface Area information from msa,
@ -1251,6 +1223,62 @@ public class SurfaceAreaQuery {
return getCNames("Externs", xPath); return getCNames("Externs", xPath);
} }
/**
* Retrive DriverBinding, ComponentName, DriverConfig,
* DriverDiag group array
*
* @returns DriverBinding group name list if elements are found
* at the known xpath
* @returns null if nothing is there
*/
public String[][] getExternProtocolGroup() {
String[] xPath = new String[] {"/Extern"};
Object[] returns = get("Externs",xPath);
if (returns == null) {
return new String[0][4];
}
List<Extern> externList = new ArrayList<Extern>();
for (int i = 0; i < returns.length; i++) {
org.tianocore.ExternsDocument.Externs.Extern extern = (org.tianocore.ExternsDocument.Externs.Extern)returns[i];
if (extern.getDriverBinding() != null) {
externList.add(extern);
}
}
String[][] externGroup = new String[externList.size()][4];
for (int i = 0; i < externList.size(); i++) {
String driverBindingStr = externList.get(i).getDriverBinding();
if ( driverBindingStr != null){
externGroup[i][0] = driverBindingStr;
} else {
externGroup[i][0] = null;
}
String componentNameStr = externList.get(i).getComponentName();
if (componentNameStr != null) {
externGroup[i][1] = componentNameStr;
} else {
externGroup[i][1] = null;
}
String driverConfigStr = externList.get(i).getDriverConfig();
if (driverConfigStr != null) {
externGroup[i][2] = driverConfigStr;
} else {
externGroup[i][2] = null;
}
String driverDiagStr = externList.get(i).getDriverDiag();
if (driverDiagStr != null) {
externGroup[i][3] = driverDiagStr;
} else {
externGroup[i][3] = null;
}
}
return externGroup;
}
/** /**
* Retrive SetVirtualAddressMapCallBack names * Retrive SetVirtualAddressMapCallBack names
* *