• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## @file
2# This file is used to define a class object to describe a module
3#
4# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
5# This program and the accompanying materials
6# are licensed and made available under the terms and conditions of the BSD License
7# which accompanies this distribution.    The full text of the license may be found at
8# http://opensource.org/licenses/bsd-license.php
9#
10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13##
14# Import Modules
15#
16from CommonClass import *
17
18## ModuleHeaderClass
19#
20# This class defined header items used in Module file
21#
22# @param IdentificationClass:    Inherited from IdentificationClass class
23# @param CommonHeaderClass:      Inherited from CommonHeaderClass class
24# @param DefineClass:            Inherited from DefineClass class
25#
26# @var ModuleType:               To store value for ModuleType
27# @var SupArchList:              To store value for SupArchList, selection scope is in below list
28#                                EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64
29# @var BinaryModule:             To store value for BinaryModule
30# @var OutputFileBasename:       To store value for OutputFileBasename
31# @var ClonedFrom:               To store value for ClonedFrom, it is a set structure as
32#                                [ ClonedRecordClass, ... ]
33# @var PcdIsDriver:              To store value for PcdIsDriver, selection scope is in below list
34#                                PEI_PCD_DRIVER | DXE_PCD_DRIVER
35# @var TianoEdkFlashMap_h:       To store value for TianoEdkFlashMap_h
36# @var InfVersion:               To store value for InfVersion
37# @var UefiSpecificationVersion: To store value for UefiSpecificationVersion
38# @var EdkReleaseVersion:        To store value for EdkReleaseVersion
39# @var LibraryClass:             To store value for LibraryClass, it is a set structure as
40#                                [ LibraryClassClass, ...]
41# @var ComponentType:            To store value for ComponentType, selection scope is in below list
42#                                LIBRARY | SECURITY_CORE | PEI_CORE | COMBINED_PEIM_DRIVER | PIC_PEIM | RELOCATABLE_PEIM | BS_DRIVER | RT_DRIVER | SAL_RT_DRIVER | APPLICATION
43# @var MakefileName:             To store value for MakefileName
44# @var BuildNumber:              To store value for BuildNumber
45# @var BuildType:                To store value for BuildType
46# @var FfsExt:                   To store value for FfsExt
47# @var FvExt:                    To store value for FvExt
48# @var SourceFv:                 To store value for SourceFv
49# @var CustomMakefile:           To store value for CustomMakefile, it is a set structure as
50#                                { Family : Filename, ... }
51# @var Shadow:                   To store value for Shadow
52# @var MacroDefines              To store the defined macros
53#
54class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
55    def __init__(self):
56        IdentificationClass.__init__(self)
57        CommonHeaderClass.__init__(self)
58        DefineClass.__init__(self)
59        self.ModuleType = ''
60        self.SupModuleList = []
61        self.SupArchList = []
62        self.BinaryModule = False
63        self.OutputFileBasename = ''
64        self.ClonedFrom = []
65        self.PcdIsDriver = ''
66        self.TianoEdkFlashMap_h = False
67        self.InfVersion = ''
68        self.PiSpecificationVersion = ''
69        self.UefiSpecificationVersion = ''
70        self.EdkReleaseVersion = ''
71        self.LibraryClass = []
72        self.ComponentType = ''
73        self.MakefileName = ''
74        self.BuildNumber = ''
75        self.BuildType = ''
76        self.FfsExt = ''
77        self.FvExt = ''
78        self.SourceFv = ''
79        self.CustomMakefile = {}
80        self.Shadow = ''
81        self.MacroDefines = {}
82        self.SourceOverridePath = ''
83        self.Specification = []
84
85## ModuleSourceFileClass
86#
87# This class defined source file item used in Module file
88#
89# @param CommonClass:      Inherited from CommonClass class
90# @param SourceFile:       Input value for SourceFile, default is ''
91# @param TagName:          Input value for TagName, default is ''
92# @param ToolCode:         Input value for ToolCode, default is ''
93# @param ToolChainFamily:  Input value for ToolChainFamily, default is ''
94# @param FeatureFlag:      Input value for FeatureFlag, default is ''
95# @param SupArchList:      Input value for SupArchList, default is []
96#
97# @var SourceFile:         To store value for SourceFile
98# @var TagName:            To store value for TagName
99# @var ToolCode:           To store value for ToolCode
100# @var ToolChainFamily:    To store value for ToolChainFamily
101#
102class ModuleSourceFileClass(CommonClass):
103    def __init__(self, SourceFile = '', TagName = '', ToolCode = '', ToolChainFamily = '', FeatureFlag = '', SupArchList = None):
104        self.SourceFile = SourceFile
105        self.TagName = TagName
106        self.ToolCode = ToolCode
107        self.ToolChainFamily = ToolChainFamily
108        self.FileType = ''
109        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)
110
111## ModuleBinaryFileClass
112#
113# This class defined binary file item used in Module file
114#
115# @param CommonClass:    Inherited from CommonClass class
116# @param BinaryFile:     Input value for BinaryFile, default is ''
117# @param FileType:       Input value for FileType, default is ''
118# @param FeatureFlag:    Input value for FeatureFlag, default is ''
119# @param SupArchList:    Input value for SupArchList, default is []
120#
121# @var BinaryFile:       To store value for BinaryFile
122# @var FileType:         To store value for FileType, selection scope is in below list
123#                        FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | SMM_DEPEX| TE | VER | UI | BIN | FV
124# @var Target:           To store value for Target
125# @var ToolChainFamily:  To store value for ToolChainFamily
126#
127class ModuleBinaryFileClass(CommonClass):
128    def __init__(self, BinaryFile = '', FileType = '', Target = '', FeatureFlag = '', SupArchList = None):
129        self.BinaryFile = BinaryFile
130        self.FileType = FileType
131        self.Target = Target
132        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)
133        self.Filenames = []
134        self.PatchPcdValues = []
135        self.PcdExValues = []
136        self.LibraryInstances = []
137        self.BuildFlags = []
138
139## ModulePackageDependencyClass
140#
141# This class defined package dependency item used in Module file
142#
143# @param CommonClass:   Inherited from CommonClass class
144# @param DefineClass:   Input value for DefineClass class
145#
146# @var FilePath:        To store value for FilePath
147# @var PackageName:     To store value for PackageName
148# @var PackageVersion:  To store value for PackageVersion
149# @var PackageGuid:     To store value for PackageGuid
150#
151class ModulePackageDependencyClass(CommonClass, DefineClass):
152    def __init__(self):
153        self.FilePath = ''
154        self.PackageName = ''
155        self.PackageVersion = ''
156        self.PackageGuid = ''
157        self.Description = ''
158        CommonClass.__init__(self)
159        DefineClass.__init__(self)
160
161## ModuleLibraryClass
162#
163# This class defined library item used in Module file
164#
165# @param CommonClass:  Inherited from CommonClass class
166#
167# @var Library:        To store value for Library
168#
169class ModuleLibraryClass(CommonClass):
170    def __init__(self):
171        self.Library = ''
172        CommonClass.__init__(self)
173
174## ModuleEventClass
175#
176# This class defined event item used in Module file
177#
178# @param CommonClass:  Inherited from CommonClass class
179#
180# @var CName:          To store value for CName
181# @var GuidCName:      To store value for GuidCName
182# @var Type:           To store value for Type, selection scope is in below list
183#                      CREATE_EVENT | SIGNAL_EVENT
184#
185class ModuleEventClass(CommonClass):
186    def __init__(self):
187        self.CName = ''
188        self.GuidCName = ''
189        self.Type = ''
190        CommonClass.__init__(self)
191
192## ModuleHobClass
193#
194# This class defined hob item used in Module file
195#
196# @param CommonClass:  Inherited from CommonClass class
197#
198# @var GuidCName:      To store value for GuidCName
199# @var Type:           To store value for Type, selection scope is in below list
200#                      PHIT | MEMORY_ALLOCATION | RESOURCE_DESCRIPTOR | GUID_EXTENSION | FIRMWARE_VOLUME | CPU | POOL | CAPSULE_VOLUME
201#
202class ModuleHobClass(CommonClass):
203    def __init__(self):
204        self.Type = ''
205        self.GuidCName = ''
206        CommonClass.__init__(self)
207
208## ModuleVariableClass
209#
210# This class defined variable item used in Module file
211#
212# @param CommonClass:  Inherited from CommonClass class
213#
214# @var GuidCName:      To store value for GuidCName
215# @var Name:           To store value for Name
216#
217class ModuleVariableClass(CommonClass):
218    def __init__(self):
219        self.Name = ''
220        self.GuidCName = ''
221        CommonClass.__init__(self)
222
223## ModuleBootModeClass
224#
225# This class defined boot mode item used in Module file
226#
227# @param CommonClass:  Inherited from CommonClass class
228#
229# @var Name:           To store value for Name, selection scope is in below list
230#                      FULL | MINIMAL | NO_CHANGE | DIAGNOSTICS | DEFAULT | S2_RESUME | S3_RESUME | S4_RESUME | S5_RESUME | FLASH_UPDATE | RECOVERY_FULL | RECOVERY_MINIMAL | RECOVERY_NO_CHANGE | RECOVERY_DIAGNOSTICS | RECOVERY_DEFAULT | RECOVERY_S2_RESUME | RECOVERY_S3_RESUME | RECOVERY_S4_RESUME | RECOVERY_S5_RESUME | RECOVERY_FLASH_UPDATE
231#
232class ModuleBootModeClass(CommonClass):
233    def __init__(self):
234        self.Name = ''
235        CommonClass.__init__(self)
236
237## ModuleSystemTableClass
238#
239# This class defined system table item used in Module file
240#
241# @param CommonClass:  Inherited from CommonClass class
242#
243# @var CName:          To store value for CName
244#
245class ModuleSystemTableClass(CommonClass):
246    def __init__(self):
247        self.CName = ''
248        CommonClass.__init__(self)
249
250## ModuleDataHubClass
251#
252# This class defined data hub item used in Module file
253#
254# @param CommonClass:  Inherited from CommonClass class
255#
256# @var CName:          To store value for CName
257#
258class ModuleDataHubClass(CommonClass):
259    def __init__(self):
260        self.CName = ''
261        CommonClass.__init__(self)
262
263## ModuleHiiPackageClass
264#
265# This class defined Hii package item used in Module file
266#
267# @param CommonClass:  Inherited from CommonClass class
268#
269# @var CName:          To store value for CName
270#
271class ModuleHiiPackageClass(CommonClass):
272    def __init__(self):
273        self.CName = ''
274        CommonClass.__init__(self)
275
276## ModuleExternImageClass
277#
278# This class defined Extern Image item used in Module file
279#
280# @param object:           Inherited from object class
281#
282# @var ModuleEntryPoint:   To store value for ModuleEntryPoint
283# @var ModuleUnloadImage:  To store value for ModuleUnloadImage
284#
285class ModuleExternImageClass(object):
286    def __init__(self):
287        self.ModuleEntryPoint = ''
288        self.ModuleUnloadImage = ''
289
290## ModuleExternLibraryClass
291#
292# This class defined Extern Library item used in Module file
293#
294# @param object:     Inherited from object class
295#
296# @var Constructor:  To store value for Constructor
297# @var Destructor:   To store value for Destructor
298#
299class ModuleExternLibraryClass(object):
300    def __init__(self):
301        self.Constructor = ''
302        self.Destructor = ''
303
304## ModuleExternDriverClass
305#
306# This class defined Extern Driver item used in Module file
307#
308# @param object:       Inherited from object class
309#
310# @var DriverBinding:  To store value for DriverBinding
311# @var ComponentName:  To store value for ComponentName
312# @var DriverConfig:   To store value for DriverConfig
313# @var DriverDiag:     To store value for DriverDiag
314#
315class ModuleExternDriverClass(object):
316    def __init__(self):
317        self.DriverBinding= ''
318        self.ComponentName = ''
319        self.DriverConfig = ''
320        self.DriverDiag = ''
321
322## ModuleExternCallBackClass
323#
324# This class defined Extern Call Back item used in Module file
325#
326# @param object:                      Inherited from object class
327#
328# @var SetVirtualAddressMapCallBack:  To store value for SetVirtualAddressMapCallBack
329# @var ExitBootServicesCallBack:      To store value for ExitBootServicesCallBack
330#
331class ModuleExternCallBackClass(object):
332    def __init__(self):
333        self.SetVirtualAddressMapCallBack = ''
334        self.ExitBootServicesCallBack = ''
335
336## ModuleExternClass
337#
338# This class defined Extern used in Module file
339#
340# @param object:                      Inherited from object class
341#
342#
343class ModuleExternClass(CommonClass):
344    def __init__(self):
345        self.EntryPoint = ''
346        self.UnloadImage = ''
347        self.Constructor = ''
348        self.Destructor = ''
349        CommonClass.__init__(self)
350
351## ModuleDepexClass
352#
353# This class defined depex item used in Module file
354#
355# @param CommonClass:  Inherited from CommonClass class
356# @param DefineClass:  Input value for DefineClass class
357#
358# @var Depex:          To store value for Depex
359#
360class ModuleDepexClass(CommonClass, DefineClass):
361    def __init__(self):
362        CommonClass.__init__(self)
363        DefineClass.__init__(self)
364        self.Depex = ''
365
366## ModuleNmakeClass
367#
368# This class defined nmake item used in Module file
369#
370# @param CommonClass:  Inherited from CommonClass class
371#
372# @var Name:           To store value for Name
373# @var Value:          To store value for Value
374#
375class ModuleNmakeClass(CommonClass):
376    def __init__(self):
377        CommonClass.__init__(self)
378        self.Name = ''
379        self.Value = ''
380
381## ModuleClass
382#
383# This class defined a complete module item
384#
385# @param object:    Inherited from object class
386#
387# @var Header:               To store value for Header, it is a structure as
388#                            {Arch : ModuleHeaderClass}
389# @var LibraryClasses:       To store value for LibraryClasses, it is a list structure as
390#                            [ LibraryClassClass, ...]
391# @var Libraries:            To store value for Libraries, it is a list structure as
392#                            [ ModuleLibraryClass, ...]
393# @var Sources:              To store value for Sources, it is a list structure as
394#                            [ ModuleSourceFileClass, ...]
395# @var Binaries:             To store value for Binaries, it is a list structure as
396#                            [ ModuleBinaryFileClass, ...]
397# @var NonProcessedFiles:    To store value for NonProcessedFiles, it is a list structure as
398#                            [ '', '', ...]
399# @var PackageDependencies:  To store value for PackageDependencies, it is a list structure as
400#                            [ ModulePackageDependencyClass, ... ]
401# @var Nmake:                To store value for Nmake, it is a list structure as
402#                            [ ModuleNmakeClass, ... ]
403# @var Depex:                To store value for Depex, it is a list structure as
404#                            [ ModuleDepexClass, ... ]
405# @var Includes:             To store value for Includes, it is a list structure as
406#                            [ IncludeClass, ...]
407# @var Protocols:            To store value for Protocols, it is a list structure as
408#                            [ ProtocolClass, ...]
409# @var Ppis:                 To store value for Ppis, it is a list structure as
410#                            [ PpiClass, ...]
411# @var Events:               To store value for Events, it is a list structure as
412#                            [ ModuleEventClass, ...]
413# @var Hobs:                 To store value for Hobs, it is a list structure as
414#                            [ ModuleHobClass, ...]
415# @var Variables:            To store value for Variables, it is a list structure as
416#                            [ ModuleVariableClass, ...]
417# @var BootModes:            To store value for BootModes, it is a list structure as
418#                            [ ModuleBootModeClass, ...]
419# @var SystemTables:         To store value for SystemTables, it is a list structure as
420#                            [ ModuleSystemTableClass, ...]
421# @var DataHubs:             To store value for DataHubs, it is a list structure as
422#                            [ ModuleDataHubClass, ...]
423# @var HiiPackages:          To store value for HiiPackages, it is a list structure as
424#                            [ ModuleHiiPackageClass, ...]
425# @var Guids:                To store value for Guids, it is a list structure as
426#                            [ GuidClass, ...]
427# @var PcdCodes:             To store value for PcdCodes, it is a list structure as
428#                            [ PcdClass, ...]
429# @var ExternImages:         To store value for ExternImages, it is a list structure as
430#                            [ ModuleExternImageClass, ...]
431# @var ExternLibraries:      To store value for ExternLibraries, it is a list structure as
432#                            [ ModuleExternLibraryClass, ...]
433# @var ExternDrivers:        To store value for ExternDrivers, it is a list structure as
434#                            [ ModuleExternDriverClass, ...]
435# @var ExternCallBacks:      To store value for ExternCallBacks, it is a list structure as
436#                            [ ModuleExternCallBackClass, ...]
437# @var BuildOptions:         To store value for BuildOptions, it is a list structure as
438#                            [ BuildOptionClass, ...]
439# @var UserExtensions:       To store value for UserExtensions, it is a list structure as
440#                            [ UserExtensionsClass, ...]
441#
442class ModuleClass(object):
443    def __init__(self):
444        self.Header = {}
445        self.ModuleHeader = ModuleHeaderClass()
446        self.LibraryClasses = []
447        self.Libraries = []
448        self.Sources = []
449        self.Binaries = []
450        self.NonProcessedFiles = []
451        self.PackageDependencies = []
452        self.Nmake = []
453        self.Depex = []
454        self.PeiDepex = None
455        self.DxeDepex = None
456        self.SmmDepex = None
457        self.Includes = []
458        self.Protocols = []
459        self.Ppis = []
460        self.Events = []
461        self.Hobs = []
462        self.Variables = []
463        self.BootModes = []
464        self.SystemTables = []
465        self.DataHubs = []
466        self.HiiPackages = []
467        self.Guids = []
468        self.PcdCodes = []
469        self.ExternImages = []
470        self.ExternLibraries = []
471        self.ExternDrivers = []
472        self.ExternCallBacks = []
473        self.Externs = []
474        self.BuildOptions = []
475        self.UserExtensions = None
476        self.MiscFiles = None
477        self.FileList = []
478
479##
480#
481# This acts like the main() function for the script, unless it is 'import'ed into another
482# script.
483#
484if __name__ == '__main__':
485    M = ModuleClass()
486