summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/CommonDataClass/ModuleClass.py
blob: 350350bdf4911a59aee8918a3157c209d2b5d798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
## @file
# This file is used to define a class object to describe a module
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution.    The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

##
# Import Modules
#
from CommonClass import *

## ModuleHeaderClass
#
# This class defined header items used in Module file
# 
# @param IdentificationClass:    Inherited from IdentificationClass class
# @param CommonHeaderClass:      Inherited from CommonHeaderClass class
# @param DefineClass:            Inherited from DefineClass class
#
# @var ModuleType:               To store value for ModuleType
# @var SupArchList:              To store value for SupArchList, selection scope is in below list
#                                EBC | IA32 | X64 | IPF | ARM | PPC
# @var BinaryModule:             To store value for BinaryModule
# @var OutputFileBasename:       To store value for OutputFileBasename
# @var ClonedFrom:               To store value for ClonedFrom, it is a set structure as
#                                [ ClonedRecordClass, ... ]
# @var PcdIsDriver:              To store value for PcdIsDriver, selection scope is in below list
#                                PEI_PCD_DRIVER | DXE_PCD_DRIVER
# @var TianoR8FlashMap_h:        To store value for TianoR8FlashMap_h
# @var InfVersion:               To store value for InfVersion
# @var UefiSpecificationVersion: To store value for UefiSpecificationVersion
# @var EdkReleaseVersion:        To store value for EdkReleaseVersion
# @var LibraryClass:             To store value for LibraryClass, it is a set structure as
#                                [ LibraryClassClass, ...]
# @var ComponentType:            To store value for ComponentType, selection scope is in below list
#                                LIBRARY | SECURITY_CORE | PEI_CORE | COMBINED_PEIM_DRIVER | PIC_PEIM | RELOCATABLE_PEIM | BS_DRIVER | RT_DRIVER | SAL_RT_DRIVER | APPLICATION
# @var MakefileName:             To store value for MakefileName
# @var BuildNumber:              To store value for BuildNumber
# @var BuildType:                To store value for BuildType
# @var FfsExt:                   To store value for FfsExt
# @var FvExt:                    To store value for FvExt
# @var SourceFv:                 To store value for SourceFv
# @var CustomMakefile:           To store value for CustomMakefile, it is a set structure as
#                                { Family : Filename, ... }
# @var Shadow:                   To store value for Shadow
# @var MacroDefines              To store the defined macros
#
class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
    def __init__(self):
        IdentificationClass.__init__(self)
        CommonHeaderClass.__init__(self)
        DefineClass.__init__(self)
        self.ModuleType = ''
        self.SupModuleList = []
        self.SupArchList = []
        self.BinaryModule = False
        self.OutputFileBasename = ''
        self.ClonedFrom = []
        self.PcdIsDriver = ''
        self.TianoR8FlashMap_h = False
        self.InfVersion = ''
        self.PiSpecificationVersion = ''
        self.UefiSpecificationVersion = ''
        self.EdkReleaseVersion = ''
        self.LibraryClass = []
        self.ComponentType = ''
        self.MakefileName = ''
        self.BuildNumber = ''
        self.BuildType = ''
        self.FfsExt = ''
        self.FvExt = ''
        self.SourceFv = ''
        self.CustomMakefile = {}
        self.Shadow = ''
        self.MacroDefines = {}
        self.SourceOverridePath = ''
        self.Specification = []

## ModuleSourceFileClass
#
# This class defined source file item used in Module file
# 
# @param CommonClass:      Inherited from CommonClass class
# @param SourceFile:       Input value for SourceFile, default is ''
# @param TagName:          Input value for TagName, default is ''
# @param ToolCode:         Input value for ToolCode, default is ''
# @param ToolChainFamily:  Input value for ToolChainFamily, default is ''
# @param FeatureFlag:      Input value for FeatureFlag, default is ''
# @param SupArchList:      Input value for SupArchList, default is []
#
# @var SourceFile:         To store value for SourceFile
# @var TagName:            To store value for TagName
# @var ToolCode:           To store value for ToolCode
# @var ToolChainFamily:    To store value for ToolChainFamily
#
class ModuleSourceFileClass(CommonClass):
    def __init__(self, SourceFile = '', TagName = '', ToolCode = '', ToolChainFamily = '', FeatureFlag = '', SupArchList = None):
        self.SourceFile = SourceFile
        self.TagName = TagName
        self.ToolCode = ToolCode
        self.ToolChainFamily = ToolChainFamily
        self.FileType = ''
        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)

