- fileBuffer\r
- .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");\r
- fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\r\n\r\n");\r
-\r
- if (entryPointList != null) {\r
- for (int i = 0; i < entryPointList.length; i++) {\r
- if (!entryPointList[i].equals("")) {\r
- fileBuffer.append("EFI_STATUS\r\n");\r
- fileBuffer.append("EFIAPI\r\n");\r
- fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\r\n");\r
- fileBuffer\r
- .append(" EFI_HANDLE ImageHandle\r\n");\r
- fileBuffer.append(" );\r\n");\r
- } else {\r
- break;\r
- }\r
- }\r
- }\r
-\r
- fileBuffer.append("EFI_STATUS\r\n");\r
- fileBuffer.append("EFIAPI\r\n");\r
- fileBuffer.append("ProcessModuleUnloadList (\r\n");\r
- fileBuffer.append(" EFI_HANDLE ImageHandle\r\n");\r
- fileBuffer.append(" )\r\n");\r
- fileBuffer.append("{\r\n");\r
-\r
- if (entryPointCount == 0) {\r
- fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
- } else if (entryPointCount == 1) {\r
- fileBuffer.append(" return ");\r
- fileBuffer.append(entryPointList[0]);\r
- fileBuffer.append("(ImageHandle);\r\n");\r
- } else {\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 < entryPointList.length; i++) {\r
- if (!entryPointList[i].equals("")) {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
- fileBuffer.append(" ");\r
- fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append("(ImageHandle);\r\n");\r
- fileBuffer.append(" } else {\r\n");\r
- fileBuffer.append(" Status = ");\r
- fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append("(ImageHandle);\r\n");\r
- fileBuffer.append(" }\r\n");\r
- } else {\r
- break;\r
- }\r
- }\r
- fileBuffer.append(" return Status;\r\n");\r
- }\r
- fileBuffer.append("}\r\n\r\n");\r
- break;\r
-\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\r
- entryPointCount = 0;\r
- fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");\r
- for (int i = 0; i < entryPointList.length; i++) {\r
- if (!entryPointList[i].equals("")) {\r
- fileBuffer.append("EFI_STATUS\r\n");\r
- fileBuffer.append("EFIAPI\r\n");\r
- fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\r\n");\r
- fileBuffer.append(" EFI_HANDLE ImageHandle,\r\n");\r
- fileBuffer.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");\r
- fileBuffer.append(" );\r\n");\r
- entryPointCount++;\r
- } else {\r
- break;\r
- }\r
- }\r
-\r
- fileBuffer\r
- .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
- fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\r\n");\r
- if (entryPointCount > 1) {\r
- fileBuffer\r
- .append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");\r
- fileBuffer\r
- .append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");\r
- }\r
- fileBuffer.append("\n");\r
-\r
- fileBuffer.append("EFI_STATUS\r\n");\r
- fileBuffer.append("EFIAPI\r\n");\r
- fileBuffer.append("ProcessModuleEntryPointList (\r\n");\r
- fileBuffer.append(" EFI_HANDLE ImageHandle,\r\n");\r
- fileBuffer.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");\r
- fileBuffer.append(" )\r\n\r\n");\r
- fileBuffer.append("{\r\n");\r
-\r
- if (entryPointCount == 0) {\r
- fileBuffer.append(" return EFI_SUCCESS;\r\n");\r
- } else if (entryPointCount == 1) {\r
- fileBuffer.append(" return (");\r
- fileBuffer.append(entryPointList[0]);\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\r
- .append(" if (SetJump (&mJumpContext) == 0) {\r\n");\r
- fileBuffer.append(" ExitDriver (");\r
- fileBuffer.append(entryPointList[i]);\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;\r\n");\r
- }\r
- fileBuffer.append("}\r\n\r\n");\r
-\r
- fileBuffer.append("VOID\n");\r
- fileBuffer.append("EFIAPI\n");\r
- fileBuffer.append("ExitDriver (\r\n");\r
- fileBuffer.append(" IN EFI_STATUS Status\n");\r
- fileBuffer.append(" )\r\n\r\n");\r
- fileBuffer.append("{\r\n");\r
- if (entryPointCount <= 1) {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
- fileBuffer\r
- .append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");\r
- fileBuffer.append(" }\r\n");\r
- fileBuffer\r
- .append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");\r
- } else {\r
- fileBuffer\r
- .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("}\r\n\r\n");\r
-\r
- //\r
- // Add ModuleUnloadImage for DxeDriver and UefiDriver module type.\r
- //\r
- entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();\r
- entryPointCount = 0;\r
- if (entryPointList != null) {\r
- for (int i = 0; i < entryPointList.length; i++) {\r
- if (!entryPointList[i].equals("")) {\r
- fileBuffer.append("EFI_STATUS\r\n");\r
- fileBuffer.append("EFIAPI\r\n");\r
- fileBuffer.append(entryPointList[i]);\r
- fileBuffer.append(" (\r\n");\r
- fileBuffer\r
- .append(" EFI_HANDLE ImageHandle\r\n");\r
- fileBuffer.append(" );\r\n");\r
- entryPointCount++;\r
- } else {\r
- break;\r
- }\r
- }\r
- }\r
-\r
- fileBuffer\r
- .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");\r
- fileBuffer.append(Integer.toString(entryPointCount));\r
- fileBuffer.append(";\r\n\r\n");\r
-\r
- if (entryPointList != null) {\r
+ }\r
+ \r
+ //\r
+ // Write consumed ppi, guid, protocol to autogen.c\r
+ //\r
+ ProtocolGuidToAutogenC(fileBuffer);\r
+ PpiGuidToAutogenC(fileBuffer);\r
+ GuidGuidToAutogenC(fileBuffer);\r
+\r
+ //\r
+ // Call pcd autogen. PCDAutoGenAction tool only need module name and\r
+ // isPcdEmulatedDriver as parameter. Library inherits PCD and module's\r
+ // PCD information has been collected in FPDParser task by\r
+ // CollectPCDAction.\r
+ // Note : when PCD image tool ready,\r
+ // isPCDEmulatedDriver parameter will be removed.\r
+ //\r
+ try {\r
+// this.myPcdAutogen = new PCDAutoGenAction(moduleId.getName(),\r
+// moduleId.getGuid(), moduleId.getPackage().getName(), moduleId.getPackage().getGuid(),this.arch,moduleId.getVersion(),false, null);\r
+ this.myPcdAutogen = new PCDAutoGenAction(moduleId.getName(),null,null,null, this.arch,null,false, null);\r
+ this.myPcdAutogen.execute();\r
+ } catch (Exception e) {\r
+ throw new BuildException("PCD Autogen failed:" + e.getMessage());\r
+ }\r
+ \r
+ if (this.myPcdAutogen != null) {\r
+ fileBuffer.append("\r\n");\r
+ fileBuffer.append(this.myPcdAutogen.OutputC());\r
+ }\r
+\r
+ if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {\r
+ throw new BuildException("Failed to generate AutoGen.c !!!");\r
+ }\r
+\r
+ }\r
+\r
+ /**\r
+ * libGenAutogenH\r
+ * \r
+ * This function generates AutoGen.h for library.\r
+ * \r
+ * @throws BuildException\r
+ * Failed to generate AutoGen.c.\r
+ */\r
+ void libGenAutogenH() throws AutoGenException {\r
+\r
+ Set<String> libClassIncludeH;\r
+ String moduleType;\r
+ List<String> headerFileList;\r
+ Iterator item;\r
+ StringBuffer fileBuffer = new StringBuffer(10240);\r
+\r
+ //\r
+ // Write Autogen.h header notation\r
+ //\r
+ fileBuffer.append(CommonDefinition.autogenHNotation);\r
+\r
+ //\r
+ // Add #ifndef ${BaseName}_AUTOGENH\r
+ // #def ${BseeName}_AUTOGENH\r
+ //\r
+ fileBuffer.append("#ifndef " + this.moduleId.getName().toUpperCase()\r
+ + "_AUTOGENH\r\n");\r
+ fileBuffer.append("#define " + this.moduleId.getName().toUpperCase()\r
+ + "_AUTOGENH\r\n\r\n");\r
+\r
+ //\r
+ // Write EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION\r
+ // to autogen.h file.\r
+ // Note: the specification version and release version should\r
+ // be get from module surface area instead of hard code.\r
+ //\r
+ fileBuffer.append(CommonDefinition.autoGenHbegin);\r
+ String[] specList = SurfaceAreaQuery.getExternSpecificaiton();\r
+ for (int i = 0; i < specList.length; i++) {\r
+ fileBuffer.append(CommonDefinition.marcDefineStr + specList[i]\r
+ + "\r\n");\r
+ }\r
+ // fileBuffer.append(CommonDefinition.autoGenHLine1);\r
+ // fileBuffer.append(CommonDefinition.autoGenHLine2);\r
+\r
+ //\r
+ // Write consumed package's mdouleInfo related *.h file to autogen.h.\r
+ // \r
+ moduleType = SurfaceAreaQuery.getModuleType();\r
+ PackageIdentification[] cosumedPkglist = SurfaceAreaQuery\r
+ .getDependencePkg(this.arch);\r
+ headerFileList = depPkgToAutogenH(cosumedPkglist, moduleType);\r
+ item = headerFileList.iterator();\r
+ while (item.hasNext()) {\r
+ fileBuffer.append(item.next().toString());\r
+ }\r
+ //\r
+ // Write library class's related *.h file to autogen.h\r
+ //\r
+ String[] libClassList = SurfaceAreaQuery\r
+ .getLibraryClasses(CommonDefinition.AlwaysConsumed);\r
+ if (libClassList != null) {\r
+ libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
+ item = libClassIncludeH.iterator();\r
+ while (item.hasNext()) {\r
+ fileBuffer.append(item.next().toString());\r
+ }\r
+ }\r
+\r
+ libClassList = SurfaceAreaQuery\r
+ .getLibraryClasses(CommonDefinition.AlwaysProduced);\r
+ if (libClassList != null) {\r
+ libClassIncludeH = LibraryClassToAutogenH(libClassList);\r
+ item = libClassIncludeH.iterator();\r
+ while (item.hasNext()) {\r
+ fileBuffer.append(item.next().toString());\r
+ }\r
+ }\r
+ fileBuffer.append("\r\n");\r
+\r
+ //\r
+ // Write PCD information to library AutoGen.h.\r
+ //\r
+ if (this.myPcdAutogen != null) {\r
+ fileBuffer.append("\r\n");\r
+ fileBuffer.append(this.myPcdAutogen.OutputH());\r
+ }\r
+\r
+ //\r
+ // Append the #endif at AutoGen.h\r
+ //\r
+ fileBuffer.append("#endif\r\n");\r
+\r
+ //\r
+ // Save content of string buffer to AutoGen.h file.\r
+ //\r
+ if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {\r
+ throw new BuildException("Failed to generate AutoGen.h !!!");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * libGenAutogenC\r
+ * \r
+ * This function generates AutoGen.h for library.\r
+ * \r
+ * @throws BuildException\r
+ * Failed to generate AutoGen.c.\r
+ */\r
+ void libGenAutogenC() throws BuildException {\r
+ StringBuffer fileBuffer = new StringBuffer(10240);\r
+\r
+ //\r
+ // Write Autogen.c header notation\r
+ //\r
+ fileBuffer.append(CommonDefinition.autogenCNotation);\r
+\r
+ fileBuffer.append(CommonDefinition.autoGenCLine1);\r
+ fileBuffer.append("\r\n");\r
+\r
+ //\r
+ // Call pcd autogen. PCDAutoGenAction tool only need module name and\r
+ // isPcdEmulatedDriver as parameter. Library inherit PCD and module's\r
+ // PCD information has been collected in FPDParser task by\r
+ // CollectPCDAction.\r
+ // Note : when PCD image tool ready,\r
+ // isPCDEmulatedDriver parameter will be removed.\r
+ //\r
+ try {\r
+// this.myPcdAutogen = new PCDAutoGenAction(this.moduleId.getName(),\r
+// this.moduleId.getGuid(),moduleId.getPackage().getName(),moduleId.getPackage().getGuid(), this.arch, moduleId.getVersion(),true, SurfaceAreaQuery.getModulePcdEntryNameArray());\r
+ this.myPcdAutogen = new PCDAutoGenAction(this.moduleId.getName(),\r
+ null,\r
+ null,\r
+ null,\r
+ this.arch,\r
+ null,\r
+ true, \r
+ SurfaceAreaQuery.getModulePcdEntryNameArray());\r
+ \r
+ this.myPcdAutogen.execute();\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+\r
+ if (this.myPcdAutogen != null) {\r
+ fileBuffer.append("\r\n");\r
+ fileBuffer.append(this.myPcdAutogen.OutputC());\r
+ }\r
+\r
+ if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {\r
+ throw new BuildException("Failed to generate AutoGen.c !!!");\r
+ }\r
+ }\r
+\r
+ /**\r
+ * LibraryClassToAutogenH\r
+ * \r
+ * This function returns *.h files declared by library classes which are\r
+ * consumed or produced by current build module or library.\r
+ * \r
+ * @param libClassList\r
+ * List of library class which consumed or produce by current\r
+ * build module or library.\r
+ * @return includeStrList List of *.h file.\r
+ */\r
+ Set<String> LibraryClassToAutogenH(String[] libClassList)\r
+ throws AutoGenException {\r
+ Set<String> includStrList = new HashSet<String>();\r
+ String includerName[];\r
+ String str = "";\r
+\r
+ //\r
+ // Get include file from GlobalData's SPDTable according to\r
+ // library class name.\r
+ //\r
+\r
+ for (int i = 0; i < libClassList.length; i++) {\r
+ includerName = GlobalData.getLibraryClassHeaderFiles(\r
+ SurfaceAreaQuery.getDependencePkg(this.arch),\r
+ libClassList[i]);\r
+ if (includerName == null) {\r
+ throw new AutoGenException("Can not find library class ["\r
+ + libClassList[i] + "] declaration in every packages. ");\r
+ }\r
+ for (int j = 0; j < includerName.length; j++) {\r
+ String includeNameStr = includerName[j];\r
+ if (includeNameStr != null) {\r
+ str = CommonDefinition.include + " " + "<";\r
+ str = str + includeNameStr + ">\r\n";\r
+ includStrList.add(str);\r
+ includeNameStr = null;\r
+ }\r
+ }\r
+ }\r
+ return includStrList;\r
+ }\r
+\r
+ /**\r
+ * IncludesToAutogenH\r
+ * \r
+ * This function add include file in AutoGen.h file.\r
+ * \r
+ * @param packageNameList\r
+ * List of module depended package.\r
+ * @param moduleType\r
+ * Module type.\r
+ * @return\r
+ */\r
+ List<String> depPkgToAutogenH(PackageIdentification[] packageNameList,\r
+ String moduleType) throws AutoGenException {\r
+\r
+ List<String> includeStrList = new LinkedList<String>();\r
+ String pkgHeader;\r
+ String includeStr = "";\r
+\r
+ //\r
+ // Get include file from moduleInfo file\r
+ //\r
+ for (int i = 0; i < packageNameList.length; i++) {\r
+ pkgHeader = GlobalData.getPackageHeaderFiles(packageNameList[i],\r
+ moduleType);\r
+ if (pkgHeader == null) {\r
+ throw new AutoGenException("Can not find package ["\r
+ + packageNameList[i]\r
+ + "] declaration in every packages. ");\r
+ } else if (!pkgHeader.equalsIgnoreCase("")) {\r
+ includeStr = CommonDefinition.include + " <" + pkgHeader\r
+ + ">\r\n";\r
+ includeStrList.add(includeStr);\r
+ }\r
+ }\r
+\r
+ return includeStrList;\r
+ }\r
+\r
+ /**\r
+ * EntryPointToAutoGen\r
+ * \r
+ * This function convert <ModuleEntryPoint> & <ModuleUnloadImage>\r
+ * information in mas to AutoGen.c\r
+ * \r
+ * @param entryPointList\r
+ * List of entry point.\r
+ * @param fileBuffer\r
+ * String buffer fo AutoGen.c.\r
+ * @throws Exception\r
+ */\r
+ void EntryPointToAutoGen(String[] entryPointList, StringBuffer fileBuffer)\r
+ throws BuildException {\r
+\r
+ String typeStr = SurfaceAreaQuery.getModuleType();\r
+\r
+ //\r
+ // The parameters and return value of entryPoint is difference\r
+ // for difference module type.\r
+ //\r
+ switch (CommonDefinition.getModuleType(typeStr)) {\r
+\r
+ case CommonDefinition.ModuleTypePeiCore:\r
+ if (entryPointList == null ||entryPointList.length != 1 ) {\r
+ throw new BuildException(\r
+ "Module type = 'PEI_CORE', only have one module entry point!");\r
+ } else {\r
+ fileBuffer.append("EFI_STATUS\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append(entryPointList[0]);\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer\r
+ .append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");\r
+ fileBuffer\r
+ .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\r
+ .append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");\r
+ fileBuffer\r
+ .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);\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
+ }\r
+ break;\r
+\r
+ case CommonDefinition.ModuleTypeDxeCore:\r
+ fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");\r
+ if (entryPointList == null || entryPointList.length != 1) {\r
+ throw new BuildException(\r
+ "Module type = 'DXE_CORE', only have one module entry point!");\r
+ } else {\r
+\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\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);\r\n");\r
+ fileBuffer.append("}\r\n\r\n");\r
+ }\r
+ break;\r
+\r
+ case CommonDefinition.ModuleTypePeim:\r
+ int entryPointCount = 0;\r
+ fileBuffer\r
+ .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");\r
+ if (entryPointList == null) {\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\r\n");\r
+ fileBuffer.append("EFIAPI\r\n");\r
+ fileBuffer.append(entryPointList[i]);\r
+ fileBuffer.append(" (\r\n");\r
+ fileBuffer\r
+ .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
+ fileBuffer\r
+ .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
+ fileBuffer.append(" );\r\n");\r
+ entryPointCount++;\r
+ \r
+ }\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_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(" return ");\r
+ fileBuffer.append(entryPointList[0]);\r
+ fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
+ } else {\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(" Status = ");\r
+ fileBuffer.append(entryPointList[i]);\r
+ fileBuffer.append(" (FfsHeader, PeiServices);\r\n");\r
+ fileBuffer\r
+ .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;\r\n");\r
+ }\r
+ fileBuffer.append("}\r\n\r\n");\r
+ break;\r
+\r
+ case CommonDefinition.ModuleTypeDxeSmmDriver:\r
+ entryPointCount = 0;\r
+ //\r
+ // If entryPoint is null, create an empty ProcessModuleEntryPointList\r
+ // function.\r
+ //\r
+ if (entryPointList == null || entryPointList.length == 0){\r
+ fileBuffer\r
+ .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
+ fileBuffer.append(Integer.toString(entryPointCount));\r
+ fileBuffer.append(";\r\n");\r
+ fileBuffer\r
+ .append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");\r
+ fileBuffer\r
+ .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(" EFI_HANDLE ImageHandle,\r\n");\r
+ fileBuffer.append(" 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
+ break;\r
+ } else {\r