4 This class is to generate Autogen.h and Autogen.c according to module surface area
5 or library surface area.
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 package org
.tianocore
.build
.autogen
;
20 import org
.tianocore
.build
.global
.GlobalData
;
21 import org
.tianocore
.build
.global
.Spd
;
22 import org
.tianocore
.build
.global
.SurfaceAreaQuery
;
23 import org
.tianocore
.build
.id
.ModuleIdentification
;
24 import org
.tianocore
.build
.id
.PackageIdentification
;
25 import org
.tianocore
.GuidsDocument
;
26 import org
.tianocore
.LibraryClassDocument
.LibraryClass
;
27 import org
.tianocore
.PPIsDocument
;
28 import org
.tianocore
.ProtocolsDocument
;
29 import org
.tianocore
.build
.pcd
.action
.PCDAutoGenAction
;
30 import org
.tianocore
.build
.exception
.*;
31 import org
.tianocore
.logger
.EdkLog
;
32 import org
.apache
.tools
.ant
.BuildException
;
33 import org
.apache
.xmlbeans
.XmlObject
;
36 import java
.io
.FileReader
;
37 import java
.io
.FileWriter
;
38 import java
.util
.ArrayList
;
39 import java
.util
.HashSet
;
40 import java
.util
.Iterator
;
41 import java
.util
.LinkedList
;
42 import java
.util
.List
;
47 * This class is to generate Autogen.h and Autogen.c according to module surface
48 * area or library surface area.
50 public class AutoGen
{
52 // / The output path of Autogen.h and Autogen.c
54 private String outputPath
;
57 // / The base name of module or library.
59 private ModuleIdentification moduleId
;
62 // / The build architecture
67 // / PcdAutogen instance which is used to manage how to generate the PCD
70 private PCDAutoGenAction myPcdAutogen
;
73 // / The protocl list which records in module or library surface area and
74 // / it's dependence on library instance surface area.
76 private Set
<String
> mProtocolList
= new HashSet
<String
>();
79 // / The Ppi list which recorded in module or library surface area and its
80 // / dependency on library instance surface area.
82 private Set
<String
> mPpiList
= new HashSet
<String
>();
85 // / The Guid list which recoreded in module or library surface area and it's
86 // / dependence on library instance surface area.
88 private Set
<String
> mGuidList
= new HashSet
<String
>();
91 // The dependence package list which recoreded in module or library surface
92 // area and it's dependence on library instance surface are.
94 private List
<PackageIdentification
> mDepPkgList
= new LinkedList
<PackageIdentification
>();
98 * This function mainly initialize some member variable.
101 * Output path of AutoGen file.
105 * Target architecture.
107 public AutoGen(String outputPath
, ModuleIdentification moduleId
, String arch
) {
108 this.outputPath
= outputPath
;
109 this.moduleId
= moduleId
;
117 * This function save the content in stringBuffer to file.
122 * The content of AutoGen file in buffer.
123 * @return "true" successful, "false" failed.
125 private boolean saveFile(String fileName
, StringBuffer fileBuffer
) {
127 File autoGenH
= new File(fileName
);
130 // if the file exists, compare their content
132 if (autoGenH
.exists()) {
133 FileReader fIn
= new FileReader(autoGenH
);
134 char[] oldFileBuffer
= new char[(int) autoGenH
.length()];
135 fIn
.read(oldFileBuffer
, 0, (int) autoGenH
.length());
139 // if we got the same file, don't re-generate it to prevent
140 // sources depending on it from re-building
142 if (fileBuffer
.toString().compareTo(new String(oldFileBuffer
)) == 0) {
146 FileWriter fOut
= new FileWriter(autoGenH
);
147 fOut
.write(fileBuffer
.toString());
149 } catch (Exception e
) {
156 * genAutogen function
158 * This function call libGenAutoGen or moduleGenAutogen function, which
159 * dependence on generate library autogen or module autogen.
161 * @throws BuildException
162 * Failed to creat AutoGen.c & AutoGen.h.
164 public void genAutogen() throws BuildException
{
167 // If outputPath do not exist, create it.
169 File path
= new File(outputPath
);
173 // Check current is library or not, then call the corresponding
176 if (this.moduleId
.isLibrary()) {
182 } catch (Exception e
) {
183 throw new BuildException(
184 "Failed to create AutoGen.c & AutoGen.h!\n"
190 * moduleGenAutogen function
192 * This function generates AutoGen.c & AutoGen.h for module.
194 * @throws BuildException
195 * Faile to create module AutoGen.c & AutoGen.h.
197 void moduleGenAutogen() throws BuildException
{
202 } catch (Exception e
) {
203 throw new BuildException(
204 "Faile to create module AutoGen.c & AutoGen.h!\n"
210 * libGenAutogen function
212 * This function generates AutoGen.c & AutoGen.h for library.
214 * @throws BuildException
215 * Faile to create library AutoGen.c & AutoGen.h
217 void libGenAutogen() throws BuildException
{
221 } catch (Exception e
) {
222 throw new BuildException(
223 "Faile to create library AutoGen.c & AutoGen.h!\n"
231 * This function generates AutoGen.h for module.
233 * @throws BuildException
234 * Failed to generate AutoGen.h.
236 void moduleGenAutogenH() throws AutoGenException
{
238 Set
<String
> libClassIncludeH
;
240 // List<String> headerFileList;
241 List
<String
> headerFileList
;
243 StringBuffer fileBuffer
= new StringBuffer(8192);
246 // Write Autogen.h header notation
248 fileBuffer
.append(CommonDefinition
.autogenHNotation
);
251 // Add #ifndef ${BaseName}_AUTOGENH
252 // #def ${BseeName}_AUTOGENH
254 fileBuffer
.append("#ifndef " + this.moduleId
.getName().toUpperCase()
256 fileBuffer
.append("#define " + this.moduleId
.getName().toUpperCase()
257 + "_AUTOGENH\r\n\r\n");
260 // Write the specification version and release version at the begine
261 // of autogen.h file.
262 // Note: the specification version and release version should
263 // be got from module surface area instead of hard code by it's
266 moduleType
= SurfaceAreaQuery
.getModuleType();
267 // switch (CommonDefinition.getModuleType(moduleType)) {
268 // case CommonDefinition.ModuleTypeDxeCore:
269 // case CommonDefinition.ModuleTypeDxeDriver:
270 // case CommonDefinition.ModuleTypeDxeRuntimeDriver:
271 // case CommonDefinition.ModuleTypeDxeSmmDriver:
272 // case CommonDefinition.ModuleTypeDxeSalDriver:
273 // case CommonDefinition.ModuleTypeUefiDriver:
274 // case CommonDefinition.ModuleTypeUefiApplication:
275 // fileBuffer.append(CommonDefinition.autoGenHLine1);
278 // fileBuffer.append(CommonDefinition.autoGenHVersionDefault);
281 // switch (CommonDefinition.getModuleType(moduleType)) {
282 // case CommonDefinition.ModuleTypeUefiDriver:
283 // case CommonDefinition.ModuleTypeUefiApplication:
284 // fileBuffer.append(CommonDefinition.autoGenHReleaseDefault);
287 // fileBuffer.append(CommonDefinition.autoGenHLine2);
292 // Add "extern int __make_me_compile_correctly;" at begin of
295 fileBuffer
.append(CommonDefinition
.autoGenHbegin
);
298 // Put EFI_SPECIFICATION_VERSION, and EDK_RELEASE_VERSION.
300 String
[] specList
= SurfaceAreaQuery
.getExternSpecificaiton();
301 for (int i
= 0; i
< specList
.length
; i
++) {
302 fileBuffer
.append(CommonDefinition
.marcDefineStr
+ specList
[i
]
306 // Write consumed package's mdouleInfo related .h file to autogen.h
308 // PackageIdentification[] consumedPkgIdList = SurfaceAreaQuery
309 // .getDependencePkg(this.arch);
310 PackageIdentification
[] consumedPkgIdList
= SurfaceAreaQuery
311 .getDependencePkg(null);
312 if (consumedPkgIdList
!= null) {
313 headerFileList
= depPkgToAutogenH(consumedPkgIdList
, moduleType
);
314 item
= headerFileList
.iterator();
315 while (item
.hasNext()) {
316 fileBuffer
.append(item
.next().toString());
321 // Write library class's related *.h file to autogen.h.
323 String
[] libClassList
= SurfaceAreaQuery
324 .getLibraryClasses(CommonDefinition
.AlwaysConsumed
);
325 if (libClassList
!= null) {
326 libClassIncludeH
= LibraryClassToAutogenH(libClassList
);
327 item
= libClassIncludeH
.iterator();
328 while (item
.hasNext()) {
329 fileBuffer
.append(item
.next().toString());
333 libClassList
= SurfaceAreaQuery
334 .getLibraryClasses(CommonDefinition
.AlwaysProduced
);
335 if (libClassList
!= null) {
336 libClassIncludeH
= LibraryClassToAutogenH(libClassList
);
337 item
= libClassIncludeH
.iterator();
338 while (item
.hasNext()) {
339 fileBuffer
.append(item
.next().toString());
342 fileBuffer
.append("\r\n");
345 // Write PCD autogen information to AutoGen.h.
347 if (this.myPcdAutogen
!= null) {
348 fileBuffer
.append("\r\n");
349 fileBuffer
.append(this.myPcdAutogen
.OutputH());
353 // Append the #endif at AutoGen.h
355 fileBuffer
.append("#endif\r\n");
358 // Save string buffer content in AutoGen.h.
360 if (!saveFile(outputPath
+ File
.separatorChar
+ "AutoGen.h", fileBuffer
)) {
361 throw new BuildException("Failed to generate AutoGen.h !!!");
368 * This function generates AutoGen.c for module.
370 * @throws BuildException
371 * Failed to generate AutoGen.c.
373 void moduleGenAutogenC() throws AutoGenException
{
375 StringBuffer fileBuffer
= new StringBuffer(8192);
377 // Write Autogen.c header notation
379 fileBuffer
.append(CommonDefinition
.autogenCNotation
);
382 // Write #include <AutoGen.h> at beginning of AutoGen.c
384 fileBuffer
.append(CommonDefinition
.includeAutogenH
);
387 // Get the native MSA file infomation. Since before call autogen,
388 // the MSA native <Externs> information were overrided. So before
389 // process <Externs> it should be set the DOC as the Native MSA info.
391 Map
<String
, XmlObject
> doc
= GlobalData
.getNativeMsa(this.moduleId
);
392 SurfaceAreaQuery
.push(doc
);
395 // DriverBinding/ComponentName/DriverConfiguration/DriverDialog
399 ExternsDriverBindingToAutoGenC(fileBuffer
);
402 // Write DriverExitBootServicesEvent/DriverSetVirtualAddressMapEvent
405 ExternCallBackToAutoGenC(fileBuffer
);
408 // Write EntryPoint to autgoGen.c
410 String
[] entryPointList
= SurfaceAreaQuery
.getModuleEntryPointArray();
411 EntryPointToAutoGen(CommonDefinition
.remDupString(entryPointList
), fileBuffer
);
415 // Restore the DOC which include the FPD module info.
417 SurfaceAreaQuery
.pop();
420 // Write Guid to autogen.c
422 String guid
= CommonDefinition
.formatGuidName(SurfaceAreaQuery
426 .append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");
428 throw new AutoGenException("Guid value must set!\n");
432 // Formate Guid as ANSI c form.Example:
433 // {0xd2b2b828, 0x826, 0x48a7,{0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24,
437 fileBuffer
.append(guid
);
438 fileBuffer
.append("};\r\n");
441 // Generate library instance consumed protocol, guid, ppi, pcd list.
442 // Save those to this.protocolList, this.ppiList, this.pcdList,
443 // this.guidList. Write Consumed library constructor and desconstuct to
446 LibInstanceToAutogenC(fileBuffer
);
449 // Get module dependent Package identification.
451 PackageIdentification
[] packages
= SurfaceAreaQuery
.getDependencePkg(this.arch
);
452 for (int i
= 0; i
< packages
.length
; i
++){
453 if (!this.mDepPkgList
.contains(packages
[i
])){
454 this.mDepPkgList
.add(packages
[i
]);
460 // Write consumed ppi, guid, protocol to autogen.c
462 ProtocolGuidToAutogenC(fileBuffer
);
463 PpiGuidToAutogenC(fileBuffer
);
464 GuidGuidToAutogenC(fileBuffer
);
467 // Call pcd autogen. PCDAutoGenAction tool only need module name and
468 // isPcdEmulatedDriver as parameter. Library inherits PCD and module's
469 // PCD information has been collected in FPDParser task by
471 // Note : when PCD image tool ready,
472 // isPCDEmulatedDriver parameter will be removed.
475 // this.myPcdAutogen = new PCDAutoGenAction(moduleId.getName(),
476 // moduleId.getGuid(), moduleId.getPackage().getName(), moduleId.getPackage().getGuid(),this.arch,moduleId.getVersion(),false, null);
477 this.myPcdAutogen
= new PCDAutoGenAction(moduleId
.getName(),null,null,null, this.arch
,null,false, null);
478 this.myPcdAutogen
.execute();
479 } catch (Exception e
) {
480 throw new BuildException("PCD Autogen failed:" + e
.getMessage());
483 if (this.myPcdAutogen
!= null) {
484 fileBuffer
.append("\r\n");
485 fileBuffer
.append(this.myPcdAutogen
.OutputC());
488 if (!saveFile(outputPath
+ File
.separatorChar
+ "AutoGen.c", fileBuffer
)) {
489 throw new BuildException("Failed to generate AutoGen.c !!!");
497 * This function generates AutoGen.h for library.
499 * @throws BuildException
500 * Failed to generate AutoGen.c.
502 void libGenAutogenH() throws AutoGenException
{
504 Set
<String
> libClassIncludeH
;
506 List
<String
> headerFileList
;
508 StringBuffer fileBuffer
= new StringBuffer(10240);
511 // Write Autogen.h header notation
513 fileBuffer
.append(CommonDefinition
.autogenHNotation
);
516 // Add #ifndef ${BaseName}_AUTOGENH
517 // #def ${BseeName}_AUTOGENH
519 fileBuffer
.append("#ifndef " + this.moduleId
.getName().toUpperCase()
521 fileBuffer
.append("#define " + this.moduleId
.getName().toUpperCase()
522 + "_AUTOGENH\r\n\r\n");
525 // Write EFI_SPECIFICATION_VERSION and EDK_RELEASE_VERSION
526 // to autogen.h file.
527 // Note: the specification version and release version should
528 // be get from module surface area instead of hard code.
530 fileBuffer
.append(CommonDefinition
.autoGenHbegin
);
531 String
[] specList
= SurfaceAreaQuery
.getExternSpecificaiton();
532 for (int i
= 0; i
< specList
.length
; i
++) {
533 fileBuffer
.append(CommonDefinition
.marcDefineStr
+ specList
[i
]
536 // fileBuffer.append(CommonDefinition.autoGenHLine1);
537 // fileBuffer.append(CommonDefinition.autoGenHLine2);
540 // Write consumed package's mdouleInfo related *.h file to autogen.h.
542 moduleType
= SurfaceAreaQuery
.getModuleType();
543 PackageIdentification
[] cosumedPkglist
= SurfaceAreaQuery
544 .getDependencePkg(this.arch
);
545 headerFileList
= depPkgToAutogenH(cosumedPkglist
, moduleType
);
546 item
= headerFileList
.iterator();
547 while (item
.hasNext()) {
548 fileBuffer
.append(item
.next().toString());
551 // Write library class's related *.h file to autogen.h
553 String
[] libClassList
= SurfaceAreaQuery
554 .getLibraryClasses(CommonDefinition
.AlwaysConsumed
);
555 if (libClassList
!= null) {
556 libClassIncludeH
= LibraryClassToAutogenH(libClassList
);
557 item
= libClassIncludeH
.iterator();
558 while (item
.hasNext()) {
559 fileBuffer
.append(item
.next().toString());
563 libClassList
= SurfaceAreaQuery
564 .getLibraryClasses(CommonDefinition
.AlwaysProduced
);
565 if (libClassList
!= null) {
566 libClassIncludeH
= LibraryClassToAutogenH(libClassList
);
567 item
= libClassIncludeH
.iterator();
568 while (item
.hasNext()) {
569 fileBuffer
.append(item
.next().toString());
572 fileBuffer
.append("\r\n");
575 // Write PCD information to library AutoGen.h.
577 if (this.myPcdAutogen
!= null) {
578 fileBuffer
.append("\r\n");
579 fileBuffer
.append(this.myPcdAutogen
.OutputH());
583 // Append the #endif at AutoGen.h
585 fileBuffer
.append("#endif\r\n");
588 // Save content of string buffer to AutoGen.h file.
590 if (!saveFile(outputPath
+ File
.separatorChar
+ "AutoGen.h", fileBuffer
)) {
591 throw new BuildException("Failed to generate AutoGen.h !!!");
598 * This function generates AutoGen.h for library.
600 * @throws BuildException
601 * Failed to generate AutoGen.c.
603 void libGenAutogenC() throws BuildException
{
604 StringBuffer fileBuffer
= new StringBuffer(10240);
607 // Write Autogen.c header notation
609 fileBuffer
.append(CommonDefinition
.autogenCNotation
);
611 fileBuffer
.append(CommonDefinition
.autoGenCLine1
);
612 fileBuffer
.append("\r\n");
615 // Call pcd autogen. PCDAutoGenAction tool only need module name and
616 // isPcdEmulatedDriver as parameter. Library inherit PCD and module's
617 // PCD information has been collected in FPDParser task by
619 // Note : when PCD image tool ready,
620 // isPCDEmulatedDriver parameter will be removed.
623 // this.myPcdAutogen = new PCDAutoGenAction(this.moduleId.getName(),
624 // this.moduleId.getGuid(),moduleId.getPackage().getName(),moduleId.getPackage().getGuid(), this.arch, moduleId.getVersion(),true, SurfaceAreaQuery.getModulePcdEntryNameArray());
625 this.myPcdAutogen
= new PCDAutoGenAction(this.moduleId
.getName(),
632 SurfaceAreaQuery
.getModulePcdEntryNameArray());
634 this.myPcdAutogen
.execute();
635 } catch (Exception e
) {
636 throw new BuildException(e
.getMessage());
639 if (this.myPcdAutogen
!= null) {
640 fileBuffer
.append("\r\n");
641 fileBuffer
.append(this.myPcdAutogen
.OutputC());
644 if (!saveFile(outputPath
+ File
.separatorChar
+ "AutoGen.c", fileBuffer
)) {
645 throw new BuildException("Failed to generate AutoGen.c !!!");
650 * LibraryClassToAutogenH
652 * This function returns *.h files declared by library classes which are
653 * consumed or produced by current build module or library.
655 * @param libClassList
656 * List of library class which consumed or produce by current
657 * build module or library.
658 * @return includeStrList List of *.h file.
660 Set
<String
> LibraryClassToAutogenH(String
[] libClassList
)
661 throws AutoGenException
{
662 Set
<String
> includStrList
= new HashSet
<String
>();
663 String includerName
[];
667 // Get include file from GlobalData's SPDTable according to
668 // library class name.
671 for (int i
= 0; i
< libClassList
.length
; i
++) {
672 includerName
= GlobalData
.getLibraryClassHeaderFiles(
673 SurfaceAreaQuery
.getDependencePkg(this.arch
),
675 if (includerName
== null) {
676 throw new AutoGenException("Can not find library class ["
677 + libClassList
[i
] + "] declaration in every packages. ");
679 for (int j
= 0; j
< includerName
.length
; j
++) {
680 String includeNameStr
= includerName
[j
];
681 if (includeNameStr
!= null) {
682 str
= CommonDefinition
.include
+ " " + "<";
683 str
= str
+ includeNameStr
+ ">\r\n";
684 includStrList
.add(str
);
685 includeNameStr
= null;
689 return includStrList
;
695 * This function add include file in AutoGen.h file.
697 * @param packageNameList
698 * List of module depended package.
703 List
<String
> depPkgToAutogenH(PackageIdentification
[] packageNameList
,
704 String moduleType
) throws AutoGenException
{
706 List
<String
> includeStrList
= new LinkedList
<String
>();
708 String includeStr
= "";
711 // Get include file from moduleInfo file
713 for (int i
= 0; i
< packageNameList
.length
; i
++) {
714 pkgHeader
= GlobalData
.getPackageHeaderFiles(packageNameList
[i
],
716 if (pkgHeader
== null) {
717 throw new AutoGenException("Can not find package ["
719 + "] declaration in every packages. ");
720 } else if (!pkgHeader
.equalsIgnoreCase("")) {
721 includeStr
= CommonDefinition
.include
+ " <" + pkgHeader
723 includeStrList
.add(includeStr
);
727 return includeStrList
;
731 * EntryPointToAutoGen
733 * This function convert <ModuleEntryPoint> & <ModuleUnloadImage>
734 * information in mas to AutoGen.c
736 * @param entryPointList
737 * List of entry point.
739 * String buffer fo AutoGen.c.
742 void EntryPointToAutoGen(String
[] entryPointList
, StringBuffer fileBuffer
)
743 throws BuildException
{
745 String typeStr
= SurfaceAreaQuery
.getModuleType();
748 // The parameters and return value of entryPoint is difference
749 // for difference module type.
751 switch (CommonDefinition
.getModuleType(typeStr
)) {
753 case CommonDefinition
.ModuleTypePeiCore
:
754 if (entryPointList
== null ||entryPointList
.length
!= 1 ) {
755 throw new BuildException(
756 "Module type = 'PEI_CORE', only have one module entry point!");
758 fileBuffer
.append("EFI_STATUS\r\n");
759 fileBuffer
.append("EFIAPI\r\n");
760 fileBuffer
.append(entryPointList
[0]);
761 fileBuffer
.append(" (\r\n");
763 .append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
765 .append(" IN VOID *OldCoreData\r\n");
766 fileBuffer
.append(" );\r\n\r\n");
768 fileBuffer
.append("EFI_STATUS\r\n");
769 fileBuffer
.append("EFIAPI\r\n");
770 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
772 .append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
774 .append(" IN VOID *OldCoreData\r\n");
775 fileBuffer
.append(" )\r\n\r\n");
776 fileBuffer
.append("{\r\n");
777 fileBuffer
.append(" return ");
778 fileBuffer
.append(entryPointList
[0]);
779 fileBuffer
.append(" (PeiStartupDescriptor, OldCoreData);\r\n");
780 fileBuffer
.append("}\r\n\r\n");
784 case CommonDefinition
.ModuleTypeDxeCore
:
785 fileBuffer
.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
786 if (entryPointList
== null || entryPointList
.length
!= 1) {
787 throw new BuildException(
788 "Module type = 'DXE_CORE', only have one module entry point!");
791 fileBuffer
.append("VOID\r\n");
792 fileBuffer
.append("EFIAPI\r\n");
793 fileBuffer
.append(entryPointList
[0]);
794 fileBuffer
.append(" (\n");
795 fileBuffer
.append(" IN VOID *HobStart\r\n");
796 fileBuffer
.append(" );\r\n\r\n");
798 fileBuffer
.append("VOID\r\n");
799 fileBuffer
.append("EFIAPI\r\n");
800 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
801 fileBuffer
.append(" IN VOID *HobStart\r\n");
802 fileBuffer
.append(" )\r\n\r\n");
803 fileBuffer
.append("{\r\n");
804 fileBuffer
.append(" ");
805 fileBuffer
.append(entryPointList
[0]);
806 fileBuffer
.append(" (HobStart);\r\n");
807 fileBuffer
.append("}\r\n\r\n");
811 case CommonDefinition
.ModuleTypePeim
:
812 int entryPointCount
= 0;
814 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");
815 if (entryPointList
== null) {
816 fileBuffer
.append("EFI_STATUS\r\n");
817 fileBuffer
.append("EFIAPI\r\n");
818 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
819 fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
820 fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
821 fileBuffer
.append(" )\r\n\r\n");
822 fileBuffer
.append("{\r\n");
823 fileBuffer
.append(" return EFI_SUCCESS;\r\n");
824 fileBuffer
.append("}\r\n\r\n");
827 for (int i
= 0; i
< entryPointList
.length
; i
++) {
828 fileBuffer
.append("EFI_STATUS\r\n");
829 fileBuffer
.append("EFIAPI\r\n");
830 fileBuffer
.append(entryPointList
[i
]);
831 fileBuffer
.append(" (\r\n");
833 .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
835 .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
836 fileBuffer
.append(" );\r\n");
841 fileBuffer
.append("EFI_STATUS\r\n");
842 fileBuffer
.append("EFIAPI\r\n");
843 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
844 fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
845 fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
846 fileBuffer
.append(" )\r\n\r\n");
847 fileBuffer
.append("{\r\n");
848 if (entryPointCount
== 1) {
849 fileBuffer
.append(" return ");
850 fileBuffer
.append(entryPointList
[0]);
851 fileBuffer
.append(" (FfsHeader, PeiServices);\r\n");
853 fileBuffer
.append(" EFI_STATUS Status;\r\n");
854 fileBuffer
.append(" EFI_STATUS CombinedStatus;\r\n\r\n");
855 fileBuffer
.append(" CombinedStatus = EFI_LOAD_ERROR;\r\n\r\n");
856 for (int i
= 0; i
< entryPointList
.length
; i
++) {
857 if (!entryPointList
[i
].equals("")) {
858 fileBuffer
.append(" Status = ");
859 fileBuffer
.append(entryPointList
[i
]);
860 fileBuffer
.append(" (FfsHeader, PeiServices);\r\n");
862 .append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\r\n");
863 fileBuffer
.append(" CombinedStatus = Status;\r\n");
864 fileBuffer
.append(" }\r\n\r\n");
869 fileBuffer
.append(" return CombinedStatus;\r\n");
871 fileBuffer
.append("}\r\n\r\n");
874 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
877 // If entryPoint is null, create an empty ProcessModuleEntryPointList
880 if (entryPointList
== null || entryPointList
.length
== 0){
882 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
883 fileBuffer
.append(Integer
.toString(entryPointCount
));
884 fileBuffer
.append(";\r\n");
886 .append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
888 .append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");
890 fileBuffer
.append("EFI_STATUS\r\n");
891 fileBuffer
.append("EFIAPI\r\n");
892 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
893 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
894 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
895 fileBuffer
.append(" )\r\n\r\n");
896 fileBuffer
.append("{\r\n");
897 fileBuffer
.append(" return EFI_SUCCESS;\r\n");
898 fileBuffer
.append("}\r\n\r\n");
901 for (int i
= 0; i
< entryPointList
.length
; i
++) {
902 if (!entryPointList
[i
].equals("")) {
903 fileBuffer
.append("EFI_STATUS\r\n");
904 fileBuffer
.append("EFIAPI\r\n");
905 fileBuffer
.append(entryPointList
[i
]);
906 fileBuffer
.append(" (\r\n");
907 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
908 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
909 fileBuffer
.append(" );\r\n");
916 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
917 fileBuffer
.append(Integer
.toString(entryPointCount
));
918 fileBuffer
.append(";\r\n");
920 .append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
922 .append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");
924 fileBuffer
.append("EFI_STATUS\r\n");
925 fileBuffer
.append("EFIAPI\r\n");
926 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
927 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
928 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
929 fileBuffer
.append(" )\r\n\r\n");
930 fileBuffer
.append("{\r\n");
933 for (int i
= 0; i
< entryPointList
.length
; i
++) {
935 .append(" if (SetJump (&mJumpContext) == 0) {\r\n");
936 fileBuffer
.append(" ExitDriver (");
937 fileBuffer
.append(entryPointList
[i
]);
938 fileBuffer
.append(" (ImageHandle, SystemTable));\r\n");
939 fileBuffer
.append(" ASSERT (FALSE);\r\n");
940 fileBuffer
.append(" }\r\n");
943 fileBuffer
.append(" return mDriverEntryPointStatus;\r\n");
944 fileBuffer
.append("}\r\n\r\n");
946 fileBuffer
.append("VOID\r\n");
947 fileBuffer
.append("EFIAPI\r\n");
948 fileBuffer
.append("ExitDriver (\r\n");
949 fileBuffer
.append(" IN EFI_STATUS Status\n");
950 fileBuffer
.append(" )\r\n\r\n");
951 fileBuffer
.append("{\r\n");
953 .append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
954 fileBuffer
.append(" mDriverEntryPointStatus = Status;\r\n");
955 fileBuffer
.append(" }\r\n");
956 fileBuffer
.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
957 fileBuffer
.append(" ASSERT (FALSE);\r\n");
958 fileBuffer
.append("}\r\n\r\n");
964 // Add "ModuleUnloadImage" for DxeSmmDriver module type;
966 entryPointList
= SurfaceAreaQuery
.getModuleUnloadImageArray();
967 entryPointList
= CommonDefinition
.remDupString(entryPointList
);
971 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
972 fileBuffer
.append(Integer
.toString(entryPointCount
));
973 fileBuffer
.append(";\r\n\r\n");
975 if (entryPointList
!= null) {
976 for (int i
= 0; i
< entryPointList
.length
; i
++) {
977 if (!entryPointList
[i
].equals("")) {
978 fileBuffer
.append("EFI_STATUS\r\n");
979 fileBuffer
.append("EFIAPI\r\n");
980 fileBuffer
.append(entryPointList
[i
]);
981 fileBuffer
.append(" (\r\n");
983 .append(" EFI_HANDLE ImageHandle\r\n");
984 fileBuffer
.append(" );\r\n");
991 fileBuffer
.append("EFI_STATUS\r\n");
992 fileBuffer
.append("EFIAPI\r\n");
993 fileBuffer
.append("ProcessModuleUnloadList (\r\n");
994 fileBuffer
.append(" EFI_HANDLE ImageHandle\r\n");
995 fileBuffer
.append(" )\r\n");
996 fileBuffer
.append("{\r\n");
998 if (entryPointCount
== 0) {
999 fileBuffer
.append(" return EFI_SUCCESS;\r\n");
1000 } else if (entryPointCount
== 1) {
1001 fileBuffer
.append(" return ");
1002 fileBuffer
.append(entryPointList
[0]);
1003 fileBuffer
.append("(ImageHandle);\r\n");
1005 fileBuffer
.append(" EFI_STATUS Status;\r\n\r\n");
1006 fileBuffer
.append(" Status = EFI_SUCCESS;\r\n\r\n");
1007 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1009 fileBuffer
.append(" Status = ");
1010 fileBuffer
.append(entryPointList
[i
]);
1011 fileBuffer
.append("(ImageHandle);\r\n");
1013 fileBuffer
.append(" if (EFI_ERROR (Status)) {\r\n");
1014 fileBuffer
.append(" ");
1015 fileBuffer
.append(entryPointList
[i
]);
1016 fileBuffer
.append("(ImageHandle);\r\n");
1017 fileBuffer
.append(" } else {\r\n");
1018 fileBuffer
.append(" Status = ");
1019 fileBuffer
.append(entryPointList
[i
]);
1020 fileBuffer
.append("(ImageHandle);\r\n");
1021 fileBuffer
.append(" }\r\n");
1024 fileBuffer
.append(" return Status;\r\n");
1026 fileBuffer
.append("}\r\n\r\n");
1029 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1030 case CommonDefinition
.ModuleTypeDxeDriver
:
1031 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1032 case CommonDefinition
.ModuleTypeUefiDriver
:
1033 case CommonDefinition
.ModuleTypeUefiApplication
:
1034 entryPointCount
= 0;
1035 fileBuffer
.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
1037 // If entry point is null, create a empty ProcessModuleEntryPointList function.
1039 if (entryPointList
== null || entryPointList
.length
== 0){
1041 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\r\n");
1042 fileBuffer
.append("EFI_STATUS\r\n");
1043 fileBuffer
.append("EFIAPI\r\n");
1044 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
1045 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
1046 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
1047 fileBuffer
.append(" )\r\n\r\n");
1048 fileBuffer
.append("{\r\n");
1049 fileBuffer
.append(" return EFI_SUCCESS;\r\n");
1050 fileBuffer
.append("}\r\n");
1053 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1055 fileBuffer
.append("EFI_STATUS\r\n");
1056 fileBuffer
.append("EFIAPI\r\n");
1057 fileBuffer
.append(entryPointList
[i
]);
1058 fileBuffer
.append(" (\r\n");
1059 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
1060 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
1061 fileBuffer
.append(" );\r\n");
1066 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
1067 fileBuffer
.append(Integer
.toString(entryPointCount
));
1068 fileBuffer
.append(";\r\n");
1069 if (entryPointCount
> 1) {
1071 .append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
1073 .append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");
1075 fileBuffer
.append("\n");
1077 fileBuffer
.append("EFI_STATUS\r\n");
1078 fileBuffer
.append("EFIAPI\r\n");
1079 fileBuffer
.append("ProcessModuleEntryPointList (\r\n");
1080 fileBuffer
.append(" EFI_HANDLE ImageHandle,\r\n");
1081 fileBuffer
.append(" EFI_SYSTEM_TABLE *SystemTable\r\n");
1082 fileBuffer
.append(" )\r\n\r\n");
1083 fileBuffer
.append("{\r\n");
1085 if (entryPointCount
== 1) {
1086 fileBuffer
.append(" return (");
1087 fileBuffer
.append(entryPointList
[0]);
1088 fileBuffer
.append(" (ImageHandle, SystemTable));\r\n");
1090 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1091 if (!entryPointList
[i
].equals("")) {
1093 .append(" if (SetJump (&mJumpContext) == 0) {\r\n");
1094 fileBuffer
.append(" ExitDriver (");
1095 fileBuffer
.append(entryPointList
[i
]);
1096 fileBuffer
.append(" (ImageHandle, SystemTable));\r\n");
1097 fileBuffer
.append(" ASSERT (FALSE);\r\n");
1098 fileBuffer
.append(" }\r\n");
1103 fileBuffer
.append(" return mDriverEntryPointStatus;\r\n");
1105 fileBuffer
.append("}\r\n\r\n");
1107 fileBuffer
.append("VOID\n");
1108 fileBuffer
.append("EFIAPI\n");
1109 fileBuffer
.append("ExitDriver (\r\n");
1110 fileBuffer
.append(" IN EFI_STATUS Status\n");
1111 fileBuffer
.append(" )\r\n\r\n");
1112 fileBuffer
.append("{\r\n");
1113 if (entryPointCount
<= 1) {
1114 fileBuffer
.append(" if (EFI_ERROR (Status)) {\r\n");
1116 .append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");
1117 fileBuffer
.append(" }\r\n");
1119 .append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");
1122 .append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
1123 fileBuffer
.append(" mDriverEntryPointStatus = Status;\r\n");
1124 fileBuffer
.append(" }\r\n");
1125 fileBuffer
.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
1126 fileBuffer
.append(" ASSERT (FALSE);\r\n");
1128 fileBuffer
.append("}\r\n\r\n");
1133 // Add ModuleUnloadImage for DxeDriver and UefiDriver module type.
1135 entryPointList
= SurfaceAreaQuery
.getModuleUnloadImageArray();
1137 // Remover duplicate unload entry point.
1139 entryPointList
= CommonDefinition
.remDupString(entryPointList
);
1140 entryPointCount
= 0;
1141 if (entryPointList
!= null) {
1142 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1143 if (!entryPointList
[i
].equals("")) {
1144 fileBuffer
.append("EFI_STATUS\r\n");
1145 fileBuffer
.append("EFIAPI\r\n");
1146 fileBuffer
.append(entryPointList
[i
]);
1147 fileBuffer
.append(" (\r\n");
1149 .append(" EFI_HANDLE ImageHandle\r\n");
1150 fileBuffer
.append(" );\r\n");
1159 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
1160 fileBuffer
.append(Integer
.toString(entryPointCount
));
1161 fileBuffer
.append(";\r\n\r\n");
1163 if (entryPointList
!= null) {
1164 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1165 if (!entryPointList
[i
].equals("")) {
1166 fileBuffer
.append("EFI_STATUS\r\n");
1167 fileBuffer
.append("EFIAPI\r\n");
1168 fileBuffer
.append(entryPointList
[i
]);
1169 fileBuffer
.append(" (\r\n");
1171 .append(" EFI_HANDLE ImageHandle\r\n");
1172 fileBuffer
.append(" );\r\n");
1179 fileBuffer
.append("EFI_STATUS\n");
1180 fileBuffer
.append("EFIAPI\r\n");
1181 fileBuffer
.append("ProcessModuleUnloadList (\r\n");
1182 fileBuffer
.append(" EFI_HANDLE ImageHandle\r\n");
1183 fileBuffer
.append(" )\r\n");
1184 fileBuffer
.append("{\r\n");
1186 if (entryPointCount
== 0) {
1187 fileBuffer
.append(" return EFI_SUCCESS;\r\n");
1188 } else if (entryPointCount
== 1) {
1189 fileBuffer
.append(" return ");
1190 fileBuffer
.append(entryPointList
[0]);
1191 fileBuffer
.append("(ImageHandle);\r\n");
1193 fileBuffer
.append(" EFI_STATUS Status;\r\n\r\n");
1194 fileBuffer
.append(" Status = EFI_SUCCESS;\r\n\r\n");
1195 for (int i
= 0; i
< entryPointList
.length
; i
++) {
1196 if (!entryPointList
[i
].equals("")) {
1197 fileBuffer
.append(" if (EFI_ERROR (Status)) {\r\n");
1198 fileBuffer
.append(" ");
1199 fileBuffer
.append(entryPointList
[i
]);
1200 fileBuffer
.append("(ImageHandle);\r\n");
1201 fileBuffer
.append(" } else {\r\n");
1202 fileBuffer
.append(" Status = ");
1203 fileBuffer
.append(entryPointList
[i
]);
1204 fileBuffer
.append("(ImageHandle);\r\n");
1205 fileBuffer
.append(" }\r\n");
1210 fileBuffer
.append(" return Status;\r\n");
1212 fileBuffer
.append("}\r\n\r\n");
1220 * This function gets GUIDs from SPD file accrodeing to <PPIs> information
1221 * and write those GUIDs to AutoGen.c.
1224 * String Buffer for Autogen.c file.
1225 * @throws BuildException
1226 * Guid must set value!
1228 void PpiGuidToAutogenC(StringBuffer fileBuffer
) throws AutoGenException
{
1229 String
[] cNameGuid
= null;
1232 // Get the all PPI adn PPI Notify from MSA file,
1233 // then add those PPI ,and PPI Notify name to list.
1236 String
[] ppiList
= SurfaceAreaQuery
.getPpiArray(this.arch
);
1237 for (int i
= 0; i
< ppiList
.length
; i
++) {
1238 this.mPpiList
.add(ppiList
[i
]);
1241 String
[] ppiNotifyList
= SurfaceAreaQuery
.getPpiNotifyArray(this.arch
);
1242 for (int i
= 0; i
< ppiNotifyList
.length
; i
++) {
1243 this.mPpiList
.add(ppiNotifyList
[i
]);
1247 // Find CNAME and GUID from dependence SPD file and write to Autogen.c
1249 Iterator ppiIterator
= this.mPpiList
.iterator();
1250 String ppiKeyWord
= null;
1251 while (ppiIterator
.hasNext()) {
1252 ppiKeyWord
= ppiIterator
.next().toString();
1253 cNameGuid
= GlobalData
.getPpiGuid(this.mDepPkgList
, ppiKeyWord
);
1254 if (cNameGuid
!= null) {
1256 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
1257 fileBuffer
.append(cNameGuid
[0]);
1258 fileBuffer
.append(" = { ");
1259 fileBuffer
.append(CommonDefinition
.formatGuidName(cNameGuid
[1]));
1260 fileBuffer
.append(" } ;");
1263 // If can't find Ppi GUID declaration in every package
1265 throw new AutoGenException("Can not find Ppi GUID ["
1266 + ppiKeyWord
+ "] declaration in every packages. ");
1272 * ProtocolGuidToAutogenc
1274 * This function gets GUIDs from SPD file accrodeing to <Protocol>
1275 * information and write those GUIDs to AutoGen.c.
1278 * String Buffer for Autogen.c file.
1279 * @throws BuildException
1280 * Protocol name must set.
1282 void ProtocolGuidToAutogenC(StringBuffer fileBuffer
) throws BuildException
{
1283 String
[] cNameGuid
= null;
1285 String
[] protocolList
= SurfaceAreaQuery
.getProtocolArray(this.arch
);
1288 // Add result to Autogen global list.
1290 for (int i
= 0; i
< protocolList
.length
; i
++) {
1291 this.mProtocolList
.add(protocolList
[i
]);
1294 String
[] protocolNotifyList
= SurfaceAreaQuery
1295 .getProtocolNotifyArray(this.arch
);
1297 for (int i
= 0; i
< protocolNotifyList
.length
; i
++) {
1298 this.mProtocolList
.add(protocolNotifyList
[i
]);
1302 // Get the NAME and GUID from dependence SPD and write to Autogen.c
1304 Iterator protocolIterator
= this.mProtocolList
.iterator();
1305 String protocolKeyWord
= null;
1308 while (protocolIterator
.hasNext()) {
1309 protocolKeyWord
= protocolIterator
.next().toString();
1310 cNameGuid
= GlobalData
.getProtocolGuid(this.mDepPkgList
, protocolKeyWord
);
1311 if (cNameGuid
!= null) {
1313 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
1314 fileBuffer
.append(cNameGuid
[0]);
1315 fileBuffer
.append(" = { ");
1316 fileBuffer
.append(CommonDefinition
.formatGuidName(cNameGuid
[1]));
1317 fileBuffer
.append(" } ;");
1320 // If can't find protocol GUID declaration in every package
1322 throw new BuildException("Can not find protocol Guid ["
1323 + protocolKeyWord
+ "] declaration in every packages. ");
1329 * GuidGuidToAutogenc
1331 * This function gets GUIDs from SPD file accrodeing to <Guids> information
1332 * and write those GUIDs to AutoGen.c.
1335 * String Buffer for Autogen.c file.
1338 void GuidGuidToAutogenC(StringBuffer fileBuffer
) throws AutoGenException
{
1339 String
[] cNameGuid
= null;
1340 String guidKeyWord
= null;
1342 String
[] guidList
= SurfaceAreaQuery
.getGuidEntryArray(this.arch
);
1344 for (int i
= 0; i
< guidList
.length
; i
++) {
1345 this.mGuidList
.add(guidList
[i
]);
1349 Iterator guidIterator
= this.mGuidList
.iterator();
1350 while (guidIterator
.hasNext()) {
1351 guidKeyWord
= guidIterator
.next().toString();
1352 cNameGuid
= GlobalData
.getGuid(this.mDepPkgList
, guidKeyWord
);
1354 if (cNameGuid
!= null) {
1356 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
1357 fileBuffer
.append(cNameGuid
[0]);
1358 fileBuffer
.append(" = { ");
1359 fileBuffer
.append(CommonDefinition
.formatGuidName(cNameGuid
[1]));
1360 fileBuffer
.append("} ;");
1363 // If can't find GUID declaration in every package
1365 throw new AutoGenException("Can not find Guid [" + guidKeyWord
1366 + "] declaration in every packages. ");
1373 * LibInstanceToAutogenC
1375 * This function adds dependent library instance to autogen.c,which
1376 * includeing library's constructor, destructor, and library dependent ppi,
1377 * protocol, guid, pcd information.
1380 * String buffer for AutoGen.c
1381 * @throws BuildException
1383 void LibInstanceToAutogenC(StringBuffer fileBuffer
) throws BuildException
{
1386 String moduleType
= SurfaceAreaQuery
.getModuleType();
1387 List
<String
> libConstructList
= new ArrayList
<String
>();
1388 List
<String
> libDestructList
= new ArrayList
<String
>();
1390 String libConstructName
= null;
1391 String libDestructName
= null;
1392 ModuleIdentification
[] libraryIdList
= SurfaceAreaQuery
1393 .getLibraryInstance(this.arch
);
1396 if (libraryIdList
!= null) {
1398 // Reorder library instance sequence.
1400 AutogenLibOrder libOrder
= new AutogenLibOrder(libraryIdList
,
1402 List
<ModuleIdentification
> orderList
= libOrder
1403 .orderLibInstance();
1405 if (orderList
!= null) {
1407 // Process library instance one by one.
1409 for (int i
= 0; i
< orderList
.size(); i
++) {
1412 // Get library instance basename.
1414 ModuleIdentification libInstanceId
= orderList
.get(i
);
1420 Map
<String
, XmlObject
> libDoc
= GlobalData
.getDoc(
1421 libInstanceId
, this.arch
);
1422 SurfaceAreaQuery
.push(libDoc
);
1425 // Get <PPis>, <Protocols>, <Guids> list of this library
1428 String
[] ppiList
= SurfaceAreaQuery
.getPpiArray(this.arch
);
1429 String
[] ppiNotifyList
= SurfaceAreaQuery
1430 .getPpiNotifyArray(this.arch
);
1431 String
[] protocolList
= SurfaceAreaQuery
1432 .getProtocolArray(this.arch
);
1433 String
[] protocolNotifyList
= SurfaceAreaQuery
1434 .getProtocolNotifyArray(this.arch
);
1435 String
[] guidList
= SurfaceAreaQuery
1436 .getGuidEntryArray(this.arch
);
1437 PackageIdentification
[] pkgList
= SurfaceAreaQuery
.getDependencePkg(this.arch
);
1440 // Add those ppi, protocol, guid in global ppi,
1444 for (index
= 0; index
< ppiList
.length
; index
++) {
1445 this.mPpiList
.add(ppiList
[index
]);
1448 for (index
= 0; index
< ppiNotifyList
.length
; index
++) {
1449 this.mPpiList
.add(ppiNotifyList
[index
]);
1452 for (index
= 0; index
< protocolList
.length
; index
++) {
1453 this.mProtocolList
.add(protocolList
[index
]);
1456 for (index
= 0; index
< protocolNotifyList
.length
; index
++) {
1457 this.mProtocolList
.add(protocolNotifyList
[index
]);
1460 for (index
= 0; index
< guidList
.length
; index
++) {
1461 this.mGuidList
.add(guidList
[index
]);
1463 for (index
= 0; index
< pkgList
.length
; index
++){
1464 if (!this.mDepPkgList
.contains(pkgList
[index
])){
1465 this.mDepPkgList
.add(pkgList
[index
]);
1470 // If not yet parse this library instance's constructor
1471 // element,parse it.
1473 libConstructName
= SurfaceAreaQuery
1474 .getLibConstructorName();
1475 libDestructName
= SurfaceAreaQuery
1476 .getLibDestructorName();
1478 SurfaceAreaQuery
.pop();
1480 // Add dependent library instance constructor function.
1482 if (libConstructName
!= null) {
1483 libConstructList
.add(libConstructName
);
1486 // Add dependent library instance destructor fuction.
1488 if (libDestructName
!= null) {
1489 libDestructList
.add(libDestructName
);
1496 // Add library constructor to AutoGen.c
1498 LibConstructorToAutogenC(libConstructList
, moduleType
,
1499 fileBuffer
/* autogenC */);
1501 // Add library destructor to AutoGen.c
1503 LibDestructorToAutogenC(libDestructList
, moduleType
, fileBuffer
/* autogenC */);
1506 } catch (Exception e
) {
1507 throw new BuildException(e
.getMessage());
1512 * LibConstructorToAutogenc
1514 * This function writes library constructor list to AutoGen.c. The library
1515 * constructor's parameter and return value depend on module type.
1517 * @param libInstanceList
1518 * List of library construct name.
1522 * String buffer for AutoGen.c
1525 void LibConstructorToAutogenC(List
<String
> libInstanceList
,
1526 String moduleType
, StringBuffer fileBuffer
) throws Exception
{
1527 boolean isFirst
= true;
1530 // The library constructor's parameter and return value depend on
1533 for (int i
= 0; i
< libInstanceList
.size(); i
++) {
1534 switch (CommonDefinition
.getModuleType(moduleType
)) {
1535 case CommonDefinition
.ModuleTypeBase
:
1536 fileBuffer
.append("RETURN_STATUS\r\n");
1537 fileBuffer
.append(libInstanceList
.get(i
));
1538 fileBuffer
.append(" (\r\n");
1539 fileBuffer
.append(" VOID\r\n");
1540 fileBuffer
.append(" );\r\n");
1543 case CommonDefinition
.ModuleTypePeiCore
:
1544 case CommonDefinition
.ModuleTypePeim
:
1545 fileBuffer
.append("EFI_STATUS\r\n");
1546 fileBuffer
.append(libInstanceList
.get(i
));
1547 fileBuffer
.append(" (\r\n");
1549 .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
1551 .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
1552 fileBuffer
.append(" );\r\n");
1555 case CommonDefinition
.ModuleTypeDxeCore
:
1556 case CommonDefinition
.ModuleTypeDxeDriver
:
1557 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1558 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
1559 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1560 case CommonDefinition
.ModuleTypeUefiDriver
:
1561 case CommonDefinition
.ModuleTypeUefiApplication
:
1562 fileBuffer
.append("EFI_STATUS\r\n");
1563 fileBuffer
.append(libInstanceList
.get(i
));
1564 fileBuffer
.append(" (\r\n");
1565 fileBuffer
.append(" IN EFI_HANDLE ImageHandle,\r\n");
1566 fileBuffer
.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
1567 fileBuffer
.append(" );\r\n");
1573 // Add ProcessLibraryConstructorList in AutoGen.c
1575 fileBuffer
.append("VOID\r\n");
1576 fileBuffer
.append("ProcessLibraryConstructorList (\r\n");
1577 switch (CommonDefinition
.getModuleType(moduleType
)) {
1578 case CommonDefinition
.ModuleTypeBase
:
1579 fileBuffer
.append(" VOID\r\n");
1582 case CommonDefinition
.ModuleTypePeiCore
:
1583 case CommonDefinition
.ModuleTypePeim
:
1584 fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
1586 .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
1589 case CommonDefinition
.ModuleTypeDxeCore
:
1590 case CommonDefinition
.ModuleTypeDxeDriver
:
1591 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1592 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
1593 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1594 case CommonDefinition
.ModuleTypeUefiDriver
:
1595 case CommonDefinition
.ModuleTypeUefiApplication
:
1596 fileBuffer
.append(" IN EFI_HANDLE ImageHandle,\r\n");
1597 fileBuffer
.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
1601 fileBuffer
.append(" )\r\n");
1602 fileBuffer
.append("{\r\n");
1604 // If no constructor function, return EFI_SUCCESS.
1606 //if (libInstanceList.size() == 0){
1607 // fileBuffer.append(" return EFI_SUCCESS;\r\n");
1609 for (int i
= 0; i
< libInstanceList
.size(); i
++) {
1611 fileBuffer
.append(" EFI_STATUS Status;\r\n");
1612 fileBuffer
.append(" Status = EFI_SUCCESS;\r\n");
1613 fileBuffer
.append("\r\n");
1616 switch (CommonDefinition
.getModuleType(moduleType
)) {
1617 case CommonDefinition
.ModuleTypeBase
:
1618 fileBuffer
.append(" Status = ");
1619 fileBuffer
.append(libInstanceList
.get(i
));
1620 fileBuffer
.append("();\r\n");
1621 fileBuffer
.append(" VOID\r\n");
1623 case CommonDefinition
.ModuleTypePeiCore
:
1624 case CommonDefinition
.ModuleTypePeim
:
1625 fileBuffer
.append(" Status = ");
1626 fileBuffer
.append(libInstanceList
.get(i
));
1627 fileBuffer
.append(" (FfsHeader, PeiServices);\r\n");
1629 case CommonDefinition
.ModuleTypeDxeCore
:
1630 case CommonDefinition
.ModuleTypeDxeDriver
:
1631 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1632 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
1633 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1634 case CommonDefinition
.ModuleTypeUefiDriver
:
1635 case CommonDefinition
.ModuleTypeUefiApplication
:
1636 fileBuffer
.append(" Status = ");
1637 fileBuffer
.append(libInstanceList
.get(i
));
1638 fileBuffer
.append(" (ImageHandle, SystemTable);\r\n");
1641 EdkLog
.log(EdkLog
.EDK_INFO
,"Autogen don't know how to deal with module type -"+ moduleType
+ " !");
1643 fileBuffer
.append(" ASSERT_EFI_ERROR (Status);\r\n");
1645 fileBuffer
.append("}\r\n");
1649 * LibDestructorToAutogenc
1651 * This function writes library destructor list to AutoGen.c. The library
1652 * destructor's parameter and return value depend on module type.
1654 * @param libInstanceList
1655 * List of library destructor name.
1659 * String buffer for AutoGen.c
1662 void LibDestructorToAutogenC(List
<String
> libInstanceList
,
1663 String moduleType
, StringBuffer fileBuffer
) throws Exception
{
1664 boolean isFirst
= true;
1665 for (int i
= 0; i
< libInstanceList
.size(); i
++) {
1666 switch (CommonDefinition
.getModuleType(moduleType
)) {
1667 case CommonDefinition
.ModuleTypeBase
:
1668 fileBuffer
.append("RETURN_STATUS\n");
1669 fileBuffer
.append(libInstanceList
.get(i
));
1670 fileBuffer
.append(" (\r\n");
1671 fileBuffer
.append(" VOID\r\n");
1672 fileBuffer
.append(" );\r\n");
1674 case CommonDefinition
.ModuleTypePeiCore
:
1675 case CommonDefinition
.ModuleTypePeim
:
1676 fileBuffer
.append("EFI_STATUS\r\n");
1677 fileBuffer
.append(libInstanceList
.get(i
));
1678 fileBuffer
.append(" (\r\n");
1680 .append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
1682 .append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
1683 fileBuffer
.append(" );\r\n");
1685 case CommonDefinition
.ModuleTypeDxeCore
:
1686 case CommonDefinition
.ModuleTypeDxeDriver
:
1687 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1688 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
1689 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1690 case CommonDefinition
.ModuleTypeUefiDriver
:
1691 case CommonDefinition
.ModuleTypeUefiApplication
:
1692 fileBuffer
.append("EFI_STATUS\r\n");
1693 fileBuffer
.append(libInstanceList
.get(i
));
1694 fileBuffer
.append(" (\r\n");
1695 fileBuffer
.append(" IN EFI_HANDLE ImageHandle,\r\n");
1696 fileBuffer
.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
1697 fileBuffer
.append(" );\r\n");
1703 // Write ProcessLibraryDestructor list to autogen.c
1705 switch (CommonDefinition
.getModuleType(moduleType
)) {
1706 case CommonDefinition
.ModuleTypeBase
:
1707 case CommonDefinition
.ModuleTypePeiCore
:
1708 case CommonDefinition
.ModuleTypePeim
:
1710 case CommonDefinition
.ModuleTypeDxeCore
:
1711 case CommonDefinition
.ModuleTypeDxeDriver
:
1712 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1713 case CommonDefinition
.ModuleTypeDxeSmmDriver
:
1714 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1715 case CommonDefinition
.ModuleTypeUefiDriver
:
1716 case CommonDefinition
.ModuleTypeUefiApplication
:
1717 fileBuffer
.append("VOID\r\n");
1718 fileBuffer
.append("ProcessLibraryDestructorList (\r\n");
1719 fileBuffer
.append(" IN EFI_HANDLE ImageHandle,\r\n");
1720 fileBuffer
.append(" IN EFI_SYSTEM_TABLE *SystemTable\r\n");
1721 fileBuffer
.append(" )\r\n");
1722 fileBuffer
.append("{\r\n");
1724 // If no library destructor function, return EFI_SUCCESS.
1727 for (int i
= 0; i
< libInstanceList
.size(); i
++) {
1729 fileBuffer
.append(" EFI_STATUS Status;\r\n");
1730 fileBuffer
.append(" Status = EFI_SUCCESS;\r\n");
1731 fileBuffer
.append("\r\n");
1734 fileBuffer
.append(" Status = ");
1735 fileBuffer
.append(libInstanceList
.get(i
));
1736 fileBuffer
.append("(ImageHandle, SystemTable);\r\n");
1737 fileBuffer
.append(" ASSERT_EFI_ERROR (Status);\r\n");
1739 fileBuffer
.append("}\r\n");
1745 * ExternsDriverBindingToAutoGenC
1747 * This function is to write DRIVER_BINDING, COMPONENT_NAME,
1748 * DRIVER_CONFIGURATION, DRIVER_DIAGNOSTIC in AutoGen.c.
1751 * String buffer for AutoGen.c
1753 void ExternsDriverBindingToAutoGenC(StringBuffer fileBuffer
)
1754 throws BuildException
{
1757 // Check what <extern> contains. And the number of following elements
1758 // under <extern> should be same. 1. DRIVER_BINDING 2. COMPONENT_NAME
1759 // 3.DRIVER_CONFIGURATION 4. DRIVER_DIAGNOSTIC
1762 String
[] drvBindList
= SurfaceAreaQuery
.getDriverBindingArray();
1765 // If component name protocol,component configuration protocol,
1766 // component diagnostic protocol is not null or empty, check
1767 // if every one have the same number of the driver binding protocol.
1769 if (drvBindList
== null || drvBindList
.length
== 0) {
1773 String
[] compNamList
= SurfaceAreaQuery
.getComponentNameArray();
1774 String
[] compConfList
= SurfaceAreaQuery
.getDriverConfigArray();
1775 String
[] compDiagList
= SurfaceAreaQuery
.getDriverDiagArray();
1780 // Write driver binding protocol extern to autogen.c
1782 for (int i
= 0; i
< drvBindList
.length
; i
++) {
1783 fileBuffer
.append("extern EFI_DRIVER_BINDING_PROTOCOL ");
1784 fileBuffer
.append(drvBindList
[i
]);
1785 fileBuffer
.append(";\r\n");
1789 // Write component name protocol extern to autogen.c
1791 if (compNamList
!= null && compNamList
.length
!= 0) {
1792 if (drvBindList
.length
!= compNamList
.length
) {
1793 throw new BuildException(
1794 "Different number of Driver Binding and Component Name protocols!");
1798 for (int i
= 0; i
< compNamList
.length
; i
++) {
1799 fileBuffer
.append("extern EFI_COMPONENT_NAME_PROTOCOL ");
1800 fileBuffer
.append(compNamList
[i
]);
1801 fileBuffer
.append(";\r\n");
1806 // Write driver configration protocol extern to autogen.c
1808 if (compConfList
!= null && compConfList
.length
!= 0) {
1809 if (drvBindList
.length
!= compConfList
.length
) {
1810 throw new BuildException(
1811 "Different number of Driver Binding and Driver Configuration protocols!");
1815 for (int i
= 0; i
< compConfList
.length
; i
++) {
1816 fileBuffer
.append("extern EFI_DRIVER_CONFIGURATION_PROTOCOL ");
1817 fileBuffer
.append(compConfList
[i
]);
1818 fileBuffer
.append(";\r\n");
1823 // Write driver dignastic protocol extern to autogen.c
1825 if (compDiagList
!= null && compDiagList
.length
!= 0) {
1826 if (drvBindList
.length
!= compDiagList
.length
) {
1827 throw new BuildException(
1828 "Different number of Driver Binding and Driver Configuration protocols!");
1832 for (int i
= 0; i
< compDiagList
.length
; i
++) {
1833 fileBuffer
.append("extern EFI_DRIVER_DIAGNOSTICS_PROTOCOL ");
1834 fileBuffer
.append(compDiagList
[i
]);
1835 fileBuffer
.append(";\r\n");
1840 // Write driver module protocol bitmask.
1843 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");
1844 fileBuffer
.append(Integer
.toString(BitMask
));
1845 fileBuffer
.append(";\r\n");
1848 // Write driver module protocol list entry
1851 .append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
1853 fileBuffer
.append(Integer
.toString(drvBindList
.length
));
1854 fileBuffer
.append(";\r\n");
1857 // Write drive module protocol list to autogen.c
1860 .append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");
1861 for (int i
= 0; i
< drvBindList
.length
; i
++) {
1863 fileBuffer
.append(",");
1865 fileBuffer
.append("\r\n {\r\n");
1866 fileBuffer
.append(" &");
1867 fileBuffer
.append(drvBindList
[i
]);
1868 fileBuffer
.append(", \r\n");
1870 if (compNamList
!= null) {
1871 fileBuffer
.append(" &");
1872 fileBuffer
.append(compNamList
[i
]);
1873 fileBuffer
.append(", \r\n");
1875 fileBuffer
.append(" NULL, \r\n");
1878 if (compConfList
!= null) {
1879 fileBuffer
.append(" &");
1880 fileBuffer
.append(compConfList
[i
]);
1881 fileBuffer
.append(", \r\n");
1883 fileBuffer
.append(" NULL, \r\n");
1886 if (compDiagList
!= null) {
1887 fileBuffer
.append(" &");
1888 fileBuffer
.append(compDiagList
[i
]);
1889 fileBuffer
.append(", \r\n");
1891 fileBuffer
.append(" NULL, \r\n");
1893 fileBuffer
.append(" }");
1895 fileBuffer
.append("\r\n};\r\n");
1899 * ExternCallBackToAutoGenC
1901 * This function adds <SetVirtualAddressMapCallBack> and
1902 * <ExitBootServicesCallBack> infomation to AutoGen.c
1905 * String buffer for AutoGen.c
1906 * @throws BuildException
1908 void ExternCallBackToAutoGenC(StringBuffer fileBuffer
)
1909 throws BuildException
{
1910 String
[] setVirtualList
= SurfaceAreaQuery
1911 .getSetVirtualAddressMapCallBackArray();
1912 String
[] exitBootList
= SurfaceAreaQuery
1913 .getExitBootServicesCallBackArray();
1914 String moduleType
= SurfaceAreaQuery
.getModuleType();
1915 boolean UefiOrDxeModule
= false;
1919 switch (CommonDefinition
.getModuleType(moduleType
)) {
1920 case CommonDefinition
.ModuleTypeDxeDriver
:
1921 case CommonDefinition
.ModuleTypeDxeRuntimeDriver
:
1922 case CommonDefinition
.ModuleTypeDxeSalDriver
:
1923 case CommonDefinition
.ModuleTypeUefiDriver
:
1924 case CommonDefinition
.ModuleTypeUefiApplication
:
1926 // Entry point lib for these module types needs to know the count
1929 UefiOrDxeModule
= true;
1931 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");
1934 // If the list is not valid or has no entries set count to zero else
1935 // set count to the number of valid entries
1938 if (setVirtualList
!= null) {
1939 for (i
= 0; i
< setVirtualList
.length
; i
++) {
1940 if (setVirtualList
[i
].equalsIgnoreCase("")) {
1947 fileBuffer
.append(Integer
.toString(Count
));
1948 fileBuffer
.append(";\r\n\r\n");
1954 if (setVirtualList
== null) {
1955 if (UefiOrDxeModule
) {
1957 // No data so make a NULL list
1960 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");
1961 fileBuffer
.append(" NULL\r\n");
1962 fileBuffer
.append("};\r\n\r\n");
1966 // Write SetVirtualAddressMap function definition.
1968 for (i
= 0; i
< setVirtualList
.length
; i
++) {
1969 if (setVirtualList
[i
].equalsIgnoreCase("")) {
1972 fileBuffer
.append("VOID\r\n");
1973 fileBuffer
.append("EFIAPI\r\n");
1974 fileBuffer
.append(setVirtualList
[i
]);
1975 fileBuffer
.append(" (\r\n");
1976 fileBuffer
.append(" IN EFI_EVENT Event,\r\n");
1977 fileBuffer
.append(" IN VOID *Context\r\n");
1978 fileBuffer
.append(" );\r\n\r\n");
1982 // Write SetVirtualAddressMap entry point array.
1985 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");
1986 for (i
= 0; i
< setVirtualList
.length
; i
++) {
1987 if (setVirtualList
[i
].equalsIgnoreCase("")) {
1992 fileBuffer
.append("\r\n ");
1994 fileBuffer
.append(",\r\n ");
1997 fileBuffer
.append(setVirtualList
[i
]);
2000 // If module is not DXE_DRIVER, DXE_RUNTIME_DIRVER, UEFI_DRIVER
2001 // UEFI_APPLICATION and DXE_SAL_DRIVER add the NULL at the end of
2002 // _gDriverSetVirtualAddressMapEvent list.
2004 if (!UefiOrDxeModule
) {
2005 fileBuffer
.append(",\r\n NULL");
2007 fileBuffer
.append("\r\n};\r\n\r\n");
2010 if (UefiOrDxeModule
) {
2012 // Entry point lib for these module types needs to know the count.
2015 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverExitBootServicesEventCount = ");
2018 // If the list is not valid or has no entries set count to zero else
2019 // set count to the number of valid entries.
2022 if (exitBootList
!= null) {
2023 if (setVirtualList
!= null) {
2024 for (i
= 0; i
< exitBootList
.length
; i
++) {
2025 if (exitBootList
[i
].equalsIgnoreCase("")) {
2032 fileBuffer
.append(Integer
.toString(Count
));
2033 fileBuffer
.append(";\r\n\r\n");
2036 if (exitBootList
== null) {
2037 if (UefiOrDxeModule
) {
2039 // No data so make a NULL list.
2042 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");
2043 fileBuffer
.append(" NULL\r\n");
2044 fileBuffer
.append("};\r\n\r\n");
2048 // Write DriverExitBootServices function definition.
2050 for (i
= 0; i
< exitBootList
.length
; i
++) {
2051 if (exitBootList
[i
].equalsIgnoreCase("")) {
2055 fileBuffer
.append("VOID\r\n");
2056 fileBuffer
.append("EFIAPI\r\n");
2057 fileBuffer
.append(exitBootList
[i
]);
2058 fileBuffer
.append(" (\r\n");
2059 fileBuffer
.append(" IN EFI_EVENT Event,\r\n");
2060 fileBuffer
.append(" IN VOID *Context\r\n");
2061 fileBuffer
.append(" );\r\n\r\n");
2065 // Write DriverExitBootServices entry point array.
2068 .append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");
2069 for (i
= 0; i
< exitBootList
.length
; i
++) {
2070 if (exitBootList
[i
].equalsIgnoreCase("")) {
2075 fileBuffer
.append("\r\n ");
2077 fileBuffer
.append(",\r\n ");
2079 fileBuffer
.append(exitBootList
[i
]);
2081 if (!UefiOrDxeModule
) {
2082 fileBuffer
.append(",\r\n NULL");
2084 fileBuffer
.append("\r\n};\r\n\r\n");