## ModuleBinaryFileClass
#
# This class defined binary file item used in Module file
# 
# @param CommonClass:    Inherited from CommonClass class
# @param BinaryFile:     Input value for BinaryFile, default is ''
# @param FileType:       Input value for FileType, default is ''
# @param FeatureFlag:    Input value for FeatureFlag, default is ''
# @param SupArchList:    Input value for SupArchList, default is []
#
# @var BinaryFile:       To store value for BinaryFile
# @var FileType:         To store value for FileType, selection scope is in below list
#                        FW | GUID | PREEFORM | UEFI_APP | UNI_UI | UNI_VER | LIB | PE32 | PIC | PEI_DEPEX | DXE_DEPEX | SMM_DEPEX| TE | VER | UI | BIN | FV
# @var Target:           To store value for Target
# @var ToolChainFamily:  To store value for ToolChainFamily
#
class ModuleBinaryFileClass(CommonClass):
    def __init__(self, BinaryFile = '', FileType = '', Target = '', FeatureFlag = '', SupArchList = None):
        self.BinaryFile = BinaryFile
        self.FileType = FileType
        self.Target = Target
        CommonClass.__init__(self, FeatureFlag = FeatureFlag, SupArchList = SupArchList)
        self.Filenames = []
        self.PatchPcdValues = []
        self.PcdExValues = []
        self.LibraryInstances = []
        self.BuildFlags = []

## ModulePackageDependencyClass
#
# This class defined package dependency item used in Module file
# 
# @param CommonClass:   Inherited from CommonClass class
# @param DefineClass:   Input value for DefineClass class
#
# @var FilePath:        To store value for FilePath
# @var PackageName:     To store value for PackageName
# @var PackageVersion:  To store value for PackageVersion
# @var PackageGuid:     To store value for PackageGuid
#
class ModulePackageDependencyClass(CommonClass, DefineClass):
    def __init__(self):
        self.FilePath = ''
        self.PackageName = ''
        self.PackageVersion = ''
        self.PackageGuid = ''
        self.Description = ''
        CommonClass.__init__(self)
        DefineClass.__init__(self)       

## ModuleLibraryClass
#
# This class defined library item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var Library:        To store value for Library
#
class ModuleLibraryClass(CommonClass):
    def __init__(self):
        self.Library = ''
        CommonClass.__init__(self)

## ModuleEventClass
#
# This class defined event item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var CName:          To store value for CName
# @var GuidCName:      To store value for GuidCName
# @var Type:           To store value for Type, selection scope is in below list
#                      CREATE_EVENT | SIGNAL_EVENT
#
class ModuleEventClass(CommonClass):        
    def __init__(self):
        self.CName = ''
        self.GuidCName = ''
        self.Type = ''                              
        CommonClass.__init__(self)

## ModuleHobClass
#
# This class defined hob item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var GuidCName:      To store value for GuidCName
# @var Type:           To store value for Type, selection scope is in below list
#                      PHIT | MEMORY_ALLOCATION | RESOURCE_DESCRIPTOR | GUID_EXTENSION | FIRMWARE_VOLUME | CPU | POOL | CAPSULE_VOLUME
#
class ModuleHobClass(CommonClass):
    def __init__(self):
        self.Type = ''
        self.GuidCName = ''
        CommonClass.__init__(self)

## ModuleVariableClass
#
# This class defined variable item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var GuidCName:      To store value for GuidCName
# @var Name:           To store value for Name
#
class ModuleVariableClass(CommonClass):
    def __init__(self):
        self.Name = ''
        self.GuidCName = ''
        CommonClass.__init__(self)

