2 # This file is used to create a database used by build tool
4 # Copyright (c) 2008 - 2017, Intel Corporation. All rights reserved.<BR>
5 # (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
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
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.
15 from Common
.String
import *
16 from Common
.DataType
import *
17 from Common
.Misc
import *
19 from MetaFileParser
import *
21 from Workspace
.BuildClassObject
import ModuleBuildClassObject
, LibraryClassObject
, PcdClassObject
22 ## Module build information from INF file
24 # This class is used to retrieve information stored in database and convert them
25 # into ModuleBuildClassObject form for easier use for AutoGen.
27 class InfBuildData(ModuleBuildClassObject
):
28 # dict used to convert PCD type in database to string used by build tool
30 MODEL_PCD_FIXED_AT_BUILD
: "FixedAtBuild",
31 MODEL_PCD_PATCHABLE_IN_MODULE
: "PatchableInModule",
32 MODEL_PCD_FEATURE_FLAG
: "FeatureFlag",
33 MODEL_PCD_DYNAMIC
: "Dynamic",
34 MODEL_PCD_DYNAMIC_DEFAULT
: "Dynamic",
35 MODEL_PCD_DYNAMIC_HII
: "DynamicHii",
36 MODEL_PCD_DYNAMIC_VPD
: "DynamicVpd",
37 MODEL_PCD_DYNAMIC_EX
: "DynamicEx",
38 MODEL_PCD_DYNAMIC_EX_DEFAULT
: "DynamicEx",
39 MODEL_PCD_DYNAMIC_EX_HII
: "DynamicExHii",
40 MODEL_PCD_DYNAMIC_EX_VPD
: "DynamicExVpd",
43 # dict used to convert part of [Defines] to members of InfBuildData directly
48 TAB_INF_DEFINES_BASE_NAME
: "_BaseName",
49 TAB_INF_DEFINES_FILE_GUID
: "_Guid",
50 TAB_INF_DEFINES_MODULE_TYPE
: "_ModuleType",
54 # TAB_INF_DEFINES_INF_VERSION : "_AutoGenVersion",
55 TAB_INF_DEFINES_COMPONENT_TYPE
: "_ComponentType",
56 TAB_INF_DEFINES_MAKEFILE_NAME
: "_MakefileName",
57 # TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
58 TAB_INF_DEFINES_DPX_SOURCE
:"_DxsFile",
59 TAB_INF_DEFINES_VERSION_NUMBER
: "_Version",
60 TAB_INF_DEFINES_VERSION_STRING
: "_Version",
61 TAB_INF_DEFINES_VERSION
: "_Version",
62 TAB_INF_DEFINES_PCD_IS_DRIVER
: "_PcdIsDriver",
63 TAB_INF_DEFINES_SHADOW
: "_Shadow",
65 TAB_COMPONENTS_SOURCE_OVERRIDE_PATH
: "_SourceOverridePath",
68 # dict used to convert Component type to Module type
71 "SECURITY_CORE" : "SEC",
72 "PEI_CORE" : "PEI_CORE",
73 "COMBINED_PEIM_DRIVER" : "PEIM",
75 "RELOCATABLE_PEIM" : "PEIM",
77 "BS_DRIVER" : "DXE_DRIVER",
78 "RT_DRIVER" : "DXE_RUNTIME_DRIVER",
79 "SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
80 "DXE_SMM_DRIVER" : "DXE_SMM_DRIVER",
81 # "SMM_DRIVER" : "DXE_SMM_DRIVER",
82 # "BS_DRIVER" : "DXE_SMM_DRIVER",
83 # "BS_DRIVER" : "UEFI_DRIVER",
84 "APPLICATION" : "UEFI_APPLICATION",
88 # regular expression for converting XXX_FLAGS in [nmake] section to new type
89 _NMAKE_FLAG_PATTERN_
= re
.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re
.UNICODE
)
90 # dict used to convert old tool name used in [nmake] section to new ones
98 ## Constructor of DscBuildData
100 # Initialize object of DscBuildData
102 # @param FilePath The path of platform description file
103 # @param RawData The raw data of DSC file
104 # @param BuildDataBase Database used to retrieve module/package information
105 # @param Arch The target architecture
106 # @param Platform The name of platform employing this module
107 # @param Macros Macros used for replacement in DSC file
109 def __init__(self
, FilePath
, RawData
, BuildDatabase
, Arch
='COMMON', Target
=None, Toolchain
=None):
110 self
.MetaFile
= FilePath
111 self
._ModuleDir
= FilePath
.Dir
112 self
._RawData
= RawData
113 self
._Bdb
= BuildDatabase
115 self
._Target
= Target
116 self
._Toolchain
= Toolchain
117 self
._Platform
= 'COMMON'
118 self
._SourceOverridePath
= None
119 if FilePath
.Key
in GlobalData
.gOverrideDir
:
120 self
._SourceOverridePath
= GlobalData
.gOverrideDir
[FilePath
.Key
]
124 def __setitem__(self
, key
, value
):
125 self
.__dict
__[self
._PROPERTY
_[key
]] = value
128 def __getitem__(self
, key
):
129 return self
.__dict
__[self
._PROPERTY
_[key
]]
132 def __contains__(self
, key
):
133 return key
in self
._PROPERTY
_
135 ## Set all internal used members of InfBuildData to None
137 self
._HeaderComments
= None
138 self
._TailComments
= None
140 self
._AutoGenVersion
= None
141 self
._BaseName
= None
143 self
._ModuleType
= None
144 self
._ComponentType
= None
145 self
._BuildType
= None
148 self
._PcdIsDriver
= None
149 self
._BinaryModule
= None
151 self
._MakefileName
= None
152 self
._CustomMakefile
= None
153 self
._Specification
= None
154 self
._LibraryClass
= None
155 self
._ModuleEntryPointList
= None
156 self
._ModuleUnloadImageList
= None
157 self
._ConstructorList
= None
158 self
._DestructorList
= None
160 self
._Binaries
= None
162 self
._LibraryClasses
= None
163 self
._Libraries
= None
164 self
._Protocols
= None
165 self
._ProtocolComments
= None
167 self
._PpiComments
= None
169 self
._GuidsUsedByPcd
= sdict()
170 self
._GuidComments
= None
171 self
._Includes
= None
172 self
._Packages
= None
174 self
._PcdComments
= None
175 self
._BuildOptions
= None
177 self
._DepexExpression
= None
180 ## Get current effective macros
181 def _GetMacros(self
):
182 if self
.__Macros
== None:
184 # EDK_GLOBAL defined macros can be applied to EDK module
185 if self
.AutoGenVersion
< 0x00010005:
186 self
.__Macros
.update(GlobalData
.gEdkGlobal
)
187 self
.__Macros
.update(GlobalData
.gGlobalDefines
)
196 # Changing the default ARCH to another may affect all other information
197 # because all information in a platform may be ARCH-related. That's
198 # why we need to clear all internal used members, in order to cause all
199 # information to be re-retrieved.
201 # @param Value The value of ARCH
203 def _SetArch(self
, Value
):
204 if self
._Arch
== Value
:
209 ## Return the name of platform employing this module
210 def _GetPlatform(self
):
211 return self
._Platform
213 ## Change the name of platform employing this module
215 # Changing the default name of platform to another may affect some information
216 # because they may be PLATFORM-related. That's why we need to clear all internal
217 # used members, in order to cause all information to be re-retrieved.
219 def _SetPlatform(self
, Value
):
220 if self
._Platform
== Value
:
222 self
._Platform
= Value
224 def _GetHeaderComments(self
):
225 if not self
._HeaderComments
:
226 self
._HeaderComments
= []
227 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER_COMMENT
]
228 for Record
in RecordList
:
229 self
._HeaderComments
.append(Record
[0])
230 return self
._HeaderComments
231 def _GetTailComments(self
):
232 if not self
._TailComments
:
233 self
._TailComments
= []
234 RecordList
= self
._RawData
[MODEL_META_DATA_TAIL_COMMENT
]
235 for Record
in RecordList
:
236 self
._TailComments
.append(Record
[0])
237 return self
._TailComments
238 ## Retrieve all information in [Defines] section
240 # (Retriving all [Defines] information in one-shot is just to save time.)
242 def _GetHeaderInfo(self
):
243 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
244 for Record
in RecordList
:
245 Name
, Value
= Record
[1], ReplaceMacro(Record
[2], self
._Macros
, False)
246 # items defined _PROPERTY_ don't need additional processing
249 if self
._Defs
== None:
251 self
._Defs
[Name
] = Value
252 self
._Macros
[Name
] = Value
253 # some special items in [Defines] section need special treatment
254 elif Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
255 if Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
256 Name
= 'UEFI_SPECIFICATION_VERSION'
257 if self
._Specification
== None:
258 self
._Specification
= sdict()
259 self
._Specification
[Name
] = GetHexVerValue(Value
)
260 if self
._Specification
[Name
] == None:
261 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
262 "'%s' format is not supported for %s" % (Value
, Name
),
263 File
=self
.MetaFile
, Line
=Record
[-1])
264 elif Name
== 'LIBRARY_CLASS':
265 if self
._LibraryClass
== None:
266 self
._LibraryClass
= []
267 ValueList
= GetSplitValueList(Value
)
268 LibraryClass
= ValueList
[0]
269 if len(ValueList
) > 1:
270 SupModuleList
= GetSplitValueList(ValueList
[1], ' ')
272 SupModuleList
= SUP_MODULE_LIST
273 self
._LibraryClass
.append(LibraryClassObject(LibraryClass
, SupModuleList
))
274 elif Name
== 'ENTRY_POINT':
275 if self
._ModuleEntryPointList
== None:
276 self
._ModuleEntryPointList
= []
277 self
._ModuleEntryPointList
.append(Value
)
278 elif Name
== 'UNLOAD_IMAGE':
279 if self
._ModuleUnloadImageList
== None:
280 self
._ModuleUnloadImageList
= []
283 self
._ModuleUnloadImageList
.append(Value
)
284 elif Name
== 'CONSTRUCTOR':
285 if self
._ConstructorList
== None:
286 self
._ConstructorList
= []
289 self
._ConstructorList
.append(Value
)
290 elif Name
== 'DESTRUCTOR':
291 if self
._DestructorList
== None:
292 self
._DestructorList
= []
295 self
._DestructorList
.append(Value
)
296 elif Name
== TAB_INF_DEFINES_CUSTOM_MAKEFILE
:
297 TokenList
= GetSplitValueList(Value
)
298 if self
._CustomMakefile
== None:
299 self
._CustomMakefile
= {}
300 if len(TokenList
) < 2:
301 self
._CustomMakefile
['MSFT'] = TokenList
[0]
302 self
._CustomMakefile
['GCC'] = TokenList
[0]
304 if TokenList
[0] not in ['MSFT', 'GCC']:
305 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
306 "No supported family [%s]" % TokenList
[0],
307 File
=self
.MetaFile
, Line
=Record
[-1])
308 self
._CustomMakefile
[TokenList
[0]] = TokenList
[1]
310 if self
._Defs
== None:
312 self
._Defs
[Name
] = Value
313 self
._Macros
[Name
] = Value
316 # Retrieve information in sections specific to Edk.x modules
318 if self
.AutoGenVersion
>= 0x00010005:
319 if not self
._ModuleType
:
320 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
321 "MODULE_TYPE is not given", File
=self
.MetaFile
)
322 if self
._ModuleType
not in SUP_MODULE_LIST
:
323 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
324 for Record
in RecordList
:
326 if Name
== "MODULE_TYPE":
329 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
330 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self
._ModuleType
, ' '.join(l
for l
in SUP_MODULE_LIST
)),
331 File
=self
.MetaFile
, Line
=LineNo
)
332 if (self
._Specification
== None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
333 if self
._ModuleType
== SUP_MODULE_SMM_CORE
:
334 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File
=self
.MetaFile
)
335 if (self
._Specification
== None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
336 if self
._ModuleType
== SUP_MODULE_MM_CORE_STANDALONE
:
337 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
, "MM_CORE_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File
=self
.MetaFile
)
338 if self
._ModuleType
== SUP_MODULE_MM_STANDALONE
:
339 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
, "MM_STANDALONE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x00010032", File
=self
.MetaFile
)
340 if self
._Defs
and 'PCI_DEVICE_ID' in self
._Defs
and 'PCI_VENDOR_ID' in self
._Defs \
341 and 'PCI_CLASS_CODE' in self
._Defs
and 'PCI_REVISION' in self
._Defs
:
342 self
._BuildType
= 'UEFI_OPTIONROM'
343 if 'PCI_COMPRESS' in self
._Defs
:
344 if self
._Defs
['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
345 EdkLogger
.error("build", FORMAT_INVALID
, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self
.MetaFile
)
347 elif self
._Defs
and 'UEFI_HII_RESOURCE_SECTION' in self
._Defs \
348 and self
._Defs
['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
349 self
._BuildType
= 'UEFI_HII'
351 self
._BuildType
= self
._ModuleType
.upper()
354 File
= PathClass(NormPath(self
._DxsFile
), self
._ModuleDir
, Arch
=self
._Arch
)
355 # check the file validation
356 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
358 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
359 File
=self
.MetaFile
, Line
=LineNo
)
360 if self
.Sources
== None:
362 self
._Sources
.append(File
)
364 if not self
._ComponentType
:
365 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
366 "COMPONENT_TYPE is not given", File
=self
.MetaFile
)
367 self
._BuildType
= self
._ComponentType
.upper()
368 if self
._ComponentType
in self
._MODULE
_TYPE
_:
369 self
._ModuleType
= self
._MODULE
_TYPE
_[self
._ComponentType
]
370 if self
._ComponentType
== 'LIBRARY':
371 self
._LibraryClass
= [LibraryClassObject(self
._BaseName
, SUP_MODULE_LIST
)]
372 # make use some [nmake] section macros
373 Macros
= self
._Macros
374 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
375 Macros
['PROCESSOR'] = self
._Arch
376 RecordList
= self
._RawData
[MODEL_META_DATA_NMAKE
, self
._Arch
, self
._Platform
]
377 for Name
, Value
, Dummy
, Arch
, Platform
, ID
, LineNo
in RecordList
:
378 Value
= ReplaceMacro(Value
, Macros
, True)
379 if Name
== "IMAGE_ENTRY_POINT":
380 if self
._ModuleEntryPointList
== None:
381 self
._ModuleEntryPointList
= []
382 self
._ModuleEntryPointList
.append(Value
)
383 elif Name
== "DPX_SOURCE":
384 File
= PathClass(NormPath(Value
), self
._ModuleDir
, Arch
=self
._Arch
)
385 # check the file validation
386 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
388 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
389 File
=self
.MetaFile
, Line
=LineNo
)
390 if self
.Sources
== None:
392 self
._Sources
.append(File
)
394 ToolList
= self
._NMAKE
_FLAG
_PATTERN
_.findall(Name
)
395 if len(ToolList
) == 0 or len(ToolList
) != 1:
397 # EdkLogger.warn("build", "Don't know how to do with macro [%s]" % Name,
398 # File=self.MetaFile, Line=LineNo)
400 if self
._BuildOptions
== None:
401 self
._BuildOptions
= sdict()
403 if ToolList
[0] in self
._TOOL
_CODE
_:
404 Tool
= self
._TOOL
_CODE
_[ToolList
[0]]
407 ToolChain
= "*_*_*_%s_FLAGS" % Tool
408 ToolChainFamily
= 'MSFT' # Edk.x only support MSFT tool chain
409 # ignore not replaced macros in value
410 ValueList
= GetSplitList(' ' + Value
, '/D')
412 for Index
in range(1, len(ValueList
)):
413 if ValueList
[Index
][-1] == '=' or ValueList
[Index
] == '':
415 Dummy
= Dummy
+ ' /D ' + ValueList
[Index
]
416 Value
= Dummy
.strip()
417 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
:
418 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Value
420 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
421 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Value
422 # set _Header to non-None in order to avoid database re-querying
423 self
._Header
_ = 'DUMMY'
425 ## Retrieve file version
426 def _GetInfVersion(self
):
427 if self
._AutoGenVersion
== None:
428 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
429 for Record
in RecordList
:
430 if Record
[1] == TAB_INF_DEFINES_INF_VERSION
:
432 ValueList
= Record
[2].split('.')
433 Major
= '%04o' % int(ValueList
[0], 0)
434 Minor
= '%04o' % int(ValueList
[1], 0)
435 self
._AutoGenVersion
= int('0x' + Major
+ Minor
, 0)
437 self
._AutoGenVersion
= int(Record
[2], 0)
439 if self
._AutoGenVersion
== None:
440 self
._AutoGenVersion
= 0x00010000
441 return self
._AutoGenVersion
443 ## Retrieve BASE_NAME
444 def _GetBaseName(self
):
445 if self
._BaseName
== None:
446 if self
._Header
_ == None:
447 self
._GetHeaderInfo
()
448 if self
._BaseName
== None:
449 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No BASE_NAME name", File
=self
.MetaFile
)
450 return self
._BaseName
453 def _GetDxsFile(self
):
454 if self
._DxsFile
== None:
455 if self
._Header
_ == None:
456 self
._GetHeaderInfo
()
457 if self
._DxsFile
== None:
461 ## Retrieve MODULE_TYPE
462 def _GetModuleType(self
):
463 if self
._ModuleType
== None:
464 if self
._Header
_ == None:
465 self
._GetHeaderInfo
()
466 if self
._ModuleType
== None:
467 self
._ModuleType
= 'BASE'
468 if self
._ModuleType
not in SUP_MODULE_LIST
:
469 self
._ModuleType
= "USER_DEFINED"
470 return self
._ModuleType
472 ## Retrieve COMPONENT_TYPE
473 def _GetComponentType(self
):
474 if self
._ComponentType
== None:
475 if self
._Header
_ == None:
476 self
._GetHeaderInfo
()
477 if self
._ComponentType
== None:
478 self
._ComponentType
= 'USER_DEFINED'
479 return self
._ComponentType
481 ## Retrieve "BUILD_TYPE"
482 def _GetBuildType(self
):
483 if self
._BuildType
== None:
484 if self
._Header
_ == None:
485 self
._GetHeaderInfo
()
486 if not self
._BuildType
:
487 self
._BuildType
= "BASE"
488 return self
._BuildType
490 ## Retrieve file guid
491 def _GetFileGuid(self
):
492 if self
._Guid
== None:
493 if self
._Header
_ == None:
494 self
._GetHeaderInfo
()
495 if self
._Guid
== None:
496 self
._Guid
= '00000000-0000-0000-0000-000000000000'
499 ## Retrieve module version
500 def _GetVersion(self
):
501 if self
._Version
== None:
502 if self
._Header
_ == None:
503 self
._GetHeaderInfo
()
504 if self
._Version
== None:
505 self
._Version
= '0.0'
508 ## Retrieve PCD_IS_DRIVER
509 def _GetPcdIsDriver(self
):
510 if self
._PcdIsDriver
== None:
511 if self
._Header
_ == None:
512 self
._GetHeaderInfo
()
513 if self
._PcdIsDriver
== None:
514 self
._PcdIsDriver
= ''
515 return self
._PcdIsDriver
518 def _GetShadow(self
):
519 if self
._Shadow
== None:
520 if self
._Header
_ == None:
521 self
._GetHeaderInfo
()
522 if self
._Shadow
!= None and self
._Shadow
.upper() == 'TRUE':
528 ## Retrieve CUSTOM_MAKEFILE
529 def _GetMakefile(self
):
530 if self
._CustomMakefile
== None:
531 if self
._Header
_ == None:
532 self
._GetHeaderInfo
()
533 if self
._CustomMakefile
== None:
534 self
._CustomMakefile
= {}
535 return self
._CustomMakefile
537 ## Retrieve EFI_SPECIFICATION_VERSION
539 if self
._Specification
== None:
540 if self
._Header
_ == None:
541 self
._GetHeaderInfo
()
542 if self
._Specification
== None:
543 self
._Specification
= {}
544 return self
._Specification
546 ## Retrieve LIBRARY_CLASS
547 def _GetLibraryClass(self
):
548 if self
._LibraryClass
== None:
549 if self
._Header
_ == None:
550 self
._GetHeaderInfo
()
551 if self
._LibraryClass
== None:
552 self
._LibraryClass
= []
553 return self
._LibraryClass
555 ## Retrieve ENTRY_POINT
556 def _GetEntryPoint(self
):
557 if self
._ModuleEntryPointList
== None:
558 if self
._Header
_ == None:
559 self
._GetHeaderInfo
()
560 if self
._ModuleEntryPointList
== None:
561 self
._ModuleEntryPointList
= []
562 return self
._ModuleEntryPointList
564 ## Retrieve UNLOAD_IMAGE
565 def _GetUnloadImage(self
):
566 if self
._ModuleUnloadImageList
== None:
567 if self
._Header
_ == None:
568 self
._GetHeaderInfo
()
569 if self
._ModuleUnloadImageList
== None:
570 self
._ModuleUnloadImageList
= []
571 return self
._ModuleUnloadImageList
573 ## Retrieve CONSTRUCTOR
574 def _GetConstructor(self
):
575 if self
._ConstructorList
== None:
576 if self
._Header
_ == None:
577 self
._GetHeaderInfo
()
578 if self
._ConstructorList
== None:
579 self
._ConstructorList
= []
580 return self
._ConstructorList
582 ## Retrieve DESTRUCTOR
583 def _GetDestructor(self
):
584 if self
._DestructorList
== None:
585 if self
._Header
_ == None:
586 self
._GetHeaderInfo
()
587 if self
._DestructorList
== None:
588 self
._DestructorList
= []
589 return self
._DestructorList
591 ## Retrieve definies other than above ones
592 def _GetDefines(self
):
593 if self
._Defs
== None:
594 if self
._Header
_ == None:
595 self
._GetHeaderInfo
()
596 if self
._Defs
== None:
600 ## Retrieve binary files
601 def _GetBinaries(self
):
602 if self
._Binaries
== None:
604 RecordList
= self
._RawData
[MODEL_EFI_BINARY_FILE
, self
._Arch
, self
._Platform
]
605 Macros
= self
._Macros
606 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
607 Macros
['PROCESSOR'] = self
._Arch
608 for Record
in RecordList
:
614 TokenList
= GetSplitValueList(Record
[2], TAB_VALUE_SPLIT
)
616 Target
= TokenList
[0]
617 if len(TokenList
) > 1:
618 FeatureFlag
= Record
[1:]
620 File
= PathClass(NormPath(Record
[1], Macros
), self
._ModuleDir
, '', FileType
, True, self
._Arch
, '', Target
)
621 # check the file validation
622 ErrorCode
, ErrorInfo
= File
.Validate()
624 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
625 self
._Binaries
.append(File
)
626 return self
._Binaries
628 ## Retrieve binary files with error check.
629 def _GetBinaryFiles(self
):
630 Binaries
= self
._GetBinaries
()
631 if GlobalData
.gIgnoreSource
and Binaries
== []:
632 ErrorInfo
= "The INF file does not contain any Binaries to use in creating the image\n"
633 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
)
636 ## Check whether it exists the binaries with current ARCH in AsBuild INF
637 def _IsSupportedArch(self
):
638 if self
._GetBinaries
() and not self
._GetSourceFiles
():
642 ## Retrieve source files
643 def _GetSourceFiles(self
):
644 # Ignore all source files in a binary build mode
645 if GlobalData
.gIgnoreSource
:
649 if self
._Sources
== None:
651 RecordList
= self
._RawData
[MODEL_EFI_SOURCE_FILE
, self
._Arch
, self
._Platform
]
652 Macros
= self
._Macros
653 for Record
in RecordList
:
655 ToolChainFamily
= Record
[1]
658 FeatureFlag
= Record
[4]
659 if self
.AutoGenVersion
< 0x00010005:
660 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
661 Macros
['PROCESSOR'] = self
._Arch
662 SourceFile
= NormPath(Record
[0], Macros
)
663 if SourceFile
[0] == os
.path
.sep
:
664 SourceFile
= mws
.join(GlobalData
.gWorkspace
, SourceFile
[1:])
665 # old module source files (Edk)
666 File
= PathClass(SourceFile
, self
._ModuleDir
, self
._SourceOverridePath
,
667 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
668 # check the file validation
669 ErrorCode
, ErrorInfo
= File
.Validate(CaseSensitive
=False)
671 if File
.Ext
.lower() == '.h':
672 EdkLogger
.warn('build', 'Include file not found', ExtraData
=ErrorInfo
,
673 File
=self
.MetaFile
, Line
=LineNo
)
676 EdkLogger
.error('build', ErrorCode
, ExtraData
=File
, File
=self
.MetaFile
, Line
=LineNo
)
678 File
= PathClass(NormPath(Record
[0], Macros
), self
._ModuleDir
, '',
679 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
680 # check the file validation
681 ErrorCode
, ErrorInfo
= File
.Validate()
683 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
685 self
._Sources
.append(File
)
688 ## Retrieve library classes employed by this module
689 def _GetLibraryClassUses(self
):
690 if self
._LibraryClasses
== None:
691 self
._LibraryClasses
= sdict()
692 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, self
._Platform
]
693 for Record
in RecordList
:
697 Instance
= NormPath(Instance
, self
._Macros
)
698 self
._LibraryClasses
[Lib
] = Instance
699 return self
._LibraryClasses
701 ## Retrieve library names (for Edk.x style of modules)
702 def _GetLibraryNames(self
):
703 if self
._Libraries
== None:
705 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_INSTANCE
, self
._Arch
, self
._Platform
]
706 for Record
in RecordList
:
707 LibraryName
= ReplaceMacro(Record
[0], self
._Macros
, False)
708 # in case of name with '.lib' extension, which is unusual in Edk.x inf
709 LibraryName
= os
.path
.splitext(LibraryName
)[0]
710 if LibraryName
not in self
._Libraries
:
711 self
._Libraries
.append(LibraryName
)
712 return self
._Libraries
714 def _GetProtocolComments(self
):
716 return self
._ProtocolComments
717 ## Retrieve protocols consumed/produced by this module
718 def _GetProtocols(self
):
719 if self
._Protocols
== None:
720 self
._Protocols
= sdict()
721 self
._ProtocolComments
= sdict()
722 RecordList
= self
._RawData
[MODEL_EFI_PROTOCOL
, self
._Arch
, self
._Platform
]
723 for Record
in RecordList
:
725 Value
= ProtocolValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
727 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
728 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
729 "Value of Protocol [%s] is not found under [Protocols] section in" % CName
,
730 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
731 self
._Protocols
[CName
] = Value
732 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
734 for CmtRec
in CommentRecords
:
735 Comments
.append(CmtRec
[0])
736 self
._ProtocolComments
[CName
] = Comments
737 return self
._Protocols
739 def _GetPpiComments(self
):
741 return self
._PpiComments
742 ## Retrieve PPIs consumed/produced by this module
744 if self
._Ppis
== None:
746 self
._PpiComments
= sdict()
747 RecordList
= self
._RawData
[MODEL_EFI_PPI
, self
._Arch
, self
._Platform
]
748 for Record
in RecordList
:
750 Value
= PpiValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
752 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
753 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
754 "Value of PPI [%s] is not found under [Ppis] section in " % CName
,
755 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
756 self
._Ppis
[CName
] = Value
757 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
759 for CmtRec
in CommentRecords
:
760 Comments
.append(CmtRec
[0])
761 self
._PpiComments
[CName
] = Comments
764 def _GetGuidComments(self
):
766 return self
._GuidComments
767 ## Retrieve GUIDs consumed/produced by this module
769 if self
._Guids
== None:
770 self
._Guids
= sdict()
771 self
._GuidComments
= sdict()
772 RecordList
= self
._RawData
[MODEL_EFI_GUID
, self
._Arch
, self
._Platform
]
773 for Record
in RecordList
:
775 Value
= GuidValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
777 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
778 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
779 "Value of Guid [%s] is not found under [Guids] section in" % CName
,
780 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
781 self
._Guids
[CName
] = Value
782 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
784 for CmtRec
in CommentRecords
:
785 Comments
.append(CmtRec
[0])
786 self
._GuidComments
[CName
] = Comments
789 ## Retrieve include paths necessary for this module (for Edk.x style of modules)
790 def _GetIncludes(self
):
791 if self
._Includes
== None:
793 if self
._SourceOverridePath
:
794 self
._Includes
.append(self
._SourceOverridePath
)
796 Macros
= self
._Macros
797 if 'PROCESSOR' in GlobalData
.gEdkGlobal
.keys():
798 Macros
['PROCESSOR'] = GlobalData
.gEdkGlobal
['PROCESSOR']
800 Macros
['PROCESSOR'] = self
._Arch
801 RecordList
= self
._RawData
[MODEL_EFI_INCLUDE
, self
._Arch
, self
._Platform
]
802 for Record
in RecordList
:
803 if Record
[0].find('EDK_SOURCE') > -1:
804 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
805 File
= NormPath(Record
[0], self
._Macros
)
807 File
= os
.path
.join(self
._ModuleDir
, File
)
809 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
810 File
= RealPath(os
.path
.normpath(File
))
812 self
._Includes
.append(File
)
814 # TRICK: let compiler to choose correct header file
815 Macros
['EDK_SOURCE'] = GlobalData
.gEdkSource
816 File
= NormPath(Record
[0], self
._Macros
)
818 File
= os
.path
.join(self
._ModuleDir
, File
)
820 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
821 File
= RealPath(os
.path
.normpath(File
))
823 self
._Includes
.append(File
)
825 File
= NormPath(Record
[0], Macros
)
827 File
= os
.path
.join(self
._ModuleDir
, File
)
829 File
= mws
.join(GlobalData
.gWorkspace
, File
)
830 File
= RealPath(os
.path
.normpath(File
))
832 self
._Includes
.append(File
)
833 if not File
and Record
[0].find('EFI_SOURCE') > -1:
834 # tricky to regard WorkSpace as EFI_SOURCE
835 Macros
['EFI_SOURCE'] = GlobalData
.gWorkspace
836 File
= NormPath(Record
[0], Macros
)
838 File
= os
.path
.join(self
._ModuleDir
, File
)
840 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
841 File
= RealPath(os
.path
.normpath(File
))
843 self
._Includes
.append(File
)
844 return self
._Includes
846 ## Retrieve packages this module depends on
847 def _GetPackages(self
):
848 if self
._Packages
== None:
850 RecordList
= self
._RawData
[MODEL_META_DATA_PACKAGE
, self
._Arch
, self
._Platform
]
851 Macros
= self
._Macros
852 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
853 for Record
in RecordList
:
854 File
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
856 # check the file validation
857 ErrorCode
, ErrorInfo
= File
.Validate('.dec')
859 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
860 # parse this package now. we need it to get protocol/ppi/guid value
861 Package
= self
._Bdb
[File
, self
._Arch
, self
._Target
, self
._Toolchain
]
862 self
._Packages
.append(Package
)
863 return self
._Packages
865 ## Retrieve PCD comments
866 def _GetPcdComments(self
):
868 return self
._PcdComments
869 ## Retrieve PCDs used in this module
871 if self
._Pcds
== None:
873 self
._PcdComments
= sdict()
874 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FIXED_AT_BUILD
))
875 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_PATCHABLE_IN_MODULE
))
876 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FEATURE_FLAG
))
877 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC
))
878 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC_EX
))
881 ## Retrieve build options specific to this module
882 def _GetBuildOptions(self
):
883 if self
._BuildOptions
== None:
884 self
._BuildOptions
= sdict()
885 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, self
._Platform
]
886 for Record
in RecordList
:
887 ToolChainFamily
= Record
[0]
888 ToolChain
= Record
[1]
890 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
or Option
.startswith('='):
891 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Option
893 # concatenate the option string if they're for the same tool
894 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
895 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Option
896 return self
._BuildOptions
898 ## Retrieve dependency expression
900 if self
._Depex
== None:
901 self
._Depex
= tdict(False, 2)
902 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
904 # If the module has only Binaries and no Sources, then ignore [Depex]
905 if self
.Sources
== None or self
.Sources
== []:
906 if self
.Binaries
!= None and self
.Binaries
!= []:
909 # PEIM and DXE drivers must have a valid [Depex] section
910 if len(self
.LibraryClass
) == 0 and len(RecordList
) == 0:
911 if self
.ModuleType
== 'DXE_DRIVER' or self
.ModuleType
== 'PEIM' or self
.ModuleType
== 'DXE_SMM_DRIVER' or \
912 self
.ModuleType
== 'DXE_SAL_DRIVER' or self
.ModuleType
== 'DXE_RUNTIME_DRIVER':
913 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
914 % self
.ModuleType
, File
=self
.MetaFile
)
916 if len(RecordList
) != 0 and self
.ModuleType
== 'USER_DEFINED':
917 for Record
in RecordList
:
918 if Record
[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DRIVER']:
919 EdkLogger
.error('build', FORMAT_INVALID
,
920 "'%s' module must specify the type of [Depex] section" % self
.ModuleType
,
924 for Record
in RecordList
:
925 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
927 ModuleType
= Record
[4]
928 TokenList
= DepexStr
.split()
929 if (Arch
, ModuleType
) not in Depex
:
930 Depex
[Arch
, ModuleType
] = []
931 DepexList
= Depex
[Arch
, ModuleType
]
932 for Token
in TokenList
:
933 if Token
in DEPEX_SUPPORTED_OPCODE
:
934 DepexList
.append(Token
)
935 elif Token
.endswith(".inf"): # module file name
936 ModuleFile
= os
.path
.normpath(Token
)
937 Module
= self
.BuildDatabase
[ModuleFile
]
939 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "Module is not found in active platform",
940 ExtraData
=Token
, File
=self
.MetaFile
, Line
=Record
[-1])
941 DepexList
.append(Module
.Guid
)
943 # get the GUID value now
944 Value
= ProtocolValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
946 Value
= PpiValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
948 Value
= GuidValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
950 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
951 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
952 "Value of [%s] is not found in" % Token
,
953 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
954 DepexList
.append(Value
)
955 for Arch
, ModuleType
in Depex
:
956 self
._Depex
[Arch
, ModuleType
] = Depex
[Arch
, ModuleType
]
959 ## Retrieve depedency expression
960 def _GetDepexExpression(self
):
961 if self
._DepexExpression
== None:
962 self
._DepexExpression
= tdict(False, 2)
963 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
964 DepexExpression
= sdict()
965 for Record
in RecordList
:
966 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
968 ModuleType
= Record
[4]
969 TokenList
= DepexStr
.split()
970 if (Arch
, ModuleType
) not in DepexExpression
:
971 DepexExpression
[Arch
, ModuleType
] = ''
972 for Token
in TokenList
:
973 DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
] + Token
.strip() + ' '
974 for Arch
, ModuleType
in DepexExpression
:
975 self
._DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
]
976 return self
._DepexExpression
978 def GetGuidsUsedByPcd(self
):
979 return self
._GuidsUsedByPcd
980 ## Retrieve PCD for given type
981 def _GetPcd(self
, Type
):
983 PcdDict
= tdict(True, 4)
985 RecordList
= self
._RawData
[Type
, self
._Arch
, self
._Platform
]
986 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, Platform
, Id
, LineNo
in RecordList
:
987 PcdDict
[Arch
, Platform
, PcdCName
, TokenSpaceGuid
] = (Setting
, LineNo
)
988 PcdList
.append((PcdCName
, TokenSpaceGuid
))
990 if TokenSpaceGuid
not in self
.Guids
:
991 Value
= GuidValue(TokenSpaceGuid
, self
.Packages
, self
.MetaFile
.Path
)
993 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
994 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
995 "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid
,
996 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=LineNo
)
997 self
.Guids
[TokenSpaceGuid
] = Value
998 self
._GuidsUsedByPcd
[TokenSpaceGuid
] = Value
999 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Id
]
1001 for CmtRec
in CommentRecords
:
1002 Comments
.append(CmtRec
[0])
1003 self
._PcdComments
[TokenSpaceGuid
, PcdCName
] = Comments
1005 # resolve PCD type, value, datum info, etc. by getting its definition from package
1006 for PcdCName
, TokenSpaceGuid
in PcdList
:
1007 PcdRealName
= PcdCName
1008 Setting
, LineNo
= PcdDict
[self
._Arch
, self
.Platform
, PcdCName
, TokenSpaceGuid
]
1011 ValueList
= AnalyzePcdData(Setting
)
1012 DefaultValue
= ValueList
[0]
1013 Pcd
= PcdClassObject(
1023 self
.Guids
[TokenSpaceGuid
]
1025 if Type
== MODEL_PCD_PATCHABLE_IN_MODULE
and ValueList
[1]:
1026 # Patch PCD: TokenSpace.PcdCName|Value|Offset
1027 Pcd
.Offset
= ValueList
[1]
1029 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1030 for Package
in self
.Packages
:
1031 for key
in Package
.Pcds
:
1032 if (Package
.Pcds
[key
].TokenCName
, Package
.Pcds
[key
].TokenSpaceGuidCName
) == (PcdRealName
, TokenSpaceGuid
):
1033 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1034 Pcd_Type
= item
[0].split('_')[-1]
1035 if Pcd_Type
== Package
.Pcds
[key
].Type
:
1036 Value
= Package
.Pcds
[key
]
1037 Value
.TokenCName
= Package
.Pcds
[key
].TokenCName
+ '_' + Pcd_Type
1039 newkey
= (Value
.TokenCName
, key
[1])
1041 newkey
= (Value
.TokenCName
, key
[1], key
[2])
1042 del Package
.Pcds
[key
]
1043 Package
.Pcds
[newkey
] = Value
1050 # get necessary info from package declaring this PCD
1051 for Package
in self
.Packages
:
1053 # 'dynamic' in INF means its type is determined by platform;
1054 # if platform doesn't give its type, use 'lowest' one in the
1055 # following order, if any
1057 # "FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"
1059 PcdType
= self
._PCD
_TYPE
_STRING
_[Type
]
1060 if Type
== MODEL_PCD_DYNAMIC
:
1062 for T
in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
1063 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1064 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1065 if str(item
[0]).endswith(T
) and (item
[0], item
[1], T
) in Package
.Pcds
:
1073 if (PcdRealName
, TokenSpaceGuid
, T
) in Package
.Pcds
:
1079 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1080 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1081 Pcd_Type
= item
[0].split('_')[-1]
1082 if Pcd_Type
== PcdType
:
1090 if (PcdCName
, TokenSpaceGuid
, PcdType
) in Package
.Pcds
:
1091 PcdInPackage
= Package
.Pcds
[PcdCName
, TokenSpaceGuid
, PcdType
]
1093 Pcd
.TokenValue
= PcdInPackage
.TokenValue
1096 # Check whether the token value exist or not.
1098 if Pcd
.TokenValue
== None or Pcd
.TokenValue
== "":
1102 "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid
, PcdRealName
, str(Package
)),
1103 File
=self
.MetaFile
, Line
=LineNo
,
1107 # Check hexadecimal token value length and format.
1109 ReIsValidPcdTokenValue
= re
.compile(r
"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re
.DOTALL
)
1110 if Pcd
.TokenValue
.startswith("0x") or Pcd
.TokenValue
.startswith("0X"):
1111 if ReIsValidPcdTokenValue
.match(Pcd
.TokenValue
) == None:
1115 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1116 File
=self
.MetaFile
, Line
=LineNo
,
1121 # Check decimal token value length and format.
1125 TokenValueInt
= int (Pcd
.TokenValue
, 10)
1126 if (TokenValueInt
< 0 or TokenValueInt
> 4294967295):
1130 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, as a decimal it should between: 0 - 4294967295!" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1131 File
=self
.MetaFile
, Line
=LineNo
,
1138 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid, it should be hexadecimal or decimal!" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1139 File
=self
.MetaFile
, Line
=LineNo
,
1143 Pcd
.DatumType
= PcdInPackage
.DatumType
1144 Pcd
.MaxDatumSize
= PcdInPackage
.MaxDatumSize
1145 Pcd
.InfDefaultValue
= Pcd
.DefaultValue
1146 if Pcd
.DefaultValue
in [None, '']:
1147 Pcd
.DefaultValue
= PcdInPackage
.DefaultValue
1150 Pcd
.DefaultValue
= ValueExpressionEx(Pcd
.DefaultValue
, Pcd
.DatumType
, self
.Guids
)(True)
1151 except BadExpression
, Value
:
1152 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid
, PcdRealName
, Pcd
.DefaultValue
, Value
),
1153 File
=self
.MetaFile
, Line
=LineNo
)
1159 "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid
, PcdRealName
, self
.MetaFile
),
1160 File
=self
.MetaFile
, Line
=LineNo
,
1161 ExtraData
="\t%s" % '\n\t'.join([str(P
) for P
in self
.Packages
])
1163 Pcds
[PcdCName
, TokenSpaceGuid
] = Pcd
1167 ## check whether current module is binary module
1168 def _IsBinaryModule(self
):
1169 if self
.Binaries
and not self
.Sources
:
1171 elif GlobalData
.gIgnoreSource
:
1176 _Macros
= property(_GetMacros
)
1177 Arch
= property(_GetArch
, _SetArch
)
1178 Platform
= property(_GetPlatform
, _SetPlatform
)
1180 HeaderComments
= property(_GetHeaderComments
)
1181 TailComments
= property(_GetTailComments
)
1182 AutoGenVersion
= property(_GetInfVersion
)
1183 BaseName
= property(_GetBaseName
)
1184 ModuleType
= property(_GetModuleType
)
1185 ComponentType
= property(_GetComponentType
)
1186 BuildType
= property(_GetBuildType
)
1187 Guid
= property(_GetFileGuid
)
1188 Version
= property(_GetVersion
)
1189 PcdIsDriver
= property(_GetPcdIsDriver
)
1190 Shadow
= property(_GetShadow
)
1191 CustomMakefile
= property(_GetMakefile
)
1192 Specification
= property(_GetSpec
)
1193 LibraryClass
= property(_GetLibraryClass
)
1194 ModuleEntryPointList
= property(_GetEntryPoint
)
1195 ModuleUnloadImageList
= property(_GetUnloadImage
)
1196 ConstructorList
= property(_GetConstructor
)
1197 DestructorList
= property(_GetDestructor
)
1198 Defines
= property(_GetDefines
)
1199 DxsFile
= property(_GetDxsFile
)
1201 Binaries
= property(_GetBinaryFiles
)
1202 Sources
= property(_GetSourceFiles
)
1203 LibraryClasses
= property(_GetLibraryClassUses
)
1204 Libraries
= property(_GetLibraryNames
)
1205 Protocols
= property(_GetProtocols
)
1206 ProtocolComments
= property(_GetProtocolComments
)
1207 Ppis
= property(_GetPpis
)
1208 PpiComments
= property(_GetPpiComments
)
1209 Guids
= property(_GetGuids
)
1210 GuidComments
= property(_GetGuidComments
)
1211 Includes
= property(_GetIncludes
)
1212 Packages
= property(_GetPackages
)
1213 Pcds
= property(_GetPcds
)
1214 PcdComments
= property(_GetPcdComments
)
1215 BuildOptions
= property(_GetBuildOptions
)
1216 Depex
= property(_GetDepex
)
1217 DepexExpression
= property(_GetDepexExpression
)
1218 IsBinaryModule
= property(_IsBinaryModule
)
1219 IsSupportedArch
= property(_IsSupportedArch
)