2 # This file is used to create a database used by build tool
4 # Copyright (c) 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 *
20 from Workspace
.BuildClassObject
import ModuleBuildClassObject
, LibraryClassObject
, PcdClassObject
21 ## Module build information from INF file
23 # This class is used to retrieve information stored in database and convert them
24 # into ModuleBuildClassObject form for easier use for AutoGen.
26 class InfBuildData(ModuleBuildClassObject
):
27 # dict used to convert PCD type in database to string used by build tool
29 MODEL_PCD_FIXED_AT_BUILD
: "FixedAtBuild",
30 MODEL_PCD_PATCHABLE_IN_MODULE
: "PatchableInModule",
31 MODEL_PCD_FEATURE_FLAG
: "FeatureFlag",
32 MODEL_PCD_DYNAMIC
: "Dynamic",
33 MODEL_PCD_DYNAMIC_DEFAULT
: "Dynamic",
34 MODEL_PCD_DYNAMIC_HII
: "DynamicHii",
35 MODEL_PCD_DYNAMIC_VPD
: "DynamicVpd",
36 MODEL_PCD_DYNAMIC_EX
: "DynamicEx",
37 MODEL_PCD_DYNAMIC_EX_DEFAULT
: "DynamicEx",
38 MODEL_PCD_DYNAMIC_EX_HII
: "DynamicExHii",
39 MODEL_PCD_DYNAMIC_EX_VPD
: "DynamicExVpd",
42 # dict used to convert part of [Defines] to members of InfBuildData directly
47 TAB_INF_DEFINES_BASE_NAME
: "_BaseName",
48 TAB_INF_DEFINES_FILE_GUID
: "_Guid",
49 TAB_INF_DEFINES_MODULE_TYPE
: "_ModuleType",
53 # TAB_INF_DEFINES_INF_VERSION : "_AutoGenVersion",
54 TAB_INF_DEFINES_COMPONENT_TYPE
: "_ComponentType",
55 TAB_INF_DEFINES_MAKEFILE_NAME
: "_MakefileName",
56 # TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
57 TAB_INF_DEFINES_DPX_SOURCE
:"_DxsFile",
58 TAB_INF_DEFINES_VERSION_NUMBER
: "_Version",
59 TAB_INF_DEFINES_VERSION_STRING
: "_Version",
60 TAB_INF_DEFINES_VERSION
: "_Version",
61 TAB_INF_DEFINES_PCD_IS_DRIVER
: "_PcdIsDriver",
62 TAB_INF_DEFINES_SHADOW
: "_Shadow",
64 TAB_COMPONENTS_SOURCE_OVERRIDE_PATH
: "_SourceOverridePath",
67 # dict used to convert Component type to Module type
70 "SECURITY_CORE" : "SEC",
71 "PEI_CORE" : "PEI_CORE",
72 "COMBINED_PEIM_DRIVER" : "PEIM",
74 "RELOCATABLE_PEIM" : "PEIM",
76 "BS_DRIVER" : "DXE_DRIVER",
77 "RT_DRIVER" : "DXE_RUNTIME_DRIVER",
78 "SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
79 "DXE_SMM_DRIVER" : "DXE_SMM_DRIVER",
80 # "SMM_DRIVER" : "DXE_SMM_DRIVER",
81 # "BS_DRIVER" : "DXE_SMM_DRIVER",
82 # "BS_DRIVER" : "UEFI_DRIVER",
83 "APPLICATION" : "UEFI_APPLICATION",
87 # regular expression for converting XXX_FLAGS in [nmake] section to new type
88 _NMAKE_FLAG_PATTERN_
= re
.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re
.UNICODE
)
89 # dict used to convert old tool name used in [nmake] section to new ones
97 ## Constructor of DscBuildData
99 # Initialize object of DscBuildData
101 # @param FilePath The path of platform description file
102 # @param RawData The raw data of DSC file
103 # @param BuildDataBase Database used to retrieve module/package information
104 # @param Arch The target architecture
105 # @param Platform The name of platform employing this module
106 # @param Macros Macros used for replacement in DSC file
108 def __init__(self
, FilePath
, RawData
, BuildDatabase
, Arch
='COMMON', Target
=None, Toolchain
=None):
109 self
.MetaFile
= FilePath
110 self
._ModuleDir
= FilePath
.Dir
111 self
._RawData
= RawData
112 self
._Bdb
= BuildDatabase
114 self
._Target
= Target
115 self
._Toolchain
= Toolchain
116 self
._Platform
= 'COMMON'
117 self
._SourceOverridePath
= None
118 if FilePath
.Key
in GlobalData
.gOverrideDir
:
119 self
._SourceOverridePath
= GlobalData
.gOverrideDir
[FilePath
.Key
]
123 def __setitem__(self
, key
, value
):
124 self
.__dict
__[self
._PROPERTY
_[key
]] = value
127 def __getitem__(self
, key
):
128 return self
.__dict
__[self
._PROPERTY
_[key
]]
131 def __contains__(self
, key
):
132 return key
in self
._PROPERTY
_
134 ## Set all internal used members of InfBuildData to None
136 self
._HeaderComments
= None
137 self
._TailComments
= None
139 self
._AutoGenVersion
= None
140 self
._BaseName
= None
142 self
._ModuleType
= None
143 self
._ComponentType
= None
144 self
._BuildType
= None
147 self
._PcdIsDriver
= None
148 self
._BinaryModule
= None
150 self
._MakefileName
= None
151 self
._CustomMakefile
= None
152 self
._Specification
= None
153 self
._LibraryClass
= None
154 self
._ModuleEntryPointList
= None
155 self
._ModuleUnloadImageList
= None
156 self
._ConstructorList
= None
157 self
._DestructorList
= None
159 self
._Binaries
= None
161 self
._LibraryClasses
= None
162 self
._Libraries
= None
163 self
._Protocols
= None
164 self
._ProtocolComments
= None
166 self
._PpiComments
= None
168 self
._GuidsUsedByPcd
= sdict()
169 self
._GuidComments
= None
170 self
._Includes
= None
171 self
._Packages
= None
173 self
._PcdComments
= None
174 self
._BuildOptions
= None
176 self
._DepexExpression
= None
179 ## Get current effective macros
180 def _GetMacros(self
):
181 if self
.__Macros
== None:
183 # EDK_GLOBAL defined macros can be applied to EDK module
184 if self
.AutoGenVersion
< 0x00010005:
185 self
.__Macros
.update(GlobalData
.gEdkGlobal
)
186 self
.__Macros
.update(GlobalData
.gGlobalDefines
)
195 # Changing the default ARCH to another may affect all other information
196 # because all information in a platform may be ARCH-related. That's
197 # why we need to clear all internal used members, in order to cause all
198 # information to be re-retrieved.
200 # @param Value The value of ARCH
202 def _SetArch(self
, Value
):
203 if self
._Arch
== Value
:
208 ## Return the name of platform employing this module
209 def _GetPlatform(self
):
210 return self
._Platform
212 ## Change the name of platform employing this module
214 # Changing the default name of platform to another may affect some information
215 # because they may be PLATFORM-related. That's why we need to clear all internal
216 # used members, in order to cause all information to be re-retrieved.
218 def _SetPlatform(self
, Value
):
219 if self
._Platform
== Value
:
221 self
._Platform
= Value
223 def _GetHeaderComments(self
):
224 if not self
._HeaderComments
:
225 self
._HeaderComments
= []
226 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER_COMMENT
]
227 for Record
in RecordList
:
228 self
._HeaderComments
.append(Record
[0])
229 return self
._HeaderComments
230 def _GetTailComments(self
):
231 if not self
._TailComments
:
232 self
._TailComments
= []
233 RecordList
= self
._RawData
[MODEL_META_DATA_TAIL_COMMENT
]
234 for Record
in RecordList
:
235 self
._TailComments
.append(Record
[0])
236 return self
._TailComments
237 ## Retrieve all information in [Defines] section
239 # (Retriving all [Defines] information in one-shot is just to save time.)
241 def _GetHeaderInfo(self
):
242 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
243 for Record
in RecordList
:
244 Name
, Value
= Record
[1], ReplaceMacro(Record
[2], self
._Macros
, False)
245 # items defined _PROPERTY_ don't need additional processing
248 if self
._Defs
== None:
250 self
._Defs
[Name
] = Value
251 self
._Macros
[Name
] = Value
252 # some special items in [Defines] section need special treatment
253 elif Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
254 if Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
255 Name
= 'UEFI_SPECIFICATION_VERSION'
256 if self
._Specification
== None:
257 self
._Specification
= sdict()
258 self
._Specification
[Name
] = GetHexVerValue(Value
)
259 if self
._Specification
[Name
] == None:
260 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
261 "'%s' format is not supported for %s" % (Value
, Name
),
262 File
=self
.MetaFile
, Line
=Record
[-1])
263 elif Name
== 'LIBRARY_CLASS':
264 if self
._LibraryClass
== None:
265 self
._LibraryClass
= []
266 ValueList
= GetSplitValueList(Value
)
267 LibraryClass
= ValueList
[0]
268 if len(ValueList
) > 1:
269 SupModuleList
= GetSplitValueList(ValueList
[1], ' ')
271 SupModuleList
= SUP_MODULE_LIST
272 self
._LibraryClass
.append(LibraryClassObject(LibraryClass
, SupModuleList
))
273 elif Name
== 'ENTRY_POINT':
274 if self
._ModuleEntryPointList
== None:
275 self
._ModuleEntryPointList
= []
276 self
._ModuleEntryPointList
.append(Value
)
277 elif Name
== 'UNLOAD_IMAGE':
278 if self
._ModuleUnloadImageList
== None:
279 self
._ModuleUnloadImageList
= []
282 self
._ModuleUnloadImageList
.append(Value
)
283 elif Name
== 'CONSTRUCTOR':
284 if self
._ConstructorList
== None:
285 self
._ConstructorList
= []
288 self
._ConstructorList
.append(Value
)
289 elif Name
== 'DESTRUCTOR':
290 if self
._DestructorList
== None:
291 self
._DestructorList
= []
294 self
._DestructorList
.append(Value
)
295 elif Name
== TAB_INF_DEFINES_CUSTOM_MAKEFILE
:
296 TokenList
= GetSplitValueList(Value
)
297 if self
._CustomMakefile
== None:
298 self
._CustomMakefile
= {}
299 if len(TokenList
) < 2:
300 self
._CustomMakefile
['MSFT'] = TokenList
[0]
301 self
._CustomMakefile
['GCC'] = TokenList
[0]
303 if TokenList
[0] not in ['MSFT', 'GCC']:
304 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
305 "No supported family [%s]" % TokenList
[0],
306 File
=self
.MetaFile
, Line
=Record
[-1])
307 self
._CustomMakefile
[TokenList
[0]] = TokenList
[1]
309 if self
._Defs
== None:
311 self
._Defs
[Name
] = Value
312 self
._Macros
[Name
] = Value
315 # Retrieve information in sections specific to Edk.x modules
317 if self
.AutoGenVersion
>= 0x00010005:
318 if not self
._ModuleType
:
319 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
320 "MODULE_TYPE is not given", File
=self
.MetaFile
)
321 if self
._ModuleType
not in SUP_MODULE_LIST
:
322 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
323 for Record
in RecordList
:
325 if Name
== "MODULE_TYPE":
328 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
329 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self
._ModuleType
, ' '.join(l
for l
in SUP_MODULE_LIST
)),
330 File
=self
.MetaFile
, Line
=LineNo
)
331 if (self
._Specification
== None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
332 if self
._ModuleType
== SUP_MODULE_SMM_CORE
:
333 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
)
334 if (self
._Specification
== None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
335 if self
._ModuleType
== SUP_MODULE_MM_CORE_STANDALONE
:
336 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
)
337 if self
._ModuleType
== SUP_MODULE_MM_STANDALONE
:
338 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
)
339 if self
._Defs
and 'PCI_DEVICE_ID' in self
._Defs
and 'PCI_VENDOR_ID' in self
._Defs \
340 and 'PCI_CLASS_CODE' in self
._Defs
and 'PCI_REVISION' in self
._Defs
:
341 self
._BuildType
= 'UEFI_OPTIONROM'
342 if 'PCI_COMPRESS' in self
._Defs
:
343 if self
._Defs
['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
344 EdkLogger
.error("build", FORMAT_INVALID
, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self
.MetaFile
)
346 elif self
._Defs
and 'UEFI_HII_RESOURCE_SECTION' in self
._Defs \
347 and self
._Defs
['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
348 self
._BuildType
= 'UEFI_HII'
350 self
._BuildType
= self
._ModuleType
.upper()
353 File
= PathClass(NormPath(self
._DxsFile
), self
._ModuleDir
, Arch
=self
._Arch
)
354 # check the file validation
355 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
357 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
358 File
=self
.MetaFile
, Line
=LineNo
)
359 if self
.Sources
== None:
361 self
._Sources
.append(File
)
363 if not self
._ComponentType
:
364 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
365 "COMPONENT_TYPE is not given", File
=self
.MetaFile
)
366 self
._BuildType
= self
._ComponentType
.upper()
367 if self
._ComponentType
in self
._MODULE
_TYPE
_:
368 self
._ModuleType
= self
._MODULE
_TYPE
_[self
._ComponentType
]
369 if self
._ComponentType
== 'LIBRARY':
370 self
._LibraryClass
= [LibraryClassObject(self
._BaseName
, SUP_MODULE_LIST
)]
371 # make use some [nmake] section macros
372 Macros
= self
._Macros
373 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
374 Macros
['PROCESSOR'] = self
._Arch
375 RecordList
= self
._RawData
[MODEL_META_DATA_NMAKE
, self
._Arch
, self
._Platform
]
376 for Name
, Value
, Dummy
, Arch
, Platform
, ID
, LineNo
in RecordList
:
377 Value
= ReplaceMacro(Value
, Macros
, True)
378 if Name
== "IMAGE_ENTRY_POINT":
379 if self
._ModuleEntryPointList
== None:
380 self
._ModuleEntryPointList
= []
381 self
._ModuleEntryPointList
.append(Value
)
382 elif Name
== "DPX_SOURCE":
383 File
= PathClass(NormPath(Value
), self
._ModuleDir
, Arch
=self
._Arch
)
384 # check the file validation
385 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
387 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
388 File
=self
.MetaFile
, Line
=LineNo
)
389 if self
.Sources
== None:
391 self
._Sources
.append(File
)
393 ToolList
= self
._NMAKE
_FLAG
_PATTERN
_.findall(Name
)
394 if len(ToolList
) == 0 or len(ToolList
) != 1:
396 # EdkLogger.warn("build", "Don't know how to do with macro [%s]" % Name,
397 # File=self.MetaFile, Line=LineNo)
399 if self
._BuildOptions
== None:
400 self
._BuildOptions
= sdict()
402 if ToolList
[0] in self
._TOOL
_CODE
_:
403 Tool
= self
._TOOL
_CODE
_[ToolList
[0]]
406 ToolChain
= "*_*_*_%s_FLAGS" % Tool
407 ToolChainFamily
= 'MSFT' # Edk.x only support MSFT tool chain
408 # ignore not replaced macros in value
409 ValueList
= GetSplitList(' ' + Value
, '/D')
411 for Index
in range(1, len(ValueList
)):
412 if ValueList
[Index
][-1] == '=' or ValueList
[Index
] == '':
414 Dummy
= Dummy
+ ' /D ' + ValueList
[Index
]
415 Value
= Dummy
.strip()
416 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
:
417 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Value
419 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
420 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Value
421 # set _Header to non-None in order to avoid database re-querying
422 self
._Header
_ = 'DUMMY'
424 ## Retrieve file version
425 def _GetInfVersion(self
):
426 if self
._AutoGenVersion
== None:
427 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
428 for Record
in RecordList
:
429 if Record
[1] == TAB_INF_DEFINES_INF_VERSION
:
431 ValueList
= Record
[2].split('.')
432 Major
= '%04o' % int(ValueList
[0], 0)
433 Minor
= '%04o' % int(ValueList
[1], 0)
434 self
._AutoGenVersion
= int('0x' + Major
+ Minor
, 0)
436 self
._AutoGenVersion
= int(Record
[2], 0)
438 if self
._AutoGenVersion
== None:
439 self
._AutoGenVersion
= 0x00010000
440 return self
._AutoGenVersion
442 ## Retrieve BASE_NAME
443 def _GetBaseName(self
):
444 if self
._BaseName
== None:
445 if self
._Header
_ == None:
446 self
._GetHeaderInfo
()
447 if self
._BaseName
== None:
448 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No BASE_NAME name", File
=self
.MetaFile
)
449 return self
._BaseName
452 def _GetDxsFile(self
):
453 if self
._DxsFile
== None:
454 if self
._Header
_ == None:
455 self
._GetHeaderInfo
()
456 if self
._DxsFile
== None:
460 ## Retrieve MODULE_TYPE
461 def _GetModuleType(self
):
462 if self
._ModuleType
== None:
463 if self
._Header
_ == None:
464 self
._GetHeaderInfo
()
465 if self
._ModuleType
== None:
466 self
._ModuleType
= 'BASE'
467 if self
._ModuleType
not in SUP_MODULE_LIST
:
468 self
._ModuleType
= "USER_DEFINED"
469 return self
._ModuleType
471 ## Retrieve COMPONENT_TYPE
472 def _GetComponentType(self
):
473 if self
._ComponentType
== None:
474 if self
._Header
_ == None:
475 self
._GetHeaderInfo
()
476 if self
._ComponentType
== None:
477 self
._ComponentType
= 'USER_DEFINED'
478 return self
._ComponentType
480 ## Retrieve "BUILD_TYPE"
481 def _GetBuildType(self
):
482 if self
._BuildType
== None:
483 if self
._Header
_ == None:
484 self
._GetHeaderInfo
()
485 if not self
._BuildType
:
486 self
._BuildType
= "BASE"
487 return self
._BuildType
489 ## Retrieve file guid
490 def _GetFileGuid(self
):
491 if self
._Guid
== None:
492 if self
._Header
_ == None:
493 self
._GetHeaderInfo
()
494 if self
._Guid
== None:
495 self
._Guid
= '00000000-0000-0000-0000-000000000000'
498 ## Retrieve module version
499 def _GetVersion(self
):
500 if self
._Version
== None:
501 if self
._Header
_ == None:
502 self
._GetHeaderInfo
()
503 if self
._Version
== None:
504 self
._Version
= '0.0'
507 ## Retrieve PCD_IS_DRIVER
508 def _GetPcdIsDriver(self
):
509 if self
._PcdIsDriver
== None:
510 if self
._Header
_ == None:
511 self
._GetHeaderInfo
()
512 if self
._PcdIsDriver
== None:
513 self
._PcdIsDriver
= ''
514 return self
._PcdIsDriver
517 def _GetShadow(self
):
518 if self
._Shadow
== None:
519 if self
._Header
_ == None:
520 self
._GetHeaderInfo
()
521 if self
._Shadow
!= None and self
._Shadow
.upper() == 'TRUE':
527 ## Retrieve CUSTOM_MAKEFILE
528 def _GetMakefile(self
):
529 if self
._CustomMakefile
== None:
530 if self
._Header
_ == None:
531 self
._GetHeaderInfo
()
532 if self
._CustomMakefile
== None:
533 self
._CustomMakefile
= {}
534 return self
._CustomMakefile
536 ## Retrieve EFI_SPECIFICATION_VERSION
538 if self
._Specification
== None:
539 if self
._Header
_ == None:
540 self
._GetHeaderInfo
()
541 if self
._Specification
== None:
542 self
._Specification
= {}
543 return self
._Specification
545 ## Retrieve LIBRARY_CLASS
546 def _GetLibraryClass(self
):
547 if self
._LibraryClass
== None:
548 if self
._Header
_ == None:
549 self
._GetHeaderInfo
()
550 if self
._LibraryClass
== None:
551 self
._LibraryClass
= []
552 return self
._LibraryClass
554 ## Retrieve ENTRY_POINT
555 def _GetEntryPoint(self
):
556 if self
._ModuleEntryPointList
== None:
557 if self
._Header
_ == None:
558 self
._GetHeaderInfo
()
559 if self
._ModuleEntryPointList
== None:
560 self
._ModuleEntryPointList
= []
561 return self
._ModuleEntryPointList
563 ## Retrieve UNLOAD_IMAGE
564 def _GetUnloadImage(self
):
565 if self
._ModuleUnloadImageList
== None:
566 if self
._Header
_ == None:
567 self
._GetHeaderInfo
()
568 if self
._ModuleUnloadImageList
== None:
569 self
._ModuleUnloadImageList
= []
570 return self
._ModuleUnloadImageList
572 ## Retrieve CONSTRUCTOR
573 def _GetConstructor(self
):
574 if self
._ConstructorList
== None:
575 if self
._Header
_ == None:
576 self
._GetHeaderInfo
()
577 if self
._ConstructorList
== None:
578 self
._ConstructorList
= []
579 return self
._ConstructorList
581 ## Retrieve DESTRUCTOR
582 def _GetDestructor(self
):
583 if self
._DestructorList
== None:
584 if self
._Header
_ == None:
585 self
._GetHeaderInfo
()
586 if self
._DestructorList
== None:
587 self
._DestructorList
= []
588 return self
._DestructorList
590 ## Retrieve definies other than above ones
591 def _GetDefines(self
):
592 if self
._Defs
== None:
593 if self
._Header
_ == None:
594 self
._GetHeaderInfo
()
595 if self
._Defs
== None:
599 ## Retrieve binary files
600 def _GetBinaries(self
):
601 if self
._Binaries
== None:
603 RecordList
= self
._RawData
[MODEL_EFI_BINARY_FILE
, self
._Arch
, self
._Platform
]
604 Macros
= self
._Macros
605 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
606 Macros
['PROCESSOR'] = self
._Arch
607 for Record
in RecordList
:
613 TokenList
= GetSplitValueList(Record
[2], TAB_VALUE_SPLIT
)
615 Target
= TokenList
[0]
616 if len(TokenList
) > 1:
617 FeatureFlag
= Record
[1:]
619 File
= PathClass(NormPath(Record
[1], Macros
), self
._ModuleDir
, '', FileType
, True, self
._Arch
, '', Target
)
620 # check the file validation
621 ErrorCode
, ErrorInfo
= File
.Validate()
623 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
624 self
._Binaries
.append(File
)
625 return self
._Binaries
627 ## Retrieve binary files with error check.
628 def _GetBinaryFiles(self
):
629 Binaries
= self
._GetBinaries
()
630 if GlobalData
.gIgnoreSource
and Binaries
== []:
631 ErrorInfo
= "The INF file does not contain any Binaries to use in creating the image\n"
632 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
)
635 ## Check whether it exists the binaries with current ARCH in AsBuild INF
636 def _IsSupportedArch(self
):
637 if self
._GetBinaries
() and not self
._GetSourceFiles
():
641 ## Retrieve source files
642 def _GetSourceFiles(self
):
643 # Ignore all source files in a binary build mode
644 if GlobalData
.gIgnoreSource
:
648 if self
._Sources
== None:
650 RecordList
= self
._RawData
[MODEL_EFI_SOURCE_FILE
, self
._Arch
, self
._Platform
]
651 Macros
= self
._Macros
652 for Record
in RecordList
:
654 ToolChainFamily
= Record
[1]
657 FeatureFlag
= Record
[4]
658 if self
.AutoGenVersion
< 0x00010005:
659 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
660 Macros
['PROCESSOR'] = self
._Arch
661 SourceFile
= NormPath(Record
[0], Macros
)
662 if SourceFile
[0] == os
.path
.sep
:
663 SourceFile
= mws
.join(GlobalData
.gWorkspace
, SourceFile
[1:])
664 # old module source files (Edk)
665 File
= PathClass(SourceFile
, self
._ModuleDir
, self
._SourceOverridePath
,
666 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
667 # check the file validation
668 ErrorCode
, ErrorInfo
= File
.Validate(CaseSensitive
=False)
670 if File
.Ext
.lower() == '.h':
671 EdkLogger
.warn('build', 'Include file not found', ExtraData
=ErrorInfo
,
672 File
=self
.MetaFile
, Line
=LineNo
)
675 EdkLogger
.error('build', ErrorCode
, ExtraData
=File
, File
=self
.MetaFile
, Line
=LineNo
)
677 File
= PathClass(NormPath(Record
[0], Macros
), self
._ModuleDir
, '',
678 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
679 # check the file validation
680 ErrorCode
, ErrorInfo
= File
.Validate()
682 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
684 self
._Sources
.append(File
)
687 ## Retrieve library classes employed by this module
688 def _GetLibraryClassUses(self
):
689 if self
._LibraryClasses
== None:
690 self
._LibraryClasses
= sdict()
691 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, self
._Platform
]
692 for Record
in RecordList
:
696 Instance
= NormPath(Instance
, self
._Macros
)
697 self
._LibraryClasses
[Lib
] = Instance
698 return self
._LibraryClasses
700 ## Retrieve library names (for Edk.x style of modules)
701 def _GetLibraryNames(self
):
702 if self
._Libraries
== None:
704 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_INSTANCE
, self
._Arch
, self
._Platform
]
705 for Record
in RecordList
:
706 LibraryName
= ReplaceMacro(Record
[0], self
._Macros
, False)
707 # in case of name with '.lib' extension, which is unusual in Edk.x inf
708 LibraryName
= os
.path
.splitext(LibraryName
)[0]
709 if LibraryName
not in self
._Libraries
:
710 self
._Libraries
.append(LibraryName
)
711 return self
._Libraries
713 def _GetProtocolComments(self
):
715 return self
._ProtocolComments
716 ## Retrieve protocols consumed/produced by this module
717 def _GetProtocols(self
):
718 if self
._Protocols
== None:
719 self
._Protocols
= sdict()
720 self
._ProtocolComments
= sdict()
721 RecordList
= self
._RawData
[MODEL_EFI_PROTOCOL
, self
._Arch
, self
._Platform
]
722 for Record
in RecordList
:
724 Value
= ProtocolValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
726 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
727 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
728 "Value of Protocol [%s] is not found under [Protocols] section in" % CName
,
729 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
730 self
._Protocols
[CName
] = Value
731 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
733 for CmtRec
in CommentRecords
:
734 Comments
.append(CmtRec
[0])
735 self
._ProtocolComments
[CName
] = Comments
736 return self
._Protocols
738 def _GetPpiComments(self
):
740 return self
._PpiComments
741 ## Retrieve PPIs consumed/produced by this module
743 if self
._Ppis
== None:
745 self
._PpiComments
= sdict()
746 RecordList
= self
._RawData
[MODEL_EFI_PPI
, self
._Arch
, self
._Platform
]
747 for Record
in RecordList
:
749 Value
= PpiValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
751 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
752 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
753 "Value of PPI [%s] is not found under [Ppis] section in " % CName
,
754 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
755 self
._Ppis
[CName
] = Value
756 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
758 for CmtRec
in CommentRecords
:
759 Comments
.append(CmtRec
[0])
760 self
._PpiComments
[CName
] = Comments
763 def _GetGuidComments(self
):
765 return self
._GuidComments
766 ## Retrieve GUIDs consumed/produced by this module
768 if self
._Guids
== None:
769 self
._Guids
= sdict()
770 self
._GuidComments
= sdict()
771 RecordList
= self
._RawData
[MODEL_EFI_GUID
, self
._Arch
, self
._Platform
]
772 for Record
in RecordList
:
774 Value
= GuidValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
776 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
777 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
778 "Value of Guid [%s] is not found under [Guids] section in" % CName
,
779 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
780 self
._Guids
[CName
] = Value
781 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
783 for CmtRec
in CommentRecords
:
784 Comments
.append(CmtRec
[0])
785 self
._GuidComments
[CName
] = Comments
788 ## Retrieve include paths necessary for this module (for Edk.x style of modules)
789 def _GetIncludes(self
):
790 if self
._Includes
== None:
792 if self
._SourceOverridePath
:
793 self
._Includes
.append(self
._SourceOverridePath
)
795 Macros
= self
._Macros
796 if 'PROCESSOR' in GlobalData
.gEdkGlobal
.keys():
797 Macros
['PROCESSOR'] = GlobalData
.gEdkGlobal
['PROCESSOR']
799 Macros
['PROCESSOR'] = self
._Arch
800 RecordList
= self
._RawData
[MODEL_EFI_INCLUDE
, self
._Arch
, self
._Platform
]
801 for Record
in RecordList
:
802 if Record
[0].find('EDK_SOURCE') > -1:
803 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
804 File
= NormPath(Record
[0], self
._Macros
)
806 File
= os
.path
.join(self
._ModuleDir
, File
)
808 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
809 File
= RealPath(os
.path
.normpath(File
))
811 self
._Includes
.append(File
)
813 # TRICK: let compiler to choose correct header file
814 Macros
['EDK_SOURCE'] = GlobalData
.gEdkSource
815 File
= NormPath(Record
[0], self
._Macros
)
817 File
= os
.path
.join(self
._ModuleDir
, File
)
819 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
820 File
= RealPath(os
.path
.normpath(File
))
822 self
._Includes
.append(File
)
824 File
= NormPath(Record
[0], Macros
)
826 File
= os
.path
.join(self
._ModuleDir
, File
)
828 File
= mws
.join(GlobalData
.gWorkspace
, File
)
829 File
= RealPath(os
.path
.normpath(File
))
831 self
._Includes
.append(File
)
832 if not File
and Record
[0].find('EFI_SOURCE') > -1:
833 # tricky to regard WorkSpace as EFI_SOURCE
834 Macros
['EFI_SOURCE'] = GlobalData
.gWorkspace
835 File
= NormPath(Record
[0], Macros
)
837 File
= os
.path
.join(self
._ModuleDir
, File
)
839 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
840 File
= RealPath(os
.path
.normpath(File
))
842 self
._Includes
.append(File
)
843 return self
._Includes
845 ## Retrieve packages this module depends on
846 def _GetPackages(self
):
847 if self
._Packages
== None:
849 RecordList
= self
._RawData
[MODEL_META_DATA_PACKAGE
, self
._Arch
, self
._Platform
]
850 Macros
= self
._Macros
851 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
852 for Record
in RecordList
:
853 File
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
855 # check the file validation
856 ErrorCode
, ErrorInfo
= File
.Validate('.dec')
858 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
859 # parse this package now. we need it to get protocol/ppi/guid value
860 Package
= self
._Bdb
[File
, self
._Arch
, self
._Target
, self
._Toolchain
]
861 self
._Packages
.append(Package
)
862 return self
._Packages
864 ## Retrieve PCD comments
865 def _GetPcdComments(self
):
867 return self
._PcdComments
868 ## Retrieve PCDs used in this module
870 if self
._Pcds
== None:
872 self
._PcdComments
= sdict()
873 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FIXED_AT_BUILD
))
874 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_PATCHABLE_IN_MODULE
))
875 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FEATURE_FLAG
))
876 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC
))
877 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC_EX
))
880 ## Retrieve build options specific to this module
881 def _GetBuildOptions(self
):
882 if self
._BuildOptions
== None:
883 self
._BuildOptions
= sdict()
884 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, self
._Platform
]
885 for Record
in RecordList
:
886 ToolChainFamily
= Record
[0]
887 ToolChain
= Record
[1]
889 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
or Option
.startswith('='):
890 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Option
892 # concatenate the option string if they're for the same tool
893 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
894 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Option
895 return self
._BuildOptions
897 ## Retrieve dependency expression
899 if self
._Depex
== None:
900 self
._Depex
= tdict(False, 2)
901 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
903 # If the module has only Binaries and no Sources, then ignore [Depex]
904 if self
.Sources
== None or self
.Sources
== []:
905 if self
.Binaries
!= None and self
.Binaries
!= []:
908 # PEIM and DXE drivers must have a valid [Depex] section
909 if len(self
.LibraryClass
) == 0 and len(RecordList
) == 0:
910 if self
.ModuleType
== 'DXE_DRIVER' or self
.ModuleType
== 'PEIM' or self
.ModuleType
== 'DXE_SMM_DRIVER' or \
911 self
.ModuleType
== 'DXE_SAL_DRIVER' or self
.ModuleType
== 'DXE_RUNTIME_DRIVER':
912 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
913 % self
.ModuleType
, File
=self
.MetaFile
)
915 if len(RecordList
) != 0 and self
.ModuleType
== 'USER_DEFINED':
916 for Record
in RecordList
:
917 if Record
[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DRIVER']:
918 EdkLogger
.error('build', FORMAT_INVALID
,
919 "'%s' module must specify the type of [Depex] section" % self
.ModuleType
,
923 for Record
in RecordList
:
924 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
926 ModuleType
= Record
[4]
927 TokenList
= DepexStr
.split()
928 if (Arch
, ModuleType
) not in Depex
:
929 Depex
[Arch
, ModuleType
] = []
930 DepexList
= Depex
[Arch
, ModuleType
]
931 for Token
in TokenList
:
932 if Token
in DEPEX_SUPPORTED_OPCODE
:
933 DepexList
.append(Token
)
934 elif Token
.endswith(".inf"): # module file name
935 ModuleFile
= os
.path
.normpath(Token
)
936 Module
= self
.BuildDatabase
[ModuleFile
]
938 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "Module is not found in active platform",
939 ExtraData
=Token
, File
=self
.MetaFile
, Line
=Record
[-1])
940 DepexList
.append(Module
.Guid
)
942 # get the GUID value now
943 Value
= ProtocolValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
945 Value
= PpiValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
947 Value
= GuidValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
949 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
950 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
951 "Value of [%s] is not found in" % Token
,
952 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
953 DepexList
.append(Value
)
954 for Arch
, ModuleType
in Depex
:
955 self
._Depex
[Arch
, ModuleType
] = Depex
[Arch
, ModuleType
]
958 ## Retrieve depedency expression
959 def _GetDepexExpression(self
):
960 if self
._DepexExpression
== None:
961 self
._DepexExpression
= tdict(False, 2)
962 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
963 DepexExpression
= sdict()
964 for Record
in RecordList
:
965 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
967 ModuleType
= Record
[4]
968 TokenList
= DepexStr
.split()
969 if (Arch
, ModuleType
) not in DepexExpression
:
970 DepexExpression
[Arch
, ModuleType
] = ''
971 for Token
in TokenList
:
972 DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
] + Token
.strip() + ' '
973 for Arch
, ModuleType
in DepexExpression
:
974 self
._DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
]
975 return self
._DepexExpression
977 def GetGuidsUsedByPcd(self
):
978 return self
._GuidsUsedByPcd
979 ## Retrieve PCD for given type
980 def _GetPcd(self
, Type
):
982 PcdDict
= tdict(True, 4)
984 RecordList
= self
._RawData
[Type
, self
._Arch
, self
._Platform
]
985 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, Platform
, Id
, LineNo
in RecordList
:
986 PcdDict
[Arch
, Platform
, PcdCName
, TokenSpaceGuid
] = (Setting
, LineNo
)
987 PcdList
.append((PcdCName
, TokenSpaceGuid
))
989 if TokenSpaceGuid
not in self
.Guids
:
990 Value
= GuidValue(TokenSpaceGuid
, self
.Packages
, self
.MetaFile
.Path
)
992 PackageList
= "\n\t".join([str(P
) for P
in self
.Packages
])
993 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
994 "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid
,
995 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=LineNo
)
996 self
.Guids
[TokenSpaceGuid
] = Value
997 self
._GuidsUsedByPcd
[TokenSpaceGuid
] = Value
998 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Id
]
1000 for CmtRec
in CommentRecords
:
1001 Comments
.append(CmtRec
[0])
1002 self
._PcdComments
[TokenSpaceGuid
, PcdCName
] = Comments
1004 # resolve PCD type, value, datum info, etc. by getting its definition from package
1005 for PcdCName
, TokenSpaceGuid
in PcdList
:
1006 PcdRealName
= PcdCName
1007 Setting
, LineNo
= PcdDict
[self
._Arch
, self
.Platform
, PcdCName
, TokenSpaceGuid
]
1010 ValueList
= AnalyzePcdData(Setting
)
1011 DefaultValue
= ValueList
[0]
1012 Pcd
= PcdClassObject(
1022 self
.Guids
[TokenSpaceGuid
]
1024 if Type
== MODEL_PCD_PATCHABLE_IN_MODULE
and ValueList
[1]:
1025 # Patch PCD: TokenSpace.PcdCName|Value|Offset
1026 Pcd
.Offset
= ValueList
[1]
1028 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1029 for Package
in self
.Packages
:
1030 for key
in Package
.Pcds
:
1031 if (Package
.Pcds
[key
].TokenCName
, Package
.Pcds
[key
].TokenSpaceGuidCName
) == (PcdRealName
, TokenSpaceGuid
):
1032 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1033 Pcd_Type
= item
[0].split('_')[-1]
1034 if Pcd_Type
== Package
.Pcds
[key
].Type
:
1035 Value
= Package
.Pcds
[key
]
1036 Value
.TokenCName
= Package
.Pcds
[key
].TokenCName
+ '_' + Pcd_Type
1038 newkey
= (Value
.TokenCName
, key
[1])
1040 newkey
= (Value
.TokenCName
, key
[1], key
[2])
1041 del Package
.Pcds
[key
]
1042 Package
.Pcds
[newkey
] = Value
1049 # get necessary info from package declaring this PCD
1050 for Package
in self
.Packages
:
1052 # 'dynamic' in INF means its type is determined by platform;
1053 # if platform doesn't give its type, use 'lowest' one in the
1054 # following order, if any
1056 # "FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"
1058 PcdType
= self
._PCD
_TYPE
_STRING
_[Type
]
1059 if Type
== MODEL_PCD_DYNAMIC
:
1061 for T
in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
1062 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1063 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1064 if str(item
[0]).endswith(T
) and (item
[0], item
[1], T
) in Package
.Pcds
:
1072 if (PcdRealName
, TokenSpaceGuid
, T
) in Package
.Pcds
:
1078 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1079 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1080 Pcd_Type
= item
[0].split('_')[-1]
1081 if Pcd_Type
== PcdType
:
1089 if (PcdCName
, TokenSpaceGuid
, PcdType
) in Package
.Pcds
:
1090 PcdInPackage
= Package
.Pcds
[PcdCName
, TokenSpaceGuid
, PcdType
]
1092 Pcd
.TokenValue
= PcdInPackage
.TokenValue
1095 # Check whether the token value exist or not.
1097 if Pcd
.TokenValue
== None or Pcd
.TokenValue
== "":
1101 "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid
, PcdRealName
, str(Package
)),
1102 File
=self
.MetaFile
, Line
=LineNo
,
1106 # Check hexadecimal token value length and format.
1108 ReIsValidPcdTokenValue
= re
.compile(r
"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re
.DOTALL
)
1109 if Pcd
.TokenValue
.startswith("0x") or Pcd
.TokenValue
.startswith("0X"):
1110 if ReIsValidPcdTokenValue
.match(Pcd
.TokenValue
) == None:
1114 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1115 File
=self
.MetaFile
, Line
=LineNo
,
1120 # Check decimal token value length and format.
1124 TokenValueInt
= int (Pcd
.TokenValue
, 10)
1125 if (TokenValueInt
< 0 or TokenValueInt
> 4294967295):
1129 "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
)),
1130 File
=self
.MetaFile
, Line
=LineNo
,
1137 "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
)),
1138 File
=self
.MetaFile
, Line
=LineNo
,
1142 Pcd
.DatumType
= PcdInPackage
.DatumType
1143 Pcd
.MaxDatumSize
= PcdInPackage
.MaxDatumSize
1144 Pcd
.InfDefaultValue
= Pcd
.DefaultValue
1145 if Pcd
.DefaultValue
in [None, '']:
1146 Pcd
.DefaultValue
= PcdInPackage
.DefaultValue
1152 "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid
, PcdRealName
, self
.MetaFile
),
1153 File
=self
.MetaFile
, Line
=LineNo
,
1154 ExtraData
="\t%s" % '\n\t'.join([str(P
) for P
in self
.Packages
])
1156 Pcds
[PcdCName
, TokenSpaceGuid
] = Pcd
1160 ## check whether current module is binary module
1161 def _IsBinaryModule(self
):
1162 if self
.Binaries
and not self
.Sources
:
1164 elif GlobalData
.gIgnoreSource
:
1169 _Macros
= property(_GetMacros
)
1170 Arch
= property(_GetArch
, _SetArch
)
1171 Platform
= property(_GetPlatform
, _SetPlatform
)
1173 HeaderComments
= property(_GetHeaderComments
)
1174 TailComments
= property(_GetTailComments
)
1175 AutoGenVersion
= property(_GetInfVersion
)
1176 BaseName
= property(_GetBaseName
)
1177 ModuleType
= property(_GetModuleType
)
1178 ComponentType
= property(_GetComponentType
)
1179 BuildType
= property(_GetBuildType
)
1180 Guid
= property(_GetFileGuid
)
1181 Version
= property(_GetVersion
)
1182 PcdIsDriver
= property(_GetPcdIsDriver
)
1183 Shadow
= property(_GetShadow
)
1184 CustomMakefile
= property(_GetMakefile
)
1185 Specification
= property(_GetSpec
)
1186 LibraryClass
= property(_GetLibraryClass
)
1187 ModuleEntryPointList
= property(_GetEntryPoint
)
1188 ModuleUnloadImageList
= property(_GetUnloadImage
)
1189 ConstructorList
= property(_GetConstructor
)
1190 DestructorList
= property(_GetDestructor
)
1191 Defines
= property(_GetDefines
)
1192 DxsFile
= property(_GetDxsFile
)
1194 Binaries
= property(_GetBinaryFiles
)
1195 Sources
= property(_GetSourceFiles
)
1196 LibraryClasses
= property(_GetLibraryClassUses
)
1197 Libraries
= property(_GetLibraryNames
)
1198 Protocols
= property(_GetProtocols
)
1199 ProtocolComments
= property(_GetProtocolComments
)
1200 Ppis
= property(_GetPpis
)
1201 PpiComments
= property(_GetPpiComments
)
1202 Guids
= property(_GetGuids
)
1203 GuidComments
= property(_GetGuidComments
)
1204 Includes
= property(_GetIncludes
)
1205 Packages
= property(_GetPackages
)
1206 Pcds
= property(_GetPcds
)
1207 PcdComments
= property(_GetPcdComments
)
1208 BuildOptions
= property(_GetBuildOptions
)
1209 Depex
= property(_GetDepex
)
1210 DepexExpression
= property(_GetDepexExpression
)
1211 IsBinaryModule
= property(_IsBinaryModule
)
1212 IsSupportedArch
= property(_IsSupportedArch
)