## ModuleBootModeClass
#
# This class defined boot mode item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var Name:           To store value for Name, selection scope is in below list
#                      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 
#
class ModuleBootModeClass(CommonClass):
    def __init__(self):
        self.Name = ''
        CommonClass.__init__(self)

## ModuleSystemTableClass
#
# This class defined system table item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var CName:          To store value for CName
#
class ModuleSystemTableClass(CommonClass):
    def __init__(self):
        self.CName = ''
        CommonClass.__init__(self)

## ModuleDataHubClass
#
# This class defined data hub item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var CName:          To store value for CName
#
class ModuleDataHubClass(CommonClass):
    def __init__(self):
        self.CName = ''
        CommonClass.__init__(self)        

## ModuleHiiPackageClass
#
# This class defined Hii package item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var CName:          To store value for CName
#
class ModuleHiiPackageClass(CommonClass):
    def __init__(self):
        self.CName = ''
        CommonClass.__init__(self)

## ModuleExternImageClass
#
# This class defined Extern Image item used in Module file
# 
# @param object:           Inherited from object class
#
# @var ModuleEntryPoint:   To store value for ModuleEntryPoint
# @var ModuleUnloadImage:  To store value for ModuleUnloadImage
#
class ModuleExternImageClass(object):
    def __init__(self):
        self.ModuleEntryPoint = ''
        self.ModuleUnloadImage = ''

## ModuleExternLibraryClass
#
# This class defined Extern Library item used in Module file
# 
# @param object:     Inherited from object class
#
# @var Constructor:  To store value for Constructor
# @var Destructor:   To store value for Destructor
#
class ModuleExternLibraryClass(object):
    def __init__(self):
        self.Constructor = ''
        self.Destructor = ''

## ModuleExternDriverClass
#
# This class defined Extern Driver item used in Module file
# 
# @param object:       Inherited from object class
#
# @var DriverBinding:  To store value for DriverBinding
# @var ComponentName:  To store value for ComponentName
# @var DriverConfig:   To store value for DriverConfig
# @var DriverDiag:     To store value for DriverDiag
#
class ModuleExternDriverClass(object):
    def __init__(self):
        self.DriverBinding= ''
        self.ComponentName = ''
        self.DriverConfig = ''
        self.DriverDiag = ''

## ModuleExternCallBackClass
#
# This class defined Extern Call Back item used in Module file
# 
# @param object:                      Inherited from object class
#
# @var SetVirtualAddressMapCallBack:  To store value for SetVirtualAddressMapCallBack
# @var ExitBootServicesCallBack:      To store value for ExitBootServicesCallBack
#
class ModuleExternCallBackClass(object):
    def __init__(self):
        self.SetVirtualAddressMapCallBack = ''
        self.ExitBootServicesCallBack = ''

## ModuleExternClass
#
# This class defined Extern used in Module file
# 
# @param object:                      Inherited from object class
#
#
class ModuleExternClass(CommonClass):
    def __init__(self):
        self.EntryPoint = ''
        self.UnloadImage = ''
        self.Constructor = ''
        self.Destructor = ''
        CommonClass.__init__(self)

## ModuleDepexClass
#
# This class defined depex item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
# @param DefineClass:  Input value for DefineClass class
#
# @var Depex:          To store value for Depex
#
class ModuleDepexClass(CommonClass, DefineClass):
    def __init__(self):
        CommonClass.__init__(self)
        DefineClass.__init__(self)
        self.Depex = ''

## ModuleNmakeClass
#
# This class defined nmake item used in Module file
# 
# @param CommonClass:  Inherited from CommonClass class
#
# @var Name:           To store value for Name
# @var Value:          To store value for Value
#
class ModuleNmakeClass(CommonClass):
    def __init__(self):
        CommonClass.__init__(self)
        self.Name = ''
        self.Value = ''

