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
160 self
._MacroDict
= None
162 ## Get current effective macros
165 if self
._MacroDict
is None:
167 # EDK_GLOBAL defined macros can be applied to EDK module
168 if self
.AutoGenVersion
< 0x00010005:
169 self
._MacroDict
.update(GlobalData
.gEdkGlobal
)
170 self
._MacroDict
.update(GlobalData
.gGlobalDefines
)
171 return self
._MacroDict
178 ## Return the name of platform employing this module
181 return self
._Platform
185 def HeaderComments(self
):
186 if not self
._HeaderComments
:
187 self
._HeaderComments
= [a
[0] for a
in self
._RawData
[MODEL_META_DATA_HEADER_COMMENT
]]
188 return self
._HeaderComments
191 def TailComments(self
):
192 if not self
._TailComments
:
193 self
._TailComments
= [a
[0] for a
in self
._RawData
[MODEL_META_DATA_TAIL_COMMENT
]]
194 return self
._TailComments
196 ## Retrieve all information in [Defines] section
198 # (Retriving all [Defines] information in one-shot is just to save time.)
200 def _GetHeaderInfo(self
):
201 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
202 for Record
in RecordList
:
203 Name
, Value
= Record
[1], ReplaceMacro(Record
[2], self
._Macros
, False)
204 # items defined _PROPERTY_ don't need additional processing
207 self
._Defs
[Name
] = Value
208 self
._Macros
[Name
] = Value
209 # some special items in [Defines] section need special treatment
210 elif Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION', 'EDK_RELEASE_VERSION', 'PI_SPECIFICATION_VERSION'):
211 if Name
in ('EFI_SPECIFICATION_VERSION', 'UEFI_SPECIFICATION_VERSION'):
212 Name
= 'UEFI_SPECIFICATION_VERSION'
213 if self
._Specification
is None:
214 self
._Specification
= OrderedDict()
215 self
._Specification
[Name
] = GetHexVerValue(Value
)
216 if self
._Specification
[Name
] is None:
217 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
218 "'%s' format is not supported for %s" % (Value
, Name
),
219 File
=self
.MetaFile
, Line
=Record
[-1])
220 elif Name
== 'LIBRARY_CLASS':
221 if self
._LibraryClass
is None:
222 self
._LibraryClass
= []
223 ValueList
= GetSplitValueList(Value
)
224 LibraryClass
= ValueList
[0]
225 if len(ValueList
) > 1:
226 SupModuleList
= GetSplitValueList(ValueList
[1], ' ')
228 SupModuleList
= SUP_MODULE_LIST
229 self
._LibraryClass
.append(LibraryClassObject(LibraryClass
, SupModuleList
))
230 elif Name
== 'ENTRY_POINT':
231 if self
._ModuleEntryPointList
is None:
232 self
._ModuleEntryPointList
= []
233 self
._ModuleEntryPointList
.append(Value
)
234 elif Name
== 'UNLOAD_IMAGE':
235 if self
._ModuleUnloadImageList
is None:
236 self
._ModuleUnloadImageList
= []
239 self
._ModuleUnloadImageList
.append(Value
)
240 elif Name
== 'CONSTRUCTOR':
241 if self
._ConstructorList
is None:
242 self
._ConstructorList
= []
245 self
._ConstructorList
.append(Value
)
246 elif Name
== 'DESTRUCTOR':
247 if self
._DestructorList
is None:
248 self
._DestructorList
= []
251 self
._DestructorList
.append(Value
)
252 elif Name
== TAB_INF_DEFINES_CUSTOM_MAKEFILE
:
253 TokenList
= GetSplitValueList(Value
)
254 if self
._CustomMakefile
is None:
255 self
._CustomMakefile
= {}
256 if len(TokenList
) < 2:
257 self
._CustomMakefile
[TAB_COMPILER_MSFT
] = TokenList
[0]
258 self
._CustomMakefile
['GCC'] = TokenList
[0]
260 if TokenList
[0] not in [TAB_COMPILER_MSFT
, 'GCC']:
261 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
262 "No supported family [%s]" % TokenList
[0],
263 File
=self
.MetaFile
, Line
=Record
[-1])
264 self
._CustomMakefile
[TokenList
[0]] = TokenList
[1]
266 self
._Defs
[Name
] = Value
267 self
._Macros
[Name
] = Value
270 # Retrieve information in sections specific to Edk.x modules
272 if self
.AutoGenVersion
>= 0x00010005:
273 if not self
._ModuleType
:
274 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
275 "MODULE_TYPE is not given", File
=self
.MetaFile
)
276 if self
._ModuleType
not in SUP_MODULE_LIST
:
277 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
278 for Record
in RecordList
:
280 if Name
== "MODULE_TYPE":
283 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
,
284 "MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self
._ModuleType
, ' '.join(l
for l
in SUP_MODULE_LIST
)),
285 File
=self
.MetaFile
, Line
=LineNo
)
286 if (self
._Specification
is None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
287 if self
._ModuleType
== SUP_MODULE_SMM_CORE
:
288 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
)
289 if (self
._Specification
is None) or (not 'PI_SPECIFICATION_VERSION' in self
._Specification
) or (int(self
._Specification
['PI_SPECIFICATION_VERSION'], 16) < 0x00010032):
290 if self
._ModuleType
== SUP_MODULE_MM_CORE_STANDALONE
:
291 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
)
292 if self
._ModuleType
== SUP_MODULE_MM_STANDALONE
:
293 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
)
294 if 'PCI_DEVICE_ID' in self
._Defs
and 'PCI_VENDOR_ID' in self
._Defs \
295 and 'PCI_CLASS_CODE' in self
._Defs
and 'PCI_REVISION' in self
._Defs
:
296 self
._BuildType
= 'UEFI_OPTIONROM'
297 if 'PCI_COMPRESS' in self
._Defs
:
298 if self
._Defs
['PCI_COMPRESS'] not in ('TRUE', 'FALSE'):
299 EdkLogger
.error("build", FORMAT_INVALID
, "Expected TRUE/FALSE for PCI_COMPRESS: %s" % self
.MetaFile
)
301 elif 'UEFI_HII_RESOURCE_SECTION' in self
._Defs \
302 and self
._Defs
['UEFI_HII_RESOURCE_SECTION'] == 'TRUE':
303 self
._BuildType
= 'UEFI_HII'
305 self
._BuildType
= self
._ModuleType
.upper()
308 File
= PathClass(NormPath(self
._DxsFile
), self
._ModuleDir
, Arch
=self
._Arch
)
309 # check the file validation
310 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
312 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
313 File
=self
.MetaFile
, Line
=LineNo
)
314 if self
.Sources
is None:
316 self
._Sources
.append(File
)
318 if not self
._ComponentType
:
319 EdkLogger
.error("build", ATTRIBUTE_NOT_AVAILABLE
,
320 "COMPONENT_TYPE is not given", File
=self
.MetaFile
)
321 self
._BuildType
= self
._ComponentType
.upper()
322 if self
._ComponentType
in COMPONENT_TO_MODULE_MAP_DICT
:
323 self
._ModuleType
= COMPONENT_TO_MODULE_MAP_DICT
[self
._ComponentType
]
324 if self
._ComponentType
== EDK_COMPONENT_TYPE_LIBRARY
:
325 self
._LibraryClass
= [LibraryClassObject(self
._BaseName
, SUP_MODULE_LIST
)]
326 # make use some [nmake] section macros
327 Macros
= self
._Macros
328 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
329 Macros
['PROCESSOR'] = self
._Arch
330 RecordList
= self
._RawData
[MODEL_META_DATA_NMAKE
, self
._Arch
, self
._Platform
]
331 for Name
, Value
, Dummy
, Arch
, Platform
, ID
, LineNo
in RecordList
:
332 Value
= ReplaceMacro(Value
, Macros
, True)
333 if Name
== "IMAGE_ENTRY_POINT":
334 if self
._ModuleEntryPointList
is None:
335 self
._ModuleEntryPointList
= []
336 self
._ModuleEntryPointList
.append(Value
)
337 elif Name
== "DPX_SOURCE":
338 File
= PathClass(NormPath(Value
), self
._ModuleDir
, Arch
=self
._Arch
)
339 # check the file validation
340 ErrorCode
, ErrorInfo
= File
.Validate(".dxs", CaseSensitive
=False)
342 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
,
343 File
=self
.MetaFile
, Line
=LineNo
)
344 if self
.Sources
is None:
346 self
._Sources
.append(File
)
348 ToolList
= self
._NMAKE
_FLAG
_PATTERN
_.findall(Name
)
349 if len(ToolList
) == 1:
350 if self
._BuildOptions
is None:
351 self
._BuildOptions
= OrderedDict()
353 if ToolList
[0] in self
._TOOL
_CODE
_:
354 Tool
= self
._TOOL
_CODE
_[ToolList
[0]]
357 ToolChain
= "*_*_*_%s_FLAGS" % Tool
358 # Edk.x only support MSFT tool chain
359 # ignore not replaced macros in value
360 ValueList
= GetSplitList(' ' + Value
, '/D')
362 for Index
in range(1, len(ValueList
)):
363 if ValueList
[Index
][-1] == '=' or ValueList
[Index
] == '':
365 Dummy
= Dummy
+ ' /D ' + ValueList
[Index
]
366 Value
= Dummy
.strip()
367 if (TAB_COMPILER_MSFT
, ToolChain
) not in self
._BuildOptions
:
368 self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
] = Value
370 OptionString
= self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
]
371 self
._BuildOptions
[TAB_COMPILER_MSFT
, ToolChain
] = OptionString
+ " " + Value
372 # set _Header to non-None in order to avoid database re-querying
373 self
._Header
_ = 'DUMMY'
375 ## Retrieve file version
377 def AutoGenVersion(self
):
378 if self
._AutoGenVersion
is None:
379 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, self
._Platform
]
380 for Record
in RecordList
:
381 if Record
[1] == TAB_INF_DEFINES_INF_VERSION
:
383 ValueList
= Record
[2].split('.')
384 Major
= '%04o' % int(ValueList
[0], 0)
385 Minor
= '%04o' % int(ValueList
[1], 0)
386 self
._AutoGenVersion
= int('0x' + Major
+ Minor
, 0)
388 self
._AutoGenVersion
= int(Record
[2], 0)
390 if self
._AutoGenVersion
is None:
391 self
._AutoGenVersion
= 0x00010000
392 return self
._AutoGenVersion
394 ## Retrieve BASE_NAME
397 if self
._BaseName
is None:
398 if self
._Header
_ is None:
399 self
._GetHeaderInfo
()
400 if self
._BaseName
is None:
401 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No BASE_NAME name", File
=self
.MetaFile
)
402 return self
._BaseName
407 if self
._DxsFile
is None:
408 if self
._Header
_ is None:
409 self
._GetHeaderInfo
()
410 if self
._DxsFile
is None:
414 ## Retrieve MODULE_TYPE
416 def ModuleType(self
):
417 if self
._ModuleType
is None:
418 if self
._Header
_ is None:
419 self
._GetHeaderInfo
()
420 if self
._ModuleType
is None:
421 self
._ModuleType
= SUP_MODULE_BASE
422 if self
._ModuleType
not in SUP_MODULE_LIST
:
423 self
._ModuleType
= SUP_MODULE_USER_DEFINED
424 return self
._ModuleType
426 ## Retrieve COMPONENT_TYPE
428 def ComponentType(self
):
429 if self
._ComponentType
is None:
430 if self
._Header
_ is None:
431 self
._GetHeaderInfo
()
432 if self
._ComponentType
is None:
433 self
._ComponentType
= SUP_MODULE_USER_DEFINED
434 return self
._ComponentType
436 ## Retrieve "BUILD_TYPE"
439 if self
._BuildType
is None:
440 if self
._Header
_ is None:
441 self
._GetHeaderInfo
()
442 if not self
._BuildType
:
443 self
._BuildType
= SUP_MODULE_BASE
444 return self
._BuildType
446 ## Retrieve file guid
449 if self
._Guid
is None:
450 if self
._Header
_ is None:
451 self
._GetHeaderInfo
()
452 if self
._Guid
is None:
453 self
._Guid
= '00000000-0000-0000-0000-000000000000'
456 ## Retrieve module version
459 if self
._Version
is None:
460 if self
._Header
_ is None:
461 self
._GetHeaderInfo
()
462 if self
._Version
is None:
463 self
._Version
= '0.0'
466 ## Retrieve PCD_IS_DRIVER
468 def PcdIsDriver(self
):
469 if self
._PcdIsDriver
is None:
470 if self
._Header
_ is None:
471 self
._GetHeaderInfo
()
472 if self
._PcdIsDriver
is None:
473 self
._PcdIsDriver
= ''
474 return self
._PcdIsDriver
479 if self
._Shadow
is None:
480 if self
._Header
_ is None:
481 self
._GetHeaderInfo
()
482 if self
._Shadow
is not None and self
._Shadow
.upper() == 'TRUE':
488 ## Retrieve CUSTOM_MAKEFILE
490 def CustomMakefile(self
):
491 if self
._CustomMakefile
is None:
492 if self
._Header
_ is None:
493 self
._GetHeaderInfo
()
494 if self
._CustomMakefile
is None:
495 self
._CustomMakefile
= {}
496 return self
._CustomMakefile
498 ## Retrieve EFI_SPECIFICATION_VERSION
500 def Specification(self
):
501 if self
._Specification
is None:
502 if self
._Header
_ is None:
503 self
._GetHeaderInfo
()
504 if self
._Specification
is None:
505 self
._Specification
= {}
506 return self
._Specification
508 ## Retrieve LIBRARY_CLASS
510 def LibraryClass(self
):
511 if self
._LibraryClass
is None:
512 if self
._Header
_ is None:
513 self
._GetHeaderInfo
()
514 if self
._LibraryClass
is None:
515 self
._LibraryClass
= []
516 return self
._LibraryClass
518 ## Retrieve ENTRY_POINT
520 def ModuleEntryPointList(self
):
521 if self
._ModuleEntryPointList
is None:
522 if self
._Header
_ is None:
523 self
._GetHeaderInfo
()
524 if self
._ModuleEntryPointList
is None:
525 self
._ModuleEntryPointList
= []
526 return self
._ModuleEntryPointList
528 ## Retrieve UNLOAD_IMAGE
530 def ModuleUnloadImageList(self
):
531 if self
._ModuleUnloadImageList
is None:
532 if self
._Header
_ is None:
533 self
._GetHeaderInfo
()
534 if self
._ModuleUnloadImageList
is None:
535 self
._ModuleUnloadImageList
= []
536 return self
._ModuleUnloadImageList
538 ## Retrieve CONSTRUCTOR
540 def ConstructorList(self
):
541 if self
._ConstructorList
is None:
542 if self
._Header
_ is None:
543 self
._GetHeaderInfo
()
544 if self
._ConstructorList
is None:
545 self
._ConstructorList
= []
546 return self
._ConstructorList
548 ## Retrieve DESTRUCTOR
550 def DestructorList(self
):
551 if self
._DestructorList
is None:
552 if self
._Header
_ is None:
553 self
._GetHeaderInfo
()
554 if self
._DestructorList
is None:
555 self
._DestructorList
= []
556 return self
._DestructorList
558 ## Retrieve definies other than above ones
561 if len(self
._Defs
) == 0 and self
._Header
_ is None:
562 self
._GetHeaderInfo
()
565 ## Retrieve binary files
566 def _GetBinaries(self
):
567 if self
._Binaries
is None:
569 RecordList
= self
._RawData
[MODEL_EFI_BINARY_FILE
, self
._Arch
, self
._Platform
]
570 Macros
= self
._Macros
571 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
572 Macros
['PROCESSOR'] = self
._Arch
573 for Record
in RecordList
:
579 TokenList
= GetSplitValueList(Record
[2], TAB_VALUE_SPLIT
)
581 Target
= TokenList
[0]
582 if len(TokenList
) > 1:
583 FeatureFlag
= Record
[1:]
585 File
= PathClass(NormPath(Record
[1], Macros
), self
._ModuleDir
, '', FileType
, True, self
._Arch
, '', Target
)
586 # check the file validation
587 ErrorCode
, ErrorInfo
= File
.Validate()
589 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
590 self
._Binaries
.append(File
)
591 return self
._Binaries
593 ## Retrieve binary files with error check.
596 Binaries
= self
._GetBinaries
()
597 if GlobalData
.gIgnoreSource
and Binaries
== []:
598 ErrorInfo
= "The INF file does not contain any Binaries to use in creating the image\n"
599 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
)
603 ## Retrieve source files
606 # Ignore all source files in a binary build mode
607 if GlobalData
.gIgnoreSource
:
611 if self
._Sources
is None:
613 RecordList
= self
._RawData
[MODEL_EFI_SOURCE_FILE
, self
._Arch
, self
._Platform
]
614 Macros
= self
._Macros
615 for Record
in RecordList
:
617 ToolChainFamily
= Record
[1]
620 FeatureFlag
= Record
[4]
621 if self
.AutoGenVersion
< 0x00010005:
622 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
623 Macros
['PROCESSOR'] = self
._Arch
624 SourceFile
= NormPath(Record
[0], Macros
)
625 if SourceFile
[0] == os
.path
.sep
:
626 SourceFile
= mws
.join(GlobalData
.gWorkspace
, SourceFile
[1:])
627 # old module source files (Edk)
628 File
= PathClass(SourceFile
, self
._ModuleDir
, self
._SourceOverridePath
,
629 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
630 # check the file validation
631 ErrorCode
, ErrorInfo
= File
.Validate(CaseSensitive
=False)
633 if File
.Ext
.lower() == '.h':
634 EdkLogger
.warn('build', 'Include file not found', ExtraData
=ErrorInfo
,
635 File
=self
.MetaFile
, Line
=LineNo
)
638 EdkLogger
.error('build', ErrorCode
, ExtraData
=File
, File
=self
.MetaFile
, Line
=LineNo
)
640 File
= PathClass(NormPath(Record
[0], Macros
), self
._ModuleDir
, '',
641 '', False, self
._Arch
, ToolChainFamily
, '', TagName
, ToolCode
)
642 # check the file validation
643 ErrorCode
, ErrorInfo
= File
.Validate()
645 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
647 self
._Sources
.append(File
)
650 ## Retrieve library classes employed by this module
652 def LibraryClasses(self
):
653 if self
._LibraryClasses
is None:
654 self
._LibraryClasses
= OrderedDict()
655 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, self
._Platform
]
656 for Record
in RecordList
:
660 Instance
= NormPath(Instance
, self
._Macros
)
661 self
._LibraryClasses
[Lib
] = Instance
662 return self
._LibraryClasses
664 ## Retrieve library names (for Edk.x style of modules)
667 if self
._Libraries
is None:
669 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_INSTANCE
, self
._Arch
, self
._Platform
]
670 for Record
in RecordList
:
671 LibraryName
= ReplaceMacro(Record
[0], self
._Macros
, False)
672 # in case of name with '.lib' extension, which is unusual in Edk.x inf
673 LibraryName
= os
.path
.splitext(LibraryName
)[0]
674 if LibraryName
not in self
._Libraries
:
675 self
._Libraries
.append(LibraryName
)
676 return self
._Libraries
679 def ProtocolComments(self
):
681 return self
._ProtocolComments
683 ## Retrieve protocols consumed/produced by this module
686 if self
._Protocols
is None:
687 self
._Protocols
= OrderedDict()
688 self
._ProtocolComments
= OrderedDict()
689 RecordList
= self
._RawData
[MODEL_EFI_PROTOCOL
, self
._Arch
, self
._Platform
]
690 for Record
in RecordList
:
692 Value
= ProtocolValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
694 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
695 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
696 "Value of Protocol [%s] is not found under [Protocols] section in" % CName
,
697 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
698 self
._Protocols
[CName
] = Value
699 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
701 for CmtRec
in CommentRecords
:
702 Comments
.append(CmtRec
[0])
703 self
._ProtocolComments
[CName
] = Comments
704 return self
._Protocols
707 def PpiComments(self
):
709 return self
._PpiComments
711 ## Retrieve PPIs consumed/produced by this module
714 if self
._Ppis
is None:
715 self
._Ppis
= OrderedDict()
716 self
._PpiComments
= OrderedDict()
717 RecordList
= self
._RawData
[MODEL_EFI_PPI
, self
._Arch
, self
._Platform
]
718 for Record
in RecordList
:
720 Value
= PpiValue(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 PPI [%s] is not found under [Ppis] section in " % CName
,
725 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
726 self
._Ppis
[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
._PpiComments
[CName
] = Comments
735 def GuidComments(self
):
737 return self
._GuidComments
739 ## Retrieve GUIDs consumed/produced by this module
742 if self
._Guids
is None:
743 self
._Guids
= OrderedDict()
744 self
._GuidComments
= OrderedDict()
745 RecordList
= self
._RawData
[MODEL_EFI_GUID
, self
._Arch
, self
._Platform
]
746 for Record
in RecordList
:
748 Value
= GuidValue(CName
, self
.Packages
, self
.MetaFile
.Path
)
750 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
751 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
752 "Value of Guid [%s] is not found under [Guids] section in" % CName
,
753 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
754 self
._Guids
[CName
] = Value
755 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Record
[5]]
757 for CmtRec
in CommentRecords
:
758 Comments
.append(CmtRec
[0])
759 self
._GuidComments
[CName
] = Comments
762 ## Retrieve include paths necessary for this module (for Edk.x style of modules)
765 if self
._Includes
is None:
767 if self
._SourceOverridePath
:
768 self
._Includes
.append(self
._SourceOverridePath
)
770 Macros
= self
._Macros
771 Macros
['PROCESSOR'] = GlobalData
.gEdkGlobal
.get('PROCESSOR', self
._Arch
)
772 RecordList
= self
._RawData
[MODEL_EFI_INCLUDE
, self
._Arch
, self
._Platform
]
773 for Record
in RecordList
:
774 if Record
[0].find('EDK_SOURCE') > -1:
775 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
776 File
= NormPath(Record
[0], self
._Macros
)
778 File
= os
.path
.join(self
._ModuleDir
, File
)
780 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
781 File
= RealPath(os
.path
.normpath(File
))
783 self
._Includes
.append(File
)
785 # TRICK: let compiler to choose correct header file
786 Macros
['EDK_SOURCE'] = GlobalData
.gEdkSource
787 File
= NormPath(Record
[0], self
._Macros
)
789 File
= os
.path
.join(self
._ModuleDir
, File
)
791 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
792 File
= RealPath(os
.path
.normpath(File
))
794 self
._Includes
.append(File
)
796 File
= NormPath(Record
[0], Macros
)
798 File
= os
.path
.join(self
._ModuleDir
, File
)
800 File
= mws
.join(GlobalData
.gWorkspace
, File
)
801 File
= RealPath(os
.path
.normpath(File
))
803 self
._Includes
.append(File
)
804 if not File
and Record
[0].find('EFI_SOURCE') > -1:
805 # tricky to regard WorkSpace as EFI_SOURCE
806 Macros
['EFI_SOURCE'] = GlobalData
.gWorkspace
807 File
= NormPath(Record
[0], Macros
)
809 File
= os
.path
.join(self
._ModuleDir
, File
)
811 File
= os
.path
.join(GlobalData
.gWorkspace
, File
)
812 File
= RealPath(os
.path
.normpath(File
))
814 self
._Includes
.append(File
)
815 return self
._Includes
817 ## Retrieve packages this module depends on
820 if self
._Packages
is None:
822 RecordList
= self
._RawData
[MODEL_META_DATA_PACKAGE
, self
._Arch
, self
._Platform
]
823 Macros
= self
._Macros
824 Macros
['EDK_SOURCE'] = GlobalData
.gEcpSource
825 for Record
in RecordList
:
826 File
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
828 # check the file validation
829 ErrorCode
, ErrorInfo
= File
.Validate('.dec')
831 EdkLogger
.error('build', ErrorCode
, ExtraData
=ErrorInfo
, File
=self
.MetaFile
, Line
=LineNo
)
832 # parse this package now. we need it to get protocol/ppi/guid value
833 Package
= self
._Bdb
[File
, self
._Arch
, self
._Target
, self
._Toolchain
]
834 self
._Packages
.append(Package
)
835 return self
._Packages
837 ## Retrieve PCD comments
839 def PcdComments(self
):
841 return self
._PcdComments
843 ## Retrieve PCDs used in this module
846 if self
._Pcds
is None:
847 self
._Pcds
= OrderedDict()
848 self
._PcdComments
= OrderedDict()
849 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FIXED_AT_BUILD
))
850 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_PATCHABLE_IN_MODULE
))
851 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FEATURE_FLAG
))
852 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC
))
853 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_DYNAMIC_EX
))
856 ## Retrieve build options specific to this module
858 def BuildOptions(self
):
859 if self
._BuildOptions
is None:
860 self
._BuildOptions
= OrderedDict()
861 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, self
._Platform
]
862 for Record
in RecordList
:
863 ToolChainFamily
= Record
[0]
864 ToolChain
= Record
[1]
866 if (ToolChainFamily
, ToolChain
) not in self
._BuildOptions
or Option
.startswith('='):
867 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = Option
869 # concatenate the option string if they're for the same tool
870 OptionString
= self
._BuildOptions
[ToolChainFamily
, ToolChain
]
871 self
._BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Option
872 return self
._BuildOptions
874 ## Retrieve dependency expression
877 if self
._Depex
is None:
878 self
._Depex
= tdict(False, 2)
879 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
881 # If the module has only Binaries and no Sources, then ignore [Depex]
882 if self
.Sources
is None or self
.Sources
== []:
883 if self
.Binaries
is not None and self
.Binaries
!= []:
886 # PEIM and DXE drivers must have a valid [Depex] section
887 if len(self
.LibraryClass
) == 0 and len(RecordList
) == 0:
888 if self
.ModuleType
== SUP_MODULE_DXE_DRIVER
or self
.ModuleType
== SUP_MODULE_PEIM
or self
.ModuleType
== SUP_MODULE_DXE_SMM_DRIVER
or \
889 self
.ModuleType
== SUP_MODULE_DXE_SAL_DRIVER
or self
.ModuleType
== SUP_MODULE_DXE_RUNTIME_DRIVER
:
890 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "No [Depex] section or no valid expression in [Depex] section for [%s] module" \
891 % self
.ModuleType
, File
=self
.MetaFile
)
893 if len(RecordList
) != 0 and self
.ModuleType
== SUP_MODULE_USER_DEFINED
:
894 for Record
in RecordList
:
895 if Record
[4] not in [SUP_MODULE_PEIM
, SUP_MODULE_DXE_DRIVER
, SUP_MODULE_DXE_SMM_DRIVER
]:
896 EdkLogger
.error('build', FORMAT_INVALID
,
897 "'%s' module must specify the type of [Depex] section" % self
.ModuleType
,
900 Depex
= OrderedDict()
901 for Record
in RecordList
:
902 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
904 ModuleType
= Record
[4]
905 TokenList
= DepexStr
.split()
906 if (Arch
, ModuleType
) not in Depex
:
907 Depex
[Arch
, ModuleType
] = []
908 DepexList
= Depex
[Arch
, ModuleType
]
909 for Token
in TokenList
:
910 if Token
in DEPEX_SUPPORTED_OPCODE_SET
:
911 DepexList
.append(Token
)
912 elif Token
.endswith(".inf"): # module file name
913 ModuleFile
= os
.path
.normpath(Token
)
914 Module
= self
.BuildDatabase
[ModuleFile
]
916 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
, "Module is not found in active platform",
917 ExtraData
=Token
, File
=self
.MetaFile
, Line
=Record
[-1])
918 DepexList
.append(Module
.Guid
)
920 # it use the Fixed PCD format
922 if tuple(Token
.split('.')[::-1]) not in self
.Pcds
:
923 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])
925 if self
.Pcds
[tuple(Token
.split('.')[::-1])].DatumType
!= TAB_VOID
:
926 EdkLogger
.error('build', FORMAT_INVALID
, "PCD [{}] used in [Depex] section should be VOID* datum type".format(Token
), File
=self
.MetaFile
, Line
=Record
[-1])
929 # get the GUID value now
930 Value
= ProtocolValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
932 Value
= PpiValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
934 Value
= GuidValue(Token
, self
.Packages
, self
.MetaFile
.Path
)
937 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
938 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
939 "Value of [%s] is not found in" % Token
,
940 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=Record
[-1])
941 DepexList
.append(Value
)
942 for Arch
, ModuleType
in Depex
:
943 self
._Depex
[Arch
, ModuleType
] = Depex
[Arch
, ModuleType
]
946 ## Retrieve depedency expression
948 def DepexExpression(self
):
949 if self
._DepexExpression
is None:
950 self
._DepexExpression
= tdict(False, 2)
951 RecordList
= self
._RawData
[MODEL_EFI_DEPEX
, self
._Arch
]
952 DepexExpression
= OrderedDict()
953 for Record
in RecordList
:
954 DepexStr
= ReplaceMacro(Record
[0], self
._Macros
, False)
956 ModuleType
= Record
[4]
957 TokenList
= DepexStr
.split()
958 if (Arch
, ModuleType
) not in DepexExpression
:
959 DepexExpression
[Arch
, ModuleType
] = ''
960 for Token
in TokenList
:
961 DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
] + Token
.strip() + ' '
962 for Arch
, ModuleType
in DepexExpression
:
963 self
._DepexExpression
[Arch
, ModuleType
] = DepexExpression
[Arch
, ModuleType
]
964 return self
._DepexExpression
966 def GetGuidsUsedByPcd(self
):
967 return self
._GuidsUsedByPcd
969 ## Retrieve PCD for given type
970 def _GetPcd(self
, Type
):
972 PcdDict
= tdict(True, 4)
974 RecordList
= self
._RawData
[Type
, self
._Arch
, self
._Platform
]
975 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, Platform
, Id
, LineNo
in RecordList
:
976 PcdDict
[Arch
, Platform
, PcdCName
, TokenSpaceGuid
] = (Setting
, LineNo
)
977 PcdList
.append((PcdCName
, TokenSpaceGuid
))
979 if TokenSpaceGuid
not in self
.Guids
:
980 Value
= GuidValue(TokenSpaceGuid
, self
.Packages
, self
.MetaFile
.Path
)
982 PackageList
= "\n\t".join(str(P
) for P
in self
.Packages
)
983 EdkLogger
.error('build', RESOURCE_NOT_AVAILABLE
,
984 "Value of Guid [%s] is not found under [Guids] section in" % TokenSpaceGuid
,
985 ExtraData
=PackageList
, File
=self
.MetaFile
, Line
=LineNo
)
986 self
.Guids
[TokenSpaceGuid
] = Value
987 self
._GuidsUsedByPcd
[TokenSpaceGuid
] = Value
988 CommentRecords
= self
._RawData
[MODEL_META_DATA_COMMENT
, self
._Arch
, self
._Platform
, Id
]
990 for CmtRec
in CommentRecords
:
991 Comments
.append(CmtRec
[0])
992 self
._PcdComments
[TokenSpaceGuid
, PcdCName
] = Comments
994 # resolve PCD type, value, datum info, etc. by getting its definition from package
995 _GuidDict
= self
.Guids
.copy()
996 for PcdCName
, TokenSpaceGuid
in PcdList
:
997 PcdRealName
= PcdCName
998 Setting
, LineNo
= PcdDict
[self
._Arch
, self
.Platform
, PcdCName
, TokenSpaceGuid
]
1001 ValueList
= AnalyzePcdData(Setting
)
1002 DefaultValue
= ValueList
[0]
1003 Pcd
= PcdClassObject(
1013 self
.Guids
[TokenSpaceGuid
]
1015 if Type
== MODEL_PCD_PATCHABLE_IN_MODULE
and ValueList
[1]:
1016 # Patch PCD: TokenSpace.PcdCName|Value|Offset
1017 Pcd
.Offset
= ValueList
[1]
1019 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1020 for Package
in self
.Packages
:
1021 for key
in Package
.Pcds
:
1022 if (Package
.Pcds
[key
].TokenCName
, Package
.Pcds
[key
].TokenSpaceGuidCName
) == (PcdRealName
, TokenSpaceGuid
):
1023 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1024 Pcd_Type
= item
[0].split('_')[-1]
1025 if Pcd_Type
== Package
.Pcds
[key
].Type
:
1026 Value
= Package
.Pcds
[key
]
1027 Value
.TokenCName
= Package
.Pcds
[key
].TokenCName
+ '_' + Pcd_Type
1029 newkey
= (Value
.TokenCName
, key
[1])
1031 newkey
= (Value
.TokenCName
, key
[1], key
[2])
1032 del Package
.Pcds
[key
]
1033 Package
.Pcds
[newkey
] = Value
1040 # get necessary info from package declaring this PCD
1041 for Package
in self
.Packages
:
1043 # 'dynamic' in INF means its type is determined by platform;
1044 # if platform doesn't give its type, use 'lowest' one in the
1045 # following order, if any
1047 # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX
1049 _GuidDict
.update(Package
.Guids
)
1050 PcdType
= self
._PCD
_TYPE
_STRING
_[Type
]
1051 if Type
== MODEL_PCD_DYNAMIC
:
1053 for T
in PCD_TYPE_LIST
:
1054 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1055 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1056 if str(item
[0]).endswith(T
) and (item
[0], item
[1], T
) in Package
.Pcds
:
1064 if (PcdRealName
, TokenSpaceGuid
, T
) in Package
.Pcds
:
1070 if (PcdRealName
, TokenSpaceGuid
) in GlobalData
.MixedPcd
:
1071 for item
in GlobalData
.MixedPcd
[(PcdRealName
, TokenSpaceGuid
)]:
1072 Pcd_Type
= item
[0].split('_')[-1]
1073 if Pcd_Type
== PcdType
:
1081 if (PcdCName
, TokenSpaceGuid
, PcdType
) in Package
.Pcds
:
1082 PcdInPackage
= Package
.Pcds
[PcdCName
, TokenSpaceGuid
, PcdType
]
1084 Pcd
.TokenValue
= PcdInPackage
.TokenValue
1087 # Check whether the token value exist or not.
1089 if Pcd
.TokenValue
is None or Pcd
.TokenValue
== "":
1093 "No TokenValue for PCD [%s.%s] in [%s]!" % (TokenSpaceGuid
, PcdRealName
, str(Package
)),
1094 File
=self
.MetaFile
, Line
=LineNo
,
1098 # Check hexadecimal token value length and format.
1100 ReIsValidPcdTokenValue
= re
.compile(r
"^[0][x|X][0]*[0-9a-fA-F]{1,8}$", re
.DOTALL
)
1101 if Pcd
.TokenValue
.startswith("0x") or Pcd
.TokenValue
.startswith("0X"):
1102 if ReIsValidPcdTokenValue
.match(Pcd
.TokenValue
) is None:
1106 "The format of TokenValue [%s] of PCD [%s.%s] in [%s] is invalid:" % (Pcd
.TokenValue
, TokenSpaceGuid
, PcdRealName
, str(Package
)),
1107 File
=self
.MetaFile
, Line
=LineNo
,
1112 # Check decimal token value length and format.
1116 TokenValueInt
= int (Pcd
.TokenValue
, 10)
1117 if (TokenValueInt
< 0 or TokenValueInt
> 4294967295):
1121 "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
)),
1122 File
=self
.MetaFile
, Line
=LineNo
,
1129 "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
)),
1130 File
=self
.MetaFile
, Line
=LineNo
,
1134 Pcd
.DatumType
= PcdInPackage
.DatumType
1135 Pcd
.MaxDatumSize
= PcdInPackage
.MaxDatumSize
1136 Pcd
.InfDefaultValue
= Pcd
.DefaultValue
1137 if not Pcd
.DefaultValue
:
1138 Pcd
.DefaultValue
= PcdInPackage
.DefaultValue
1141 Pcd
.DefaultValue
= ValueExpressionEx(Pcd
.DefaultValue
, Pcd
.DatumType
, _GuidDict
)(True)
1142 except BadExpression
as Value
:
1143 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %(TokenSpaceGuid
, PcdRealName
, Pcd
.DefaultValue
, Value
),
1144 File
=self
.MetaFile
, Line
=LineNo
)
1150 "PCD [%s.%s] in [%s] is not found in dependent packages:" % (TokenSpaceGuid
, PcdRealName
, self
.MetaFile
),
1151 File
=self
.MetaFile
, Line
=LineNo
,
1152 ExtraData
="\t%s" % '\n\t'.join(str(P
) for P
in self
.Packages
)
1154 Pcds
[PcdCName
, TokenSpaceGuid
] = Pcd
1158 ## check whether current module is binary module
1160 def IsBinaryModule(self
):
1161 if (self
.Binaries
and not self
.Sources
) or GlobalData
.gIgnoreSource
: