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 ## Platform build information from DSC file
17 # This class is used to retrieve information stored in database and convert them
18 # into PlatformBuildClassObject form for easier use for AutoGen.
20 from Common
.String
import *
21 from Common
.DataType
import *
22 from Common
.Misc
import *
25 from CommonDataClass
.CommonClass
import SkuInfoClass
26 from Common
.TargetTxtClassObject
import *
27 from Common
.ToolDefClassObject
import *
28 from MetaDataTable
import *
29 from MetaFileTable
import *
30 from MetaFileParser
import *
32 from WorkspaceCommon
import GetDeclaredPcd
33 from Common
.Misc
import AnalyzeDscPcd
34 from Common
.Misc
import ProcessDuplicatedInf
36 from Common
.Parsing
import IsValidWord
37 from Common
.VariableAttributes
import VariableAttributes
38 import Common
.GlobalData
as GlobalData
40 from Common
.Misc
import SaveFileOnChange
41 from Workspace
.BuildClassObject
import PlatformBuildClassObject
, StructurePcd
, PcdClassObject
, ModuleBuildClassObject
44 # Treat CHAR16 as a synonym for UINT16. CHAR16 support is required for VFR C structs
46 PcdValueInitName
= 'PcdValueInit'
47 PcdSupportedBaseTypes
= ['BOOLEAN', 'UINT8', 'UINT16', 'UINT32', 'UINT64', 'CHAR16']
48 PcdSupportedBaseTypeWidth
= {'BOOLEAN':8, 'UINT8':8, 'UINT16':16, 'UINT32':32, 'UINT64':64}
49 PcdUnsupportedBaseTypes
= ['INT8', 'INT16', 'INT32', 'INT64', 'CHAR8', 'UINTN', 'INTN', 'VOID']
60 #include <PcdValueCommon.h>
70 return PcdValueMain (argc, argv);
74 PcdMakefileHeader
= '''
77 # This file is auto-generated by build utility
82 WindowsCFLAGS
= 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
83 LinuxCFLAGS
= 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
85 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
87 LIBS = $(LIB_PATH)\Common.lib
89 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
93 MAKEROOT ?= $(EDK_TOOLS_PATH)/Source/C
97 class DscBuildData(PlatformBuildClassObject
):
98 # dict used to convert PCD type in database to string used by build tool
100 MODEL_PCD_FIXED_AT_BUILD
: "FixedAtBuild",
101 MODEL_PCD_PATCHABLE_IN_MODULE
: "PatchableInModule",
102 MODEL_PCD_FEATURE_FLAG
: "FeatureFlag",
103 MODEL_PCD_DYNAMIC
: "Dynamic",
104 MODEL_PCD_DYNAMIC_DEFAULT
: "Dynamic",
105 MODEL_PCD_DYNAMIC_HII
: "DynamicHii",
106 MODEL_PCD_DYNAMIC_VPD
: "DynamicVpd",
107 MODEL_PCD_DYNAMIC_EX
: "DynamicEx",
108 MODEL_PCD_DYNAMIC_EX_DEFAULT
: "DynamicEx",
109 MODEL_PCD_DYNAMIC_EX_HII
: "DynamicExHii",
110 MODEL_PCD_DYNAMIC_EX_VPD
: "DynamicExVpd",
113 # dict used to convert part of [Defines] to members of DscBuildData directly
118 TAB_DSC_DEFINES_PLATFORM_NAME
: "_PlatformName",
119 TAB_DSC_DEFINES_PLATFORM_GUID
: "_Guid",
120 TAB_DSC_DEFINES_PLATFORM_VERSION
: "_Version",
121 TAB_DSC_DEFINES_DSC_SPECIFICATION
: "_DscSpecification",
122 # TAB_DSC_DEFINES_OUTPUT_DIRECTORY : "_OutputDirectory",
123 # TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES : "_SupArchList",
124 # TAB_DSC_DEFINES_BUILD_TARGETS : "_BuildTargets",
125 TAB_DSC_DEFINES_SKUID_IDENTIFIER
: "_SkuName",
126 # TAB_DSC_DEFINES_FLASH_DEFINITION : "_FlashDefinition",
127 TAB_DSC_DEFINES_BUILD_NUMBER
: "_BuildNumber",
128 TAB_DSC_DEFINES_MAKEFILE_NAME
: "_MakefileName",
129 TAB_DSC_DEFINES_BS_BASE_ADDRESS
: "_BsBaseAddress",
130 TAB_DSC_DEFINES_RT_BASE_ADDRESS
: "_RtBaseAddress",
131 # TAB_DSC_DEFINES_RFC_LANGUAGES : "_RFCLanguages",
132 # TAB_DSC_DEFINES_ISO_LANGUAGES : "_ISOLanguages",
135 # used to compose dummy library class name for those forced library instances
136 _NullLibraryNumber
= 0
138 ## Constructor of DscBuildData
140 # Initialize object of DscBuildData
142 # @param FilePath The path of platform description file
143 # @param RawData The raw data of DSC file
144 # @param BuildDataBase Database used to retrieve module/package information
145 # @param Arch The target architecture
146 # @param Platform (not used for DscBuildData)
147 # @param Macros Macros used for replacement in DSC file
149 def __init__(self
, FilePath
, RawData
, BuildDataBase
, Arch
='COMMON', Target
=None, Toolchain
=None):
150 self
.MetaFile
= FilePath
151 self
._RawData
= RawData
152 self
._Bdb
= BuildDataBase
154 self
._Target
= Target
155 self
._Toolchain
= Toolchain
156 self
._ToolChainFamily
= None
158 self
._HandleOverridePath
()
159 self
.WorkspaceDir
= os
.getenv("WORKSPACE") if os
.getenv("WORKSPACE") else ""
160 self
.DefaultStores
= None
161 self
.SkuIdMgr
= SkuClass(self
.SkuName
, self
.SkuIds
)
163 def OutputPath(self
):
164 if os
.getenv("WORKSPACE"):
165 return os
.path
.join(os
.getenv("WORKSPACE"), self
.OutputDirectory
, self
._Target
+ "_" + self
._Toolchain
,PcdValueInitName
)
167 return os
.path
.dirname(self
.DscFile
)
170 def __setitem__(self
, key
, value
):
171 self
.__dict
__[self
._PROPERTY
_[key
]] = value
174 def __getitem__(self
, key
):
175 return self
.__dict
__[self
._PROPERTY
_[key
]]
178 def __contains__(self
, key
):
179 return key
in self
._PROPERTY
_
181 ## Set all internal used members of DscBuildData to None
184 self
._PlatformName
= None
187 self
._DscSpecification
= None
188 self
._OutputDirectory
= None
189 self
._SupArchList
= None
190 self
._BuildTargets
= None
192 self
._PcdInfoFlag
= None
193 self
._VarCheckFlag
= None
194 self
._FlashDefinition
= None
195 self
._Prebuild
= None
196 self
._Postbuild
= None
197 self
._BuildNumber
= None
198 self
._MakefileName
= None
199 self
._BsBaseAddress
= None
200 self
._RtBaseAddress
= None
203 self
._LibraryInstances
= None
204 self
._LibraryClasses
= None
207 self
._BuildOptions
= None
208 self
._ModuleTypeOptions
= None
209 self
._LoadFixAddress
= None
210 self
._RFCLanguages
= None
211 self
._ISOLanguages
= None
212 self
._VpdToolGuid
= None
214 self
.DefaultStores
= None
217 ## handle Override Path of Module
218 def _HandleOverridePath(self
):
219 RecordList
= self
._RawData
[MODEL_META_DATA_COMPONENT
, self
._Arch
]
220 Macros
= self
._Macros
221 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
222 for Record
in RecordList
:
225 ModuleFile
= PathClass(NormPath(Record
[0]), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
226 RecordList
= self
._RawData
[MODEL_META_DATA_COMPONENT_SOURCE_OVERRIDE_PATH
, self
._Arch
, None, ModuleId
]
228 SourceOverridePath
= mws
.join(GlobalData
.gWorkspace
, NormPath(RecordList
[0][0]))
230 # Check if the source override path exists
231 if not os
.path
.isdir(SourceOverridePath
):
232 EdkLogger
.error('build', FILE_NOT_FOUND
, Message
='Source override path does not exist:', File
=self
.MetaFile
, ExtraData
=SourceOverridePath
, Line
=LineNo
)
234 # Add to GlobalData Variables
235 GlobalData
.gOverrideDir
[ModuleFile
.Key
] = SourceOverridePath
237 ## Get current effective macros
238 def _GetMacros(self
):
239 if self
.__Macros
== None:
241 self
.__Macros
.update(GlobalData
.gPlatformDefines
)
242 self
.__Macros
.update(GlobalData
.gGlobalDefines
)
243 self
.__Macros
.update(GlobalData
.gCommandLineDefines
)
252 # Changing the default ARCH to another may affect all other information
253 # because all information in a platform may be ARCH-related. That's
254 # why we need to clear all internal used members, in order to cause all
255 # information to be re-retrieved.
257 # @param Value The value of ARCH
259 def _SetArch(self
, Value
):
260 if self
._Arch
== Value
:
265 ## Retrieve all information in [Defines] section
267 # (Retriving all [Defines] information in one-shot is just to save time.)
269 def _GetHeaderInfo(self
):
270 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
]
271 for Record
in RecordList
:
273 # items defined _PROPERTY_ don't need additional processing
275 # some special items in [Defines] section need special treatment
276 if Name
== TAB_DSC_DEFINES_OUTPUT_DIRECTORY
:
277 self
._OutputDirectory
= NormPath(Record
[2], self
._Macros
)
278 if ' ' in self
._OutputDirectory
:
279 EdkLogger
.error("build", FORMAT_NOT_SUPPORTED
, "No space is allowed in OUTPUT_DIRECTORY",
280 File
=self
.MetaFile
, Line
=Record
[-1],
281 ExtraData
=self
._OutputDirectory
)
282 elif Name
== TAB_DSC_DEFINES_FLASH_DEFINITION
:
283 self
._FlashDefinition
= PathClass(NormPath(Record
[2], self
._Macros
), GlobalData
.gWorkspace
)
284 ErrorCode
, ErrorInfo
= self
._FlashDefinition
.Validate('.fdf')
286 EdkLogger
.error('build', ErrorCode
, File
=self
.MetaFile
, Line
=Record
[-1],
288 elif Name
== TAB_DSC_PREBUILD
:
289 PrebuildValue
= Record
[2]
290 if Record
[2][0] == '"':
291 if Record
[2][-1] != '"':
292 EdkLogger
.error('build', FORMAT_INVALID
, 'Missing double quotes in the end of %s statement.' % TAB_DSC_PREBUILD
,
293 File
=self
.MetaFile
, Line
=Record
[-1])
294 PrebuildValue
= Record
[2][1:-1]
295 self
._Prebuild
= PrebuildValue
296 elif Name
== TAB_DSC_POSTBUILD
:
297 PostbuildValue
= Record
[2]
298 if Record
[2][0] == '"':
299 if Record
[2][-1] != '"':
300 EdkLogger
.error('build', FORMAT_INVALID
, 'Missing double quotes in the end of %s statement.' % TAB_DSC_POSTBUILD
,
301 File
=self
.MetaFile
, Line
=Record
[-1])
302 PostbuildValue
= Record
[2][1:-1]
303 self
._Postbuild
= PostbuildValue
304 elif Name
== TAB_DSC_DEFINES_SUPPORTED_ARCHITECTURES
:
305 self
._SupArchList
= GetSplitValueList(Record
[2], TAB_VALUE_SPLIT
)
306 elif Name
== TAB_DSC_DEFINES_BUILD_TARGETS
:
307 self
._BuildTargets
= GetSplitValueList(Record
[2])
308 elif Name
== TAB_DSC_DEFINES_SKUID_IDENTIFIER
:
309 if self
._SkuName
== None:
310 self
._SkuName
= Record
[2]
311 if GlobalData
.gSKUID_CMD
:
312 self
._SkuName
= GlobalData
.gSKUID_CMD
313 elif Name
== TAB_DSC_DEFINES_PCD_INFO_GENERATION
:
314 self
._PcdInfoFlag
= Record
[2]
315 elif Name
== TAB_DSC_DEFINES_PCD_VAR_CHECK_GENERATION
:
316 self
._VarCheckFlag
= Record
[2]
317 elif Name
== TAB_FIX_LOAD_TOP_MEMORY_ADDRESS
:
319 self
._LoadFixAddress
= int (Record
[2], 0)
321 EdkLogger
.error("build", PARAMETER_INVALID
, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (Record
[2]))
322 elif Name
== TAB_DSC_DEFINES_RFC_LANGUAGES
:
323 if not Record
[2] or Record
[2][0] != '"' or Record
[2][-1] != '"' or len(Record
[2]) == 1:
324 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'language code for RFC_LANGUAGES must have double quotes around it, for example: RFC_LANGUAGES = "en-us;zh-hans"',
325 File
=self
.MetaFile
, Line
=Record
[-1])
326 LanguageCodes
= Record
[2][1:-1]
327 if not LanguageCodes
:
328 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'one or more RFC4646 format language code must be provided for RFC_LANGUAGES statement',
329 File
=self
.MetaFile
, Line
=Record
[-1])
330 LanguageList
= GetSplitValueList(LanguageCodes
, TAB_SEMI_COLON_SPLIT
)
331 # check whether there is empty entries in the list
332 if None in LanguageList
:
333 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'one or more empty language code is in RFC_LANGUAGES statement',
334 File
=self
.MetaFile
, Line
=Record
[-1])
335 self
._RFCLanguages
= LanguageList
336 elif Name
== TAB_DSC_DEFINES_ISO_LANGUAGES
:
337 if not Record
[2] or Record
[2][0] != '"' or Record
[2][-1] != '"' or len(Record
[2]) == 1:
338 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'language code for ISO_LANGUAGES must have double quotes around it, for example: ISO_LANGUAGES = "engchn"',
339 File
=self
.MetaFile
, Line
=Record
[-1])
340 LanguageCodes
= Record
[2][1:-1]
341 if not LanguageCodes
:
342 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'one or more ISO639-2 format language code must be provided for ISO_LANGUAGES statement',
343 File
=self
.MetaFile
, Line
=Record
[-1])
344 if len(LanguageCodes
) % 3:
345 EdkLogger
.error('build', FORMAT_NOT_SUPPORTED
, 'bad ISO639-2 format for ISO_LANGUAGES',
346 File
=self
.MetaFile
, Line
=Record
[-1])
348 for i
in range(0, len(LanguageCodes
), 3):
349 LanguageList
.append(LanguageCodes
[i
:i
+ 3])
350 self
._ISOLanguages
= LanguageList
351 elif Name
== TAB_DSC_DEFINES_VPD_TOOL_GUID
:
353 # try to convert GUID to a real UUID value to see whether the GUID is format
354 # for VPD_TOOL_GUID is correct.
359 EdkLogger
.error("build", FORMAT_INVALID
, "Invalid GUID format for VPD_TOOL_GUID", File
=self
.MetaFile
)
360 self
._VpdToolGuid
= Record
[2]
362 self
[Name
] = Record
[2]
363 # set _Header to non-None in order to avoid database re-querying
364 self
._Header
= 'DUMMY'
366 ## Retrieve platform name
367 def _GetPlatformName(self
):
368 if self
._PlatformName
== None:
369 if self
._Header
== None:
370 self
._GetHeaderInfo
()
371 if self
._PlatformName
== None:
372 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No PLATFORM_NAME", File
=self
.MetaFile
)
373 return self
._PlatformName
375 ## Retrieve file guid
376 def _GetFileGuid(self
):
377 if self
._Guid
== None:
378 if self
._Header
== None:
379 self
._GetHeaderInfo
()
380 if self
._Guid
== None:
381 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No PLATFORM_GUID", File
=self
.MetaFile
)
384 ## Retrieve platform version
385 def _GetVersion(self
):
386 if self
._Version
== None:
387 if self
._Header
== None:
388 self
._GetHeaderInfo
()
389 if self
._Version
== None:
390 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No PLATFORM_VERSION", File
=self
.MetaFile
)
393 ## Retrieve platform description file version
394 def _GetDscSpec(self
):
395 if self
._DscSpecification
== None:
396 if self
._Header
== None:
397 self
._GetHeaderInfo
()
398 if self
._DscSpecification
== None:
399 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No DSC_SPECIFICATION", File
=self
.MetaFile
)
400 return self
._DscSpecification
402 ## Retrieve OUTPUT_DIRECTORY
403 def _GetOutpuDir(self
):
404 if self
._OutputDirectory
== None:
405 if self
._Header
== None:
406 self
._GetHeaderInfo
()
407 if self
._OutputDirectory
== None:
408 self
._OutputDirectory
= os
.path
.join("Build", self
._PlatformName
)
409 return self
._OutputDirectory
411 ## Retrieve SUPPORTED_ARCHITECTURES
412 def _GetSupArch(self
):
413 if self
._SupArchList
== None:
414 if self
._Header
== None:
415 self
._GetHeaderInfo
()
416 if self
._SupArchList
== None:
417 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No SUPPORTED_ARCHITECTURES", File
=self
.MetaFile
)
418 return self
._SupArchList
420 ## Retrieve BUILD_TARGETS
421 def _GetBuildTarget(self
):
422 if self
._BuildTargets
== None:
423 if self
._Header
== None:
424 self
._GetHeaderInfo
()
425 if self
._BuildTargets
== None:
426 EdkLogger
.error('build', ATTRIBUTE_NOT_AVAILABLE
, "No BUILD_TARGETS", File
=self
.MetaFile
)
427 return self
._BuildTargets
429 def _GetPcdInfoFlag(self
):
430 if self
._PcdInfoFlag
== None or self
._PcdInfoFlag
.upper() == 'FALSE':
432 elif self
._PcdInfoFlag
.upper() == 'TRUE':
436 def _GetVarCheckFlag(self
):
437 if self
._VarCheckFlag
== None or self
._VarCheckFlag
.upper() == 'FALSE':
439 elif self
._VarCheckFlag
.upper() == 'TRUE':
444 # # Retrieve SKUID_IDENTIFIER
445 def _GetSkuName(self
):
446 if self
._SkuName
== None:
447 if self
._Header
== None:
448 self
._GetHeaderInfo
()
449 if self
._SkuName
== None:
450 self
._SkuName
= 'DEFAULT'
453 ## Override SKUID_IDENTIFIER
454 def _SetSkuName(self
, Value
):
455 self
._SkuName
= Value
457 def _GetFdfFile(self
):
458 if self
._FlashDefinition
== None:
459 if self
._Header
== None:
460 self
._GetHeaderInfo
()
461 if self
._FlashDefinition
== None:
462 self
._FlashDefinition
= ''
463 return self
._FlashDefinition
465 def _GetPrebuild(self
):
466 if self
._Prebuild
== None:
467 if self
._Header
== None:
468 self
._GetHeaderInfo
()
469 if self
._Prebuild
== None:
471 return self
._Prebuild
473 def _GetPostbuild(self
):
474 if self
._Postbuild
== None:
475 if self
._Header
== None:
476 self
._GetHeaderInfo
()
477 if self
._Postbuild
== None:
479 return self
._Postbuild
481 ## Retrieve FLASH_DEFINITION
482 def _GetBuildNumber(self
):
483 if self
._BuildNumber
== None:
484 if self
._Header
== None:
485 self
._GetHeaderInfo
()
486 if self
._BuildNumber
== None:
487 self
._BuildNumber
= ''
488 return self
._BuildNumber
490 ## Retrieve MAKEFILE_NAME
491 def _GetMakefileName(self
):
492 if self
._MakefileName
== None:
493 if self
._Header
== None:
494 self
._GetHeaderInfo
()
495 if self
._MakefileName
== None:
496 self
._MakefileName
= ''
497 return self
._MakefileName
499 ## Retrieve BsBaseAddress
500 def _GetBsBaseAddress(self
):
501 if self
._BsBaseAddress
== None:
502 if self
._Header
== None:
503 self
._GetHeaderInfo
()
504 if self
._BsBaseAddress
== None:
505 self
._BsBaseAddress
= ''
506 return self
._BsBaseAddress
508 ## Retrieve RtBaseAddress
509 def _GetRtBaseAddress(self
):
510 if self
._RtBaseAddress
== None:
511 if self
._Header
== None:
512 self
._GetHeaderInfo
()
513 if self
._RtBaseAddress
== None:
514 self
._RtBaseAddress
= ''
515 return self
._RtBaseAddress
517 ## Retrieve the top address for the load fix address
518 def _GetLoadFixAddress(self
):
519 if self
._LoadFixAddress
== None:
520 if self
._Header
== None:
521 self
._GetHeaderInfo
()
523 if self
._LoadFixAddress
== None:
524 self
._LoadFixAddress
= self
._Macros
.get(TAB_FIX_LOAD_TOP_MEMORY_ADDRESS
, '0')
527 self
._LoadFixAddress
= int (self
._LoadFixAddress
, 0)
529 EdkLogger
.error("build", PARAMETER_INVALID
, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (self
._LoadFixAddress
))
532 # If command line defined, should override the value in DSC file.
534 if 'FIX_LOAD_TOP_MEMORY_ADDRESS' in GlobalData
.gCommandLineDefines
.keys():
536 self
._LoadFixAddress
= int(GlobalData
.gCommandLineDefines
['FIX_LOAD_TOP_MEMORY_ADDRESS'], 0)
538 EdkLogger
.error("build", PARAMETER_INVALID
, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (GlobalData
.gCommandLineDefines
['FIX_LOAD_TOP_MEMORY_ADDRESS']))
540 if self
._LoadFixAddress
< 0:
541 EdkLogger
.error("build", PARAMETER_INVALID
, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid negative value 0x%x" % (self
._LoadFixAddress
))
542 if self
._LoadFixAddress
!= 0xFFFFFFFFFFFFFFFF and self
._LoadFixAddress
% 0x1000 != 0:
543 EdkLogger
.error("build", PARAMETER_INVALID
, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid unaligned 4K value 0x%x" % (self
._LoadFixAddress
))
545 return self
._LoadFixAddress
547 ## Retrieve RFCLanguage filter
548 def _GetRFCLanguages(self
):
549 if self
._RFCLanguages
== None:
550 if self
._Header
== None:
551 self
._GetHeaderInfo
()
552 if self
._RFCLanguages
== None:
553 self
._RFCLanguages
= []
554 return self
._RFCLanguages
556 ## Retrieve ISOLanguage filter
557 def _GetISOLanguages(self
):
558 if self
._ISOLanguages
== None:
559 if self
._Header
== None:
560 self
._GetHeaderInfo
()
561 if self
._ISOLanguages
== None:
562 self
._ISOLanguages
= []
563 return self
._ISOLanguages
564 ## Retrieve the GUID string for VPD tool
565 def _GetVpdToolGuid(self
):
566 if self
._VpdToolGuid
== None:
567 if self
._Header
== None:
568 self
._GetHeaderInfo
()
569 if self
._VpdToolGuid
== None:
570 self
._VpdToolGuid
= ''
571 return self
._VpdToolGuid
573 ## Retrieve [SkuIds] section information
574 def _GetSkuIds(self
):
575 if self
._SkuIds
== None:
576 self
._SkuIds
= sdict()
577 RecordList
= self
._RawData
[MODEL_EFI_SKU_ID
, self
._Arch
]
578 for Record
in RecordList
:
579 if Record
[0] in [None, '']:
580 EdkLogger
.error('build', FORMAT_INVALID
, 'No Sku ID number',
581 File
=self
.MetaFile
, Line
=Record
[-1])
582 if Record
[1] in [None, '']:
583 EdkLogger
.error('build', FORMAT_INVALID
, 'No Sku ID name',
584 File
=self
.MetaFile
, Line
=Record
[-1])
585 Pattern
= re
.compile('^[1-9]\d*|0$')
586 HexPattern
= re
.compile(r
'0[xX][0-9a-fA-F]+$')
587 if Pattern
.match(Record
[0]) == None and HexPattern
.match(Record
[0]) == None:
588 EdkLogger
.error('build', FORMAT_INVALID
, "The format of the Sku ID number is invalid. It only support Integer and HexNumber",
589 File
=self
.MetaFile
, Line
=Record
[-1])
590 if not IsValidWord(Record
[1]):
591 EdkLogger
.error('build', FORMAT_INVALID
, "The format of the Sku ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
592 File
=self
.MetaFile
, Line
=Record
[-1])
593 self
._SkuIds
[Record
[1].upper()] = (str(self
.ToInt(Record
[0])), Record
[1].upper(), Record
[2].upper())
594 if 'DEFAULT' not in self
._SkuIds
:
595 self
._SkuIds
['DEFAULT'] = ("0","DEFAULT","DEFAULT")
596 if 'COMMON' not in self
._SkuIds
:
597 self
._SkuIds
['COMMON'] = ("0","DEFAULT","DEFAULT")
599 def ToInt(self
,intstr
):
600 return int(intstr
,16) if intstr
.upper().startswith("0X") else int(intstr
)
601 def _GetDefaultStores(self
):
602 if self
.DefaultStores
== None:
603 self
.DefaultStores
= sdict()
604 RecordList
= self
._RawData
[MODEL_EFI_DEFAULT_STORES
, self
._Arch
]
605 for Record
in RecordList
:
606 if Record
[0] in [None, '']:
607 EdkLogger
.error('build', FORMAT_INVALID
, 'No DefaultStores ID number',
608 File
=self
.MetaFile
, Line
=Record
[-1])
609 if Record
[1] in [None, '']:
610 EdkLogger
.error('build', FORMAT_INVALID
, 'No DefaultStores ID name',
611 File
=self
.MetaFile
, Line
=Record
[-1])
612 Pattern
= re
.compile('^[1-9]\d*|0$')
613 HexPattern
= re
.compile(r
'0[xX][0-9a-fA-F]+$')
614 if Pattern
.match(Record
[0]) == None and HexPattern
.match(Record
[0]) == None:
615 EdkLogger
.error('build', FORMAT_INVALID
, "The format of the DefaultStores ID number is invalid. It only support Integer and HexNumber",
616 File
=self
.MetaFile
, Line
=Record
[-1])
617 if not IsValidWord(Record
[1]):
618 EdkLogger
.error('build', FORMAT_INVALID
, "The format of the DefaultStores ID name is invalid. The correct format is '(a-zA-Z0-9_)(a-zA-Z0-9_-.)*'",
619 File
=self
.MetaFile
, Line
=Record
[-1])
620 self
.DefaultStores
[Record
[1].upper()] = (self
.ToInt(Record
[0]),Record
[1].upper())
621 if TAB_DEFAULT_STORES_DEFAULT
not in self
.DefaultStores
:
622 self
.DefaultStores
[TAB_DEFAULT_STORES_DEFAULT
] = (0,TAB_DEFAULT_STORES_DEFAULT
)
623 GlobalData
.gDefaultStores
= self
.DefaultStores
.keys()
624 if GlobalData
.gDefaultStores
:
625 GlobalData
.gDefaultStores
.sort()
626 return self
.DefaultStores
628 ## Retrieve [Components] section information
629 def _GetModules(self
):
630 if self
._Modules
!= None:
633 self
._Modules
= sdict()
634 RecordList
= self
._RawData
[MODEL_META_DATA_COMPONENT
, self
._Arch
]
635 Macros
= self
._Macros
636 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
637 for Record
in RecordList
:
638 DuplicatedFile
= False
640 ModuleFile
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
644 # check the file validation
645 ErrorCode
, ErrorInfo
= ModuleFile
.Validate('.inf')
647 EdkLogger
.error('build', ErrorCode
, File
=self
.MetaFile
, Line
=LineNo
,
650 # If arch is COMMON, no duplicate module is checked since all modules in all component sections are selected
651 if self
._Arch
!= 'COMMON' and ModuleFile
in self
._Modules
:
652 DuplicatedFile
= True
654 Module
= ModuleBuildClassObject()
655 Module
.MetaFile
= ModuleFile
657 # get module private library instance
658 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, None, ModuleId
]
659 for Record
in RecordList
:
660 LibraryClass
= Record
[0]
661 LibraryPath
= PathClass(NormPath(Record
[1], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
664 # check the file validation
665 ErrorCode
, ErrorInfo
= LibraryPath
.Validate('.inf')
667 EdkLogger
.error('build', ErrorCode
, File
=self
.MetaFile
, Line
=LineNo
,
670 if LibraryClass
== '' or LibraryClass
== 'NULL':
671 self
._NullLibraryNumber
+= 1
672 LibraryClass
= 'NULL%d' % self
._NullLibraryNumber
673 EdkLogger
.verbose("Found forced library for %s\n\t%s [%s]" % (ModuleFile
, LibraryPath
, LibraryClass
))
674 Module
.LibraryClasses
[LibraryClass
] = LibraryPath
675 if LibraryPath
not in self
.LibraryInstances
:
676 self
.LibraryInstances
.append(LibraryPath
)
678 # get module private PCD setting
679 for Type
in [MODEL_PCD_FIXED_AT_BUILD
, MODEL_PCD_PATCHABLE_IN_MODULE
, \
680 MODEL_PCD_FEATURE_FLAG
, MODEL_PCD_DYNAMIC
, MODEL_PCD_DYNAMIC_EX
]:
681 RecordList
= self
._RawData
[Type
, self
._Arch
, None, ModuleId
]
682 for TokenSpaceGuid
, PcdCName
, Setting
, Dummy1
, Dummy2
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
683 TokenList
= GetSplitValueList(Setting
)
684 DefaultValue
= TokenList
[0]
685 # the format is PcdName| Value | VOID* | MaxDatumSize
686 if len(TokenList
) > 2:
687 MaxDatumSize
= TokenList
[2]
690 TypeString
= self
._PCD
_TYPE
_STRING
_[Type
]
691 Pcd
= PcdClassObject(
703 Module
.Pcds
[PcdCName
, TokenSpaceGuid
] = Pcd
705 # get module private build options
706 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, None, ModuleId
]
707 for ToolChainFamily
, ToolChain
, Option
, Dummy1
, Dummy2
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
708 if (ToolChainFamily
, ToolChain
) not in Module
.BuildOptions
:
709 Module
.BuildOptions
[ToolChainFamily
, ToolChain
] = Option
711 OptionString
= Module
.BuildOptions
[ToolChainFamily
, ToolChain
]
712 Module
.BuildOptions
[ToolChainFamily
, ToolChain
] = OptionString
+ " " + Option
714 RecordList
= self
._RawData
[MODEL_META_DATA_HEADER
, self
._Arch
, None, ModuleId
]
715 if DuplicatedFile
and not RecordList
:
716 EdkLogger
.error('build', FILE_DUPLICATED
, File
=self
.MetaFile
, ExtraData
=str(ModuleFile
), Line
=LineNo
)
718 if len(RecordList
) != 1:
719 EdkLogger
.error('build', OPTION_UNKNOWN
, 'Only FILE_GUID can be listed in <Defines> section.',
720 File
=self
.MetaFile
, ExtraData
=str(ModuleFile
), Line
=LineNo
)
721 ModuleFile
= ProcessDuplicatedInf(ModuleFile
, RecordList
[0][2], GlobalData
.gWorkspace
)
722 ModuleFile
.Arch
= self
._Arch
724 self
._Modules
[ModuleFile
] = Module
727 ## Retrieve all possible library instances used in this platform
728 def _GetLibraryInstances(self
):
729 if self
._LibraryInstances
== None:
730 self
._GetLibraryClasses
()
731 return self
._LibraryInstances
733 ## Retrieve [LibraryClasses] information
734 def _GetLibraryClasses(self
):
735 if self
._LibraryClasses
== None:
736 self
._LibraryInstances
= []
738 # tdict is a special dict kind of type, used for selecting correct
739 # library instance for given library class and module type
741 LibraryClassDict
= tdict(True, 3)
742 # track all library class names
743 LibraryClassSet
= set()
744 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_CLASS
, self
._Arch
, None, -1]
745 Macros
= self
._Macros
746 for Record
in RecordList
:
747 LibraryClass
, LibraryInstance
, Dummy
, Arch
, ModuleType
, Dummy
,Dummy
, LineNo
= Record
748 if LibraryClass
== '' or LibraryClass
== 'NULL':
749 self
._NullLibraryNumber
+= 1
750 LibraryClass
= 'NULL%d' % self
._NullLibraryNumber
751 EdkLogger
.verbose("Found forced library for arch=%s\n\t%s [%s]" % (Arch
, LibraryInstance
, LibraryClass
))
752 LibraryClassSet
.add(LibraryClass
)
753 LibraryInstance
= PathClass(NormPath(LibraryInstance
, Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
754 # check the file validation
755 ErrorCode
, ErrorInfo
= LibraryInstance
.Validate('.inf')
757 EdkLogger
.error('build', ErrorCode
, File
=self
.MetaFile
, Line
=LineNo
,
760 if ModuleType
!= 'COMMON' and ModuleType
not in SUP_MODULE_LIST
:
761 EdkLogger
.error('build', OPTION_UNKNOWN
, "Unknown module type [%s]" % ModuleType
,
762 File
=self
.MetaFile
, ExtraData
=LibraryInstance
, Line
=LineNo
)
763 LibraryClassDict
[Arch
, ModuleType
, LibraryClass
] = LibraryInstance
764 if LibraryInstance
not in self
._LibraryInstances
:
765 self
._LibraryInstances
.append(LibraryInstance
)
767 # resolve the specific library instance for each class and each module type
768 self
._LibraryClasses
= tdict(True)
769 for LibraryClass
in LibraryClassSet
:
770 # try all possible module types
771 for ModuleType
in SUP_MODULE_LIST
:
772 LibraryInstance
= LibraryClassDict
[self
._Arch
, ModuleType
, LibraryClass
]
773 if LibraryInstance
== None:
775 self
._LibraryClasses
[LibraryClass
, ModuleType
] = LibraryInstance
777 # for Edk style library instances, which are listed in different section
778 Macros
["EDK_SOURCE"] = GlobalData
.gEcpSource
779 RecordList
= self
._RawData
[MODEL_EFI_LIBRARY_INSTANCE
, self
._Arch
]
780 for Record
in RecordList
:
781 File
= PathClass(NormPath(Record
[0], Macros
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
783 # check the file validation
784 ErrorCode
, ErrorInfo
= File
.Validate('.inf')
786 EdkLogger
.error('build', ErrorCode
, File
=self
.MetaFile
, Line
=LineNo
,
788 if File
not in self
._LibraryInstances
:
789 self
._LibraryInstances
.append(File
)
791 # we need the module name as the library class name, so we have
792 # to parse it here. (self._Bdb[] will trigger a file parse if it
793 # hasn't been parsed)
795 Library
= self
._Bdb
[File
, self
._Arch
, self
._Target
, self
._Toolchain
]
796 self
._LibraryClasses
[Library
.BaseName
, ':dummy:'] = Library
797 return self
._LibraryClasses
799 def _ValidatePcd(self
, PcdCName
, TokenSpaceGuid
, Setting
, PcdType
, LineNo
):
800 if self
._DecPcds
== None:
803 if GlobalData
.gFdfParser
:
804 FdfInfList
= GlobalData
.gFdfParser
.Profile
.InfList
807 for Inf
in FdfInfList
:
808 ModuleFile
= PathClass(NormPath(Inf
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
809 if ModuleFile
in self
._Modules
:
811 ModuleData
= self
._Bdb
[ModuleFile
, self
._Arch
, self
._Target
, self
._Toolchain
]
812 PkgSet
.update(ModuleData
.Packages
)
814 self
._DecPcds
, self
._GuidDict
= GetDeclaredPcd(self
, self
._Bdb
, self
._Arch
, self
._Target
, self
._Toolchain
,PkgSet
)
815 self
._GuidDict
.update(GlobalData
.gPlatformPcds
)
817 if (PcdCName
, TokenSpaceGuid
) not in self
._DecPcds
:
818 EdkLogger
.error('build', PARSER_ERROR
,
819 "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (TokenSpaceGuid
, PcdCName
, self
._Arch
),
820 File
=self
.MetaFile
, Line
=LineNo
)
821 ValueList
, IsValid
, Index
= AnalyzeDscPcd(Setting
, PcdType
, self
._DecPcds
[PcdCName
, TokenSpaceGuid
].DatumType
)
823 if PcdType
not in [MODEL_PCD_FEATURE_FLAG
, MODEL_PCD_FIXED_AT_BUILD
]:
824 EdkLogger
.error('build', FORMAT_INVALID
, "Pcd format incorrect.", File
=self
.MetaFile
, Line
=LineNo
,
825 ExtraData
="%s.%s|%s" % (TokenSpaceGuid
, PcdCName
, Setting
))
827 if ValueList
[2] == '-1':
828 EdkLogger
.error('build', FORMAT_INVALID
, "Pcd format incorrect.", File
=self
.MetaFile
, Line
=LineNo
,
829 ExtraData
="%s.%s|%s" % (TokenSpaceGuid
, PcdCName
, Setting
))
831 DatumType
= self
._DecPcds
[PcdCName
, TokenSpaceGuid
].DatumType
833 ValueList
[Index
] = ValueExpressionEx(ValueList
[Index
], DatumType
, self
._GuidDict
)(True)
834 except BadExpression
, Value
:
835 EdkLogger
.error('Parser', FORMAT_INVALID
, Value
, File
=self
.MetaFile
, Line
=LineNo
,
836 ExtraData
="PCD [%s.%s] Value \"%s\" " % (
837 TokenSpaceGuid
, PcdCName
, ValueList
[Index
]))
838 except EvaluationException
, Excpt
:
839 if hasattr(Excpt
, 'Pcd'):
840 if Excpt
.Pcd
in GlobalData
.gPlatformOtherPcds
:
841 EdkLogger
.error('Parser', FORMAT_INVALID
, "Cannot use this PCD (%s) in an expression as"
842 " it must be defined in a [PcdsFixedAtBuild] or [PcdsFeatureFlag] section"
843 " of the DSC file" % Excpt
.Pcd
,
844 File
=self
.MetaFile
, Line
=LineNo
)
846 EdkLogger
.error('Parser', FORMAT_INVALID
, "PCD (%s) is not defined in DSC file" % Excpt
.Pcd
,
847 File
=self
.MetaFile
, Line
=LineNo
)
849 EdkLogger
.error('Parser', FORMAT_INVALID
, "Invalid expression: %s" % str(Excpt
),
850 File
=self
.MetaFile
, Line
=LineNo
)
853 Valid
, ErrStr
= CheckPcdDatum(self
._DecPcds
[PcdCName
, TokenSpaceGuid
].DatumType
, ValueList
[Index
])
855 EdkLogger
.error('build', FORMAT_INVALID
, ErrStr
, File
=self
.MetaFile
, Line
=LineNo
,
856 ExtraData
="%s.%s" % (TokenSpaceGuid
, PcdCName
))
857 if PcdType
in (MODEL_PCD_DYNAMIC_DEFAULT
, MODEL_PCD_DYNAMIC_EX_DEFAULT
):
858 if self
._DecPcds
[PcdCName
, TokenSpaceGuid
].DatumType
.strip() != ValueList
[1].strip():
859 EdkLogger
.error('build', FORMAT_INVALID
, "Pcd datumtype used in DSC file is not the same as its declaration in DEC file." , File
=self
.MetaFile
, Line
=LineNo
,
860 ExtraData
="%s.%s|%s" % (TokenSpaceGuid
, PcdCName
, Setting
))
861 if (TokenSpaceGuid
+ '.' + PcdCName
) in GlobalData
.gPlatformPcds
:
862 if GlobalData
.gPlatformPcds
[TokenSpaceGuid
+ '.' + PcdCName
] != ValueList
[Index
]:
863 GlobalData
.gPlatformPcds
[TokenSpaceGuid
+ '.' + PcdCName
] = ValueList
[Index
]
866 def _FilterPcdBySkuUsage(self
,Pcds
):
867 available_sku
= self
.SkuIdMgr
.AvailableSkuIdSet
868 sku_usage
= self
.SkuIdMgr
.SkuUsageType
869 if sku_usage
== SkuClass
.SINGLE
:
872 Pcds
[pcdname
].SkuInfoList
= {"DEFAULT":pcd
.SkuInfoList
[skuid
] for skuid
in pcd
.SkuInfoList
if skuid
in available_sku
}
873 if type(pcd
) is StructurePcd
and pcd
.SkuOverrideValues
:
874 Pcds
[pcdname
].SkuOverrideValues
= {"DEFAULT":pcd
.SkuOverrideValues
[skuid
] for skuid
in pcd
.SkuOverrideValues
if skuid
in available_sku
}
878 Pcds
[pcdname
].SkuInfoList
= {skuid
:pcd
.SkuInfoList
[skuid
] for skuid
in pcd
.SkuInfoList
if skuid
in available_sku
}
879 if type(pcd
) is StructurePcd
and pcd
.SkuOverrideValues
:
880 Pcds
[pcdname
].SkuOverrideValues
= {skuid
:pcd
.SkuOverrideValues
[skuid
] for skuid
in pcd
.SkuOverrideValues
if skuid
in available_sku
}
882 def CompleteHiiPcdsDefaultStores(self
,Pcds
):
883 HiiPcd
= [Pcds
[pcd
] for pcd
in Pcds
if Pcds
[pcd
].Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]]
884 DefaultStoreMgr
= DefaultStore(self
.DefaultStores
)
886 for skuid
in pcd
.SkuInfoList
:
887 skuobj
= pcd
.SkuInfoList
.get(skuid
)
888 if "STANDARD" not in skuobj
.DefaultStoreDict
:
889 PcdDefaultStoreSet
= set([defaultstorename
for defaultstorename
in skuobj
.DefaultStoreDict
])
890 mindefaultstorename
= DefaultStoreMgr
.GetMin(PcdDefaultStoreSet
)
891 skuobj
.DefaultStoreDict
['STANDARD'] = copy
.deepcopy(skuobj
.DefaultStoreDict
[mindefaultstorename
])
894 def RecoverCommandLinePcd(self
):
896 if GlobalData
.BuildOptionPcd
:
897 for pcd
in GlobalData
.BuildOptionPcd
:
899 pcdset
.append((pcd
[0],pcd
[1],pcd
[3]))
901 if (pcd
[1],pcd
[0]) not in self
._Pcds
:
902 pcdvalue
= pcd
[3] if len(pcd
) == 4 else pcd
[2]
903 pcdset
.append((pcd
[0],pcd
[1],pcdvalue
))
905 # remove the settings from command line since it has been handled.
906 GlobalData
.BuildOptionPcd
= pcdset
907 def GetFieldValueFromComm(self
,ValueStr
,TokenSpaceGuidCName
, TokenCName
, FieldName
):
908 PredictedFieldType
= "VOID*"
909 if ValueStr
.startswith('L'):
911 EdkLogger
.error("build", FORMAT_INVALID
, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
912 ValueStr
= ValueStr
[0] + '"' + ValueStr
[1:] + '"'
913 PredictedFieldType
= "VOID*"
914 elif ValueStr
.startswith('H') or ValueStr
.startswith('{'):
915 EdkLogger
.error("build", FORMAT_INVALID
, 'Currently we do not support assign H"{...}" format for Pcd field.', ExtraData
="%s.%s.%s from command line" % (TokenSpaceGuidCName
, TokenCName
, FieldName
))
916 ValueStr
= ValueStr
[1:]
917 PredictedFieldType
= "VOID*"
918 elif ValueStr
.upper() in ['TRUE', '0X1', '0X01', '1', 'FALSE', '0X0', '0X00', '0']:
919 PredictedFieldType
= "BOOLEAN"
920 elif ValueStr
.isdigit() or ValueStr
.upper().startswith('0X'):
921 PredictedFieldType
= TAB_UINT16
924 EdkLogger
.error("build", FORMAT_INVALID
, 'For Void* type PCD, when specify the Value in the command line, please use the following format: "string", L"string", H"{...}"')
925 ValueStr
= '"' + ValueStr
+ '"'
926 PredictedFieldType
= "VOID*"
927 IsValid
, Cause
= CheckPcdDatum(PredictedFieldType
, ValueStr
)
929 EdkLogger
.error("build", FORMAT_INVALID
, Cause
, ExtraData
="%s.%s.%s from command line" % (TokenSpaceGuidCName
, TokenCName
, FieldName
))
930 if PredictedFieldType
== 'BOOLEAN':
931 ValueStr
= ValueStr
.upper()
932 if ValueStr
== 'TRUE' or ValueStr
== '1':
934 elif ValueStr
== 'FALSE' or ValueStr
== '0':
937 def __ParsePcdFromCommandLine(self
):
938 if GlobalData
.BuildOptionPcd
:
939 for i
, pcd
in enumerate(GlobalData
.BuildOptionPcd
):
940 if type(pcd
) is tuple:
942 (pcdname
, pcdvalue
) = pcd
.split('=')
944 EdkLogger
.error('build', AUTOGEN_ERROR
, "No Value specified for the PCD %s." % (pcdname
))
946 (Name1
, Name2
) = pcdname
.split('.',1)
948 (Name3
, FieldName
) = Name2
.split(".",1)
949 if ((Name3
,Name1
)) in self
.DecPcds
:
952 TokenSpaceGuidCName
= Name1
956 TokenSpaceGuidCName
= ''
957 HasTokenSpace
= False
959 if ((Name2
,Name1
)) in self
.DecPcds
:
962 TokenSpaceGuidCName
= Name1
967 TokenSpaceGuidCName
= ''
968 HasTokenSpace
= False
972 TokenSpaceGuidCName
= ''
973 HasTokenSpace
= False
974 TokenSpaceGuidCNameList
= []
978 if not HasTokenSpace
:
979 for key
in self
.DecPcds
:
980 if TokenCName
== key
[0]:
981 if TokenSpaceGuidCName
:
985 "The Pcd %s is found under multiple different TokenSpaceGuid: %s and %s." % (TokenCName
, TokenSpaceGuidCName
, key
[1])
988 TokenSpaceGuidCName
= key
[1]
991 if (TokenCName
, TokenSpaceGuidCName
) in self
.DecPcds
:
994 NewValue
= self
.GetFieldValueFromComm(pcdvalue
, TokenSpaceGuidCName
, TokenCName
, FieldName
)
995 GlobalData
.BuildOptionPcd
[i
] = (TokenSpaceGuidCName
, TokenCName
, FieldName
,NewValue
,("build command options",1))
997 # Replace \' to ', \\\' to \'
998 pcdvalue
= pcdvalue
.replace("\\\\\\'", '\\\\\\"').replace('\\\'', '\'').replace('\\\\\\"', "\\'")
999 for key
in self
.DecPcds
:
1000 PcdItem
= self
.DecPcds
[key
]
1002 if (PcdItem
.TokenCName
, PcdItem
.TokenSpaceGuidCName
) == (TokenCName
, TokenSpaceGuidCName
):
1003 PcdDatumType
= PcdItem
.DatumType
1004 if pcdvalue
.startswith('H'):
1006 pcdvalue
= ValueExpressionEx(pcdvalue
[1:], PcdDatumType
, self
._GuidDict
)(True)
1007 except BadExpression
, Value
:
1008 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1009 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1010 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
, 'BOOLEAN']:
1011 pcdvalue
= 'H' + pcdvalue
1012 elif pcdvalue
.startswith("L'"):
1014 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1015 except BadExpression
, Value
:
1016 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1017 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1018 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
, 'BOOLEAN']:
1019 pcdvalue
= 'H' + pcdvalue
1020 elif pcdvalue
.startswith("'"):
1022 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1023 except BadExpression
, Value
:
1024 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1025 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1026 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
, 'BOOLEAN']:
1027 pcdvalue
= 'H' + pcdvalue
1028 elif pcdvalue
.startswith('L'):
1029 pcdvalue
= 'L"' + pcdvalue
[1:] + '"'
1031 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1032 except BadExpression
, Value
:
1033 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1034 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1037 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1038 except BadExpression
, Value
:
1040 pcdvalue
= '"' + pcdvalue
+ '"'
1041 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1042 except BadExpression
, Value
:
1043 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1044 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1045 NewValue
= BuildOptionPcdValueFormat(TokenSpaceGuidCName
, TokenCName
, PcdDatumType
, pcdvalue
)
1048 if PcdItem
.TokenCName
== TokenCName
:
1049 if not PcdItem
.TokenSpaceGuidCName
in TokenSpaceGuidCNameList
:
1050 if len (TokenSpaceGuidCNameList
) < 1:
1051 TokenSpaceGuidCNameList
.append(PcdItem
.TokenSpaceGuidCName
)
1052 PcdDatumType
= PcdItem
.DatumType
1053 TokenSpaceGuidCName
= PcdItem
.TokenSpaceGuidCName
1054 if pcdvalue
.startswith('H'):
1056 pcdvalue
= ValueExpressionEx(pcdvalue
[1:], PcdDatumType
, self
._GuidDict
)(True)
1057 except BadExpression
, Value
:
1058 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1059 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1060 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
,'BOOLEAN']:
1061 pcdvalue
= 'H' + pcdvalue
1062 elif pcdvalue
.startswith("L'"):
1064 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(
1066 except BadExpression
, Value
:
1067 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1068 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1069 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
, 'BOOLEAN']:
1070 pcdvalue
= 'H' + pcdvalue
1071 elif pcdvalue
.startswith("'"):
1073 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(
1075 except BadExpression
, Value
:
1076 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1077 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1078 if PcdDatumType
not in [TAB_UINT8
, TAB_UINT16
, TAB_UINT32
, TAB_UINT64
, 'BOOLEAN']:
1079 pcdvalue
= 'H' + pcdvalue
1080 elif pcdvalue
.startswith('L'):
1081 pcdvalue
= 'L"' + pcdvalue
[1:] + '"'
1083 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(
1085 except BadExpression
, Value
:
1086 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1087 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1090 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1091 except BadExpression
, Value
:
1093 pcdvalue
= '"' + pcdvalue
+ '"'
1094 pcdvalue
= ValueExpressionEx(pcdvalue
, PcdDatumType
, self
._GuidDict
)(True)
1095 except BadExpression
, Value
:
1096 EdkLogger
.error('Parser', FORMAT_INVALID
, 'PCD [%s.%s] Value "%s", %s' %
1097 (TokenSpaceGuidCName
, TokenCName
, pcdvalue
, Value
))
1098 NewValue
= BuildOptionPcdValueFormat(TokenSpaceGuidCName
, TokenCName
, PcdDatumType
, pcdvalue
)
1104 "The Pcd %s is found under multiple different TokenSpaceGuid: %s and %s." % (TokenCName
, PcdItem
.TokenSpaceGuidCName
, TokenSpaceGuidCNameList
[0])
1106 GlobalData
.BuildOptionPcd
[i
] = (TokenSpaceGuidCName
, TokenCName
, FieldName
,NewValue
,("build command options",1))
1109 EdkLogger
.error('build', AUTOGEN_ERROR
, "The Pcd %s.%s is not found in the DEC file." % (TokenSpaceGuidCName
, TokenCName
))
1111 EdkLogger
.error('build', AUTOGEN_ERROR
, "The Pcd %s is not found in the DEC file." % (TokenCName
))
1112 for BuildData
in self
._Bdb
._CACHE
_.values():
1113 if BuildData
.MetaFile
.Ext
== '.dec' or BuildData
.MetaFile
.Ext
== '.dsc':
1115 for key
in BuildData
.Pcds
:
1116 PcdItem
= BuildData
.Pcds
[key
]
1117 if (TokenSpaceGuidCName
, TokenCName
) == (PcdItem
.TokenSpaceGuidCName
, PcdItem
.TokenCName
) and FieldName
=="":
1118 PcdItem
.DefaultValue
= NewValue
1119 ## Retrieve all PCD settings in platform
1121 if self
._Pcds
== None:
1122 self
._Pcds
= sdict()
1123 self
.__ParsePcdFromCommandLine
()
1124 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FIXED_AT_BUILD
))
1125 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_PATCHABLE_IN_MODULE
))
1126 self
._Pcds
.update(self
._GetPcd
(MODEL_PCD_FEATURE_FLAG
))
1127 self
._Pcds
.update(self
._GetDynamicPcd
(MODEL_PCD_DYNAMIC_DEFAULT
))
1128 self
._Pcds
.update(self
._GetDynamicHiiPcd
(MODEL_PCD_DYNAMIC_HII
))
1129 self
._Pcds
.update(self
._GetDynamicVpdPcd
(MODEL_PCD_DYNAMIC_VPD
))
1130 self
._Pcds
.update(self
._GetDynamicPcd
(MODEL_PCD_DYNAMIC_EX_DEFAULT
))
1131 self
._Pcds
.update(self
._GetDynamicHiiPcd
(MODEL_PCD_DYNAMIC_EX_HII
))
1132 self
._Pcds
.update(self
._GetDynamicVpdPcd
(MODEL_PCD_DYNAMIC_EX_VPD
))
1134 self
._Pcds
= self
.CompletePcdValues(self
._Pcds
)
1135 self
._Pcds
= self
.UpdateStructuredPcds(MODEL_PCD_TYPE_LIST
, self
._Pcds
)
1136 self
._Pcds
= self
.CompleteHiiPcdsDefaultStores(self
._Pcds
)
1137 self
._Pcds
= self
._FilterPcdBySkuUsage
(self
._Pcds
)
1138 self
._Pcds
= self
.OverrideByFdfCommOverAll(self
._Pcds
)
1139 self
.RecoverCommandLinePcd()
1142 def _dumpPcdInfo(self
,Pcds
):
1145 if not pcdobj
.TokenCName
.startswith("Test"):
1147 for skuid
in pcdobj
.SkuInfoList
:
1148 if pcdobj
.Type
in (self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
],self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]):
1149 for storename
in pcdobj
.SkuInfoList
[skuid
].DefaultStoreDict
:
1150 print "PcdCName: %s, SkuName: %s, StoreName: %s, Value: %s" % (".".join((pcdobj
.TokenSpaceGuidCName
, pcdobj
.TokenCName
)), skuid
,storename
,str(pcdobj
.SkuInfoList
[skuid
].DefaultStoreDict
[storename
]))
1152 print "PcdCName: %s, SkuName: %s, Value: %s" % (".".join((pcdobj
.TokenSpaceGuidCName
, pcdobj
.TokenCName
)), skuid
,str(pcdobj
.SkuInfoList
[skuid
].DefaultValue
))
1153 ## Retrieve [BuildOptions]
1154 def _GetBuildOptions(self
):
1155 if self
._BuildOptions
== None:
1156 self
._BuildOptions
= sdict()
1158 # Retrieve build option for EDKII and EDK style module
1160 for CodeBase
in (EDKII_NAME
, EDK_NAME
):
1161 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
, CodeBase
]
1162 for ToolChainFamily
, ToolChain
, Option
, Dummy1
, Dummy2
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
1163 if Dummy3
.upper() != 'COMMON':
1165 CurKey
= (ToolChainFamily
, ToolChain
, CodeBase
)
1167 # Only flags can be appended
1169 if CurKey
not in self
._BuildOptions
or not ToolChain
.endswith('_FLAGS') or Option
.startswith('='):
1170 self
._BuildOptions
[CurKey
] = Option
1172 if ' ' + Option
not in self
._BuildOptions
[CurKey
]:
1173 self
._BuildOptions
[CurKey
] += ' ' + Option
1174 return self
._BuildOptions
1176 def GetBuildOptionsByModuleType(self
, Edk
, ModuleType
):
1177 if self
._ModuleTypeOptions
== None:
1178 self
._ModuleTypeOptions
= sdict()
1179 if (Edk
, ModuleType
) not in self
._ModuleTypeOptions
:
1181 self
._ModuleTypeOptions
[Edk
, ModuleType
] = options
1182 DriverType
= '%s.%s' % (Edk
, ModuleType
)
1183 CommonDriverType
= '%s.%s' % ('COMMON', ModuleType
)
1184 RecordList
= self
._RawData
[MODEL_META_DATA_BUILD_OPTION
, self
._Arch
]
1185 for ToolChainFamily
, ToolChain
, Option
, Dummy1
, Dummy2
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
1186 Type
= Dummy2
+ '.' + Dummy3
1187 if Type
.upper() == DriverType
.upper() or Type
.upper() == CommonDriverType
.upper():
1188 Key
= (ToolChainFamily
, ToolChain
, Edk
)
1189 if Key
not in options
or not ToolChain
.endswith('_FLAGS') or Option
.startswith('='):
1190 options
[Key
] = Option
1192 if ' ' + Option
not in options
[Key
]:
1193 options
[Key
] += ' ' + Option
1194 return self
._ModuleTypeOptions
[Edk
, ModuleType
]
1196 def GetStructurePcdInfo(self
, PcdSet
):
1197 structure_pcd_data
= {}
1199 if (item
[0],item
[1]) not in structure_pcd_data
:
1200 structure_pcd_data
[(item
[0],item
[1])] = []
1201 structure_pcd_data
[(item
[0],item
[1])].append(item
)
1203 return structure_pcd_data
1204 def OverrideByFdfComm(self
,StruPcds
):
1205 StructurePcdInCom
= {(item
[0],item
[1],item
[2] ):(item
[3],item
[4]) for item
in GlobalData
.BuildOptionPcd
if len(item
) == 5 and (item
[1],item
[0]) in StruPcds
} if GlobalData
.BuildOptionPcd
else {}
1206 GlobalPcds
= set([(item
[0],item
[1]) for item
in StructurePcdInCom
.keys()])
1207 for Pcd
in StruPcds
.values():
1208 if (Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
) not in GlobalPcds
:
1210 FieldValues
= {item
[2]:StructurePcdInCom
[item
] for item
in StructurePcdInCom
if (Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
) == (item
[0],item
[1]) and item
[2]}
1211 for sku
in Pcd
.SkuOverrideValues
:
1212 for defaultstore
in Pcd
.SkuOverrideValues
[sku
]:
1213 for field
in FieldValues
:
1214 if field
not in Pcd
.SkuOverrideValues
[sku
][defaultstore
]:
1215 Pcd
.SkuOverrideValues
[sku
][defaultstore
][field
] = ["","",""]
1216 Pcd
.SkuOverrideValues
[sku
][defaultstore
][field
][0] = FieldValues
[field
][0]
1217 Pcd
.SkuOverrideValues
[sku
][defaultstore
][field
][1] = FieldValues
[field
][1][0]
1218 Pcd
.SkuOverrideValues
[sku
][defaultstore
][field
][2] = FieldValues
[field
][1][1]
1220 def OverrideByFdfCommOverAll(self
,AllPcds
):
1221 def CheckStructureInComm(commpcds
):
1224 if len(commpcds
[0]) == 5:
1228 if CheckStructureInComm(GlobalData
.BuildOptionPcd
):
1229 StructurePcdInCom
= {(item
[0],item
[1],item
[2] ):(item
[3],item
[4]) for item
in GlobalData
.BuildOptionPcd
} if GlobalData
.BuildOptionPcd
else {}
1230 NoFiledValues
= {(item
[0],item
[1]):StructurePcdInCom
[item
] for item
in StructurePcdInCom
if not item
[2]}
1232 NoFiledValues
= {(item
[0],item
[1]):[item
[2]] for item
in GlobalData
.BuildOptionPcd
}
1233 for Guid
,Name
in NoFiledValues
:
1234 if (Name
,Guid
) in AllPcds
:
1235 Pcd
= AllPcds
.get((Name
,Guid
))
1236 Pcd
.DefaultValue
= NoFiledValues
[(Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
)][0]
1237 for sku
in Pcd
.SkuInfoList
:
1238 SkuInfo
= Pcd
.SkuInfoList
[sku
]
1239 if SkuInfo
.DefaultValue
:
1240 SkuInfo
.DefaultValue
= NoFiledValues
[(Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
)][0]
1242 SkuInfo
.HiiDefaultValue
= NoFiledValues
[(Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
)][0]
1243 for defaultstore
in SkuInfo
.DefaultStoreDict
:
1244 SkuInfo
.DefaultStoreDict
[defaultstore
] = NoFiledValues
[(Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
)][0]
1246 PcdInDec
= self
.DecPcds
.get((Name
,Guid
))
1248 if PcdInDec
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_FIXED_AT_BUILD
],
1249 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_PATCHABLE_IN_MODULE
]]:
1250 self
.Pcds
[Name
, Guid
] = copy
.deepcopy(PcdInDec
)
1251 self
.Pcds
[Name
, Guid
].DefaultValue
= NoFiledValues
[( Guid
,Name
)][0]
1253 def UpdateStructuredPcds(self
, TypeList
, AllPcds
):
1255 DynamicPcdType
= [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_DEFAULT
],
1256 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
],
1257 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_VPD
],
1258 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_DEFAULT
],
1259 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
],
1260 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_VPD
]]
1263 DefaultStoreMgr
= DefaultStore(self
.DefaultStores
)
1264 SkuIds
= self
.SkuIdMgr
.AvailableSkuIdSet
1265 SkuIds
.update({'DEFAULT':0})
1266 DefaultStores
= set([storename
for pcdobj
in AllPcds
.values() for skuobj
in pcdobj
.SkuInfoList
.values() for storename
in skuobj
.DefaultStoreDict
.keys()])
1269 # Find out all possible PCD candidates for self._Arch
1272 for Type
in TypeList
:
1273 RecordList
.extend(self
._RawData
[Type
, self
._Arch
])
1275 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, SkuName
, default_store
, Dummy4
,Dummy5
in RecordList
:
1276 SkuName
= SkuName
.upper()
1277 default_store
= default_store
.upper()
1278 SkuName
= 'DEFAULT' if SkuName
== 'COMMON' else SkuName
1279 if SkuName
not in SkuIds
:
1282 if SkuName
in SkuIds
and "." in TokenSpaceGuid
:
1283 S_PcdSet
.append([ TokenSpaceGuid
.split(".")[0],TokenSpaceGuid
.split(".")[1], PcdCName
,SkuName
, default_store
,Dummy5
, AnalyzePcdExpression(Setting
)[0]])
1285 # handle pcd value override
1286 StrPcdSet
= self
.GetStructurePcdInfo(S_PcdSet
)
1288 for str_pcd
in StrPcdSet
:
1289 str_pcd_obj
= Pcds
.get((str_pcd
[1], str_pcd
[0]), None)
1290 str_pcd_dec
= self
._DecPcds
.get((str_pcd
[1], str_pcd
[0]), None)
1291 if not isinstance (str_pcd_dec
, StructurePcd
):
1292 EdkLogger
.error('build', PARSER_ERROR
,
1293 "Pcd (%s.%s) is not declared as Structure PCD in DEC files. Arch: ['%s']" % (str_pcd
[0], str_pcd
[1], self
._Arch
),
1294 File
=self
.MetaFile
,Line
= StrPcdSet
[str_pcd
][0][5])
1296 str_pcd_obj_str
= StructurePcd()
1297 str_pcd_obj_str
.copy(str_pcd_dec
)
1299 str_pcd_obj_str
.copy(str_pcd_obj
)
1300 if str_pcd_obj
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
1301 str_pcd_obj_str
.DefaultFromDSC
= {skuname
:{defaultstore
: str_pcd_obj
.SkuInfoList
[skuname
].DefaultStoreDict
.get(defaultstore
, str_pcd_obj
.SkuInfoList
[skuname
].HiiDefaultValue
) for defaultstore
in DefaultStores
} for skuname
in str_pcd_obj
.SkuInfoList
}
1303 str_pcd_obj_str
.DefaultFromDSC
= {skuname
:{defaultstore
: str_pcd_obj
.SkuInfoList
[skuname
].DefaultStoreDict
.get(defaultstore
, str_pcd_obj
.SkuInfoList
[skuname
].DefaultValue
) for defaultstore
in DefaultStores
} for skuname
in str_pcd_obj
.SkuInfoList
}
1304 for str_pcd_data
in StrPcdSet
[str_pcd
]:
1305 if str_pcd_data
[3] in SkuIds
:
1306 str_pcd_obj_str
.AddOverrideValue(str_pcd_data
[2], str(str_pcd_data
[6]), 'DEFAULT' if str_pcd_data
[3] == 'COMMON' else str_pcd_data
[3],'STANDARD' if str_pcd_data
[4] == 'COMMON' else str_pcd_data
[4], self
.MetaFile
.File
if self
.WorkspaceDir
not in self
.MetaFile
.File
else self
.MetaFile
.File
[len(self
.WorkspaceDir
) if self
.WorkspaceDir
.endswith(os
.path
.sep
) else len(self
.WorkspaceDir
)+1:],LineNo
=str_pcd_data
[5])
1307 S_pcd_set
[str_pcd
[1], str_pcd
[0]] = str_pcd_obj_str
1309 EdkLogger
.error('build', PARSER_ERROR
,
1310 "Pcd (%s.%s) defined in DSC is not declared in DEC files. Arch: ['%s']" % (str_pcd
[0], str_pcd
[1], self
._Arch
),
1311 File
=self
.MetaFile
,Line
= StrPcdSet
[str_pcd
][0][5])
1312 # Add the Structure PCD that only defined in DEC, don't have override in DSC file
1313 for Pcd
in self
.DecPcds
:
1314 if type (self
._DecPcds
[Pcd
]) is StructurePcd
:
1315 if Pcd
not in S_pcd_set
:
1316 str_pcd_obj_str
= StructurePcd()
1317 str_pcd_obj_str
.copy(self
._DecPcds
[Pcd
])
1318 str_pcd_obj
= Pcds
.get(Pcd
, None)
1320 str_pcd_obj_str
.copy(str_pcd_obj
)
1321 if str_pcd_obj
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
1322 str_pcd_obj_str
.DefaultFromDSC
= {skuname
:{defaultstore
: str_pcd_obj
.SkuInfoList
[skuname
].DefaultStoreDict
.get(defaultstore
, str_pcd_obj
.SkuInfoList
[skuname
].HiiDefaultValue
) for defaultstore
in DefaultStores
} for skuname
in str_pcd_obj
.SkuInfoList
}
1324 str_pcd_obj_str
.DefaultFromDSC
= {skuname
:{defaultstore
: str_pcd_obj
.SkuInfoList
[skuname
].DefaultStoreDict
.get(defaultstore
, str_pcd_obj
.SkuInfoList
[skuname
].DefaultValue
) for defaultstore
in DefaultStores
} for skuname
in str_pcd_obj
.SkuInfoList
}
1325 S_pcd_set
[Pcd
] = str_pcd_obj_str
1327 GlobalData
.gStructurePcd
[self
.Arch
] = S_pcd_set
1328 for stru_pcd
in S_pcd_set
.values():
1329 for skuid
in SkuIds
:
1330 if skuid
in stru_pcd
.SkuOverrideValues
:
1332 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(skuid
)
1334 while nextskuid
not in stru_pcd
.SkuOverrideValues
:
1335 if nextskuid
== "DEFAULT":
1338 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(nextskuid
)
1339 stru_pcd
.SkuOverrideValues
[skuid
] = copy
.deepcopy(stru_pcd
.SkuOverrideValues
[nextskuid
]) if not NoDefault
else copy
.deepcopy({defaultstorename
: stru_pcd
.DefaultValues
for defaultstorename
in DefaultStores
} if DefaultStores
else {'STANDARD':stru_pcd
.DefaultValues
})
1340 if stru_pcd
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
1341 for skuid
in SkuIds
:
1344 if skuid
not in stru_pcd
.SkuOverrideValues
:
1345 while nextskuid
not in stru_pcd
.SkuOverrideValues
:
1346 if nextskuid
== "DEFAULT":
1349 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(nextskuid
)
1352 PcdDefaultStoreSet
= set([defaultstorename
for defaultstorename
in stru_pcd
.SkuOverrideValues
[nextskuid
]])
1353 mindefaultstorename
= DefaultStoreMgr
.GetMin(PcdDefaultStoreSet
)
1355 for defaultstoreid
in DefaultStores
:
1356 if defaultstoreid
not in stru_pcd
.SkuOverrideValues
[skuid
]:
1357 stru_pcd
.SkuOverrideValues
[skuid
][defaultstoreid
] = copy
.deepcopy(stru_pcd
.SkuOverrideValues
[nextskuid
][mindefaultstorename
])
1358 S_pcd_set
= self
.OverrideByFdfComm(S_pcd_set
)
1359 Str_Pcd_Values
= self
.GenerateByteArrayValue(S_pcd_set
)
1361 for (skuname
,StoreName
,PcdGuid
,PcdName
,PcdValue
) in Str_Pcd_Values
:
1362 str_pcd_obj
= S_pcd_set
.get((PcdName
, PcdGuid
))
1363 if str_pcd_obj
is None:
1364 print PcdName
, PcdGuid
1366 if str_pcd_obj
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
],
1367 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
1368 if skuname
not in str_pcd_obj
.SkuInfoList
:
1369 str_pcd_obj
.SkuInfoList
[skuname
] = SkuInfoClass(SkuIdName
=skuname
, SkuId
=self
.SkuIds
[skuname
][0], HiiDefaultValue
=PcdValue
, DefaultStore
= {StoreName
:PcdValue
})
1371 str_pcd_obj
.SkuInfoList
[skuname
].HiiDefaultValue
= PcdValue
1372 str_pcd_obj
.SkuInfoList
[skuname
].DefaultStoreDict
.update({StoreName
:PcdValue
})
1373 elif str_pcd_obj
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_FIXED_AT_BUILD
],
1374 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_PATCHABLE_IN_MODULE
]]:
1375 if skuname
in (self
.SkuIdMgr
.SystemSkuId
, 'DEFAULT', 'COMMON'):
1376 str_pcd_obj
.DefaultValue
= PcdValue
1378 if skuname
not in str_pcd_obj
.SkuInfoList
:
1379 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(skuname
)
1381 while nextskuid
not in str_pcd_obj
.SkuInfoList
:
1382 if nextskuid
== "DEFAULT":
1385 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(nextskuid
)
1386 str_pcd_obj
.SkuInfoList
[skuname
] = copy
.deepcopy(str_pcd_obj
.SkuInfoList
[nextskuid
]) if not NoDefault
else SkuInfoClass(SkuIdName
=skuname
, SkuId
=self
.SkuIds
[skuname
][0], DefaultValue
=PcdValue
)
1387 str_pcd_obj
.SkuInfoList
[skuname
].SkuId
= self
.SkuIds
[skuname
][0]
1388 str_pcd_obj
.SkuInfoList
[skuname
].SkuIdName
= skuname
1390 str_pcd_obj
.SkuInfoList
[skuname
].DefaultValue
= PcdValue
1391 for str_pcd_obj
in S_pcd_set
.values():
1392 if str_pcd_obj
.Type
not in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
],
1393 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
1395 PcdDefaultStoreSet
= set([defaultstorename
for skuobj
in str_pcd_obj
.SkuInfoList
.values() for defaultstorename
in skuobj
.DefaultStoreDict
])
1396 DefaultStoreObj
= DefaultStore(self
._GetDefaultStores
())
1397 mindefaultstorename
= DefaultStoreObj
.GetMin(PcdDefaultStoreSet
)
1398 str_pcd_obj
.SkuInfoList
[self
.SkuIdMgr
.SystemSkuId
].HiiDefaultValue
= str_pcd_obj
.SkuInfoList
[self
.SkuIdMgr
.SystemSkuId
].DefaultStoreDict
[mindefaultstorename
]
1400 for str_pcd_obj
in S_pcd_set
.values():
1402 str_pcd_obj
.MaxDatumSize
= self
.GetStructurePcdMaxSize(str_pcd_obj
)
1403 Pcds
[str_pcd_obj
.TokenCName
, str_pcd_obj
.TokenSpaceGuidCName
] = str_pcd_obj
1407 if 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
1408 pcd
.SkuInfoList
['DEFAULT'] = pcd
.SkuInfoList
['COMMON']
1409 del(pcd
.SkuInfoList
['COMMON'])
1410 elif 'DEFAULT' in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
1411 del(pcd
.SkuInfoList
['COMMON'])
1413 map(self
.FilterSkuSettings
,[Pcds
[pcdkey
] for pcdkey
in Pcds
if Pcds
[pcdkey
].Type
in DynamicPcdType
])
1416 ## Retrieve non-dynamic PCD settings
1418 # @param Type PCD type
1420 # @retval a dict object contains settings of given PCD type
1422 def _GetPcd(self
, Type
):
1425 # tdict is a special dict kind of type, used for selecting correct
1426 # PCD settings for certain ARCH
1428 AvailableSkuIdSet
= copy
.copy(self
.SkuIds
)
1430 PcdDict
= tdict(True, 3)
1432 # Find out all possible PCD candidates for self._Arch
1433 RecordList
= self
._RawData
[Type
, self
._Arch
]
1434 PcdValueDict
= sdict()
1435 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, SkuName
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
1436 SkuName
= SkuName
.upper()
1437 SkuName
= 'DEFAULT' if SkuName
== 'COMMON' else SkuName
1438 if SkuName
not in AvailableSkuIdSet
:
1439 EdkLogger
.error('build ', PARAMETER_INVALID
, 'Sku %s is not defined in [SkuIds] section' % SkuName
,
1440 File
=self
.MetaFile
, Line
=Dummy5
)
1441 if SkuName
in (self
.SkuIdMgr
.SystemSkuId
, 'DEFAULT', 'COMMON'):
1442 if "." not in TokenSpaceGuid
:
1443 PcdSet
.add((PcdCName
, TokenSpaceGuid
, SkuName
, Dummy5
))
1444 PcdDict
[Arch
, PcdCName
, TokenSpaceGuid
, SkuName
] = Setting
1446 for PcdCName
, TokenSpaceGuid
, SkuName
, Dummy4
in PcdSet
:
1447 Setting
= PcdDict
[self
._Arch
, PcdCName
, TokenSpaceGuid
, SkuName
]
1450 PcdValue
, DatumType
, MaxDatumSize
= self
._ValidatePcd
(PcdCName
, TokenSpaceGuid
, Setting
, Type
, Dummy4
)
1451 if (PcdCName
, TokenSpaceGuid
) in PcdValueDict
:
1452 PcdValueDict
[PcdCName
, TokenSpaceGuid
][SkuName
] = (PcdValue
, DatumType
, MaxDatumSize
)
1454 PcdValueDict
[PcdCName
, TokenSpaceGuid
] = {SkuName
:(PcdValue
, DatumType
, MaxDatumSize
)}
1456 PcdsKeys
= PcdValueDict
.keys()
1457 for PcdCName
, TokenSpaceGuid
in PcdsKeys
:
1459 PcdSetting
= PcdValueDict
[PcdCName
, TokenSpaceGuid
]
1463 if 'COMMON' in PcdSetting
:
1464 PcdValue
, DatumType
, MaxDatumSize
= PcdSetting
['COMMON']
1465 if 'DEFAULT' in PcdSetting
:
1466 PcdValue
, DatumType
, MaxDatumSize
= PcdSetting
['DEFAULT']
1467 if self
.SkuIdMgr
.SystemSkuId
in PcdSetting
:
1468 PcdValue
, DatumType
, MaxDatumSize
= PcdSetting
[self
.SkuIdMgr
.SystemSkuId
]
1470 Pcds
[PcdCName
, TokenSpaceGuid
] = PcdClassObject(
1473 self
._PCD
_TYPE
_STRING
_[Type
],
1486 def __UNICODE2OCTList(self
,Value
):
1487 Value
= Value
.strip()
1491 Temp
= '%04X' % ord(Item
)
1492 List
.append('0x' + Temp
[2:4])
1493 List
.append('0x' + Temp
[0:2])
1497 def __STRING2OCTList(self
,Value
):
1499 Value
= Value
.strip('"')
1501 Temp
= '%02X' % ord(char
)
1502 OCTList
.append('0x' + Temp
)
1503 OCTList
.append('0x00')
1506 def GetStructurePcdMaxSize(self
, str_pcd
):
1507 pcd_default_value
= str_pcd
.DefaultValue
1508 sku_values
= [skuobj
.HiiDefaultValue
if str_pcd
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]] else skuobj
.DefaultValue
for skuobj
in str_pcd
.SkuInfoList
.values()]
1509 sku_values
.append(pcd_default_value
)
1511 def get_length(value
):
1512 Value
= value
.strip()
1514 if Value
.startswith('GUID') and Value
.endswith(')'):
1516 if Value
.startswith('L"') and Value
.endswith('"'):
1517 return len(Value
[2:-1])
1518 if Value
[0] == '"' and Value
[-1] == '"':
1519 return len(Value
) - 2
1520 if Value
[0] == '{' and Value
[-1] == '}':
1521 return len(Value
.split(","))
1522 if Value
.startswith("L'") and Value
.endswith("'") and len(list(Value
[2:-1])) > 1:
1523 return len(list(Value
[2:-1]))
1524 if Value
[0] == "'" and Value
[-1] == "'" and len(list(Value
[1:-1])) > 1:
1525 return len(Value
) - 2
1528 return str(max([pcd_size
for pcd_size
in [get_length(item
) for item
in sku_values
]]))
1530 def IsFieldValueAnArray (self
, Value
):
1531 Value
= Value
.strip()
1532 if Value
.startswith('GUID') and Value
.endswith(')'):
1534 if Value
.startswith('L"') and Value
.endswith('"') and len(list(Value
[2:-1])) > 1:
1536 if Value
[0] == '"' and Value
[-1] == '"' and len(list(Value
[1:-1])) > 1:
1538 if Value
[0] == '{' and Value
[-1] == '}':
1540 if Value
.startswith("L'") and Value
.endswith("'") and len(list(Value
[2:-1])) > 1:
1541 print 'foo = ', list(Value
[2:-1])
1543 if Value
[0] == "'" and Value
[-1] == "'" and len(list(Value
[1:-1])) > 1:
1544 print 'bar = ', list(Value
[1:-1])
1548 def ExecuteCommand (self
, Command
):
1550 Process
= subprocess
.Popen(Command
, stdout
=subprocess
.PIPE
, stderr
=subprocess
.PIPE
, shell
=True)
1552 EdkLogger
.error('Build', COMMAND_FAILURE
, 'Can not execute command: %s' % Command
)
1553 Result
= Process
.communicate()
1554 return Process
.returncode
, Result
[0], Result
[1]
1556 def IntToCString(self
, Value
, ValueSize
):
1558 if not isinstance (Value
, str):
1559 for Index
in range(0, ValueSize
):
1560 Result
= Result
+ '\\x%02x' % (Value
& 0xff)
1562 Result
= Result
+ '"'
1565 def GenerateInitializeFunc(self
, SkuName
, DefaultStoreName
, Pcd
, InitByteValue
, CApp
):
1566 OverrideValues
= {DefaultStoreName
:""}
1567 if Pcd
.SkuOverrideValues
:
1568 OverrideValues
= Pcd
.SkuOverrideValues
[SkuName
]
1569 for DefaultStoreName
in OverrideValues
.keys():
1570 CApp
= CApp
+ 'void\n'
1571 CApp
= CApp
+ 'Initialize_%s_%s_%s_%s(\n' % (SkuName
, DefaultStoreName
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
)
1572 CApp
= CApp
+ ' void\n'
1573 CApp
= CApp
+ ' )\n'
1575 CApp
= CApp
+ ' UINT32 Size;\n'
1576 CApp
= CApp
+ ' UINT32 FieldSize;\n'
1577 CApp
= CApp
+ ' CHAR8 *Value;\n'
1578 CApp
= CApp
+ ' UINT32 OriginalSize;\n'
1579 CApp
= CApp
+ ' VOID *OriginalPcd;\n'
1580 CApp
= CApp
+ ' %s *Pcd; // From %s Line %d \n' % (Pcd
.DatumType
, Pcd
.PkgPath
, Pcd
.PcdDefineLineNo
)
1583 if SkuName
in Pcd
.SkuInfoList
:
1584 DefaultValue
= Pcd
.SkuInfoList
[SkuName
].DefaultStoreDict
.get(DefaultStoreName
,Pcd
.SkuInfoList
[SkuName
].HiiDefaultValue
) if Pcd
.SkuInfoList
[SkuName
].HiiDefaultValue
else Pcd
.SkuInfoList
[SkuName
].DefaultValue
1586 DefaultValue
= Pcd
.DefaultValue
1587 PcdDefaultValue
= StringToArray(DefaultValue
.strip())
1589 InitByteValue
+= '%s.%s.%s.%s|%s|%s\n' % (SkuName
, DefaultStoreName
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, Pcd
.DatumType
, PcdDefaultValue
)
1592 # Get current PCD value and size
1594 CApp
= CApp
+ ' OriginalPcd = PcdGetPtr (%s, %s, %s, %s, &OriginalSize);\n' % (SkuName
, DefaultStoreName
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
)
1597 # Determine the size of the PCD. For simple structures, sizeof(TYPE) provides
1598 # the correct value. For structures with a flexible array member, the flexible
1599 # array member is detected, and the size is based on the highest index used with
1600 # the flexible array member. The flexible array member must be the last field
1601 # in a structure. The size formula for this case is:
1602 # OFFSET_OF(FlexbleArrayField) + sizeof(FlexibleArray[0]) * (HighestIndex + 1)
1604 CApp
= CApp
+ ' Size = sizeof(%s);\n' % (Pcd
.DatumType
)
1605 CApp
= CApp
+ "// Default Value in Dec \n"
1606 for FieldList
in [Pcd
.DefaultValues
]:
1609 for FieldName
in FieldList
:
1610 FieldName
= "." + FieldName
1611 IsArray
= self
.IsFieldValueAnArray(FieldList
[FieldName
.strip(".")][0])
1614 Value
= ValueExpressionEx(FieldList
[FieldName
.strip(".")][0], "VOID*", self
._GuidDict
)(True)
1615 except BadExpression
:
1616 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " %
1617 (".".join((Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, FieldName
.strip('.'))), FieldList
[FieldName
.strip(".")][1], FieldList
[FieldName
.strip(".")][2]))
1618 Value
, ValueSize
= ParseFieldValue(Value
)
1619 CApp
= CApp
+ ' __FLEXIBLE_SIZE(Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s \n' % (Pcd
.DatumType
, FieldName
.strip("."), ValueSize
, Pcd
.DatumType
, FieldName
.strip("."), ValueSize
, Pcd
.DatumType
, FieldName
.strip("."), FieldList
[FieldName
.strip(".")][1], FieldList
[FieldName
.strip(".")][2], FieldList
[FieldName
.strip(".")][0]);
1622 FieldName_ori
= FieldName
.strip('.')
1623 while '[' in FieldName
:
1624 NewFieldName
= NewFieldName
+ FieldName
.split('[', 1)[0] + '[0]'
1625 ArrayIndex
= int(FieldName
.split('[', 1)[1].split(']', 1)[0])
1626 FieldName
= FieldName
.split(']', 1)[1]
1627 FieldName
= NewFieldName
+ FieldName
1628 while '[' in FieldName
:
1629 FieldName
= FieldName
.rsplit('[', 1)[0]
1630 CApp
= CApp
+ ' __FLEXIBLE_SIZE(Size, %s, %s, %d); // From %s Line %d Value %s\n' % (Pcd
.DatumType
, FieldName
.strip("."), ArrayIndex
+ 1, FieldList
[FieldName_ori
][1], FieldList
[FieldName_ori
][2], FieldList
[FieldName_ori
][0])
1631 for skuname
in self
.SkuIdMgr
.GetSkuChain(SkuName
):
1632 inherit_OverrideValues
= Pcd
.SkuOverrideValues
[skuname
]
1633 storeset
= [DefaultStoreName
] if DefaultStoreName
== 'STANDARD' else ['STANDARD', DefaultStoreName
]
1634 for defaultstorenameitem
in storeset
:
1635 CApp
= CApp
+ "// SkuName: %s, DefaultStoreName: %s \n" % (skuname
, defaultstorenameitem
)
1636 for FieldList
in [inherit_OverrideValues
.get(defaultstorenameitem
)]:
1639 for FieldName
in FieldList
:
1640 FieldName
= "." + FieldName
1641 IsArray
= self
.IsFieldValueAnArray(FieldList
[FieldName
.strip(".")][0])
1644 Value
= ValueExpressionEx(FieldList
[FieldName
.strip(".")][0], "VOID*", self
._GuidDict
)(True)
1645 except BadExpression
:
1646 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " %
1647 (".".join((Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, FieldName
.strip('.'))), FieldList
[FieldName
.strip(".")][1], FieldList
[FieldName
.strip(".")][2]))
1648 Value
, ValueSize
= ParseFieldValue(Value
)
1649 CApp
= CApp
+ ' __FLEXIBLE_SIZE(Size, %s, %s, %d / __ARRAY_ELEMENT_SIZE(%s, %s) + ((%d %% __ARRAY_ELEMENT_SIZE(%s, %s)) ? 1 : 0)); // From %s Line %d Value %s\n' % (Pcd
.DatumType
, FieldName
.strip("."), ValueSize
, Pcd
.DatumType
, FieldName
.strip("."), ValueSize
, Pcd
.DatumType
, FieldName
.strip("."), FieldList
[FieldName
.strip(".")][1], FieldList
[FieldName
.strip(".")][2], FieldList
[FieldName
.strip(".")][0]);
1652 FieldName_ori
= FieldName
.strip('.')
1653 while '[' in FieldName
:
1654 NewFieldName
= NewFieldName
+ FieldName
.split('[', 1)[0] + '[0]'
1655 ArrayIndex
= int(FieldName
.split('[', 1)[1].split(']', 1)[0])
1656 FieldName
= FieldName
.split(']', 1)[1]
1657 FieldName
= NewFieldName
+ FieldName
1658 while '[' in FieldName
:
1659 FieldName
= FieldName
.rsplit('[', 1)[0]
1660 CApp
= CApp
+ ' __FLEXIBLE_SIZE(Size, %s, %s, %d); // From %s Line %d Value %s \n' % (Pcd
.DatumType
, FieldName
.strip("."), ArrayIndex
+ 1, FieldList
[FieldName_ori
][1], FieldList
[FieldName_ori
][2], FieldList
[FieldName_ori
][0])
1661 if skuname
== SkuName
:
1665 # Allocate and zero buffer for the PCD
1666 # Must handle cases where current value is smaller, larger, or same size
1667 # Always keep that larger one as the current size
1669 CApp
= CApp
+ ' Size = (OriginalSize > Size ? OriginalSize : Size);\n'
1670 CApp
= CApp
+ ' Pcd = (%s *)malloc (Size);\n' % (Pcd
.DatumType
)
1671 CApp
= CApp
+ ' memset (Pcd, 0, Size);\n'
1674 # Copy current PCD value into allocated buffer.
1676 CApp
= CApp
+ ' memcpy (Pcd, OriginalPcd, OriginalSize);\n'
1679 # Assign field values in PCD
1681 CApp
= CApp
+ "// Default value in Dec \n"
1682 DefaultValueFromDec
= Pcd
.DefaultValueFromDec
1683 IsArray
= self
.IsFieldValueAnArray(Pcd
.DefaultValueFromDec
)
1686 DefaultValueFromDec
= ValueExpressionEx(Pcd
.DefaultValueFromDec
, "VOID*")(True)
1687 except BadExpression
:
1688 EdkLogger
.error("Build", FORMAT_INVALID
, "Invalid value format for %s.%s, from DEC: %s" %
1689 (Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, DefaultValueFromDec
))
1690 Value
, ValueSize
= ParseFieldValue (DefaultValueFromDec
)
1691 if isinstance(Value
, str):
1692 CApp
= CApp
+ ' Pcd = %s; // From DEC Default Value %s\n' % (Value
, Pcd
.DefaultValueFromDec
)
1695 # Use memcpy() to copy value into field
1697 CApp
= CApp
+ ' Value = %s; // From DEC Default Value %s\n' % (self
.IntToCString(Value
, ValueSize
), Pcd
.DefaultValueFromDec
)
1698 CApp
= CApp
+ ' memcpy (Pcd, Value, %d);\n' % (ValueSize
)
1699 for FieldList
in [Pcd
.DefaultValues
]:
1702 for FieldName
in FieldList
:
1703 IsArray
= self
.IsFieldValueAnArray(FieldList
[FieldName
][0])
1706 FieldList
[FieldName
][0] = ValueExpressionEx(FieldList
[FieldName
][0], "VOID*", self
._GuidDict
)(True)
1707 except BadExpression
:
1708 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " %
1709 (".".join((Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, FieldName
)), FieldList
[FieldName
][1],FieldList
[FieldName
][2]))
1712 Value
, ValueSize
= ParseFieldValue (FieldList
[FieldName
][0])
1714 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
,FieldName
)),FieldList
[FieldName
][1], FieldList
[FieldName
][2]))
1715 if isinstance(Value
, str):
1716 CApp
= CApp
+ ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1719 # Use memcpy() to copy value into field
1721 CApp
= CApp
+ ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd
.DatumType
, FieldName
)
1722 CApp
= CApp
+ ' Value = %s; // From %s Line %d Value %s\n' % (self
.IntToCString(Value
, ValueSize
), FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1723 CApp
= CApp
+ ' memcpy (&Pcd->%s[0], Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName
, ValueSize
, ValueSize
)
1726 CApp
= CApp
+ ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1728 CApp
= CApp
+ ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1729 for skuname
in self
.SkuIdMgr
.GetSkuChain(SkuName
):
1730 inherit_OverrideValues
= Pcd
.SkuOverrideValues
[skuname
]
1731 storeset
= [DefaultStoreName
] if DefaultStoreName
== 'STANDARD' else ['STANDARD', DefaultStoreName
]
1732 for defaultstorenameitem
in storeset
:
1733 CApp
= CApp
+ "// SkuName: %s, DefaultStoreName: %s \n" % (skuname
, defaultstorenameitem
)
1734 pcddefaultvalue
= Pcd
.DefaultFromDSC
.get(skuname
,{}).get(defaultstorenameitem
, Pcd
.DefaultValue
) if Pcd
.DefaultFromDSC
else Pcd
.DefaultValue
1735 for FieldList
in [pcddefaultvalue
,inherit_OverrideValues
.get(defaultstorenameitem
)]:
1738 if pcddefaultvalue
and FieldList
== pcddefaultvalue
:
1739 IsArray
= self
.IsFieldValueAnArray(FieldList
)
1742 FieldList
= ValueExpressionEx(FieldList
, "VOID*")(True)
1743 except BadExpression
:
1744 EdkLogger
.error("Build", FORMAT_INVALID
, "Invalid value format for %s.%s, from DSC: %s" %
1745 (Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, FieldList
))
1746 Value
, ValueSize
= ParseFieldValue (FieldList
)
1747 if isinstance(Value
, str):
1748 CApp
= CApp
+ ' Pcd = %s; // From DSC Default Value %s\n' % (Value
, Pcd
.DefaultFromDSC
.get(skuname
,{}).get(defaultstorenameitem
, Pcd
.DefaultValue
) if Pcd
.DefaultFromDSC
else Pcd
.DefaultValue
)
1751 # Use memcpy() to copy value into field
1753 CApp
= CApp
+ ' Value = %s; // From DSC Default Value %s\n' % (self
.IntToCString(Value
, ValueSize
), Pcd
.DefaultFromDSC
.get(skuname
,{}).get(defaultstorenameitem
, Pcd
.DefaultValue
) if Pcd
.DefaultFromDSC
else Pcd
.DefaultValue
)
1754 CApp
= CApp
+ ' memcpy (Pcd, Value, %d);\n' % (ValueSize
)
1756 for FieldName
in FieldList
:
1757 IsArray
= self
.IsFieldValueAnArray(FieldList
[FieldName
][0])
1760 FieldList
[FieldName
][0] = ValueExpressionEx(FieldList
[FieldName
][0], "VOID*", self
._GuidDict
)(True)
1761 except BadExpression
:
1762 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " %
1763 (".".join((Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
, FieldName
)), FieldList
[FieldName
][1], FieldList
[FieldName
][2]))
1765 Value
, ValueSize
= ParseFieldValue (FieldList
[FieldName
][0])
1767 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid value format for %s. From %s Line %d " % (".".join((Pcd
.TokenSpaceGuidCName
,Pcd
.TokenCName
,FieldName
)),FieldList
[FieldName
][1], FieldList
[FieldName
][2]))
1768 if isinstance(Value
, str):
1769 CApp
= CApp
+ ' Pcd->%s = %s; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1772 # Use memcpy() to copy value into field
1774 CApp
= CApp
+ ' FieldSize = __FIELD_SIZE(%s, %s);\n' % (Pcd
.DatumType
, FieldName
)
1775 CApp
= CApp
+ ' Value = %s; // From %s Line %d Value %s\n' % (self
.IntToCString(Value
, ValueSize
), FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1776 CApp
= CApp
+ ' memcpy (&Pcd->%s[0], Value, (FieldSize > 0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName
, ValueSize
, ValueSize
)
1779 CApp
= CApp
+ ' Pcd->%s = %dULL; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1781 CApp
= CApp
+ ' Pcd->%s = %d; // From %s Line %d Value %s\n' % (FieldName
, Value
, FieldList
[FieldName
][1], FieldList
[FieldName
][2], FieldList
[FieldName
][0])
1782 if skuname
== SkuName
:
1785 # Set new PCD value and size
1787 CApp
= CApp
+ ' PcdSetPtr (%s, %s, %s, %s, Size, (UINT8 *)Pcd);\n' % (SkuName
, DefaultStoreName
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
)
1792 CApp
= CApp
+ ' free (Pcd);\n'
1795 return InitByteValue
, CApp
1797 def GenerateByteArrayValue (self
, StructuredPcds
):
1799 # Generate/Compile/Run C application to determine if there are any flexible array members
1801 if not StructuredPcds
:
1805 CApp
= PcdMainCHeader
1808 for PcdName
in StructuredPcds
:
1809 Pcd
= StructuredPcds
[PcdName
]
1810 for IncludeFile
in Pcd
.StructuredPcdIncludeFile
:
1811 if IncludeFile
not in Includes
:
1812 Includes
[IncludeFile
] = True
1813 CApp
= CApp
+ '#include <%s>\n' % (IncludeFile
)
1815 for PcdName
in StructuredPcds
:
1816 Pcd
= StructuredPcds
[PcdName
]
1817 if not Pcd
.SkuOverrideValues
or Pcd
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_FIXED_AT_BUILD
],
1818 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_PATCHABLE_IN_MODULE
]]:
1819 InitByteValue
, CApp
= self
.GenerateInitializeFunc(self
.SkuIdMgr
.SystemSkuId
, 'STANDARD', Pcd
, InitByteValue
, CApp
)
1821 for SkuName
in self
.SkuIdMgr
.SkuOverrideOrder():
1822 if SkuName
not in Pcd
.SkuOverrideValues
:
1824 for DefaultStoreName
in Pcd
.DefaultStoreName
:
1825 Pcd
= StructuredPcds
[PcdName
]
1826 InitByteValue
, CApp
= self
.GenerateInitializeFunc(SkuName
, DefaultStoreName
, Pcd
, InitByteValue
, CApp
)
1828 CApp
= CApp
+ 'VOID\n'
1829 CApp
= CApp
+ 'PcdEntryPoint(\n'
1830 CApp
= CApp
+ ' VOID\n'
1831 CApp
= CApp
+ ' )\n'
1833 for Pcd
in StructuredPcds
.values():
1834 if not Pcd
.SkuOverrideValues
or Pcd
.Type
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_FIXED_AT_BUILD
],self
._PCD
_TYPE
_STRING
_[MODEL_PCD_PATCHABLE_IN_MODULE
]]:
1835 CApp
= CApp
+ ' Initialize_%s_%s_%s_%s();\n' % (self
.SkuIdMgr
.SystemSkuId
, 'STANDARD', Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
)
1837 for SkuName
in self
.SkuIdMgr
.SkuOverrideOrder():
1838 if SkuName
not in Pcd
.SkuOverrideValues
:
1840 for DefaultStoreName
in Pcd
.SkuOverrideValues
[SkuName
]:
1841 CApp
= CApp
+ ' Initialize_%s_%s_%s_%s();\n' % (SkuName
, DefaultStoreName
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
)
1844 CApp
= CApp
+ PcdMainCEntry
+ '\n'
1846 if not os
.path
.exists(self
.OutputPath
):
1847 os
.makedirs(self
.OutputPath
)
1848 CAppBaseFileName
= os
.path
.join(self
.OutputPath
, PcdValueInitName
)
1849 SaveFileOnChange(CAppBaseFileName
+ '.c', CApp
, False)
1851 MakeApp
= PcdMakefileHeader
1852 if sys
.platform
== "win32":
1853 MakeApp
= MakeApp
+ 'APPNAME = %s\n' % (PcdValueInitName
) + 'OBJECTS = %s\%s.obj\n' % (self
.OutputPath
, PcdValueInitName
) + 'INC = '
1855 MakeApp
= MakeApp
+ PcdGccMakefile
1856 MakeApp
= MakeApp
+ 'APPNAME = %s\n' % (PcdValueInitName
) + 'OBJECTS = %s/%s.o\n' % (self
.OutputPath
, PcdValueInitName
) + \
1857 'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='
1860 for Cache
in self
._Bdb
._CACHE
_.values():
1861 if Cache
.MetaFile
.Ext
.lower() != '.dec':
1864 if str(Cache
.MetaFile
.Path
) not in PlatformInc
:
1865 PlatformInc
[str(Cache
.MetaFile
.Path
)] = Cache
.CommonIncludes
1868 for Pcd
in StructuredPcds
.values():
1869 for PackageDec
in Pcd
.PackageDecs
:
1870 Package
= os
.path
.normpath(mws
.join(GlobalData
.gWorkspace
, PackageDec
))
1871 if not os
.path
.exists(Package
):
1872 EdkLogger
.error('Build', RESOURCE_NOT_AVAILABLE
, "The dependent Package %s of PCD %s.%s is not exist." % (PackageDec
, Pcd
.TokenSpaceGuidCName
, Pcd
.TokenCName
))
1873 if Package
not in PcdDependDEC
:
1874 PcdDependDEC
.append(Package
)
1876 if PlatformInc
and PcdDependDEC
:
1877 for pkg
in PcdDependDEC
:
1878 if pkg
in PlatformInc
:
1879 for inc
in PlatformInc
[pkg
]:
1880 MakeApp
+= '-I' + str(inc
) + ' '
1881 MakeApp
= MakeApp
+ '\n'
1883 CC_FLAGS
= LinuxCFLAGS
1884 if sys
.platform
== "win32":
1885 CC_FLAGS
= WindowsCFLAGS
1887 for Options
in self
.BuildOptions
:
1888 if Options
[2] != EDKII_NAME
:
1891 if Family
and Family
!= self
.ToolChainFamily
:
1893 Target
, Tag
, Arch
, Tool
, Attr
= Options
[1].split("_")
1897 if Target
== "*" or Target
== self
._Target
:
1898 if Tag
== "*" or Tag
== self
._Toolchain
:
1899 if Arch
== "*" or Arch
== self
.Arch
:
1900 if Tool
not in BuildOptions
:
1901 BuildOptions
[Tool
] = {}
1902 if Attr
!= "FLAGS" or Attr
not in BuildOptions
[Tool
] or self
.BuildOptions
[Options
].startswith('='):
1903 BuildOptions
[Tool
][Attr
] = self
.BuildOptions
[Options
]
1905 # append options for the same tool except PATH
1907 BuildOptions
[Tool
][Attr
] += " " + self
.BuildOptions
[Options
]
1909 BuildOptions
[Tool
][Attr
] = self
.BuildOptions
[Options
]
1911 for Tool
in BuildOptions
:
1912 for Attr
in BuildOptions
[Tool
]:
1914 Value
= BuildOptions
[Tool
][Attr
]
1915 ValueList
= Value
.split()
1917 for Id
, Item
in enumerate(ValueList
):
1918 if Item
== '-D' or Item
== '/D':
1919 CC_FLAGS
+= ' ' + Item
1920 if Id
+ 1 < len(ValueList
):
1921 CC_FLAGS
+= ' ' + ValueList
[Id
+ 1]
1922 elif Item
.startswith('/D') or Item
.startswith('-D'):
1923 CC_FLAGS
+= ' ' + Item
1926 if sys
.platform
== "win32":
1927 MakeApp
= MakeApp
+ PcdMakefileEnd
1928 MakeFileName
= os
.path
.join(self
.OutputPath
, 'Makefile')
1929 SaveFileOnChange(MakeFileName
, MakeApp
, False)
1931 InputValueFile
= os
.path
.join(self
.OutputPath
, 'Input.txt')
1932 OutputValueFile
= os
.path
.join(self
.OutputPath
, 'Output.txt')
1933 SaveFileOnChange(InputValueFile
, InitByteValue
, False)
1935 PcdValueInitExe
= PcdValueInitName
1936 if not sys
.platform
== "win32":
1937 PcdValueInitExe
= os
.path
.join(os
.getenv("EDK_TOOLS_PATH"), 'Source', 'C', 'bin', PcdValueInitName
)
1939 PcdValueInitExe
= os
.path
.join(os
.getenv("EDK_TOOLS_PATH"), 'Bin', 'Win32', PcdValueInitName
) +".exe"
1940 if not os
.path
.exists(PcdValueInitExe
) or self
.NeedUpdateOutput(OutputValueFile
, CAppBaseFileName
+ '.c',MakeFileName
,InputValueFile
):
1942 if sys
.platform
== "win32":
1943 MakeCommand
= 'nmake clean & nmake -f %s' % (MakeFileName
)
1944 returncode
, StdOut
, StdErr
= self
.ExecuteCommand (MakeCommand
)
1947 MakeCommand
= 'make clean & make -f %s' % (MakeFileName
)
1948 returncode
, StdOut
, StdErr
= self
.ExecuteCommand (MakeCommand
)
1950 Messages
= Messages
.split('\n')
1953 CAppBaseFileName
= os
.path
.join(self
.OutputPath
, PcdValueInitName
)
1954 File
= open (CAppBaseFileName
+ '.c', 'r')
1955 FileData
= File
.readlines()
1957 for Message
in Messages
:
1958 if " error" in Message
or "warning" in Message
:
1959 FileInfo
= Message
.strip().split('(')
1960 if len (FileInfo
) > 1:
1961 FileName
= FileInfo
[0]
1962 FileLine
= FileInfo
[1].split (')')[0]
1964 FileInfo
= Message
.strip().split(':')
1965 FileName
= FileInfo
[0]
1966 FileLine
= FileInfo
[1]
1967 if FileLine
.isdigit():
1968 error_line
= FileData
[int (FileLine
) - 1]
1969 if r
"//" in error_line
:
1970 c_line
,dsc_line
= error_line
.split(r
"//")
1972 dsc_line
= error_line
1973 message_itmes
= Message
.split(":")
1975 if "PcdValueInit.c" not in Message
:
1976 if not MessageGroup
:
1977 MessageGroup
.append(Message
)
1980 for item
in message_itmes
:
1981 if "PcdValueInit.c" in item
:
1982 Index
= message_itmes
.index(item
)
1983 message_itmes
[Index
] = dsc_line
.strip()
1985 MessageGroup
.append(":".join(message_itmes
[Index
:]).strip())
1988 MessageGroup
.append(Message
)
1990 EdkLogger
.error("build", PCD_STRUCTURE_PCD_ERROR
, "\n".join(MessageGroup
) )
1992 EdkLogger
.error('Build', COMMAND_FAILURE
, 'Can not execute command: %s' % MakeCommand
)
1993 Command
= PcdValueInitExe
+ ' -i %s -o %s' % (InputValueFile
, OutputValueFile
)
1994 returncode
, StdOut
, StdErr
= self
.ExecuteCommand (Command
)
1996 EdkLogger
.warn('Build', COMMAND_FAILURE
, 'Can not collect output from command: %s' % Command
)
1998 File
= open (OutputValueFile
, 'r')
1999 FileBuffer
= File
.readlines()
2002 StructurePcdSet
= []
2003 for Pcd
in FileBuffer
:
2004 PcdValue
= Pcd
.split ('|')
2005 PcdInfo
= PcdValue
[0].split ('.')
2006 StructurePcdSet
.append((PcdInfo
[0],PcdInfo
[1], PcdInfo
[2], PcdInfo
[3], PcdValue
[2].strip()))
2007 return StructurePcdSet
2009 def NeedUpdateOutput(self
,OutputFile
, ValueCFile
, MakeFile
, StructureInput
):
2010 if not os
.path
.exists(OutputFile
):
2012 if os
.stat(OutputFile
).st_mtime
<= os
.stat(ValueCFile
).st_mtime
:
2014 if os
.stat(OutputFile
).st_mtime
<= os
.stat(MakeFile
).st_mtime
:
2016 if os
.stat(OutputFile
).st_mtime
<= os
.stat(StructureInput
).st_mtime
:
2020 ## Retrieve dynamic PCD settings
2022 # @param Type PCD type
2024 # @retval a dict object contains settings of given PCD type
2026 def _GetDynamicPcd(self
, Type
):
2031 # tdict is a special dict kind of type, used for selecting correct
2032 # PCD settings for certain ARCH and SKU
2034 PcdDict
= tdict(True, 4)
2036 # Find out all possible PCD candidates for self._Arch
2037 RecordList
= self
._RawData
[Type
, self
._Arch
]
2038 AvailableSkuIdSet
= copy
.copy(self
.SkuIds
)
2041 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, SkuName
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
2042 SkuName
= SkuName
.upper()
2043 SkuName
= 'DEFAULT' if SkuName
== 'COMMON' else SkuName
2044 if SkuName
not in AvailableSkuIdSet
:
2045 EdkLogger
.error('build', PARAMETER_INVALID
, 'Sku %s is not defined in [SkuIds] section' % SkuName
,
2046 File
=self
.MetaFile
, Line
=Dummy5
)
2047 if "." not in TokenSpaceGuid
:
2048 PcdList
.append((PcdCName
, TokenSpaceGuid
, SkuName
, Dummy5
))
2049 PcdDict
[Arch
, SkuName
, PcdCName
, TokenSpaceGuid
] = Setting
2051 # Remove redundant PCD candidates, per the ARCH and SKU
2052 for PcdCName
, TokenSpaceGuid
, SkuName
, Dummy4
in PcdList
:
2054 Setting
= PcdDict
[self
._Arch
, SkuName
, PcdCName
, TokenSpaceGuid
]
2058 PcdValue
, DatumType
, MaxDatumSize
= self
._ValidatePcd
(PcdCName
, TokenSpaceGuid
, Setting
, Type
, Dummy4
)
2059 SkuInfo
= SkuInfoClass(SkuName
, self
.SkuIds
[SkuName
][0], '', '', '', '', '', PcdValue
)
2060 if (PcdCName
, TokenSpaceGuid
) in Pcds
.keys():
2061 pcdObject
= Pcds
[PcdCName
, TokenSpaceGuid
]
2062 pcdObject
.SkuInfoList
[SkuName
] = SkuInfo
2063 if MaxDatumSize
.strip():
2064 CurrentMaxSize
= int(MaxDatumSize
.strip(), 0)
2067 if pcdObject
.MaxDatumSize
:
2068 PcdMaxSize
= int(pcdObject
.MaxDatumSize
, 0)
2071 if CurrentMaxSize
> PcdMaxSize
:
2072 pcdObject
.MaxDatumSize
= str(CurrentMaxSize
)
2074 Pcds
[PcdCName
, TokenSpaceGuid
] = PcdClassObject(
2077 self
._PCD
_TYPE
_STRING
_[Type
],
2082 {SkuName
: SkuInfo
},
2087 for pcd
in Pcds
.values():
2088 pcdDecObject
= self
._DecPcds
[pcd
.TokenCName
, pcd
.TokenSpaceGuidCName
]
2089 # Only fix the value while no value provided in DSC file.
2090 for sku
in pcd
.SkuInfoList
.values():
2091 if (sku
.DefaultValue
== "" or sku
.DefaultValue
==None):
2092 sku
.DefaultValue
= pcdDecObject
.DefaultValue
2093 if 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' not in pcd
.SkuInfoList
.keys():
2094 valuefromDec
= pcdDecObject
.DefaultValue
2095 SkuInfo
= SkuInfoClass('DEFAULT', '0', '', '', '', '', '', valuefromDec
)
2096 pcd
.SkuInfoList
['DEFAULT'] = SkuInfo
2097 elif 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2098 pcd
.SkuInfoList
['DEFAULT'] = pcd
.SkuInfoList
['COMMON']
2099 del(pcd
.SkuInfoList
['COMMON'])
2100 elif 'DEFAULT' in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2101 del(pcd
.SkuInfoList
['COMMON'])
2103 map(self
.FilterSkuSettings
,Pcds
.values())
2107 def FilterSkuSettings(self
, PcdObj
):
2109 if self
.SkuIdMgr
.SkuUsageType
== self
.SkuIdMgr
.SINGLE
:
2110 if 'DEFAULT' in PcdObj
.SkuInfoList
.keys() and self
.SkuIdMgr
.SystemSkuId
not in PcdObj
.SkuInfoList
.keys():
2111 PcdObj
.SkuInfoList
[self
.SkuIdMgr
.SystemSkuId
] = PcdObj
.SkuInfoList
['DEFAULT']
2112 PcdObj
.SkuInfoList
= {'DEFAULT':PcdObj
.SkuInfoList
[self
.SkuIdMgr
.SystemSkuId
]}
2113 PcdObj
.SkuInfoList
['DEFAULT'].SkuIdName
= 'DEFAULT'
2114 PcdObj
.SkuInfoList
['DEFAULT'].SkuId
= '0'
2116 elif self
.SkuIdMgr
.SkuUsageType
== self
.SkuIdMgr
.DEFAULT
:
2117 PcdObj
.SkuInfoList
= {'DEFAULT':PcdObj
.SkuInfoList
['DEFAULT']}
2122 def CompareVarAttr(self
, Attr1
, Attr2
):
2123 if not Attr1
or not Attr2
: # for empty string
2125 Attr1s
= [attr
.strip() for attr
in Attr1
.split(",")]
2126 Attr1Set
= set(Attr1s
)
2127 Attr2s
= [attr
.strip() for attr
in Attr2
.split(",")]
2128 Attr2Set
= set(Attr2s
)
2129 if Attr2Set
== Attr1Set
:
2133 def CompletePcdValues(self
,PcdSet
):
2135 DefaultStoreObj
= DefaultStore(self
._GetDefaultStores
())
2136 SkuIds
= {skuname
:skuid
for skuname
,skuid
in self
.SkuIdMgr
.AvailableSkuIdSet
.items() if skuname
!='COMMON'}
2137 DefaultStores
= set([storename
for pcdobj
in PcdSet
.values() for skuobj
in pcdobj
.SkuInfoList
.values() for storename
in skuobj
.DefaultStoreDict
.keys()])
2138 for PcdCName
, TokenSpaceGuid
in PcdSet
:
2139 PcdObj
= PcdSet
[(PcdCName
, TokenSpaceGuid
)]
2140 if PcdObj
.Type
not in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_DEFAULT
],
2141 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
],
2142 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_VPD
],
2143 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_DEFAULT
],
2144 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
],
2145 self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_VPD
]]:
2146 Pcds
[PcdCName
, TokenSpaceGuid
]= PcdObj
2148 PcdType
= PcdObj
.Type
2149 if PcdType
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
2150 for skuid
in PcdObj
.SkuInfoList
:
2151 skuobj
= PcdObj
.SkuInfoList
[skuid
]
2152 mindefaultstorename
= DefaultStoreObj
.GetMin(set([defaultstorename
for defaultstorename
in skuobj
.DefaultStoreDict
]))
2153 for defaultstorename
in DefaultStores
:
2154 if defaultstorename
not in skuobj
.DefaultStoreDict
:
2155 skuobj
.DefaultStoreDict
[defaultstorename
] = copy
.deepcopy(skuobj
.DefaultStoreDict
[mindefaultstorename
])
2156 skuobj
.HiiDefaultValue
= skuobj
.DefaultStoreDict
[mindefaultstorename
]
2157 for skuname
,skuid
in SkuIds
.items():
2158 if skuname
not in PcdObj
.SkuInfoList
:
2159 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(skuname
)
2160 while nextskuid
not in PcdObj
.SkuInfoList
:
2161 nextskuid
= self
.SkuIdMgr
.GetNextSkuId(nextskuid
)
2162 PcdObj
.SkuInfoList
[skuname
] = copy
.deepcopy(PcdObj
.SkuInfoList
[nextskuid
])
2163 PcdObj
.SkuInfoList
[skuname
].SkuId
= skuid
2164 PcdObj
.SkuInfoList
[skuname
].SkuIdName
= skuname
2165 if PcdType
in [self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_HII
], self
._PCD
_TYPE
_STRING
_[MODEL_PCD_DYNAMIC_EX_HII
]]:
2166 PcdObj
.DefaultValue
= PcdObj
.SkuInfoList
.values()[0].HiiDefaultValue
if self
.SkuIdMgr
.SkuUsageType
== self
.SkuIdMgr
.SINGLE
else PcdObj
.SkuInfoList
["DEFAULT"].HiiDefaultValue
2167 Pcds
[PcdCName
, TokenSpaceGuid
]= PcdObj
2169 ## Retrieve dynamic HII PCD settings
2171 # @param Type PCD type
2173 # @retval a dict object contains settings of given PCD type
2175 def _GetDynamicHiiPcd(self
, Type
):
2181 # tdict is a special dict kind of type, used for selecting correct
2182 # PCD settings for certain ARCH and SKU
2184 PcdDict
= tdict(True, 5)
2186 RecordList
= self
._RawData
[Type
, self
._Arch
]
2187 # Find out all possible PCD candidates for self._Arch
2188 AvailableSkuIdSet
= copy
.copy(self
.SkuIds
)
2189 DefaultStoresDefine
= self
._GetDefaultStores
()
2191 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, SkuName
, DefaultStore
, Dummy4
,Dummy5
in RecordList
:
2192 SkuName
= SkuName
.upper()
2193 SkuName
= 'DEFAULT' if SkuName
== 'COMMON' else SkuName
2194 DefaultStore
= DefaultStore
.upper()
2195 if DefaultStore
== "COMMON":
2196 DefaultStore
= "STANDARD"
2197 if SkuName
not in AvailableSkuIdSet
:
2198 EdkLogger
.error('build', PARAMETER_INVALID
, 'Sku %s is not defined in [SkuIds] section' % SkuName
,
2199 File
=self
.MetaFile
, Line
=Dummy5
)
2200 if DefaultStore
not in DefaultStoresDefine
:
2201 EdkLogger
.error('build', PARAMETER_INVALID
, 'DefaultStores %s is not defined in [DefaultStores] section' % DefaultStore
,
2202 File
=self
.MetaFile
, Line
=Dummy5
)
2203 if "." not in TokenSpaceGuid
:
2204 PcdSet
.add((PcdCName
, TokenSpaceGuid
, SkuName
,DefaultStore
, Dummy5
))
2205 PcdDict
[Arch
, SkuName
, PcdCName
, TokenSpaceGuid
,DefaultStore
] = Setting
2208 # Remove redundant PCD candidates, per the ARCH and SKU
2209 for PcdCName
, TokenSpaceGuid
, SkuName
,DefaultStore
, Dummy4
in PcdSet
:
2211 Setting
= PcdDict
[self
._Arch
, SkuName
, PcdCName
, TokenSpaceGuid
,DefaultStore
]
2214 VariableName
, VariableGuid
, VariableOffset
, DefaultValue
, VarAttribute
= self
._ValidatePcd
(PcdCName
, TokenSpaceGuid
, Setting
, Type
, Dummy4
)
2216 rt
, Msg
= VariableAttributes
.ValidateVarAttributes(VarAttribute
)
2218 EdkLogger
.error("build", PCD_VARIABLE_ATTRIBUTES_ERROR
, "Variable attributes settings for %s is incorrect.\n %s" % (".".join((TokenSpaceGuid
, PcdCName
)), Msg
),
2219 ExtraData
="[%s]" % VarAttribute
)
2221 FormatCorrect
= True
2222 if VariableOffset
.isdigit():
2223 if int(VariableOffset
, 10) > 0xFFFF:
2225 elif re
.match(r
'[\t\s]*0[xX][a-fA-F0-9]+$', VariableOffset
):
2226 if int(VariableOffset
, 16) > 0xFFFF:
2228 # For Offset written in "A.B"
2229 elif VariableOffset
.find('.') > -1:
2230 VariableOffsetList
= VariableOffset
.split(".")
2231 if not (len(VariableOffsetList
) == 2
2232 and IsValidWord(VariableOffsetList
[0])
2233 and IsValidWord(VariableOffsetList
[1])):
2234 FormatCorrect
= False
2236 FormatCorrect
= False
2237 if not FormatCorrect
:
2238 EdkLogger
.error('Build', FORMAT_INVALID
, "Invalid syntax or format of the variable offset value is incorrect for %s." % ".".join((TokenSpaceGuid
, PcdCName
)))
2241 EdkLogger
.error('Build', OPTION_VALUE_INVALID
, "The variable offset value must not exceed the maximum value of 0xFFFF (UINT16) for %s." % ".".join((TokenSpaceGuid
, PcdCName
)))
2242 if (VariableName
, VariableGuid
) not in VariableAttrs
:
2243 VariableAttrs
[(VariableName
, VariableGuid
)] = VarAttribute
2245 if not self
.CompareVarAttr(VariableAttrs
[(VariableName
, VariableGuid
)], VarAttribute
):
2246 EdkLogger
.error('Build', PCD_VARIABLE_ATTRIBUTES_CONFLICT_ERROR
, "The variable %s.%s for DynamicHii PCDs has conflicting attributes [%s] and [%s] " % (VariableGuid
, VariableName
, VarAttribute
, VariableAttrs
[(VariableName
, VariableGuid
)]))
2248 pcdDecObject
= self
._DecPcds
[PcdCName
, TokenSpaceGuid
]
2249 if (PcdCName
, TokenSpaceGuid
) in Pcds
.keys():
2250 pcdObject
= Pcds
[PcdCName
, TokenSpaceGuid
]
2251 if SkuName
in pcdObject
.SkuInfoList
:
2252 Skuitem
= pcdObject
.SkuInfoList
[SkuName
]
2253 Skuitem
.DefaultStoreDict
.update({DefaultStore
:DefaultValue
})
2255 SkuInfo
= SkuInfoClass(SkuName
, self
.SkuIds
[SkuName
][0], VariableName
, VariableGuid
, VariableOffset
, DefaultValue
, VariableAttribute
=VarAttribute
,DefaultStore
={DefaultStore
:DefaultValue
})
2256 pcdObject
.SkuInfoList
[SkuName
] = SkuInfo
2258 SkuInfo
= SkuInfoClass(SkuName
, self
.SkuIds
[SkuName
][0], VariableName
, VariableGuid
, VariableOffset
, DefaultValue
, VariableAttribute
=VarAttribute
,DefaultStore
={DefaultStore
:DefaultValue
})
2259 Pcds
[PcdCName
, TokenSpaceGuid
] = PcdClassObject(
2262 self
._PCD
_TYPE
_STRING
_[Type
],
2267 {SkuName
: SkuInfo
},
2270 pcdDecObject
.validateranges
,
2271 pcdDecObject
.validlists
,
2272 pcdDecObject
.expressions
,
2276 for pcd
in Pcds
.values():
2277 SkuInfoObj
= pcd
.SkuInfoList
.values()[0]
2278 pcdDecObject
= self
._DecPcds
[pcd
.TokenCName
, pcd
.TokenSpaceGuidCName
]
2279 pcd
.DatumType
= pcdDecObject
.DatumType
2280 # Only fix the value while no value provided in DSC file.
2281 for sku
in pcd
.SkuInfoList
.values():
2282 if (sku
.HiiDefaultValue
== "" or sku
.HiiDefaultValue
== None):
2283 sku
.HiiDefaultValue
= pcdDecObject
.DefaultValue
2284 for default_store
in sku
.DefaultStoreDict
:
2285 sku
.DefaultStoreDict
[default_store
]=pcdDecObject
.DefaultValue
2286 pcd
.DefaultValue
= pcdDecObject
.DefaultValue
2287 if 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' not in pcd
.SkuInfoList
.keys():
2288 valuefromDec
= pcdDecObject
.DefaultValue
2289 SkuInfo
= SkuInfoClass('DEFAULT', '0', SkuInfoObj
.VariableName
, SkuInfoObj
.VariableGuid
, SkuInfoObj
.VariableOffset
, valuefromDec
,VariableAttribute
=SkuInfoObj
.VariableAttribute
,DefaultStore
={DefaultStore
:valuefromDec
})
2290 pcd
.SkuInfoList
['DEFAULT'] = SkuInfo
2291 elif 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2292 pcd
.SkuInfoList
['DEFAULT'] = pcd
.SkuInfoList
['COMMON']
2293 del(pcd
.SkuInfoList
['COMMON'])
2294 elif 'DEFAULT' in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2295 del(pcd
.SkuInfoList
['COMMON'])
2297 if pcd
.MaxDatumSize
.strip():
2298 MaxSize
= int(pcd
.MaxDatumSize
, 0)
2301 if pcdDecObject
.DatumType
== 'VOID*':
2302 for (_
, skuobj
) in pcd
.SkuInfoList
.items():
2304 skuobj
.HiiDefaultValue
= StringToArray(skuobj
.HiiDefaultValue
)
2305 datalen
= len(skuobj
.HiiDefaultValue
.split(","))
2306 if datalen
> MaxSize
:
2308 for defaultst
in skuobj
.DefaultStoreDict
:
2309 skuobj
.DefaultStoreDict
[defaultst
] = StringToArray(skuobj
.DefaultStoreDict
[defaultst
])
2310 pcd
.DefaultValue
= StringToArray(pcd
.DefaultValue
)
2311 pcd
.MaxDatumSize
= str(MaxSize
)
2312 rt
, invalidhii
= self
.CheckVariableNameAssignment(Pcds
)
2314 invalidpcd
= ",".join(invalidhii
)
2315 EdkLogger
.error('build', PCD_VARIABLE_INFO_ERROR
, Message
='The same HII PCD must map to the same EFI variable for all SKUs', File
=self
.MetaFile
, ExtraData
=invalidpcd
)
2317 map(self
.FilterSkuSettings
,Pcds
.values())
2321 def CheckVariableNameAssignment(self
,Pcds
):
2323 for pcdname
in Pcds
:
2325 varnameset
= set([sku
.VariableName
for (skuid
,sku
) in pcd
.SkuInfoList
.items()])
2326 if len(varnameset
) > 1:
2327 invalidhii
.append(".".join((pcdname
[1],pcdname
[0])))
2329 return False,invalidhii
2332 ## Retrieve dynamic VPD PCD settings
2334 # @param Type PCD type
2336 # @retval a dict object contains settings of given PCD type
2338 def _GetDynamicVpdPcd(self
, Type
):
2343 # tdict is a special dict kind of type, used for selecting correct
2344 # PCD settings for certain ARCH and SKU
2346 PcdDict
= tdict(True, 4)
2349 # Find out all possible PCD candidates for self._Arch
2350 RecordList
= self
._RawData
[Type
, self
._Arch
]
2351 AvailableSkuIdSet
= copy
.copy(self
.SkuIds
)
2353 for TokenSpaceGuid
, PcdCName
, Setting
, Arch
, SkuName
, Dummy3
, Dummy4
,Dummy5
in RecordList
:
2354 SkuName
= SkuName
.upper()
2355 SkuName
= 'DEFAULT' if SkuName
== 'COMMON' else SkuName
2356 if SkuName
not in AvailableSkuIdSet
:
2357 EdkLogger
.error('build', PARAMETER_INVALID
, 'Sku %s is not defined in [SkuIds] section' % SkuName
,
2358 File
=self
.MetaFile
, Line
=Dummy5
)
2359 if "." not in TokenSpaceGuid
:
2360 PcdList
.append((PcdCName
, TokenSpaceGuid
, SkuName
, Dummy5
))
2361 PcdDict
[Arch
, SkuName
, PcdCName
, TokenSpaceGuid
] = Setting
2363 # Remove redundant PCD candidates, per the ARCH and SKU
2364 for PcdCName
, TokenSpaceGuid
, SkuName
, Dummy4
in PcdList
:
2365 Setting
= PcdDict
[self
._Arch
, SkuName
, PcdCName
, TokenSpaceGuid
]
2369 # For the VOID* type, it can have optional data of MaxDatumSize and InitialValue
2370 # For the Integer & Boolean type, the optional data can only be InitialValue.
2371 # At this point, we put all the data into the PcdClssObject for we don't know the PCD's datumtype
2372 # until the DEC parser has been called.
2374 VpdOffset
, MaxDatumSize
, InitialValue
= self
._ValidatePcd
(PcdCName
, TokenSpaceGuid
, Setting
, Type
, Dummy4
)
2375 SkuInfo
= SkuInfoClass(SkuName
, self
.SkuIds
[SkuName
][0], '', '', '', '', VpdOffset
, InitialValue
)
2376 if (PcdCName
, TokenSpaceGuid
) in Pcds
.keys():
2377 pcdObject
= Pcds
[PcdCName
, TokenSpaceGuid
]
2378 pcdObject
.SkuInfoList
[SkuName
] = SkuInfo
2379 if MaxDatumSize
.strip():
2380 CurrentMaxSize
= int(MaxDatumSize
.strip(), 0)
2383 if pcdObject
.MaxDatumSize
:
2384 PcdMaxSize
= int(pcdObject
.MaxDatumSize
, 0)
2387 if CurrentMaxSize
> PcdMaxSize
:
2388 pcdObject
.MaxDatumSize
= str(CurrentMaxSize
)
2390 Pcds
[PcdCName
, TokenSpaceGuid
] = PcdClassObject(
2393 self
._PCD
_TYPE
_STRING
_[Type
],
2398 {SkuName
: SkuInfo
},
2402 for pcd
in Pcds
.values():
2403 SkuInfoObj
= pcd
.SkuInfoList
.values()[0]
2404 pcdDecObject
= self
._DecPcds
[pcd
.TokenCName
, pcd
.TokenSpaceGuidCName
]
2405 pcd
.DatumType
= pcdDecObject
.DatumType
2406 # Only fix the value while no value provided in DSC file.
2407 for sku
in pcd
.SkuInfoList
.values():
2408 if (sku
.DefaultValue
== "" or sku
.DefaultValue
==None):
2409 sku
.DefaultValue
= pcdDecObject
.DefaultValue
2410 if 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' not in pcd
.SkuInfoList
.keys():
2411 valuefromDec
= pcdDecObject
.DefaultValue
2412 SkuInfo
= SkuInfoClass('DEFAULT', '0', '', '', '', '', SkuInfoObj
.VpdOffset
, valuefromDec
)
2413 pcd
.SkuInfoList
['DEFAULT'] = SkuInfo
2414 elif 'DEFAULT' not in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2415 pcd
.SkuInfoList
['DEFAULT'] = pcd
.SkuInfoList
['COMMON']
2416 del(pcd
.SkuInfoList
['COMMON'])
2417 elif 'DEFAULT' in pcd
.SkuInfoList
.keys() and 'COMMON' in pcd
.SkuInfoList
.keys():
2418 del(pcd
.SkuInfoList
['COMMON'])
2421 map(self
.FilterSkuSettings
,Pcds
.values())
2424 ## Add external modules
2426 # The external modules are mostly those listed in FDF file, which don't
2429 # @param FilePath The path of module description file
2431 def AddModule(self
, FilePath
):
2432 FilePath
= NormPath(FilePath
)
2433 if FilePath
not in self
.Modules
:
2434 Module
= ModuleBuildClassObject()
2435 Module
.MetaFile
= FilePath
2436 self
.Modules
.append(Module
)
2438 def _GetToolChainFamily(self
):
2439 self
._ToolChainFamily
= "MSFT"
2440 BuildConfigurationFile
= os
.path
.normpath(os
.path
.join(GlobalData
.gConfDirectory
, "target.txt"))
2441 if os
.path
.isfile(BuildConfigurationFile
) == True:
2442 TargetTxt
= TargetTxtClassObject()
2443 TargetTxt
.LoadTargetTxtFile(BuildConfigurationFile
)
2444 ToolDefinitionFile
= TargetTxt
.TargetTxtDictionary
[DataType
.TAB_TAT_DEFINES_TOOL_CHAIN_CONF
]
2445 if ToolDefinitionFile
== '':
2446 ToolDefinitionFile
= "tools_def.txt"
2447 ToolDefinitionFile
= os
.path
.normpath(mws
.join(self
.WorkspaceDir
, 'Conf', ToolDefinitionFile
))
2448 if os
.path
.isfile(ToolDefinitionFile
) == True:
2449 ToolDef
= ToolDefClassObject()
2450 ToolDef
.LoadToolDefFile(ToolDefinitionFile
)
2451 ToolDefinition
= ToolDef
.ToolsDefTxtDatabase
2452 if TAB_TOD_DEFINES_FAMILY
not in ToolDefinition \
2453 or self
._Toolchain
not in ToolDefinition
[TAB_TOD_DEFINES_FAMILY
] \
2454 or not ToolDefinition
[TAB_TOD_DEFINES_FAMILY
][self
._Toolchain
]:
2455 self
._ToolChainFamily
= "MSFT"
2457 self
._ToolChainFamily
= ToolDefinition
[TAB_TOD_DEFINES_FAMILY
][self
._Toolchain
]
2458 return self
._ToolChainFamily
2460 ## Add external PCDs
2462 # The external PCDs are mostly those listed in FDF file to specify address
2463 # or offset information.
2465 # @param Name Name of the PCD
2466 # @param Guid Token space guid of the PCD
2467 # @param Value Value of the PCD
2469 def AddPcd(self
, Name
, Guid
, Value
):
2470 if (Name
, Guid
) not in self
.Pcds
:
2471 self
.Pcds
[Name
, Guid
] = PcdClassObject(Name
, Guid
, '', '', '', '', '', {}, False, None)
2472 self
.Pcds
[Name
, Guid
].DefaultValue
= Value
2475 if self
._DecPcds
== None:
2477 if GlobalData
.gFdfParser
:
2478 FdfInfList
= GlobalData
.gFdfParser
.Profile
.InfList
2480 for Inf
in FdfInfList
:
2481 ModuleFile
= PathClass(NormPath(Inf
), GlobalData
.gWorkspace
, Arch
=self
._Arch
)
2482 if ModuleFile
in self
._Modules
:
2484 ModuleData
= self
._Bdb
[ModuleFile
, self
._Arch
, self
._Target
, self
._Toolchain
]
2485 PkgSet
.update(ModuleData
.Packages
)
2486 self
._DecPcds
, self
._GuidDict
= GetDeclaredPcd(self
, self
._Bdb
, self
._Arch
, self
._Target
, self
._Toolchain
,PkgSet
)
2487 return self
._DecPcds
2488 _Macros
= property(_GetMacros
)
2489 Arch
= property(_GetArch
, _SetArch
)
2490 Platform
= property(_GetPlatformName
)
2491 PlatformName
= property(_GetPlatformName
)
2492 Guid
= property(_GetFileGuid
)
2493 Version
= property(_GetVersion
)
2494 DscSpecification
= property(_GetDscSpec
)
2495 OutputDirectory
= property(_GetOutpuDir
)
2496 SupArchList
= property(_GetSupArch
)
2497 BuildTargets
= property(_GetBuildTarget
)
2498 SkuName
= property(_GetSkuName
, _SetSkuName
)
2499 PcdInfoFlag
= property(_GetPcdInfoFlag
)
2500 VarCheckFlag
= property(_GetVarCheckFlag
)
2501 FlashDefinition
= property(_GetFdfFile
)
2502 Prebuild
= property(_GetPrebuild
)
2503 Postbuild
= property(_GetPostbuild
)
2504 BuildNumber
= property(_GetBuildNumber
)
2505 MakefileName
= property(_GetMakefileName
)
2506 BsBaseAddress
= property(_GetBsBaseAddress
)
2507 RtBaseAddress
= property(_GetRtBaseAddress
)
2508 LoadFixAddress
= property(_GetLoadFixAddress
)
2509 RFCLanguages
= property(_GetRFCLanguages
)
2510 ISOLanguages
= property(_GetISOLanguages
)
2511 VpdToolGuid
= property(_GetVpdToolGuid
)
2512 SkuIds
= property(_GetSkuIds
)
2513 Modules
= property(_GetModules
)
2514 LibraryInstances
= property(_GetLibraryInstances
)
2515 LibraryClasses
= property(_GetLibraryClasses
)
2516 Pcds
= property(_GetPcds
)
2517 BuildOptions
= property(_GetBuildOptions
)
2518 ToolChainFamily
= property(_GetToolChainFamily
)