## ModuleClass
#
# This class defined a complete module item
# 
# @param object:    Inherited from object class
#
# @var Header:               To store value for Header, it is a structure as
#                            {Arch : ModuleHeaderClass}
# @var LibraryClasses:       To store value for LibraryClasses, it is a list structure as
#                            [ LibraryClassClass, ...]
# @var Libraries:            To store value for Libraries, it is a list structure as
#                            [ ModuleLibraryClass, ...]
# @var Sources:              To store value for Sources, it is a list structure as
#                            [ ModuleSourceFileClass, ...]
# @var Binaries:             To store value for Binaries, it is a list structure as
#                            [ ModuleBinaryFileClass, ...]
# @var NonProcessedFiles:    To store value for NonProcessedFiles, it is a list structure as
#                            [ '', '', ...]
# @var PackageDependencies:  To store value for PackageDependencies, it is a list structure as
#                            [ ModulePackageDependencyClass, ... ] 
# @var Nmake:                To store value for Nmake, it is a list structure as
#                            [ ModuleNmakeClass, ... ]
# @var Depex:                To store value for Depex, it is a list structure as
#                            [ ModuleDepexClass, ... ]
# @var Includes:             To store value for Includes, it is a list structure as
#                            [ IncludeClass, ...]
# @var Protocols:            To store value for Protocols, it is a list structure as
#                            [ ProtocolClass, ...]
# @var Ppis:                 To store value for Ppis, it is a list structure as
#                            [ PpiClass, ...]
# @var Events:               To store value for Events, it is a list structure as
#                            [ ModuleEventClass, ...]
# @var Hobs:                 To store value for Hobs, it is a list structure as
#                            [ ModuleHobClass, ...] 
# @var Variables:            To store value for Variables, it is a list structure as
#                            [ ModuleVariableClass, ...]
# @var BootModes:            To store value for BootModes, it is a list structure as
#                            [ ModuleBootModeClass, ...]
# @var SystemTables:         To store value for SystemTables, it is a list structure as
#                            [ ModuleSystemTableClass, ...]
# @var DataHubs:             To store value for DataHubs, it is a list structure as
#                            [ ModuleDataHubClass, ...]
# @var HiiPackages:          To store value for HiiPackages, it is a list structure as
#                            [ ModuleHiiPackageClass, ...]
# @var Guids:                To store value for Guids, it is a list structure as
#                            [ GuidClass, ...]
# @var PcdCodes:             To store value for PcdCodes, it is a list structure as
#                            [ PcdClass, ...]
# @var ExternImages:         To store value for ExternImages, it is a list structure as
#                            [ ModuleExternImageClass, ...]
# @var ExternLibraries:      To store value for ExternLibraries, it is a list structure as
#                            [ ModuleExternLibraryClass, ...]
# @var ExternDrivers:        To store value for ExternDrivers, it is a list structure as
#                            [ ModuleExternDriverClass, ...]
# @var ExternCallBacks:      To store value for ExternCallBacks, it is a list structure as
#                            [ ModuleExternCallBackClass, ...]
# @var BuildOptions:         To store value for BuildOptions, it is a list structure as
#                            [ BuildOptionClass, ...]
# @var UserExtensions:       To store value for UserExtensions, it is a list structure as
#                            [ UserExtensionsClass, ...]
#
class ModuleClass(object):
    def __init__(self):
        self.Header = {}
        self.ModuleHeader = ModuleHeaderClass()
        self.LibraryClasses = []
        self.Libraries = []
        self.Sources = []
        self.Binaries = []
        self.NonProcessedFiles = []
        self.PackageDependencies = []
        self.Nmake = []
        self.Depex = []
        self.PeiDepex = None
        self.DxeDepex = None
        self.SmmDepex = None
        self.Includes = []
        self.Protocols = []
        self.Ppis = []
        self.Events = []
        self.Hobs = []
        self.Variables = []
        self.BootModes = []
        self.SystemTables = []
        self.DataHubs = []
        self.HiiPackages = []
        self.Guids = []
        self.PcdCodes = []
        self.ExternImages = []
        self.ExternLibraries = []
        self.ExternDrivers = []
        self.ExternCallBacks = []
        self.Externs = []
        self.BuildOptions = []
        self.UserExtensions = None
        self.MiscFiles = None
        self.FileList = []

##
#
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.
#
if __name__ == '__main__':
    M = ModuleClass()