1 ## @file 2 # This file is used to define common items of class object 3 # 4 # Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR> 5 # This program and the accompanying materials 6 # are licensed and made available under the terms and conditions of the BSD License 7 # which accompanies this distribution. The full text of the license may be found at 8 # http://opensource.org/licenses/bsd-license.php 9 # 10 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13 14 # 15 # Generate help text 16 # 17 def GenerateHelpText(Text, Lang): 18 if Text: 19 Ht = HelpTextClass() 20 Ht.Lang = Lang 21 Ht.String = Text 22 23 return Ht 24 25 return None 26 27 ## CommonClass 28 # 29 # This class defined common items used in Module/Platform/Package files 30 # 31 # @param object: Inherited from object class 32 # @param Usage: Input value for Usage, default is [] 33 # @param FeatureFlag: Input value for FeatureFalg, default is '' 34 # @param SupArchList: Input value for SupArchList, default is [] 35 # @param HelpText: Input value for HelpText, default is '' 36 # 37 # @var Usage: To store value for Usage, selection scope is in below list 38 # ALWAYS_CONSUMED | SOMETIMES_CONSUMED | ALWAYS_PRODUCED | SOMETIMES_PRODUCED | TO_START | BY_START | PRIVATE 39 # @var FeatureFlag: To store value for FeatureFlag 40 # @var SupArchList: To store value for SupArchList, selection scope is in below list 41 # EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 42 # @var HelpText: To store value for HelpText 43 # 44 class CommonClass(object): 45 def __init__(self, Usage = None, FeatureFlag = '', SupArchList = None, HelpText = ''): 46 self.Usage = Usage 47 if self.Usage == None: 48 self.Usage = [] 49 self.FeatureFlag = FeatureFlag 50 self.SupArchList = SupArchList 51 if self.SupArchList == None: 52 self.SupArchList = [] 53 self.HelpText = HelpText 54 self.HelpTextList = [] 55 56 ## CommonHeaderClass 57 # 58 # This class defined common items used in Module/Platform/Package files 59 # 60 # @param object: Inherited from object class 61 # 62 # @var Abstract: To store value for Abstract 63 # @var Description: To store value for Description 64 # @var Copyright: To store value for Copyright 65 # @var License: To store value for License 66 # @var Specification: To store value for Specification 67 # 68 class CommonHeaderClass(object): 69 def __init__(self): 70 self.Abstract = '' 71 self.Description = '' 72 self.Copyright = '' 73 self.License = '' 74 self.Specification = {} 75 76 ## HelpTextClass 77 # 78 # This class defined HelpText item used in PKG file 79 # 80 # @param object: Inherited from object class 81 # 82 # @var Lang: To store value for Lang 83 # @var String: To store value for String 84 # 85 class HelpTextClass(object): 86 def __init__(self): 87 self.Lang = '' 88 self.String = '' 89 90 ## DefineClass 91 # 92 # This class defined item DEFINE used in Module/Platform/Package files 93 # 94 # @param object: Inherited from object class 95 # 96 # @var Define: To store value for Define, it is a set structure as 97 # { (DefineName, Arch) : DefineValue, ... } 98 # 99 class DefineClass(object): 100 def __init__(self): 101 self.Define = {} 102 103 ## ClonedRecordClass 104 # 105 # This class defined ClonedRecord items used in Module/Platform/Package files 106 # 107 # @param object: Inherited from object class 108 # 109 # @var Id: To store value for Id 110 # @var FarGuid: To store value for FarGuid 111 # @var PackageGuid: To store value for PackageGuid 112 # @var PackageVersion: To store value for PackageVersion 113 # @var ModuleGuid: To store value for ModuleGuid 114 # @var ModuleVersion: To store value for ModuleVersion 115 # 116 class ClonedRecordClass(object): 117 def __init__(self): 118 self.Id = 0 119 self.FarGuid = '' 120 self.PackageGuid = '' 121 self.PackageVersion = '' 122 self.ModuleGuid = '' 123 self.ModuleVersion = '' 124 125 ## IdentificationClass 126 # 127 # This class defined Identification items used in Module/Platform/Package files 128 # 129 # @param object: Inherited from object class 130 # 131 # @var Name: To store value for Name 132 # ModuleName(Inf) / PackageName(Dec) / PlatformName(Dsc) 133 # @var Guid: To store value for Guid 134 # @var Version: To store value for Version 135 # @var FileName: To store value for FileName 136 # @var FullPath: To store value for FullPath 137 # 138 class IdentificationClass(object): 139 def __init__(self): 140 self.Name = '' 141 self.BaseName = '' 142 self.Guid = '' 143 self.Version = '' 144 self.FileName = '' 145 self.FullPath = '' 146 self.RelaPath = '' 147 self.PackagePath = '' 148 self.ModulePath = '' 149 self.CombinePath = '' 150 151 ## IncludeStatementClass 152 # 153 # This class defined IncludeFiles item used in Module/Platform/Package files 154 # 155 # @param object: Inherited from object class 156 # 157 # @var IncludeFiles: To store value for IncludeFiles 158 # It is a set structure as { IncludeFile : [Arch1, Arch2, ...], ... } 159 # 160 class IncludeStatementClass(object): 161 def __init__(self): 162 self.IncludeFiles = {} 163 164 ## GuidProtocolPpiCommonClass 165 # 166 # This class defined Guid, Protocol and Ppi like items used in Module/Platform/Package files 167 # 168 # @param CommonClass: Inherited from CommonClass class 169 # 170 # @var Name: To store value for Name 171 # @var CName: To store value for CName 172 # @var Guid: To store value for Guid 173 # @var Notify: To store value for Notify 174 # @var GuidTypeList: To store value for GuidTypeList, selection scope is in below list 175 # DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID 176 # @var SupModuleList: To store value for SupModuleList, selection scope is in below list 177 # BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE 178 # 179 class GuidProtocolPpiCommonClass(CommonClass): 180 def __init__(self): 181 self.Name = '' 182 self.CName = '' 183 self.Guid = '' 184 self.VariableName = '' 185 self.Notify = False 186 self.GuidTypeList = [] 187 self.GuidTypeLists = [] 188 self.SupModuleList = [] 189 CommonClass.__init__(self) 190 191 ## LibraryClassClass 192 # 193 # This class defined Library item used in Module/Platform/Package files 194 # 195 # @param CommonClass: Inherited from CommonClass class 196 # @param DefineClass: Inherited from DefineClass class 197 # 198 # @var LibraryClass: To store value for LibraryClass 199 # @var IncludeHeader: To store value for IncludeHeader 200 # @var RecommendedInstanceVersion: To store value for RecommendedInstanceVersion 201 # @var RecommendedInstanceGuid: To store value for RecommendedInstanceGuid 202 # @var RecommendedInstance: To store value for RecommendedInstance, selection scope is in below list 203 # DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID 204 # @var SupModuleList: To store value for SupModuleList, selection scope is in below list 205 # BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE 206 # 207 class LibraryClassClass(CommonClass, DefineClass): 208 def __init__(self): 209 self.LibraryClass = '' 210 self.IncludeHeader = '' 211 self.RecommendedInstanceVersion = '' 212 self.RecommendedInstanceGuid = '' 213 self.RecommendedInstance = '' 214 self.SupModuleList = [] 215 CommonClass.__init__(self) 216 DefineClass.__init__(self) 217 218 ## GuidClass 219 # 220 # This class defined Guid item used in Module/Platform/Package files 221 # 222 # @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class 223 # 224 class GuidClass(GuidProtocolPpiCommonClass): 225 def __init__(self): 226 GuidProtocolPpiCommonClass.__init__(self) 227 228 ## ProtocolClass 229 # 230 # This class defined Protocol item used in Module/Platform/Package files 231 # 232 # @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class 233 # 234 class ProtocolClass(GuidProtocolPpiCommonClass): 235 def __init__(self): 236 GuidProtocolPpiCommonClass.__init__(self) 237 238 ## PpiClass 239 # 240 # This class defined Ppi item used in Module/Platform/Package files 241 # 242 # @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommonClass class 243 # 244 class PpiClass(GuidProtocolPpiCommonClass): 245 def __init__(self): 246 GuidProtocolPpiCommonClass.__init__(self) 247 248 ## SkuInfoClass 249 # 250 # This class defined SkuInfo item used in Module/Platform/Package files 251 # 252 # @param object: Inherited from object class 253 # @param SkuIdName: Input value for SkuIdName, default is '' 254 # @param SkuId: Input value for SkuId, default is '' 255 # @param VariableName: Input value for VariableName, default is '' 256 # @param VariableGuid: Input value for VariableGuid, default is '' 257 # @param VariableOffset: Input value for VariableOffset, default is '' 258 # @param HiiDefaultValue: Input value for HiiDefaultValue, default is '' 259 # @param VpdOffset: Input value for VpdOffset, default is '' 260 # @param DefaultValue: Input value for DefaultValue, default is '' 261 # 262 # @var SkuIdName: To store value for SkuIdName 263 # @var SkuId: To store value for SkuId 264 # @var VariableName: To store value for VariableName 265 # @var VariableGuid: To store value for VariableGuid 266 # @var VariableOffset: To store value for VariableOffset 267 # @var HiiDefaultValue: To store value for HiiDefaultValue 268 # @var VpdOffset: To store value for VpdOffset 269 # @var DefaultValue: To store value for DefaultValue 270 # 271 class SkuInfoClass(object): 272 def __init__(self, SkuIdName = '', SkuId = '', VariableName = '', VariableGuid = '', VariableOffset = '', 273 HiiDefaultValue = '', VpdOffset = '', DefaultValue = '', VariableGuidValue = '', VariableAttribute = ''): 274 self.SkuIdName = SkuIdName 275 self.SkuId = SkuId 276 277 # 278 # Used by Hii 279 # 280 self.VariableName = VariableName 281 self.VariableGuid = VariableGuid 282 self.VariableGuidValue = VariableGuidValue 283 self.VariableOffset = VariableOffset 284 self.HiiDefaultValue = HiiDefaultValue 285 self.VariableAttribute = VariableAttribute 286 287 # 288 # Used by Vpd 289 # 290 self.VpdOffset = VpdOffset 291 292 # 293 # Used by Default 294 # 295 self.DefaultValue = DefaultValue 296 297 ## Convert the class to a string 298 # 299 # Convert each member of the class to string 300 # Organize to a signle line format string 301 # 302 # @retval Rtn Formatted String 303 # 304 def __str__(self): 305 Rtn = 'SkuId = ' + str(self.SkuId) + "," + \ 306 'SkuIdName = ' + str(self.SkuIdName) + "," + \ 307 'VariableName = ' + str(self.VariableName) + "," + \ 308 'VariableGuid = ' + str(self.VariableGuid) + "," + \ 309 'VariableOffset = ' + str(self.VariableOffset) + "," + \ 310 'HiiDefaultValue = ' + str(self.HiiDefaultValue) + "," + \ 311 'VpdOffset = ' + str(self.VpdOffset) + "," + \ 312 'DefaultValue = ' + str(self.DefaultValue) + "," 313 return Rtn 314 ## PcdErrorClass 315 # 316 # 317 # 318 class PcdErrorClass(object): 319 def __init__(self): 320 self.ValidValueList = '' 321 self.ValidValueListLang = '' 322 self.ValidValueRange = '' 323 self.Expression = '' 324 self.ErrorNumber = '' 325 self.ErrorMessage = [] 326 327 ## PcdClass 328 # 329 # This class defined Pcd item used in Module/Platform/Package files 330 # 331 # @param CommonClass: Inherited from CommonClass class 332 # @param CName: Input value for CName, default is '' 333 # @param Token: Input value for Token, default is '' 334 # @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, default is '' 335 # @param DatumType: Input value for DatumType, default is '' 336 # @param MaxDatumSize: Input value for MaxDatumSize, default is '' 337 # @param DefaultValue: Input value for DefaultValue, default is '' 338 # @param ItemType: Input value for ItemType, default is '' 339 # @param ValidUsage: Input value for ValidUsage, default is [] 340 # @param SkuInfoList: Input value for SkuInfoList, default is {} 341 # @param SupModuleList: Input value for SupModuleList, default is [] 342 # 343 # @var CName: To store value for CName 344 # @var Token: To store value for Token 345 # @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName 346 # @var DatumType: To store value for DatumType, selection scope is in below list 347 # UINT8 | UINT16 | UINT32 | UINT64 | VOID* | BOOLEAN 348 # @var MaxDatumSize: To store value for MaxDatumSize 349 # @var DefaultValue: To store value for DefaultValue 350 # @var ItemType: To store value for ItemType, selection scope is in below list 351 # FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX 352 # @var ValidUsage: To store value for ValidUsage, selection scope is in below list 353 # FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_IN_MODULE | DYNAMIC | DYNAMIC_EX 354 # @var SkuInfoList: To store value for SkuInfoList 355 # It is a set structure as { [SkuIdName] : SkuInfoClass } 356 # @var SupModuleList: To store value for SupModuleList, selection scope is in below list 357 # BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE 358 # 359 class PcdClass(CommonClass): 360 def __init__(self, CName = '', Token = '', TokenSpaceGuidCName = '', DatumType = '', MaxDatumSize = '', DefaultValue = '', ItemType = '', ValidUsage = None, SkuInfoList = None, SupModuleList = None): 361 self.CName = CName 362 self.Token = Token 363 self.TokenSpaceGuidCName = TokenSpaceGuidCName 364 self.DatumType = DatumType 365 self.MaxDatumSize = MaxDatumSize 366 self.DefaultValue = DefaultValue 367 self.ItemType = ItemType 368 self.ValidUsage = ValidUsage 369 self.PcdItemType = '' 370 self.TokenSpaceGuidValue = '' 371 self.PcdUsage = '' 372 self.PcdCName = '' 373 self.Value = '' 374 self.Offset = '' 375 if self.ValidUsage == None: 376 self.ValidUsage = [] 377 self.SkuInfoList = SkuInfoList 378 if self.SkuInfoList == None: 379 self.SkuInfoList = {} 380 self.SupModuleList = SupModuleList 381 if self.SupModuleList == None: 382 self.SupModuleList = [] 383 CommonClass.__init__(self) 384 self.PcdErrors = [] 385 386 ## BuildOptionClass 387 # 388 # This class defined BuildOption item used in Module/Platform/Package files 389 # 390 # @param IncludeStatementClass: Inherited from IncludeStatementClass class 391 # @param ToolChainFamily: Input value for ToolChainFamily, default is '' 392 # @param ToolChain: Input value for ToolChain, default is '' 393 # @param Option: Input value for Option, default is '' 394 # 395 # @var Statement: To store value for Statement 396 # It is a string in a special format as "Family:Target_TagName_Tarch_ToolCode_FLAGS = String" 397 # @var ToolChainFamily: To store value for ToolChainFamily 398 # @var ToolChain: To store value for ToolChain 399 # @var Option: To store value for Option 400 # @var BuildTarget: To store value for BuildTarget 401 # @var TagName: To store value for TagName 402 # @var ToolCode: To store value for ToolCode 403 # @var SupArchList: To store value for SupArchList, selection scope is in below list 404 # EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 405 # 406 class BuildOptionClass(IncludeStatementClass): 407 def __init__(self, ToolChainFamily = '', ToolChain = '', Option = ''): 408 IncludeStatementClass.__init__(self) 409 self.Statement = '' 410 self.ToolChainFamily = ToolChainFamily 411 self.ToolChain = ToolChain 412 self.Option = Option 413 self.BuildTarget = '' 414 self.TagName = '' 415 self.ToolCode = '' 416 self.SupArchList = [] 417 418 ## IncludeClass 419 # 420 # This class defined Include item used in Module/Platform/Package files 421 # 422 # @param CommonClass: Inherited from CommonClass class 423 # 424 # @var FilePath: To store value for FilePath 425 # @var ModuleType: To store value for ModuleType 426 # @var Comment: To store value for Comment 427 # 428 class IncludeClass(CommonClass): 429 def __init__(self): 430 self.FilePath = '' 431 self.ModuleType = '' 432 self.SupModuleList = [] 433 self.Comment = '' 434 CommonClass.__init__(self) 435 436 ## FileClass 437 # 438 # 439 class FileClass(CommonClass): 440 def __init__(self): 441 self.Filename = '' 442 self.Executable = '' 443 self.Family = '' 444 self.FileType = '' 445 CommonClass.__init__(self) 446 447 448 ## MiscFileClass 449 # 450 # 451 class MiscFileClass(CommonHeaderClass): 452 def __init__(self): 453 CommonHeaderClass.__init__(self) 454 self.Name = '' 455 self.Files = [] 456 457 458 ## UserExtensionsClass 459 # 460 # This class defined UserExtensions item used in Module/Platform/Package files 461 # 462 # @param object: Inherited from object class 463 # 464 # @var UserID: To store value for UserID 465 # @var Identifier: To store value for Identifier 466 # @var Content: To store value for Content 467 # 468 class UserExtensionsClass(object): 469 def __init__(self): 470 self.UserID = '' 471 self.Identifier = 0 472 self.Content = '' 473 self.Defines = [] 474 self.BuildOptions = [] 475