summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/AutoGen
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/Python/AutoGen')
-rw-r--r--BaseTools/Source/Python/AutoGen/AutoGen.py68
-rw-r--r--BaseTools/Source/Python/AutoGen/GenC.py3
-rw-r--r--BaseTools/Source/Python/AutoGen/GenMake.py3
3 files changed, 70 insertions, 4 deletions
diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 4e2b2e47d2..ff1c4fd82c 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -169,10 +169,17 @@ class WorkspaceAutoGen(AutoGen):
# @param FlashDefinitionFile File of flash definition
# @param Fds FD list to be generated
# @param Fvs FV list to be generated
+ # @param Caps Capsule list to be generated
# @param SkuId SKU id from command line
#
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
- BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', UniFlag=None):
+ BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None):
+ if Fds is None:
+ Fds = []
+ if Fvs is None:
+ Fvs = []
+ if Caps is None:
+ Caps = []
self.MetaFile = ActivePlatform.MetaFile
self.WorkspaceDir = WorkspaceDir
self.Platform = ActivePlatform
@@ -188,6 +195,7 @@ class WorkspaceAutoGen(AutoGen):
self.FdfFile = FlashDefinitionFile
self.FdTargetList = Fds
self.FvTargetList = Fvs
+ self.CapTargetList = Caps
self.AutoGenObjectList = []
# there's many relative directory operations, so ...
@@ -228,6 +236,11 @@ class WorkspaceAutoGen(AutoGen):
#
self._CheckAllPcdsTokenValueConflict()
+ #
+ # Check PCD type and definition between DSC and DEC
+ #
+ self._CheckPcdDefineAndType()
+
self._BuildDir = None
self._FvDir = None
self._MakeFileDir = None
@@ -235,6 +248,56 @@ class WorkspaceAutoGen(AutoGen):
return True
+ def _CheckPcdDefineAndType(self):
+ PcdTypeList = [
+ "FixedAtBuild", "PatchableInModule", "FeatureFlag",
+ "Dynamic", #"DynamicHii", "DynamicVpd",
+ "DynamicEx", # "DynamicExHii", "DynamicExVpd"
+ ]
+
+ # This dict store PCDs which are not used by any modules with specified arches
+ UnusedPcd = sdict()
+ for Pa in self.AutoGenObjectList:
+ # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid
+ for Pcd in Pa.Platform.Pcds:
+ PcdType = Pa.Platform.Pcds[Pcd].Type
+
+ # If no PCD type, this PCD comes from FDF
+ if not PcdType:
+ continue
+
+ # Try to remove Hii and Vpd suffix
+ if PcdType.startswith("DynamicEx"):
+ PcdType = "DynamicEx"
+ elif PcdType.startswith("Dynamic"):
+ PcdType = "Dynamic"
+
+ for Package in Pa.PackageList:
+ # Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType
+ if (Pcd[0], Pcd[1], PcdType) in Package.Pcds:
+ break
+ for Type in PcdTypeList:
+ if (Pcd[0], Pcd[1], Type) in Package.Pcds:
+ EdkLogger.error(
+ 'build',
+ FORMAT_INVALID,
+ "Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \
+ % (Pa.Platform.Pcds[Pcd].Type, Pcd[1], Pcd[0], Type),
+ ExtraData=None
+ )
+ return
+ else:
+ UnusedPcd.setdefault(Pcd, []).append(Pa.Arch)
+
+ for Pcd in UnusedPcd:
+ EdkLogger.warn(
+ 'build',
+ "The PCD was not specified by any INF module in the platform for the given architecture.\n"
+ "\tPCD: [%s.%s]\n\tPlatform: [%s]\n\tArch: %s"
+ % (Pcd[1], Pcd[0], os.path.basename(str(self.MetaFile)), str(UnusedPcd[Pcd])),
+ ExtraData=None
+ )
+
def __repr__(self):
return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))
@@ -2125,9 +2188,8 @@ class ModuleAutoGen(AutoGen):
#
def _GetAutoGenFileList(self):
UniStringAutoGenC = True
- UniStringBinBuffer = None
+ UniStringBinBuffer = StringIO()
if self.BuildType == 'UEFI_HII':
- UniStringBinBuffer = StringIO()
UniStringAutoGenC = False
if self._AutoGenFileList == None:
self._AutoGenFileList = {}
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py
index e6e8847623..4430c94e0b 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1951,6 +1951,9 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
if Info.ModuleType in gModuleTypeHeaderFile \
and gModuleTypeHeaderFile[Info.ModuleType][0] != gBasicHeaderFile:
AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0])
+ if 'PcdLib' in Info.Module.LibraryClasses:
+ AutoGenH.Append("#include <Library/PcdLib.h>\n")
+
AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;\n\n')
if Info.IsLibrary:
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py
index 6396c612ad..41a46fc69d 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -1253,7 +1253,7 @@ ${END}\t@cd $(BUILD_DIR)
#
fds: init
\t-@cd $(FV_DIR)
-${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -D ${macro} ${END}
+${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END}
#
# run command for emulator platform only
@@ -1365,6 +1365,7 @@ ${END}\t@cd $(BUILD_DIR)\n
"active_platform" : str(PlatformInfo),
"fd" : PlatformInfo.FdTargetList,
"fv" : PlatformInfo.FvTargetList,
+ "cap" : PlatformInfo.CapTargetList,
"extra_options" : ExtraOption,
"macro" : MacroList,
}