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!");
} else {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\r\n");
fileBuffer
@ -814,7 +813,6 @@ public class AutoGen {
} else {
fileBuffer.append("VOID\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\n");
fileBuffer.append(" IN VOID *HobStart\r\n");
@ -851,7 +849,6 @@ public class AutoGen {
}
for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
@ -920,7 +917,6 @@ public class AutoGen {
} else {
for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
@ -987,7 +983,6 @@ public class AutoGen {
if (unloadImageList != null) {
for (int i = 0; i < unloadImageList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
@ -1067,7 +1062,6 @@ public class AutoGen {
for (int i = 0; i < entryPointList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\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.
//
//entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();
//
// Remover duplicate unload entry point.
//
//entryPointList = CommonDefinition.remDupString(entryPointList);
//entryPointCount = 0;
unloadImageCount = 0;
if (unloadImageList != null) {
for (int i = 0; i < unloadImageList.length; i++) {
fileBuffer.append("EFI_STATUS\r\n");
//fileBuffer.append("EFIAPI\r\n");
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
@ -1639,87 +1638,75 @@ public class AutoGen {
throws EdkException {
//
// Check what <extern> contains. And the number of following elements
// under <extern> should be same. 1. DRIVER_BINDING 2. COMPONENT_NAME
// 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC
//
String[] drvBindList = saq.getDriverBindingArray();
// Get the arry of extern. The driverBindingGroup is a 2 dimension array.
// The second dimension is include following element: DriverBinding,
// ComponentName, DriverConfiguration, DriverDiag;
//
String[][] driverBindingGroup = this.saq.getExternProtocolGroup();
//
// If component name protocol,component configuration protocol,
// 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();
// inital BitMask;
//
int BitMask = 0;
//
// Write driver binding protocol extern to autogen.c
//
for (int i = 0; i < drvBindList.length; i++) {
fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
fileBuffer.append(drvBindList[i]);
fileBuffer.append(";\r\n");
for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][0] != null) {
fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][0]);
fileBuffer.append(";\r\n");
}
}
//
// Write component name protocol extern to autogen.c
//
if (compNamList != null && compNamList.length != 0) {
if (drvBindList.length != compNamList.length) {
throw new AutoGenException(
"Different number of Driver Binding and Component Name protocols!");
}
BitMask |= 0x01;
for (int i = 0; i < compNamList.length; i++) {
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
fileBuffer.append(compNamList[i]);
fileBuffer.append(";\r\n");
}
}
for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][1]!= null) {
if (driverBindingGroup[i][0] != null) {
BitMask |= 0x01;
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][1]);
fileBuffer.append(";\r\n");
} else {
throw new AutoGenException("DriverBinding can't be empty!!");
}
}
}
//
// Write driver configration protocol extern to autogen.c
//
if (compConfList != null && compConfList.length != 0) {
if (drvBindList.length != compConfList.length) {
throw new AutoGenException(
"Different number of Driver Binding and Driver Configuration protocols!");
}
BitMask |= 0x02;
for (int i = 0; i < compConfList.length; i++) {
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
fileBuffer.append(compConfList[i]);
fileBuffer.append(";\r\n");
}
}
for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][2] != null) {
if (driverBindingGroup[i][0] != null) {
BitMask |= 0x02;
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][2]);
fileBuffer.append(";\r\n");
} else {
throw new AutoGenException("DriverBinding can't be empty!!");
}
}
}
//
// Write driver dignastic protocol extern to autogen.c
//
if (compDiagList != null && compDiagList.length != 0) {
if (drvBindList.length != compDiagList.length) {
throw new AutoGenException(
"Different number of Driver Binding and Driver Diagnosis protocols!");
}
BitMask |= 0x04;
for (int i = 0; i < compDiagList.length; i++) {
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
fileBuffer.append(compDiagList[i]);
fileBuffer.append(";\r\n");
}
}
for (int i = 0; i < driverBindingGroup.length; i++) {
if (driverBindingGroup[i][3] != null) {
if (driverBindingGroup[i][0] != null) {
BitMask |= 0x04;
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
fileBuffer.append(driverBindingGroup[i][3]);
fileBuffer.append(";\r\n");
} else {
throw new AutoGenException("DriverBinding can't be empty!!");
}
}
}
//
// Write driver module protocol bitmask.
@ -1735,49 +1722,58 @@ public class AutoGen {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
fileBuffer.append(Integer.toString(drvBindList.length));
fileBuffer.append(Integer.toString(driverBindingGroup.length));
fileBuffer.append(";\r\n");
//
// 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[] = {");
for (int i = 0; i < drvBindList.length; i++) {
}
for (int i = 0; i < driverBindingGroup.length; i++) {
if (i != 0) {
fileBuffer.append(",");
}
fileBuffer.append("\r\n {\r\n");
fileBuffer.append("\r\n {\r\n");
fileBuffer.append(" &");
fileBuffer.append(drvBindList[i]);
fileBuffer.append(driverBindingGroup[i][0]);
fileBuffer.append(", \r\n");
if (compNamList != null) {
if (driverBindingGroup[i][1] != null) {
fileBuffer.append(" &");
fileBuffer.append(compNamList[i]);
fileBuffer.append(driverBindingGroup[i][1]);
fileBuffer.append(", \r\n");
} else {
fileBuffer.append(" NULL, \r\n");
}
if (compConfList != null) {
if (driverBindingGroup[i][2] != null) {
fileBuffer.append(" &");
fileBuffer.append(compConfList[i]);
fileBuffer.append(driverBindingGroup[i][2]);
fileBuffer.append(", \r\n");
} else {
fileBuffer.append(" NULL, \r\n");
}
if (compDiagList != null) {
if (driverBindingGroup[i][3] != null) {
fileBuffer.append(" &");
fileBuffer.append(compDiagList[i]);
fileBuffer.append(driverBindingGroup[i][3]);
fileBuffer.append(", \r\n");
} else {
fileBuffer.append(" NULL, \r\n");
}
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.Pattern;
import org.w3c.dom.Node;
import org.tianocore.ExternsDocument.Externs.Extern;
import org.apache.xmlbeans.XmlObject;
import org.apache.xmlbeans.XmlString;
import org.tianocore.BuildOptionsDocument;
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.*;
import org.tianocore.ExternsDocument.Externs;
import org.tianocore.FilenameDocument.Filename;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
import org.tianocore.MsaHeaderDocument.MsaHeader;
import org.tianocore.ProtocolsDocument.Protocols.Protocol;
import org.tianocore.ProtocolsDocument.Protocols.ProtocolNotify;
import org.tianocore.PcdDriverTypes;
import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog;
import org.tianocore.build.autogen.CommonDefinition;
import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.id.PlatformIdentification;
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,
@ -1251,6 +1223,62 @@ public class SurfaceAreaQuery {
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
*