From cbe7543ebbf9bb3e8531a2235ff205713b569605 Mon Sep 17 00:00:00 2001 From: Bob Feng Date: Thu, 5 Sep 2019 17:45:10 +0800 Subject: [PATCH] BaseTools: Fix a bug for Hii Pcd override BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2157 Hii Pcd links to a efi variable. The Variable default value is evaluated by related Hii Pcds setting. If multiple Hii Pcds links to one variable, and the offset overlap, the later Hii Pcds setting should be effective. There is a tool bug that is if the Pcds are in different dsc file which are included into the platform dsc file, build tool does not get the Pcds relative position correctly. That means build tool does not know which Pcd is the later one. As the result, the variable default value will be incorrect. This patch is to fix this bug. Cc: Liming Gao Signed-off-by: Bob Feng Reviewed-by: Liming Gao --- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index d2b5ccbb7a..9192077f90 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -3014,7 +3014,7 @@ class DscBuildData(PlatformBuildClassObject): # Remove redundant PCD candidates, per the ARCH and SKU - for PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4 in PcdList: + for index,(PcdCName, TokenSpaceGuid, SkuName, DefaultStore, Dummy4) in enumerate(PcdList): Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid, DefaultStore] if Setting is None: @@ -3083,7 +3083,7 @@ class DscBuildData(PlatformBuildClassObject): PcdClassObj.UserDefinedDefaultStoresFlag = True Pcds[PcdCName, TokenSpaceGuid] = PcdClassObj - Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = int(Dummy4) + Pcds[PcdCName, TokenSpaceGuid].CustomAttribute['DscPosition'] = index if SkuName not in Pcds[PcdCName, TokenSpaceGuid].DscRawValue: Pcds[PcdCName, TokenSpaceGuid].DscRawValue[SkuName] = {} Pcds[PcdCName, TokenSpaceGuid].DscRawValueInfo[SkuName] = {} -- 2.39.2