[edk2] [PATCH] BaseTools: Add $(INC)-like support when compiling .nasm files
From: zhijufan current edk2\BaseTools\Conf\build_rule.template, the compile of nasm source files does not have the $(INC) support. The '-I' option only includes the directory of the nasm source file (${s_path}(+)). Hence, it will be impossible for nasm files to include files outside of the nasm source file directory. As a comparison, the compile of both .s and .asm have $(INC) support in their compile commands. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenMake.py | 20 +++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index d94d8f9368..ef7bc845d0 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -167,7 +167,7 @@ class BuildFile(object): "gmake" : "include" } -_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} +_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I", "NASM" : "-I"} ## Constructor of BuildFile # @@ -596,6 +596,24 @@ cleanlib: } ) FileMacroList.append(FileMacro) +# Add support when compiling .nasm source files +for File in self.FileCache.keys(): +if not str(File).endswith('.nasm'): +continue +IncludePathList = [] +for P in MyAgo.IncludePathList: +IncludePath = self._INC_FLAG_['NASM'] + self.PlaceMacro(P, self.Macros) +if IncludePath.endswith(os.sep): +IncludePath = IncludePath.rstrip(os.sep) +# When compiling .nasm files, need to add a literal backslash at each path +# To specify a literal backslash at the end of the line, precede it with a caret (^) +if P == MyAgo.IncludePathList[-1] and os.sep == '\\': +IncludePath = ''.join([IncludePath, '^', os.sep]) +else: +IncludePath = os.path.join(IncludePath, '') +IncludePathList.append(IncludePath) + FileMacroList.append(self._FILE_MACRO_TEMPLATE.Replace({"macro_name": "NASM_INC", "source_file": IncludePathList})) +break # Generate macros used to represent files containing list of input files for ListFileMacro in self.ListFileMacros: -- 2.18.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH 2/2] BaseTools: Update nasm file build rule to support $(INC)
From: zhijufan Update the build rule to: "$(NASM)" -I${s_path}(+) $(NASM_INC) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Conf/build_rule.template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index 3ab560603f..2a53d7ed63 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -62,6 +62,7 @@ # $(BIN_DIR) Common directory for executable files # $(FV_DIR) Directory to store flash image files # $(INC) Search path of current module +# $(NASM_INC) Search nasm file path of current module # $(INC_LIST) A file containing search pathes of current module # $(LIBS) Static library files of current module # $(_FLAGS) Tools flags of current module @@ -225,7 +226,7 @@ "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i -"$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii +"$(NASM)" -I${s_path}(+) $(NASM_INC) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii [Device-Tree-Source-File] -- 2.18.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Update .nasm to support $(INC)-like support
From: zhijufan Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan zhijufan (2): BaseTools: Add $(INC)-like support when compiling .nasm files BaseTools: Update nasm file build rule to support $(INC) BaseTools/Conf/build_rule.template | 3 +- BaseTools/Source/Python/AutoGen/GenMake.py | 20 +- 2 files changed, 21 insertions(+), 2 deletions(-) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools:Break build if same [LibraryClasses] name is used
From: zhijufan For example if both PackageA and PackageB declare the [LibraryClasses] name of MyLibClass, that is mapped to an include file in each package: PackageA.dec [LibraryClasses] MyLibClass|Include/Library/MyLibClass.h PackageB.dec [LibraryClasses] MyLibClass|Include/Library/MyLibClass.h Cc: Liming Gao Cc: Yonghong Zhu Cc: Bob Feng Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=954 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- .../Python/Workspace/WorkspaceCommon.py | 19 ++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py index 55d01fa4b2..b05ed9 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -20,7 +20,8 @@ from Workspace.BuildClassObject import StructurePcd from Common.BuildToolError import RESOURCE_NOT_AVAILABLE from Common.BuildToolError import OPTION_MISSING from Common.BuildToolError import BUILD_ERROR - +from Common.BuildToolError import OPTION_CONFLICT +from Common import EdkLogger as EdkLogger class OrderedListDict(OrderedDict): def __init__(self, *args, **kwargs): super(OrderedListDict, self).__init__(*args, **kwargs) @@ -48,6 +49,21 @@ def GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain): PkgSet.update(Lib.Packages) return list(PkgSet) +# Check that the LibraryClasses name are the same +def CheckLibraryClassesName(PkgList): +LibraryDict = {} +for Pkg in PkgList: +LibCls = Pkg.LibraryClasses +for Lib in LibCls: +if Lib in LibraryDict: +if LibraryDict[Lib] != str(Pkg): +EdkLogger.error("build", OPTION_CONFLICT, +"ClassName is conflicted,Please change the ClassName", +ExtraData="in [%s] [%s]\n\tClassName is [%s]" % ( +LibraryDict[Lib], str(Pkg), Lib)) +else: +LibraryDict[Lib] = str(Pkg) + ## Get all declared PCD from platform for specified arch, target and toolchain # # @param Platform: DscBuildData instance @@ -60,6 +76,7 @@ def GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain): # def GetDeclaredPcd(Platform, BuildDatabase, Arch, Target, Toolchain, additionalPkgs): PkgList = GetPackageList(Platform, BuildDatabase, Arch, Target, Toolchain) +CheckLibraryClassesName(PkgList) PkgList = set(PkgList) PkgList |= additionalPkgs DecPcds = {} -- 2.18.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] Maintainers.txt: Update BaseTools maintainers
As Yonghong has some other focus, change him from maintainer to reviewer, Bob will be the new maintainer. Cc: Bob Feng Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- Maintainers.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Maintainers.txt b/Maintainers.txt index 8a9f8df..2031db6 100644 --- a/Maintainers.txt +++ b/Maintainers.txt @@ -82,12 +82,13 @@ M: Laszlo Ersek M: Ard Biesheuvel R: Julien Grall BaseTools W: https://github.com/tianocore/tianocore.github.io/wiki/BaseTools -M: Yonghong Zhu +M: Bob Feng M: Liming Gao +R: Yonghong Zhu BeagleBoardPkg W: https://github.com/tianocore/tianocore.github.io/wiki/BeagleBoardPkg M: Leif Lindholm M: Ard Biesheuvel -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/Eot: Remove a duplication code in EotMain class
From: Hess Chen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Eot/EotMain.py | 365 - 1 file changed, 365 deletions(-) diff --git a/BaseTools/Source/Python/Eot/EotMain.py b/BaseTools/Source/Python/Eot/EotMain.py index 2ad93cc6b4..7eae4ac672 100644 --- a/BaseTools/Source/Python/Eot/EotMain.py +++ b/BaseTools/Source/Python/Eot/EotMain.py @@ -1083,371 +1083,6 @@ class Ffs(Image): State = property(_GetState, _SetState) -_FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3" - -_GUID_ = struct.Struct("16x 1I2H8B") -_LENGTH_= struct.Struct("16x 16x 1Q") -_SIG_ = struct.Struct("16x 16x 8x 1I") -_ATTR_ = struct.Struct("16x 16x 8x 4x 1I") -_HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H") -_CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H") - -def __init__(self, Name=''): -Image.__init__(self) -self.Name = Name -self.FfsDict = sdict() -self.OrderedFfsDict = sdict() -self.UnDispatchedFfsDict = sdict() -self.ProtocolList = sdict() - -def CheckArchProtocol(self): -for Item in EotGlobalData.gArchProtocolGuids: -if Item.lower() not in EotGlobalData.gProtocolList: -return False -return True - -def ParseDepex(self, Depex, Type): -List = None -if Type == 'Ppi': -List = EotGlobalData.gPpiList -if Type == 'Protocol': -List = EotGlobalData.gProtocolList -DepexStack = [] -DepexList = [] -DepexString = '' -FileDepex = None -CouldBeLoaded = True -for Index in range(0, len(Depex.Expression)): -Item = Depex.Expression[Index] -if Item == 0x00: -Index = Index + 1 -Guid = gGuidStringFormat % Depex.Expression[Index] -if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: -return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE']) -elif Item == 0x01: -Index = Index + 1 -Guid = gGuidStringFormat % Depex.Expression[Index] -if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] == 0x08: -return (True, 'AFTER %s' % Guid, [Guid, 'AFTER']) -elif Item == 0x02: -Index = Index + 1 -Guid = gGuidStringFormat % Depex.Expression[Index] -if Guid.lower() in List: -DepexStack.append(True) -DepexList.append(Guid) -else: -DepexStack.append(False) -DepexList.append(Guid) -continue -elif Item == 0x03 or Item == 0x04: -DepexStack.append(eval(str(DepexStack.pop()) + ' ' + Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop( -DepexList.append(str(DepexList.pop()) + ' ' + Depex._OPCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop())) -elif Item == 0x05: -DepexStack.append(eval(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop( -DepexList.append(Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexList.pop())) -elif Item == 0x06: -DepexStack.append(True) -DepexList.append('TRUE') -DepexString = DepexString + 'TRUE' + ' ' -elif Item == 0x07: -DepexStack.append(False) -DepexList.append('False') -DepexString = DepexString + 'FALSE' + ' ' -elif Item == 0x08: -if Index != len(Depex.Expression) - 1: -CouldBeLoaded = False -else: -CouldBeLoaded = DepexStack.pop() -else: -CouldBeLoaded = False -if DepexList != []: -DepexString = DepexList[0].strip() -return (CouldBeLoaded, DepexString, FileDepex) - -def Dispatch(self, Db = None): -if Db is None: -return False -self.UnDispatchedFfsDict = copy.copy(self.FfsDict) -# Find PeiCore, DexCore, PeiPriori, DxePriori first -FfsSecCoreGuid = None -FfsPeiCoreGuid = None -FfsDxeCoreGuid = None -FfsPeiPrioriGuid = None -FfsDxePrioriGuid = None -for FfsID in self.UnDispatchedFfsDict: -Ffs = self.UnDispatchedFfsDict[FfsID] -if Ffs.Type == 0x03: -FfsSecCoreGuid = FfsID -continue -if Ffs.Type == 0x04: -FfsPeiCoreGuid = FfsID -continue -if Ffs.Type == 0x05: -FfsDxeCoreGuid = FfsID -continue -if Ffs.Guid.lower() == PEI_APRIORI_GUID.lower(): -FfsPeiPrioriGuid = FfsID -continue -
[edk2] [Patch V2] BaseTools: Add special handle for '\' use in Pcd Value
From: zhijufan V2: Follow PEP8 to not multiples import on one line Case: gEfiOzmosisPkgTokenSpaceGuid.PcdBootLogFolderPath|L"\\Logs\\"|VOID*|12 Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1287 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Expression.py | 14 +- BaseTools/Source/Python/Common/Misc.py | 8 ++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 05459b9c26..a21ab5daa7 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -22,6 +22,8 @@ import Common.EdkLogger as EdkLogger import copy from Common.DataType import * import sys +from random import sample +import string ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].' ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].' @@ -55,6 +57,8 @@ PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$') # def SplitString(String): # There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi' +RanStr = ''.join(sample(string.ascii_letters + string.digits, 8)) +String = String.replace('', RanStr).strip() RetList = [] InSingleQuote = False InDoubleQuote = False @@ -87,11 +91,16 @@ def SplitString(String): raise BadExpression(ERR_STRING_TOKEN % Item) if Item: RetList.append(Item) +for i, ch in enumerate(RetList): +if RanStr in ch: +RetList[i] = ch.replace(RanStr,'') return RetList def SplitPcdValueString(String): # There might be escaped comma in GUID() or DEVICE_PATH() or " " # or ' ' or L' ' or L" " +RanStr = ''.join(sample(string.ascii_letters + string.digits, 8)) +String = String.replace('', RanStr).strip() RetList = [] InParenthesis = 0 InSingleQuote = False @@ -124,6 +133,9 @@ def SplitPcdValueString(String): raise BadExpression(ERR_STRING_TOKEN % Item) if Item: RetList.append(Item) +for i, ch in enumerate(RetList): +if RanStr in ch: +RetList[i] = ch.replace(RanStr,'') return RetList def IsValidCName(Str): @@ -390,7 +402,7 @@ class ValueExpression(BaseExpression): elif not Val: Val = False RealVal = '""' -elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'"): +elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'") and not Val.startswith("'"): Val = True RealVal = '"' + RealVal + '"' diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index b32b7cdc5f..3b8efb2e71 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -24,6 +24,7 @@ import re import pickle import array import shutil +from random import sample from struct import pack from UserDict import IterableUserDict from UserList import UserList @@ -1236,7 +1237,8 @@ def IsFieldValueAnArray (Value): return False def AnalyzePcdExpression(Setting): -Setting = Setting.strip() +RanStr = ''.join(sample(string.ascii_letters + string.digits, 8)) +Setting = Setting.replace('', RanStr).strip() # There might be escaped quote in a string: \", \\\" , \', \\\' Data = Setting # There might be '|' in string and in ( ... | ... ), replace it with '-' @@ -1269,7 +1271,9 @@ def AnalyzePcdExpression(Setting): break FieldList.append(Setting[StartPos:Pos].strip()) StartPos = Pos + 1 - +for i, ch in enumerate(FieldList): +if RanStr in ch: +FieldList[i] = ch.replace(RanStr,'') return FieldList def ParseDevPathValue (Value): -- 2.18.0.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Add special handle for '\' use in Pcd Value
From: zhijufan Case: gEfiOzmosisPkgTokenSpaceGuid.PcdBootLogFolderPath|L"\\Logs\\"|VOID*|12 Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1287 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Expression.py | 13 - BaseTools/Source/Python/Common/Misc.py | 9 ++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 05459b9..6eec0de 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -20,10 +20,11 @@ from CommonDataClass.Exceptions import WrnExpression from .Misc import GuidStringToGuidStructureString, ParseFieldValue import Common.EdkLogger as EdkLogger import copy from Common.DataType import * import sys +import random, string ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].' ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].' ERR_MATCH = 'No matching right parenthesis.' ERR_STRING_TOKEN= 'Bad string token: [%s].' @@ -53,10 +54,12 @@ PcdPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*\.[_a-zA-Z][0-9A-Za-z_]*$') # Split string to list according double quote # For example: abc"de\"f"ghi"jkl"mn will be: ['abc', '"de\"f"', 'ghi', '"jkl"', 'mn'] # def SplitString(String): # There might be escaped quote: "abc\"def\\\"ghi", 'abc\'def\\\'ghi' +RanStr = ''.join(random.sample(string.ascii_letters + string.digits, 8)) +String = String.replace('', RanStr).strip() RetList = [] InSingleQuote = False InDoubleQuote = False Item = '' for i, ch in enumerate(String): @@ -85,15 +88,20 @@ def SplitString(String): Item += String[i] if InSingleQuote or InDoubleQuote: raise BadExpression(ERR_STRING_TOKEN % Item) if Item: RetList.append(Item) +for i, ch in enumerate(RetList): +if RanStr in ch: +RetList[i] = ch.replace(RanStr,'') return RetList def SplitPcdValueString(String): # There might be escaped comma in GUID() or DEVICE_PATH() or " " # or ' ' or L' ' or L" " +RanStr = ''.join(random.sample(string.ascii_letters + string.digits, 8)) +String = String.replace('', RanStr).strip() RetList = [] InParenthesis = 0 InSingleQuote = False InDoubleQuote = False Item = '' @@ -122,10 +130,13 @@ def SplitPcdValueString(String): Item += String[i] if InSingleQuote or InDoubleQuote or InParenthesis: raise BadExpression(ERR_STRING_TOKEN % Item) if Item: RetList.append(Item) +for i, ch in enumerate(RetList): +if RanStr in ch: +RetList[i] = ch.replace(RanStr,'') return RetList def IsValidCName(Str): return True if __ValidString.match(Str) else False @@ -388,11 +399,11 @@ class ValueExpression(BaseExpression): if Val == 'L""': Val = False elif not Val: Val = False RealVal = '""' -elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'"): +elif not Val.startswith('L"') and not Val.startswith('{') and not Val.startswith("L'") and not Val.startswith("'"): Val = True RealVal = '"' + RealVal + '"' # The expression has been parsed, but the end of expression is not reached # It means the rest does not comply EBNF of diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index b32b7cd..b27268a 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -15,11 +15,11 @@ # Import Modules # from __future__ import absolute_import import Common.LongFilePathOs as os import sys -import string +import random, string import threading import time import re import pickle import array @@ -1234,11 +1234,12 @@ def IsFieldValueAnArray (Value): if Value[0] == "'" and Value[-1] == "'" and len(list(Value[1:-1])) > 1: return True return False def AnalyzePcdExpression(Setting): -Setting = Setting.strip() +RanStr = ''.join(random.sample(string.ascii_letters + string.digits, 8)) +Setting = Setting.replace('', RanStr).strip() # There might be escaped quote in a string: \", \\\" , \', \\\' Data = Setting # There might be '|' in string and in ( ... | ... ), replace it with '-' NewStr = '' InSingleQuoteStr = False @@ -1267,11 +1268,13 @@ def AnalyzePcdExpression(Setting): if Pos <
[edk2] [Patch 2/2 V2] BaseTools: Update nasm file build rule to support $(INC)
From: zhijufan Update the build rule to: "$(NASM)" -I${s_path}(+) $(NASM_INC)(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Conf/build_rule.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index ed54a55..8ac46c5 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -223,11 +223,11 @@ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i -"$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii +"$(NASM)" -I${s_path}(+) $(NASM_INC)(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii [Device-Tree-Source-File] ?.dts -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2 V2] Update .nasm to support $(INC)-like support
V2: 1. remove FileMacro variable 2. Make sure the NASM_INC file path have '\' in the end Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan zhijufan (2): BaseTools: Add $(INC)-like support when compiling .nasm files BaseTools: Update nasm file build rule to support $(INC) BaseTools/Conf/build_rule.template | 2 +- BaseTools/Source/Python/AutoGen/GenMake.py | 14 +- 2 files changed, 14 insertions(+), 2 deletions(-) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 1/2 V2] BaseTools: Add $(INC)-like support when compiling .nasm files
From: zhijufan current edk2\BaseTools\Conf\build_rule.template, the compile of nasm source files does not have the $(INC) support. The '-I' option only includes the directory of the nasm source file (${s_path}(+)). Hence, it will be impossible for nasm files to include files outside of the nasm source file directory. As a comparison, the compile of both .s and .asm have $(INC) support in their compile commands. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenMake.py | 13 - 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index b4377ee..f754f03 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -165,11 +165,11 @@ class BuildFile(object): _INCLUDE_CMD_ = { "nmake" : '!INCLUDE', "gmake" : "include" } -_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} +_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I", "NASM" : "-I"} ## Constructor of BuildFile # # @param AutoGenObject Object of AutoGen class # @@ -594,10 +594,21 @@ cleanlib: "macro_name" : "INC", "source_file" : IncludePathList } ) FileMacroList.append(FileMacro) +for File in self.FileCache.keys(): +if not str(File).endswith('.nasm'): +continue +IncludePathList = [] +for P in MyAgo.IncludePathList: +IncludePath = self._INC_FLAG_['NASM'] + self.PlaceMacro(P, self.Macros) +if not P.endswith('\\'): +IncludePath += '\\' +IncludePathList.append(IncludePath) + FileMacroList.append(self._FILE_MACRO_TEMPLATE.Replace({"macro_name": "NASM_INC", "source_file": IncludePathList})) +break # Generate macros used to represent files containing list of input files for ListFileMacro in self.ListFileMacros: ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro) - 5]) FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName)) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] FDF spec: Add PI1.5 standalone SMM support in FDF file
V2: Update it to MM_CORE_STANDALONE and MM_STANDALONE Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=551 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Cc: Cohen, Eugene Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 1_introduction/12_terms.md| 9 + 2_fdf_design_discussion/25_[fv]_sections.md | 6 +- 3_edk_ii_fdf_file_format/32_fdf_definition.md | 1 + 3_edk_ii_fdf_file_format/36_[fv]_sections.md | 19 --- 3_edk_ii_fdf_file_format/37_[capsule]_sections.md | 22 ++ 3_edk_ii_fdf_file_format/39_[rule]_sections.md| 22 +- README.md | 1 + 7 files changed, 51 insertions(+), 29 deletions(-) diff --git a/1_introduction/12_terms.md b/1_introduction/12_terms.md index af33faa..abb857b 100644 --- a/1_introduction/12_terms.md +++ b/1_introduction/12_terms.md @@ -1,9 +1,9 @@
[edk2] [Patch 1/2] BaseTools: Add $(INC)-like support when compiling .nasm files
From: zhijufan current edk2\BaseTools\Conf\build_rule.template, the compile of nasm source files does not have the $(INC) support. The '-I' option only includes the directory of the nasm source file (${s_path}(+)). Hence, it will be impossible for nasm files to include files outside of the nasm source file directory. As a comparison, the compile of both .s and .asm have $(INC) support in their compile commands. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenMake.py | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index d94d8f9..8860d50 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -165,11 +165,11 @@ class BuildFile(object): _INCLUDE_CMD_ = { "nmake" : '!INCLUDE', "gmake" : "include" } -_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I"} +_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I", "RVCT" : "-I", "NASM" : "-I"} ## Constructor of BuildFile # # @param AutoGenObject Object of AutoGen class # @@ -594,10 +594,22 @@ cleanlib: "macro_name" : "INC", "source_file" : IncludePathList } ) FileMacroList.append(FileMacro) +for File in self.FileCache.keys(): +if not str(File).endswith('.nasm'): +continue +FileMacro = "" +IncludePathList = [] +for P in MyAgo.IncludePathList: +IncludePathList.append(self._INC_FLAG_['NASM'] + self.PlaceMacro(P, self.Macros)) +if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros: + self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(self._INC_FLAG_['NASM'] + P) +FileMacro += self._FILE_MACRO_TEMPLATE.Replace({"macro_name": "NASM_INC", "source_file": IncludePathList}) +FileMacroList.append(FileMacro) +break # Generate macros used to represent files containing list of input files for ListFileMacro in self.ListFileMacros: ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" % ListFileMacro.lower()[:len(ListFileMacro) - 5]) FileMacroList.append("%s = %s" % (ListFileMacro, ListFileName)) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 2/2] BaseTools: Update nasm file build rule to support $(INC)
From: zhijufan Update the build rule to: "$(NASM)" -I${s_path}(+) $(NASM_INC)(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Conf/build_rule.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index ed54a55..7c4b9e6 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -223,11 +223,11 @@ $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i Trim --trim-long --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i -"$(NASM)" -I${s_path}(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii +"$(NASM)" -I${s_path}(+) $(NASM_INC)(+) $(NASM_FLAGS) -o $dst ${d_path}(+)${s_base}.iii [Device-Tree-Source-File] ?.dts -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch 0/2] Update .nasm to support $(INC)-like support
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan zhijufan (2): BaseTools: Add $(INC)-like support when compiling .nasm files BaseTools: Update nasm file build rule to support $(INC) BaseTools/Conf/build_rule.template | 2 +- BaseTools/Source/Python/AutoGen/GenMake.py | 14 +- 2 files changed, 14 insertions(+), 2 deletions(-) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V2] BaseTools: Fix the bug for Pcd used in command line's override
V2: remove the not used parameter i Fix the bug for Pcd used in command line not override the Pcd used in the [component] driver's sub-section. Case: DSC file: [PcdsFixedAtBuild] TokenSpaceGuid.PcdTest [Components] TestPkg/TestDriver.inf { TokenSpaceGuid.PcdTest|"b" } build command with --pcd TokenSpaceGuid.PcdTest="BB" Then we found the Pcd value in the AutoGen.c file is incorrect, because of the incorrect logic that use the pcd in the [component] section to re-override it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py| 7 +++ BaseTools/Source/Python/Workspace/DscBuildData.py | 5 + 2 files changed, 12 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 804f579..84645e3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2118,10 +2118,17 @@ class PlatformAutoGen(AutoGen): # override PCD settings with module specific setting if Module in self.Platform.Modules: PlatformModule = self.Platform.Modules[str(Module)] for Key in PlatformModule.Pcds: +if GlobalData.BuildOptionPcd: +for pcd in GlobalData.BuildOptionPcd: +(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd +if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="": +PlatformModule.Pcds[Key].DefaultValue = pcdvalue +PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue +break Flag = False if Key in Pcds: ToPcd = Pcds[Key] Flag = True elif Key in GlobalData.MixedPcd: diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index b0e88a9..162360c 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1058,11 +1058,16 @@ class DscBuildData(PlatformBuildClassObject): IsValid, Cause = CheckPcdDatum(PcdDatumType, pcdvalue) if not IsValid: EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName)) GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, ("build command options", 1)) +if GlobalData.BuildOptionPcd: +for pcd in GlobalData.BuildOptionPcd: +(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd for BuildData in self._Bdb._CACHE_.values(): +if BuildData.Arch != self.Arch: +continue if BuildData.MetaFile.Ext == '.dec' or BuildData.MetaFile.Ext == '.dsc': continue for key in BuildData.Pcds: PcdItem = BuildData.Pcds[key] if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="": -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: list .nasm include inc files as its dependency
From: zhijufan .nasm source file may include some header files. header file should be listed in Makefile as .nasm source file dependency. But now, BaseTools doesn't find them and list them in Makefile. This is a missing, because original ASM file supports it. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/GenMake.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index b4377ee..d94d8f9 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -28,11 +28,11 @@ from .BuildEngine import * import Common.GlobalData as GlobalData from collections import OrderedDict from Common.DataType import TAB_COMPILER_MSFT ## Regular expression for finding header file inclusions -gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) +gIncludePattern = re.compile(r"^[ \t]*[#%]?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE) ## Regular expression for matching macro used in header file inclusion gMacroPattern = re.compile("([_A-Z][_A-Z0-9]*)[ \t]*\((.+)\)", re.UNICODE) gIsFileMap = {} -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix the bug for Pcd used in command line's override
Fix the bug for Pcd used in command line not override the Pcd used in the [component] driver's sub-section. Case: DSC file: [PcdsFixedAtBuild] TokenSpaceGuid.PcdTest [Components] TestPkg/TestDriver.inf { TokenSpaceGuid.PcdTest|"b" } build command with --pcd TokenSpaceGuid.PcdTest="BB" Then we found the Pcd value in the AutoGen.c file is incorrect, because of the incorrect logic that use the pcd in the [component] section to re-override it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py| 7 +++ BaseTools/Source/Python/Workspace/DscBuildData.py | 5 + 2 files changed, 12 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 804f579..84645e3 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2118,10 +2118,17 @@ class PlatformAutoGen(AutoGen): # override PCD settings with module specific setting if Module in self.Platform.Modules: PlatformModule = self.Platform.Modules[str(Module)] for Key in PlatformModule.Pcds: +if GlobalData.BuildOptionPcd: +for i, pcd in enumerate(GlobalData.BuildOptionPcd): +(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd +if (TokenCName, TokenSpaceGuidCName) == Key and FieldName =="": +PlatformModule.Pcds[Key].DefaultValue = pcdvalue +PlatformModule.Pcds[Key].PcdValueFromComm = pcdvalue +break Flag = False if Key in Pcds: ToPcd = Pcds[Key] Flag = True elif Key in GlobalData.MixedPcd: diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index b0e88a9..162360c 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1058,11 +1058,16 @@ class DscBuildData(PlatformBuildClassObject): IsValid, Cause = CheckPcdDatum(PcdDatumType, pcdvalue) if not IsValid: EdkLogger.error("build", FORMAT_INVALID, Cause, ExtraData="%s.%s" % (TokenSpaceGuidCName, TokenCName)) GlobalData.BuildOptionPcd[i] = (TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, ("build command options", 1)) +if GlobalData.BuildOptionPcd: +for i, pcd in enumerate(GlobalData.BuildOptionPcd): +(TokenSpaceGuidCName, TokenCName, FieldName, pcdvalue, _) = pcd for BuildData in self._Bdb._CACHE_.values(): +if BuildData.Arch != self.Arch: +continue if BuildData.MetaFile.Ext == '.dec' or BuildData.MetaFile.Ext == '.dsc': continue for key in BuildData.Pcds: PcdItem = BuildData.Pcds[key] if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="": -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix VPD PCD Sub-section display bug
original we get the VPD PCD items from the VPDGuid.map file in the FV output folder. but this logic doesn't work when 1) there only have single non Default SKU, 2) there have multiple SKU with same value. Now we change it to get the really VPD Pcd items that already display in the PCD section of the report. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/build/BuildReport.py | 46 ++-- 1 file changed, 17 insertions(+), 29 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index de8f0fb..ea98ef7 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -124,10 +124,13 @@ gDriverTypeMap = { } ## The look up table of the supported opcode in the dependency expression binaries gOpCodeList = ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT", "TRUE", "FALSE", "END", "SOR"] +## Save VPD Pcd +VPDPcdList = [] + ## # Writes a string to the file object. # # This function writes a string to the file object and a new line is appended # afterwards. It may optionally wraps the string for better readability. @@ -1399,10 +1402,13 @@ class PcdReport(object): FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', Value)) else: FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value)) if TypeName in ('DYNVPD', 'DEXVPD'): FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset)) +VPDPcdItem = (Pcd.TokenSpaceGuidCName + '.' + PcdTokenCName, SkuIdName, SkuInfo.VpdOffset, Pcd.MaxDatumSize, SkuInfo.DefaultValue) +if VPDPcdItem not in VPDPcdList: +VPDPcdList.append(VPDPcdItem) if IsStructure: FiledOverrideFlag = False OverrideValues = Pcd.SkuOverrideValues[Sku] if OverrideValues: Keys = OverrideValues.keys() @@ -2015,39 +2021,18 @@ class FdReport(object): self.FdName = Fd.FdUiName self.BaseAddress = Fd.BaseAddress self.Size = Fd.Size self.FdRegionList = [FdRegionReport(FdRegion, Wa) for FdRegion in Fd.RegionList] self.FvPath = os.path.join(Wa.BuildDir, TAB_FV_DIRECTORY) -self.VpdFilePath = os.path.join(self.FvPath, "%s.map" % Wa.Platform.VpdToolGuid) self.VPDBaseAddress = 0 self.VPDSize = 0 -self.VPDInfoList = [] for index, FdRegion in enumerate(Fd.RegionList): if str(FdRegion.RegionType) is 'FILE' and Wa.Platform.VpdToolGuid in str(FdRegion.RegionDataList): self.VPDBaseAddress = self.FdRegionList[index].BaseAddress self.VPDSize = self.FdRegionList[index].Size break -if os.path.isfile(self.VpdFilePath): -fd = open(self.VpdFilePath, "r") -Lines = fd.readlines() -for Line in Lines: -Line = Line.strip() -if len(Line) == 0 or Line.startswith("#"): -continue -try: -PcdName, SkuId, Offset, Size, Value = Line.split("#")[0].split("|") -PcdName, SkuId, Offset, Size, Value = PcdName.strip(), SkuId.strip(), Offset.strip(), Size.strip(), Value.strip() -if Offset.lower().startswith('0x'): -Offset = '0x%08X' % (int(Offset, 16) + self.VPDBaseAddress) -else: -Offset = '0x%08X' % (int(Offset, 10) + self.VPDBaseAddress) -self.VPDInfoList.append("%s | %s | %s | %s | %s" % (PcdName, SkuId, Offset, Size, Value)) -except: -EdkLogger.error("BuildReport", CODE_ERROR, "Fail to parse VPD information file %s" % self.VpdFilePath) -fd.close() - ## # Generate report for the firmware device. # # This function generates report for the firmware device. # @@ -2063,27 +2048,30 @@ class FdReport(object): if len(self.FdRegionList) > 0: FileWrite(File, gSectionSep) for FdRegionItem in self.FdRegionList: FdRegionItem.GenerateReport(File) -if len(self.VPDInfoList) > 0: +if VPDPcdList: +VPDPcdList.sort(key=lambda x: int(x[2], 0)) FileWrite(File, gSubSectionStart) FileWrite(File, "FD VPD
[edk2] [Patch] FDF spec: Add PI1.5 standalone SMM support in FDF file
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=551 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Cc: Cohen, Eugene Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 1_introduction/12_terms.md| 9 + 2_fdf_design_discussion/25_[fv]_sections.md | 6 +- 3_edk_ii_fdf_file_format/32_fdf_definition.md | 1 + 3_edk_ii_fdf_file_format/36_[fv]_sections.md | 19 --- 3_edk_ii_fdf_file_format/37_[capsule]_sections.md | 22 ++ 3_edk_ii_fdf_file_format/39_[rule]_sections.md| 22 +- README.md | 1 + 7 files changed, 51 insertions(+), 29 deletions(-) diff --git a/1_introduction/12_terms.md b/1_introduction/12_terms.md index af33faa..5d9cdc9 100644 --- a/1_introduction/12_terms.md +++ b/1_introduction/12_terms.md @@ -1,9 +1,9 @@
[edk2] [Patch] FDF Spec: Add the $(PCD) usage in the [FD] section
current code support to use $(PCD) in the [FD] section, and lots of platform FDF file already used this usage, so we update the FDF spec first to align with code to reduce the incompatible change for firmware developer. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_fdf_design_discussion/24_[fd]_sections.md | 2 +- 3_edk_ii_fdf_file_format/35_[fd]_sections.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/2_fdf_design_discussion/24_[fd]_sections.md b/2_fdf_design_discussion/24_[fd]_sections.md index e532041..67e478e 100644 --- a/2_fdf_design_discussion/24_[fd]_sections.md +++ b/2_fdf_design_discussion/24_[fd]_sections.md @@ -162,11 +162,11 @@ For a PCD that has a datum type of `VOID`*, the data can be a Unicode string, as in `L"text"`, a valid C data array (it must be either a C format GUID or a hex byte array), as in `{0x20, 0x01, 0x50, 0x00, 0x32, 0xFF, 0x00, 0xAA, {0xFF, 0xF0, 0x00, 0x00, 0x00}}.` For other PCD datum types, the value may be a boolean or a hex value, as in `0x000F,` with a value that is consistent with the PCD's datum type. -The value may also be a macro or it may be computed, using arithmetic +The value may also be a macro or `$(PCD)` or it may be computed, using arithmetic operations, arithmetic expressions and or logical expressions. The value portion of the `SET` statement, when using any of these computations are in-fix expressions that are evaluated left to right, with items within parenthesis evaluated before the outer expressions are evaluated. Use of parenthesis is encouraged to remove ambiguity. diff --git a/3_edk_ii_fdf_file_format/35_[fd]_sections.md b/3_edk_ii_fdf_file_format/35_[fd]_sections.md index f0003e7..e46fd7b 100644 --- a/3_edk_ii_fdf_file_format/35_[fd]_sections.md +++ b/3_edk_ii_fdf_file_format/35_[fd]_sections.md @@ -150,13 +150,13 @@ The `FvUiName` must be specified in a `[FV]` section header defined in this the file. **_PcdValue_** The PCD Value may be a specific numeric value, an array of numeric bytes, a -GUID, a quoted string, an L quoted string (representing a unicode string), an +GUID, a quoted string, an `L` quoted string (representing a unicode string), an arithmetic expression, a logic expression or a macro from a previously defined -macro statement. +macro statement or a `$(PCD) format. **_Expression_** Refer to the EDK II Expression Syntax Specification for more information. -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix the bug that PcdValueFromComm is not set
the bug is PcdValueFromComm is not set, but the Pcd have been override by the command line option. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 1 + 1 file changed, 1 insertion(+) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index e481ea4..17e6f62 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1065,10 +1065,11 @@ class DscBuildData(PlatformBuildClassObject): continue for key in BuildData.Pcds: PcdItem = BuildData.Pcds[key] if (TokenSpaceGuidCName, TokenCName) == (PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="": PcdItem.DefaultValue = pcdvalue +PcdItem.PcdValueFromComm = pcdvalue #In command line, the latter full assign value in commandLine should override the former field assign value. #For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}" delete_assign = [] field_assign = {} if GlobalData.BuildOptionPcd: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix the crash issue when Dynamic structure Pcd use in FDF
The case is use Dynamic structure Pcd in the FDF file. Current code already save the Guid, Name and Filed info for those Pcd, but it directly use the dict key as [Name, Guid] and cause this crash issue. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1264 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index f2146a7..804f579 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -567,12 +567,12 @@ class WorkspaceAutoGen(AutoGen): if (Name, Guid) not in DecPcds: EdkLogger.error( 'build', PARSER_ERROR, "PCD (%s.%s) used in FDF is not declared in DEC files." % (Guid, Name), -File = self.FdfProfile.PcdFileLineDict[Name, Guid][0], -Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1] +File = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][0], +Line = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][1] ) else: # Check whether Dynamic or DynamicEx PCD used in FDF file. If used, build break and give a error message. if (Name, Guid, TAB_PCDS_FIXED_AT_BUILD) in DecPcdsKey \ or (Name, Guid, TAB_PCDS_PATCHABLE_IN_MODULE) in DecPcdsKey \ @@ -581,12 +581,12 @@ class WorkspaceAutoGen(AutoGen): elif (Name, Guid, TAB_PCDS_DYNAMIC) in DecPcdsKey or (Name, Guid, TAB_PCDS_DYNAMIC_EX) in DecPcdsKey: EdkLogger.error( 'build', PARSER_ERROR, "Using Dynamic or DynamicEx type of PCD [%s.%s] in FDF file is not allowed." % (Guid, Name), -File = self.FdfProfile.PcdFileLineDict[Name, Guid][0], -Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1] +File = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][0], +Line = self.FdfProfile.PcdFileLineDict[Name, Guid, Fileds][1] ) Pa = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch) # # Explicitly collect platform's dynamic PCDs -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix the *B and *F Flag display for Structure Pcd
Because of we newly add the PcdFieldValueFromComm and PcdFieldValueFromFdf in early parser phase, so in the report we use the saved value in this two variables to print it. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/build/BuildReport.py | 14 +- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index a66adfb..c648086 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1072,13 +1072,17 @@ class PcdReport(object): SkuInfoList = Pcd.SkuInfoList Pcd = GlobalData.gStructurePcd[self.Arch][(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)] Pcd.DatumType = Pcd.StructName if TypeName in ('DYNVPD', 'DEXVPD'): Pcd.SkuInfoList = SkuInfoList -if Pcd.PcdFieldValueFromComm: +if Pcd.PcdValueFromComm or Pcd.PcdFieldValueFromComm: BuildOptionMatch = True DecMatch = False +elif Pcd.PcdValueFromFdf or Pcd.PcdFieldValueFromFdf: +DscDefaultValue = True +DscMatch = True +DecMatch = False elif Pcd.SkuOverrideValues: DscOverride = False if Pcd.DefaultFromDSC: DscOverride = True else: @@ -1264,18 +1268,22 @@ class PcdReport(object): Value = '{} ({:d})'.format(Value, int(Value, 0)) else: Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: +FiledOverrideFlag = False OverrideValues = Pcd.SkuOverrideValues if OverrideValues: for Data in OverrideValues.values(): Struct = list(Data.values()) if Struct: OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0]) self.PrintStructureInfo(File, OverrideFieldStruct) +FiledOverrideFlag = True break +if not FiledOverrideFlag and (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf): +OverrideFieldStruct = self.OverrideFieldValue(Pcd, {}) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: FirstPrint = True SkuList = sorted(Pcd.SkuInfoList.keys()) for Sku in SkuList: @@ -1391,15 +1399,19 @@ class PcdReport(object): else: FileWrite(File, ' %-*s : %6s %10s %10s = %s' % (self.MaxLen, ' ', TypeName, '(' + Pcd.DatumType + ')', '(' + SkuIdName + ')', Value)) if TypeName in ('DYNVPD', 'DEXVPD'): FileWrite(File, '%*s' % (self.MaxLen + 4, SkuInfo.VpdOffset)) if IsStructure: +FiledOverrideFlag = False OverrideValues = Pcd.SkuOverrideValues[Sku] if OverrideValues: Keys = OverrideValues.keys() OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) self.PrintStructureInfo(File, OverrideFieldStruct) +FiledOverrideFlag = True +if not FiledOverrideFlag and (Pcd.PcdFieldValueFromComm or Pcd.PcdFieldValueFromFdf): +OverrideFieldStruct = self.OverrideFieldValue(Pcd, {}) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) def OverrideFieldValue(self, Pcd, OverrideStruct): OverrideFieldStruct = collections.OrderedDict() if OverrideStruct: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd
The case is: in the DSC file: SKUID_IDENTIFIER = ALL [SkuIds] 0|DEFAULT 1|A [PcdsFixedAtBuild.common.A] TokenSpaceGuid.Test401|{0x0F, 0x12} TokenSpaceGuid.Test401.TEST401INT8ARRAY[0]|'B' in the build report, Data = OverrideValues[Keys[0]], but the Keys[0] is the keyword "DEFAULT", and in this case the "DEFAULT" SKU doesn't save any value, then it cause the Data is empty, in the next code when we use the code it cause crash. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/build/BuildReport.py | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 14143b3..5e2a664 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1089,14 +1089,16 @@ class PcdReport(object): DscOverride = False else: if not Pcd.SkuInfoList: OverrideValues = Pcd.SkuOverrideValues if OverrideValues: -Keys = list(OverrideValues.keys()) -Data = OverrideValues[Keys[0]] -Struct = list(Data.values()) -DscOverride = self.ParseStruct(Struct[0]) +for key in OverrideValues.keys(): +Data = OverrideValues[key] +Struct = list(Data.values()) +if Struct: +DscOverride = self.ParseStruct(Struct[0]) +break else: SkuList = sorted(Pcd.SkuInfoList.keys()) for Sku in SkuList: SkuInfo = Pcd.SkuInfoList[Sku] if TypeName in ('DYNHII', 'DEXHII'): @@ -1265,16 +1267,17 @@ class PcdReport(object): Value = "0x{:X} ({})".format(int(Value, 0), Value) FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value)) if IsStructure: OverrideValues = Pcd.SkuOverrideValues if OverrideValues: -Keys = list(OverrideValues.keys()) -Data = OverrideValues[Keys[0]] -Struct = list(Data.values()) -if Struct: -OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0]) -self.PrintStructureInfo(File, OverrideFieldStruct) +for key in OverrideValues.keys(): +Data = OverrideValues[key] +Struct = list(Data.values()) +if Struct: +OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct[0]) +self.PrintStructureInfo(File, OverrideFieldStruct) +break self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: FirstPrint = True SkuList = sorted(Pcd.SkuInfoList.keys()) for Sku in SkuList: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH V2] BaseTools/ECC: Add a checkpoint to check no usage for deprecated functions.
From: Hess Chen V2: change list to set Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py | 60 BaseTools/Source/Python/Ecc/Configuration.py | 3 ++ BaseTools/Source/Python/Ecc/EccToolError.py | 2 + BaseTools/Source/Python/Ecc/config.ini | 2 + 4 files changed, 67 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index eb086362bd..d2192d10cb 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -270,6 +270,66 @@ class Check(object): self.FunctionLayoutCheckPrototype() self.FunctionLayoutCheckBody() self.FunctionLayoutCheckLocalVariable() +self.FunctionLayoutCheckDeprecated() + +# To check if the deprecated functions are used +def FunctionLayoutCheckDeprecated(self): +if EccGlobalData.gConfig.CFunctionLayoutCheckNoDeprecated == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': +EdkLogger.quiet("Checking function no deprecated one being used ...") + +DeprecatedFunctionSet = ('UnicodeValueToString', + 'AsciiValueToString', + 'StrCpy', + 'StrnCpy', + 'StrCat', + 'StrnCat', + 'UnicodeStrToAsciiStr', + 'AsciiStrCpy', + 'AsciiStrnCpy', + 'AsciiStrCat', + 'AsciiStrnCat', + 'AsciiStrToUnicodeStr', + 'PcdSet8', + 'PcdSet16', + 'PcdSet32', + 'PcdSet64', + 'PcdSetPtr', + 'PcdSetBool', + 'PcdSetEx8', + 'PcdSetEx16', + 'PcdSetEx32', + 'PcdSetEx64', + 'PcdSetExPtr', + 'PcdSetExBool', + 'LibPcdSet8', + 'LibPcdSet16', + 'LibPcdSet32', + 'LibPcdSet64', + 'LibPcdSetPtr', + 'LibPcdSetBool', + 'LibPcdSetEx8', + 'LibPcdSetEx16', + 'LibPcdSetEx32', + 'LibPcdSetEx64', + 'LibPcdSetExPtr', + 'LibPcdSetExBool', + 'GetVariable', + 'GetEfiGlobalVariable', + ) + +for IdentifierTable in EccGlobalData.gIdentifierTableList: +SqlCommand = """select ID, Name, BelongsToFile from %s +where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_FUNCTION_CALLING) +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +for Key in DeprecatedFunctionSet: +if Key == Record[1]: +if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, Key): +OtherMsg = 'The function [%s] is deprecated which should NOT be used' % Key + EccGlobalData.gDb.TblReport.Insert(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, + OtherMsg=OtherMsg, + BelongsToTable=IdentifierTable, + BelongsToItem=Record[0]) def WalkTree(self): IgnoredPattern = c.GetIgnoredDirListPattern() diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index c19a3990c7..8f6886169c 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -34,6 +34,7 @@ _ConfigFileToInternalTranslation = { "CFunctionLayoutCheckFunctionBody":"CFunctionLayoutCheckFunctionBody", "CFunctionLayoutCheckFunctionName":"CFunctionLayoutCheckFunctionName",
[edk2] [Patch] BaseTools: Fix bug caused by 03c36c36a3
In the expression for unicode string and general string compare, it should check whether it startswith "L'" or 'L"', but not "L". Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Expression.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index e398f7a..05459b9 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -295,12 +295,12 @@ class ValueExpression(BaseExpression): # bitwise and logical operation between number and boolean is allowed pass else: raise BadExpression(ERR_EXPR_TYPE) if isinstance(Oprand1, type('')) and isinstance(Oprand2, type('')): -if ((Oprand1.startswith('L"') or Oprand1.startswith('L')) and (not Oprand2.startswith('L"')) and (not Oprand2.startswith("L'"))) or \ -(((not Oprand1.startswith('L"')) and (not Oprand1.startswith("L'"))) and (Oprand2.startswith('L"') or Oprand2.startswith('L'))): +if ((Oprand1.startswith('L"') or Oprand1.startswith("L'")) and (not Oprand2.startswith('L"')) and (not Oprand2.startswith("L'"))) or \ +(((not Oprand1.startswith('L"')) and (not Oprand1.startswith("L'"))) and (Oprand2.startswith('L"') or Oprand2.startswith("L'"))): raise BadExpression(ERR_STRING_CMP % (Oprand1, Operator, Oprand2)) if 'in' in Operator and isinstance(Oprand2, type('')): Oprand2 = Oprand2.split() EvalStr = 'Oprand1 ' + Operator + ' Oprand2' -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/ECC: Add a checkpoint to check no usage for deprecated functions.
From: Hess Chen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py | 60 BaseTools/Source/Python/Ecc/Configuration.py | 3 ++ BaseTools/Source/Python/Ecc/EccToolError.py | 2 + BaseTools/Source/Python/Ecc/config.ini | 2 + 4 files changed, 67 insertions(+) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index eb086362bd..3baf81fa44 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -270,6 +270,66 @@ class Check(object): self.FunctionLayoutCheckPrototype() self.FunctionLayoutCheckBody() self.FunctionLayoutCheckLocalVariable() +self.FunctionLayoutCheckDeprecated() + +# To check if the deprecated functions are used +def FunctionLayoutCheckDeprecated(self): +if EccGlobalData.gConfig.CFunctionLayoutCheckNoDeprecated == '1' or EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': +EdkLogger.quiet("Checking function no deprecated one being used ...") + +DeprecatedFunctionList = ['UnicodeValueToString', + 'AsciiValueToString', + 'StrCpy', + 'StrnCpy', + 'StrCat', + 'StrnCat', + 'UnicodeStrToAsciiStr', + 'AsciiStrCpy', + 'AsciiStrnCpy', + 'AsciiStrCat', + 'AsciiStrnCat', + 'AsciiStrToUnicodeStr', + 'PcdSet8', + 'PcdSet16', + 'PcdSet32', + 'PcdSet64', + 'PcdSetPtr', + 'PcdSetBool', + 'PcdSetEx8', + 'PcdSetEx16', + 'PcdSetEx32', + 'PcdSetEx64', + 'PcdSetExPtr', + 'PcdSetExBool', + 'LibPcdSet8', + 'LibPcdSet16', + 'LibPcdSet32', + 'LibPcdSet64', + 'LibPcdSetPtr', + 'LibPcdSetBool', + 'LibPcdSetEx8', + 'LibPcdSetEx16', + 'LibPcdSetEx32', + 'LibPcdSetEx64', + 'LibPcdSetExPtr', + 'LibPcdSetExBool', + 'GetVariable', + 'GetEfiGlobalVariable', + ] + +for IdentifierTable in EccGlobalData.gIdentifierTableList: +SqlCommand = """select ID, Name, BelongsToFile from %s +where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_FUNCTION_CALLING) +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +for Key in DeprecatedFunctionList: +if Key == Record[1]: +if not EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, Key): +OtherMsg = 'The function [%s] is deprecated which should NOT be used' % Key + EccGlobalData.gDb.TblReport.Insert(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE, + OtherMsg=OtherMsg, + BelongsToTable=IdentifierTable, + BelongsToItem=Record[0]) def WalkTree(self): IgnoredPattern = c.GetIgnoredDirListPattern() diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index c19a3990c7..8f6886169c 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -34,6 +34,7 @@ _ConfigFileToInternalTranslation = { "CFunctionLayoutCheckFunctionBody":"CFunctionLayoutCheckFunctionBody", "CFunctionLayoutCheckFunctionName":"CFunctionLayoutCheckFunctionName",
[edk2] [Patch] BaseTools: Fix a bug --pcd option enable and use the pcd in expression
the case is: in the DSC: [PcdsFixedAtBuild.common] TokenSpaceGuid.TestFixedPcd|0xFFEAA000 [PcdsDynamicExDefault.common.DEFAULT] !if TokenSpaceGuid.PcdFlag == TRUE TokenSpaceGuid.PcdTest|TokenSpaceGuid.TestFixedPcd !endif Then build with --pcd TokenSpaceGuid.PcdFlag=TRUE, it report failure, but if we build without this --pcd option, it could build success. we found when the --pcd is enabled, the fixedatbuild pcds are not be collected into expression to calculate. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1256 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 1 + 1 file changed, 1 insertion(+) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index f41038e..ace348b 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -2942,6 +2942,7 @@ class DscBuildData(PlatformBuildClassObject): if ModuleFile in self._Modules: continue ModuleData = self._Bdb[ModuleFile, self._Arch, self._Target, self._Toolchain] PkgSet.update(ModuleData.Packages) self._DecPcds, self._GuidDict = GetDeclaredPcd(self, self._Bdb, self._Arch, self._Target, self._Toolchain, PkgSet) +self._GuidDict.update(GlobalData.gPlatformPcds) return self._DecPcds -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typedef function.
From: Hess Chen Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py | 12 +++- BaseTools/Source/Python/Ecc/c.py | 8 ++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 3bf86b42cd..eb086362bd 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -586,13 +586,23 @@ class Check(object): if EccGlobalData.gConfig.IncludeFileCheckData == '1' or EccGlobalData.gConfig.IncludeFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': EdkLogger.quiet("Checking header file data ...") +# Get all typedef functions +gAllTypedefFun = [] +for IdentifierTable in EccGlobalData.gIdentifierTableList: +SqlCommand = """select Name from %s +where Model = %s """ % (IdentifierTable, MODEL_IDENTIFIER_TYPEDEF) +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +if Record[0].startswith('('): +gAllTypedefFun.append(Record[0]) + #for Dirpath, Dirnames, Filenames in self.WalkTree(): #for F in Filenames: #if os.path.splitext(F)[1] in ('.h'): #FullName = os.path.join(Dirpath, F) #MsgList = c.CheckHeaderFileData(FullName) for FullName in EccGlobalData.gHFileList: -MsgList = c.CheckHeaderFileData(FullName) +MsgList = c.CheckHeaderFileData(FullName, gAllTypedefFun) # Doxygen document checking def DoxygenCheck(self): diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py index 953f1630b6..b8d6adde16 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -2144,7 +2144,7 @@ def CheckBooleanValueComparison(FullFileName): PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate Expression: %s' % Exp, FileTable, Str[2]) -def CheckHeaderFileData(FullFileName): +def CheckHeaderFileData(FullFileName, AllTypedefFun=[]): ErrorMsgList = [] FileID = GetTableID(FullFileName, ErrorMsgList) @@ -2160,7 +2160,11 @@ def CheckHeaderFileData(FullFileName): ResultSet = Db.TblFile.Exec(SqlStatement) for Result in ResultSet: if not Result[1].startswith('extern'): -PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0]) +for Item in AllTypedefFun: +if '(%s)' % Result[1] in Item: +break +else: +PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition appears in header file', FileTable, Result[0]) SqlStatement = """ select ID from Function -- 2.14.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/UPT: Fix an issue of UNI string checking.
From: Hess Chen The tool now can detect the error that the content between double quotes contains another double quotes or enter key. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- .../Source/Python/UPT/Library/UniClassObject.py| 23 ++ 1 file changed, 23 insertions(+) diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py index 670cf3b4ee..cd575d5a34 100644 --- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py +++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py @@ -566,6 +566,22 @@ class UniFileClassObject(object): if Line.startswith(u'#language') and len(Line.split()) == 2: MultiLineFeedExits = True +# +# Check the situation that there only has one '"' for the language entry +# +if Line.startswith(u'#string') and Line.find(u'#language') > 0 and Line.count(u'"') == 1: +EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, +ExtraData='''The line %s misses '"' at the end of it in file %s''' +% (LineCount, File.Path)) + +# +# Check the situation that there has more than 2 '"' for the language entry +# +if Line.startswith(u'#string') and Line.find(u'#language') > 0 and Line.replace(u'\\"', '').count(u'"') > 2: +EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, +ExtraData='''The line %s has more than 2 '"' for language entry in file %s''' +% (LineCount, File.Path)) + # # Between two String entry, can not contain line feed # @@ -727,6 +743,13 @@ class UniFileClassObject(object): else: EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path) elif Line.startswith(u'"'): +# +# Check the situation that there has more than 2 '"' for the language entry +# +if Line.replace(u'\\"', '').count(u'"') > 2: +EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, +ExtraData='''The line %s has more than 2 '"' for language entry in file %s''' +% (LineCount, File.Path)) if u'#string' in Line or u'#language' in Line: EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path) NewLines.append(Line) -- 2.14.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/Ecc: Update a checkpoint criteria.
From: Hess Chen Change the criteria of the checkpoint of "#ifndef" to remove the requirement of prefix '_'. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py| 2 +- BaseTools/Source/Python/Ecc/EccToolError.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index fc86ad96f2..3bf86b42cd 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -1374,7 +1374,7 @@ class Check(object): RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) for Record in RecordSet: Name = Record[1].replace('#ifndef', '').strip() -if Name[0] != '_' or Name[-1] != '_': +if Name[-1] != '_': if not EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, Name): EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT, OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), BelongsToTable=FileTable, BelongsToItem=Record[0]) diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py b/BaseTools/Source/Python/Ecc/EccToolError.py index ae0a31af8a..e327a7888d 100644 --- a/BaseTools/Source/Python/Ecc/EccToolError.py +++ b/BaseTools/Source/Python/Ecc/EccToolError.py @@ -167,7 +167,7 @@ gEccErrorMessage = { ERROR_NAMING_CONVENTION_CHECK_ALL : "", ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only capital letters are allowed to be used for #define declarations", ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only capital letters are allowed to be used for typedef declarations", -ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start of an include file should use both prefix and postfix underscore characters, '_'", +ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start of an include file should use a postfix underscore characters, '_'", ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""", ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : """Variable name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters 4. Global variable name must start with a 'g'""", ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : """Function name does not follow the rules: 1. First character should be upper case 2. Must contain lower case characters 3. No white space characters""", -- 2.14.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] Expression spec: Add clarification for String compare
Relational and equality operators require both operands to be of the same type. Treat the string 'A' and "A" as same type, but for "A" and L"A" are not same type since one is general string, another is unicode string. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_expression_overview.md | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/2_expression_overview.md b/2_expression_overview.md index c29a632..bf66ffe 100644 --- a/2_expression_overview.md +++ b/2_expression_overview.md @@ -1,9 +1,9 @@
[edk2] [Patch] BaseTools: Support to use struct name as datum type before max size
Original it hard code to use "VOID*", this patch extend it to both support VOID* and valid struct name. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Misc.py | 4 +++- BaseTools/Source/Python/Workspace/MetaFileParser.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 2cf9574..3c71dfc 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -47,10 +47,12 @@ startPatternGeneral = re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") addressPatternGeneral = re.compile("^Address[' ']+Publics by Value[' ']+Rva\+Base") valuePatternGcc = re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$') pcdPatternGcc = re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') secReGeneral = re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([.\w\$]+) +(\w+)', re.UNICODE) +StructPattern = re.compile(r'[_a-zA-Z][0-9A-Za-z_]*$') + ## Dictionary used to store file time stamp for quick re-access gFileTimeStampCache = {}# {file path : file time stamp} ## Dictionary used to store dependencies of files gDependencyDatabase = {}# arch : {file path : [dependent files list]} @@ -1461,11 +1463,11 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): Value = FieldList[0] Size = '' if len(FieldList) > 1 and FieldList[1]: DataType = FieldList[1] -if FieldList[1] != TAB_VOID: +if FieldList[1] != TAB_VOID and StructPattern.match(FieldList[1]) is None: IsValid = False if len(FieldList) > 2: Size = FieldList[2] if IsValid: if DataType == "": diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 79e3180..f33b91c 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -27,11 +27,11 @@ import Common.EdkLogger as EdkLogger import Common.GlobalData as GlobalData from CommonDataClass.DataClass import * from Common.DataType import * from Common.StringUtils import * -from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldValue +from Common.Misc import GuidStructureStringToGuidString, CheckPcdDatum, PathClass, AnalyzePcdData, AnalyzeDscPcd, AnalyzePcdExpression, ParseFieldValue, StructPattern from Common.Expression import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open from collections import defaultdict from .MetaFileTable import MetaFileStorage @@ -1610,12 +1610,12 @@ class DscParser(MetaFileParser): return ValList, Valid, Index = AnalyzeDscPcd(self._ValueList[2], self._ItemType) if not Valid: if self._ItemType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): -if ValList[1] != TAB_VOID and ValList[2]: -EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect. Only VOID* type PCD need the maxsize info.", File=self._FileWithError, +if ValList[1] != TAB_VOID and StructPattern.match(ValList[1]) is None and ValList[2]: +EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect. The datum type info should be VOID* or a valid struct name.", File=self._FileWithError, Line=self._LineIndex + 1, ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2])) EdkLogger.error('build', FORMAT_INVALID, "Pcd format incorrect.", File=self._FileWithError, Line=self._LineIndex + 1, ExtraData="%s.%s|%s" % (self._ValueList[0], self._ValueList[1], self._ValueList[2])) PcdValue = ValList[Index] if PcdValue and "." not in self._ValueList[0]: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix bugs use special character in the --pcd option
Cases: --pcd Token.Name="!" --pcd Token.Name="\'W&\'" --pcd Token.Name="2*h" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index aaef404..1a0a293 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1078,10 +1078,12 @@ class DscBuildData(PlatformBuildClassObject): if PcdValue.upper() == 'TRUE': PcdValue = str(1) if not FieldName: if PcdDatumType not in TAB_PCD_NUMERIC_TYPES: PcdValue = '"' + PcdValue + '"' +elif not PcdValue.isdigit() and not PcdValue.upper().startswith('0X'): +PcdValue = '"' + PcdValue + '"' else: IsArray = False Base = 10 if PcdValue.upper().startswith('0X'): Base = 16 -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Add check for the string type whether is same
From: zhijufan Relational and equality operators require both operands to be of the same type. Treat the string 'A' and "A" as same type, but for "A" and L"A" are not same type since one is general string, another is unicode string. True:'A'<'B', "A"<"B" 'A'<"B", L'A' Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Expression.py | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 78c69fa..84898f7 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -295,12 +295,12 @@ class ValueExpression(BaseExpression): # bitwise and logical operation between number and boolean is allowed pass else: raise BadExpression(ERR_EXPR_TYPE) if isinstance(Oprand1, type('')) and isinstance(Oprand2, type('')): -if (Oprand1.startswith('L"') and not Oprand2.startswith('L"')) or \ -(not Oprand1.startswith('L"') and Oprand2.startswith('L"')): +if ((Oprand1.startswith('L"') or Oprand1.startswith('L')) and (not Oprand2.startswith('L"')) and (not Oprand2.startswith("L'"))) or \ +(((not Oprand1.startswith('L"')) and (not Oprand1.startswith("L'"))) and (Oprand2.startswith('L"') or Oprand2.startswith('L'))): raise BadExpression(ERR_STRING_CMP % (Oprand1, Operator, Oprand2)) if 'in' in Operator and isinstance(Oprand2, type('')): Oprand2 = Oprand2.split() EvalStr = 'Oprand1 ' + Operator + ' Oprand2' @@ -825,10 +825,12 @@ class ValueExpressionEx(ValueExpression): except BadExpression as Value: if self.PcdType in TAB_PCD_NUMERIC_TYPES: PcdValue = PcdValue.strip() if PcdValue.startswith('{') and PcdValue.endswith('}'): PcdValue = SplitPcdValueString(PcdValue[1:-1]) +if ERR_STRING_CMP.split(':')[0] in Value.message: +raise BadExpression("Type: %s, Value: %s, %s" % (self.PcdType, PcdValue, Value)) if isinstance(PcdValue, type([])): TmpValue = 0 Size = 0 ValueType = '' for Item in PcdValue: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/EOT: Change to call a program instead of calling Python API.
From: hchen30 Update the EOT tool to call the program itself instead of calling the Python API when parsing FV images. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Eot/{Eot.py => EotMain.py} | 465 +++-- BaseTools/Source/Python/Eot/InfParserLite.py | 26 +- BaseTools/Source/Python/Eot/Parser.py | 28 +- BaseTools/Source/Python/Eot/Report.py | 6 +- BaseTools/Source/Python/build/BuildReport.py | 2 +- 5 files changed, 84 insertions(+), 443 deletions(-) rename BaseTools/Source/Python/Eot/{Eot.py => EotMain.py} (75%) diff --git a/BaseTools/Source/Python/Eot/Eot.py b/BaseTools/Source/Python/Eot/EotMain.py similarity index 75% rename from BaseTools/Source/Python/Eot/Eot.py rename to BaseTools/Source/Python/Eot/EotMain.py index ce83da1495..49a1494126 100644 --- a/BaseTools/Source/Python/Eot/Eot.py +++ b/BaseTools/Source/Python/Eot/EotMain.py @@ -17,18 +17,20 @@ from __future__ import absolute_import import Common.LongFilePathOs as os, time, glob import Common.EdkLogger as EdkLogger -from . import EotGlobalData +import Eot.EotGlobalData as EotGlobalData from optparse import OptionParser from Common.StringUtils import NormPath from Common import BuildToolError from Common.Misc import GuidStructureStringToGuidString, sdict -from .InfParserLite import * -from . import c -from . import Database +from Eot.Parser import * +from Eot.InfParserLite import EdkInfParser +from Common.StringUtils import GetSplitValueList +from Eot import c +from Eot import Database from array import array -from .Report import Report +from Eot.Report import Report from Common.BuildVersion import gBUILD_VERSION -from .Parser import ConvertGuid +from Eot.Parser import ConvertGuid from Common.LongFilePathSupport import OpenLongFilePath as open import struct import uuid @@ -58,14 +60,14 @@ class Image(array): self._SubImages = sdict() # {offset: Image()} -array.__init__(self, 'B') +array.__init__(self) def __repr__(self): return self._ID_ def __len__(self): Len = array.__len__(self) -for Offset in self._SubImages: +for Offset in self._SubImages.keys(): Len += len(self._SubImages[Offset]) return Len @@ -154,19 +156,11 @@ class CompressedImage(Image): def _GetSections(self): try: -from . import EfiCompressor -TmpData = EfiCompressor.FrameworkDecompress( -self[self._HEADER_SIZE_:], -len(self) - self._HEADER_SIZE_ -) +TmpData = DeCompress('Efi', self[self._HEADER_SIZE_:]) DecData = array('B') DecData.fromstring(TmpData) except: -from . import EfiCompressor -TmpData = EfiCompressor.UefiDecompress( -self[self._HEADER_SIZE_:], -len(self) - self._HEADER_SIZE_ -) +TmpData = DeCompress('Framework', self[self._HEADER_SIZE_:]) DecData = array('B') DecData.fromstring(TmpData) @@ -297,7 +291,7 @@ class Depex(Image): Expression = property(_GetExpression) -## FirmwareVolume() class +# # FirmwareVolume() class # # A class for Firmware Volume # @@ -308,12 +302,12 @@ class FirmwareVolume(Image): _FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3" -_GUID_ = struct.Struct("16x 1I2H8B") -_LENGTH_= struct.Struct("16x 16x 1Q") -_SIG_ = struct.Struct("16x 16x 8x 1I") -_ATTR_ = struct.Struct("16x 16x 8x 4x 1I") -_HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H") -_CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H") +_GUID_ = struct.Struct("16x 1I2H8B") +_LENGTH_ = struct.Struct("16x 16x 1Q") +_SIG_ = struct.Struct("16x 16x 8x 1I") +_ATTR_ = struct.Struct("16x 16x 8x 4x 1I") +_HLEN_ = struct.Struct("16x 16x 8x 4x 4x 1H") +_CHECKSUM_ = struct.Struct("16x 16x 8x 4x 4x 2x 1H") def __init__(self, Name=''): Image.__init__(self) @@ -387,7 +381,7 @@ class FirmwareVolume(Image): DepexString = DepexList[0].strip() return (CouldBeLoaded, DepexString, FileDepex) -def Dispatch(self, Db = None): +def Dispatch(self, Db=None): if Db is None: return False self.UnDispatchedFfsDict = copy.copy(self.FfsDict) @@ -397,7 +391,7 @@ class FirmwareVolume(Image): FfsDxeCoreGuid = None FfsPeiPrioriGuid = None FfsDxePrioriGuid = None -for FfsID in self.UnDispatchedFfsDict: +for FfsID in self.UnDispatchedFfsDict.keys(): Ffs = self.UnDispatchedFfsDict[FfsID] if Ffs.Type == 0x03: FfsSecCoreGuid = FfsID @@ -439,6 +433,7 @@ class
[edk2] [Patch] BaseTools/Tests: Update GNUmakefile to use python3 variable
Cover the case use do make -C BaseTools before run the .edksetup.sh file. Cc: Ard Biesheuvel Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Tests/GNUmakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Tests/GNUmakefile b/BaseTools/Tests/GNUmakefile index af334a8a..536f0b7 100644 --- a/BaseTools/Tests/GNUmakefile +++ b/BaseTools/Tests/GNUmakefile @@ -12,10 +12,10 @@ # all: test test: - @if command -v $(PYTHON3) >/dev/null 2>&1; then $(PYTHON3) RunTests.py; else python RunTests.py; fi + @if command -v python3 >/dev/null 2>&1; then python3 RunTests.py; else echo "Error: Please install a python 3 tool!"; fi clean: find . -name '*.pyc' -exec rm '{}' ';' -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Remove the logic that check Python3 version larger than 3.6
Remove the logic that the Python3 version must larger than 3.6. We verified Python3 migration patches on version 3.6 and 3.7. for other version we not verified it. Cc: Ard Biesheuvel Cc: Leif Lindholm Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/toolsetup.bat | 7 --- edksetup.sh | 4 ++-- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 0d4028d..d585431 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -314,17 +314,10 @@ set PYTHON3=py -3 echo. echo !!! ERROR !!! %PYTHON3% not install. echo. goto end ) - FOR /F "TOKENS=1,2" %%i IN ('%PYTHON3% --version') DO set VERSION=%%j - if /I "%VERSION%" LSS "3.6" ( - echo. - echo !!! ERROR !!! python version should greater than or equal to version 3.6. - echo. - goto end - ) :check_freezer_path @REM We have Python, now test for FreezePython application if not defined PYTHON_FREEZER_PATH ( echo. diff --git a/edksetup.sh b/edksetup.sh index d4e577e..84b3e63 100755 --- a/edksetup.sh +++ b/edksetup.sh @@ -129,13 +129,13 @@ function SetupPython3() if [ "$ret" -eq 1 ]; then origin_version=$python_version export PYTHON3=$python fi done - if [ -z "$origin_version" ] || [ `echo "$origin_version < 3.6" |bc` -eq 1 ]; then + if [ -z "$origin_version" ]; then echo -echo ERROR!!!, python version should greater than or equal to version 3.6. +echo ERROR!!!, Please install a Python 3 Tool. echo return 1 fi -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Add --uefi option to enable UefiCompress method
From: Yunhua Feng Add one new option --uefi to enable UefiCompress. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/C/TianoCompress/TianoCompress.c | 81 +--- BaseTools/Source/C/TianoCompress/TianoCompress.h | 2 +- 2 files changed, 58 insertions(+), 25 deletions(-) diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c index 9a548fae1e..b88d7da2ed 100644 --- a/BaseTools/Source/C/TianoCompress/TianoCompress.c +++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c @@ -15,10 +15,11 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include "Compress.h" +#include "Decompress.h" #include "TianoCompress.h" #include "EfiUtilityMsgs.h" #include "ParseInf.h" #include #include "assert.h" @@ -63,10 +64,11 @@ static BOOLEAN QuietMode = FALSE; // // Global Variables // STATIC BOOLEAN ENCODE = FALSE; STATIC BOOLEAN DECODE = FALSE; +STATIC BOOLEAN UEFIMODE = FALSE; STATIC UINT8 *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit; STATIC UINT8 *mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen; STATIC INT16 mHeap[NC + 1]; STATIC INT32 mRemainder, mMatchLen, mBitCount, mHeapSize, mN; STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, mCrc; @@ -1701,10 +1703,12 @@ Returns: // // Details Option // fprintf (stdout, "Options:\n"); + fprintf (stdout, " --uefi\n\ +Enable UefiCompress, use TianoCompress when without this option\n"); fprintf (stdout, " -o FileName, --output FileName\n\ File will be created to store the ouput content.\n"); fprintf (stdout, " -v, --verbose\n\ Turn on verbose output with informational messages.\n"); fprintf (stdout, " -q, --quiet\n\ @@ -1820,10 +1824,17 @@ Returns: argc--; argv++; continue; } +if (stricmp(argv[0], "--uefi") == 0) { + UEFIMODE = TRUE; + argc--; + argv++; + continue; +} + if (stricmp (argv[0], "--debug") == 0) { argc-=2; argv++; Status = AsciiStringToUint64(argv[0], FALSE, ); if (DebugLevel > 9) { @@ -1937,21 +1948,29 @@ Returns: // First call TianoCompress to get DstSize // if (DebugMode) { DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL); } - Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + if (UEFIMODE) { +Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + } else { +Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + } if (Status == EFI_BUFFER_TOO_SMALL) { OutBuffer = (UINT8 *) malloc (DstSize); if (OutBuffer == NULL) { Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); goto ERROR; } } - Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + if (UEFIMODE) { +Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + } else { +Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, ); + } if (Status != EFI_SUCCESS) { Error (NULL, 0, 0007, "Error compressing file", NULL); goto ERROR; } @@ -1977,36 +1996,50 @@ Returns: } else if (DECODE) { if (DebugMode) { DebugMsg(UTILITY_NAME, 0, DebugLevel, "Decoding\n", NULL); } - // - // Get Compressed file original size - // - Src = (UINT8 *)FileBuffer; - OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24); - // - // Allocate OutputBuffer - // - OutBuffer = (UINT8 *)malloc(OrigSize); - if (OutBuffer == NULL) { -Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); -goto ERROR; - } + if (UEFIMODE) { +Status = Extract((VOID *)FileBuffer, InputLength, (VOID *), , 1); +if (Status != EFI_SUCCESS) { + goto ERROR; +} +fwrite(OutBuffer, (size_t)(DstSize), 1, OutputFile); + } else { +// +// Get Compressed file original size +// +Src = (UINT8 *)FileBuffer; +OrigSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24); - Status = Decompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 2); - if (Status != EFI_SUCCESS) { - goto ERROR; - } +// +// Allocate OutputBuffer +// +OutBuffer = (UINT8 *)malloc(OrigSize); +if (OutBuffer == NULL) { + Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); + goto ERROR; + } - fwrite(OutBuffer, (size_t)(Scratch->mOrigSize), 1, OutputFile); +S
[edk2] [PATCH] BaseTools: increment build generate inf file lost .depex file
From: Yunhua Feng increment build generate inf file in output directory lost .depex file info. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1244 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py | 4 1 file changed, 4 insertions(+) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 5778943512..2201ec8790 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -3634,10 +3634,14 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['binary_item'].append('ACPI|' + File) elif Item.Target.Ext.lower() == '.efi': AsBuiltInfDict['binary_item'].append('PE32|' + self.Name + '.efi') else: AsBuiltInfDict['binary_item'].append('BIN|' + File) +if not self.DepexGenerated: +DepexFile = os.path.join(self.OutputDir, self.Name + '.depex') +if os.path.exists(DepexFile): +self.DepexGenerated = True if self.DepexGenerated: self.OutputFile.add(self.Name + '.depex') if self.ModuleType in [SUP_MODULE_PEIM]: AsBuiltInfDict['binary_item'].append('PEI_DEPEX|' + self.Name + '.depex') elif self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Not compare the VOID* difference in the DSC and DEC file
For structure Pcd, the type defined in the DEC file is the struct name while if this Pcd used in the DSC file, it should add VOID* keywords when it have max size info. so this patch filter the type compare for this case. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index 02aae3a67b..5ed879c8d7 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -935,11 +935,12 @@ class DscBuildData(PlatformBuildClassObject): Valid, ErrStr = CheckPcdDatum(self._DecPcds[PcdCName, TokenSpaceGuid].DatumType, ValueList[Index]) if not Valid: EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=self.MetaFile, Line=LineNo, ExtraData="%s.%s" % (TokenSpaceGuid, PcdCName)) if PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT, MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE): -if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() != ValueList[1].strip(): +if self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() in TAB_PCD_NUMERIC_TYPES_VOID \ + and self._DecPcds[PcdCName, TokenSpaceGuid].DatumType.strip() != ValueList[1].strip(): EdkLogger.error('build', FORMAT_INVALID, "Pcd datumtype used in DSC file is not the same as its declaration in DEC file.", File=self.MetaFile, Line=LineNo, ExtraData="%s.%s|%s" % (TokenSpaceGuid, PcdCName, Setting)) if (TokenSpaceGuid + '.' + PcdCName) in GlobalData.gPlatformPcds: if GlobalData.gPlatformPcds[TokenSpaceGuid + '.' + PcdCName] != ValueList[Index]: GlobalData.gPlatformPcds[TokenSpaceGuid + '.' + PcdCName] = ValueList[Index] -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] Build Spec: Add description for Structure Pcd display in the module
The detail rules are totally same with Global Pcd section. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 13_build_reports/136_global_pcd_section.md | 12 ++-- 13_build_reports/138_module_section.md | 7 ++- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/13_build_reports/136_global_pcd_section.md b/13_build_reports/136_global_pcd_section.md index 0e3afa7..9a3b98e 100644 --- a/13_build_reports/136_global_pcd_section.md +++ b/13_build_reports/136_global_pcd_section.md @@ -160,23 +160,23 @@ option. 13.6.2.4 Rules for Structure PCD If the Pcd is a Structure Pcd, it display in the report file would have two parts. One is the final Pcd value and its field value, the field value is from FDF file, DSC file PCD Section or build option, not from the final structure byte array, and the field order is sorted by the field name. When the field value from DSC file -PCD Section, it will not have additional *P Flag, when the field value from FDF file, -it will have additional *F Flag before the field name, when the field value from -build option, it will have additional *B Flag before the field name. The other part +PCD Section, it will not have additional `*P` Flag, when the field value from FDF file, +it will have additional `*F` Flag before the field name, when the field value from +build option, it will have additional `*B` Flag before the field name. The other part is the DEC default value and its field value, this part is optional. The field value in this part is from DEC file, and the field order is sorted by the field name. ** **Note:** When the structure Pcd have some value from build option, no matter whether -the value is same with FDF or DSC file or DEC file, there will display a *B Flag before +the value is same with FDF or DSC file or DEC file, there will display a `*B` Flag before the PCD name. When the structure Pcd have some value from FDF file, no matter whether -the value is same with DSC file or DEC file, there will display a *F Flag before the +the value is same with DSC file or DEC file, there will display a `*F` Flag before the PCD name. When the structure Pcd value have some value from DSC file PCD section, no -matter whether the value is same with DEC file, there will display a *P Flag before +matter whether the value is same with DEC file, there will display a `*P` Flag before the PCD name. ** Example diff --git a/13_build_reports/138_module_section.md b/13_build_reports/138_module_section.md index 843ad34..d457c24 100644 --- a/13_build_reports/138_module_section.md +++ b/13_build_reports/138_module_section.md @@ -260,15 +260,12 @@ Each PCD may contain up to following lines: *P PcdPlatformBootTimeOut : DYNHII (UINT16) = 0xA (10) gEfiGlobalVariableGuid: L"Timeout": 0x0 DEC DEFAULT = 0x (65535) ``` -4. Additional lines may exist if the PCD is Structure PCD. Every field value -that user specified in DSC/DEC file and build command will print out. The field -value is from DSC/DEC file or build command, not from the final structure byte -array, and the field order is same as it in DSC/DEC file. when the field value is -from build command, tool will additional print a *B Flag. +4. Additional lines may exist if the PCD is Structure PCD. Please refer to +13.6.2.4 Rules for Structure PCD for details. ** **Note:** This sub-section is present when **PCD** is specified in **-Y** option. ** -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Enhance the *P Flag display for Structure Pcd
Cover the case: 1.only define the structure Pcd in DEC file, it should not have any Flag. 2.In the DEC file and DSC file only have the PCD's default value, and without the field value, it should have *P Flag. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/build/BuildReport.py | 66 1 file changed, 39 insertions(+), 27 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index feaf6a5..031594b 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1071,41 +1071,52 @@ class PcdReport(object): if Pcd.PcdFieldValueFromComm: BuildOptionMatch = True DecMatch = False elif Pcd.SkuOverrideValues: DscOverride = False -if not Pcd.SkuInfoList: -OverrideValues = Pcd.SkuOverrideValues -if OverrideValues: -Keys = list(OverrideValues.keys()) -Data = OverrideValues[Keys[0]] -Struct = list(Data.values())[0] -DscOverride = self.ParseStruct(Struct) +if Pcd.DefaultFromDSC: +DscOverride = True else: -SkuList = sorted(Pcd.SkuInfoList.keys()) -for Sku in SkuList: -SkuInfo = Pcd.SkuInfoList[Sku] -if TypeName in ('DYNHII', 'DEXHII'): -if SkuInfo.DefaultStoreDict: -DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) -for DefaultStore in DefaultStoreList: -OverrideValues = Pcd.SkuOverrideValues[Sku] -DscOverride = self.ParseStruct(OverrideValues[DefaultStore]) -if DscOverride: -break -else: -OverrideValues = Pcd.SkuOverrideValues[Sku] +DictLen = 0 +for item in Pcd.SkuOverrideValues: +DictLen += len(Pcd.SkuOverrideValues[item]) +if not DictLen: +DscOverride = False +else: +if not Pcd.SkuInfoList: +OverrideValues = Pcd.SkuOverrideValues if OverrideValues: Keys = list(OverrideValues.keys()) -OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) -DscOverride = self.ParseStruct(OverrideFieldStruct) -if DscOverride: -break +Data = OverrideValues[Keys[0]] +Struct = list(Data.values()) +DscOverride = self.ParseStruct(Struct[0]) +else: +SkuList = sorted(Pcd.SkuInfoList.keys()) +for Sku in SkuList: +SkuInfo = Pcd.SkuInfoList[Sku] +if TypeName in ('DYNHII', 'DEXHII'): +if SkuInfo.DefaultStoreDict: +DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) +for DefaultStore in DefaultStoreList: +OverrideValues = Pcd.SkuOverrideValues[Sku] +DscOverride = self.ParseStruct(OverrideValues[DefaultStore]) +if DscOverride: +break +else: +OverrideValues = Pcd.SkuOverrideValues[Sku] +if OverrideValues: +Keys = list(OverrideValues.keys()) +OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) +DscOverride
[edk2] [Patch] BaseTools: do basic check in FvImage with header size and signature
From: zhijufan Add some basic check in FvImage with header size and signature. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1181 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/GenFds/Fv.py | 44 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 0d005eb..510f283 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -193,36 +193,40 @@ class FV (FvClassObject): ) # # Write the Fv contents to Buffer # -if os.path.isfile(FvOutputFile): +if os.path.isfile(FvOutputFile) and os.path.getsize(FvOutputFile) >= 0x48: FvFileObj = open(FvOutputFile, 'rb') -GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName) -GenFdsGlobalVariable.SharpCounter = 0 - -Buffer.write(FvFileObj.read()) -FvFileObj.seek(0) # PI FvHeader is 0x48 byte FvHeaderBuffer = FvFileObj.read(0x48) -# FV alignment position. -FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F) -if FvAlignmentValue >= 0x400: -if FvAlignmentValue >= 0x10: -if FvAlignmentValue >= 0x100: -#The max alignment supported by FFS is 16M. -self.FvAlignment = "16M" +Signature = FvHeaderBuffer[0x28:0x32] +if Signature and Signature.startswith('_FVH'): +GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName) +GenFdsGlobalVariable.SharpCounter = 0 + +Buffer.write(FvFileObj.read()) +FvFileObj.seek(0) +# FV alignment position. +FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F) +if FvAlignmentValue >= 0x400: +if FvAlignmentValue >= 0x10: +if FvAlignmentValue >= 0x100: +#The max alignment supported by FFS is 16M. +self.FvAlignment = "16M" +else: +self.FvAlignment = str(FvAlignmentValue / 0x10) + "M" else: -self.FvAlignment = str(FvAlignmentValue / 0x10) + "M" +self.FvAlignment = str(FvAlignmentValue / 0x400) + "K" else: -self.FvAlignment = str(FvAlignmentValue / 0x400) + "K" +# FvAlignmentValue is less than 1K +self.FvAlignment = str (FvAlignmentValue) +FvFileObj.close() +GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile +GenFdsGlobalVariable.LargeFileInFvFlags.pop() else: -# FvAlignmentValue is less than 1K -self.FvAlignment = str (FvAlignmentValue) -FvFileObj.close() -GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile -GenFdsGlobalVariable.LargeFileInFvFlags.pop() +GenFdsGlobalVariable.ErrorLogger("Invalid FV file %s." % self.UiFvName) else: GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName) return FvOutputFile ## _GetBlockSize() -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: refactor the error for PCD value is negative or exceed max
From: zhijufan refactor the error handling for the PCD value that is negative or it exceed the max value. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/AutoGen/GenC.py | 57 - BaseTools/Source/Python/BPDG/GenVpd.py | 44 - BaseTools/Source/Python/Common/Misc.py | 4 +++ 3 files changed, 30 insertions(+), 75 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index f455f83..09626d0 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1013,54 +1013,23 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): ValueNumber = int (Value, 0) except: EdkLogger.error("build", AUTOGEN_ERROR, "PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), ExtraData="[%s]" % str(Info)) -if Pcd.DatumType == TAB_UINT64: -if ValueNumber < 0: -EdkLogger.error("build", AUTOGEN_ERROR, -"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -elif ValueNumber >= 0x1: -EdkLogger.error("build", AUTOGEN_ERROR, -"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -if not Value.endswith('ULL'): -Value += 'ULL' -elif Pcd.DatumType == TAB_UINT32: -if ValueNumber < 0: -EdkLogger.error("build", AUTOGEN_ERROR, -"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -elif ValueNumber >= 0x1: -EdkLogger.error("build", AUTOGEN_ERROR, -"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -if not Value.endswith('U'): -Value += 'U' -elif Pcd.DatumType == TAB_UINT16: -if ValueNumber < 0: -EdkLogger.error("build", AUTOGEN_ERROR, -"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -elif ValueNumber >= 0x1: -EdkLogger.error("build", AUTOGEN_ERROR, -"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -if not Value.endswith('U'): -Value += 'U' -elif Pcd.DatumType == TAB_UINT8: -if ValueNumber < 0: -EdkLogger.error("build", AUTOGEN_ERROR, -"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -elif ValueNumber >= 0x100: -EdkLogger.error("build", AUTOGEN_ERROR, -"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), -ExtraData="[%s]" % str(Info)) -if not Value.endswith('U'): -Value += 'U' +if ValueNumber < 0: +EdkLogger.error("build", AUTOGEN_ERROR, +"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName), +ExtraData="[%s]" % str(Info)) +elif ValueNumber > MAX_VAL_TYPE[Pcd.DatumType]: +
[edk2] [Patch] Build Spec: Add some clarification of Build report section
1. Add the section header of Global PCD Section 2. Add 'INF DEFAULT' in the module PCD section Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 13_build_reports/136_global_pcd_section.md | 13 + 13_build_reports/138_module_section.md | 8 +--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/13_build_reports/136_global_pcd_section.md b/13_build_reports/136_global_pcd_section.md index 2b7cf5f..0e3afa7 100644 --- a/13_build_reports/136_global_pcd_section.md +++ b/13_build_reports/136_global_pcd_section.md @@ -45,10 +45,23 @@ gEfiNt32PkgTokenSpaceGuid ``` PCD values derived from expressions or other PCDs are not differentiated in the report. Only the final value is displayed. +The section header is: +``` +>===< +Platform Configuration Database Report + *B - PCD override in the build option + *P - Platform scoped PCD override in DSC file + *F - Platform scoped PCD override in FDF file + *M - Module scoped PCD override += +.. (List of PCDs) +<===> +``` + Each global PCD item contains one or more lines: ### 13.6.1 Required line The first line is required: diff --git a/13_build_reports/138_module_section.md b/13_build_reports/138_module_section.md index 52288d7..843ad34 100644 --- a/13_build_reports/138_module_section.md +++ b/13_build_reports/138_module_section.md @@ -241,15 +241,17 @@ Each PCD may contain up to following lines: ``` *F PcdVpdSample : DYN-VPD (UINT32) = 0x1 (1) 0x0001FFF ``` -3. The third and fourth lines are both option if the module's final - `` is not equal to the PCD value in the PCD common section in the - DSC file and the PCD value in the DEC file respectively. +3. The `DSC DEFAULT` `INF DEFAULT` and `DEC DEFAULT` are option if the module's + final `` is not equal to the PCD value in the PCD common section in + DSC file, the PCD value in the module INF file and the PCD value in the DEC + file respectively. ``` DSC DEFAULT = + INF DEFAULT = DEC DEFAULT = ``` For example: ``` *M PcdDebugPrintErrorLevel : FIXED (UINT32) = 0x8042 (2147483714) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] Build Spec: Update EBNF of --pcd for String type to at least one char
Update the '*' in the EBNF to '+' which means in the string there at least need one char. the case like "" is not supported. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- appendix_d_buildexe_command/d4_usage.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appendix_d_buildexe_command/d4_usage.md b/appendix_d_buildexe_command/d4_usage.md index 16c3630..00928f3 100644 --- a/appendix_d_buildexe_command/d4_usage.md +++ b/appendix_d_buildexe_command/d4_usage.md @@ -214,12 +214,12 @@ precedence over PCD provided in DSC, FDF, INF, and DEC files. ::= {"0x"} {"0X"} (a-fA-F0-9){1,16} ::= {} {} ::= {"TRUE"} {"True"} {"true"} {"1"} {"0x1"} {"0x01"} ::= {"FALSE"} {"False"} {"false"} {"0"} {"0x0"} {"0x00"} ::= {} {} - ::= ["L"] * -::= ["L"] "\" * + ::= ["L"] + +::= ["L"] "\" + "\" ::= {} {} ::= 0x22 ::= 0x27 ::= {0x21} {(0x23 - 0x26)} {(0x28 - 0x5B)} {(0x5D - 0x7E)} -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: remove the not used PyUtility file
the PyUtility is not used, so we remove it. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/C/PyUtility/Makefile| 25 --- BaseTools/Source/C/PyUtility/PyUtility.c | 106 --- BaseTools/Source/C/PyUtility/setup.py| 42 --- BaseTools/Source/Python/Common/Misc.py | 16 +--- BaseTools/Source/Python/Common/PyUtility.pyd | Bin 6144 -> 0 bytes 5 files changed, 3 insertions(+), 186 deletions(-) delete mode 100644 BaseTools/Source/C/PyUtility/Makefile delete mode 100644 BaseTools/Source/C/PyUtility/PyUtility.c delete mode 100644 BaseTools/Source/C/PyUtility/setup.py delete mode 100644 BaseTools/Source/Python/Common/PyUtility.pyd diff --git a/BaseTools/Source/C/PyUtility/Makefile b/BaseTools/Source/C/PyUtility/Makefile deleted file mode 100644 index 5829070..000 --- a/BaseTools/Source/C/PyUtility/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -## @file -# Makefile -# -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved. -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution.The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -!INCLUDE ..\Makefiles\ms.common - -APPNAME = GenSec - -LIBS = $(LIB_PATH)\Common.lib - -OBJECTS = PyUtility.obj - -#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib - -!INCLUDE ..\Makefiles\ms.app - diff --git a/BaseTools/Source/C/PyUtility/PyUtility.c b/BaseTools/Source/C/PyUtility/PyUtility.c deleted file mode 100644 index d14b872..000 --- a/BaseTools/Source/C/PyUtility/PyUtility.c +++ /dev/null @@ -1,106 +0,0 @@ -/** @file -Python Utility - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/* - SaveFileToDisk(FilePath, Content) -*/ -STATIC -PyObject* -SaveFileToDisk ( - PyObject*Self, - PyObject*Args - ) -{ - CHAR8 *File; - UINT8 *Data; - UINTN DataLength; - UINTN WriteBytes; - UINTN Status; - HANDLEFileHandle; - PyObject *ReturnValue = Py_False; - - Status = PyArg_ParseTuple( -Args, -"ss#", -, -, - -); - if (Status == 0) { -return NULL; - } - - FileHandle = CreateFile( -File, -GENERIC_WRITE, -FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE, -NULL, -CREATE_ALWAYS, -FILE_ATTRIBUTE_NORMAL, -NULL -); - if (FileHandle == INVALID_HANDLE_VALUE) { -PyErr_SetString(PyExc_Exception, "File creation failure"); -return NULL; - } - - while (WriteFile(FileHandle, Data, DataLength, , NULL)) { -if (DataLength <= WriteBytes) { - DataLength = 0; - break; -} - -Data += WriteBytes; -DataLength -= WriteBytes; - } - - if (DataLength != 0) { -// file saved unsuccessfully -PyErr_SetString(PyExc_Exception, "File write failure"); -goto Done; - } - - // - // Flush buffer may slow down the whole build performance (average 10s slower) - // - //if (!FlushFileBuffers(FileHandle)) { - // PyErr_SetString(PyExc_Exception, "File flush failure"); - // goto Done; - //} - - // success! - ReturnValue = Py_True; - -Done: - CloseHandle(FileHandle); - return ReturnValue; -} - -STATIC INT8 SaveFileToDiskDocs[] = "SaveFileToDisk(): Make sure the file is saved to disk\n"; - -STATIC PyMethodDef PyUtility_Funcs[] = { - {"SaveFileToDisk", (PyCFunction)SaveFileToDisk, METH_VARARGS, SaveFileToDiskDocs}, - {NULL, NULL, 0, NULL} -}; - -PyMODINIT_FUNC -initPyUtility(VOID) { - Py_InitModule3("PyUtility", PyUtility_Funcs, "Utilties Module Implemented C Language"); -} - - diff --git a/BaseTools/Source/C/PyUtility/setup.py b/BaseTools/Source/C/PyUtility/setup.py deleted file mode 100644 index e4d407d..000 --- a/BaseTools/Source/C/PyUtility/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -## @file -# package and install PyEfiCompressor extension -# -# Copyright (c) 2008, Intel Corporation. All rights reserved. -# -# This program and the accompanying
[edk2] [Patch] BaseTools: remove PyUtility and open the file with unbuffered
the PyUtility is not used, so we remove it. And update the open file with unbuffered to avoid the case that the file is not wrote but directly used in later when the host's multiple thread is very strong. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/C/PyUtility/Makefile| 25 --- BaseTools/Source/C/PyUtility/PyUtility.c | 106 --- BaseTools/Source/C/PyUtility/setup.py| 42 --- BaseTools/Source/Python/Common/Misc.py | 16 +--- BaseTools/Source/Python/Common/PyUtility.pyd | Bin 6144 -> 0 bytes 5 files changed, 3 insertions(+), 186 deletions(-) delete mode 100644 BaseTools/Source/C/PyUtility/Makefile delete mode 100644 BaseTools/Source/C/PyUtility/PyUtility.c delete mode 100644 BaseTools/Source/C/PyUtility/setup.py delete mode 100644 BaseTools/Source/Python/Common/PyUtility.pyd diff --git a/BaseTools/Source/C/PyUtility/Makefile b/BaseTools/Source/C/PyUtility/Makefile deleted file mode 100644 index 5829070..000 --- a/BaseTools/Source/C/PyUtility/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -## @file -# Makefile -# -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved. -# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution.The full text of the license may be found at -# http://opensource.org/licenses/bsd-license.php -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# - -!INCLUDE ..\Makefiles\ms.common - -APPNAME = GenSec - -LIBS = $(LIB_PATH)\Common.lib - -OBJECTS = PyUtility.obj - -#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib - -!INCLUDE ..\Makefiles\ms.app - diff --git a/BaseTools/Source/C/PyUtility/PyUtility.c b/BaseTools/Source/C/PyUtility/PyUtility.c deleted file mode 100644 index d14b872..000 --- a/BaseTools/Source/C/PyUtility/PyUtility.c +++ /dev/null @@ -1,106 +0,0 @@ -/** @file -Python Utility - -Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved. -This program and the accompanying materials are licensed and made available -under the terms and conditions of the BSD License which accompanies this -distribution. The full text of the license may be found at -http://opensource.org/licenses/bsd-license.php - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -**/ - -#include -#include -#include - -/* - SaveFileToDisk(FilePath, Content) -*/ -STATIC -PyObject* -SaveFileToDisk ( - PyObject*Self, - PyObject*Args - ) -{ - CHAR8 *File; - UINT8 *Data; - UINTN DataLength; - UINTN WriteBytes; - UINTN Status; - HANDLEFileHandle; - PyObject *ReturnValue = Py_False; - - Status = PyArg_ParseTuple( -Args, -"ss#", -, -, - -); - if (Status == 0) { -return NULL; - } - - FileHandle = CreateFile( -File, -GENERIC_WRITE, -FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE, -NULL, -CREATE_ALWAYS, -FILE_ATTRIBUTE_NORMAL, -NULL -); - if (FileHandle == INVALID_HANDLE_VALUE) { -PyErr_SetString(PyExc_Exception, "File creation failure"); -return NULL; - } - - while (WriteFile(FileHandle, Data, DataLength, , NULL)) { -if (DataLength <= WriteBytes) { - DataLength = 0; - break; -} - -Data += WriteBytes; -DataLength -= WriteBytes; - } - - if (DataLength != 0) { -// file saved unsuccessfully -PyErr_SetString(PyExc_Exception, "File write failure"); -goto Done; - } - - // - // Flush buffer may slow down the whole build performance (average 10s slower) - // - //if (!FlushFileBuffers(FileHandle)) { - // PyErr_SetString(PyExc_Exception, "File flush failure"); - // goto Done; - //} - - // success! - ReturnValue = Py_True; - -Done: - CloseHandle(FileHandle); - return ReturnValue; -} - -STATIC INT8 SaveFileToDiskDocs[] = "SaveFileToDisk(): Make sure the file is saved to disk\n"; - -STATIC PyMethodDef PyUtility_Funcs[] = { - {"SaveFileToDisk", (PyCFunction)SaveFileToDisk, METH_VARARGS, SaveFileToDiskDocs}, - {NULL, NULL, 0, NULL} -}; - -PyMODINIT_FUNC -initPyUtility(VOID) { - Py_InitModule3("PyUtility", PyUtility_Funcs, "Utilties Module Implemented C Language"); -} - - diff --git a/BaseTools/Source/C/PyUtility/setup.py b/BaseTools/Source/C/PyUtility/setup.py deleted file mode 100644 index e4d407d..000 --- a/BaseTools/Source/C/PyUtility/setup.py +++ /dev/null @@ -1,42 +0,0 @@ -## @file
[edk2] [Patch] BaseTools: Fix a bug for Unused PCDs section display in the report
From: zhijufan Fix a regression issue caused by ac4578af364, when there doesn't exist not used PCD, it also display the not used Pcd section in the report. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1170 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 12 +++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index c7fa1b9..49bcd9c 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -886,11 +886,21 @@ class PcdReport(object): def GenerateReport(self, File, ModulePcdSet): if not ModulePcdSet: if self.ConditionalPcds: self.GenerateReportDetail(File, ModulePcdSet, 1) if self.UnusedPcds: -self.GenerateReportDetail(File, ModulePcdSet, 2) +IsEmpty = True +for Token in self.UnusedPcds: +TokenDict = self.UnusedPcds[Token] +for Type in TokenDict: +if TokenDict[Type]: +IsEmpty = False +break +if not IsEmpty: +break +if not IsEmpty: +self.GenerateReportDetail(File, ModulePcdSet, 2) self.GenerateReportDetail(File, ModulePcdSet) ## # Generate report for PCD information # -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V2] INF spec: Correct some items in the Table 1 EDK II [Defines] Section
V2: list the updated items Remove 'EDK_RELEASE_VERSION', 'DEFINE' Add 'PCI_REVISION' Update 'VERSION_STRING''s required attrubute in the table to Optional. Update 'LIBRARY_CLASS' and UEFI PCI Option ROM's value in the table per 3.4 section Update the table's format because current in the PDF format spec this table's display was cut off. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1162 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_inf_overview/24_[defines]_section.md | 59 3_edk_ii_inf_file_format/34_[defines]_section.md | 2 +- README.md| 1 + 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/2_inf_overview/24_[defines]_section.md b/2_inf_overview/24_[defines]_section.md index 37b0135..0afdfed 100644 --- a/2_inf_overview/24_[defines]_section.md +++ b/2_inf_overview/24_[defines]_section.md @@ -106,35 +106,34 @@ the PEI Core or the Dxe Core. EDK II only references the first possible dispatch instance. ** ## Table 1 EDK II [Defines] Section Elements -| Tag | Required | Value | Notes | -| | | - | --- | -| `INF_VERSION`| REQUIRED | 1.27 or 0x0001001B| This identifies the INF spec. version. It is decimal value with fraction or two-nibble hexadecimal representation of the same, for example: 1.27. Tools use this value to handle parsing of previous releases of the specification if there are incompatible changes. | -| `BASE_NAME` | REQUIRED | A single word | This is a single word identifier that will be used for the component name. | -| `EDK_RELEASE_VERSION`| Not required | Hex Double Word | The minimum revision value across the module and all its dependent libraries. If a revision value is not declared in the module or any of the dependent libraries, then the tool may use the value of 0, which disables checking. | -| `PI_SPECIFICATION_VERSION` | Not required | Decimal or special format of hex | The minimum revision value across the module and all its dependent libraries. If a revision value is not declared in the module or any of the dependent libraries, then tools may use the value of 0, which disables checking
[edk2] [Patch] BaseTools: Align the boolean type PCD value's display in the report
From: zhijufan This patch align the boolean type PCD value's display in the build report. Original it may display 0x0, also may use 0 for the same PCD. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 19 +-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index a598d64..c7fa1b9 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1012,11 +1012,11 @@ class PcdReport(object): FileWrite(File, "") FileWrite(File, Key) First = False -if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: +if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: PcdValueNumber = int(PcdValue.strip(), 0) if DecDefaultValue is None: DecMatch = True else: DecDefaultValueNumber = int(DecDefaultValue.strip(), 0) @@ -1100,10 +1100,19 @@ class PcdReport(object): DecMatch = False # # Report PCD item according to their override relationship # +if Pcd.DatumType == 'BOOLEAN': +if DscDefaultValue: +DscDefaultValue = str(int(DscDefaultValue, 0)) +if DecDefaultValue: +DecDefaultValue = str(int(DecDefaultValue, 0)) +if InfDefaultValue: +InfDefaultValue = str(int(InfDefaultValue, 0)) +if Pcd.DefaultValue: +Pcd.DefaultValue = str(int(Pcd.DefaultValue, 0)) if DecMatch: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, ' ') elif InfDefaultValue and InfMatch: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M') elif BuildOptionMatch: @@ -1124,13 +1133,15 @@ class PcdReport(object): continue if not BuildOptionMatch: ModuleOverride = self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {}) for ModulePath in ModuleOverride: ModuleDefault = ModuleOverride[ModulePath] -if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: +if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES: ModulePcdDefaultValueNumber = int(ModuleDefault.strip(), 0) Match = (ModulePcdDefaultValueNumber == PcdValueNumber) +if Pcd.DatumType == 'BOOLEAN': +ModuleDefault = str(ModulePcdDefaultValueNumber) else: Match = (ModuleDefault.strip() == PcdValue.strip()) if Match: continue IsByteArray, ArrayList = ByteArrayForamt(ModuleDefault.strip()) @@ -1245,10 +1256,12 @@ class PcdReport(object): if SkuInfo.DefaultStoreDict: DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) for DefaultStore in DefaultStoreList: Value = SkuInfo.DefaultStoreDict[DefaultStore] IsByteArray, ArrayList = ByteArrayForamt(Value) +if Pcd.DatumType == 'BOOLEAN': +Value = str(int(Value, 0)) if FirstPrint: FirstPrint = False if IsByteArray: if self.DefaultStoreSingle and self.SkuSingle: FileWrite(File, ' %-*s : %6s %10s = %s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', '{')) @@ -1307,10 +1320,12 @@ class PcdReport(object): self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: Value = SkuInfo.DefaultValue IsByteArray, ArrayList = ByteArrayForamt(Value) +if Pcd.DatumType == 'BOOLEAN': +Value = str
[edk2] [Patch] BaseTools: Report error for incorrect hex value format
From: zhijufan The case is user use 0x1} as a hex value for Pcd, it directly cause tool report traceback info. This patch add more error info. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Misc.py | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 2cf9574..430bf6b 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1412,11 +1412,14 @@ def ParseFieldValue (Value): if Value.startswith('DEVICE_PATH(') and Value.endswith(')'): Value = Value.replace("DEVICE_PATH(", '').rstrip(')') Value = Value.strip().strip('"') return ParseDevPathValue(Value) if Value.lower().startswith('0x'): -Value = int(Value, 16) +try: +Value = int(Value, 16) +except: +raise BadExpression("invalid hex value: %s" % Value) if Value == 0: return 0, 1 return Value, (Value.bit_length() + 7) / 8 if Value[0].isdigit(): Value = int(Value, 10) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] Build spec: correct the Operator used in the expression for Table 12
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=598 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- .../82_auto-generation_process.md | 34 +++--- README.md | 1 + 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md b/8_pre-build_autogen_stage/82_auto-generation_process.md index 6ce1710..9b61e0d 100644 --- a/8_pre-build_autogen_stage/82_auto-generation_process.md +++ b/8_pre-build_autogen_stage/82_auto-generation_process.md @@ -657,15 +657,11 @@ Refer to the DSC and FDF file form specifications "_Conditional Directive Blocks_" section for additional details of how directives must be processed. 8.2.4.6 Expressions Expressions can be used in conditional directive comparison statements and in -value fields for PCDs in the DSC and FDF files. - -** -**Note:** Expressions are not supported in the INF and DEC files. -** +value fields for PCDs in the meta-data files. Expressions follow C relation, equality, logical and bitwise precedence and associativity. Not all C operators are supported, only operators in the following list can be used. @@ -681,22 +677,26 @@ Use of parenthesis is encouraged to remove ambiguity. Additional scripting style operators may be used in place of C operators as shown in the table below. ## Table 12 Operator Precedence and Supported Operands -| Operator | Use with Data Types | Notes | Priority | -| | - | - | | -| `or`, `OR`, | Number, Boolean | | Lowest | -| `and`, `AND`, `&&` | Number, Boolean | | | -| | Number, Boolean | Bitwise OR | | -| `^`, `xor`, `XOR`| Number, Boolean | Exclusive OR | | -| `&` | Number, Boolean | Bitwise AND | | -| `==`, `!=`, `EQ`, `NE`, `IN` | All | The IN operator can only be used to test a quoted unary literal string for membership in a list. | | -| | | Space characters must be used before and after the letter operators Strings compared to boolean or numeric values using "==" or "EQ" will always return FALSE, while using the "!=" or "NE" operators will always return TRUE | | -| `<=`, `>=`, `<`, `>`, `LE`, `GE`, `LT`, `GT` | All | Space characters must be used before and after the letter operators. | | -| `+`, `-` | Number, Boolean | Cannot be used with strings - the system does not automatically do concatenation. Tools should report a warning
[edk2] [Patch] INF spec: Correct some items in the Table 1 EDK II [Defines] Section
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1162 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_inf_overview/24_[defines]_section.md | 59 3_edk_ii_inf_file_format/34_[defines]_section.md | 2 +- README.md| 1 + 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/2_inf_overview/24_[defines]_section.md b/2_inf_overview/24_[defines]_section.md index 37b0135..0afdfed 100644 --- a/2_inf_overview/24_[defines]_section.md +++ b/2_inf_overview/24_[defines]_section.md @@ -106,35 +106,34 @@ the PEI Core or the Dxe Core. EDK II only references the first possible dispatch instance. ** ## Table 1 EDK II [Defines] Section Elements -| Tag | Required | Value | Notes | -| | | - | --- | -| `INF_VERSION`| REQUIRED | 1.27 or 0x0001001B| This identifies the INF spec. version. It is decimal value with fraction or two-nibble hexadecimal representation of the same, for example: 1.27. Tools use this value to handle parsing of previous releases of the specification if there are incompatible changes. | -| `BASE_NAME` | REQUIRED | A single word | This is a single word identifier that will be used for the component name. | -| `EDK_RELEASE_VERSION`| Not required | Hex Double Word | The minimum revision value across the module and all its dependent libraries. If a revision value is not declared in the module or any of the dependent libraries, then the tool may use the value of 0, which disables checking. | -| `PI_SPECIFICATION_VERSION` | Not required | Decimal or special format of hex | The minimum revision value across the module and all its dependent libraries. If a revision value is not declared in the module or any of the dependent libraries, then tools may use the value of 0, which disables checking. | -| | | | The `PI_SPECIFICATION_VERSION` must only be set in the INF file if the module depends on services or system table fields or PI core behaviors that are not present in the PI 1.0 version. For example, if a module depends on definitions in PI 1.1 that are not in PI 1.0
[edk2] [Patch] BaseTools: Fix the RaiseError variable issue caused by 855698fb69f
The bug is that it cause the RaiseError always be set to TRUE even we call the function with FALSE parameter. Cc: Hess Chen Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/EdkLogger.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index 80697bf..af77074 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -196,12 +196,12 @@ def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=Non LogText = _ErrorMessageTemplate % TemplateDict else: LogText = _ErrorMessageTemplateWithoutFile % TemplateDict _ErrorLogger.log(ERROR, LogText) -RaiseError = IsRaiseError -if RaiseError: + +if RaiseError and IsRaiseError: raise FatalError(ErrorCode) # Log information which should be always put out quiet = _ErrorLogger.error -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix a bug about list the PCD in "not used" section
From: zhijufan Defined a pcd in Ovmf.dec and used that pcd in AcpiPlatformDxe.inf, then assign a value to that pcd from DSC, then build Ovmf platform successfully. But this Pcd was wrongly listed into not used section in the report.txt file. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/build/BuildReport.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index deb88a7..a598d64 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -817,10 +817,13 @@ class PcdReport(object): if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) in package.Pcds: Pcd.DatumType = package.Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType)].DatumType break PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, []) +UnusedPcdList = self.UnusedPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, []) +if Pcd in UnusedPcdList: +UnusedPcdList.remove(Pcd) if Pcd not in PcdList and Pcd not in UnusedPcdFullList: UnusedPcdFullList.append(Pcd) if len(Pcd.TokenCName) > self.MaxLen: self.MaxLen = len(Pcd.TokenCName) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Report more clear error message for PCD used in expression
From: zhijufan Only the FeatureFlag type or FixedAtBuild type can be used in the expression. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Expression.py | 2 +- BaseTools/Source/Python/Common/RangeExpression.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 78c69fa..ff92710 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -27,11 +27,11 @@ ERR_STRING_EXPR = 'This operator cannot be used in string expression: [% ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].' ERR_MATCH = 'No matching right parenthesis.' ERR_STRING_TOKEN= 'Bad string token: [%s].' ERR_MACRO_TOKEN = 'Bad macro token: [%s].' ERR_EMPTY_TOKEN = 'Empty token is not allowed.' -ERR_PCD_RESOLVE = 'PCD token cannot be resolved: [%s].' +ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild type: [%s].' ERR_VALID_TOKEN = 'No more valid token found from rest of string: [%s].' ERR_EXPR_TYPE = 'Different types found in expression.' ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]' ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.' WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.' diff --git a/BaseTools/Source/Python/Common/RangeExpression.py b/BaseTools/Source/Python/Common/RangeExpression.py index 20581ed..407dc06 100644 --- a/BaseTools/Source/Python/Common/RangeExpression.py +++ b/BaseTools/Source/Python/Common/RangeExpression.py @@ -24,11 +24,11 @@ ERR_STRING_EXPR = 'This operator cannot be used in string expression: [%s].' ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].' ERR_MATCH = 'No matching right parenthesis.' ERR_STRING_TOKEN = 'Bad string token: [%s].' ERR_MACRO_TOKEN = 'Bad macro token: [%s].' ERR_EMPTY_TOKEN = 'Empty token is not allowed.' -ERR_PCD_RESOLVE = 'PCD token cannot be resolved: [%s].' +ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild type: [%s].' ERR_VALID_TOKEN = 'No more valid token found from rest of string: [%s].' ERR_EXPR_TYPE = 'Different types found in expression.' ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]' ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.' WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic expression.' -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Extend the keyword "!include"/"!if" to case-insensitive
From: zhijufan Extend the keyword "!include", "!if", etc to case-insensitive. Current DSC parser already support it, while FDF parser only support the lower case, so this patch add the support for FDF parser. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/GenFds/FdfParser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 8de0b48..7e1be65 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -,10 +,12 @@ class FdfParser: EndPos = self.CurrentOffsetWithinLine if self.CurrentLineNumber != StartLine: EndPos = len(self.Profile.FileLinesList[StartLine-1]) self.__Token = self.Profile.FileLinesList[StartLine-1][StartPos : EndPos] +if self.__Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF, TAB_ELSE, TAB_IF_DEF, TAB_IF_N_DEF, TAB_ERROR, TAB_INCLUDE]: +self.__Token = self.__Token.lower() if StartPos != self.CurrentOffsetWithinLine: return True else: return False -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] FDF Spec: Extend exclamation statement's keyword to case-insensitive
This patch add some description for "!include", "!error", "!if", etc, to extend those statement's keyword to case-insensitive. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_fdf_design_discussion/22_flash_description_file_format.md | 8 +--- 3_edk_ii_fdf_file_format/32_fdf_definition.md | 6 ++ README.md | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/2_fdf_design_discussion/22_flash_description_file_format.md b/2_fdf_design_discussion/22_flash_description_file_format.md index 1092f00..3ea818f 100644 --- a/2_fdf_design_discussion/22_flash_description_file_format.md +++ b/2_fdf_design_discussion/22_flash_description_file_format.md @@ -209,11 +209,12 @@ directory this INF file is in or in sub-directories of this directory. ### 2.2.5 !include Statements The `!include` statement may appear within an EDK II FDF file. The included file content must match the content type of the current section definition, -contain complete sections, or combination of both. +contain complete sections, or combination of both. The keyword `!include` +is case-insensitive. The argument of this statement is a filename. The file is relative to the directory that contains this DSC file, and if not found the tool must attempt to find the file relative to paths listed in the system environment variables, `$(WORKSPACE)`, `$(PACKAGES_PATH)`, `$(EFI_SOURCE)`, `$(EDK_SOURCE)`, and @@ -523,11 +524,11 @@ statements may appear anywhere within the FDF file. ** **Note:** A limited number of statements are supported. This specification does not support every conditional statement that C programmers are familiar with. ** -Supported statements are: +Supported following statements and the keyword are case-insensitive: `!ifdef, !ifndef, !if, !elseif, !else and !endif` Refer to the Macro Statement section for information on using Macros in conditional directives. @@ -620,11 +621,12 @@ The following is an example of conditional statements. ### 2.2.9 !error Statement The `!error` statement may appear within any section of EDK II FDF file. The argument of this statement is an error message, it causes build tool to stop at the location where the statement is encountered and error message following -the `!error` statement is output as a message. +the `!error` statement is output as a message. The keyword `!error` is not +case-sensitive. The following example show the valid usage of the `!error` statement. ```ini !if $(FEATURE_ENABLE) == TRUE diff --git a/3_edk_ii_fdf_file_format/32_fdf_definition.md b/3_edk_ii_fdf_file_format/32_fdf_definition.md index 39d211d..4c323c5 100644 --- a/3_edk_ii_fdf_file_format/32_fdf_definition.md +++ b/3_edk_ii_fdf_file_format/32_fdf_definition.md @@ -425,10 +425,12 @@ C pre-processor. * Zero or more `!elseif` statements are permitted; only one `!else` statement is permitted. * Conditional directive blocks may be nested. +* Keyword `!ifdef, !ifndef, !if, !elseif, !else, !endif` are case-insensitive. + * Directives can be used to encapsulate entire sections or elements within a single section, such that they do not break the integrity of the section definitions. * Directives are in-fix expressions that are evaluated left to right; content @@ -658,10 +660,12 @@ to locate the file relaitive to the directory that contains the DSC file. If none of these methods find the file, and a directory separator is in ``, the tools attempt to find the file in a WORKSPACE (or a directory listed in the PACKAGES_PATH) relative path. If the file cannot be found, the build system must exit with an appropriate error message. +The keyword `!include` is case-insensitive. + Prototype ` ::= "!include" ` ## Example (EDK II FDF) @@ -681,10 +685,12 @@ Use of this statement is optional. This section defines the `!error` statement in EDK II FDF files. This statement is used to cause build tool to stop at the location where the statement is encountered and error message following the `!error` statement is output as a message. +The keyword `!error` is case-insensitive. + Prototype ` ::= "!error" ` ` ::= ` diff --git a/README.md b/README.md index cd489ee..5928df8 100644 --- a/README.md +++ b/README.md @@ -213,5 +213,6 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. || Per PI 1.6 to support FV extended header entry contain the used size of FV | | || Add !error statement section |
[edk2] [Patch] Build Spec: Extend exclamation statement's keyword to case-insensitive
This patch add some description for "!include", "!error", "!if", etc, to extend those statement's keyword to case-insensitive. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- .../82_auto-generation_process.md | 22 +- README.md | 1 + 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/8_pre-build_autogen_stage/82_auto-generation_process.md b/8_pre-build_autogen_stage/82_auto-generation_process.md index abfa55c..6ce1710 100644 --- a/8_pre-build_autogen_stage/82_auto-generation_process.md +++ b/8_pre-build_autogen_stage/82_auto-generation_process.md @@ -268,11 +268,11 @@ Multiple library class instances for a single library class must not be specified in the same `[LibraryClasses]` or `` section in the DSC file. 8.2.4.1 !include Files -The DSC (and FDF) file can use `!include` statements to include text files that +The DSC and FDF file can use `!include` statements to include text files that contain content that would appear in the DSC file. When gathering the content from the DSC (or FDF) file, the file pointed to by the !include statement is read before any other information that appears later in the file. The build system does not parse the files as the lines are read, but rather the @@ -283,10 +283,12 @@ If only a filename is provided, the file must be located in the same directory as the DSC or FDF file. Use of `$(WORKSPACE)//` is allowed for include files outside of the directory tree containing the DSC or FDF file, or `/` if the include file is in the directory tree containing the DSC or FDF file. +The keyword `!include` is case-insensitive. + 8.2.4.2 INF and DEC Parsing The build tools try to parse the INF file one by one, including the INF file for library instances. From the INF file, the build tools collect information such as source file list, library class list, package list, GUID/Protocol/PPI @@ -594,18 +596,18 @@ enclosed by double quotation marks. When testing values for PCDs, only the PCD name is required: `TokenSpaceGuidCname.PcdCname`; enclosing the PCD name in "$(" and ")" is not permitted. Supported statements are: `!ifdef`, `!ifndef`, `!if`, `!else`, `!elseif` and -`!endif`. These control statements are used to either include or exclude lines -as the parsing tool processes these files. The `!ifdef` and `!ifndef` -statements test whether a Macro has been defined or not defined (PCDs are -always defined - the build will break if a PCD is used by a module specified in -the DSC file that cannot be located in any of the dependent DEC files, from the -`[Packages]` section of an INF specified in the DSC file). FeatureFlag and -FixedAtBuild access methods are the only PCDs that can be used in conditional -directives. +`!endif`, and those keywords are case-insensitive. These control statements are +used to either include or exclude lines as the parsing tool processes these files. +The `!ifdef` and `!ifndef` statements test whether a Macro has been defined or +not defined (PCDs are always defined - the build will break if a PCD is used by +a module specified in the DSC file that cannot be located in any of the dependent +DEC files, from the `[Packages]` section of an INF specified in the DSC file). +FeatureFlag and FixedAtBuild access methods are the only PCDs that can be used in +conditional directives. The build system will process the DSC and FDF files more than once. The first pass is to pick up all macros and PCD values for macros and PCDs used in conditional directives, then on the second pass, process the conditional directive content. This second pass is required as there is no required order @@ -1064,10 +1066,12 @@ source files and generate the binary files. The DSC and FDF file can use `!error` statement. The argument of this statement is an error message, it causes build tool to stop at the location where the statement is encountered and error message following the `!error` statement is output as a message. +The keyword `!error` is case-insensitive. + ### 8.2.5 Post processing Once all files are parsed, the build tools will do following work for each EDK II module: diff --git a/README.md b/README.md index 9ca8733..8b20643 100644 --- a/README.md +++ b/README.md @@ -225,5 +225,6 @@ Copyright (c) 2008-2017, Intel Corporation. All rights reserved. || Update PCD value and SKU, DefaultStore info in build report | | || Clari
[edk2] [Patch] DSC Spec: Extend exclamation statement's keyword to case-insensitive
This patch add some description for "!include", "!error", "!if", etc, to extend those statement's keyword to case-insensitive. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_dsc_overview/22_build_description_file_format.md | 8 +--- 3_edk_ii_dsc_file_format/33_platform_dsc_definition.md | 6 ++ README.md | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/2_dsc_overview/22_build_description_file_format.md b/2_dsc_overview/22_build_description_file_format.md index 9bf46a6..31e23f4 100644 --- a/2_dsc_overview/22_build_description_file_format.md +++ b/2_dsc_overview/22_build_description_file_format.md @@ -223,11 +223,12 @@ names. ### 2.2.5 !include Statement Processing The `!include` statement may appear within any section of EDK II DSC file. The included file content must match the content type of the current section -definition, contain complete sections, or combination of both. +definition, contain complete sections, or combination of both. And the keyword +`!include` is case-insensitive. The argument of this statement is a filename. The file is relative to the directory that contains this DSC file, and if not found the tool must attempt to find the file relative to the paths listed in the system environment variables `$(WORKSPACE)`, `$(EFI_SOURCE)`, `$(EDK_SOURCE)`, and @@ -502,11 +503,11 @@ statements may appear anywhere within the DSC file. ** **Note:** A limited number of statements are supported. This specification does not support every conditional statement that C programmers are familiar with. ** -Supported statements are: +Supported following statements and the keyword are case-insensitive: `!ifdef, !ifndef, !if, !elseif, !else and !endif` Refer to the Macro Statement section for information on using Macros in conditional directives. @@ -646,11 +647,12 @@ The following are examples of conditional directives. ### 2.2.9 !error Statement The `!error` statement may appear within any section of EDK II DSC file. The argument of this statement is an error message, it causes build tool to stop at the location where the statement is encountered and error message following -the `!error` statement is output as a message. +the `!error` statement is output as a message. The keyword `!error` is not +case-sensitive. The following example show the valid usage of the `!error` statement. ```ini !if $(FEATURE_ENABLE) == TRUE diff --git a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md index 3bbcd9d..0ff9d9d 100644 --- a/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md +++ b/3_edk_ii_dsc_file_format/33_platform_dsc_definition.md @@ -474,10 +474,12 @@ directive blocks can be nested. * Zero or more "!elseif" statements are permitted; only one "!else" statement is permitted. * Conditional directive blocks may be nested. +* Keyword `!ifdef, !ifndef, !if, !elseif, !else, !endif` are case-insensitive. + * Directives can be used to encapsulate entire sections or elements within a single section, such that they do not break the integrity of the section definitions. * Directives are in-fix expressions that are evaluated left to right; content @@ -701,10 +703,12 @@ PACKAGES_PATH) relative path. If the file cannot be found, the build system must exit with an appropriate error message. Statements in the include file are permitted to override previous definitions as well as to define new entries. +The keyword `!include` is case-insensitive. + Prototype ` ::= "!include" ` Example (EDK II DSC) @@ -730,10 +734,12 @@ Use of this statement is optional. This section defines the `!error` statement in EDK II Platform (DSC) files. This statement is used to cause build tool to stop at the location where the statement is encountered and error message following the `!error` statement is output as a message. +The keyword `!error` is case-insensitive. + Prototype ` ::= "!error" ` ` ::= ` diff --git a/README.md b/README.md index 5672273..17d4ebf 100644 --- a/README.md +++ b/README.md @@ -191,5 +191,6 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. || Add flexible PCD value format into spec || |
[edk2] [Patch] BaseTools: include variable namespace GUIDs of HII PCDs in Guid.xref
From: zhijufan [PcdsDynamicHii] gFooTokenSpaceGuid.PcdBar|L"Variable"|gVarNameSpaceGuid|0x0|FALSE|NV,BS This patch add the variable namespace GUIDs in "Guid.xref" that are used with dynamic HII PCDs. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=452 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/GenFds/GenFds.py | 11 +++ 1 file changed, 11 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index 2307a19..9dec9c5 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -601,16 +601,27 @@ class GenFds : print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType) def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj): GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref") GuidXRefFile = BytesIO('') +PkgGuidDict = {} GuidDict = {} ModuleList = [] FileGuidList = [] GuidPattern = gGuidPattern for Arch in ArchList: PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] +PkgList = GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag) +for P in PkgList: +PkgGuidDict.update(P.Guids) +for Name, Guid in PlatformDataBase.Pcds: +Pcd = PlatformDataBase.Pcds[Name, Guid] +if Pcd.Type in [TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_EX_HII]: +for SkuId in Pcd.SkuInfoList: +Sku = Pcd.SkuInfoList[SkuId] +if Sku.VariableGuid and Sku.VariableGuid in PkgGuidDict.keys(): +GuidDict[Sku.VariableGuid] = PkgGuidDict[Sku.VariableGuid] for ModuleFile in PlatformDataBase.Modules: Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] if Module in ModuleList: continue else: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Add check only VOID* type Pcd need the maxsize info
From: zhijufan Add check for the datum type keyword "VOID*", only the VOID* type Pcd need the additional maxsize info. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Zhiju.Fan --- BaseTools/Source/Python/Common/Misc.py| 53 +++ .../Source/Python/Workspace/DscBuildData.py | 2 +- .../Source/Python/Workspace/MetaFileParser.py | 4 ++ 3 files changed, 23 insertions(+), 36 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 74a5f0bca5..5a63c83a2a 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1432,9 +1432,9 @@ def ParseFieldValue (Value): ## AnalyzeDscPcd # # Analyze DSC PCD value, since there is no data type info in DSC -# This fuction is used to match functions (AnalyzePcdData) used for retrieving PCD value from database +# This function is used to match functions (AnalyzePcdData) used for retrieving PCD value from database # 1. Feature flag: TokenSpace.PcdCName|PcdValue -# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|MaxSize] +# 2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] # 3. Dynamic default: # TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]] # TokenSpace.PcdCName|PcdValue @@ -1442,7 +1442,7 @@ def ParseFieldValue (Value): # TokenSpace.PcdCName|VpdOffset[|VpdValue] # TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]] # 5. Dynamic HII: -# TokenSpace.PcdCName|HiiString|VaiableGuid|VariableOffset[|HiiValue] +# TokenSpace.PcdCName|HiiString|VariableGuid|VariableOffset[|HiiValue] # PCD value needs to be located in such kind of string, and the PCD value might be an expression in which #there might have "|" operator, also in string value. # @@ -1458,42 +1458,20 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): FieldList = AnalyzePcdExpression(Setting) IsValid = True -if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_FEATURE_FLAG): +if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): Value = FieldList[0] Size = '' -if len(FieldList) > 1: -if FieldList[1].upper().startswith("0X") or FieldList[1].isdigit(): -Size = FieldList[1] -else: -DataType = FieldList[1] - -if len(FieldList) > 2: -Size = FieldList[2] -if DataType == "": -IsValid = (len(FieldList) <= 1) -else: -IsValid = (len(FieldList) <= 3) -# Value, Size = ParseFieldValue(Value) -if Size: -try: -int(Size, 16) if Size.upper().startswith("0X") else int(Size) -except: +if len(FieldList) > 1 and FieldList[1]: +DataType = FieldList[1] +if FieldList[1] != TAB_VOID: IsValid = False -Size = -1 -return [str(Value), '', str(Size)], IsValid, 0 -elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT): -Value = FieldList[0] -Size = Type = '' -if len(FieldList) > 1: -Type = FieldList[1] -else: -Type = DataType if len(FieldList) > 2: Size = FieldList[2] -if DataType == "": -IsValid = (len(FieldList) <= 1) -else: -IsValid = (len(FieldList) <= 3) +if IsValid: +if DataType == "": +IsValid = (len(FieldList) <= 1) +else: +IsValid = (len(FieldList) <= 3) if Size: try: @@ -1501,7 +1479,12 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''): except: IsValid = False Size = -1 -return [Value, Type, str(Size)], IsValid, 0 +return [str(Value), DataType, str(Size)], IsValid, 0 +elif PcdType == MODEL_PCD_FEATURE_FLAG: +Value = FieldList[0] +Size = '' +IsValid = (len(FieldList) <= 1) +return [Value, DataType, str(Size)], IsValid, 0 elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD): VpdOffset = FieldList[0] Value = Size = '' diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index a4ad53ee15..748452623f 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -897,7 +897,7 @@ class DscBuildData(PlatformBuildClassObject): if not Valid: EdkLogger.error('build', FORMAT_INVALID, ErrStr, File=self.MetaFile, Line=LineNo, ExtraData="%s.%s"
[edk2] [Patch V2] BaseTools: Update Makefile for ECC tool
V2: Add --target-name to specify the file name to create Because Ecc.py was renamed to EccMain.py Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile index d78b12d..ac99259 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -234,11 +234,11 @@ CMD_ECC=$(BASE_TOOLS_PATH)\Source\Python\Ecc\c.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CodeFragment.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CodeFragmentCollector.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Configuration.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CParser.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Database.py \ -$(BASE_TOOLS_PATH)\Source\Python\Ecc\Ecc.py \ +$(BASE_TOOLS_PATH)\Source\Python\Ecc\EccMain.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccGlobalData.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Exception.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\FileProfile.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\MetaDataParser.py \ @@ -294,12 +294,12 @@ $(BIN_DIR)\TestSigningPrivateKey.pem: $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sh @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sha256Sign\TestSigningPrivateKey.pem $(BIN_DIR)\TestSigningPrivateKey.pem $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe: $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py -$(BIN_DIR)\Ecc.exe: $(BASE_TOOLS_PATH)\Source\Python\Ecc\Ecc.py $(CMD_ECC) $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml - @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Ecc\Ecc.py +$(BIN_DIR)\Ecc.exe: $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccMain.py $(CMD_ECC) $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml + @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Ecc\EccMain.py --target-name=Ecc.exe $(BIN_DIR)\config.ini: $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml: $(BASE_TOOLS_PATH)\Source\Python\Ecc\exception.xml -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Update Makefile for ECC tool
Because Ecc.py was renamed to EccMain.py Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile index d78b12d..36e8b20 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -234,11 +234,11 @@ CMD_ECC=$(BASE_TOOLS_PATH)\Source\Python\Ecc\c.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CodeFragment.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CodeFragmentCollector.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Configuration.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\CParser.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Database.py \ -$(BASE_TOOLS_PATH)\Source\Python\Ecc\Ecc.py \ +$(BASE_TOOLS_PATH)\Source\Python\Ecc\EccMain.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccGlobalData.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\Exception.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\FileProfile.py \ $(BASE_TOOLS_PATH)\Source\Python\Ecc\MetaDataParser.py \ @@ -294,12 +294,12 @@ $(BIN_DIR)\TestSigningPrivateKey.pem: $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sh @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sha256Sign\TestSigningPrivateKey.pem $(BIN_DIR)\TestSigningPrivateKey.pem $(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe: $(BASE_TOOLS_PATH)\Source\Python\Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Rsa2048Sha256Sign\Rsa2048Sha256GenerateKeys.py -$(BIN_DIR)\Ecc.exe: $(BASE_TOOLS_PATH)\Source\Python\Ecc\Ecc.py $(CMD_ECC) $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml - @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Ecc\Ecc.py +$(BIN_DIR)\Ecc.exe: $(BASE_TOOLS_PATH)\Source\Python\Ecc\EccMain.py $(CMD_ECC) $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml + @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) Ecc\EccMain.py $(BIN_DIR)\config.ini: $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini @copy /Y /B $(BASE_TOOLS_PATH)\Source\Python\Ecc\config.ini $(BIN_DIR)\config.ini $(BIN_DIR)\exception.xml: $(BASE_TOOLS_PATH)\Source\Python\Ecc\exception.xml -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix one expression bug to support ~ operate
current use (0x41>=~0x0&0x41|0x0) as Pcd value cause build failure because the ~ is not correctly recognized. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Expression.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index 0091e47..78c69fa 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -786,11 +786,11 @@ class ValueExpression(BaseExpression): return '' OpToken = '' for Ch in Expr: if Ch in self.NonLetterOpLst: -if '!' == Ch and OpToken: +if Ch in ['!', '~'] and OpToken: break self._Idx += 1 OpToken += Ch else: break -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V2] BaseTools: Clean up not used code in BuildClassObject
V2: Add back "from Common.DataType import *" 1. Remove some import statement that are not used. 2. Remove the Type value in the LibraryClassObject because we don't actually use it. Cc: Liming Gao Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 3b47715..88465c5 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -9,15 +9,10 @@ # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import Common.LongFilePathOs as os - -from collections import OrderedDict -from Common.Misc import RealPath2 -from Common.BuildToolError import * from Common.DataType import * import collections ## PcdClassObject # @@ -251,22 +246,18 @@ class StructurePcd(PcdClassObject): # 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 [] -# @param Type:Input value for Type, default is None # # @var LibraryClass: To store value for LibraryClass # @var SupModList:To store value for SupModList -# @var Type: To store value for Type # class LibraryClassObject(object): -def __init__(self, Name = None, SupModList = [], Type = None): +def __init__(self, Name = None, SupModList = []): self.LibraryClass = Name self.SupModList = SupModList -if Type is not None: -self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT) ## ModuleBuildClassObject # # This Class defines ModuleBuildClass # @@ -330,11 +321,11 @@ class ModuleBuildClassObject(object): self.ConstructorList = [] self.DestructorList = [] self.Binaries= [] self.Sources = [] -self.LibraryClasses = OrderedDict() +self.LibraryClasses = collections.OrderedDict() self.Libraries = [] self.Protocols = [] self.Ppis= [] self.Guids = [] self.Includes= [] -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Clean up not used code in BuildClassObject
1. Remove some import statement that are not used. 2. Remove the Type value in the LibraryClassObject because we don't actually use it. Cc: Liming Gao Cc: Jaben Carsey Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/BuildClassObject.py | 14 ++ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py b/BaseTools/Source/Python/Workspace/BuildClassObject.py index 3b47715..28b6190 100644 --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py @@ -9,16 +9,10 @@ # # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # -import Common.LongFilePathOs as os - -from collections import OrderedDict -from Common.Misc import RealPath2 -from Common.BuildToolError import * -from Common.DataType import * import collections ## PcdClassObject # # This Class is used for PcdObject @@ -251,22 +245,18 @@ class StructurePcd(PcdClassObject): # 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 [] -# @param Type:Input value for Type, default is None # # @var LibraryClass: To store value for LibraryClass # @var SupModList:To store value for SupModList -# @var Type: To store value for Type # class LibraryClassObject(object): -def __init__(self, Name = None, SupModList = [], Type = None): +def __init__(self, Name = None, SupModList = []): self.LibraryClass = Name self.SupModList = SupModList -if Type is not None: -self.SupModList = CleanString(Type).split(DataType.TAB_SPACE_SPLIT) ## ModuleBuildClassObject # # This Class defines ModuleBuildClass # @@ -330,11 +320,11 @@ class ModuleBuildClassObject(object): self.ConstructorList = [] self.DestructorList = [] self.Binaries= [] self.Sources = [] -self.LibraryClasses = OrderedDict() +self.LibraryClasses = collections.OrderedDict() self.Libraries = [] self.Protocols = [] self.Ppis= [] self.Guids = [] self.Includes= [] -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Remove the redundant if statement
after analysis the BuildOptionValue function, we found the if statement IsFieldValueAnArray is redundant because ValueExpressionEx will handle it. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Common/Expression.py | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Source/Python/Common/Expression.py index ccc7368..0091e47 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -15,11 +15,11 @@ from __future__ import print_function from __future__ import absolute_import from Common.GlobalData import * from CommonDataClass.Exceptions import BadExpression from CommonDataClass.Exceptions import WrnExpression -from .Misc import GuidStringToGuidStructureString, ParseFieldValue, IsFieldValueAnArray +from .Misc import GuidStringToGuidStructureString, ParseFieldValue import Common.EdkLogger as EdkLogger import copy from Common.DataType import * import sys @@ -136,15 +136,15 @@ def BuildOptionValue(PcdValue, GuidDict): InputValue = PcdValue elif PcdValue.startswith('L'): InputValue = 'L"' + PcdValue[1:] + '"' else: InputValue = PcdValue -if IsFieldValueAnArray(InputValue): -try: -PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True) -except: -pass +try: +PcdValue = ValueExpressionEx(InputValue, TAB_VOID, GuidDict)(True) +except: +pass + return PcdValue ## ReplaceExprMacro # def ReplaceExprMacro(String, Macros, ExceptionList = None): -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Update the rule to remove .lib before link it for GCC
We met a case on GCC toolchain for increment build. the case is user build Helloworld first, then rename the source file Helloworld.c to Helloworld_new.c and also update the file name to Helloworld_new.c in .inf file's [sources] section. finally, he rebuild it again. It cause build failure due to multiple definition of `UefiMain' because in the .lib file it both have Helloworld.obj and Helloworld_new.obj. current we use the option 'cr' to create the .lib file while the 'r' cmd means replace existing or insert new files into the archive. so in this patch before we create the .lib file, we delete it first. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Conf/build_rule.template | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/BaseTools/Conf/build_rule.template b/BaseTools/Conf/build_rule.template index b2667c2..ed54a55 100755 --- a/BaseTools/Conf/build_rule.template +++ b/BaseTools/Conf/build_rule.template @@ -1,7 +1,7 @@ # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved. +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved. # Portions copyright (c) 2008 - 2010, Apple Inc. All rights reserved. # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -267,10 +267,11 @@ "$(SLINK)" $(SLINK_FLAGS) /OUT:${dst} @$(OBJECT_FILES_LIST) +$(RM) ${dst} "$(SLINK)" cr ${dst} $(SLINK_FLAGS) @$(OBJECT_FILES_LIST) "$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/Ecc: Fix import issues
From: hchen30 1. Complete the full path for import statement. Use "EccMain" to replace "Ecc" for the absolute path support. 2. Fix some issues on configuration file. 3. Fix an issue of RaiseError not working in EdkLogger. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/BinWrappers/PosixLike/Ecc| 2 +- BaseTools/BinWrappers/WindowsLike/Ecc.bat | 2 +- BaseTools/Source/Python/Common/EdkLogger.py| 3 ++- BaseTools/Source/Python/Ecc/CParser.py | 4 ++-- BaseTools/Source/Python/Ecc/Check.py | 8 .../Source/Python/Ecc/CodeFragmentCollector.py | 12 +-- BaseTools/Source/Python/Ecc/Configuration.py | 2 ++ BaseTools/Source/Python/Ecc/Database.py| 6 +++--- BaseTools/Source/Python/Ecc/{Ecc.py => EccMain.py} | 24 +++--- BaseTools/Source/Python/Ecc/Exception.py | 2 +- BaseTools/Source/Python/Ecc/FileProfile.py | 2 +- BaseTools/Source/Python/Ecc/MetaDataParser.py | 4 ++-- .../Python/Ecc/MetaFileWorkspace/MetaFileParser.py | 6 +++--- .../Python/Ecc/MetaFileWorkspace/MetaFileTable.py | 6 +++--- BaseTools/Source/Python/Ecc/c.py | 12 +-- BaseTools/Source/Python/Ecc/config.ini | 4 ++-- BaseTools/Source/Python/Table/TableDataModel.py| 2 +- BaseTools/Source/Python/Table/TableDec.py | 2 +- BaseTools/Source/Python/Table/TableDsc.py | 2 +- BaseTools/Source/Python/Table/TableEotReport.py| 2 +- BaseTools/Source/Python/Table/TableFdf.py | 2 +- BaseTools/Source/Python/Table/TableFile.py | 2 +- BaseTools/Source/Python/Table/TableFunction.py | 2 +- BaseTools/Source/Python/Table/TableIdentifier.py | 2 +- BaseTools/Source/Python/Table/TableInf.py | 2 +- BaseTools/Source/Python/Table/TablePcd.py | 2 +- BaseTools/Source/Python/Table/TableQuery.py| 2 +- BaseTools/Source/Python/Table/TableReport.py | 6 +++--- 28 files changed, 65 insertions(+), 62 deletions(-) rename BaseTools/Source/Python/Ecc/{Ecc.py => EccMain.py} (95%) diff --git a/BaseTools/BinWrappers/PosixLike/Ecc b/BaseTools/BinWrappers/PosixLike/Ecc index bca1bae96a..1142964028 100755 --- a/BaseTools/BinWrappers/PosixLike/Ecc +++ b/BaseTools/BinWrappers/PosixLike/Ecc @@ -11,4 +11,4 @@ dir=$(dirname "$full_cmd") cmd=${full_cmd##*/} export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" -exec "${python_exe:-python}" -m $cmd.$cmd "$@" +exec "${python_exe:-python}" -m $cmd.EccMain "$@" diff --git a/BaseTools/BinWrappers/WindowsLike/Ecc.bat b/BaseTools/BinWrappers/WindowsLike/Ecc.bat index 98095cfbd4..8705e7541e 100644 --- a/BaseTools/BinWrappers/WindowsLike/Ecc.bat +++ b/BaseTools/BinWrappers/WindowsLike/Ecc.bat @@ -1,4 +1,4 @@ @setlocal @set ToolName=%~n0% @set PYTHONPATH=%PYTHONPATH%;%BASE_TOOLS_PATH%\Source\Python -@%PYTHON_HOME%\python.exe -m %ToolName%.%ToolName% %* +@%PYTHON_HOME%\python.exe -m %ToolName%.EccMain %* diff --git a/BaseTools/Source/Python/Common/EdkLogger.py b/BaseTools/Source/Python/Common/EdkLogger.py index 19749066ec..80697bf09b 100644 --- a/BaseTools/Source/Python/Common/EdkLogger.py +++ b/BaseTools/Source/Python/Common/EdkLogger.py @@ -1,7 +1,7 @@ ## @file # This file implements the log mechanism for Python tools. # -# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved. +# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved. # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at @@ -198,6 +198,7 @@ def error(ToolName, ErrorCode, Message=None, File=None, Line=None, ExtraData=Non LogText = _ErrorMessageTemplateWithoutFile % TemplateDict _ErrorLogger.log(ERROR, LogText) +RaiseError = IsRaiseError if RaiseError: raise FatalError(ErrorCode) diff --git a/BaseTools/Source/Python/Ecc/CParser.py b/BaseTools/Source/Python/Ecc/CParser.py index 0b74b53ae7..a3ab8e7bf4 100644 --- a/BaseTools/Source/Python/Ecc/CParser.py +++ b/BaseTools/Source/Python/Ecc/CParser.py @@ -24,8 +24,8 @@ from antlr3.compat import set, frozenset # ## -from . import CodeFragment -from . import FileProfile +from Ecc import CodeFragment +from Ecc import FileProfile diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 6803afdfdd..fc86ad96f2 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -15,10 +15,10 @@ import Common.LongFilePathOs as os import re from CommonDataClass.DataClass import * import Common.DataType as DT -from .EccToolError import * -from .MetaDataParser import ParseHeaderCommentSection -from . import EccGlobalData -from . import c +from Ecc.EccToolError import * +from
[edk2] [Patch] BaseTools: Add check for VOID* PCD Max Size
Per spec VOID* PCD max size should be a UINT16 value. so this patch add the value check whether it is in range 0x0 .. 0x. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/Workspace/DscBuildData.py | 21 + 1 file changed, 21 insertions(+) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/Source/Python/Workspace/DscBuildData.py index e8b36a3..c7f07f4 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1534,10 +1534,17 @@ class DscBuildData(PlatformBuildClassObject): for PcdCName, TokenSpaceGuid, SkuName, Dummy4 in PcdSet: Setting = PcdDict[self._Arch, PcdCName, TokenSpaceGuid, SkuName] if Setting is None: continue PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4) +if MaxDatumSize: +if int(MaxDatumSize, 0) > 0x: +EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0x (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) +if int(MaxDatumSize, 0) < 0: +EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) if (PcdCName, TokenSpaceGuid) in PcdValueDict: PcdValueDict[PcdCName, TokenSpaceGuid][SkuName] = (PcdValue, DatumType, MaxDatumSize) else: PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, DatumType, MaxDatumSize)} @@ -2379,10 +2386,17 @@ class DscBuildData(PlatformBuildClassObject): Setting = PcdDict[self._Arch, SkuName, PcdCName, TokenSpaceGuid] if Setting is None: continue PcdValue, DatumType, MaxDatumSize = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4) +if MaxDatumSize: +if int(MaxDatumSize, 0) > 0x: +EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0x (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) +if int(MaxDatumSize, 0) < 0: +EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', '', PcdValue) if (PcdCName, TokenSpaceGuid) in Pcds: pcdObject = Pcds[PcdCName, TokenSpaceGuid] pcdObject.SkuInfoList[SkuName] = SkuInfo if MaxDatumSize.strip(): @@ -2712,10 +2726,17 @@ class DscBuildData(PlatformBuildClassObject): # For the Integer & Boolean type, the optional data can only be InitialValue. # At this point, we put all the data into the PcdClssObject for we don't know the PCD's datumtype # until the DEC parser has been called. # VpdOffset, MaxDatumSize, InitialValue = self._ValidatePcd(PcdCName, TokenSpaceGuid, Setting, Type, Dummy4) +if MaxDatumSize: +if int(MaxDatumSize, 0) > 0x: +EdkLogger.error('build', FORMAT_INVALID, "The size value must not exceed the maximum value of 0x (UINT16) for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) +if int(MaxDatumSize, 0) < 0: +EdkLogger.error('build', FORMAT_INVALID, "The size value can't be set to negative value for %s." % ".".join((TokenSpaceGuid, PcdCName)), +File=self.MetaFile, Line=Dummy4) SkuInfo = SkuInfoClass(SkuName, self.SkuIds[SkuName][0], '', '', '', '', VpdOffset, InitialValue) if (PcdCName, TokenSpaceGuid) in Pcds: pcdObject = Pcds[PcdCName, TokenSpaceGuid] pcdObject.SkuInfoList[SkuName] = SkuInfo if MaxDatumSize.strip(): -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] DSC Spec: limit the VOID* PCD max size to UINT16
current the max size of VOID* PCD in the spec is a number that doesn't no limitation, now this patch update to limit the max size to UINT16, besides, also update some typo to make sure the format in chapter 2 and chapter 3 are align. Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 2_dsc_overview/29_pcd_sections.md| 6 +++--- 3_edk_ii_dsc_file_format/310_pcd_sections.md | 8 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/2_dsc_overview/29_pcd_sections.md b/2_dsc_overview/29_pcd_sections.md index 6547656..b33026c 100644 --- a/2_dsc_overview/29_pcd_sections.md +++ b/2_dsc_overview/29_pcd_sections.md @@ -1,9 +1,9 @@
[edk2] [Patch] Build Spec: Add rules for structure pcd display in the report
Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 13_build_reports/136_global_pcd_section.md | 32 +- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/13_build_reports/136_global_pcd_section.md b/13_build_reports/136_global_pcd_section.md index 64bda35..1a072b3 100644 --- a/13_build_reports/136_global_pcd_section.md +++ b/13_build_reports/136_global_pcd_section.md @@ -142,44 +142,58 @@ These lines are formatted as: ** **Note:** Global PCD section is present when **PCD** is specified in **-Y** option. ** - 13.6.2.4 Field value for Structure PCD -If the Pcd is a Structure Pcd, every field value that user specified in DSC/DEC -file and build command will print out. The field value is from DSC/DEC file or -build command, not from the final structure byte array, and the field order is -same as it in DSC/DEC file. when the field value is from build command, tool will -additional print a *B Flag. + 13.6.2.4 Rules for Structure PCD +If the Pcd is a Structure Pcd, it display in the report file would have two parts. +One is the final Pcd value and its field value, the field value is from FDF file, +DSC file PCD Section or build option, not from the final structure byte array, +and the field order is sorted by the field name. When the field value from DSC file +PCD Section, it will not have additional *P Flag, when the field value from FDF file, +it will have additional *F Flag before the field name, when the field value from +build option, it will have additional *B Flag before the field name. The other part +is the DEC default value and its field value, this part is optional. The field value +in this part is from DEC file, and the field order is sorted by the field name. + +** +**Note:** When the structure Pcd have some value from build option, no matter whether +the value is same with FDF or DSC file or DEC file, there will display a *B Flag before +the PCD name. When the structure Pcd have some value from FDF file, no matter whether +the value is same with DSC file or DEC file, there will display a *F Flag before the +PCD name. When the structure Pcd value have some value from DSC file PCD section, no +matter whether the value is same with DEC file, there will display a *P Flag before +the PCD name. +** Example ``` gEfiMdePkgTokenSpaceGuid *B TestDynamicExHii : DEXHII(TEST) (SKU1) (STANDARD) = { 0xff,0x01,0x00,0x2e,0xf6,0x08,0x6f,0x19,0x5c,0x8e,0x49,0x91,0x57,0x00,0x00,0x00, 0x00,0x64,0x00,0x00,0x00} .A = 0x1 - *B .C = 0x0 .Array = {0x2e,0xf6,0x08,0x6f,0x19,0x5c,0x8e,0x49,0x91,0x57} + *B .C = 0x0 .D = 0x64 : DEXHII(TEST) (SKU1) (Manufacturing) = { 0xff,0x02,0x00,0x2e,0xf6,0x08,0x6f,0x20,0x5c,0x8e,0x49,0x91,0x57,0x00,0x00,0x00, 0x00,0x68,0x00,0x00,0x00} .A = 0x2 - *B .C = 0x0 .Array = {0x2e,0xf6,0x08,0x6f,0x20,0x5c,0x8e,0x49,0x91,0x57} + *B .C = 0x0 .D = 0x68 DEC DEFAULT = {0xFF,0xFF} .A = 0xF .C = 0xF *P TestFix: FIXED (TEST) = { 0xff,0x02,0x00,0x2e,0xf6,0x08,0x6f,0x19,0x5c,0x8e,0x49,0x91,0x57,0x00,0x00,0x00, 0x00,0x64,0x00,0x00,0x00} .A = 0x2 - .C = 0x0 .Array = {0x2e,0xf6,0x08,0x6f,0x19,0x5c,0x8e,0x49,0x91,0x57} + .C = 0x0 .D = 0x64 DEC DEFAULT = {0xFF,0xFF} .A = 0xF .C = 0xF ``` -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Use pickle to replace cPickle
From: Yunhua Feng Use pickle to replace cPickle because of python3 removed cPickle Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Common/Misc.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index fd948c727a..74a5f0bca5 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -19,11 +19,11 @@ import Common.LongFilePathOs as os import sys import string import threading import time import re -import cPickle +import pickle import array import shutil from struct import pack from UserDict import IterableUserDict from UserList import UserList @@ -497,11 +497,11 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True): # def DataDump(Data, File): Fd = None try: Fd = open(File, 'wb') -cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL) +pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL) except: EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, RaiseError=False) finally: if Fd is not None: Fd.close() @@ -516,11 +516,11 @@ def DataDump(Data, File): def DataRestore(File): Data = None Fd = None try: Fd = open(File, 'rb') -Data = cPickle.load(Fd) +Data = pickle.load(Fd) except Exception as e: EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e))) Data = None finally: if Fd is not None: -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: remove unused import thread
From: Yunhua Feng remove unused import thread Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Common/Misc.py | 1 - 1 file changed, 1 deletion(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 79d1ff28f5..fd948c727a 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -16,11 +16,10 @@ # from __future__ import absolute_import import Common.LongFilePathOs as os import sys import string -import thread import threading import time import re import cPickle import array -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver
From: Yunhua Feng In DSC, we can define the driver with the different FILE GUID. So, this driver name and its FILE GUID should also be listed in Build output Guid.xref. But now, Guid.xref still lists the driver MODULE_GUID. The case in Platform.dsc: MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf { FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2 PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf } Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/GenFds/GenFds.py | 11 ++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index a7c1e6c853..156aae1d0e 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -603,19 +603,28 @@ class GenFds : GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref") GuidXRefFile = BytesIO('') GuidDict = {} ModuleList = [] FileGuidList = [] +GuidPattern = re.compile("\s*([0-9a-fA-F]){8}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){4}-" + "([0-9a-fA-F]){12}\s*") for Arch in ArchList: PlatformDataBase = BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] for ModuleFile in PlatformDataBase.Modules: Module = BuildDb.BuildObject[ModuleFile, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag] if Module in ModuleList: continue else: ModuleList.append(Module) -GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName)) +GuidMatch = GuidPattern.match(ModuleFile.BaseName) +if GuidMatch is not None: +GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseName, Module.BaseName)) +else: +GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName)) for key, item in Module.Protocols.items(): GuidDict[key] = item for key, item in Module.Guids.items(): GuidDict[key] = item for key, item in Module.Ppis.items(): -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Update build report for StructurePcd value
From: Yunhua Feng Update build report to display the structure Pcd value that from FDF file. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/build/BuildReport.py | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 27680019dc..d973db5c77 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -966,11 +966,10 @@ class PcdReport(object): Field = '' for (CName, Guid, Field) in self.FdfPcdSet: if CName == PcdTokenCName and Guid == Key: DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)] break -DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue) if DscDefaultValue != DscDefaultValBak: try: DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True) except BadExpression as DscDefaultValue: EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) @@ -1082,12 +1081,17 @@ class PcdReport(object): OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) DscOverride = self.ParseStruct(OverrideFieldStruct) if DscOverride: break if DscOverride: +DscDefaultValue = True DscMatch = True DecMatch = False +else: +DscDefaultValue = True +DscMatch = True +DecMatch = False # # Report PCD item according to their override relationship # if DecMatch: @@ -1344,20 +1348,26 @@ class PcdReport(object): for Key, Values in OverrideStruct.items(): if Values[1] and Values[1].endswith('.dsc'): OverrideFieldStruct[Key] = Values if Pcd.PcdFieldValueFromFdf: for Key, Values in Pcd.PcdFieldValueFromFdf.items(): +if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]: +continue OverrideFieldStruct[Key] = Values if Pcd.PcdFieldValueFromComm: for Key, Values in Pcd.PcdFieldValueFromComm.items(): +if Key in OverrideFieldStruct and Values[0] == OverrideFieldStruct[Key][0]: +continue OverrideFieldStruct[Key] = Values return OverrideFieldStruct def PrintStructureInfo(self, File, Struct): -for Key, Value in Struct.items(): +for Key, Value in sorted(Struct.items(), key=lambda x: x[0]): if Value[1] and 'build command options' in Value[1]: FileWrite(File, '*B %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0])) +elif Value[1] and Value[1].endswith('.fdf'): +FileWrite(File, '*F %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0])) else: FileWrite(File, '%-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0])) def StrtoHex(self, value): try: -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Fix build crash when fdf is empty file
From: Yunhua Feng Fix build crash when fdf is empty file Fix https://bugzilla.tianocore.org/show_bug.cgi?id=912 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/GenFds/FdfParser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 4be790a819..ae6b10f1e3 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -421,10 +421,12 @@ class FdfParser: def __CurrentLine(self): return self.Profile.FileLinesList[self.CurrentLineNumber - 1] def __StringToList(self): self.Profile.FileLinesList = [list(s) for s in self.Profile.FileLinesList] +if not self.Profile.FileLinesList: +EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The file is empty!', File=self.FileName) self.Profile.FileLinesList[-1].append(' ') def __ReplaceFragment(self, StartPos, EndPos, Value = ' '): if StartPos[0] == EndPos[0]: Offset = StartPos[1] -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect
From: Yunhua Feng hex number 0x00010019, the major number is 0001, the minor number is 0019. the decimal number 1.25, the major number is 1, and the minor number is 25 Fix https://bugzilla.tianocore.org/show_bug.cgi?id=921 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index fbfc182c8b..250cbf79a9 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -374,13 +374,16 @@ class MetaFileParser(object): if Name == 'INF_VERSION': if hexVersionPattern.match(Value): self._Version = int(Value, 0) elif decVersionPattern.match(Value): ValueList = Value.split('.') -Major = '%04o' % int(ValueList[0], 0) -Minor = '%04o' % int(ValueList[1], 0) -self._Version = int('0x' + Major + Minor, 0) +Major = int(ValueList[0], 0) +Minor = int(ValueList[1], 0) +if Major > 0x or Minor > 0x: +EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", +ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) +self._Version = int('0x' + '{0:04x}{1:04x}'.format(Major, Minor), 0) else: EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number", ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1) if isinstance(self, InfParser) and self._Version < 0x00010005: -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix bug about *M value not display decimal and hexadecimal
From: Yunhua Feng V2: Add the check for Pcd DatumType report format like as below: *M Shell.inf = 0xFF (255) Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/build/BuildReport.py | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 176a390..dd5d1c0 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1117,11 +1117,17 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, '{')) for Array in ArrayList: FileWrite(File, Array) else: -FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, ModuleDefault.strip())) +Value = ModuleDefault.strip() +if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES: +if Value.startswith(('0x', '0X')): +Value = '{} ({:d})'.format(Value, int(Value, 0)) +else: +Value = "0x{:X} ({})".format(int(Value, 0), Value) +FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, Value)) if ModulePcdSet is None: FileWrite(File, gSectionEnd) else: if not ReportSubType and ModulePcdSet: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix bug about *M value not display decimal and hexadecimal
From: Yunhua Feng report format like as below: *M Shell.inf = 0xFF (255) Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/build/BuildReport.py | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 176a390..178d340 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -1117,11 +1117,16 @@ class PcdReport(object): if IsByteArray: FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, '{')) for Array in ArrayList: FileWrite(File, Array) else: -FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, ModuleDefault.strip())) +Value = ModuleDefault.strip() +if Value.startswith(('0x', '0X')): +Value = '{} ({:d})'.format(Value, int(Value, 0)) +else: +Value = "0x{:X} ({})".format(int(Value, 0), Value) +FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 15, ModulePath, Value)) if ModulePcdSet is None: FileWrite(File, gSectionEnd) else: if not ReportSubType and ModulePcdSet: -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools: Fix build report for *P and *M flag incorrectly
From: Yunhua Feng Flag *M for INF defined value and DSC components value Flag *P only for platform defined value Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/build/BuildReport.py | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 273e7d41b8..1270070327 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -956,10 +956,15 @@ class PcdReport(object): # Get PCD default value and their override relationship # DecDefaultValue = self.DecPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType)) DscDefaultValue = self.DscPcdDefault.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName)) DscDefaultValBak = DscDefaultValue +Field = '' +for (CName, Guid, Field) in self.FdfPcdSet: +if CName == PcdTokenCName and Guid == Key: +DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)] +break DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), DscDefaultValue) if DscDefaultValue != DscDefaultValBak: try: DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True) except BadExpression as DscDefaultValue: @@ -968,17 +973,18 @@ class PcdReport(object): InfDefaultValue = None PcdValue = DecDefaultValue if DscDefaultValue: PcdValue = DscDefaultValue +Pcd.DefaultValue = PcdValue if ModulePcdSet is not None: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet: continue -InfDefault, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] +InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] Pcd.DefaultValue = PcdValue -if InfDefault == "": -InfDefault = None +if InfDefaultValue == "": +InfDefaultValue = None BuildOptionMatch = False if GlobalData.BuildOptionPcd: for pcd in GlobalData.BuildOptionPcd: if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (pcd[0], pcd[1]): @@ -1077,17 +1083,19 @@ class PcdReport(object): DecMatch = False # # Report PCD item according to their override relationship # -if DecMatch and InfMatch: +if DecMatch: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, ' ') +elif InfDefaultValue and InfMatch: +self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M') elif BuildOptionMatch: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*B') else: -if DscMatch: -if (Pcd.TokenCName, Key) in self.FdfPcdSet: +if DscDefaultValue and DscMatch: +if (Pcd.TokenCName, Key, Field) in self.FdfPcdSet: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*F') else: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*P') else: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M') -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/Ecc: Add some new checkpoints
From: hchen30 1. Add a checkpoint to check NO TABs. 2. Add a checkpoint to check line ending with CRLF. 3. Add a checkpoint to check no trailing spaces. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hess Chen --- BaseTools/Source/Python/Ecc/Check.py | 54 BaseTools/Source/Python/Ecc/Configuration.py | 4 +++ BaseTools/Source/Python/Ecc/EccToolError.py | 8 +++-- BaseTools/Source/Python/Ecc/config.ini | 4 +++ 4 files changed, 68 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python/Ecc/Check.py index 0b81013d77..6803afdfdd 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -188,6 +188,60 @@ class Check(object): def GeneralCheck(self): self.GeneralCheckNonAcsii() self.UniCheck() +self.GeneralCheckNoTab() +self.GeneralCheckLineEnding() +self.GeneralCheckTrailingWhiteSpaceLine() + +# Check whether NO Tab is used, replaced with spaces +def GeneralCheckNoTab(self): +if EccGlobalData.gConfig.GeneralCheckNoTab == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': +EdkLogger.quiet("Checking No TAB used in file ...") +SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')""" +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList: +op = open(Record[1]).readlines() +IndexOfLine = 0 +for Line in op: +IndexOfLine += 1 +IndexOfChar = 0 +for Char in Line: +IndexOfChar += 1 +if Char == '\t': +OtherMsg = "File %s has TAB char at line %s column %s" % (Record[1], IndexOfLine, IndexOfChar) + EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_NO_TAB, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0]) + +# Check Only use CRLF (Carriage Return Line Feed) line endings. +def GeneralCheckLineEnding(self): +if EccGlobalData.gConfig.GeneralCheckLineEnding == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': +EdkLogger.quiet("Checking line ending in file ...") +SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')""" +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList: +op = open(Record[1], 'rb').readlines() +IndexOfLine = 0 +for Line in op: +IndexOfLine += 1 +if not Line.endswith('\r\n'): +OtherMsg = "File %s has invalid line ending at line %s" % (Record[1], IndexOfLine) + EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_INVALID_LINE_ENDING, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0]) + +# Check if there is no trailing white space in one line. +def GeneralCheckTrailingWhiteSpaceLine(self): +if EccGlobalData.gConfig.GeneralCheckTrailingWhiteSpaceLine == '1' or EccGlobalData.gConfig.GeneralCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': +EdkLogger.quiet("Checking trailing white space line in file ...") +SqlCommand = """select ID, FullPath, ExtName from File where ExtName in ('.dec', '.inf', '.dsc', 'c', 'h')""" +RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand) +for Record in RecordSet: +if Record[2].upper() not in EccGlobalData.gConfig.BinaryExtList: +op = open(Record[1], 'rb').readlines() +IndexOfLine = 0 +for Line in op: +IndexOfLine += 1 +if Line.replace('\r', '').replace('\n', '').endswith(' '): +OtherMsg = "File %s has trailing white spaces at line %s" % (Record[1], IndexOfLine) + EccGlobalData.gDb.TblReport.Insert(ERROR_GENERAL_CHECK_TRAILING_WHITE_SPACE_LINE, OtherMsg=OtherMsg, BelongsToTable='File', BelongsToItem=Record[0]) # Check whether file has non ACSII char def GeneralCheckNonAcsii(self): diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Source/Python/Ecc/Configuration.py index 29a1220761..f58adbf736 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@
[edk2] [Patch] BaseTools: Correct _PCD_PATCHABLE_TokenName_SIZE's value
current if user use PatchPcdSetPtr in library, it will report the _PCD_PATCHABLE_TokenName_SIZE is not defined. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/GenC.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index 3b39649..f741f1c 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1291,11 +1291,10 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd): AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPcdSet%sS(%s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName)) else: AutoGenH.Append('#define %s(Value) LibPcdSet%s(%s, (Value))\n' % (SetModeName, DatumSizeLib, PcdTokenName)) AutoGenH.Append('#define %s(Value) LibPcdSet%sS(%s, (Value))\n' % (SetModeStatusName, DatumSizeLib, PcdTokenName)) if PcdItemType == TAB_PCDS_PATCHABLE_IN_MODULE: -GetModeMaxSizeName = '_PCD_GET_MODE_MAXSIZE' + '_' + TokenCName PcdVariableName = '_gPcd_' + gItemTypeStringDatabase[TAB_PCDS_PATCHABLE_IN_MODULE] + '_' + TokenCName if DatumType not in TAB_PCD_NUMERIC_TYPES: if DatumType == TAB_VOID and Array == '[]': DatumType = [TAB_UINT8, TAB_UINT16][Pcd.DefaultValue[0] == 'L'] else: @@ -1306,11 +1305,11 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd): AutoGenH.Append('#define %s %s_gPcd_BinaryPatch_%s\n' %(GetModeName, Type, TokenCName)) PcdDataSize = Pcd.GetPcdSize() if Pcd.DatumType not in TAB_PCD_NUMERIC_TYPES: AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSize((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable)) AutoGenH.Append('#define %s(SizeOfBuffer, Buffer) LibPatchPcdSetPtrAndSizeS((VOID *)_gPcd_BinaryPatch_%s, &%s, %s, (SizeOfBuffer), (Buffer))\n' % (SetModeStatusName, TokenCName, PatchPcdSizeVariableName, PatchPcdMaxSizeVariable)) -AutoGenH.Append('#define %s %s\n' % (GetModeMaxSizeName, PatchPcdMaxSizeVariable)) +AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PatchPcdMaxSizeVariable)) AutoGenH.Append('extern const UINTN %s; \n' % PatchPcdMaxSizeVariable) else: AutoGenH.Append('#define %s(Value) (%s = (Value))\n' % (SetModeName, PcdVariableName)) AutoGenH.Append('#define %s(Value) ((%s = (Value)), RETURN_SUCCESS)\n' % (SetModeStatusName, PcdVariableName)) AutoGenH.Append('#define %s %s\n' % (PatchPcdSizeTokenName, PcdDataSize)) -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V3] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
From: Yunhua Feng V3: Add some invalid type and datum check V2: limit the PCD used in the [Depex] section should be used in the module The PCD item used in INF [Depex] section must be defined as FixedAtBuild type and VOID* datum type, and the size of the PCD must be 16 bytes. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=443 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py| 32 +-- BaseTools/Source/Python/AutoGen/GenDepex.py | 6 + BaseTools/Source/Python/Workspace/InfBuildData.py | 20 ++ BaseTools/Source/Python/build/BuildReport.py | 7 - 4 files changed, 57 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index c5ab334..9bbf6e1 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2750,10 +2750,14 @@ class ModuleAutoGen(AutoGen): ## Store the FixedAtBuild Pcds # self._FixedAtBuildPcds = [] self.ConstPcd = {} +##Store the VOID* type FixedAtBuild Pcds +# +self._FixedPcdVoidTypeDict = {} + def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) # Get FixedAtBuild Pcds of this Module def _GetFixedAtBuildPcds(self): @@ -2765,10 +2769,19 @@ class ModuleAutoGen(AutoGen): if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) return self._FixedAtBuildPcds +def _GetFixedAtBuildVoidTypePcds(self): +if self._FixedPcdVoidTypeDict: +return self._FixedPcdVoidTypeDict +for Pcd in self.ModulePcdList: +if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID: +if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict: + self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue +return self._FixedPcdVoidTypeDict + def _GetUniqueBaseName(self): BaseName = self.Name for Module in self.PlatformInfo.ModuleAutoGenList: if Module.MetaFile == self.MetaFile: continue @@ -3034,11 +3047,11 @@ class ModuleAutoGen(AutoGen): self._DepexDict = {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: return self._DepexDict self._DepexDict[self.ModuleType] = [] - +self._GetFixedAtBuildVoidTypePcds() for ModuleType in self._DepexDict: DepexList = self._DepexDict[ModuleType] # # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # @@ -3046,11 +3059,25 @@ class ModuleAutoGen(AutoGen): Inherited = False for D in M.Depex[self.Arch, ModuleType]: if DepexList != []: DepexList.append('AND') DepexList.append('(') -DepexList.extend(D) +#replace D with value if D is FixedAtBuild PCD +NewList = [] +for item in D: +if '.' not in item: +NewList.append(item) +else: +if item not in self._FixedPcdVoidTypeDict: +EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) +else: +Value = self._FixedPcdVoidTypeDict[item] +if len(Value.split(',')) != 16: +EdkLogger.error("build", FORMAT_INVALID, +"{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type and 16 bytes in the module.".format(item)) +NewList.append(Value) +DepexList.extend(NewList) if DepexList[-1] == 'END': # no need of a END at this time DepexList.pop() DepexList.append(')') Inherited = True if Inherited: @@ -4418,10 +4445,11 @@ class ModuleAutoGen(AutoGen): BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildCommand= property(_GetBuildCommand) FixedAt
[edk2] [Patch] BaseTools: Remove the duplicate Pcd items
The case is the Pcd item both used in 1 module inf and 1 lib inf, and in the DSC component section, it override the Pcd value. In the module, the pcd value is the override value, but in the lib inf the pcd value is the value that in the DSC PCD section's value, then it cause the Pcd value is different in the module and lib. but actually we only need use the Pcd value in the module to decide whether it use the same value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 289309f..cf53c2b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1289,11 +1289,11 @@ class PlatformAutoGen(AutoGen): def CollectFixedAtBuildPcds(self): for LibAuto in self.LibraryAutoGenList: FixedAtBuildPcds = {} ShareFixedAtBuildPcdsSameValue = {} for Module in LibAuto._ReferenceModules: -for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds: +for Pcd in set(Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds): DefaultValue = Pcd.DefaultValue # Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib if Pcd in Module.LibraryPcdList: Index = Module.LibraryPcdList.index(Pcd) DefaultValue = Module.LibraryPcdList[Index].DefaultValue -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: ElfConvert Tool update VerboseMsg to same with the comment
Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=994 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/C/GenFw/Elf32Convert.c | 2 +- BaseTools/Source/C/GenFw/Elf64Convert.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c index af5ff93..3d7de6d 100644 --- a/BaseTools/Source/C/GenFw/Elf32Convert.c +++ b/BaseTools/Source/C/GenFw/Elf32Convert.c @@ -688,11 +688,11 @@ WriteSections32 ( default: // // Ignore for unkown section type. // -VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); +VerboseMsg ("%s unknown section type %x. We ignore this unknown section type.", mInImageName, (unsigned)Shdr->sh_type); break; } } } diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c index 15da89c..469979c 100644 --- a/BaseTools/Source/C/GenFw/Elf64Convert.c +++ b/BaseTools/Source/C/GenFw/Elf64Convert.c @@ -822,11 +822,11 @@ WriteSections64 ( default: // // Ignore for unkown section type. // -VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type); +VerboseMsg ("%s unknown section type %x. We ignore this unknown section type.", mInImageName, (unsigned)Shdr->sh_type); break; } } } -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix the bug that incorrect size info in the Lib autogen
The case is a PCD used in one library only, and in DSC component section the PCD value is override in one of module inf. Then it cause the bug the PCD size in the Lib autogen use the PCD value in the DSC PCD section, but not use the override value. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 6d76afd..3908697 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1291,16 +1291,21 @@ class PlatformAutoGen(AutoGen): for LibAuto in self.LibraryAutoGenList: FixedAtBuildPcds = {} ShareFixedAtBuildPcdsSameValue = {} for Module in LibAuto._ReferenceModules: for Pcd in Module.FixedAtBuildPcds + LibAuto.FixedAtBuildPcds: +DefaultValue = Pcd.DefaultValue +# Cover the case: DSC component override the Pcd value and the Pcd only used in one Lib +if Pcd in Module.LibraryPcdList: +Index = Module.LibraryPcdList.index(Pcd) +DefaultValue = Module.LibraryPcdList[Index].DefaultValue key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) if key not in FixedAtBuildPcds: ShareFixedAtBuildPcdsSameValue[key] = True -FixedAtBuildPcds[key] = Pcd.DefaultValue +FixedAtBuildPcds[key] = DefaultValue else: -if FixedAtBuildPcds[key] != Pcd.DefaultValue: +if FixedAtBuildPcds[key] != DefaultValue: ShareFixedAtBuildPcdsSameValue[key] = False for Pcd in LibAuto.FixedAtBuildPcds: key = ".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName)) if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in self.NonDynamicPcdDict: continue -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V2] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
From: Yunhua Feng V2: limit the PCD used in the [Depex] section should be used in the module The PCD item used in INF [Depex] section must be defined as FixedAtBuild type and VOID* datum type, and the size of the PCD must be 16 bytes. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=443 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/AutoGen/AutoGen.py| 31 --- BaseTools/Source/Python/AutoGen/GenDepex.py | 6 + BaseTools/Source/Python/Workspace/InfBuildData.py | 15 +++ BaseTools/Source/Python/build/BuildReport.py | 6 + 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 6d76afd..7d4539e 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2745,10 +2745,14 @@ class ModuleAutoGen(AutoGen): ## Store the FixedAtBuild Pcds # self._FixedAtBuildPcds = [] self.ConstPcd = {} +##Store the VOID* type FixedAtBuild Pcds +# +self._FixedPcdVoidTypeDict = {} + def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) # Get FixedAtBuild Pcds of this Module def _GetFixedAtBuildPcds(self): @@ -2758,11 +2762,20 @@ class ModuleAutoGen(AutoGen): if Pcd.Type != TAB_PCDS_FIXED_AT_BUILD: continue if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) -return self._FixedAtBuildPcds +return self._FixedAtBuildPcds + +def _GetFixedAtBuildVoidTypePcds(self): +if self._FixedPcdVoidTypeDict: +return self._FixedPcdVoidTypeDict +for Pcd in self.ModulePcdList: +if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID: +if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict: + self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue +return self._FixedPcdVoidTypeDict def _GetUniqueBaseName(self): BaseName = self.Name for Module in self.PlatformInfo.ModuleAutoGenList: if Module.MetaFile == self.MetaFile: @@ -3029,11 +3042,11 @@ class ModuleAutoGen(AutoGen): self._DepexDict = {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: return self._DepexDict self._DepexDict[self.ModuleType] = [] - +self._GetFixedAtBuildVoidTypePcds() for ModuleType in self._DepexDict: DepexList = self._DepexDict[ModuleType] # # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # @@ -3041,11 +3054,22 @@ class ModuleAutoGen(AutoGen): Inherited = False for D in M.Depex[self.Arch, ModuleType]: if DepexList != []: DepexList.append('AND') DepexList.append('(') -DepexList.extend(D) +#replace D with value if D is FixedAtBuild PCD +NewList = [] +for item in D: +if '.' not in item: +NewList.append(item) +else: +if item not in self._FixedPcdVoidTypeDict: +EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be used as FixedAtBuild type and VOID* datum type in the module.".format(item)) +else: +Value = self._FixedPcdVoidTypeDict[item] +NewList.append(Value) +DepexList.extend(NewList) if DepexList[-1] == 'END': # no need of a END at this time DepexList.pop() DepexList.append(')') Inherited = True if Inherited: @@ -4409,10 +4433,11 @@ class ModuleAutoGen(AutoGen): BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildCommand= property(_GetBuildCommand) FixedAtBuildPcds = property(_GetFixedAtBuildPcds) UniqueBaseName = property(_GetUniqueBaseName) +FixedVoidTypePcds = property(_GetFixedAtBuildVoidTypePcds) # This acts like the main() function for the script, unless it is 'import'ed into another script. if __name__
[edk2] [Patch] BaseTools: enable FixedAtBuild (VOID*) PCD use in the [DEPEX] section
From: Yunhua Feng The PCD item used in INF [Depex] section must be defined as FixedAtBuild type and VOID* datum type, and the size of the PCD must be 16 bytes. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=443 Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py| 31 --- BaseTools/Source/Python/AutoGen/GenDepex.py | 6 + BaseTools/Source/Python/Workspace/InfBuildData.py | 15 +++ BaseTools/Source/Python/build/BuildReport.py | 6 + 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 6d76afd..7d4539e 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -2745,10 +2745,14 @@ class ModuleAutoGen(AutoGen): ## Store the FixedAtBuild Pcds # self._FixedAtBuildPcds = [] self.ConstPcd = {} +##Store the VOID* type FixedAtBuild Pcds +# +self._FixedPcdVoidTypeDict = {} + def __repr__(self): return "%s [%s]" % (self.MetaFile, self.Arch) # Get FixedAtBuild Pcds of this Module def _GetFixedAtBuildPcds(self): @@ -2758,11 +2762,20 @@ class ModuleAutoGen(AutoGen): if Pcd.Type != TAB_PCDS_FIXED_AT_BUILD: continue if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) -return self._FixedAtBuildPcds +return self._FixedAtBuildPcds + +def _GetFixedAtBuildVoidTypePcds(self): +if self._FixedPcdVoidTypeDict: +return self._FixedPcdVoidTypeDict +for Pcd in self.ModulePcdList + self.LibraryPcdList: +if Pcd.Type == TAB_PCDS_FIXED_AT_BUILD and Pcd.DatumType == TAB_VOID: +if '{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName) not in self._FixedPcdVoidTypeDict: + self._FixedPcdVoidTypeDict['{}.{}'.format(Pcd.TokenSpaceGuidCName, Pcd.TokenCName)] = Pcd.DefaultValue +return self._FixedPcdVoidTypeDict def _GetUniqueBaseName(self): BaseName = self.Name for Module in self.PlatformInfo.ModuleAutoGenList: if Module.MetaFile == self.MetaFile: @@ -3029,11 +3042,11 @@ class ModuleAutoGen(AutoGen): self._DepexDict = {} if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in self.FileTypes: return self._DepexDict self._DepexDict[self.ModuleType] = [] - +self._GetFixedAtBuildVoidTypePcds() for ModuleType in self._DepexDict: DepexList = self._DepexDict[ModuleType] # # Append depex from dependent libraries, if not "BEFORE", "AFTER" expresion # @@ -3041,11 +3054,22 @@ class ModuleAutoGen(AutoGen): Inherited = False for D in M.Depex[self.Arch, ModuleType]: if DepexList != []: DepexList.append('AND') DepexList.append('(') -DepexList.extend(D) +#replace D with value if D is FixedAtBuild PCD +NewList = [] +for item in D: +if '.' not in item: +NewList.append(item) +else: +if item not in self._FixedPcdVoidTypeDict: +EdkLogger.error("build", FORMAT_INVALID, "{} used in [Depex] section should be FixedAtBuild type and VOID* datum type in the module or its dependent libraries.".format(item)) +else: +Value = self._FixedPcdVoidTypeDict[item] +NewList.append(Value) +DepexList.extend(NewList) if DepexList[-1] == 'END': # no need of a END at this time DepexList.pop() DepexList.append(')') Inherited = True if Inherited: @@ -4409,10 +4433,11 @@ class ModuleAutoGen(AutoGen): BuildOptionIncPathList = property(_GetBuildOptionIncPathList) BuildCommand= property(_GetBuildCommand) FixedAtBuildPcds = property(_GetFixedAtBuildPcds) UniqueBaseName = property(_GetUniqueBaseName) +FixedVoidTypePcds = property(_GetFixedAtBuildVoidTypePcds) # This acts like the main() function for the script, unless it is 'import'ed into another script. if __name__ == '__
[edk2] [Patch V2] BaseTools: Fix parsing multiple nest !include issue
From: Yunhua Feng Fix the bug !include file in Components subsection meet syntax error. Case example: DSC components: !include Test1.txt Test1.txt: TestPkg/TestDriver.inf { PcdToken.PcdTest1 | "A" !include Test2.txt } Test2.txt: !include Test3.txt Test3.txt: PcdToken.PcdTest2 | "B" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- .../Source/Python/Workspace/MetaFileParser.py | 28 ++ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 8c860d594b..75ca630806 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -942,11 +942,18 @@ class DscParser(MetaFileParser): # subsection header elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER # directive line elif Line[0] == '!': -self._DirectiveParser() +TokenList = GetSplitValueList(Line, ' ', 1) +if TokenList[0].upper() == "!INCLUDE": +for Arch, ModuleType, DefaultStore in self._Scope: +if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId: +self._Owner[-1] = OwnerId[Arch] +self._DirectiveParser() +else: +self._DirectiveParser() continue if Line[0] == TAB_OPTION_START and not self._InSubsection: EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the '{' before %s in Line %s" % (Line, Index+1), ExtraData=self.MetaFile) if self._InSubsection: @@ -963,11 +970,11 @@ class DscParser(MetaFileParser): # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 # for Arch, ModuleType, DefaultStore in self._Scope: Owner = self._Owner[-1] -if self._SubsectionType != MODEL_UNKNOWN: +if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId: Owner = OwnerId[Arch] self._LastItem = self._Store( self._ItemType, self._ValueList[0], self._ValueList[1], @@ -1188,10 +1195,11 @@ class DscParser(MetaFileParser): @ParseMacro def _ComponentParser(self): if self._CurrentLine[-1] == '{': self._ValueList[0] = self._CurrentLine[0:-1].strip() self._InSubsection = True +self._SubsectionType = MODEL_UNKNOWN else: self._ValueList[0] = self._CurrentLine ## [LibraryClasses] section @ParseMacro @@ -1560,28 +1568,18 @@ class DscParser(MetaFileParser): self.IncludedFiles.add (IncludedFile1) # set the parser status with current status Parser._SectionName = self._SectionName -if self._InSubsection: -Parser._SectionType = self._SubsectionType -else: -Parser._SectionType = self._SectionType +Parser._SubsectionType = self._SubsectionType +Parser._InSubsection = self._InSubsection +Parser._SectionType = self._SectionType Parser._Scope = self._Scope Parser._Enabled = self._Enabled # Parse the included file Parser.Start() -# update current status with sub-parser's status -self._SectionName = Parser._SectionName -if not self._InSubsection: -self._SectionType = Parser._SectionType -self._SubsectionType = Parser._SubsectionType -self._InSubsection = Parser._InSubsection - -self._Scope = Parser._Scope -self._Enabled = Parser._Enabled # Insert all records in the table for the included file into dsc file table Records = IncludedFileTable.GetAll() if Records: self._Content[self._ContentIndex:self._ContentIndex] = Records -- 2.12.2.windows.2 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch V2] FDF Spec: support varstore template generation with a [FV] section
Add format to support varstore template generation with a dedicated [FV] section. Code bug: https://bugzilla.tianocore.org/show_bug.cgi?id=932 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 3_edk_ii_fdf_file_format/36_[fv]_sections.md | 13 + README.md| 1 + 2 files changed, 14 insertions(+) diff --git a/3_edk_ii_fdf_file_format/36_[fv]_sections.md b/3_edk_ii_fdf_file_format/36_[fv]_sections.md index 9c77df9..7796c37 100644 --- a/3_edk_ii_fdf_file_format/36_[fv]_sections.md +++ b/3_edk_ii_fdf_file_format/36_[fv]_sections.md @@ -73,10 +73,14 @@ Conditional statements may be used anywhere within this section. ::= [] ::= [] [] [] [] +[] +[] +[] +[] [] [] [] [] [] @@ -109,10 +113,14 @@ Conditional statements may be used anywhere within this section. [ "READ_DISABLED_CAP" ] [ "READ_STATUS" ] [ "WEAK_ALIGNMENT" ] [ "ERASE_POLARITY" {"0"} {"1"} ] ::= "FileSystemGuid" + ::= "VariableSignatureGuid" + ::= "VariabeRegionSize" + ::= "FtwWorkingSpaceSize" + ::= "FtwSpareSpaceSize" ::= "FvNameGuid" ::= "FvUsedSizeEnable" ::= "FvNameString" ::= "APRIORI" "PEI" "{" @@ -279,10 +287,15 @@ Conditional statements may be used anywhere within this section. ::= {"before"} {"after"} ::= "SECTION" [] "SMM_DEPEX_EXP" "{" [] "}" ``` +** +**Note:** The `VariableSignatureGuid` and `VariabeRegionSize` must exist when +`FileSystemGuid` value is same as FFF12B8D-7696-4C8B-A9852747075B4F50. +** + Restrictions **_Filename_** For BINARY ONLY content (`UEFI_DRIVER` and `UEFI_APPLICATION` .efi files) the diff --git a/README.md b/README.md index 05b3b7a..cd489ee 100644 --- a/README.md +++ b/README.md @@ -212,5 +212,6 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. || Per PI 1.6 to extend FFS alignment to 16M | | || Per PI 1.6 to support FV extended header entry contain the used size of FV | | || Add !error statement section | | || clean up the and usage in spec | | || document WEAK_ALIGNMENT attribute | | +|| support varstore template generation with a [FV] section | | -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] FDF spec: document WEAK_ALIGNMENT attribute
WEAK_ALIGNMENT FV attribute is supported by GenFds, but is not documented in the FDF specification. Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=892 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 3_edk_ii_fdf_file_format/36_[fv]_sections.md | 1 + 1 file changed, 1 insertion(+) diff --git a/3_edk_ii_fdf_file_format/36_[fv]_sections.md b/3_edk_ii_fdf_file_format/36_[fv]_sections.md index 2f79d1c..9c77df9 100644 --- a/3_edk_ii_fdf_file_format/36_[fv]_sections.md +++ b/3_edk_ii_fdf_file_format/36_[fv]_sections.md @@ -106,10 +106,11 @@ Conditional statements may be used anywhere within this section. [ "READ_LOCK_CAP" ] [ "READ_LOCK_STATUS" ] [ "READ_ENABLED_CAP" ] [ "READ_DISABLED_CAP" ] [ "READ_STATUS" ] +[ "WEAK_ALIGNMENT" ] [ "ERASE_POLARITY" {"0"} {"1"} ] ::= "FileSystemGuid" ::= "FvNameGuid" ::= "FvUsedSizeEnable" ::= "FvNameString" -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] FDF Spec: support varstore template generation with a [FV] section
Add format to support varstore template generation with a dedicated [FV] section. Code bug: https://bugzilla.tianocore.org/show_bug.cgi?id=932 Cc: Liming Gao Cc: Michael Kinney Cc: Kevin W Shaw Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- 3_edk_ii_fdf_file_format/36_[fv]_sections.md | 15 +++ README.md| 1 + 2 files changed, 16 insertions(+) diff --git a/3_edk_ii_fdf_file_format/36_[fv]_sections.md b/3_edk_ii_fdf_file_format/36_[fv]_sections.md index 2f79d1c..cb3698d 100644 --- a/3_edk_ii_fdf_file_format/36_[fv]_sections.md +++ b/3_edk_ii_fdf_file_format/36_[fv]_sections.md @@ -73,10 +73,14 @@ Conditional statements may be used anywhere within this section. ::= [] ::= [] [] [] [] +[] +[] +[] +[] [] [] [] [] [] @@ -108,10 +112,14 @@ Conditional statements may be used anywhere within this section. [ "READ_ENABLED_CAP" ] [ "READ_DISABLED_CAP" ] [ "READ_STATUS" ] [ "ERASE_POLARITY" {"0"} {"1"} ] ::= "FileSystemGuid" + ::= "VariableSignatureGuid" + ::= "VariabeRegionSize" + ::= "FtwWorkingSpaceSize" + ::= "FtwSpareSpaceSize" ::= "FvNameGuid" ::= "FvUsedSizeEnable" ::= "FvNameString" ::= "APRIORI" "PEI" "{" @@ -278,10 +286,17 @@ Conditional statements may be used anywhere within this section. ::= {"before"} {"after"} ::= "SECTION" [] "SMM_DEPEX_EXP" "{" [] "}" ``` +** +**Note:** The `VariableSignatureGuid` and `VariabeRegionSize` must exist when +`FileSystemGuid` value is same as FFF12B8D-7696-4C8B-A9852747075B4F50. +The `VariableSignatureGuid`, `VariabeRegionSize` and `FtwWorkingSpaceSize` must +exist when `FileSystemGuid` value is same as 9e58292b-7c68-497d-a0ce6500fd9f1b95. +** + Restrictions **_Filename_** For BINARY ONLY content (`UEFI_DRIVER` and `UEFI_APPLICATION` .efi files) the diff --git a/README.md b/README.md index c2767fb..d5a31b1 100644 --- a/README.md +++ b/README.md @@ -211,5 +211,6 @@ Copyright (c) 2006-2017, Intel Corporation. All rights reserved. | 1.28 | Update version to 1.28 | March 2018| || Per PI 1.6 to extend FFS alignment to 16M | | || Per PI 1.6 to support FV extended header entry contain the used size of FV | | || Add !error statement section | | || clean up the and usage in spec | | +|| support varstore template generation with a [FV] section | | -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [PATCH] BaseTools/PackageDocumentTools: Correct INI parse condition check
From: "Chen, Pai-Ching" Change-Id: I147ad470d5840c6fee1086f629991f8a9f9d9056 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Chen, Pai-Ching --- .../Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py index bf1040d6ba..ea83327052 100644 --- a/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py +++ b/BaseTools/Scripts/PackageDocumentTools/plugins/EdkPlugins/basemodel/ini.py @@ -122,7 +122,7 @@ class BaseINIFile(object): continue m = section_re.match(templine) -if mis not None: # found a section +if m is not None: # found a section inGlobal = False # Finish the latest section first if len(sObjs) != 0: -- 2.16.2.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
[edk2] [Patch] BaseTools: Fix two drivers include the same file issue
From: Yunhua Feng Two drivers include the same PCD file, the PCD value in the first driver is correct, but it in the second driver is incorrect. DSC: [Components] Testpkg/Testdriver1.inf { !include Test.txt } Testpkg/Testdriver2.inf { !include Test.txt } Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- BaseTools/Source/Python/Workspace/MetaDataTable.py | 27 +- .../Source/Python/Workspace/MetaFileParser.py | 4 ++-- BaseTools/Source/Python/Workspace/MetaFileTable.py | 14 ++- 3 files changed, 31 insertions(+), 14 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaDataTable.py b/BaseTools/Source/Python/Workspace/MetaDataTable.py index e37a10c..bd751ea 100644 --- a/BaseTools/Source/Python/Workspace/MetaDataTable.py +++ b/BaseTools/Source/Python/Workspace/MetaDataTable.py @@ -166,11 +166,12 @@ class TableFile(Table): Name VARCHAR NOT NULL, ExtName VARCHAR, Path VARCHAR, FullPath VARCHAR NOT NULL, Model INTEGER DEFAULT 0, -TimeStamp SINGLE NOT NULL +TimeStamp SINGLE NOT NULL, +FromItem REAL NOT NULL ''' def __init__(self, Cursor): Table.__init__(self, Cursor, 'File') ## Insert table @@ -182,20 +183,21 @@ class TableFile(Table): # @param Path: Path of a File # @param FullPath: FullPath of a File # @param Model: Model of a File # @param TimeStamp: TimeStamp of a File # -def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp): +def Insert(self, Name, ExtName, Path, FullPath, Model, TimeStamp, FromItem=0): (Name, ExtName, Path, FullPath) = ConvertToSqlString((Name, ExtName, Path, FullPath)) return Table.Insert( self, Name, ExtName, Path, FullPath, Model, -TimeStamp +TimeStamp, +FromItem ) ## InsertFile # # Insert one file to table @@ -203,11 +205,21 @@ class TableFile(Table): # @param FileFullPath: The full path of the file # @param Model: The model of the file # # @retval FileID: The ID after record is inserted # -def InsertFile(self, File, Model): +def InsertFile(self, File, Model, FromItem=''): +if FromItem: +return self.Insert( +File.Name, +File.Ext, +File.Dir, +File.Path, +Model, +File.TimeStamp, +FromItem +) return self.Insert( File.Name, File.Ext, File.Dir, File.Path, @@ -219,12 +231,15 @@ class TableFile(Table): # # @param FilePathPath of file # # @retval ID ID value of given file in the table # -def GetFileId(self, File): -QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File)) +def GetFileId(self, File, FromItem=None): +if FromItem: +QueryScript = "select ID from %s where FullPath = '%s' and FromItem = %s" % (self.Table, str(File), str(FromItem)) +else: +QueryScript = "select ID from %s where FullPath = '%s'" % (self.Table, str(File)) RecordList = self.Exec(QueryScript) if len(RecordList) == 0: return None return RecordList[0][0] diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index f03b264..f3eb0c1 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -883,11 +883,11 @@ class DscParser(MetaFileParser): # @param Owner Owner ID (for sub-section parsing) # @param FromID from which the data comes (for !INCLUDE directive) # def __init__(self, FilePath, FileType, Arch, Table, Owner= -1, From= -1): # prevent re-initialization -if hasattr(self, "_Table"): +if hasattr(self, "_Table") and self._Table is Table: return MetaFileParser.__init__(self, FilePath, FileType, Arch, Table, Owner, From) self._Version = 0x00010005 # Only EDK2 dsc file is supported # to store conditional directive evaluation result self._DirectiveStack = [] @@ -1550,16 +1550,16 @@ class DscParser(MetaFileParser): EdkLogger.error('parser', ErrorCode, File=self._FileWithError, Line=self._LineIndex + 1, ExtraData=ErrorInfo1 + "\n" + ErrorInfo2) self._Fi
[edk2] [Patch] BaseTools: Fix parsing multiple nest !include issue
From: Yunhua Feng Case example: DSC components: !include Test1.txt Test1.txt: TestPkg/TestDriver.inf { PcdToken.PcdTest1 | "A" !include Test2.txt } Test2.txt: !include Test3.txt Test3.txt: PcdToken.PcdTest2 | "B" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- .../Source/Python/Workspace/MetaFileParser.py | 24 -- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py index 88c7bb3..f03b264 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -941,11 +941,14 @@ class DscParser(MetaFileParser): # subsection header elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END: self._SubsectionType = MODEL_META_DATA_SUBSECTION_HEADER # directive line elif Line[0] == '!': -self._DirectiveParser() +for Arch, ModuleType, DefaultStore in self._Scope: +if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId: +self._Owner[-1] = OwnerId[Arch] +self._DirectiveParser() continue if Line[0] == TAB_OPTION_START and not self._InSubsection: EdkLogger.error("Parser", FILE_READ_FAILURE, "Missing the '{' before %s in Line %s" % (Line, Index+1),ExtraData=self.MetaFile) if self._InSubsection: @@ -962,11 +965,11 @@ class DscParser(MetaFileParser): # Model, Value1, Value2, Value3, Arch, ModuleType, BelongsToItem=-1, BelongsToFile=-1, # LineBegin=-1, ColumnBegin=-1, LineEnd=-1, ColumnEnd=-1, Enabled=-1 # for Arch, ModuleType, DefaultStore in self._Scope: Owner = self._Owner[-1] -if self._SubsectionType != MODEL_UNKNOWN: +if self._SubsectionType != MODEL_UNKNOWN and Arch in OwnerId: Owner = OwnerId[Arch] self._LastItem = self._Store( self._ItemType, self._ValueList[0], self._ValueList[1], @@ -1187,10 +1190,11 @@ class DscParser(MetaFileParser): @ParseMacro def _ComponentParser(self): if self._CurrentLine[-1] == '{': self._ValueList[0] = self._CurrentLine[0:-1].strip() self._InSubsection = True +self._SubsectionType = MODEL_UNKNOWN else: self._ValueList[0] = self._CurrentLine ## [LibraryClasses] section @ParseMacro @@ -1559,28 +1563,18 @@ class DscParser(MetaFileParser): self.IncludedFiles.add (IncludedFile1) # set the parser status with current status Parser._SectionName = self._SectionName -if self._InSubsection: -Parser._SectionType = self._SubsectionType -else: -Parser._SectionType = self._SectionType +Parser._SubsectionType = self._SubsectionType +Parser._InSubsection = self._InSubsection +Parser._SectionType = self._SectionType Parser._Scope = self._Scope Parser._Enabled = self._Enabled # Parse the included file Parser.Start() -# update current status with sub-parser's status -self._SectionName = Parser._SectionName -if not self._InSubsection: -self._SectionType = Parser._SectionType -self._SubsectionType = Parser._SubsectionType -self._InSubsection = Parser._InSubsection - -self._Scope = Parser._Scope -self._Enabled = Parser._Enabled # Insert all records in the table for the included file into dsc file table Records = IncludedFileTable.GetAll() if Records: self._Content[self._ContentIndex:self._ContentIndex] = Records -- 2.6.1.windows.1 ___ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel