Skip to content

Commit

Permalink
Fixed PCD override issue.
Browse files Browse the repository at this point in the history
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1236 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
jwang36 committed May 19, 2008
1 parent 834a841 commit d287317
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
18 changes: 13 additions & 5 deletions Source/Python/AutoGen/AutoGen.py
Expand Up @@ -917,15 +917,23 @@ def ApplyLibraryInstance(self, Module):
# @param ToPcd The PCD to be overrided
# @param FromPcd The PCD overrideing from
#
def _OverridePcd(self, ToPcd, FromPcd):
def _OverridePcd(self, ToPcd, FromPcd, Module=""):
#
# in case there's PCDs coming from FDF file, which have no type given.
# at this point, PcdInModule.Type has the type found from dependent
# at this point, ToPcd.Type has the type found from dependent
# package
#
if FromPcd != None:
if FromPcd.Type not in [None, '']:
if ToPcd.Pending and FromPcd.Type not in [None, '']:
ToPcd.Type = FromPcd.Type
elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [None, ''] \
and ToPcd.Type != FromPcd.Type:
EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD type",
ExtraData="%s.%s is defined as [%s] in module %s, but as [%s] in platform."\
% (ToPcd.TokenSpaceGuidCName, ToPcd.TokenCName,
ToPcd.Type, Module, FromPcd.Type),
File=self._MetaFile)

if FromPcd.MaxDatumSize not in [None, '']:
ToPcd.MaxDatumSize = FromPcd.MaxDatumSize
if FromPcd.DefaultValue not in [None, '']:
Expand Down Expand Up @@ -977,7 +985,7 @@ def ApplyPcdSetting(self, Module):
else:
PcdInPlatform = None
# then override the settings if any
self._OverridePcd(PcdInModule, PcdInPlatform)
self._OverridePcd(PcdInModule, PcdInPlatform, Module)
# resolve the VariableGuid value
for SkuId in PcdInModule.SkuInfoList:
Sku = PcdInModule.SkuInfoList[SkuId]
Expand All @@ -999,7 +1007,7 @@ def ApplyPcdSetting(self, Module):
PlatformModule = self.Platform.Modules[str(Module)]
for Key in PlatformModule.Pcds:
if Key in Module.Pcds:
self._OverridePcd(Module.Pcds[Key], PlatformModule.Pcds[Key])
self._OverridePcd(Module.Pcds[Key], PlatformModule.Pcds[Key], Module)
return Module.Pcds.values()

## Resolve library names to library modules
Expand Down
11 changes: 6 additions & 5 deletions Source/Python/Workspace/BuildClassObject.py
Expand Up @@ -16,7 +16,7 @@
## PcdClassObject
#
# This Class is used for PcdObject
#
#
# @param object: Inherited from object class
# @param Name: Input value for Name of Pcd, default is None
# @param Guid: Input value for Guid of Pcd, default is None
Expand Down Expand Up @@ -50,6 +50,7 @@ def __init__(self, Name = None, Guid = None, Type = None, DatumType = None, Valu
self.MaxDatumSize = MaxDatumSize
self.SkuInfoList = SkuInfoList
self.Phase = "DXE"
self.Pending = False

## Convert the class to a string
#
Expand Down Expand Up @@ -94,7 +95,7 @@ def __hash__(self):
## LibraryClassObject
#
# This Class defines LibraryClassObject used in BuildDatabase
#
#
# @param object: Inherited from object class
# @param Name: Input value for LibraryClassName, default is None
# @param SupModList: Input value for SupModList, default is []
Expand All @@ -114,7 +115,7 @@ def __init__(self, Name = None, SupModList = [], Type = None):
## ModuleBuildClassObject
#
# This Class defines ModuleBuildClass
#
#
# @param object: Inherited from object class
#
# @var DescFilePath: To store value for DescFilePath
Expand Down Expand Up @@ -218,7 +219,7 @@ def __hash__(self):
## PackageBuildClassObject
#
# This Class defines PackageBuildClass
#
#
# @param object: Inherited from object class
#
# @var DescFilePath: To store value for DescFilePath
Expand Down Expand Up @@ -283,7 +284,7 @@ def __hash__(self):
## PlatformBuildClassObject
#
# This Class defines PlatformBuildClass
#
#
# @param object: Inherited from object class
#
# @var DescFilePath: To store value for DescFilePath
Expand Down
5 changes: 4 additions & 1 deletion Source/Python/Workspace/WorkspaceDatabase.py
Expand Up @@ -359,7 +359,7 @@ def _GetModules(self):
MaxDatumSize = TokenList[1]
else:
MaxDatumSize = ''
Type = self._PCD_TYPE_STRING_[MODEL_PCD_FIXED_AT_BUILD]
Type = self._PCD_TYPE_STRING_[Type]
Pcd = PcdClassObject(
PcdCName,
TokenSpaceGuid,
Expand Down Expand Up @@ -1676,10 +1676,13 @@ def _GetPcd(self, Type):
#
PcdType = self._PCD_TYPE_STRING_[Type]
if Type in [MODEL_PCD_DYNAMIC, MODEL_PCD_DYNAMIC_EX]:
Pcd.Pending = True
for T in ["FixedAtBuild", "PatchableInModule", "FeatureFlag", "Dynamic", "DynamicEx"]:
if (PcdCName, TokenSpaceGuid, T) in Package.Pcds:
PcdType = T
break
else:
Pcd.Pending = False

if (PcdCName, TokenSpaceGuid, PcdType) in Package.Pcds:
PcdInPackage = Package.Pcds[PcdCName, TokenSpaceGuid, PcdType]
Expand Down

0 comments on commit d287317

Please sign in to comment.