X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FAutoGen.py;h=a4e36d1a2fb4f3a47157f932157d7a7e8a86f222;hp=5940e88682edf3486abe0feabb9ba64fe3cce897;hb=1563349a967d7e02c43492ba853babb9c660a083;hpb=eca980c0c899d9c2c57327e8af03fabe1da5feef diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 5940e88682..a4e36d1a2f 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -256,12 +256,6 @@ class WorkspaceAutoGen(AutoGen): def _InitWorker(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb, BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None, Progress=None, BuildModule=None): - if Fds is None: - Fds = [] - if Fvs is None: - Fvs = [] - if Caps is None: - Caps = [] self.BuildDatabase = MetaFileDb self.MetaFile = ActivePlatform self.WorkspaceDir = WorkspaceDir @@ -276,9 +270,9 @@ class WorkspaceAutoGen(AutoGen): self.TargetTxt = BuildConfig self.ToolDef = ToolDefinition self.FdfFile = FlashDefinitionFile - self.FdTargetList = Fds - self.FvTargetList = Fvs - self.CapTargetList = Caps + self.FdTargetList = Fds if Fds else [] + self.FvTargetList = Fvs if Fvs else [] + self.CapTargetList = Caps if Caps else [] self.AutoGenObjectList = [] self._BuildDir = None self._FvDir = None @@ -361,13 +355,12 @@ class WorkspaceAutoGen(AutoGen): # but the path (self.MetaFile.Path) is the real path for key in self.FdfProfile.InfDict: if key == 'ArchTBD': - Platform_cache = {} MetaFile_cache = {} for Arch in self.ArchList: - Platform_cache[Arch] = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain] + Current_Platform_cache = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain] MetaFile_cache[Arch] = set() - for Pkey in Platform_cache[Arch].Modules: - MetaFile_cache[Arch].add(Platform_cache[Arch].Modules[Pkey].MetaFile) + for Pkey in Current_Platform_cache.Modules: + MetaFile_cache[Arch].add(Current_Platform_cache.Modules[Pkey].MetaFile) for Inf in self.FdfProfile.InfDict[key]: ModuleFile = PathClass(NormPath(Inf), GlobalData.gWorkspace, Arch) for Arch in self.ArchList: @@ -410,7 +403,8 @@ class WorkspaceAutoGen(AutoGen): # apply SKU and inject PCDs from Flash Definition file for Arch in self.ArchList: Platform = self.BuildDatabase[self.MetaFile, Arch, Target, Toolchain] - + PlatformPcds = Platform.Pcds + self._GuidDict = Platform._GuidDict SourcePcdDict = {'DynamicEx':set(), 'PatchableInModule':set(),'Dynamic':set(),'FixedAtBuild':set()} BinaryPcdDict = {'DynamicEx':set(), 'PatchableInModule':set()} SourcePcdDict_Keys = SourcePcdDict.keys() @@ -1278,7 +1272,7 @@ class PlatformAutoGen(AutoGen): FixedAtBuildPcds = {} ShareFixedAtBuildPcdsSameValue = {} for Module in LibAuto._ReferenceModules: - for Pcd in Module.FixedAtBuildPcds: + for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds: key = ".".join((Pcd.TokenSpaceGuidCName,Pcd.TokenCName)) if key not in FixedAtBuildPcds: ShareFixedAtBuildPcdsSameValue[key] = True @@ -1456,13 +1450,10 @@ class PlatformAutoGen(AutoGen): self._NonDynaPcdList_.remove (self._NonDynaPcdList_[Index]) PcdFromModule.Pending = False self._NonDynaPcdList_.append (PcdFromModule) - # Parse the DynamicEx PCD from the AsBuild INF module list of FDF. - DscModuleList = [] - for ModuleInf in self.Platform.Modules.keys(): - DscModuleList.append (os.path.normpath(ModuleInf.Path)) + DscModuleSet = {os.path.normpath(ModuleInf.Path) for ModuleInf in self.Platform.Modules} # add the PCD from modules that listed in FDF but not in DSC to Database for InfName in FdfModuleList: - if InfName not in DscModuleList: + if InfName not in DscModuleSet: InfClass = PathClass(InfName) M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, self.ToolChain] # If a module INF in FDF but not in current arch's DSC module list, it must be module (either binary or source) @@ -2354,6 +2345,7 @@ class PlatformAutoGen(AutoGen): if FromPcd.MaxDatumSize: ToPcd.MaxDatumSize = FromPcd.MaxDatumSize + ToPcd.MaxSizeUserSet = FromPcd.MaxDatumSize if FromPcd.DefaultValue: ToPcd.DefaultValue = FromPcd.DefaultValue if FromPcd.TokenValue: @@ -2456,6 +2448,7 @@ class PlatformAutoGen(AutoGen): for Name, Guid in Pcds: Pcd = Pcds[Name, Guid] if Pcd.DatumType == "VOID*" and Pcd.MaxDatumSize in ['', None]: + Pcd.MaxSizeUserSet = None Value = Pcd.DefaultValue if Value in [None, '']: Pcd.MaxDatumSize = '1' @@ -2788,7 +2781,7 @@ class ModuleAutoGen(AutoGen): self.Workspace = Workspace self.WorkspaceDir = Workspace.WorkspaceDir - + self._GuidDict = Workspace._GuidDict self.MetaFile = ModuleFile self.PlatformInfo = PlatformAutoGen(Workspace, PlatformFile, Target, Toolchain, Arch) @@ -4157,9 +4150,12 @@ class ModuleAutoGen(AutoGen): Padding = Padding * 2 ArraySize = ArraySize / 2 if ArraySize < (len(PcdValue) + 1): - EdkLogger.error("build", AUTOGEN_ERROR, + if Pcd.MaxSizeUserSet: + EdkLogger.error("build", AUTOGEN_ERROR, "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName) ) + else: + ArraySize = len(PcdValue) + 1 if ArraySize > len(PcdValue) + 1: NewValue = NewValue + Padding * (ArraySize - len(PcdValue) - 1) PcdValue = NewValue + Padding.strip().rstrip(',') + '}' @@ -4167,9 +4163,12 @@ class ModuleAutoGen(AutoGen): PcdValue = PcdValue.rstrip('}') + ', 0x00' * (ArraySize - len(PcdValue.split(','))) PcdValue += '}' else: - EdkLogger.error("build", AUTOGEN_ERROR, + if Pcd.MaxSizeUserSet: + EdkLogger.error("build", AUTOGEN_ERROR, "The maximum size of VOID* type PCD '%s.%s' is less than its actual size occupied." % (Pcd.TokenSpaceGuidCName, TokenCName) ) + else: + ArraySize = len(PcdValue) + 1 PcdItem = '%s.%s|%s|0x%X' % \ (Pcd.TokenSpaceGuidCName, TokenCName, PcdValue, PatchPcd[1]) PcdComments = ''