2 # This file is used to create a database used by build tool
4 # Copyright (c) 2008 - 2018, 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 __future__
import absolute_import
16 from Common
.StringUtils
import *
17 from Common
.DataType
import *
18 from Common
.Misc
import *
20 from .MetaFileParser
import *
21 from collections
import OrderedDict
23 from Workspace
.BuildClassObject
import ModuleBuildClassObject
, LibraryClassObject
, PcdClassObject
24 ## Module build information from INF file
26 # This class is used to retrieve information stored in database and convert them
27 # into ModuleBuildClassObject form for easier use for AutoGen.
29 class InfBuildData(ModuleBuildClassObject
):
30 # dict used to convert PCD type in database to string used by build tool
32 MODEL_PCD_FIXED_AT_BUILD
: TAB_PCDS_FIXED_AT_BUILD
,
33 MODEL_PCD_PATCHABLE_IN_MODULE
: TAB_PCDS_PATCHABLE_IN_MODULE
,
34 MODEL_PCD_FEATURE_FLAG
: TAB_PCDS_FEATURE_FLAG
,
35 MODEL_PCD_DYNAMIC
: TAB_PCDS_DYNAMIC
,
36 MODEL_PCD_DYNAMIC_DEFAULT
: TAB_PCDS_DYNAMIC
,
37 MODEL_PCD_DYNAMIC_HII
: TAB_PCDS_DYNAMIC_HII
,
38 MODEL_PCD_DYNAMIC_VPD
: TAB_PCDS_DYNAMIC_VPD
,
39 MODEL_PCD_DYNAMIC_EX
: TAB_PCDS_DYNAMIC_EX
,
40 MODEL_PCD_DYNAMIC_EX_DEFAULT
: TAB_PCDS_DYNAMIC_EX
,
41 MODEL_PCD_DYNAMIC_EX_HII
: TAB_PCDS_DYNAMIC_EX_HII
,
42 MODEL_PCD_DYNAMIC_EX_VPD
: TAB_PCDS_DYNAMIC_EX_VPD
,
45 # dict used to convert part of [Defines] to members of InfBuildData directly
50 TAB_INF_DEFINES_BASE_NAME
: "_BaseName",
51 TAB_INF_DEFINES_FILE_GUID
: "_Guid",
52 TAB_INF_DEFINES_MODULE_TYPE
: "_ModuleType",
56 # TAB_INF_DEFINES_INF_VERSION : "_AutoGenVersion",
57 TAB_INF_DEFINES_COMPONENT_TYPE
: "_ComponentType",
58 TAB_INF_DEFINES_MAKEFILE_NAME
: "_MakefileName",
59 # TAB_INF_DEFINES_CUSTOM_MAKEFILE : "_CustomMakefile",
60 TAB_INF_DEFINES_DPX_SOURCE
:"_DxsFile",
61 TAB_INF_DEFINES_VERSION_NUMBER
: "_Version",
62 TAB_INF_DEFINES_VERSION_STRING
: "_Version",
63 TAB_INF_DEFINES_VERSION
: "_Version",
64 TAB_INF_DEFINES_PCD_IS_DRIVER
: "_PcdIsDriver",
65 TAB_INF_DEFINES_SHADOW
: "_Shadow",
67 TAB_COMPONENTS_SOURCE_OVERRIDE_PATH
: "_SourceOverridePath",
70 # regular expression for converting XXX_FLAGS in [nmake] section to new type
71 _NMAKE_FLAG_PATTERN_
= re
.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|ARCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re
.UNICODE
)
72 # dict used to convert old tool name used in [nmake] section to new ones
75 BINARY_FILE_TYPE_LIB
: "SLINK",
80 ## Constructor of DscBuildData
82 # Initialize object of DscBuildData
84 # @param FilePath The path of platform description file
85 # @param RawData The raw data of DSC file
86 # @param BuildDataBase Database used to retrieve module/package information
87 # @param Arch The target architecture
88 # @param Platform The name of platform employing this module
89 # @param Macros Macros used for replacement in DSC file
91 def __init__(self
, FilePath
, RawData
, BuildDatabase
, Arch
=TAB_ARCH_COMMON
, Target
=None, Toolchain
=None):
92 self
.MetaFile
= FilePath
93 self
._ModuleDir
= FilePath
.Dir
94 self
._RawData
= RawData
95 self
._Bdb
= BuildDatabase
98 self
._Toolchain
= Toolchain
99 self
._Platform
= TAB_COMMON
100 self
._SourceOverridePath
= None
101 if FilePath
.Key
in GlobalData
.gOverrideDir
:
102 self
._SourceOverridePath
= GlobalData
.gOverrideDir
[FilePath
.Key
]
106 def __setitem__(self
, key
, value
):
107 self
.__dict
__[self
._PROPERTY
_[key
]] = value
110 def __getitem__(self
, key
):
111 return self
.__dict
__[self
._PROPERTY
_[key
]]
114 def __contains__(self
, key
):
115 return key
in self
._PROPERTY
_
117 ## Set all internal used members of InfBuildData to None
119 self
._HeaderComments
= None
120 self
._TailComments
= None
122 self
._AutoGenVersion
= None
123 self
._BaseName
= None
125 self
._ModuleType
= None
126 self
._ComponentType
= None
127 self
._BuildType
= None
130 self
._PcdIsDriver
= None
131 self
._BinaryModule
= None
133 self
._MakefileName
= None
134 self
._CustomMakefile
= None
135 self
._Specification
= None
136 self
._LibraryClass
= None
137 self
._ModuleEntryPointList
= None
138 self
._ModuleUnloadImageList
= None
139 self
._ConstructorList
= None
140 self
._DestructorList
= None
141 self
._Defs
= OrderedDict()
142 self
._Binaries
= None
144 self
._LibraryClasses
= None
145 self
._Libraries
= None
146 self
._Protocols
= None
147 self
._ProtocolComments
= None
149 self
._PpiComments
= None
151 self
._GuidsUsedByPcd
= OrderedDict()
152 self
._GuidComments
= None
153 self
._Includes
= None
154 self
._Packages
= None
156 self
._PcdComments
= None
157 self
._BuildOptions
= None
159 self
._DepexExpression
= None
162 ## Get current effective macros
163 def _GetMacros(self
):
164 if self
.__Macros
is None:
166 # EDK_GLOBAL defined macros can be applied to EDK module
167 if self
.AutoGenVersion
< 0x00010005:
168 self
.__Macros
.update(GlobalData
.gEdkGlobal
)
169 self
.__Macros
.update(GlobalData
.gGlobalDefines
)
176 ## Return the name of platform employing this module
177 def _GetPlatform(self
):
178 return self
._Platform
180 def _GetHeaderComments(self
):
181 if not self
._HeaderComments
:
182 self
._HeaderComments
= []
183 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER_COMMENT
]
184 for Record
in RecordList
:
185 self
._HeaderComments
.append(Record
[0])
186 return self
._HeaderComments
187 def _GetTailComments(self
):
188 if not self
._TailComments
:
189 self
._TailComments
= []
190 RecordList
= self
._RawData
[MODEL_META_DATA_TAIL_COMMENT
]
191 for Record
in RecordList
:
192 self
._TailComments
.append(Record
[0])
193 return self
._TailComments
194 ## Retrieve all information in [Defines] section
196 # (Retriving all [Defines] information in one-shot is just to save time.)
198 def _GetHeaderInfo(self
):
199 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
200 for Record
in RecordList
:
201 Name
, Value
= Record
[1], ReplaceMacro(Record
[2], self
._Macros
, False)
202 # items defined _PROPERTY_ don't need additional processing
205 self
._Defs
[Name
] = Value
206 self
._Macros
[Name
] = Value
207 # some special items in [Defines] section need special treatment
208 elif Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
209 if Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
210 Name
= 'UEFI_SPECIFICATION_VERSION'
211 if self
._Specification
is None:
212 self
._Specification
= OrderedDict()
213 self
._Specification
[Name
] = GetHexVerValue(Value
)
214 if self
._Specification
[Name
] is None:
215 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
216 "'%s' format is not supported for %s" % (Value
, Name
),
217 File
=self
.MetaFile
, Line
=Record
[-1])
218 elif Name
== 'LIBRARY_CLASS':
219 if self
._LibraryClass
is None:
220 self
._LibraryClass
= []
221 ValueList
= GetSplitValueList(Value
)
222 LibraryClass
= ValueList
[0]
223 if len(ValueList
) > 1:
224 SupModuleList
= GetSplitValueList(ValueList
[1], ' ')
226 SupModuleList
= SUP_MODULE_LIST
227 self
._LibraryClass
.append(LibraryClassObject(LibraryClass
, SupModuleList
))
228 elif Name
== 'ENTRY_POINT':
229 if self
._ModuleEntryPointList
is None:
230 self
._ModuleEntryPointList
= []
231 self
._ModuleEntryPointList
.append(Value
)
232 elif Name
== 'UNLOAD_IMAGE':
233 if self
._ModuleUnloadImageList
is None:
234 self
._ModuleUnloadImageList
= []
237 self
._ModuleUnloadImageList
.append(Value
)
238 elif Name
== 'CONSTRUCTOR':
239 if self
._ConstructorList
is None:
240 self
._ConstructorList
= []
243 self
._ConstructorList
.append(Value
)
244 elif Name
== 'DESTRUCTOR':
245 if self
._DestructorList
is None:
246 self
._DestructorList
= []
249 self
._DestructorList
.append(Value
)
250 elif Name
== TAB_INF_DEFINES_CUSTOM_MAKEFILE
:
251 TokenList
= GetSplitValueList(Value
)
252 if self
._CustomMakefile
is None:
253 self
._CustomMakefile
= {}
254 if len(TokenList
) < 2:
255 self
._CustomMakefile
[TAB_COMPILER_MSFT
] = TokenList
[0]
256 self
._CustomMakefile
['GCC'] = TokenList
[0]
258 if TokenList
[0] not in [TAB_COMPILER_MSFT
, 'GCC']:
259 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
260 "No supported family [%s]" % TokenList
[0],
261 File
=self
.MetaFile
, Line
=Record
[-1])
262 self
._CustomMakefile
[TokenList
[0]] = TokenList
[1]
264 self
._Defs
[Name
] = Value
265 self
._Macros
[Name
] = Value
268 # Retrieve information in sections specific to Edk.x modules
270 if self
.AutoGenVersion
>= 0x00010005:
271 if not self
._ModuleType
:
272 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
273 "MODULE_TYPE is not given", File
=self
.MetaFile
)
274 if self
._ModuleType
not in SUP_MODULE_LIST
:
275 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
276 for Record
in RecordList
:
278 if Name
== "MODULE_TYPE":
281 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
282 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self
._ModuleType
, ' '.join(l
for l
in SUP_MODULE_LIST
)),
283 File
=self
.MetaFile
, Line
=LineNo
)
284 if (self
._Specification
is None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
285 if self
._ModuleType
== SUP_MODULE_SMM_CORE
:
286 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
)
287 if (self
._Specification
is None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
288 if self
._ModuleType
== SUP_MODULE_MM_CORE_STANDALONE
:
289 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
)
290 if self
._ModuleType
== SUP_MODULE_MM_STANDALONE
:
291 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
)
292 if 'PCI_DEVICE_ID' in self
._Defs
and 'PCI_VENDOR_ID' in self
._Defs \
293 and 'PCI_CLASS_CODE' in self
._Defs
and 'PCI_REVISION' in self
._Defs
:
294 self
._BuildType
= 'UEFI_OPTIONROM'
295 if 'PCI_COMPRESS' in self
._Defs
:
296 if self
._Defs
['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
297 EdkLogger
.error("build", FORMAT_INVALID
, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self
.MetaFile
)
299 elif 'UEFI_HII_RESOURCE_SECTION' in self
._Defs \
300 and self
._Defs
['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
301 self
._BuildType
= 'UEFI_HII'
303 self
._BuildType
= self
._ModuleType
.upper()
306 File
= PathClass(NormPath(self
._DxsFile
), self
._ModuleDir
, Arch
=self
._Arch
)
307 # check the file validation
308 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
310 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
311 File
=self
.MetaFile
, Line
=LineNo
)
312 if self
.Sources
is None:
314 self
._Sources
.append(File
)
316 if not self
._ComponentType
:
317 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
318 "COMPONENT_TYPE is not given", File
=self
.MetaFile
)
319 self
._BuildType
= self
._ComponentType
.upper()
320 if self
._ComponentType
in COMPONENT_TO_MODULE_MAP_DICT
:
321 self
._ModuleType
= COMPONENT_TO_MODULE_MAP_DICT
[self
._ComponentType
]
322 if self
._ComponentType
== EDK_COMPONENT_TYPE_LIBRARY
:
323 self
._LibraryClass
= [LibraryClassObject(self
._BaseName
, SUP_MODULE_LIST
)]
324 # make use some [nmake] section macros
325 Macros
= self
._Macros
326 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
327 Macros
['PROCESSOR'] = self
._Arch
328 RecordList
= self
._RawData
[MODEL_META_DATA_NMAKE
, self
._Arch
, self
._Platform
]
329 for Name
, Value
, Dummy
, Arch
, Platform
, ID
, LineNo
in RecordList
:
330 Value
= ReplaceMacro(Value
, Macros
, True)
331 if Name
== "IMAGE_ENTRY_POINT":
332 if self
._ModuleEntryPointList
is None:
333 self
._ModuleEntryPointList
= []
334 self
._ModuleEntryPointList
.append(Value
)
335 elif Name
== "DPX_SOURCE":
336 File
= PathClass(NormPath(Value
), self
._ModuleDir
, Arch
=self
._Arch
)
337 # check the file validation
338 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
340 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
341 File
=self
.MetaFile
, Line
=LineNo
)
342 if self
.Sources
is None:
344 self
._Sources
.append(File
)
346 ToolList
= self
._NMAKE
_FLAG
_PATTERN
_.findall(Name
)
347 if len(ToolList
) == 1:
348 if self
._BuildOptions
is None:
349 self
._BuildOptions
= OrderedDict()
351 if ToolList
[0] in self
._TOOL
_CODE
_:
352 Tool
= self
._TOOL
_CODE
_[ToolList
[0]]
355 ToolChain
= "*_*_*_%s_FLAGS" % Tool
356 # Edk.x only support MSFT tool chain
357 # ignore not replaced macros in value
358 ValueList
= GetSplitList(' ' + Value
, '/D')
360 for Index
in range(1, len(ValueList
)):
361 if ValueList
[Index
][-1] == '=' or ValueList
[Index
] == '':
363 Dummy
= Dummy
+ ' /D ' + ValueList
[Index
]
364 Value
= Dummy
.strip()
365 if (TAB_COMPILER_MSFT
, ToolChain
) not in self
._BuildOptions
:
366 self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
] = Value
368 OptionString
= self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
]
369 self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
] = OptionString
+ " " + Value
370 # set _Header to non-None in order to avoid database re-querying
371 self
._Header
_ = 'DUMMY'
373 ## Retrieve file version
374 def _GetInfVersion(self
):
375 if self
._AutoGenVersion
is None:
376 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
377 for Record
in RecordList
:
378 if Record
[1] == TAB_INF_DEFINES_INF_VERSION
:
380 ValueList
= Record
[2].split('.')
381 Major
= '%04o' % int(ValueList
[0], 0)
382 Minor
= '%04o' % int(ValueList
[1], 0)
383 self
._AutoGenVersion
= int('0x' + Major
+ Minor
, 0)
385 self
._AutoGenVersion
= int(Record
[2], 0)
387 if self
._AutoGenVersion
is None:
388 self
._AutoGenVersion
= 0x00010000
389 return self
._AutoGenVersion
391 ## Retrieve BASE_NAME
392 def _GetBaseName(self
):
393 if self
._BaseName
is None:
394 if self
._Header
_ is None:
395 self
._GetHeaderInfo
()
396 if self
._BaseName
is None:
397 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No BASE_NAME name", File
=self
.MetaFile
)
398 return self
._BaseName
401 def _GetDxsFile(self
):
402 if self
._DxsFile
is None:
403 if self
._Header
_ is None:
404 self
._GetHeaderInfo
()
405 if self
._DxsFile
is None:
409 ## Retrieve MODULE_TYPE
410 def _GetModuleType(self
):
411 if self
._ModuleType
is None:
412 if self
._Header
_ is None:
413 self
._GetHeaderInfo
()
414 if self
._ModuleType
is None:
415 self
._ModuleType
= SUP_MODULE_BASE
416 if self
._ModuleType
not in SUP_MODULE_LIST
:
417 self
._ModuleType
= SUP_MODULE_USER_DEFINED
418 return self
._ModuleType
420 ## Retrieve COMPONENT_TYPE
421 def _GetComponentType(self
):
422 if self
._ComponentType
is None:
423 if self
._Header
_ is None:
424 self
._GetHeaderInfo
()
425 if self
._ComponentType
is None:
426 self
._ComponentType
= SUP_MODULE_USER_DEFINED
427 return self
._ComponentType
429 ## Retrieve "BUILD_TYPE"
430 def _GetBuildType(self
):
431 if self
._BuildType
is None:
432 if self
._Header
_ is None:
433 self
._GetHeaderInfo
()
434 if not self
._BuildType
:
435 self
._BuildType
= SUP_MODULE_BASE
436 return self
._BuildType
438 ## Retrieve file guid
439 def _GetFileGuid(self
):
440 if self
._Guid
is None:
441 if self
._Header
_ is None:
442 self
._GetHeaderInfo
()
443 if self
._Guid
is None:
444 self
._Guid
= '00000000-0000-0000-0000-000000000000'
447 ## Retrieve module version
448 def _GetVersion(self
):
449 if self
._Version
is None:
450 if self
._Header
_ is None:
451 self
._GetHeaderInfo
()
452 if self
._Version
is None:
453 self
._Version
= '0.0'
456 ## Retrieve PCD_IS_DRIVER
457 def _GetPcdIsDriver(self
):
458 if self
._PcdIsDriver
is None:
459 if self
._Header
_ is None:
460 self
._GetHeaderInfo
()
461 if self
._PcdIsDriver
is None:
462 self
._PcdIsDriver
= ''
463 return self
._PcdIsDriver
466 def _GetShadow(self
):
467 if self
._Shadow
is None:
468 if self
._Header
_ is None:
469 self
._GetHeaderInfo
()
470 if self
._Shadow
is not None and self
._Shadow
.upper() == 'TRUE':
476 ## Retrieve CUSTOM_MAKEFILE
477 def _GetMakefile(self
):
478 if self
._CustomMakefile
is None:
479 if self
._Header
_ is None:
480 self
._GetHeaderInfo
()
481 if self
._CustomMakefile
is None:
482 self
._CustomMakefile
= {}
483 return self
._CustomMakefile
485 ## Retrieve EFI_SPECIFICATION_VERSION
487 if self
._Specification
is None:
488 if self
._Header
_ is None:
489 self
._GetHeaderInfo
()
490 if self
._Specification
is None:
491 self
._Specification
= {}
492 return self
._Specification
494 ## Retrieve LIBRARY_CLASS
495 def _GetLibraryClass(self
):
496 if self
._LibraryClass
is None:
497 if self
._Header
_ is None:
498 self
._GetHeaderInfo
()
499 if self
._LibraryClass
is None:
500 self
._LibraryClass
= []
501 return self
._LibraryClass
503 ## Retrieve ENTRY_POINT
504 def _GetEntryPoint(self
):
505 if self
._ModuleEntryPointList
is None:
506 if self
._Header
_ is None:
507 self
._GetHeaderInfo
()
508 if self
._ModuleEntryPointList
is None:
509 self
._ModuleEntryPointList
= []
510 return self
._ModuleEntryPointList
512 ## Retrieve UNLOAD_IMAGE
513 def _GetUnloadImage(self
):
514 if self
._ModuleUnloadImageList
is None:
515 if self
._Header
_ is None:
516 self
._GetHeaderInfo
()
517 if self
._ModuleUnloadImageList
is None:
518 self
._ModuleUnloadImageList
= []
519 return self
._ModuleUnloadImageList
521 ## Retrieve CONSTRUCTOR
522 def _GetConstructor(self
):
523 if self
._ConstructorList
is None:
524 if self
._Header
_ is None:
525 self
._GetHeaderInfo
()
526 if self
._ConstructorList
is None:
527 self
._ConstructorList
= []
528 return self
._ConstructorList
530 ## Retrieve DESTRUCTOR
531 def _GetDestructor(self
):
532 if self
._DestructorList
is None:
533 if self
._Header
_ is None:
534 self
._GetHeaderInfo
()
535 if self
._DestructorList
is None:
536 self
._DestructorList
= []
537 return self
._DestructorList
539 ## Retrieve definies other than above ones
540 def _GetDefines(self
):
541 if len(self
._Defs
) == 0 and self
._Header
_ is None:
542 self
._GetHeaderInfo
()
545 ## Retrieve binary files
546 def _GetBinaries(self
):
547 if self
._Binaries
is None:
549 RecordList
= self
._RawData
[MODEL_EFI_BINARY_FILE
, self
._Arch
, self
._Platform
]
550 Macros
= self
._Macros
551 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
552 Macros
['PROCESSOR'] = self
._Arch
553 for Record
in RecordList
:
559 TokenList
= GetSplitValueList(Record
[2], TAB_VALUE_SPLIT
)
561 Target
= TokenList
[0]
562 if len(TokenList
) > 1:
563 FeatureFlag
= Record
[1:]
565 File
= PathClass(NormPath(Record
[1], Macros
), self
._ModuleDir
, '', FileType
, True, self
._Arch
, '', Target
)
566 # check the file validation
567 ErrorCode
, ErrorInfo
= File
.Validate()
569 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
570 self
._Binaries
.append(File
)
571 return self
._Binaries
573 ## Retrieve binary files with error check.
574 def _GetBinaryFiles(self
):
575 Binaries
= self
._GetBinaries
()
576 if GlobalData
.gIgnoreSource
and Binaries
== []:
577 ErrorInfo
= "The INF file does not contain any Binaries to use in creating the image\n"
578 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
)
581 ## Check whether it exists the binaries with current ARCH in AsBuild INF
582 def _IsSupportedArch(self
):
583 if self
._GetBinaries
() and not self
._GetSourceFiles
():
587 ## Retrieve source files
588 def _GetSourceFiles(self
):
589 # Ignore all source files in a binary build mode
590 if GlobalData
.gIgnoreSource
:
594 if self
._Sources
is None:
596 RecordList
= self
._RawData
[MODEL_EFI_SOURCE_FILE
, self
._Arch
, self
._Platform
]
597 Macros
= self
._Macros
598 for Record
in RecordList
:
600 ToolChainFamily
= Record
[1]
603 FeatureFlag
= Record
[4]
604 if self
.AutoGenVersion
< 0x00010005:
605 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
606 Macros
['PROCESSOR'] = self
._Arch
607 SourceFile
= NormPath(Record
[0], Macros
)
608 if SourceFile
[0] == os
.path
.sep
:
609 SourceFile
= mws
.join(GlobalData
.gWorkspace
, SourceFile
[1:])
610 # old module source files (Edk)
611 File
= PathClass(SourceFile
, self
._ModuleDir
, self
._SourceOverridePath
,
612 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
613 # check the file validation
614 ErrorCode
, ErrorInfo
= File
.Validate(CaseSensitive
=False)
616 if File
.Ext
.lower() == '.h':
617 EdkLogger
.warn('build', 'Include file not found', ExtraData
=ErrorInfo
,
618 File
=self
.MetaFile
, Line
=LineNo
)
621 EdkLogger
.error('build', ErrorCode
, ExtraData
=File
, File
=self
.MetaFile
, Line
=LineNo
)
623 File
= PathClass(NormPath(Record
[0], Macros
), self
._ModuleDir
, '',
624 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
625 # check the file validation
626 ErrorCode
, ErrorInfo
= File
.Validate()
628 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
630 self
._Sources
.append(File
)
633 ## Retrieve library classes employed by this module
634 def _GetLibraryClassUses(self
):
635 if self
._LibraryClasses
is None:
636 self
._LibraryClasses
= OrderedDict()
637 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, self
._Platform
]
638 for Record
in RecordList
:
642 Instance
= NormPath(Instance
, self
._Macros
)
643 self
._LibraryClasses
[Lib
] = Instance
644 return self
._LibraryClasses
646 ## Retrieve library names (for Edk.x style of modules)
647 def _GetLibraryNames(self
):
648 if self
._Libraries
is None:
650 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_INSTANCE
, self
._Arch
, self
._Platform
]
651 for Record
in RecordList
:
652 LibraryName
= ReplaceMacro(Record
[0], self
._Macros
, False)
653 # in case of name with '.lib' extension, which is unusual in Edk.x inf
654 LibraryName
= os
.path
.splitext(LibraryName
)[0]
655 if LibraryName
not in self
._Libraries
:
656 self
._Libraries
.append(LibraryName
)
657 return self
._Libraries
659 def _GetProtocolComments(self
):
661 return self
._ProtocolComments
662 ## Retrieve protocols consumed/produced by this module
663 def _GetProtocols(self
):
664 if self
._Protocols
is None:
665 self
._Protocols
= OrderedDict()
666 self
._ProtocolComments
= OrderedDict()
667 RecordList
= self
._RawData
[MODEL_EFI_PROTOCOL
, self
._Arch
, self
._Platform
]
668 for Record
in RecordList
:
670 Value
= ProtocolValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
672 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
673 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
674 "Value of Protocol [%s] is not found under [Protocols] section in" % CName
,
675 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
676 self
._Protocols
[CName
] = Value
677 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
679 for CmtRec
in CommentRecords
:
680 Comments
.append(CmtRec
[0])
681 self
._ProtocolComments
[CName
] = Comments
682 return self
._Protocols
684 def _GetPpiComments(self
):
686 return self
._PpiComments
687 ## Retrieve PPIs consumed/produced by this module
689 if self
._Ppis
is None:
690 self
._Ppis
= OrderedDict()
691 self
._PpiComments
= OrderedDict()
692 RecordList
= self
._RawData
[MODEL_EFI_PPI
, self
._Arch
, self
._Platform
]
693 for Record
in RecordList
:
695 Value
= PpiValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
697 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
698 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
699 "Value of PPI [%s] is not found under [Ppis] section in " % CName
,
700 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
701 self
._Ppis
[CName
] = Value
702 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
704 for CmtRec
in CommentRecords
:
705 Comments
.append(CmtRec
[0])
706 self
._PpiComments
[CName
] = Comments
709 def _GetGuidComments(self
):
711 return self
._GuidComments
712 ## Retrieve GUIDs consumed/produced by this module
714 if self
._Guids
is None:
715 self
._Guids
= OrderedDict()
716 self
._GuidComments
= OrderedDict()
717 RecordList
= self
._RawData
[MODEL_EFI_GUID
, self
._Arch
, self
._Platform
]
718 for Record
in RecordList
:
720 Value
= GuidValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
722 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
723 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
724 "Value of Guid [%s] is not found under [Guids] section in" % CName
,
725 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
726 self
._Guids
[CName
] = Value
727 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
729 for CmtRec
in CommentRecords
:
730 Comments
.append(CmtRec
[0])
731 self
._GuidComments
[CName
] = Comments
734 ## Retrieve include paths necessary for this module (for Edk.x style of modules)
735 def _GetIncludes(self
):
736 if self
._Includes
is None:
738 if self
._SourceOverridePath
:
739 self
._Includes
.append(self
._SourceOverridePath
)
741 Macros
= self
._Macros
742 Macros
['PROCESSOR'] = GlobalData
.gEdkGlobal
.get('PROCESSOR', self
._Arch
)
743 RecordList
= self
._RawData
[MODEL_EFI_INCLUDE
, self
._Arch
, self
._Platform
]
744 for Record
in RecordList
:
745 if Record
[0].find('EDK_SOURCE') > -1:
746 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
747 File
= NormPath(Record
[0], self
._Macros
)
749 File
= os
.path
.join(self
._ModuleDir
, File
)
751 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
752 File
= RealPath(os
.path
.normpath(File
))
754 self
._Includes
.append(File
)
756 # TRICK: let compiler to choose correct header file
757 Macros
['EDK_SOURCE'] = GlobalData
.gEdkSource
758 File
= NormPath(Record
[0], self
._Macros
)
760 File
= os
.path
.join(self
._ModuleDir
, File
)
762 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
763 File
= RealPath(os
.path
.normpath(File
))
765 self
._Includes
.append(File
)
767 File
= NormPath(Record
[0], Macros
)
769 File
= os
.path
.join(self
._ModuleDir
, File
)
771 File
= mws
.join(GlobalData
.gWorkspace
, File
)
772 File
= RealPath(os
.path
.normpath(File
))
774 self
._Includes
.append(File
)
775 if not File
and Record
[0].find('EFI_SOURCE') > -1:
776 # tricky to regard WorkSpace as EFI_SOURCE
777 Macros
['EFI_SOURCE'] = GlobalData
.gWorkspace
778 File
= NormPath(Record
[0], Macros
)
780 File
= os
.path
.join(self
._ModuleDir
, File
)
782 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
783 File
= RealPath(os
.path
.normpath(File
))
785 self
._Includes
.append(File
)
786 return self
._Includes
788 ## Retrieve packages this module depends on
789 def _GetPackages(self
):
790 if self
._Packages
is None:
792 RecordList
= self
._RawData
[MODEL_META_DATA_PACKAGE
, self
._Arch
, self
._Platform
]
793 Macros
= self
._Macros
794 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
795 for Record
in RecordList
:
796 File
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
798 # check the file validation
799 ErrorCode
, ErrorInfo
= File
.Validate('.dec')
801 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
802 # parse this package now. we need it to get protocol/ppi/guid value
803 Package
= self
._Bdb
[File
, self
._Arch
, self
._Target
, self
._Toolchain
]
804 self
._Packages
.append(Package
)
805 return self
._Packages
807 ## Retrieve PCD comments
808 def _GetPcdComments(self
):
810 return self
._PcdComments
811 ## Retrieve PCDs used in this module
813 if self
._Pcds
is None:
814 self
._Pcds
= OrderedDict()
815 self
._PcdComments
= OrderedDict()
816 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FIXED_AT_BUILD
))
817 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_PATCHABLE_IN_MODULE
))
818 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FEATURE_FLAG
))
819 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC
))
820 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC_EX
))
823 ## Retrieve build options specific to this module
824 def _GetBuildOptions(self
):
825 if self
._BuildOptions
is None:
826 self
._BuildOptions
= OrderedDict()
827 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, self
._Platform
]
828 for Record
in RecordList
:
829 ToolChainFamily
= Record
[0]
830 ToolChain
= Record
[1]
832 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
or Option
.startswith('='):
833 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Option
835 # concatenate the option string if they're for the same tool
836 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
837 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Option
838 return self
._BuildOptions
840 ## Retrieve dependency expression
842 if self
._Depex
is None:
843 self
._Depex
= tdict(False, 2)
844 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
846 # If the module has only Binaries and no Sources, then ignore [Depex]
847 if self
.Sources
is None or self
.Sources
== []:
848 if self
.Binaries
is not None and self
.Binaries
!= []:
851 # PEIM and DXE drivers must have a valid [Depex] section
852 if len(self
.LibraryClass
) == 0 and len(RecordList
) == 0:
853 if self
.ModuleType
== SUP_MODULE_DXE_DRIVER
or self
.ModuleType
== SUP_MODULE_PEIM
or self
.ModuleType
== SUP_MODULE_DXE_SMM_DRIVER
or \
854 self
.ModuleType
== SUP_MODULE_DXE_SAL_DRIVER
or self
.ModuleType
== SUP_MODULE_DXE_RUNTIME_DRIVER
:
855 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
856 % self
.ModuleType
, File
=self
.MetaFile
)
858 if len(RecordList
) != 0 and self
.ModuleType
== SUP_MODULE_USER_DEFINED
:
859 for Record
in RecordList
:
860 if Record
[4] not in [SUP_MODULE_PEIM
, SUP_MODULE_DXE_DRIVER
, SUP_MODULE_DXE_SMM_DRIVER
]:
861 EdkLogger
.error('build', FORMAT_INVALID
,
862 "'%s' module must specify the type of [Depex] section" % self
.ModuleType
,
865 Depex
= OrderedDict()
866 for Record
in RecordList
:
867 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
869 ModuleType
= Record
[4]
870 TokenList
= DepexStr
.split()
871 if (Arch
, ModuleType
) not in Depex
:
872 Depex
[Arch
, ModuleType
] = []
873 DepexList
= Depex
[Arch
, ModuleType
]
874 for Token
in TokenList
:
875 if Token
in DEPEX_SUPPORTED_OPCODE_SET
:
876 DepexList
.append(Token
)
877 elif Token
.endswith(".inf"): # module file name
878 ModuleFile
= os
.path
.normpath(Token
)
879 Module
= self
.BuildDatabase
[ModuleFile
]
881 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "Module is not found in active platform",
882 ExtraData
=Token
, File
=self
.MetaFile
, Line
=Record
[-1])
883 DepexList
.append(Module
.Guid
)
885 # it use the Fixed PCD format
887 if tuple(Token
.split('.')[::-1]) not in self
.Pcds
:
888 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "PCD [{}] used in [Depex] section should be listed in module PCD section".format(Token
), File
=self
.MetaFile
, Line
=Record
[-1])
890 if self
.Pcds
[tuple(Token
.split('.')[::-1])].DatumType
!= TAB_VOID
:
891 EdkLogger
.error('build', FORMAT_INVALID
, "PCD [{}] used in [Depex] section should be VOID* datum type".format(Token
), File
=self
.MetaFile
, Line
=Record
[-1])
894 # get the GUID value now
895 Value
= ProtocolValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
897 Value
= PpiValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
899 Value
= GuidValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
902 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
903 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
904 "Value of [%s] is not found in" % Token
,
905 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
906 DepexList
.append(Value
)
907 for Arch
, ModuleType
in Depex
:
908 self
._Depex
[Arch
, ModuleType
] = Depex
[Arch
, ModuleType
]
911 ## Retrieve depedency expression
912 def _GetDepexExpression(self
):
913 if self
._DepexExpression
is None:
914 self
._DepexExpression
= tdict(False, 2)
915 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
916 DepexExpression
= OrderedDict()
917 for Record
in RecordList
:
918 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
920 ModuleType
= Record
[4]
921 TokenList
= DepexStr
.split()
922 if (Arch
, ModuleType
) not in DepexExpression
:
923 DepexExpression
[Arch
, ModuleType
] = ''
924 for Token
in TokenList
:
925 DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
] + Token
.strip() + ' '
926 for Arch
, ModuleType
in DepexExpression
:
927 self
._DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
]
928 return self
._DepexExpression
930 def GetGuidsUsedByPcd(self
):
931 return self
._GuidsUsedByPcd
932 ## Retrieve PCD for given type
933 def _GetPcd(self
, Type
):
935 PcdDict
= tdict(True, 4)
937 RecordList
= self
._RawData
[Type
, self
._Arch
, self
._Platform
]
938 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, Platform
, Id
, LineNo
in RecordList
:
939 PcdDict
[Arch
, Platform
, PcdCName
, TokenSpaceGuid
] = (Setting
, LineNo
)
940 PcdList
.append((PcdCName
, TokenSpaceGuid
))
942 if TokenSpaceGuid
not in self
.Guids
:
943 Value
= GuidValue(TokenSpaceGuid
, self
.Packages
, self
.MetaFile
.Path
)
945 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
946 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
947 "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid
,
948 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=LineNo
)
949 self
.Guids
[TokenSpaceGuid
] = Value
950 self
._GuidsUsedByPcd
[TokenSpaceGuid
] = Value
951 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Id
]
953 for CmtRec
in CommentRecords
:
954 Comments
.append(CmtRec
[0])
955 self
._PcdComments
[TokenSpaceGuid
, PcdCName
] = Comments
957 # resolve PCD type, value, datum info, etc. by getting its definition from package
958 _GuidDict
= self
.Guids
.copy()
959 for PcdCName
, TokenSpaceGuid
in PcdList
:
960 PcdRealName
= PcdCName
961 Setting
, LineNo
= PcdDict
[self
._Arch
, self
.Platform
, PcdCName
, TokenSpaceGuid
]
964 ValueList
= AnalyzePcdData(Setting
)
965 DefaultValue
= ValueList
[0]
966 Pcd
= PcdClassObject(
976 self
.Guids
[TokenSpaceGuid
]
978 if Type
== MODEL_PCD_PATCHABLE_IN_MODULE
and ValueList
[1]:
979 # Patch PCD: TokenSpace.PcdCName|Value|Offset
980 Pcd
.Offset
= ValueList
[1]
982 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
983 for Package
in self
.Packages
:
984 for key
in Package
.Pcds
:
985 if (Package
.Pcds
[key
].TokenCName
, Package
.Pcds
[key
].TokenSpaceGuidCName
) == (PcdRealName
, TokenSpaceGuid
):
986 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
987 Pcd_Type
= item
[0].split('_')[-1]
988 if Pcd_Type
== Package
.Pcds
[key
].Type
:
989 Value
= Package
.Pcds
[key
]
990 Value
.TokenCName
= Package
.Pcds
[key
].TokenCName
+ '_' + Pcd_Type
992 newkey
= (Value
.TokenCName
, key
[1])
994 newkey
= (Value
.TokenCName
, key
[1], key
[2])
995 del Package
.Pcds
[key
]
996 Package
.Pcds
[newkey
] = Value
1003 # get necessary info from package declaring this PCD
1004 for Package
in self
.Packages
:
1006 # 'dynamic' in INF means its type is determined by platform;
1007 # if platform doesn't give its type, use 'lowest' one in the
1008 # following order, if any
1010 # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
1012 _GuidDict
.update(Package
.Guids
)
1013 PcdType
= self
._PCD
_TYPE
_STRING
_[Type
]
1014 if Type
== MODEL_PCD_DYNAMIC
:
1016 for T
in PCD_TYPE_LIST
:
1017 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1018 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1019 if str(item
[0]).endswith(T
) and (item
[0], item
[1], T
) in Package
.Pcds
:
1027 if (PcdRealName
, TokenSpaceGuid
, T
) in Package
.Pcds
:
1033 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1034 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1035 Pcd_Type
= item
[0].split('_')[-1]
1036 if Pcd_Type
== PcdType
:
1044 if (PcdCName
, TokenSpaceGuid
, PcdType
) in Package
.Pcds
:
1045 PcdInPackage
= Package
.Pcds
[PcdCName
, TokenSpaceGuid
, PcdType
]
1047 Pcd
.TokenValue
= PcdInPackage
.TokenValue
1050 # Check whether the token value exist or not.
1052 if Pcd
.TokenValue
is None or Pcd
.TokenValue
== "":
1056 "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid
, PcdRealName
, str(Package
)),
1057 File
=self
.MetaFile
, Line
=LineNo
,
1061 # Check hexadecimal token value length and format.
1063 ReIsValidPcdTokenValue
= re
.compile(r
"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re
.DOTALL
)
1064 if Pcd
.TokenValue
.startswith("0x") or Pcd
.TokenValue
.startswith("0X"):
1065 if ReIsValidPcdTokenValue
.match(Pcd
.TokenValue
) is None:
1069 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1070 File
=self
.MetaFile
, Line
=LineNo
,
1075 # Check decimal token value length and format.
1079 TokenValueInt
= int (Pcd
.TokenValue
, 10)
1080 if (TokenValueInt
< 0 or TokenValueInt
> 4294967295):
1084 "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
)),
1085 File
=self
.MetaFile
, Line
=LineNo
,
1092 "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
)),
1093 File
=self
.MetaFile
, Line
=LineNo
,
1097 Pcd
.DatumType
= PcdInPackage
.DatumType
1098 Pcd
.MaxDatumSize
= PcdInPackage
.MaxDatumSize
1099 Pcd
.InfDefaultValue
= Pcd
.DefaultValue
1100 if not Pcd
.DefaultValue
:
1101 Pcd
.DefaultValue
= PcdInPackage
.DefaultValue
1104 Pcd
.DefaultValue
= ValueExpressionEx(Pcd
.DefaultValue
, Pcd
.DatumType
, _GuidDict
)(True)
1105 except BadExpression
as Value
:
1106 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid
, PcdRealName
, Pcd
.DefaultValue
, Value
),
1107 File
=self
.MetaFile
, Line
=LineNo
)
1113 "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid
, PcdRealName
, self
.MetaFile
),
1114 File
=self
.MetaFile
, Line
=LineNo
,
1115 ExtraData
="\t%s" % '\n\t'.join(str(P
) for P
in self
.Packages
)
1117 Pcds
[PcdCName
, TokenSpaceGuid
] = Pcd
1121 ## check whether current module is binary module
1122 def _IsBinaryModule(self
):
1123 if self
.Binaries
and not self
.Sources
:
1125 elif GlobalData
.gIgnoreSource
:
1130 _Macros
= property(_GetMacros
)
1131 Arch
= property(_GetArch
)
1132 Platform
= property(_GetPlatform
)
1134 HeaderComments
= property(_GetHeaderComments
)
1135 TailComments
= property(_GetTailComments
)
1136 AutoGenVersion
= property(_GetInfVersion
)
1137 BaseName
= property(_GetBaseName
)
1138 ModuleType
= property(_GetModuleType
)
1139 ComponentType
= property(_GetComponentType
)
1140 BuildType
= property(_GetBuildType
)
1141 Guid
= property(_GetFileGuid
)
1142 Version
= property(_GetVersion
)
1143 PcdIsDriver
= property(_GetPcdIsDriver
)
1144 Shadow
= property(_GetShadow
)
1145 CustomMakefile
= property(_GetMakefile
)
1146 Specification
= property(_GetSpec
)
1147 LibraryClass
= property(_GetLibraryClass
)
1148 ModuleEntryPointList
= property(_GetEntryPoint
)
1149 ModuleUnloadImageList
= property(_GetUnloadImage
)
1150 ConstructorList
= property(_GetConstructor
)
1151 DestructorList
= property(_GetDestructor
)
1152 Defines
= property(_GetDefines
)
1153 DxsFile
= property(_GetDxsFile
)
1155 Binaries
= property(_GetBinaryFiles
)
1156 Sources
= property(_GetSourceFiles
)
1157 LibraryClasses
= property(_GetLibraryClassUses
)
1158 Libraries
= property(_GetLibraryNames
)
1159 Protocols
= property(_GetProtocols
)
1160 ProtocolComments
= property(_GetProtocolComments
)
1161 Ppis
= property(_GetPpis
)
1162 PpiComments
= property(_GetPpiComments
)
1163 Guids
= property(_GetGuids
)
1164 GuidComments
= property(_GetGuidComments
)
1165 Includes
= property(_GetIncludes
)
1166 Packages
= property(_GetPackages
)
1167 Pcds
= property(_GetPcds
)
1168 PcdComments
= property(_GetPcdComments
)
1169 BuildOptions
= property(_GetBuildOptions
)
1170 Depex
= property(_GetDepex
)
1171 DepexExpression
= property(_GetDepexExpression
)
1172 IsBinaryModule
= property(_IsBinaryModule
)
1173 IsSupportedArch
= property(_IsSupportedArch
)