Fixed EDKT318

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1611 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
qouyang 2006-09-25 14:29:57 +00:00
parent b7089db120
commit 4353d8e173
1 changed files with 131 additions and 94 deletions

View File

@ -41,6 +41,7 @@ import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification; import org.tianocore.build.id.PackageIdentification;
import org.tianocore.build.pcd.action.PCDAutoGenAction; import org.tianocore.build.pcd.action.PCDAutoGenAction;
import org.tianocore.common.definitions.ToolDefinitions; import org.tianocore.common.definitions.ToolDefinitions;
import org.tianocore.common.definitions.EdkDefinitions;
import org.tianocore.common.exception.EdkException; import org.tianocore.common.exception.EdkException;
import org.tianocore.common.logger.EdkLog; import org.tianocore.common.logger.EdkLog;
@ -106,10 +107,11 @@ public class AutoGen {
/// ///
/// For non library module, add its library instance's construct and destructor to /// For non library module, add its library instance's construct and destructor to
/// list. /// list. String[0] recode LibConstructor name, String[1] recode Lib instance
/// module type.
/// ///
private List<String> libConstructList = new ArrayList<String>(); private List<String[]> libConstructList = new ArrayList<String[]>();
private List<String> libDestructList = new ArrayList<String>(); private List<String[]> libDestructList = new ArrayList<String[]>();
/// ///
/// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack /// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack
@ -1398,7 +1400,7 @@ public class AutoGen {
String buffer for AutoGen.c String buffer for AutoGen.c
@throws Exception @throws Exception
**/ **/
void LibConstructorToAutogenC(List<String> libInstanceList, void LibConstructorToAutogenC(List<String[]> libInstanceList,
String moduleType, StringBuffer fileBuffer) throws EdkException { String moduleType, StringBuffer fileBuffer) throws EdkException {
boolean isFirst = true; boolean isFirst = true;
@ -1407,44 +1409,54 @@ public class AutoGen {
// module type. // module type.
// //
for (int i = 0; i < libInstanceList.size(); i++) { for (int i = 0; i < libInstanceList.size(); i++) {
switch (CommonDefinition.getModuleType(moduleType)) { if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
case CommonDefinition.ModuleTypeBase: fileBuffer.append("RETURN_STATUS\r\n");
fileBuffer.append("RETURN_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer.append(" VOID\r\n"); fileBuffer.append(" VOID\r\n");
fileBuffer.append(" );\r\n"); fileBuffer.append(" );\r\n");
break; } else {
switch (CommonDefinition.getModuleType(moduleType)) {
case CommonDefinition.ModuleTypeBase:
fileBuffer.append("RETURN_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n");
fileBuffer.append(" VOID\r\n");
fileBuffer.append(" );\r\n");
break;
case CommonDefinition.ModuleTypePeiCore: case CommonDefinition.ModuleTypePeiCore:
case CommonDefinition.ModuleTypePeim: case CommonDefinition.ModuleTypePeim:
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n"); .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n"); .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" );\r\n"); fileBuffer.append(" );\r\n");
break; break;
case CommonDefinition.ModuleTypeDxeCore: case CommonDefinition.ModuleTypeDxeCore:
case CommonDefinition.ModuleTypeDxeDriver: case CommonDefinition.ModuleTypeDxeDriver:
case CommonDefinition.ModuleTypeDxeRuntimeDriver: case CommonDefinition.ModuleTypeDxeRuntimeDriver:
case CommonDefinition.ModuleTypeDxeSmmDriver: case CommonDefinition.ModuleTypeDxeSmmDriver:
case CommonDefinition.ModuleTypeDxeSalDriver: case CommonDefinition.ModuleTypeDxeSalDriver:
case CommonDefinition.ModuleTypeUefiDriver: case CommonDefinition.ModuleTypeUefiDriver:
case CommonDefinition.ModuleTypeUefiApplication: case CommonDefinition.ModuleTypeUefiApplication:
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n"); fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
fileBuffer.append(" );\r\n"); fileBuffer.append(" );\r\n");
break; break;
}
} }
} }
@ -1493,32 +1505,40 @@ public class AutoGen {
fileBuffer.append("\r\n"); fileBuffer.append("\r\n");
isFirst = false; isFirst = false;
} }
switch (CommonDefinition.getModuleType(moduleType)) { if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
case CommonDefinition.ModuleTypeBase:
fileBuffer.append(" Status = "); fileBuffer.append(" Status = ");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append("();\r\n"); fileBuffer.append("();\r\n");
fileBuffer.append(" VOID\r\n"); fileBuffer.append(" VOID\r\n");
break; } else {
case CommonDefinition.ModuleTypePeiCore: switch (CommonDefinition.getModuleType(moduleType)) {
case CommonDefinition.ModuleTypePeim: case CommonDefinition.ModuleTypeBase:
fileBuffer.append(" Status = "); fileBuffer.append(" Status = ");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (FfsHeader, PeiServices);\r\n"); fileBuffer.append("();\r\n");
break; fileBuffer.append(" VOID\r\n");
case CommonDefinition.ModuleTypeDxeCore: break;
case CommonDefinition.ModuleTypeDxeDriver: case CommonDefinition.ModuleTypePeiCore:
case CommonDefinition.ModuleTypeDxeRuntimeDriver: case CommonDefinition.ModuleTypePeim:
case CommonDefinition.ModuleTypeDxeSmmDriver: fileBuffer.append(" Status = ");
case CommonDefinition.ModuleTypeDxeSalDriver: fileBuffer.append(libInstanceList.get(i)[0]);
case CommonDefinition.ModuleTypeUefiDriver: fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
case CommonDefinition.ModuleTypeUefiApplication: break;
fileBuffer.append(" Status = "); case CommonDefinition.ModuleTypeDxeCore:
fileBuffer.append(libInstanceList.get(i)); case CommonDefinition.ModuleTypeDxeDriver:
fileBuffer.append(" (ImageHandle, SystemTable);\r\n"); case CommonDefinition.ModuleTypeDxeRuntimeDriver:
break; case CommonDefinition.ModuleTypeDxeSmmDriver:
default: case CommonDefinition.ModuleTypeDxeSalDriver:
EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!"); case CommonDefinition.ModuleTypeUefiDriver:
case CommonDefinition.ModuleTypeUefiApplication:
fileBuffer.append(" Status = ");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (ImageHandle, SystemTable);\r\n");
break;
default:
EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!");
}
} }
fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n"); fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");
} }
@ -1539,46 +1559,55 @@ public class AutoGen {
String buffer for AutoGen.c String buffer for AutoGen.c
@throws Exception @throws Exception
**/ **/
void LibDestructorToAutogenC(List<String> libInstanceList, void LibDestructorToAutogenC(List<String[]> libInstanceList,
String moduleType, StringBuffer fileBuffer) throws EdkException { String moduleType, StringBuffer fileBuffer) throws EdkException {
boolean isFirst = true; boolean isFirst = true;
for (int i = 0; i < libInstanceList.size(); i++) { for (int i = 0; i < libInstanceList.size(); i++) {
switch (CommonDefinition.getModuleType(moduleType)) { if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
case CommonDefinition.ModuleTypeBase:
fileBuffer.append("RETURN_STATUS\r\n"); fileBuffer.append("RETURN_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer.append(" VOID\r\n"); fileBuffer.append(" VOID\r\n");
fileBuffer.append(" );\r\n"); fileBuffer.append(" );\r\n");
break; } else {
case CommonDefinition.ModuleTypePeiCore: switch (CommonDefinition.getModuleType(moduleType)) {
case CommonDefinition.ModuleTypePeim: case CommonDefinition.ModuleTypeBase:
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("RETURN_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n"); fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n"); fileBuffer.append(" (\r\n");
fileBuffer fileBuffer.append(" VOID\r\n");
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n"); fileBuffer.append(" );\r\n");
fileBuffer break;
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n"); case CommonDefinition.ModuleTypePeiCore:
fileBuffer.append(" );\r\n"); case CommonDefinition.ModuleTypePeim:
break; fileBuffer.append("EFI_STATUS\r\n");
case CommonDefinition.ModuleTypeDxeCore: fileBuffer.append("EFIAPI\r\n");
case CommonDefinition.ModuleTypeDxeDriver: fileBuffer.append(libInstanceList.get(i)[0]);
case CommonDefinition.ModuleTypeDxeRuntimeDriver: fileBuffer.append(" (\r\n");
case CommonDefinition.ModuleTypeDxeSmmDriver: fileBuffer
case CommonDefinition.ModuleTypeDxeSalDriver: .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
case CommonDefinition.ModuleTypeUefiDriver: fileBuffer
case CommonDefinition.ModuleTypeUefiApplication: .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append(" );\r\n");
fileBuffer.append("EFIAPI\r\n"); break;
fileBuffer.append(libInstanceList.get(i)); case CommonDefinition.ModuleTypeDxeCore:
fileBuffer.append(" (\r\n"); case CommonDefinition.ModuleTypeDxeDriver:
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n"); case CommonDefinition.ModuleTypeDxeRuntimeDriver:
fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); case CommonDefinition.ModuleTypeDxeSmmDriver:
fileBuffer.append(" );\r\n"); case CommonDefinition.ModuleTypeDxeSalDriver:
break; case CommonDefinition.ModuleTypeUefiDriver:
case CommonDefinition.ModuleTypeUefiApplication:
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");
fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
fileBuffer.append(" );\r\n");
break;
}
} }
} }
@ -1615,8 +1644,14 @@ public class AutoGen {
fileBuffer.append("\r\n"); fileBuffer.append("\r\n");
isFirst = false; isFirst = false;
} }
if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
fileBuffer.append(" Status = ");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append("();\r\n");
fileBuffer.append(" VOID\r\n");
}
fileBuffer.append(" Status = "); fileBuffer.append(" Status = ");
fileBuffer.append(libInstanceList.get(i)); fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append("(ImageHandle, SystemTable);\r\n"); fileBuffer.append("(ImageHandle, SystemTable);\r\n");
fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n"); fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");
} }
@ -1880,6 +1915,7 @@ public class AutoGen {
String libConstructName = null; String libConstructName = null;
String libDestructName = null; String libDestructName = null;
String libModuleType = null;
String[] setVirtuals = null; String[] setVirtuals = null;
String[] exitBoots = null; String[] exitBoots = null;
@ -1958,6 +1994,7 @@ public class AutoGen {
// //
libConstructName = saq.getLibConstructorName(); libConstructName = saq.getLibConstructorName();
libDestructName = saq.getLibDestructorName(); libDestructName = saq.getLibDestructorName();
libModuleType = saq.getModuleType();
// //
// Collect SetVirtualAddressMapCallBack and // Collect SetVirtualAddressMapCallBack and
@ -1980,13 +2017,13 @@ public class AutoGen {
// Add dependent library instance constructor function. // Add dependent library instance constructor function.
// //
if (libConstructName != null) { if (libConstructName != null) {
this.libConstructList.add(libConstructName); this.libConstructList.add(new String[] {libConstructName, libModuleType});
} }
// //
// Add dependent library instance destructor fuction. // Add dependent library instance destructor fuction.
// //
if (libDestructName != null) { if (libDestructName != null) {
this.libDestructList.add(libDestructName); this.libDestructList.add(new String[] {libDestructName, libModuleType});
} }
} }
} }