]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/edk2/model/baseobject.py
ee00529f464bc51e1bfed35fa7e08e5b97aca079
3 # Copyright (c) 2011 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
7 from plugins
.EdkPlugins
.basemodel
import ini
8 from plugins
.EdkPlugins
.edk2
.model
import dsc
9 from plugins
.EdkPlugins
.edk2
.model
import inf
10 from plugins
.EdkPlugins
.edk2
.model
import dec
12 from plugins
.EdkPlugins
.basemodel
.message
import *
14 class SurfaceObject(object):
17 def __new__(cls
, *args
, **kwargs
):
18 """Maintain only a single instance of this object
19 @return: instance of this class
22 obj
= object.__new
__(cls
)
23 if "None" not in cls
._objs
:
24 cls
._objs
["None"] = []
25 cls
._objs
["None"].append(obj
)
29 def __init__(self
, parent
, workspace
):
32 self
._workspace
= workspace
33 self
._isModify
= False
34 self
._modifiedObjs
= []
40 key
= self
.GetRelativeFilename()
41 self
.GetFileObj().Destroy(self
)
43 # dereference self from _objs arrary
44 assert key
in self
._objs
, "when destory, object is not in obj list"
45 assert self
in self
._objs
[key
], "when destory, object is not in obj list"
46 self
._objs
[key
].remove(self
)
47 if len(self
._objs
[key
]) == 0:
53 def GetWorkspace(self
):
54 return self
._workspace
56 def GetFileObjectClass(self
):
57 return ini
.BaseINIFile
59 def GetFilename(self
):
60 return self
.GetFileObj().GetFilename()
65 def GetRelativeFilename(self
):
66 fullPath
= self
.GetFilename()
67 return fullPath
[len(self
._workspace
) + 1:]
69 def Load(self
, relativePath
):
70 # if has been loaded, directly return
71 if self
._fileObj
is not None: return True
73 relativePath
= os
.path
.normpath(relativePath
)
74 fullPath
= os
.path
.join(self
._workspace
, relativePath
)
75 fullPath
= os
.path
.normpath(fullPath
)
77 if not os
.path
.exists(fullPath
):
78 ErrorMsg("file does not exist!", fullPath
)
81 self
._fileObj
= self
.GetFileObjectClass()(fullPath
, self
)
83 if not self
._fileObj
.Parse():
84 ErrorMsg("Fail to parse file!", fullPath
)
87 # remove self from None list to list with filename as key
89 if self
not in cls
._objs
["None"]:
90 ErrorMsg("Sufrace object does not be create into None list")
91 cls
._objs
["None"].remove(self
)
92 if relativePath
not in cls
._objs
:
93 cls
._objs
[relativePath
] = []
94 cls
._objs
[relativePath
].append(self
)
98 def Reload(self
, force
=False):
100 # whether require must be update
102 ret
= self
.GetFileObj().Reload(True)
104 if self
.IsModified():
105 if self
.GetFileObj().IsModified():
106 ret
= self
.GetFileObj().Reload()
109 def Modify(self
, modify
=True, modifiedObj
=None):
111 #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
112 if issubclass(modifiedObj
.__class
__, ini
.BaseINIFile
) and self
._isModify
:
114 self
._isModify
= modify
115 self
.GetParent().Modify(modify
, self
)
117 self
._isModify
= modify
119 def IsModified(self
):
120 return self
._isModify
122 def GetModifiedObjs(self
):
123 return self
._modifiedObjs
125 def FilterObjsByArch(self
, objs
, arch
):
128 if obj
.GetArch().lower() == 'common':
131 if obj
.GetArch().lower() == arch
.lower():
136 class Platform(SurfaceObject
):
137 def __init__(self
, parent
, workspace
):
138 SurfaceObject
.__init
__(self
, parent
, workspace
)
143 for module
in self
._modules
:
147 del self
._packages
[:]
148 SurfaceObject
.Destroy(self
)
151 return self
.GetFileObj().GetDefine("PLATFORM_NAME")
153 def GetFileObjectClass(self
):
156 def GetModuleCount(self
):
157 if self
.GetFileObj() is None:
158 ErrorMsg("Fail to get module count because DSC file has not been load!")
160 return len(self
.GetFileObj().GetComponents())
162 def GetSupportArchs(self
):
163 return self
.GetFileObj().GetDefine("SUPPORTED_ARCHITECTURES").strip().split('#')[0].split('|')
165 def LoadModules(self
, precallback
=None, postcallback
=None):
166 for obj
in self
.GetFileObj().GetComponents():
167 mFilename
= obj
.GetFilename()
168 if precallback
is not None:
169 precallback(self
, mFilename
)
171 if arch
.lower() == 'common':
172 archarr
= self
.GetSupportArchs()
176 module
= Module(self
, self
.GetWorkspace())
177 if module
.Load(mFilename
, arch
, obj
.GetOveridePcds(), obj
.GetOverideLibs()):
178 self
._modules
.append(module
)
179 if postcallback
is not None:
180 postcallback(self
, module
)
183 ErrorMsg("Fail to load module %s" % mFilename
)
185 def GetModules(self
):
188 def GetLibraryPath(self
, classname
, arch
, type):
189 objs
= self
.GetFileObj().GetSectionObjectsByName("libraryclasses")
192 if classname
.lower() != obj
.GetClass().lower():
194 if obj
.GetArch().lower() != 'common' and \
195 obj
.GetArch().lower() != arch
.lower():
198 if obj
.GetModuleType().lower() != 'common' and \
199 obj
.GetModuleType().lower() != type.lower():
202 return obj
.GetInstance()
204 ErrorMsg("Fail to get library class %s [%s][%s] from platform %s" % (classname
, arch
, type, self
.GetFilename()))
207 def GetPackage(self
, path
):
208 package
= self
.GetParent().GetPackage(path
)
209 if package
not in self
._packages
:
210 self
._packages
.append(package
)
213 def GetPcdBuildObjs(self
, name
, arch
=None):
215 objs
= self
.GetFileObj().GetSectionObjectsByName('pcds')
217 if obj
.GetPcdName().lower() == name
.lower():
220 arr
= self
.FilterObjsByArch(arr
, arch
)
223 def Reload(self
, callback
=None):
224 # do not care force paramter for platform object
225 isFileChanged
= self
.GetFileObj().IsModified()
226 ret
= SurfaceObject
.Reload(self
, False)
227 if not ret
: return False
229 # destroy all modules and reload them again
230 for obj
in self
._modules
:
233 del self
._packages
[:]
234 self
.LoadModules(callback
)
236 for obj
in self
._modules
:
237 callback(self
, obj
.GetFilename())
243 def Modify(self
, modify
=True, modifiedObj
=None):
245 #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
246 if issubclass(modifiedObj
.__class
__, ini
.BaseINIFile
) and self
._isModify
:
248 self
._isModify
= modify
249 self
.GetParent().Modify(modify
, self
)
251 if self
.GetFileObj().IsModified():
253 for obj
in self
._modules
:
257 self
._isModify
= modify
258 self
.GetParent().Modify(modify
, self
)
260 def GetModuleObject(self
, relativePath
, arch
):
261 path
= os
.path
.normpath(relativePath
)
262 for obj
in self
._modules
:
263 if obj
.GetRelativeFilename() == path
:
264 if arch
.lower() == 'common':
266 if obj
.GetArch() == arch
:
270 def GenerateFullReferenceDsc(self
):
271 oldDsc
= self
.GetFileObj()
272 newDsc
= dsc
.DSCFile()
273 newDsc
.CopySectionsByName(oldDsc
, 'defines')
274 newDsc
.CopySectionsByName(oldDsc
, 'SkuIds')
277 # Dynamic common section should also be copied
279 newDsc
.CopySectionsByName(oldDsc
, 'PcdsDynamicDefault')
280 newDsc
.CopySectionsByName(oldDsc
, 'PcdsDynamicHii')
281 newDsc
.CopySectionsByName(oldDsc
, 'PcdsDynamicVpd')
282 newDsc
.CopySectionsByName(oldDsc
, 'PcdsDynamicEx')
284 sects
= oldDsc
.GetSectionByName('Components')
285 for oldSect
in sects
:
286 newSect
= newDsc
.AddNewSection(oldSect
.GetName())
287 for oldComObj
in oldSect
.GetObjects():
288 module
= self
.GetModuleObject(oldComObj
.GetFilename(), oldSect
.GetArch())
289 if module
is None: continue
291 newComObj
= dsc
.DSCComponentObject(newSect
)
292 newComObj
.SetFilename(oldComObj
.GetFilename())
294 # add all library instance for override section
295 libdict
= module
.GetLibraries()
296 for libclass
in libdict
.keys():
297 if libdict
[libclass
] is not None:
298 newComObj
.AddOverideLib(libclass
, libdict
[libclass
].GetRelativeFilename().replace('\\', '/'))
300 # add all pcds for override section
301 pcddict
= module
.GetPcds()
302 for pcd
in pcddict
.values():
303 buildPcd
= pcd
.GetBuildObj()
304 buildType
= buildPcd
.GetPcdType()
306 if buildType
.lower() == 'pcdsdynamichii' or \
307 buildType
.lower() == 'pcdsdynamicvpd' or \
308 buildType
.lower() == 'pcdsdynamicdefault':
309 buildType
= 'PcdsDynamic'
310 if buildType
!= 'PcdsDynamic':
311 buildValue
= buildPcd
.GetPcdValue()
312 newComObj
.AddOveridePcd(buildPcd
.GetPcdName(),
315 newSect
.AddObject(newComObj
)
318 class Module(SurfaceObject
):
319 def __init__(self
, parent
, workspace
):
320 SurfaceObject
.__init
__(self
, parent
, workspace
)
321 self
._arch
= 'common'
322 self
._parent
= parent
323 self
._overidePcds
= {}
324 self
._overideLibs
= {}
334 for lib
in self
._libs
.values():
339 for pcd
in self
._pcds
.values():
343 for ppi
in self
._ppis
:
347 for protocol
in self
._protocols
:
348 if protocol
is not None:
350 del self
._protocols
[:]
352 for guid
in self
._guids
:
357 del self
._packages
[:]
359 SurfaceObject
.Destroy(self
)
361 def GetFileObjectClass(self
):
364 def GetLibraries(self
):
367 def Load(self
, filename
, arch
='common', overidePcds
=None, overideLibs
=None):
368 if not SurfaceObject
.Load(self
, filename
):
372 if overidePcds
is not None:
373 self
._overideLibs
= overideLibs
374 if overideLibs
is not None:
375 self
._overidePcds
= overidePcds
377 self
._SearchLibraries
()
378 self
._SearchPackage
()
379 self
._SearchSurfaceItems
()
385 def GetModuleName(self
):
386 return self
.GetFileObj().GetDefine("BASE_NAME")
388 def GetModuleType(self
):
389 return self
.GetFileObj().GetDefine("MODULE_TYPE")
391 def GetPlatform(self
):
392 return self
.GetParent()
394 def GetModuleObj(self
):
398 pcds
= self
._pcds
.copy()
399 for lib
in self
._libs
.values():
400 if lib
is None: continue
401 for name
in lib
._pcds
.keys():
402 pcds
[name
] = lib
._pcds
[name
]
408 for lib
in self
._libs
.values():
409 if lib
is None: continue
413 def GetProtocols(self
):
415 pros
= self
._protocols
416 for lib
in self
._libs
.values():
417 if lib
is None: continue
418 pros
+= lib
._protocols
424 for lib
in self
._libs
.values():
425 if lib
is None: continue
432 for lib
in self
._libs
.values():
433 if lib
is None: continue
438 return self
.GetFileObj().GetDefine("LIBRARY_CLASS") is not None
440 def GetLibraryInstance(self
, classname
, arch
, type):
441 if classname
not in self
._libs
.keys():
442 # find in overide lib firstly
443 if classname
in self
._overideLibs
.keys():
444 self
._libs
[classname
] = Library(self
, self
.GetWorkspace())
445 self
._libs
[classname
].Load(self
._overideLibs
[classname
])
446 return self
._libs
[classname
]
448 parent
= self
.GetParent()
449 if issubclass(parent
.__class
__, Platform
):
450 path
= parent
.GetLibraryPath(classname
, arch
, type)
452 ErrorMsg('Fail to get library instance for %s' % classname
, self
.GetFilename())
454 self
._libs
[classname
] = Library(self
, self
.GetWorkspace())
455 if not self
._libs
[classname
].Load(path
, self
.GetArch()):
456 self
._libs
[classname
] = None
458 self
._libs
[classname
] = parent
.GetLibraryInstance(classname
, arch
, type)
459 return self
._libs
[classname
]
461 def GetSourceObjs(self
):
462 return self
.GetFileObj().GetSectionObjectsByName('source')
464 def _SearchLibraries(self
):
465 objs
= self
.GetFileObj().GetSectionObjectsByName('libraryclasses')
466 arch
= self
.GetArch()
467 type = self
.GetModuleType()
469 if obj
.GetArch().lower() != 'common' and \
470 obj
.GetArch().lower() not in self
.GetPlatform().GetSupportArchs():
472 classname
= obj
.GetClass()
473 instance
= self
.GetLibraryInstance(classname
, arch
, type)
474 if not self
.IsLibrary() and instance
is not None:
475 instance
._isInherit
= False
477 if classname
not in self
._libs
.keys():
478 self
._libs
[classname
] = instance
480 def _SearchSurfaceItems(self
):
481 # get surface item from self's inf
487 if self
.GetFileObj() is not None:
488 pcds
= self
.FilterObjsByArch(self
.GetFileObj().GetSectionObjectsByName('pcd'),
491 if pcd
.GetPcdName() not in self
._pcds
.keys():
492 pcdItem
= PcdItem(pcd
.GetPcdName(), self
, pcd
)
493 self
._pcds
[pcd
.GetPcdName()] = ModulePcd(self
,
498 ppis
+= self
.FilterObjsByArch(self
.GetFileObj().GetSectionObjectsByName('ppis'),
502 item
= PpiItem(ppi
.GetName(), self
, ppi
)
503 if item
not in self
._ppis
:
504 self
._ppis
.append(item
)
506 pros
+= self
.FilterObjsByArch(self
.GetFileObj().GetSectionObjectsByName('protocols'),
510 item
= ProtocolItem(pro
.GetName(), self
, pro
)
511 if item
not in self
._protocols
:
512 self
._protocols
.append(item
)
514 deps
+= self
.FilterObjsByArch(self
.GetFileObj().GetSectionObjectsByName('depex'),
517 item
= DepexItem(self
, dep
)
518 self
._depexs
.append(item
)
520 guids
+= self
.FilterObjsByArch(self
.GetFileObj().GetSectionObjectsByName('guids'),
523 item
= GuidItem(guid
.GetName(), self
, guid
)
524 if item
not in self
._guids
:
525 self
._guids
.append(item
)
527 def _SearchPackage(self
):
528 objs
= self
.GetFileObj().GetSectionObjectsByName('packages')
530 package
= self
.GetPlatform().GetPackage(obj
.GetPath())
531 if package
is not None:
532 self
._packages
.append(package
)
534 def GetPackages(self
):
535 return self
._packages
537 def GetPcdObjects(self
):
538 if self
.GetFileObj() is None:
541 return self
.GetFileObj().GetSectionObjectsByName('pcd')
543 def GetLibraryClassHeaderFilePath(self
):
544 lcname
= self
.GetFileObj().GetProduceLibraryClass()
545 if lcname
is None: return None
547 pkgs
= self
.GetPackages()
549 path
= package
.GetLibraryClassHeaderPathByName(lcname
)
551 return os
.path
.realpath(os
.path
.join(package
.GetFileObj().GetPackageRootPath(), path
))
554 def Reload(self
, force
=False, callback
=None):
555 if callback
is not None:
556 callback(self
, "Starting reload...")
558 ret
= SurfaceObject
.Reload(self
, force
)
559 if not ret
: return False
561 if not force
and not self
.IsModified():
564 for lib
in self
._libs
.values():
569 for pcd
in self
._pcds
.values():
573 for ppi
in self
._ppis
:
577 for protocol
in self
._protocols
:
579 del self
._protocols
[:]
581 for guid
in self
._guids
:
585 del self
._packages
[:]
588 if callback
is not None:
589 callback(self
, "Searching libraries...")
590 self
._SearchLibraries
()
591 if callback
is not None:
592 callback(self
, "Searching packages...")
593 self
._SearchPackage
()
594 if callback
is not None:
595 callback(self
, "Searching surface items...")
596 self
._SearchSurfaceItems
()
601 def Modify(self
, modify
=True, modifiedObj
=None):
603 #LogMsg("%s is modified, modified object is %s" % (self.GetFilename(), modifiedObj))
604 if issubclass(modifiedObj
.__class
__, ini
.BaseINIFile
) and self
._isModify
:
606 self
._isModify
= modify
607 self
.GetParent().Modify(modify
, self
)
609 if self
.GetFileObj().IsModified():
612 self
._isModify
= modify
613 self
.GetParent().Modify(modify
, self
)
615 class Library(Module
):
616 def __init__(self
, parent
, workspace
):
617 Module
.__init
__(self
, parent
, workspace
)
618 self
._isInherit
= True
621 return self
._isInherit
623 def GetModuleType(self
):
624 return self
.GetParent().GetModuleType()
626 def GetPlatform(self
):
627 return self
.GetParent().GetParent()
629 def GetModuleObj(self
):
630 return self
.GetParent()
633 return self
.GetParent().GetArch()
638 SurfaceObject
.Destroy(self
)
640 class Package(SurfaceObject
):
641 def __init__(self
, parent
, workspace
):
642 SurfaceObject
.__init
__(self
, parent
, workspace
)
652 return list(self
._ppis
.values())
654 def GetProtocols(self
):
655 return list(self
._protocols
.values())
658 return list(self
._guids
.values())
661 for pcd
in self
._pcds
.values():
664 for guid
in self
._guids
.values():
667 for protocol
in self
._protocols
.values():
668 if protocol
is not None:
670 for ppi
in self
._ppis
.values():
675 self
._protocols
.clear()
678 SurfaceObject
.Destroy(self
)
680 def Load(self
, relativePath
):
681 ret
= SurfaceObject
.Load(self
, relativePath
)
682 if not ret
: return False
683 pcds
= self
.GetFileObj().GetSectionObjectsByName('pcds')
685 if pcd
.GetPcdName() in self
._pcds
.keys():
686 if self
._pcds
[pcd
.GetPcdName()] is not None:
687 self
._pcds
[pcd
.GetPcdName()].AddDecObj(pcd
)
689 self
._pcds
[pcd
.GetPcdName()] = PcdItem(pcd
.GetPcdName(), self
, pcd
)
691 guids
= self
.GetFileObj().GetSectionObjectsByName('guids')
693 if guid
.GetName() not in self
._guids
.keys():
694 self
._guids
[guid
.GetName()] = GuidItem(guid
.GetName(), self
, guid
)
696 WarnMsg("Duplicate definition for %s" % guid
.GetName())
698 ppis
= self
.GetFileObj().GetSectionObjectsByName('ppis')
700 if ppi
.GetName() not in self
._ppis
.keys():
701 self
._ppis
[ppi
.GetName()] = PpiItem(ppi
.GetName(), self
, ppi
)
703 WarnMsg("Duplicate definition for %s" % ppi
.GetName())
705 protocols
= self
.GetFileObj().GetSectionObjectsByName('protocols')
706 for protocol
in protocols
:
707 if protocol
.GetName() not in self
._protocols
.keys():
708 self
._protocols
[protocol
.GetName()] = ProtocolItem(protocol
.GetName(), self
, protocol
)
710 WarnMsg("Duplicate definition for %s" % protocol
.GetName())
714 def GetFileObjectClass(self
):
718 return self
.GetFileObj().GetDefine("PACKAGE_NAME")
720 def GetPcdDefineObjs(self
, name
=None):
722 objs
= self
.GetFileObj().GetSectionObjectsByName('pcds')
723 if name
is None: return objs
726 if obj
.GetPcdName().lower() == name
.lower():
730 def GetLibraryClassObjs(self
):
731 return self
.GetFileObj().GetSectionObjectsByName('libraryclasses')
733 def Modify(self
, modify
=True, modifiedObj
=None):
735 self
._isModify
= modify
736 self
.GetParent().Modify(modify
, self
)
738 if self
.GetFileObj().IsModified():
741 self
._isModify
= modify
742 self
.GetParent().Modify(modify
, self
)
744 def GetLibraryClassHeaderPathByName(self
, clsname
):
745 objs
= self
.GetLibraryClassObjs()
747 if obj
.GetClassName() == clsname
:
748 return obj
.GetHeaderFile()
751 class DepexItem(object):
752 def __init__(self
, parent
, infObj
):
753 self
._parent
= parent
754 self
._infObj
= infObj
756 def GetDepexString(self
):
757 return str(self
._infObj
)
759 def GetInfObject(self
):
762 class ModulePcd(object):
763 _type_mapping
= {'FeaturePcd': 'PcdsFeatureFlag',
764 'FixedPcd': 'PcdsFixedAtBuild',
765 'PatchPcd': 'PcdsPatchableInModule'}
767 def __init__(self
, parent
, name
, infObj
, pcdItem
):
768 assert issubclass(parent
.__class
__, Module
), "Module's PCD's parent must be module!"
769 assert pcdItem
is not None, 'Pcd %s does not in some package!' % name
772 self
._parent
= parent
773 self
._pcdItem
= pcdItem
774 self
._infObj
= infObj
783 return self
._parent
.GetArch()
786 self
._pcdItem
.DeRef(self
._parent
)
789 def GetBuildObj(self
):
790 platformInfos
= self
._parent
.GetPlatform().GetPcdBuildObjs(self
._name
, self
.GetArch())
791 modulePcdType
= self
._infObj
.GetPcdType()
793 # if platform do not gives pcd's value, get default value from package
794 if len(platformInfos
) == 0:
795 if modulePcdType
.lower() == 'pcd':
796 return self
._pcdItem
.GetDecObject()
798 for obj
in self
._pcdItem
.GetDecObjects():
799 if modulePcdType
not in self
._type
_mapping
.keys():
800 ErrorMsg("Invalid PCD type %s" % modulePcdType
)
803 if self
._type
_mapping
[modulePcdType
] == obj
.GetPcdType():
805 ErrorMsg ('Module PCD type %s does not in valied range [%s] in package!' % \
808 if modulePcdType
.lower() == 'pcd':
809 if len(platformInfos
) > 1:
810 WarnMsg("Find more than one value for PCD %s in platform %s" % \
811 (self
._name
, self
._parent
.GetPlatform().GetFilename()))
812 return platformInfos
[0]
814 for obj
in platformInfos
:
815 if modulePcdType
not in self
._type
_mapping
.keys():
816 ErrorMsg("Invalid PCD type %s" % modulePcdType
)
819 if self
._type
_mapping
[modulePcdType
] == obj
.GetPcdType():
822 ErrorMsg('Can not find value for pcd %s in pcd type %s' % \
823 (self
._name
, modulePcdType
))
827 class SurfaceItem(object):
830 def __new__(cls
, *args
, **kwargs
):
831 """Maintain only a single instance of this object
832 @return: instance of this class
838 if issubclass(parent
.__class
__, Package
):
839 if name
in cls
._objs
.keys():
840 ErrorMsg("%s item is duplicated defined in packages: %s and %s" %
841 (name
, parent
.GetFilename(), cls
._objs
[name
].GetParent().GetFilename()))
843 obj
= object.__new
__(cls
)
844 cls
._objs
[name
] = obj
846 elif issubclass(parent
.__class
__, Module
):
847 if name
not in cls
._objs
.keys():
848 ErrorMsg("%s item does not defined in any package! It is used by module %s" % \
849 (name
, parent
.GetFilename()))
851 return cls
._objs
[name
]
856 def __init__(self
, name
, parent
, fileObj
):
857 if issubclass(parent
.__class
__, Package
):
859 self
._parent
= parent
860 self
._decObj
= [fileObj
]
863 self
.RefModule(parent
, fileObj
)
866 def GetObjectDict(cls
):
872 def GetReference(self
):
875 def RefModule(self
, mObj
, infObj
):
876 if mObj
in self
._refMods
.keys():
878 self
._refMods
[mObj
] = infObj
880 def DeRef(self
, mObj
):
881 if mObj
not in self
._refMods
.keys():
882 WarnMsg("%s is not referenced by module %s" % (self
._name
, mObj
.GetFilename()))
884 del self
._refMods
[mObj
]
887 self
._refMods
.clear()
889 del cls
._objs
[self
._name
]
894 def GetDecObject(self
):
895 return self
._decObj
[0]
897 def GetDecObjects(self
):
900 class PcdItem(SurfaceItem
):
901 def AddDecObj(self
, fileObj
):
902 for decObj
in self
._decObj
:
903 if decObj
.GetFilename() != fileObj
.GetFilename():
904 ErrorMsg("Pcd %s defined in more than one packages : %s and %s" % \
905 (self
._name
, decObj
.GetFilename(), fileObj
.GetFilename()))
907 if decObj
.GetPcdType() == fileObj
.GetPcdType() and \
908 decObj
.GetArch().lower() == fileObj
.GetArch():
909 ErrorMsg("Pcd %s is duplicated defined in pcd type %s in package %s" % \
910 (self
._name
, decObj
.GetPcdType(), decObj
.GetFilename()))
912 self
._decObj
.append(fileObj
)
914 def GetValidPcdType(self
):
916 for obj
in self
._decObj
:
917 if obj
.GetPcdType() not in types
:
918 types
+= obj
.GetPcdType()
921 class GuidItem(SurfaceItem
):
924 class PpiItem(SurfaceItem
):
927 class ProtocolItem(SurfaceItem
):