private List<String> setVirtalAddList = new ArrayList<String>();\r
private List<String> exitBootServiceList = new ArrayList<String>();\r
\r
+ private StringBuffer functionDeclarations = new StringBuffer(10240);\r
+\r
//\r
// flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable \r
//\r
String[] specList = saq.getExternSpecificaiton();\r
for (int i = 0; i < specList.length; i++) {\r
fileBuffer.append(CommonDefinition.DEFINE + specList[i]\r
- + "\n");\r
+ + "\r\n");\r
}\r
//\r
// Write consumed package's mdouleInfo related .h file to autogen.h\r
//\r
// Write library class's related *.h file to autogen.h.\r
//\r
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED,this.arch);\r
- if (libClassList != null) {\r
+ String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
+ if (libClassList.length > 0) {\r
libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
item = libClassIncludeH.iterator();\r
while (item.hasNext()) {\r
}\r
}\r
\r
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);\r
- if (libClassList != null) {\r
+ libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
+ if (libClassList.length > 0) {\r
libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
item = libClassIncludeH.iterator();\r
while (item.hasNext()) {\r
fileBuffer.append(item.next().toString());\r
}\r
}\r
- fileBuffer.append("\n");\r
+ fileBuffer.append("\r\n");\r
\r
//\r
// If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to\r
if (saq.isHaveTianoR8FlashMap()) {\r
fileBuffer.append(CommonDefinition.INCLUDE);\r
fileBuffer.append(" <");\r
- fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\n");\r
+ fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");\r
copyFlashMapHToDebugDir();\r
}\r
\r
// Write PCD autogen information to AutoGen.h.\r
//\r
if (this.myPcdAutogen != null) {\r
- fileBuffer.append("\n");\r
+ fileBuffer.append("\r\n");\r
fileBuffer.append(this.myPcdAutogen.getHAutoGenString());\r
}\r
\r
+ fileBuffer.append(functionDeclarations);\r
//\r
// Append the #endif at AutoGen.h\r
//\r
- fileBuffer.append("#endif\n");\r
+ fileBuffer.append("#endif\r\n");\r
\r
//\r
// Save string buffer content in AutoGen.h.\r
//\r
\r
fileBuffer.append(guid);\r
- fileBuffer.append("};\n");\r
+ fileBuffer.append("};\r\n");\r
\r
//\r
// Generate library instance consumed protocol, guid, ppi, pcd list.\r
\r
this.myPcdAutogen.execute();\r
if (this.myPcdAutogen != null) {\r
- fileBuffer.append("\n");\r
+ fileBuffer.append("\r\n");\r
fileBuffer.append(this.myPcdAutogen.getCAutoGenString());\r
}\r
\r
fileBuffer.append(CommonDefinition.AUTOGENHBEGIN);\r
String[] specList = saq.getExternSpecificaiton();\r
for (int i = 0; i < specList.length; i++) {\r
- fileBuffer.append(CommonDefinition.DEFINE + specList[i]\r
- + "\n");\r
+ fileBuffer.append(CommonDefinition.DEFINE + specList[i] + "\r\n");\r
}\r
// fileBuffer.append(CommonDefinition.autoGenHLine1);\r
// fileBuffer.append(CommonDefinition.autoGenHLine2);\r
// Write consumed package's mdouleInfo related *.h file to autogen.h.\r
//\r
moduleType = saq.getModuleType();\r
- PackageIdentification[] cosumedPkglist = saq\r
- .getDependencePkg(this.arch);\r
+ PackageIdentification[] cosumedPkglist = saq.getDependencePkg(this.arch);\r
headerFileList = depPkgToAutogenH(cosumedPkglist, moduleType);\r
item = headerFileList.iterator();\r
while (item.hasNext()) {\r
//\r
// Write library class's related *.h file to autogen.h\r
//\r
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);\r
+ String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
if (libClassList != null) {\r
libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
item = libClassIncludeH.iterator();\r
}\r
}\r
\r
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);\r
+ libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
if (libClassList != null) {\r
libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
item = libClassIncludeH.iterator();\r
if (saq.isHaveTianoR8FlashMap()) {\r
fileBuffer.append(CommonDefinition.INCLUDE);\r
fileBuffer.append(" <");\r
- fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\n");\r
+ fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");\r
copyFlashMapHToDebugDir();\r
}\r
\r
// Write PCD information to library AutoGen.h.\r
//\r
if (this.myPcdAutogen != null) {\r
- fileBuffer.append("\n");\r
+ fileBuffer.append("\r\n");\r
fileBuffer.append(this.myPcdAutogen.getHAutoGenString());\r
}\r
//\r
// generate function prototype for constructor and destructor\r
// \r
- LibConstructorToAutogenH(moduleType, fileBuffer);\r
- LibDestructorToAutogenH(moduleType, fileBuffer);\r
+ LibConstructorToAutogenH(moduleType);\r
+ LibDestructorToAutogenH(moduleType);\r
+ ExternCallBackToAutoGenH(moduleType);\r
+ fileBuffer.append(functionDeclarations);\r
//\r
// Append the #endif at AutoGen.h\r
//\r
- fileBuffer.append("#endif\n");\r
+ fileBuffer.append("#endif\r\n");\r
//\r
// Save content of string buffer to AutoGen.h file.\r
//\r
String includeNameStr = includeName[j];\r
if (includeNameStr != null) {\r
str = CommonDefinition.INCLUDE + " " + "<";\r
- str = str + includeNameStr + ">\n";\r
+ str = str + includeNameStr + ">\r\n";\r
includeStrList.add(str);\r
includeNameStr = null;\r
}\r
+ packageNameList[i]\r
+ "] declaration in any SPD package. ");\r
} else if (!pkgHeader.equalsIgnoreCase("")) {\r
- includeStr = CommonDefinition.INCLUDE + " <" + pkgHeader\r
- + ">\n";\r
+ includeStr = CommonDefinition.INCLUDE + " <" + pkgHeader + ">\r\n";\r
includeStrList.add(includeStr);\r
}\r
}\r
throws EdkException {\r
\r
String typeStr = saq.getModuleType();\r
- String debugStr = "DEBUG ((EFI_D_INFO | EFI_D_LOAD, \"Module Entry Point (%s) 0x%%p\\n\", (VOID *)(UINTN)%s));\n";\r
+ String debugStr = "DEBUG ((EFI_D_INFO | EFI_D_LOAD, \"Module Entry Point (%s) 0x%%p\\n\", (VOID *)(UINTN)%s));\r\n";\r
int unloadImageCount = 0;\r
int entryPointCount = 0;\r
\r
\r
case CommonDefinition.ModuleTypePeiCore:\r
if (entryPointList == null ||entryPointList.length != 1 ) {\r
- throw new AutoGenException(\r
- "Module type = 'PEI_CORE', can have only one module entry point!");\r
+ throw new AutoGenException("Module type = 'PEI_CORE', can have only one module entry point!");\r
} else {\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\n");\r
- fileBuffer.append(" IN VOID *OldCoreData\n");\r
- fileBuffer.append(" );\n\n");\r
-\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\n");\r
- fileBuffer.append(" IN VOID *OldCoreData\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");\r
+ fileBuffer.append(" IN VOID *OldCoreData\r\n");\r
+ fileBuffer.append(" );\r\n\r\n");\r
+\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");\r
+ fileBuffer.append(" IN VOID *OldCoreData\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
fileBuffer.append(" return ");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (PeiStartupDescriptor, OldCoreData);\n");\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append(" (PeiStartupDescriptor, OldCoreData);\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
}\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeCore:\r
- fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\n");\r
+ fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");\r
if (entryPointList == null || entryPointList.length != 1) {\r
throw new AutoGenException("Module type = 'DXE_CORE', can have only one module entry point!");\r
} else {\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN VOID *HobStart\n");\r
- fileBuffer.append(" );\n\n");\r
-\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN VOID *HobStart\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN VOID *HobStart\r\n");\r
+ fileBuffer.append(" );\r\n\r\n");\r
+\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN VOID *HobStart\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
fileBuffer.append(" ");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (HobStart);\n");\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append(" (HobStart);\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
}\r
break;\r
\r
case CommonDefinition.ModuleTypePeim:\r
entryPointCount = 0;\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\n");\r
+ fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");\r
if (entryPointList == null || entryPointList.length == 0) {\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
- fileBuffer.append(" return EFI_SUCCESS;\n");\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
+ fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
break;\r
}\r
for (int i = 0; i < entryPointList.length; i++) {\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" );\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ fileBuffer.append(" );\r\n");\r
entryPointCount++;\r
}\r
\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
if (entryPointCount == 1) {\r
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));\r
fileBuffer.append(" return ");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (FfsHeader, PeiServices);\n");\r
+ fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
} else {\r
- fileBuffer.append(" EFI_STATUS Status;\n");\r
- fileBuffer.append(" EFI_STATUS CombinedStatus;\n\n");\r
- fileBuffer.append(" CombinedStatus = EFI_LOAD_ERROR;\n\n");\r
+ fileBuffer.append(" EFI_STATUS Status;\r\n");\r
+ fileBuffer.append(" EFI_STATUS CombinedStatus;\r\n\r\n");\r
+ fileBuffer.append(" CombinedStatus = EFI_LOAD_ERROR;\r\n\r\n");\r
for (int i = 0; i < entryPointList.length; i++) {\r
if (!entryPointList[i].equals("")) {\r
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (FfsHeader, PeiServices);\n");\r
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\n");\r
- fileBuffer.append(" CombinedStatus = Status;\n");\r
- fileBuffer.append(" }\n\n");\r
+ fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
+ fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\r\n");\r
+ fileBuffer.append(" CombinedStatus = Status;\r\n");\r
+ fileBuffer.append(" }\r\n\r\n");\r
} else {\r
break;\r
}\r
}\r
- fileBuffer.append(" return CombinedStatus;\n");\r
+ fileBuffer.append(" return CombinedStatus;\r\n");\r
}\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeSmmDriver:\r
if (entryPointList == null || entryPointList.length == 0) {\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\n");\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
- fileBuffer.append(" return EFI_SUCCESS;\n");\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append(";\r\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
+ fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
\r
} else {\r
for (int i = 0; i < entryPointList.length; i++) {\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" );\r\n");\r
entryPointCount++;\r
}\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\n");\r
- fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\n");\r
- fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\n\n");\r
-\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append(";\r\n");\r
+ fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");\r
+ fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");\r
+\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
\r
for (int i = 0; i < entryPointList.length; i++) {\r
- fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\n");\r
+ fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");\r
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));\r
fileBuffer.append(" ExitDriver (");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (ImageHandle, SystemTable));\n");\r
- fileBuffer.append(" ASSERT (FALSE);\n");\r
- fileBuffer.append(" }\n");\r
+ fileBuffer.append(" (ImageHandle, SystemTable));\r\n");\r
+ fileBuffer.append(" ASSERT (FALSE);\r\n");\r
+ fileBuffer.append(" }\r\n");\r
}\r
- fileBuffer.append(" return mDriverEntryPointStatus;\n");\r
- fileBuffer.append("}\n\n");\r
-\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ExitDriver (\n");\r
- fileBuffer.append(" IN EFI_STATUS Status\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\n");\r
- fileBuffer.append(" mDriverEntryPointStatus = Status;\n");\r
- fileBuffer.append(" }\n");\r
- fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\n");\r
- fileBuffer.append(" ASSERT (FALSE);\n");\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append(" return mDriverEntryPointStatus;\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
+\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ExitDriver (\r\n");\r
+ fileBuffer.append(" IN EFI_STATUS Status\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
+ fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");\r
+ fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");\r
+ fileBuffer.append(" }\r\n");\r
+ fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");\r
+ fileBuffer.append(" ASSERT (FALSE);\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
}\r
\r
\r
//\r
// Add "ModuleUnloadImage" for DxeSmmDriver module type;\r
//\r
- //entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();\r
- //entryPointList = CommonDefinition.remDupString(entryPointList);\r
- //entryPointCount = 0;\r
\r
unloadImageCount = 0;\r
if (unloadImageList != null) {\r
for (int i = 0; i < unloadImageList.length; i++) {\r
- fileBuffer.append("EFI_STATUS\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\n");\r
- fileBuffer.append(" );\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");\r
+ fileBuffer.append(" );\r\n");\r
unloadImageCount++;\r
}\r
}\r
\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");\r
fileBuffer.append(Integer.toString(unloadImageCount));\r
- fileBuffer.append(";\n\n");\r
+ fileBuffer.append(";\r\n\r\n");\r
\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleUnloadList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\n");\r
- fileBuffer.append(" )\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleUnloadList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");\r
+ fileBuffer.append(" )\r\n");\r
+ fileBuffer.append("{\r\n");\r
\r
if (unloadImageCount == 0) {\r
- fileBuffer.append(" return EFI_SUCCESS;\n");\r
+ fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
} else if (unloadImageCount == 1) {\r
fileBuffer.append(" return ");\r
fileBuffer.append(unloadImageList[0]);\r
- fileBuffer.append("(ImageHandle);\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
} else {\r
- fileBuffer.append(" EFI_STATUS Status;\n\n");\r
- fileBuffer.append(" Status = EFI_SUCCESS;\n\n");\r
+ fileBuffer.append(" EFI_STATUS Status;\r\n\r\n");\r
+ fileBuffer.append(" Status = EFI_SUCCESS;\r\n\r\n");\r
for (int i = 0; i < unloadImageList.length; i++) {\r
if (i == 0) {\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
} else {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\n");\r
+ fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
fileBuffer.append(" ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
- fileBuffer.append(" } else {\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
+ fileBuffer.append(" } else {\r\n");\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
- fileBuffer.append(" }\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
+ fileBuffer.append(" }\r\n");\r
}\r
}\r
- fileBuffer.append(" return Status;\n");\r
+ fileBuffer.append(" return Status;\r\n");\r
}\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
entryPointCount = 0;\r
- fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\n");\r
+ fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");\r
//\r
// If entry point is null, create a empty ProcessModuleEntryPointList function.\r
//\r
if (entryPointList == null || entryPointList.length == 0) {\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\n");\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
- fileBuffer.append(" return EFI_SUCCESS;\n");\r
- fileBuffer.append("}\n");\r
+ fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\r\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
+ fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
+ fileBuffer.append("}\r\n");\r
\r
} else {\r
for (int i = 0; i < entryPointList.length; i++) {\r
-\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" );\r\n");\r
entryPointCount++;\r
}\r
\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
if (entryPointCount > 1) {\r
- fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\n");\r
- fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\n");\r
+ fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");\r
+ fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");\r
}\r
- fileBuffer.append("\n");\r
+ fileBuffer.append("\r\n");\r
\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
\r
if (entryPointCount == 1) {\r
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));\r
fileBuffer.append(" return ");\r
fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append(" (ImageHandle, SystemTable);\n");\r
+ fileBuffer.append(" (ImageHandle, SystemTable);\r\n");\r
} else {\r
for (int i = 0; i < entryPointList.length; i++) {\r
if (!entryPointList[i].equals("")) {\r
- fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\n");\r
+ fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");\r
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));\r
fileBuffer.append(" ExitDriver (");\r
fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (ImageHandle, SystemTable));\n");\r
- fileBuffer.append(" ASSERT (FALSE);\n");\r
- fileBuffer.append(" }\n");\r
+ fileBuffer.append(" (ImageHandle, SystemTable));\r\n");\r
+ fileBuffer.append(" ASSERT (FALSE);\r\n");\r
+ fileBuffer.append(" }\r\n");\r
} else {\r
break;\r
}\r
}\r
- fileBuffer.append(" return mDriverEntryPointStatus;\n");\r
+ fileBuffer.append(" return mDriverEntryPointStatus;\r\n");\r
}\r
- fileBuffer.append("}\n\n");\r
-\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ExitDriver (\n");\r
- fileBuffer.append(" IN EFI_STATUS Status\n");\r
- fileBuffer.append(" )\n\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
+\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ExitDriver (\r\n");\r
+ fileBuffer.append(" IN EFI_STATUS Status\r\n");\r
+ fileBuffer.append(" )\r\n\r\n");\r
+ fileBuffer.append("{\r\n");\r
if (entryPointCount <= 1) {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\n");\r
- fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\n");\r
- fileBuffer.append(" }\n");\r
+ fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
+ fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");\r
+ fileBuffer.append(" }\r\n");\r
fileBuffer\r
- .append(" gBS->Exit (gImageHandle, Status, 0, NULL);\n");\r
+ .append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");\r
} else {\r
- fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\n");\r
- fileBuffer.append(" mDriverEntryPointStatus = Status;\n");\r
- fileBuffer.append(" }\n");\r
- fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\n");\r
- fileBuffer.append(" ASSERT (FALSE);\n");\r
+ fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");\r
+ fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");\r
+ fileBuffer.append(" }\r\n");\r
+ fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");\r
+ fileBuffer.append(" ASSERT (FALSE);\r\n");\r
}\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
}\r
\r
//\r
unloadImageCount = 0;\r
if (unloadImageList != null) {\r
for (int i = 0; i < unloadImageList.length; i++) {\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\n");\r
- fileBuffer.append(" );\n");\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");\r
+ fileBuffer.append(" );\r\n");\r
unloadImageCount++;\r
}\r
}\r
\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");\r
fileBuffer.append(Integer.toString(unloadImageCount));\r
- fileBuffer.append(";\n\n");\r
+ fileBuffer.append(";\r\n\r\n");\r
\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessModuleUnloadList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle\n");\r
- fileBuffer.append(" )\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessModuleUnloadList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");\r
+ fileBuffer.append(" )\r\n");\r
+ fileBuffer.append("{\r\n");\r
\r
if (unloadImageCount == 0) {\r
- fileBuffer.append(" return EFI_SUCCESS;\n");\r
+ fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
} else if (unloadImageCount == 1) {\r
fileBuffer.append(" return ");\r
fileBuffer.append(unloadImageList[0]);\r
- fileBuffer.append("(ImageHandle);\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
} else {\r
- fileBuffer.append(" EFI_STATUS Status;\n\n");\r
- fileBuffer.append(" Status = EFI_SUCCESS;\n\n");\r
+ fileBuffer.append(" EFI_STATUS Status;\r\n\r\n");\r
+ fileBuffer.append(" Status = EFI_SUCCESS;\r\n\r\n");\r
for (int i = 0; i < unloadImageList.length; i++) {\r
if (i == 0) {\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
} else {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\n");\r
+ fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
fileBuffer.append(" ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
- fileBuffer.append(" } else {\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
+ fileBuffer.append(" } else {\r\n");\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\n");\r
- fileBuffer.append(" }\n");\r
+ fileBuffer.append("(ImageHandle);\r\n");\r
+ fileBuffer.append(" }\r\n");\r
}\r
}\r
- fileBuffer.append(" return Status;\n");\r
+ fileBuffer.append(" return Status;\r\n");\r
}\r
- fileBuffer.append("}\n\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
break;\r
}\r
}\r
ppiKeyWord = ppiIterator.next().toString();\r
cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, ppiKeyWord);\r
if (cNameGuid != null) {\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
fileBuffer.append(cNameGuid[0]);\r
fileBuffer.append(" = { ");\r
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
protocolKeyWord = protocolIterator.next().toString();\r
cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, protocolKeyWord);\r
if (cNameGuid != null) {\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
fileBuffer.append(cNameGuid[0]);\r
fileBuffer.append(" = { ");\r
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);\r
\r
if (cNameGuid != null) {\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");\r
fileBuffer.append(cNameGuid[0]);\r
fileBuffer.append(" = { ");\r
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));\r
//\r
// Add library constructor to AutoGen.c\r
//\r
- LibConstructorToAutogenC(libConstructList, moduleType,\r
- fileBuffer/* autogenC */);\r
+ LibConstructorToAutogenC(libConstructList, moduleType, fileBuffer);\r
//\r
// Add library destructor to AutoGen.c\r
//\r
- LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer/* autogenC */);\r
+ LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer);\r
}\r
\r
/**\r
String buffer for AutoGen.c\r
@throws Exception\r
**/\r
- void LibConstructorToAutogenH(String moduleType, StringBuffer fileBuffer) throws EdkException {\r
+ void LibConstructorToAutogenH(String moduleType) throws EdkException {\r
boolean isFirst = true;\r
\r
//\r
// module type.\r
//\r
if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libConstructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libConstructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
} else {\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libConstructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libConstructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libConstructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libConstructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libConstructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libConstructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
}\r
String buffer for AutoGen.c\r
@throws Exception\r
**/\r
- void LibDestructorToAutogenH(String moduleType, StringBuffer fileBuffer) throws EdkException {\r
+ void LibDestructorToAutogenH(String moduleType) throws EdkException {\r
boolean isFirst = true;\r
String libDestructName = saq.getLibDestructorName();\r
if (libDestructName == null) {\r
}\r
\r
if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libDestructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libDestructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
} else {\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libDestructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libDestructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libDestructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libDestructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeDriver:\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libDestructName);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libDestructName);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
}\r
}\r
//\r
for (int i = 0; i < libInstanceList.size(); i++) {\r
if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
} else {\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
\r
}\r
//\r
// Add ProcessLibraryConstructorList in AutoGen.c\r
//\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessLibraryConstructorList (\n");\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessLibraryConstructorList (\r\n");\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
- fileBuffer.append(" VOID\n");\r
+ fileBuffer.append(" VOID\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
+ fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
fileBuffer\r
- .append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
+ .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
break;\r
\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
break;\r
}\r
\r
- fileBuffer.append(" )\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append(" )\r\n");\r
+ fileBuffer.append("{\r\n");\r
//\r
// If no constructor function, return EFI_SUCCESS.\r
//\r
- //if (libInstanceList.size() == 0){\r
- // fileBuffer.append(" return EFI_SUCCESS;\n");\r
- //}\r
for (int i = 0; i < libInstanceList.size(); i++) {\r
if (isFirst) {\r
- fileBuffer.append(" EFI_STATUS Status;\n");\r
- fileBuffer.append(" Status = EFI_SUCCESS;\n");\r
- fileBuffer.append("\n");\r
+ fileBuffer.append(" EFI_STATUS Status;\r\n");\r
+ fileBuffer.append(" Status = EFI_SUCCESS;\r\n");\r
+ fileBuffer.append("\r\n");\r
isFirst = false;\r
}\r
if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append("();\n");\r
+ fileBuffer.append("();\r\n");\r
} else {\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append("();\n");\r
+ fileBuffer.append("();\r\n");\r
break;\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (FfsHeader, PeiServices);\n");\r
+ fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
break;\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (ImageHandle, SystemTable);\n");\r
+ fileBuffer.append(" (ImageHandle, SystemTable);\r\n");\r
break;\r
default:\r
EdkLog.log(EdkLog.EDK_INFO,"Autogen doesn't know how to deal with module type - " + moduleType + "!");\r
}\r
\r
}\r
- fileBuffer.append(" ASSERT_EFI_ERROR (Status);\n");\r
+ fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");\r
}\r
- fileBuffer.append("}\n");\r
+ fileBuffer.append("}\r\n");\r
}\r
\r
/**\r
boolean isFirst = true;\r
for (int i = 0; i < libInstanceList.size(); i++) {\r
if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
} else {\r
switch (CommonDefinition.getModuleType(moduleType)) {\r
case CommonDefinition.ModuleTypeBase:\r
- fileBuffer.append("RETURN_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" VOID\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("RETURN_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" VOID\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
case CommonDefinition.ModuleTypePeiCore:\r
case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ functionDeclarations.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
case CommonDefinition.ModuleTypeDxeCore:\r
case CommonDefinition.ModuleTypeDxeDriver:\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append("EFI_STATUS\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" );\n");\r
+ functionDeclarations.append("EFI_STATUS\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(libInstanceList.get(i)[0]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ functionDeclarations.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ functionDeclarations.append(" );\r\n");\r
break;\r
}\r
}\r
case CommonDefinition.ModuleTypeDxeSalDriver:\r
case CommonDefinition.ModuleTypeUefiDriver:\r
case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ProcessLibraryDestructorList (\n");\r
- fileBuffer.append(" IN EFI_HANDLE ImageHandle,\n");\r
- fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\n");\r
- fileBuffer.append(" )\n");\r
- fileBuffer.append("{\n");\r
+ fileBuffer.append("VOID\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append("ProcessLibraryDestructorList (\r\n");\r
+ fileBuffer.append(" IN EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");\r
+ fileBuffer.append(" )\r\n");\r
+ fileBuffer.append("{\r\n");\r
//\r
// If no library destructor function, return EFI_SUCCESS.\r
//\r
\r
for (int i = 0; i < libInstanceList.size(); i++) {\r
if (isFirst) {\r
- fileBuffer.append(" EFI_STATUS Status;\n");\r
- fileBuffer.append(" Status = EFI_SUCCESS;\n");\r
- fileBuffer.append("\n");\r
+ fileBuffer.append(" EFI_STATUS Status;\r\n");\r
+ fileBuffer.append(" Status = EFI_SUCCESS;\r\n");\r
+ fileBuffer.append("\r\n");\r
isFirst = false;\r
}\r
if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append("();\n");\r
- fileBuffer.append(" VOID\n");\r
+ fileBuffer.append("();\r\n");\r
+ fileBuffer.append(" VOID\r\n");\r
} else {\r
fileBuffer.append(" Status = ");\r
fileBuffer.append(libInstanceList.get(i)[0]);\r
- fileBuffer.append("(ImageHandle, SystemTable);\n");\r
- fileBuffer.append(" ASSERT_EFI_ERROR (Status);\n");\r
+ fileBuffer.append("(ImageHandle, SystemTable);\r\n");\r
+ fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");\r
}\r
}\r
- fileBuffer.append("}\n");\r
+ fileBuffer.append("}\r\n");\r
break;\r
}\r
}\r
if (driverBindingGroup[i][0] != null) {\r
fileBuffer.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
fileBuffer.append(driverBindingGroup[i][0]);\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
}\r
}\r
\r
BitMask |= 0x01;\r
fileBuffer.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
fileBuffer.append(driverBindingGroup[i][1]);\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
} else {\r
throw new AutoGenException("DriverBinding can't be empty!!");\r
}\r
BitMask |= 0x02;\r
fileBuffer.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
fileBuffer.append(driverBindingGroup[i][2]);\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
} else {\r
throw new AutoGenException("DriverBinding can't be empty!!");\r
}\r
BitMask |= 0x04;\r
fileBuffer.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
fileBuffer.append(driverBindingGroup[i][3]);\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
} else {\r
throw new AutoGenException("DriverBinding can't be empty!!");\r
}\r
//\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");\r
fileBuffer.append(Integer.toString(BitMask));\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
\r
//\r
// Write driver module protocol list entry\r
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");\r
\r
fileBuffer.append(Integer.toString(driverBindingGroup.length));\r
- fileBuffer.append(";\n");\r
+ fileBuffer.append(";\r\n");\r
\r
//\r
// Write drive module protocol list to autogen.c\r
//\r
// DriverBinding\r
// \r
- fileBuffer.append("\n {\n");\r
+ fileBuffer.append("\r\n {\r\n");\r
fileBuffer.append(" &");\r
fileBuffer.append(driverBindingGroup[i][0]);\r
- fileBuffer.append(", \n");\r
+ fileBuffer.append(", \r\n");\r
\r
//\r
// ComponentName\r
if (driverBindingGroup[i][1] != null && componentNamePcd != true) {\r
fileBuffer.append(" &");\r
fileBuffer.append(driverBindingGroup[i][1]);\r
- fileBuffer.append(", \n");\r
+ fileBuffer.append(", \r\n");\r
} else {\r
- fileBuffer.append(" NULL, \n");\r
+ fileBuffer.append(" NULL, \r\n");\r
}\r
\r
//\r
if (driverBindingGroup[i][2] != null) {\r
fileBuffer.append(" &");\r
fileBuffer.append(driverBindingGroup[i][2]);\r
- fileBuffer.append(", \n");\r
+ fileBuffer.append(", \r\n");\r
} else {\r
- fileBuffer.append(" NULL, \n");\r
+ fileBuffer.append(" NULL, \r\n");\r
}\r
\r
//\r
if (driverBindingGroup[i][3] != null && driverDiagnostPcd != true) {\r
fileBuffer.append(" &");\r
fileBuffer.append(driverBindingGroup[i][3]);\r
- fileBuffer.append(", \n");\r
+ fileBuffer.append(", \r\n");\r
} else {\r
- fileBuffer.append(" NULL, \n");\r
+ fileBuffer.append(" NULL, \r\n");\r
}\r
fileBuffer.append(" }");\r
}\r
\r
if (driverBindingGroup.length > 0) {\r
- fileBuffer.append("\n};\n");\r
+ fileBuffer.append("\r\n};\r\n");\r
+ }\r
+ }\r
+\r
+ /**\r
+ ExternCallBackToAutoGenC\r
+ \r
+ This function adds <SetVirtualAddressMapCallBack> and\r
+ <ExitBootServicesCallBack> infomation to AutoGen.c\r
+ \r
+ @param fileBuffer\r
+ String buffer for AutoGen.c\r
+ @throws BuildException\r
+ **/\r
+ void ExternCallBackToAutoGenH(String moduleType)\r
+ throws EdkException {\r
+ //\r
+ // Collect module's <SetVirtualAddressMapCallBack> and\r
+ // <ExitBootServiceCallBack> and add to setVirtualAddList\r
+ // exitBootServiceList.\r
+ //\r
+ String[] setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
+ String[] exitBoots = saq.getExitBootServicesCallBackArray();\r
+ //\r
+ // Add c code in autogen.c which relate to <SetVirtualAddressMapCallBack>\r
+ // and <ExitBootServicesCallBack>\r
+ //\r
+ switch (CommonDefinition.getModuleType(moduleType)) {\r
+ case CommonDefinition.ModuleTypeDxeDriver:\r
+ case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
+ case CommonDefinition.ModuleTypeDxeSalDriver:\r
+ case CommonDefinition.ModuleTypeUefiDriver:\r
+ case CommonDefinition.ModuleTypeUefiApplication:\r
+ //\r
+ // Write SetVirtualAddressMap function definition.\r
+ //\r
+ for (int i = 0; setVirtuals != null && i < setVirtuals.length; i++) {\r
+ if (setVirtuals[i].equalsIgnoreCase("")) {\r
+ continue;\r
+ }\r
+ functionDeclarations.append("VOID\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(setVirtuals[i]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_EVENT Event,\r\n");\r
+ functionDeclarations.append(" IN VOID *Context\r\n");\r
+ functionDeclarations.append(" );\r\n\r\n");\r
+ }\r
+\r
+ //\r
+ // Write DriverExitBootServices function definition.\r
+ //\r
+ for (int i = 0; exitBoots != null && i < exitBoots.length; i++) {\r
+ if (exitBoots[i].equalsIgnoreCase("")) {\r
+ continue;\r
+ }\r
+\r
+ functionDeclarations.append("VOID\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(exitBoots[i]);\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_EVENT Event,\r\n");\r
+ functionDeclarations.append(" IN VOID *Context\r\n");\r
+ functionDeclarations.append(" );\r\n\r\n");\r
+ }\r
+ break;\r
+ default:\r
+ break;\r
}\r
}\r
\r
private void collectLibInstanceInfo() throws EdkException{\r
int index;\r
\r
+ String moduleType = moduleId.getModuleType();\r
String libConstructName = null;\r
String libDestructName = null;\r
String libModuleType = null;\r
String[] exitBoots = null;\r
\r
ModuleIdentification[] libraryIdList = saq.getLibraryInstance(this.arch);\r
+ if (libraryIdList.length <= 0) {\r
+ return;\r
+ }\r
+ //\r
+ // Reorder library instance sequence.\r
+ //\r
+ AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList, this.arch);\r
+ List<ModuleIdentification> orderList = libOrder.orderLibInstance();\r
+ //\r
+ // Process library instance one by one.\r
+ //\r
+ for (int i = 0; i < orderList.size(); i++) {\r
+ //\r
+ // Get library instance basename.\r
+ //\r
+ ModuleIdentification libInstanceId = orderList.get(i);\r
\r
- if (libraryIdList != null) {\r
//\r
- // Reorder library instance sequence.\r
+ // Get override map\r
//\r
- AutogenLibOrder libOrder = new AutogenLibOrder(libraryIdList,\r
- this.arch);\r
- List<ModuleIdentification> orderList = libOrder\r
- .orderLibInstance();\r
\r
- if (orderList != null) {\r
- //\r
- // Process library instance one by one.\r
- //\r
- for (int i = 0; i < orderList.size(); i++) {\r
- //\r
- // Get library instance basename.\r
- //\r
- ModuleIdentification libInstanceId = orderList.get(i);\r
-\r
- //\r
- // Get override map\r
- //\r
-\r
- Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
- saq.push(libDoc);\r
- //\r
- // Get <PPis>, <Protocols>, <Guids> list of this library\r
- // instance.\r
- //\r
- String[] ppiList = saq.getPpiArray(this.arch);\r
- String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
- String[] protocolList = saq.getProtocolArray(this.arch);\r
- String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
- String[] guidList = saq.getGuidEntryArray(this.arch);\r
- PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
-\r
- //\r
- // Add those ppi, protocol, guid in global ppi,\r
- // protocol, guid\r
- // list.\r
- //\r
- for (index = 0; index < ppiList.length; index++) {\r
- this.mPpiList.add(ppiList[index]);\r
- }\r
+ Map<String, XmlObject> libDoc = GlobalData.getDoc(libInstanceId, this.arch);\r
+ saq.push(libDoc);\r
+ //\r
+ // check if the library instance support current module\r
+ // \r
+ String[] libraryClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED,\r
+ this.arch,\r
+ moduleType\r
+ );\r
+ if (libraryClassList.length <= 0) {\r
+ throw new EdkException("Library instance " + libInstanceId.getName() \r
+ + " doesn't support module type " + moduleType);\r
+ }\r
+ //\r
+ // Get <PPis>, <Protocols>, <Guids> list of this library\r
+ // instance.\r
+ //\r
+ String[] ppiList = saq.getPpiArray(this.arch);\r
+ String[] ppiNotifyList = saq.getPpiNotifyArray(this.arch);\r
+ String[] protocolList = saq.getProtocolArray(this.arch);\r
+ String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);\r
+ String[] guidList = saq.getGuidEntryArray(this.arch);\r
+ PackageIdentification[] pkgList = saq.getDependencePkg(this.arch);\r
\r
- for (index = 0; index < ppiNotifyList.length; index++) {\r
- this.mPpiList.add(ppiNotifyList[index]);\r
- }\r
+ //\r
+ // Add those ppi, protocol, guid in global ppi,\r
+ // protocol, guid\r
+ // list.\r
+ //\r
+ for (index = 0; index < ppiList.length; index++) {\r
+ this.mPpiList.add(ppiList[index]);\r
+ }\r
\r
- for (index = 0; index < protocolList.length; index++) {\r
- this.mProtocolList.add(protocolList[index]);\r
- }\r
+ for (index = 0; index < ppiNotifyList.length; index++) {\r
+ this.mPpiList.add(ppiNotifyList[index]);\r
+ }\r
\r
- for (index = 0; index < protocolNotifyList.length; index++) {\r
- this.mProtocolList.add(protocolNotifyList[index]);\r
- }\r
+ for (index = 0; index < protocolList.length; index++) {\r
+ this.mProtocolList.add(protocolList[index]);\r
+ }\r
\r
- for (index = 0; index < guidList.length; index++) {\r
- this.mGuidList.add(guidList[index]);\r
- }\r
- for (index = 0; index < pkgList.length; index++) {\r
- if (!this.mDepPkgList.contains(pkgList[index])) {\r
- this.mDepPkgList.add(pkgList[index]);\r
- }\r
- }\r
+ for (index = 0; index < protocolNotifyList.length; index++) {\r
+ this.mProtocolList.add(protocolNotifyList[index]);\r
+ }\r
\r
- //\r
- // If not yet parse this library instance's constructor\r
- // element,parse it.\r
- //\r
- libConstructName = saq.getLibConstructorName();\r
- libDestructName = saq.getLibDestructorName();\r
- libModuleType = saq.getModuleType();\r
-\r
- //\r
- // Collect SetVirtualAddressMapCallBack and\r
- // ExitBootServiceCallBack.\r
- //\r
- setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
- exitBoots = saq.getExitBootServicesCallBackArray();\r
- if (setVirtuals != null) {\r
- for (int j = 0; j < setVirtuals.length; j++) {\r
- this.setVirtalAddList.add(setVirtuals[j]);\r
- }\r
- }\r
- if (exitBoots != null) {\r
- for (int k = 0; k < exitBoots.length; k++) {\r
- this.exitBootServiceList.add(exitBoots[k]);\r
- }\r
- }\r
- saq.pop();\r
- //\r
- // Add dependent library instance constructor function.\r
- //\r
- if (libConstructName != null) {\r
- this.libConstructList.add(new String[] {libConstructName, libModuleType});\r
- }\r
- //\r
- // Add dependent library instance destructor fuction.\r
- //\r
- if (libDestructName != null) {\r
- this.libDestructList.add(new String[] {libDestructName, libModuleType});\r
- }\r
+ for (index = 0; index < guidList.length; index++) {\r
+ this.mGuidList.add(guidList[index]);\r
+ }\r
+ for (index = 0; index < pkgList.length; index++) {\r
+ if (!this.mDepPkgList.contains(pkgList[index])) {\r
+ this.mDepPkgList.add(pkgList[index]);\r
}\r
}\r
+\r
+ //\r
+ // If not yet parse this library instance's constructor\r
+ // element,parse it.\r
+ //\r
+ libConstructName = saq.getLibConstructorName();\r
+ libDestructName = saq.getLibDestructorName();\r
+ libModuleType = saq.getModuleType();\r
+\r
+ //\r
+ // Collect SetVirtualAddressMapCallBack and\r
+ // ExitBootServiceCallBack.\r
+ //\r
+ setVirtuals = saq.getSetVirtualAddressMapCallBackArray();\r
+ exitBoots = saq.getExitBootServicesCallBackArray();\r
+ if (setVirtuals != null) {\r
+ for (int j = 0; j < setVirtuals.length; j++) {\r
+ this.setVirtalAddList.add(setVirtuals[j]);\r
+ }\r
+ }\r
+ if (exitBoots != null) {\r
+ for (int k = 0; k < exitBoots.length; k++) {\r
+ this.exitBootServiceList.add(exitBoots[k]);\r
+ }\r
+ }\r
+ saq.pop();\r
+ //\r
+ // Add dependent library instance constructor function.\r
+ //\r
+ if (libConstructName != null) {\r
+ this.libConstructList.add(new String[] {libConstructName, libModuleType});\r
+ }\r
+ //\r
+ // Add dependent library instance destructor fuction.\r
+ //\r
+ if (libDestructName != null) {\r
+ this.libDestructList.add(new String[] {libDestructName, libModuleType});\r
+ }\r
}\r
}\r
+\r
private void setVirtualAddressToAutogenC(StringBuffer fileBuffer){\r
//\r
// Entry point lib for these module types needs to know the count\r
// of entryPoint.\r
//\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");\r
\r
//\r
// If the list is not valid or has no entries set count to zero else\r
}\r
\r
fileBuffer.append(Integer.toString(Count));\r
- fileBuffer.append(";\n\n");\r
+ fileBuffer.append(";\r\n\r\n");\r
if (this.setVirtalAddList == null || this.setVirtalAddList.size() == 0) {\r
//\r
// No data so make a NULL list\r
//\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\n");\r
- fileBuffer.append(" NULL\n");\r
- fileBuffer.append("};\n\n");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");\r
+ fileBuffer.append(" NULL\r\n");\r
+ fileBuffer.append("};\r\n\r\n");\r
} else {\r
//\r
// Write SetVirtualAddressMap function definition.\r
if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
break;\r
}\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(this.setVirtalAddList.get(i));\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_EVENT Event,\n");\r
- fileBuffer.append(" IN VOID *Context\n");\r
- fileBuffer.append(" );\n\n");\r
+ functionDeclarations.append("VOID\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(this.setVirtalAddList.get(i));\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_EVENT Event,\r\n");\r
+ functionDeclarations.append(" IN VOID *Context\r\n");\r
+ functionDeclarations.append(" );\r\n\r\n");\r
}\r
\r
//\r
// Write SetVirtualAddressMap entry point array.\r
//\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");\r
for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
break;\r
}\r
\r
if (i == 0) {\r
- fileBuffer.append("\n ");\r
+ fileBuffer.append("\r\n ");\r
} else {\r
- fileBuffer.append(",\n ");\r
+ fileBuffer.append(",\r\n ");\r
}\r
\r
fileBuffer.append(this.setVirtalAddList.get(i));\r
//\r
// add the NULL at the end of _gDriverSetVirtualAddressMapEvent list.\r
//\r
- fileBuffer.append(",\n NULL");\r
- fileBuffer.append("\n};\n\n");\r
+ fileBuffer.append(",\r\n NULL");\r
+ fileBuffer.append("\r\n};\r\n\r\n");\r
}\r
}\r
\r
//\r
// Entry point lib for these module types needs to know the count.\r
//\r
- fileBuffer\r
- .append("\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverExitBootServicesEventCount = ");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverExitBootServicesEventCount = ");\r
\r
//\r
// If the list is not valid or has no entries set count to zero else\r
Count = i;\r
}\r
fileBuffer.append(Integer.toString(Count));\r
- fileBuffer.append(";\n\n");\r
+ fileBuffer.append(";\r\n\r\n");\r
\r
if (this.exitBootServiceList == null || this.exitBootServiceList.size() == 0) {\r
// \r
// No data so make a NULL list.\r
//\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\n");\r
- fileBuffer.append(" NULL\n");\r
- fileBuffer.append("};\n\n");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");\r
+ fileBuffer.append(" NULL\r\n");\r
+ fileBuffer.append("};\r\n\r\n");\r
} else {\r
//\r
// Write DriverExitBootServices function definition.\r
break;\r
}\r
\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append(this.exitBootServiceList.get(i));\r
- fileBuffer.append(" (\n");\r
- fileBuffer.append(" IN EFI_EVENT Event,\n");\r
- fileBuffer.append(" IN VOID *Context\n");\r
- fileBuffer.append(" );\n\n");\r
+ functionDeclarations.append("VOID\r\n");\r
+ functionDeclarations.append("EFIAPI\r\n");\r
+ functionDeclarations.append(this.exitBootServiceList.get(i));\r
+ functionDeclarations.append(" (\r\n");\r
+ functionDeclarations.append(" IN EFI_EVENT Event,\r\n");\r
+ functionDeclarations.append(" IN VOID *Context\r\n");\r
+ functionDeclarations.append(" );\r\n\r\n");\r
}\r
\r
//\r
// Write DriverExitBootServices entry point array.\r
//\r
- fileBuffer.append("\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");\r
+ fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");\r
for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
break;\r
}\r
\r
if (i == 0) {\r
- fileBuffer.append("\n ");\r
+ fileBuffer.append("\r\n ");\r
} else {\r
- fileBuffer.append(",\n ");\r
+ fileBuffer.append(",\r\n ");\r
}\r
fileBuffer.append(this.exitBootServiceList.get(i));\r
}\r
\r
- fileBuffer.append(",\n NULL");\r
- fileBuffer.append("\n};\n\n");\r
+ fileBuffer.append(",\r\n NULL");\r
+ fileBuffer.append("\r\n};\r\n\r\n");\r
} \r
}\r
/**\r