1## @file
2# classes represent data in FDF
3#
4#  Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>
5#
6#  This program and the accompanying materials
7#  are licensed and made available under the terms and conditions of the BSD License
8#  which accompanies this distribution.  The full text of the license may be found at
9#  http://opensource.org/licenses/bsd-license.php
10#
11#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13#
14
15## FD data in FDF
16#
17#
18class FDClassObject:
19    ## The constructor
20    #
21    #   @param  self        The object pointer
22    #
23    def __init__(self):
24        self.FdUiName = ''
25        self.CreateFileName = None
26        self.BaseAddress = None
27        self.BaseAddressPcd = None
28        self.Size = None
29        self.SizePcd = None
30        self.ErasePolarity = None
31        # 3-tuple list (blockSize, numBlocks, pcd)
32        self.BlockSizeList = []
33        # DefineVarDict[var] = value
34        self.DefineVarDict = {}
35        # SetVarDict[var] = value
36        self.SetVarDict = {}
37        self.RegionList = []
38        self.vtfRawDict = {}
39
40## FV data in FDF
41#
42#
43class FvClassObject:
44    ## The constructor
45    #
46    #   @param  self        The object pointer
47    #
48    def __init__(self):
49        self.UiFvName = None
50        self.CreateFileName = None
51        # 3-tuple list (blockSize, numBlocks, pcd)
52        self.BlockSizeList = []
53        # DefineVarDict[var] = value
54        self.DefineVarDict = {}
55        # SetVarDict[var] = value
56        self.SetVarDict = {}
57        self.FvAlignment = None
58        # FvAttributeDict[attribute] = TRUE/FALSE (1/0)
59        self.FvAttributeDict = {}
60        self.FvNameGuid = None
61        self.FvNameString = None
62        self.AprioriSectionList = []
63        self.FfsList = []
64        self.BsBaseAddress = None
65        self.RtBaseAddress = None
66
67## Region data in FDF
68#
69#
70class RegionClassObject:
71    ## The constructor
72    #
73    #   @param  self        The object pointer
74    #
75    def __init__(self):
76        self.Offset = None       # The begin position of the Region
77        self.Size = None         # The Size of the Region
78        self.PcdOffset = None
79        self.PcdSize = None
80        self.SetVarDict = {}
81        self.RegionType = None
82        self.RegionDataList = []
83
84## FFS data in FDF
85#
86#
87class FfsClassObject:
88    ## The constructor
89    #
90    #   @param  self        The object pointer
91    #
92    def __init__(self):
93        self.NameGuid = None
94        self.Fixed = False
95        self.CheckSum = False
96        self.Alignment = None
97        self.SectionList = []
98
99## FILE statement data in FDF
100#
101#
102class FileStatementClassObject (FfsClassObject) :
103    ## The constructor
104    #
105    #   @param  self        The object pointer
106    #
107    def __init__(self):
108        FfsClassObject.__init__(self)
109        self.FvFileType = None
110        self.FileName = None
111        self.KeyStringList = []
112        self.FvName = None
113        self.FdName = None
114        self.DefineVarDict = {}
115        self.AprioriSection = None
116        self.KeepReloc = None
117
118## INF statement data in FDF
119#
120#
121class FfsInfStatementClassObject(FfsClassObject):
122    ## The constructor
123    #
124    #   @param  self        The object pointer
125    #
126    def __init__(self):
127        FfsClassObject.__init__(self)
128        self.Rule = None
129        self.Version = None
130        self.Ui = None
131        self.InfFileName = None
132        self.BuildNum = ''
133        self.KeyStringList = []
134        self.KeepReloc = None
135        self.UseArch = None
136
137## APRIORI section data in FDF
138#
139#
140class AprioriSectionClassObject:
141    ## The constructor
142    #
143    #   @param  self        The object pointer
144    #
145    def __init__(self):
146        # DefineVarDict[var] = value
147        self.DefineVarDict = {}
148        self.FfsList = []
149
150## section data in FDF
151#
152#
153class SectionClassObject:
154    ## The constructor
155    #
156    #   @param  self        The object pointer
157    #
158    def __init__(self):
159        self.Alignment = None
160
161## Depex expression section in FDF
162#
163#
164class DepexSectionClassObject (SectionClassObject):
165    ## The constructor
166    #
167    #   @param  self        The object pointer
168    #
169    def __init__(self):
170        self.DepexType = None
171        self.Expression = None
172        self.ExpressionProcessed = False
173
174## Compress section data in FDF
175#
176#
177class CompressSectionClassObject (SectionClassObject) :
178    ## The constructor
179    #
180    #   @param  self        The object pointer
181    #
182    def __init__(self):
183        SectionClassObject.__init__(self)
184        self.CompType = None
185        self.SectionList = []
186
187## Data section data in FDF
188#
189#
190class DataSectionClassObject (SectionClassObject):
191    ## The constructor
192    #
193    #   @param  self        The object pointer
194    #
195    def __init__(self):
196        SectionClassObject.__init__(self)
197        self.SecType = None
198        self.SectFileName = None
199        self.SectionList = []
200        self.KeepReloc = True
201
202## Rule section data in FDF
203#
204#
205class EfiSectionClassObject (SectionClassObject):
206    ## The constructor
207    #
208    #   @param  self        The object pointer
209    #
210    def __init__(self):
211        SectionClassObject.__init__(self)
212        self.SectionType = None
213        self.Optional = False
214        self.FileType = None
215        self.StringData = None
216        self.FileName = None
217        self.FileExtension = None
218        self.BuildNum = None
219        self.KeepReloc = None
220
221## FV image section data in FDF
222#
223#
224class FvImageSectionClassObject (SectionClassObject):
225    ## The constructor
226    #
227    #   @param  self        The object pointer
228    #
229    def __init__(self):
230        SectionClassObject.__init__(self)
231        self.Fv = None
232        self.FvName = None
233        self.FvFileType = None
234        self.FvFileName = None
235        self.FvFileExtension = None
236        self.FvAddr = None
237
238## GUIDed section data in FDF
239#
240#
241class GuidSectionClassObject (SectionClassObject) :
242    ## The constructor
243    #
244    #   @param  self        The object pointer
245    #
246    def __init__(self):
247        SectionClassObject.__init__(self)
248        self.NameGuid = None
249        self.SectionList = []
250        self.SectionType = None
251        self.ProcessRequired = False
252        self.AuthStatusValid = False
253        self.ExtraHeaderSize = -1
254        self.FvAddr = []
255        self.FvParentAddr = None
256        self.IncludeFvSection = False
257
258## UI section data in FDF
259#
260#
261class UiSectionClassObject (SectionClassObject):
262    ## The constructor
263    #
264    #   @param  self        The object pointer
265    #
266    def __init__(self):
267        SectionClassObject.__init__(self)
268        self.StringData = None
269        self.FileName = None
270
271## Version section data in FDF
272#
273#
274class VerSectionClassObject (SectionClassObject):
275    ## The constructor
276    #
277    #   @param  self        The object pointer
278    #
279    def __init__(self):
280        SectionClassObject.__init__(self)
281        self.BuildNum = None
282        self.StringData = None
283        self.FileName = None
284
285## Rule data in FDF
286#
287#
288class RuleClassObject :
289    ## The constructor
290    #
291    #   @param  self        The object pointer
292    #
293    def __init__(self):
294        self.Arch = None
295        self.ModuleType = None    # For Module Type
296        self.TemplateName = None
297        self.NameGuid = None
298        self.Fixed = False
299        self.Alignment = None
300        self.SectAlignment = None
301        self.CheckSum = False
302        self.FvFileType = None       # for Ffs File Type
303        self.KeyStringList = []
304        self.KeepReloc = None
305
306## Complex rule data in FDF
307#
308#
309class RuleComplexFileClassObject(RuleClassObject) :
310    ## The constructor
311    #
312    #   @param  self        The object pointer
313    #
314    def __init__(self):
315        RuleClassObject.__init__(self)
316        self.SectionList = []
317
318## Simple rule data in FDF
319#
320#
321class RuleSimpleFileClassObject(RuleClassObject) :
322    ## The constructor
323    #
324    #   @param  self        The object pointer
325    #
326    def __init__(self):
327        RuleClassObject.__init__(self)
328        self.FileName = None
329        self.SectionType = ''
330        self.FileExtension = None
331
332## File extension rule data in FDF
333#
334#
335class RuleFileExtensionClassObject(RuleClassObject):
336    ## The constructor
337    #
338    #   @param  self        The object pointer
339    #
340    def __init__(self):
341        RuleClassObject.__init__(self)
342        self.FileExtension = None
343
344## Capsule data in FDF
345#
346#
347class CapsuleClassObject :
348    ## The constructor
349    #
350    #   @param  self        The object pointer
351    #
352    def __init__(self):
353        self.SpecName = None
354        self.UiCapsuleName = None
355        self.CreateFile = None
356        self.GroupIdNumber = None
357        # DefineVarDict[var] = value
358        self.DefineVarDict = {}
359        # SetVarDict[var] = value
360        self.SetVarDict = {}
361        # TokensDict[var] = value
362        self.TokensDict = {}
363        self.CapsuleDataList = []
364        self.FmpPayloadList = []
365
366## VTF data in FDF
367#
368#
369class VtfClassObject :
370    ## The constructor
371    #
372    #   @param  self        The object pointer
373    #
374    def __init__(self):
375        self.KeyArch = None
376        self.ArchList = None
377        self.UiName = None
378        self.ResetBin = None
379        self.ComponentStatementList = []
380
381## VTF component data in FDF
382#
383#
384class ComponentStatementClassObject :
385    ## The constructor
386    #
387    #   @param  self        The object pointer
388    #
389    def __init__(self):
390        self.CompName = None
391        self.CompLoc = None
392        self.CompType = None
393        self.CompVer = None
394        self.CompCs = None
395        self.CompBin = None
396        self.CompSym = None
397        self.CompSize = None
398        self.FilePos = None
399
400## OptionROM data in FDF
401#
402#
403class OptionRomClassObject:
404    ## The constructor
405    #
406    #   @param  self        The object pointer
407    #
408    def __init__(self):
409        self.DriverName = None
410        self.FfsList = []
411
412