X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=Tools%2FJava%2FSource%2FGenBuild%2Forg%2Ftianocore%2Fbuild%2Fautogen%2FAutoGen.java;h=2d9178cfdf7aa5e68316e2c4b554dffad812a13a;hb=2c9b03f219d7ebececf0a8e86019fe622ac0cc42;hp=ce6ff6184221a37cb793dd21b9eee2feb51234c0;hpb=700279a971c1f603a72a45455be4b4f842ce39d9;p=mirror_edk2.git diff --git a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java index ce6ff61842..2d9178cfdf 100644 --- a/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java +++ b/Tools/Java/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java @@ -120,6 +120,7 @@ public class AutoGen { private List exitBootServiceList = new ArrayList(); private StringBuffer functionDeclarations = new StringBuffer(10240); + private StringBuffer globalDeclarations = new StringBuffer(10240); // // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable @@ -384,6 +385,7 @@ public class AutoGen { fileBuffer.append(this.myPcdAutogen.getHAutoGenString()); } + fileBuffer.append(globalDeclarations); fileBuffer.append(functionDeclarations); // // Append the #endif at AutoGen.h @@ -673,10 +675,6 @@ public class AutoGen { fileBuffer.append(ToolDefinitions.LINE_SEPARATOR); fileBuffer.append(this.myPcdAutogen.getCAutoGenString()); } - - if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) { - throw new AutoGenException("Failed to generate AutoGen.c !!!"); - } } /** @@ -788,13 +786,13 @@ public class AutoGen { if (entryPointList == null ||entryPointList.length != 1 ) { throw new AutoGenException("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.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n"); - fileBuffer.append(" IN VOID *OldCoreData\r\n"); - fileBuffer.append(" );\r\n\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(entryPointList[0]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n"); + functionDeclarations.append(" IN VOID *OldCoreData\r\n"); + functionDeclarations.append(" );\r\n\r\n"); fileBuffer.append("EFI_STATUS\r\n"); fileBuffer.append("EFIAPI\r\n"); @@ -815,12 +813,12 @@ public class AutoGen { if (entryPointList == null || entryPointList.length != 1) { throw new AutoGenException("Module type = 'DXE_CORE', can have only one module entry point!"); } else { - fileBuffer.append("VOID\r\n"); - fileBuffer.append("EFIAPI\r\n"); - fileBuffer.append(entryPointList[0]); - fileBuffer.append(" (\r\n"); - fileBuffer.append(" IN VOID *HobStart\r\n"); - fileBuffer.append(" );\r\n\r\n"); + functionDeclarations.append("VOID\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(entryPointList[0]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN VOID *HobStart\r\n"); + functionDeclarations.append(" );\r\n\r\n"); fileBuffer.append("VOID\r\n"); fileBuffer.append("EFIAPI\r\n"); @@ -851,13 +849,13 @@ public class AutoGen { break; } 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_FFS_FILE_HEADER *FfsHeader,\r\n"); - fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n"); - fileBuffer.append(" );\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(entryPointList[i]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n"); + functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n"); + functionDeclarations.append(" );\r\n"); entryPointCount++; } @@ -917,13 +915,13 @@ 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"); - fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); - fileBuffer.append(" );\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(entryPointList[i]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n"); + functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); + functionDeclarations.append(" );\r\n"); entryPointCount++; } fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = "); @@ -974,11 +972,11 @@ public class AutoGen { unloadImageCount = 0; if (unloadImageList != null) { for (int i = 0; i < unloadImageList.length; i++) { - fileBuffer.append("EFI_STATUS\r\n"); - fileBuffer.append(unloadImageList[i]); - fileBuffer.append(" (\r\n"); - fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n"); - fileBuffer.append(" );\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append(unloadImageList[i]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n"); + functionDeclarations.append(" );\r\n"); unloadImageCount++; } } @@ -1049,13 +1047,13 @@ 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"); - fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); - fileBuffer.append(" );\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(entryPointList[i]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n"); + functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n"); + functionDeclarations.append(" );\r\n"); entryPointCount++; } @@ -1133,12 +1131,12 @@ public class AutoGen { 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(unloadImageList[i]); - fileBuffer.append(" (\r\n"); - fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n"); - fileBuffer.append(" );\r\n"); + functionDeclarations.append("EFI_STATUS\r\n"); + functionDeclarations.append("EFIAPI\r\n"); + functionDeclarations.append(unloadImageList[i]); + functionDeclarations.append(" (\r\n"); + functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n"); + functionDeclarations.append(" );\r\n"); unloadImageCount++; } } @@ -1802,9 +1800,9 @@ public class AutoGen { // 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"); + globalDeclarations.append("extern EFI_DRIVER_BINDING_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][0]); + globalDeclarations.append(";\r\n"); } } @@ -1816,9 +1814,9 @@ public class AutoGen { 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"); + globalDeclarations.append("extern EFI_COMPONENT_NAME_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][1]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); } @@ -1833,9 +1831,9 @@ public class AutoGen { 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"); + globalDeclarations.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][2]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); } @@ -1850,9 +1848,9 @@ public class AutoGen { 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"); + globalDeclarations.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL "); + globalDeclarations.append(driverBindingGroup[i][3]); + globalDeclarations.append(";\r\n"); } else { throw new AutoGenException("DriverBinding can't be empty!!"); }