+++ /dev/null
-/** @file\r
- AutoGen class.\r
-\r
- This class is to generate Autogen.h and Autogen.c according to module surface area\r
- or library surface area.\r
-\r
- Copyright (c) 2006, Intel Corporation\r
- All rights reserved. This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
-\r
- **/\r
-\r
-package org.tianocore.build.autogen;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.FileOutputStream;\r
-import java.io.FileReader;\r
-import java.io.FileWriter;\r
-import java.io.IOException;\r
-import java.util.ArrayList;\r
-import java.util.HashSet;\r
-import java.util.Iterator;\r
-import java.util.LinkedHashSet;\r
-import java.util.LinkedList;\r
-import java.util.List;\r
-import java.util.Map;\r
-import java.util.Set;\r
-\r
-import org.apache.tools.ant.BuildException;\r
-import org.apache.xmlbeans.XmlObject;\r
-import org.tianocore.build.exception.AutoGenException;\r
-import org.tianocore.build.global.GlobalData;\r
-import org.tianocore.build.global.SurfaceAreaQuery;\r
-import org.tianocore.build.id.ModuleIdentification;\r
-import org.tianocore.build.id.PackageIdentification;\r
-import org.tianocore.build.pcd.action.PCDAutoGenAction;\r
-import org.tianocore.common.definitions.ToolDefinitions;\r
-import org.tianocore.common.definitions.EdkDefinitions;\r
-import org.tianocore.common.exception.EdkException;\r
-import org.tianocore.common.logger.EdkLog;\r
-\r
-/**\r
- This class is to generate Autogen.h and Autogen.c according to module surface\r
- area or library surface area.\r
-**/\r
-public class AutoGen {\r
- ///\r
- /// The output path of Autogen.h and Autogen.c\r
- ///\r
- private String outputPath;\r
-\r
- ///\r
- /// The name of FV directory\r
- ///\r
- private String fvDir;\r
-\r
- ///\r
- /// The base name of module or library.\r
- ///\r
- private ModuleIdentification moduleId;\r
-\r
- ///\r
- /// The build architecture\r
- ///\r
- private String arch;\r
-\r
- ///\r
- /// PcdAutogen instance which is used to manage how to generate the PCD\r
- /// information.\r
- ///\r
- private PCDAutoGenAction myPcdAutogen;\r
-\r
- ///\r
- /// the one of type : NOT_PCD_DRIVER, PEI_PCD_DRIVER, DXE_PCD_DRIVER\r
- /// \r
- private CommonDefinition.PCD_DRIVER_TYPE pcdDriverType;\r
-\r
- ///\r
- /// The Guid CName list which recoreded in module or library surface area \r
- /// and it's dependence on library instance surface area.\r
- ///\r
- private Set<String> mGuidCNameList = new HashSet<String>();\r
-\r
- ///\r
- /// The dependence package list which recoreded in module or library surface\r
- /// area and it's dependence on library instance surface area.\r
- ///\r
- private List<PackageIdentification> mDepPkgList = new LinkedList<PackageIdentification>();\r
-\r
- ///\r
- /// For non library module, add its library instance's construct and destructor to\r
- /// list. String[0] recode LibConstructor name, String[1] recode Lib instance \r
- /// module type.\r
- ///\r
- private List<String[]> libConstructList = new ArrayList<String[]>();\r
- private List<String[]> libDestructList = new ArrayList<String[]>();\r
-\r
- ///\r
- /// List to store SetVirtalAddressMapCallBack, ExitBootServiceCallBack\r
- ///\r
- private List<String> setVirtalAddList = new ArrayList<String>();\r
- private List<String> exitBootServiceList = new ArrayList<String>();\r
-\r
- private StringBuffer functionDeclarations = new StringBuffer(10240);\r
- private StringBuffer globalDeclarations = new StringBuffer(10240);\r
-\r
- //\r
- // flag of PcdComponentNameDisable, PcdDriverDiagnosticDisable \r
- //\r
- private boolean componentNamePcd = false;\r
- private boolean driverDiagnostPcd = false;\r
-\r
- //\r
- // Instance of SurfaceAreaQuery\r
- //\r
- private SurfaceAreaQuery saq = null;\r
-\r
- private ModuleIdentification parentId = null;\r
-\r
- /**\r
- Construct function\r
- \r
- This function mainly initialize some member variable.\r
- \r
- @param fvDir\r
- Absolute path of FV directory.\r
- @param outputPath\r
- Output path of AutoGen file.\r
- @param moduleId\r
- Module identification.\r
- @param arch\r
- Target architecture.\r
- **/\r
- public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch, SurfaceAreaQuery saq, ModuleIdentification parentId) {\r
- this.outputPath = outputPath;\r
- this.moduleId = moduleId;\r
- this.arch = arch;\r
- this.fvDir = fvDir;\r
- this.saq = saq;\r
- this.parentId = parentId;\r
- }\r
-\r
- /**\r
- saveFile function\r
- \r
- This function save the content in stringBuffer to file.\r
- \r
- @param fileName\r
- The name of file.\r
- @param fileBuffer\r
- The content of AutoGen file in buffer.\r
- @return boolean \r
- "true" successful\r
- "false" failed\r
- **/\r
- private boolean saveFile(String fileName, StringBuffer fileBuffer) {\r
-\r
- File autoGenH = new File(fileName);\r
-\r
- //\r
- // if the file exists, compare their content\r
- //\r
- if (autoGenH.exists()) {\r
- char[] oldFileBuffer = new char[(int) autoGenH.length()];\r
- try {\r
- FileReader fIn = new FileReader(autoGenH);\r
- fIn.read(oldFileBuffer, 0, (int) autoGenH.length());\r
- fIn.close();\r
- } catch (IOException e) {\r
- EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
- + "'s " \r
- + fileName \r
- + " is exist, but can't be open!!");\r
- return false;\r
- }\r
-\r
- //\r
- // if we got the same file, don't re-generate it to prevent\r
- // sources depending on it from re-building\r
- //\r
- if (fileBuffer.toString().compareTo(new String(oldFileBuffer)) == 0) {\r
- return true;\r
- }\r
- }\r
-\r
- try {\r
- FileWriter fOut = new FileWriter(autoGenH);\r
- fOut.write(fileBuffer.toString());\r
- fOut.flush();\r
- fOut.close();\r
- } catch (IOException e) {\r
- EdkLog.log(EdkLog.EDK_INFO, this.moduleId.getName() \r
- + "'s " \r
- + fileName \r
- + " can't be create!!");\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- /**\r
- genAutogen function\r
- \r
- This function call libGenAutoGen or moduleGenAutogen function, which\r
- dependence on generate library autogen or module autogen.\r
- \r
- @throws BuildException\r
- Failed to creat AutoGen.c & AutoGen.h.\r
- **/\r
- public void genAutogen() throws EdkException {\r
- //\r
- // If outputPath do not exist, create it.\r
- //\r
- File path = new File(outputPath);\r
- path.mkdirs();\r
-\r
- //\r
- // Check current is library or not, then call the corresponding\r
- // function.\r
- //\r
- if (this.moduleId.isLibrary()) {\r
- libGenAutogen();\r
- } else {\r
- moduleGenAutogen();\r
- }\r
- }\r
-\r
- /**\r
- moduleGenAutogen function\r
- \r
- This function generates AutoGen.c & AutoGen.h for module.\r
- \r
- @throws BuildException\r
- Faile to create module AutoGen.c & AutoGen.h.\r
- **/\r
- void moduleGenAutogen() throws EdkException {\r
- setPcdComponentName();\r
- setPcdDriverDiagnostic();\r
- collectLibInstanceInfo();\r
- moduleGenAutogenC();\r
- moduleGenAutogenH();\r
- }\r
-\r
- /**\r
- libGenAutogen function\r
- \r
- This function generates AutoGen.c & AutoGen.h for library.\r
- \r
- @throws BuildException\r
- Faile to create library AutoGen.c & AutoGen.h\r
- **/\r
- void libGenAutogen() throws EdkException {\r
- libGenAutogenC();\r
- libGenAutogenH();\r
- }\r
-\r
- /**\r
- moduleGenAutogenH\r
- \r
- This function generates AutoGen.h for module.\r
- \r
- @throws BuildException\r
- Failed to generate AutoGen.h.\r
- **/\r
- void moduleGenAutogenH() throws EdkException {\r
-\r
- Set<String> libClassIncludeH;\r
- String moduleType;\r
- // List<String> headerFileList;\r
- List<String> headerFileList;\r
- Iterator item;\r
- StringBuffer fileBuffer = new StringBuffer(8192);\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(CommonDefinition.IFNDEF \r
- + CommonDefinition.AUTOGENH\r
- + this.moduleId.getGuid().replaceAll("-", "_") \r
- + ToolDefinitions.LINE_SEPARATOR);\r
- fileBuffer.append(CommonDefinition.DEFINE \r
- + CommonDefinition.AUTOGENH\r
- + this.moduleId.getGuid().replaceAll("-", "_") \r
- + ToolDefinitions.LINE_SEPARATOR \r
- + ToolDefinitions.LINE_SEPARATOR);\r
-\r
- //\r
- // Write the specification version and release version at the begine\r
- // of autogen.h file.\r
- // Note: the specification version and release version should\r
- // be got from module surface area instead of hard code by it's\r
- // moduleType.\r
- //\r
- moduleType = saq.getModuleType();\r
-\r
- //\r
- // Add "extern int __make_me_compile_correctly;" at begin of\r
- // AutoGen.h.\r
- //\r
- fileBuffer.append(CommonDefinition.AUTOGENHBEGIN);\r
-\r
- //\r
- // Put EFI_SPECIFICATION_VERSION, and EDK_RELEASE_VERSION.\r
- //\r
- String[] specList = saq.getExternSpecificaiton();\r
- for (int i = 0; i < specList.length; i++) {\r
- fileBuffer.append(CommonDefinition.DEFINE + specList[i]\r
- + "\r\n");\r
- }\r
- //\r
- // Write consumed package's mdouleInfo related .h file to autogen.h\r
- //\r
- // PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery\r
- // .getDependencePkg(this.arch);\r
- PackageIdentification[] consumedPkgIdList = saq.getDependencePkg(this.arch);\r
- if (consumedPkgIdList != null) {\r
- headerFileList = depPkgToAutogenH(consumedPkgIdList, moduleType);\r
- item = headerFileList.iterator();\r
- while (item.hasNext()) {\r
- fileBuffer.append(item.next().toString());\r
- }\r
- }\r
-\r
- //\r
- // Write library class's related *.h file to autogen.h.\r
- //\r
- List<String> libClasses = new ArrayList<String>(100);\r
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
- for (int i = 0; i < libClassList.length; ++i) {\r
- libClasses.add(libClassList[i]);\r
- }\r
-\r
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
- for (int i = 0; i < libClassList.length; ++i) {\r
- libClasses.add(libClassList[i]);\r
- }\r
- //\r
- // Add AutoGen used library class\r
- // \r
- int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
- if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
- && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
- libClasses.add("DebugLib");\r
- }\r
- switch (moduleTypeId) {\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\r
- if (!libClasses.contains("UefiBootServicesTableLib")) {\r
- libClasses.add("UefiBootServicesTableLib");\r
- }\r
- break;\r
- }\r
- LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
- fileBuffer.append("\r\n");\r
-\r
- //\r
- // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to\r
- // {DEST_DIR_DRBUG}/FlashMap.h\r
- //\r
- if (saq.isHaveTianoR8FlashMap()) {\r
- fileBuffer.append(CommonDefinition.INCLUDE);\r
- fileBuffer.append(" <");\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("\r\n");\r
- fileBuffer.append(this.myPcdAutogen.getHAutoGenString());\r
- }\r
-\r
- fileBuffer.append(globalDeclarations);\r
- fileBuffer.append(functionDeclarations);\r
- //\r
- // Append the #endif at AutoGen.h\r
- //\r
- fileBuffer.append("#endif\r\n");\r
-\r
- //\r
- // Save string buffer content in AutoGen.h.\r
- //\r
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {\r
- throw new AutoGenException("Failed to generate AutoGen.h !!!");\r
- }\r
- }\r
-\r
- /**\r
- moduleGenAutogenC\r
- \r
- This function generates AutoGen.c for module.\r
- \r
- @throws BuildException\r
- Failed to generate AutoGen.c.\r
- **/\r
- void moduleGenAutogenC() throws EdkException {\r
-\r
- StringBuffer fileBuffer = new StringBuffer(8192);\r
- //\r
- // Write Autogen.c header notation\r
- //\r
- fileBuffer.append(CommonDefinition.AUTOGENCNOTATION);\r
-\r
- //\r
- // Get the native MSA file infomation. Since before call autogen,\r
- // the MSA native <Externs> information were overrided. So before\r
- // process <Externs> it should be set the DOC as the Native MSA info.\r
- //\r
- Map<String, XmlObject> doc = GlobalData.getNativeMsa(this.moduleId);\r
- saq.push(doc);\r
- //\r
- // Write <Extern>\r
- // DriverBinding/ComponentName/DriverConfiguration/DriverDialog\r
- // to AutoGen.c\r
- //\r
- if (!moduleId.getModuleType().equalsIgnoreCase("UEFI_APPLICATION")) {\r
- ExternsDriverBindingToAutoGenC(fileBuffer);\r
- }\r
-\r
- //\r
- // Write DriverExitBootServicesEvent/DriverSetVirtualAddressMapEvent\r
- // to Autogen.c\r
- //\r
- ExternCallBackToAutoGenC(fileBuffer);\r
-\r
- //\r
- // Write EntryPoint to autgoGen.c\r
- //\r
- String[] entryPointList = saq.getModuleEntryPointArray();\r
- String[] unloadImageList = saq.getModuleUnloadImageArray();\r
- EntryPointToAutoGen(CommonDefinition.remDupString(entryPointList), \r
- CommonDefinition.remDupString(unloadImageList),\r
- fileBuffer);\r
-\r
- pcdDriverType = saq.getPcdDriverType();\r
-\r
- //\r
- // Restore the DOC which include the FPD module info.\r
- //\r
- saq.pop();\r
-\r
- //\r
- // Write Guid to autogen.c\r
- //\r
- String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());\r
- if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\r
- globalDeclarations.append("extern GUID gEfiCallerIdGuid;\r\n");\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");\r
- } else if (!this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_USER_DEFINED)) {\r
- globalDeclarations.append("extern EFI_GUID gEfiCallerIdGuid;\r\n");\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");\r
- }\r
-\r
- if (guid == null) {\r
- throw new AutoGenException("Guid value must set!\n");\r
- }\r
-\r
- //\r
- // Formate Guid as ANSI c form.Example:\r
- // {0xd2b2b828, 0x826, 0x48a7,{0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24,\r
- // 0xf0}}\r
- //\r
-\r
- fileBuffer.append(guid);\r
- fileBuffer.append("};\r\n");\r
-\r
- //\r
- // Generate library instance consumed protocol, guid, ppi, pcd list.\r
- // Save those to this.protocolList, this.ppiList, this.pcdList,\r
- // this.guidList. Write Consumed library constructor and desconstuct to\r
- // autogen.c\r
- //\r
- LibInstanceToAutogenC(fileBuffer);\r
-\r
- //\r
- // Get module dependent Package identification.\r
- //\r
- PackageIdentification[] packages = saq.getDependencePkg(this.arch);\r
- for (int i = 0; i < packages.length; i++) {\r
- if (!this.mDepPkgList.contains(packages[i])) {\r
- this.mDepPkgList.add(packages[i]);\r
- }\r
-\r
- }\r
-\r
- //\r
- // Write consumed ppi, guid, protocol, etc to autogen.c\r
- //\r
- CNameToAutogenC(fileBuffer);\r
-\r
- //\r
- // Call pcd autogen.\r
- //\r
- this.myPcdAutogen = new PCDAutoGenAction(moduleId, \r
- arch, \r
- false, \r
- null,\r
- pcdDriverType, \r
- parentId);\r
-\r
- this.myPcdAutogen.execute();\r
- if (this.myPcdAutogen != null) {\r
- fileBuffer.append("\r\n");\r
- fileBuffer.append(this.myPcdAutogen.getCAutoGenString());\r
- }\r
-\r
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.c", fileBuffer)) {\r
- throw new AutoGenException("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 EdkException {\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(CommonDefinition.IFNDEF \r
- + CommonDefinition.AUTOGENH\r
- + this.moduleId.getGuid().replaceAll("-", "_") \r
- + ToolDefinitions.LINE_SEPARATOR);\r
- fileBuffer.append(CommonDefinition.DEFINE \r
- + CommonDefinition.AUTOGENH\r
- + this.moduleId.getGuid().replaceAll("-", "_") \r
- + ToolDefinitions.LINE_SEPARATOR \r
- + ToolDefinitions.LINE_SEPARATOR);\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 = saq.getExternSpecificaiton();\r
- for (int i = 0; i < specList.length; i++) {\r
- fileBuffer.append(CommonDefinition.DEFINE + specList[i] + "\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 = saq.getModuleType();\r
- PackageIdentification[] cosumedPkglist = saq.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
- List<String> libClasses = new ArrayList<String>(100);\r
- String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch, null);\r
- for (int i = 0; i < libClassList.length; ++i) {\r
- libClasses.add(libClassList[i]);\r
- }\r
-\r
- libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch, null);\r
- for (int i = 0; i < libClassList.length; ++i) {\r
- libClasses.add(libClassList[i]);\r
- }\r
- //\r
- // Add AutoGen used library class\r
- // \r
- int moduleTypeId = CommonDefinition.getModuleType(moduleType);\r
- if (!libClasses.contains("DebugLib") && moduleTypeId != CommonDefinition.ModuleTypeUnknown\r
- && moduleTypeId != CommonDefinition.ModuleTypeBase) {\r
- libClasses.add("DebugLib");\r
- }\r
- switch (moduleTypeId) {\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\r
- if (!libClasses.contains("UefiBootServicesTableLib")) {\r
- libClasses.add("UefiBootServicesTableLib");\r
- }\r
- break;\r
- }\r
- LibraryClassToAutogenH(fileBuffer, libClasses.toArray(new String[libClasses.size()]));\r
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
-\r
- //\r
- // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to\r
- // {DEST_DIR_DRBUG}/FlashMap.h\r
- //\r
- if (saq.isHaveTianoR8FlashMap()) {\r
- fileBuffer.append(CommonDefinition.INCLUDE);\r
- fileBuffer.append(" <");\r
- fileBuffer.append(CommonDefinition.TIANOR8PLASHMAPH + ">\r\n");\r
- copyFlashMapHToDebugDir();\r
- }\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.getHAutoGenString());\r
- }\r
- //\r
- // generate function prototype for constructor and destructor\r
- // \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\r\n");\r
- //\r
- // Save content of string buffer to AutoGen.h file.\r
- //\r
- if (!saveFile(outputPath + File.separatorChar + "AutoGen.h", fileBuffer)) {\r
- throw new AutoGenException("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 EdkException {\r
- StringBuffer fileBuffer = new StringBuffer(10240);\r
-\r
- //\r
- // Write Autogen.c header notation\r
- //\r
- fileBuffer.append(CommonDefinition.AUTOGENCNOTATION);\r
-\r
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
-\r
- //\r
- // Call pcd autogen.\r
- //\r
- this.myPcdAutogen = new PCDAutoGenAction(moduleId,\r
- arch,\r
- true,\r
- saq.getModulePcdEntryNameArray(this.arch),\r
- pcdDriverType, \r
- parentId);\r
- this.myPcdAutogen.execute();\r
- if (this.myPcdAutogen != null) {\r
- fileBuffer.append(ToolDefinitions.LINE_SEPARATOR);\r
- fileBuffer.append(this.myPcdAutogen.getCAutoGenString());\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
- void LibraryClassToAutogenH(StringBuffer fileBuffer, String[] libClassList)\r
- throws EdkException {\r
- String includeName[];\r
- String str = "";\r
-\r
- //\r
- // Get include file from GlobalData's SPDTable according to\r
- // library class name.\r
- //\r
- for (int i = 0; i < libClassList.length; i++) {\r
- includeName = GlobalData.getLibraryClassHeaderFiles(\r
- saq.getDependencePkg(this.arch),\r
- libClassList[i]);\r
- if (includeName == null) {\r
- throw new AutoGenException("Can not find library class ["\r
- + libClassList[i] + "] declaration in any SPD package. ");\r
- }\r
- for (int j = 0; j < includeName.length; j++) {\r
- String includeNameStr = includeName[j];\r
- if (includeNameStr != null) {\r
- fileBuffer.append(CommonDefinition.INCLUDE);\r
- fileBuffer.append(" <");\r
- fileBuffer.append(includeNameStr);\r
- fileBuffer.append(">\r\n");\r
- includeNameStr = null;\r
- }\r
- }\r
- }\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 any SPD package. ");\r
- } else if (!pkgHeader.equalsIgnoreCase("")) {\r
- includeStr = CommonDefinition.INCLUDE + " <" + pkgHeader + ">\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, String[] unloadImageList, StringBuffer fileBuffer)\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));\r\n";\r
- int unloadImageCount = 0;\r
- int entryPointCount = 0;\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 AutoGenException("Module type = 'PEI_CORE', can have only one module entry point!");\r
- } else {\r
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(entryPointList[0]);\r
- functionDeclarations.append(" (\r\n");\r
- functionDeclarations.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");\r
- functionDeclarations.append(" IN VOID *OldCoreData\r\n");\r
- functionDeclarations.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);\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 AutoGenException("Module type = 'DXE_CORE', can have only one module entry point!");\r
- } else {\r
- functionDeclarations.append("VOID\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(entryPointList[0]);\r
- functionDeclarations.append(" (\r\n");\r
- functionDeclarations.append(" IN VOID *HobStart\r\n");\r
- functionDeclarations.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
- entryPointCount = 0;\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\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
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(entryPointList[i]);\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
- entryPointCount++;\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(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));\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(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));\r
- fileBuffer.append(" Status = ");\r
- fileBuffer.append(entryPointList[i]);\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;\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.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
- fileBuffer.append(Integer.toString(entryPointCount));\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
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(entryPointList[i]);\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
- entryPointCount++;\r
- }\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");\r
- fileBuffer.append(Integer.toString(entryPointCount));\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) {\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));\r\n");\r
- fileBuffer.append(" ASSERT (FALSE);\r\n");\r
- fileBuffer.append(" }\r\n");\r
- }\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
-\r
- unloadImageCount = 0;\r
- if (unloadImageList != null) {\r
- for (int i = 0; i < unloadImageList.length; i++) {\r
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append(unloadImageList[i]);\r
- functionDeclarations.append(" (\r\n");\r
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n");\r
- functionDeclarations.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(";\r\n\r\n");\r
-\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;\r\n");\r
- } else if (unloadImageCount == 1) {\r
- fileBuffer.append(" return ");\r
- fileBuffer.append(unloadImageList[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 < unloadImageList.length; i++) {\r
- if (i == 0) {\r
- fileBuffer.append(" Status = ");\r
- fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\r\n");\r
- } else {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
- fileBuffer.append(" ");\r
- fileBuffer.append(unloadImageList[i]);\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);\r\n");\r
- fileBuffer.append(" }\r\n");\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
- //\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;\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
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(entryPointList[i]);\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
- entryPointCount++;\r
- }\r
-\r
- fileBuffer.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.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("\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
- 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);\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) {\r\n");\r
- fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));\r
- if (CommonDefinition.getModuleType(typeStr) == CommonDefinition.ModuleTypeUefiApplication) {\r
- fileBuffer.append(" Exit (");\r
- } else {\r
- fileBuffer.append(" ExitDriver (");\r
- }\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
- if (CommonDefinition.getModuleType(typeStr) != CommonDefinition.ModuleTypeUefiApplication) {\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)) {\r\n");\r
- fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");\r
- fileBuffer.append(" }\r\n");\r
- fileBuffer.append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");\r
- } else {\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("}\r\n\r\n");\r
- }\r
- }\r
-\r
- if (CommonDefinition.getModuleType(typeStr) == CommonDefinition.ModuleTypeUefiApplication) {\r
- break;\r
- }\r
- //\r
- // Add ModuleUnloadImage for DxeDriver and UefiDriver module type.\r
- //\r
- //entryPointList = SurfaceAreaQuery.getModuleUnloadImageArray();\r
- //\r
- // Remover duplicate unload entry point.\r
- //\r
- //entryPointList = CommonDefinition.remDupString(entryPointList);\r
- //entryPointCount = 0;\r
- unloadImageCount = 0;\r
- if (unloadImageList != null) {\r
- for (int i = 0; i < unloadImageList.length; i++) {\r
- functionDeclarations.append("EFI_STATUS\r\n");\r
- functionDeclarations.append("EFIAPI\r\n");\r
- functionDeclarations.append(unloadImageList[i]);\r
- functionDeclarations.append(" (\r\n");\r
- functionDeclarations.append(" IN EFI_HANDLE ImageHandle\r\n");\r
- functionDeclarations.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(";\r\n\r\n");\r
-\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;\r\n");\r
- } else if (unloadImageCount == 1) {\r
- fileBuffer.append(" return ");\r
- fileBuffer.append(unloadImageList[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 < unloadImageList.length; i++) {\r
- if (i == 0) {\r
- fileBuffer.append(" Status = ");\r
- fileBuffer.append(unloadImageList[i]);\r
- fileBuffer.append("(ImageHandle);\r\n");\r
- } else {\r
- fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");\r
- fileBuffer.append(" ");\r
- fileBuffer.append(unloadImageList[i]);\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);\r\n");\r
- fileBuffer.append(" }\r\n");\r
- }\r
- }\r
- fileBuffer.append(" return Status;\r\n");\r
- }\r
- fileBuffer.append("}\r\n\r\n");\r
- break;\r
- }\r
- }\r
-\r
- /**\r
- CNameToAutogenc\r
- \r
- This function gets GUIDs from SPD file accrodeing to <Protocols> <Ppis> \r
- <Guids> information and write those GUIDs to AutoGen.c.\r
- \r
- @param fileBuffer\r
- String Buffer for Autogen.c file.\r
- \r
- **/\r
- void CNameToAutogenC(StringBuffer fileBuffer) throws AutoGenException {\r
- String[] cNameGuid = null;\r
- String guidKeyWord = null;\r
-\r
- String[] cnameList = saq.getCNameArray(this.arch);\r
- for (int i = 0; i < cnameList.length; i++) {\r
- this.mGuidCNameList.add(cnameList[i]);\r
- }\r
-\r
-\r
- Iterator guidIterator = this.mGuidCNameList.iterator();\r
- while (guidIterator.hasNext()) {\r
- guidKeyWord = guidIterator.next().toString();\r
- cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);\r
- if (cNameGuid == null) {\r
- cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, guidKeyWord);\r
- if (cNameGuid == null) {\r
- cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, guidKeyWord);\r
- if (cNameGuid == null) {\r
- //\r
- // If can't find GUID declaration in every package, stop the build\r
- //\r
- EdkLog.log(EdkLog.EDK_INFO,"WARN: Can not find Guid [" + guidKeyWord + "] declaration in any SPD file.");\r
- continue;\r
- //throw new AutoGenException("Can not find Guid [" + guidKeyWord\r
- // + "] declaration in any SPD package. ");\r
- }\r
- }\r
- }\r
-\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
- fileBuffer.append("} ;");\r
- }\r
- }\r
-\r
- /**\r
- LibInstanceToAutogenC\r
- \r
- This function adds dependent library instance to autogen.c,which\r
- includeing library's constructor, destructor, and library dependent ppi,\r
- protocol, guid, pcd information.\r
- \r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- @throws BuildException\r
- **/\r
- void LibInstanceToAutogenC(StringBuffer fileBuffer) throws EdkException {\r
- String moduleType = this.moduleId.getModuleType();\r
- //\r
- // Add library constructor to AutoGen.c\r
- //\r
- LibConstructorToAutogenC(libConstructList, moduleType, fileBuffer);\r
- //\r
- // Add library destructor to AutoGen.c\r
- //\r
- LibDestructorToAutogenC(libDestructList, moduleType, fileBuffer);\r
- }\r
-\r
- /**\r
- LibConstructorToAutogenH\r
- \r
- This function writes library constructor declarations AutoGen.h. The library\r
- constructor's parameter and return value depend on module type.\r
- \r
- @param libInstanceList\r
- List of library construct name.\r
- @param moduleType\r
- Module type.\r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- @throws Exception\r
- **/\r
- void LibConstructorToAutogenH(String moduleType) throws EdkException {\r
- boolean isFirst = true;\r
-\r
- //\r
- // If not yet parse this library instance's constructor\r
- // element,parse it.\r
- //\r
- String libConstructName = saq.getLibConstructorName();\r
- if (libConstructName == null) {\r
- return;\r
- }\r
-\r
- //\r
- // The library constructor's parameter and return value depend on\r
- // module type.\r
- //\r
- if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\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
- 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
- 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.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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
- }\r
- }\r
-\r
- /**\r
- LibDestructorToAutogenH\r
- \r
- This function writes library destructor declarations AutoGen.h. The library\r
- destructor's parameter and return value depend on module type.\r
- \r
- @param libInstanceList\r
- List of library destructor name.\r
- @param moduleType\r
- Module type.\r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- @throws Exception\r
- **/\r
- void LibDestructorToAutogenH(String moduleType) throws EdkException {\r
- boolean isFirst = true;\r
- String libDestructName = saq.getLibDestructorName();\r
- if (libDestructName == null) {\r
- return;\r
- }\r
-\r
- if (moduleType.equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\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
- 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
- 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.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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
-\r
- /**\r
- LibConstructorToAutogenc\r
- \r
- This function writes library constructor list to AutoGen.c. The library\r
- constructor's parameter and return value depend on module type.\r
- \r
- @param libInstanceList\r
- List of library construct name.\r
- @param moduleType\r
- Module type.\r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- @throws Exception\r
- **/\r
- void LibConstructorToAutogenC(List<String[]> libInstanceList,\r
- String moduleType, StringBuffer fileBuffer) throws EdkException {\r
- boolean isFirst = true;\r
-\r
- //\r
- // The library constructor's parameter and return value depend on\r
- // module type.\r
- //\r
- for (int i = 0; i < libInstanceList.size(); i++) {\r
- if (libInstanceList.get(i)[1].equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {\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
- 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
- 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.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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
- }\r
-\r
- //\r
- // Add ProcessLibraryConstructorList in AutoGen.c\r
- //\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\r\n");\r
- break;\r
-\r
- case CommonDefinition.ModuleTypePeiCore:\r
- case CommonDefinition.ModuleTypePeim:\r
- fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");\r
- fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");\r
- break;\r
-\r
- case CommonDefinition.ModuleTypeDxeCore:\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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(" )\r\n");\r
- fileBuffer.append("{\r\n");\r
- //\r
- // If no constructor function, return EFI_SUCCESS.\r
- //\r
- for (int i = 0; i < libInstanceList.size(); i++) {\r
- if (isFirst) {\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("();\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("();\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);\r\n");\r
- break;\r
- case CommonDefinition.ModuleTypeDxeCore:\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\r
- fileBuffer.append(" Status = ");\r
- fileBuffer.append(libInstanceList.get(i)[0]);\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);\r\n");\r
- }\r
- fileBuffer.append("}\r\n");\r
- }\r
-\r
- /**\r
- LibDestructorToAutogenc\r
- \r
- This function writes library destructor list to AutoGen.c. The library\r
- destructor's parameter and return value depend on module type.\r
- \r
- @param libInstanceList\r
- List of library destructor name.\r
- @param moduleType\r
- Module type.\r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- @throws Exception\r
- **/\r
- void LibDestructorToAutogenC(List<String[]> libInstanceList,\r
- String moduleType, StringBuffer fileBuffer) throws EdkException {\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
- 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
- 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
- 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.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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
-\r
- //\r
- // Write ProcessLibraryDestructor list to autogen.c\r
- //\r
- switch (CommonDefinition.getModuleType(moduleType)) {\r
- case CommonDefinition.ModuleTypeBase:\r
- case CommonDefinition.ModuleTypePeiCore:\r
- case CommonDefinition.ModuleTypePeim:\r
- break;\r
- case CommonDefinition.ModuleTypeDxeCore:\r
- case CommonDefinition.ModuleTypeDxeDriver:\r
- case CommonDefinition.ModuleTypeDxeRuntimeDriver:\r
- case CommonDefinition.ModuleTypeDxeSmmDriver:\r
- case CommonDefinition.ModuleTypeDxeSalDriver:\r
- case CommonDefinition.ModuleTypeUefiDriver:\r
- case CommonDefinition.ModuleTypeUefiApplication:\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;\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("();\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);\r\n");\r
- fileBuffer.append(" ASSERT_EFI_ERROR (Status);\r\n");\r
- }\r
- }\r
- fileBuffer.append("}\r\n");\r
- break;\r
- }\r
- }\r
-\r
- /**\r
- ExternsDriverBindingToAutoGenC\r
- \r
- This function is to write DRIVER_BINDING, COMPONENT_NAME,\r
- DRIVER_CONFIGURATION, DRIVER_DIAGNOSTIC in AutoGen.c.\r
- \r
- @param fileBuffer\r
- String buffer for AutoGen.c\r
- **/\r
- void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer)\r
- throws EdkException {\r
- //\r
- // Get the arry of extern. The driverBindingGroup is a 2 dimension array.\r
- // The second dimension is include following element: DriverBinding, \r
- // ComponentName, DriverConfiguration, DriverDiag;\r
- // \r
- String[][] driverBindingGroup = this.saq.getExternProtocolGroup();\r
-\r
-\r
- //\r
- // inital BitMask;\r
- // \r
- int BitMask = 0;\r
-\r
- //\r
- // Write driver binding protocol extern to autogen.c\r
- //\r
- for (int i = 0; i < driverBindingGroup.length; i++) {\r
- if (driverBindingGroup[i][0] != null) {\r
- globalDeclarations.append("extern EFI_DRIVER_BINDING_PROTOCOL ");\r
- globalDeclarations.append(driverBindingGroup[i][0]);\r
- globalDeclarations.append(";\r\n");\r
- }\r
- }\r
-\r
- //\r
- // Write component name protocol extern to autogen.c\r
- //\r
- if (!componentNamePcd) {\r
- for (int i = 0; i < driverBindingGroup.length; i++) {\r
- if (driverBindingGroup[i][1]!= null) {\r
- if (driverBindingGroup[i][0] != null) {\r
- BitMask |= 0x01;\r
- globalDeclarations.append("extern EFI_COMPONENT_NAME_PROTOCOL ");\r
- globalDeclarations.append(driverBindingGroup[i][1]);\r
- globalDeclarations.append(";\r\n");\r
- } else {\r
- throw new AutoGenException("DriverBinding can't be empty!!");\r
- }\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Write driver configration protocol extern to autogen.c\r
- //\r
- for (int i = 0; i < driverBindingGroup.length; i++) {\r
- if (driverBindingGroup[i][2] != null) {\r
- if (driverBindingGroup[i][0] != null) {\r
- BitMask |= 0x02;\r
- globalDeclarations.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");\r
- globalDeclarations.append(driverBindingGroup[i][2]);\r
- globalDeclarations.append(";\r\n");\r
- } else {\r
- throw new AutoGenException("DriverBinding can't be empty!!");\r
- }\r
- }\r
- }\r
-\r
- //\r
- // Write driver dignastic protocol extern to autogen.c\r
- //\r
- if (!driverDiagnostPcd) {\r
- for (int i = 0; i < driverBindingGroup.length; i++) {\r
- if (driverBindingGroup[i][3] != null) {\r
- if (driverBindingGroup[i][0] != null) {\r
- BitMask |= 0x04;\r
- globalDeclarations.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");\r
- globalDeclarations.append(driverBindingGroup[i][3]);\r
- globalDeclarations.append(";\r\n");\r
- } else {\r
- throw new AutoGenException("DriverBinding can't be empty!!");\r
- }\r
- }\r
- }\r
- }\r
-\r
-\r
- //\r
- // Write driver module protocol bitmask.\r
- //\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");\r
- fileBuffer.append(Integer.toString(BitMask));\r
- fileBuffer.append(";\r\n");\r
-\r
- //\r
- // Write driver module protocol list entry\r
- //\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");\r
-\r
- fileBuffer.append(Integer.toString(driverBindingGroup.length));\r
- fileBuffer.append(";\r\n");\r
-\r
- //\r
- // Write drive module protocol list to autogen.c\r
- //\r
- if (driverBindingGroup.length > 0) {\r
- fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");\r
- }\r
-\r
-\r
- for (int i = 0; i < driverBindingGroup.length; i++) {\r
- if (i != 0) {\r
- fileBuffer.append(",");\r
- }\r
- //\r
- // DriverBinding\r
- // \r
- fileBuffer.append("\r\n {\r\n");\r
- fileBuffer.append(" &");\r
- fileBuffer.append(driverBindingGroup[i][0]);\r
- fileBuffer.append(", \r\n");\r
-\r
- //\r
- // ComponentName\r
- // \r
- if (driverBindingGroup[i][1] != null && componentNamePcd != true) {\r
- fileBuffer.append(" &");\r
- fileBuffer.append(driverBindingGroup[i][1]);\r
- fileBuffer.append(", \r\n");\r
- } else {\r
- fileBuffer.append(" NULL, \r\n");\r
- }\r
-\r
- //\r
- // DriverConfiguration\r
- // \r
- if (driverBindingGroup[i][2] != null) {\r
- fileBuffer.append(" &");\r
- fileBuffer.append(driverBindingGroup[i][2]);\r
- fileBuffer.append(", \r\n");\r
- } else {\r
- fileBuffer.append(" NULL, \r\n");\r
- }\r
-\r
- //\r
- // DriverDiagnostic\r
- // \r
- if (driverBindingGroup[i][3] != null && driverDiagnostPcd != true) {\r
- fileBuffer.append(" &");\r
- fileBuffer.append(driverBindingGroup[i][3]);\r
- fileBuffer.append(", \r\n");\r
- } else {\r
- fileBuffer.append(" NULL, \r\n");\r
- }\r
- fileBuffer.append(" }");\r
- }\r
-\r
- if (driverBindingGroup.length > 0) {\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
- /**\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 ExternCallBackToAutoGenC(StringBuffer fileBuffer)\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
- 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
- //\r
- // Add c code in autogen.c which relate to <SetVirtualAddressMapCallBack>\r
- // and <ExitBootServicesCallBack>\r
- //\r
- String moduleType = this.moduleId.getModuleType();\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
- // If moduleType is one of above, call setVirtualAddressToAutogenC,\r
- // and setExitBootServiceToAutogenC.\r
- // \r
- setVirtualAddressToAutogenC(fileBuffer);\r
- setExitBootServiceToAutogenC(fileBuffer);\r
- break;\r
- default:\r
- break;\r
- }\r
- }\r
-\r
- /**\r
- copyFlashMapHToDebugDir\r
- \r
- This function is to copy the falshmap.h to debug directory and change \r
- its name to TianoR8FlashMap.h\r
- \r
- @param \r
- @return\r
- **/\r
- private void copyFlashMapHToDebugDir() throws AutoGenException{\r
-\r
- File inFile = new File(fvDir + File.separatorChar + CommonDefinition.FLASHMAPH);\r
- int size = (int)inFile.length();\r
- byte[] buffer = new byte[size];\r
- File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.TIANOR8PLASHMAPH);\r
- //\r
- // If TianoR8FlashMap.h existed and the flashMap.h don't change,\r
- // do nothing.\r
- //\r
- if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {\r
- if (inFile.exists()) {\r
- try {\r
- FileInputStream fis = new FileInputStream (inFile);\r
- fis.read(buffer);\r
- FileOutputStream fos = new FileOutputStream(outFile);\r
- fos.write(buffer);\r
- fis.close();\r
- fos.close();\r
- } catch (IOException e) {\r
- throw new AutoGenException("The file, flashMap.h can't be open!");\r
- }\r
-\r
- } else {\r
- throw new AutoGenException("The file, flashMap.h doesn't exist!");\r
- }\r
- }\r
- }\r
-\r
- /**\r
- This function first order the library instances, then collect\r
- library instance 's PPI, Protocol, GUID,\r
- SetVirtalAddressMapCallBack, ExitBootServiceCallBack, and\r
- Destructor, Constructor.\r
- \r
- @param\r
- @return \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[] setVirtuals = 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
- //\r
- // Get override map\r
- //\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 CName list from <PPis>, <Protocols>, <Guids>, etc. of this library\r
- // instance.\r
- //\r
- String[] guidCNameList = saq.getCNameArray(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 < guidCNameList.length; index++) {\r
- this.mGuidCNameList.add(guidCNameList[index]);\r
- }\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("\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
- // set count to the number of valid entries\r
- //\r
- int Count = 0;\r
- int i = 0;\r
- if (this.setVirtalAddList != null) {\r
- for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
- if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
- break;\r
- }\r
- }\r
- Count = i;\r
- }\r
-\r
- fileBuffer.append(Integer.toString(Count));\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("\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
- //\r
- for (i = 0; i < this.setVirtalAddList.size(); i++) {\r
- if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {\r
- break;\r
- }\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("\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("\r\n ");\r
- } else {\r
- fileBuffer.append(",\r\n ");\r
- }\r
-\r
- fileBuffer.append(this.setVirtalAddList.get(i));\r
- }\r
- //\r
- // add the NULL at the end of _gDriverSetVirtualAddressMapEvent list.\r
- //\r
- fileBuffer.append(",\r\n NULL");\r
- fileBuffer.append("\r\n};\r\n\r\n");\r
- }\r
- }\r
-\r
-\r
- private void setExitBootServiceToAutogenC(StringBuffer fileBuffer){\r
- //\r
- // Entry point lib for these module types needs to know the count.\r
- //\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
- // set count to the number of valid entries.\r
- //\r
- int Count = 0;\r
- int i = 0; \r
- if (this.exitBootServiceList != null) {\r
- for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
- if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
- break;\r
- }\r
- }\r
- Count = i;\r
- }\r
- fileBuffer.append(Integer.toString(Count));\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("\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
- //\r
- for (i = 0; i < this.exitBootServiceList.size(); i++) {\r
- if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {\r
- break;\r
- }\r
-\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("\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("\r\n ");\r
- } else {\r
- fileBuffer.append(",\r\n ");\r
- }\r
- fileBuffer.append(this.exitBootServiceList.get(i));\r
- }\r
-\r
- fileBuffer.append(",\r\n NULL");\r
- fileBuffer.append("\r\n};\r\n\r\n");\r
- } \r
- }\r
- /**\r
- setPcdComponentName\r
- \r
- Get the Pcd Value of ComponentName to \r
- decide whether need to disable the componentName. \r
- \r
- **/\r
- public void setPcdComponentName (){\r
- String pcdValue = null;\r
- pcdValue = saq.getPcdValueBycName("PcdComponentNameDisable");\r
- if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
- this.componentNamePcd = true;\r
- }\r
- }\r
-\r
- /**\r
- setPcdDriverDiagnostic \r
- \r
- Get the Pcd Value of DriverDiagnostic to \r
- decide whether need to disable DriverDiagnostic.\r
- \r
- **/\r
- public void setPcdDriverDiagnostic (){\r
- String pcdValue = null;\r
- pcdValue = saq.getPcdValueBycName("PcdDriverDiagnosticsDisable");\r
- if (pcdValue != null && pcdValue.equalsIgnoreCase("true")) {\r
- this.driverDiagnostPcd = true;\r
- }\r
- } \r
-\r
-}\r