From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239522007746.2349503296136; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 95193226EA5A7; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 5E4202251212F for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:54 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:52 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811533" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:21 -0700 Message-Id: <2a976f16c253e6d5074f1715d98337e3e63fd5c3.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 01/27] BaseTools: Misc - refactor RegEx to minimize multiple compiling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/Misc.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 4f2bfd63cfc3..bc7d0c2d9d00 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -84,6 +84,7 @@ def _parseForXcode(lines, efifilepath, varnames): if status =3D=3D 1 and len(line) !=3D 0: for varname in varnames: if varname in line: + # cannot pregenerate this RegEx since it uses varname = from varnames. m =3D re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*%s)$' % = varname, line) if m is not None: ret.append((varname, m.group(1))) @@ -91,6 +92,8 @@ def _parseForXcode(lines, efifilepath, varnames): =20 def _parseForGCC(lines, efifilepath, varnames): """ Parse map file generated by GCC linker """ + valuePattern =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]= +)$') + pcdPattern =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') status =3D 0 sections =3D [] varoffset =3D [] @@ -109,7 +112,7 @@ def _parseForGCC(lines, efifilepath, varnames): =20 # status handler if status =3D=3D 3: - m =3D re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$',= line) + m =3D valuePattern.match(line) if m is not None: sections.append(m.groups(0)) for varname in varnames: @@ -122,7 +125,7 @@ def _parseForGCC(lines, efifilepath, varnames): else: Str =3D line[len(".data.%s" % varname):] if Str: - m =3D re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', = Str.strip()) + m =3D pcdPattern.match(Str.strip()) if m is not None: varoffset.append((varname, int(m.groups(0)[0],= 16) , int(sections[-1][1], 16), sections[-1][0])) =20 @@ -152,16 +155,18 @@ def _parseGeneral(lines, efifilepath, varnames): varoffset =3D [] secRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]?= +([.\w\$]+) +(\w+)', re.UNICODE) symRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+= ) +([\da-fA-F]+)', re.UNICODE) + startRe =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") + addressRe =3D re.compile("^Address[' ']+Publics by Value[' ']+Rva\+Bas= e") =20 for line in lines: line =3D line.strip() - if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line): + if startRe.match(line): status =3D 1 continue - if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line): + if addressRe.match(line): status =3D 2 continue - if re.match("^entry point at", line): + if line.startswith("entry point at"): status =3D 3 continue =20 if status =3D=3D 1 and len(line) !=3D 0: @@ -177,6 +182,7 @@ def _parseGeneral(lines, efifilepath, varnames): sec_no =3D int(sec_no, 16) sym_offset =3D int(sym_offset, 16) vir_addr =3D int(vir_addr, 16) + # cannot pregenerate this RegEx since it uses varname from= varnames. m2 =3D re.match('^[_]*(%s)' % varname, sym_name) if m2 is not None: # fond a binary pcd entry in map file --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239538956940.0411178641018; Fri, 20 Apr 2018 08:52:18 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 9C922226EA5C0; Fri, 20 Apr 2018 08:51:57 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CDFE022512131 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:52 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811535" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:22 -0700 Message-Id: <9ee84ed884976a5ee7d3c019ee28881fecdbece0.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 02/27] BaseTools: GenPatchPcdTable - refactor RegEx to minimize multiple compiling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 24 ++++++++= ++++-------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b= /BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py index dc2ceaf775d8..59748763a553 100644 --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py @@ -63,6 +63,7 @@ def parsePcdInfoFromMapFile(mapfilepath, efifilepath): return _parseGeneral(lines, efifilepath) =20 def _parseForXcode(lines, efifilepath): + valuePattern =3D re.compile('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_Binar= yPatch_([\w]+))') status =3D 0 pcds =3D [] for line in lines: @@ -72,13 +73,16 @@ def _parseForXcode(lines, efifilepath): continue if status =3D=3D 1 and len(line) !=3D 0: if '_gPcd_BinaryPatch_' in line: - m =3D re.match('^([\da-fA-FxX]+)([\s\S]*)([_]*_gPcd_Binary= Patch_([\w]+))', line) + m =3D valuePattern.match(line) if m is not None: pcds.append((m.groups(0)[3], int(m.groups(0)[0], 16))) return pcds =20 def _parseForGCC(lines, efifilepath): """ Parse map file generated by GCC linker """ + valuePattern =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]= +)$') + dataPattern =3D re.compile('^.data._gPcd_BinaryPatch_([\w_\d]+)$') + pcdPattern =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') status =3D 0 imageBase =3D -1 sections =3D [] @@ -98,15 +102,15 @@ def _parseForGCC(lines, efifilepath): =20 # status handler if status =3D=3D 3: - m =3D re.match('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+)$',= line) + m =3D valuePattern.match(line) if m is not None: sections.append(m.groups(0)) if status =3D=3D 3: - m =3D re.match('^.data._gPcd_BinaryPatch_([\w_\d]+)$', line) + m =3D dataPattern.match(line) if m is not None: if lines[index + 1]: PcdName =3D m.groups(0)[0] - m =3D re.match('^([\da-fA-Fx]+) +([\da-fA-Fx]+)', line= s[index + 1].strip()) + m =3D pcdPattern.match(lines[index + 1].strip()) if m is not None: bpcds.append((PcdName, int(m.groups(0)[0], 16) , i= nt(sections[-1][1], 16), sections[-1][0])) =20 @@ -137,17 +141,19 @@ def _parseGeneral(lines, efifilepath): status =3D 0 #0 - beginning of file; 1 - PE section definition; 2 -= symbol table secs =3D [] # key =3D section name bPcds =3D [] - + startPattern =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") + addressPattern =3D re.compile("^Address[' ']+Publics by Value[' ']+Rva= \+Base") + symPattern =3D re.compile('^[_]+gPcd_BinaryPatch_([\w]+)') =20 for line in lines: line =3D line.strip() - if re.match("^Start[' ']+Length[' ']+Name[' ']+Class", line): + if startPattern.match(line): status =3D 1 continue - if re.match("^Address[' ']+Publics by Value[' ']+Rva\+Base", line): + if addressPattern.match(line): status =3D 2 continue - if re.match("^entry point at", line): + if line.startswith("entry point at"): status =3D 3 continue if status =3D=3D 1 and len(line) !=3D 0: @@ -162,7 +168,7 @@ def _parseGeneral(lines, efifilepath): sec_no =3D int(sec_no, 16) sym_offset =3D int(sym_offset, 16) vir_addr =3D int(vir_addr, 16) - m2 =3D re.match('^[_]+gPcd_BinaryPatch_([\w]+)', sym_name) + m2 =3D symPattern.match(sym_name) if m2 is not None: # fond a binary pcd entry in map file for sec in secs: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239577738910.1400951484319; Fri, 20 Apr 2018 08:52:57 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 637612274F3EF; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 50D352251212F for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811538" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:23 -0700 Message-Id: <8e9e20fa37e691fba2ea8487f4e21ba990ada3b0.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 03/27] BaseTools: Share RegEx between files X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/Misc.py | 22 ++++++++= +++--------- BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py | 15 +++++---= ----- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index bc7d0c2d9d00..4a6a29c7ae80 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -42,6 +42,13 @@ import subprocess ## Regular expression used to find out place holders in string template gPlaceholderPattern =3D re.compile("\$\{([^$()\s]+)\}", re.MULTILINE | re.= UNICODE) =20 +## regular expressions for map file processing +startPatternGeneral =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Clas= s") +addressPatternGeneral =3D re.compile("^Address[' ']+Publics by Value[' ']+= Rva\+Base") +valuePatternGcc =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]+= )$') +pcdPatternGcc =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') +secReGeneral =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[H= h]? +([.\w\$]+) +(\w+)', re.UNICODE) + ## Dictionary used to store file time stamp for quick re-access gFileTimeStampCache =3D {} # {file path : file time stamp} =20 @@ -92,8 +99,6 @@ def _parseForXcode(lines, efifilepath, varnames): =20 def _parseForGCC(lines, efifilepath, varnames): """ Parse map file generated by GCC linker """ - valuePattern =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]= +)$') - pcdPattern =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') status =3D 0 sections =3D [] varoffset =3D [] @@ -112,7 +117,7 @@ def _parseForGCC(lines, efifilepath, varnames): =20 # status handler if status =3D=3D 3: - m =3D valuePattern.match(line) + m =3D valuePatternGcc.match(line) if m is not None: sections.append(m.groups(0)) for varname in varnames: @@ -125,7 +130,7 @@ def _parseForGCC(lines, efifilepath, varnames): else: Str =3D line[len(".data.%s" % varname):] if Str: - m =3D pcdPattern.match(Str.strip()) + m =3D pcdPatternGcc.match(Str.strip()) if m is not None: varoffset.append((varname, int(m.groups(0)[0],= 16) , int(sections[-1][1], 16), sections[-1][0])) =20 @@ -153,24 +158,21 @@ def _parseGeneral(lines, efifilepath, varnames): status =3D 0 #0 - beginning of file; 1 - PE section definition; 2 -= symbol table secs =3D [] # key =3D section name varoffset =3D [] - secRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]?= +([.\w\$]+) +(\w+)', re.UNICODE) symRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.:\\\\\w\?@\$]+= ) +([\da-fA-F]+)', re.UNICODE) - startRe =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") - addressRe =3D re.compile("^Address[' ']+Publics by Value[' ']+Rva\+Bas= e") =20 for line in lines: line =3D line.strip() - if startRe.match(line): + if startPatternGeneral.match(line): status =3D 1 continue - if addressRe.match(line): + if addressPatternGeneral.match(line): status =3D 2 continue if line.startswith("entry point at"): status =3D 3 continue =20 if status =3D=3D 1 and len(line) !=3D 0: - m =3D secRe.match(line) + m =3D secReGeneral.match(line) assert m is not None, "Fail to parse the section in map file ,= line is %s" % line sec_no, sec_start, sec_length, sec_name, sec_class =3D m.group= s(0) secs.append([int(sec_no, 16), int(sec_start, 16), int(sec_leng= th, 16), sec_name, sec_class]) diff --git a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py b= /BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py index 59748763a553..2a039480a00a 100644 --- a/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py +++ b/BaseTools/Source/Python/GenPatchPcdTable/GenPatchPcdTable.py @@ -24,7 +24,7 @@ import array =20 from Common.BuildToolError import * import Common.EdkLogger as EdkLogger -from Common.Misc import PeImageClass +from Common.Misc import PeImageClass, startPatternGeneral, addressPatternG= eneral, valuePatternGcc, pcdPatternGcc, secReGeneral from Common.BuildVersion import gBUILD_VERSION from Common.LongFilePathSupport import OpenLongFilePath as open =20 @@ -36,7 +36,6 @@ __copyright__ =3D "Copyright (c) 2008 - 2010, Intel Corpo= ration. All rights reserv #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Internal Libraries =3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =20 #=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Code =3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D -secRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\da-fA-F]+)[Hh]? +([= .\w\$]+) +(\w+)', re.UNICODE) symRe =3D re.compile('^([\da-fA-F]+):([\da-fA-F]+) +([\.\-:\\\\\w\?@\$<>]+= ) +([\da-fA-F]+)', re.UNICODE) =20 def parsePcdInfoFromMapFile(mapfilepath, efifilepath): @@ -80,9 +79,7 @@ def _parseForXcode(lines, efifilepath): =20 def _parseForGCC(lines, efifilepath): """ Parse map file generated by GCC linker """ - valuePattern =3D re.compile('^([\w_\.]+) +([\da-fA-Fx]+) +([\da-fA-Fx]= +)$') dataPattern =3D re.compile('^.data._gPcd_BinaryPatch_([\w_\d]+)$') - pcdPattern =3D re.compile('^([\da-fA-Fx]+) +([\da-fA-Fx]+)') status =3D 0 imageBase =3D -1 sections =3D [] @@ -102,7 +99,7 @@ def _parseForGCC(lines, efifilepath): =20 # status handler if status =3D=3D 3: - m =3D valuePattern.match(line) + m =3D valuePatternGcc.match(line) if m is not None: sections.append(m.groups(0)) if status =3D=3D 3: @@ -110,7 +107,7 @@ def _parseForGCC(lines, efifilepath): if m is not None: if lines[index + 1]: PcdName =3D m.groups(0)[0] - m =3D pcdPattern.match(lines[index + 1].strip()) + m =3D pcdPatternGcc.match(lines[index + 1].strip()) if m is not None: bpcds.append((PcdName, int(m.groups(0)[0], 16) , i= nt(sections[-1][1], 16), sections[-1][0])) =20 @@ -141,16 +138,14 @@ def _parseGeneral(lines, efifilepath): status =3D 0 #0 - beginning of file; 1 - PE section definition; 2 -= symbol table secs =3D [] # key =3D section name bPcds =3D [] - startPattern =3D re.compile("^Start[' ']+Length[' ']+Name[' ']+Class") - addressPattern =3D re.compile("^Address[' ']+Publics by Value[' ']+Rva= \+Base") symPattern =3D re.compile('^[_]+gPcd_BinaryPatch_([\w]+)') =20 for line in lines: line =3D line.strip() - if startPattern.match(line): + if startPatternGeneral.match(line): status =3D 1 continue - if addressPattern.match(line): + if addressPatternGeneral.match(line): status =3D 2 continue if line.startswith("entry point at"): --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239520703315.34388946521585; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 619242274F3F6; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2164522512131 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:54 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811541" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:24 -0700 Message-Id: <7f83d6722511aa3833f7c339e86e80d9afb3ca14.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 04/27] BaseTools: Workspace - refactor RegEx to minimize multiple compiling X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 +++- BaseTools/Source/Python/Workspace/MetaFileParser.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index d6b8b761d607..be3f7b6881e8 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -41,6 +41,8 @@ from Common.Misc import SaveFileOnChange from Workspace.BuildClassObject import PlatformBuildClassObject, Structure= Pcd, PcdClassObject, ModuleBuildClassObject from collections import OrderedDict =20 +variablePattern =3D re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$') + # # Treat CHAR16 as a synonym for UINT16. CHAR16 support is required for VF= R C structs # @@ -2421,7 +2423,7 @@ class DscBuildData(PlatformBuildClassObject): if VariableOffset.isdigit(): if int(VariableOffset, 10) > 0xFFFF: ExceedMax =3D True - elif re.match(r'[\t\s]*0[xX][a-fA-F0-9]+$', VariableOffset): + elif variablePattern.match(VariableOffset): if int(VariableOffset, 16) > 0xFFFF: ExceedMax =3D True # For Offset written in "A.B" diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 322ed3844966..550359f9abb2 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -35,6 +35,10 @@ from Common.LongFilePathSupport import OpenLongFilePath = as open from MetaFileTable import MetaFileStorage from MetaFileCommentParser import CheckInfComment =20 +## RegEx for finding file versions +hexVersionPattern =3D re.compile(r'0[xX][\da-f-A-F]{5,8}') +decVersionPattern =3D re.compile(r'\d+\.\d+') + ## A decorator used to parse macro definition def ParseMacro(Parser): def MacroParser(self): @@ -366,9 +370,9 @@ class MetaFileParser(object): EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined"= % (Macro), ExtraData=3Dself._CurrentLine, File=3Dself.MetaFile, Line=3Dsel= f._LineIndex + 1) # Sometimes, we need to make differences between EDK and EDK2 modu= les=20 if Name =3D=3D 'INF_VERSION': - if re.match(r'0[xX][\da-f-A-F]{5,8}', Value): + if hexVersionPattern.match(Value): self._Version =3D int(Value, 0) =20 - elif re.match(r'\d+\.\d+', Value): + elif decVersionPattern.match(Value): ValueList =3D Value.split('.') Major =3D '%04o' % int(ValueList[0], 0) Minor =3D '%04o' % int(ValueList[1], 0) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239525036736.4799592874276; Fri, 20 Apr 2018 08:52:05 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CAB03226EA5B1; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7DEB622512131 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:54 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811545" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:25 -0700 Message-Id: <8584f8145e185f1c1e3e2c1e0d412aff2956441e.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 05/27] BaseTools: Autogen - replace string constants with those from DataType X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu --- BaseTools/Source/Python/AutoGen/AutoGen.py | 68 ++++++++++---------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 6152225943cf..3a2976181ac1 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -259,7 +259,7 @@ class WorkspaceAutoGen(AutoGen): self.BuildDatabase =3D MetaFileDb self.MetaFile =3D ActivePlatform self.WorkspaceDir =3D WorkspaceDir - self.Platform =3D self.BuildDatabase[self.MetaFile, TAB_COMM= ON, Target, Toolchain] + self.Platform =3D self.BuildDatabase[self.MetaFile, TAB_ARCH= _COMMON, Target, Toolchain] GlobalData.gActivePlatform =3D self.Platform self.BuildTarget =3D Target self.ToolChain =3D Toolchain @@ -405,8 +405,8 @@ class WorkspaceAutoGen(AutoGen): Platform =3D self.BuildDatabase[self.MetaFile, Arch, Target, T= oolchain] PlatformPcds =3D Platform.Pcds self._GuidDict =3D Platform._GuidDict - SourcePcdDict =3D {'DynamicEx':set(), 'PatchableInModule':set(= ),'Dynamic':set(),'FixedAtBuild':set()} - BinaryPcdDict =3D {'DynamicEx':set(), 'PatchableInModule':set(= )} + SourcePcdDict =3D {TAB_PCDS_DYNAMIC_EX:set(), TAB_PCDS_PATCHAB= LE_IN_MODULE:set(),TAB_PCDS_DYNAMIC:set(),TAB_PCDS_FIXED_AT_BUILD:set()} + BinaryPcdDict =3D {TAB_PCDS_DYNAMIC_EX:set(), TAB_PCDS_PATCHAB= LE_IN_MODULE:set()} SourcePcdDict_Keys =3D SourcePcdDict.keys() BinaryPcdDict_Keys =3D BinaryPcdDict.keys() =20 @@ -430,23 +430,23 @@ class WorkspaceAutoGen(AutoGen): if PcdInPlatform.Type not in [None, ''= ]: BuildData.Pcds[key].Type =3D PcdIn= Platform.Type =20 - if 'DynamicEx' in BuildData.Pcds[key].Type: + if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type: if BuildData.IsBinaryModule: - BinaryPcdDict['DynamicEx'].add((BuildData.= Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + BinaryPcdDict[TAB_PCDS_DYNAMIC_EX].add((Bu= ildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) else: - SourcePcdDict['DynamicEx'].add((BuildData.= Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + SourcePcdDict[TAB_PCDS_DYNAMIC_EX].add((Bu= ildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) =20 - elif 'PatchableInModule' in BuildData.Pcds[key].Ty= pe: + elif TAB_PCDS_PATCHABLE_IN_MODULE in BuildData.Pcd= s[key].Type: if BuildData.MetaFile.Ext =3D=3D '.inf': if BuildData.IsBinaryModule: - BinaryPcdDict['PatchableInModule'].add= ((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + BinaryPcdDict[TAB_PCDS_PATCHABLE_IN_MO= DULE].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGu= idCName)) else: - SourcePcdDict['PatchableInModule'].add= ((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + SourcePcdDict[TAB_PCDS_PATCHABLE_IN_MO= DULE].add((BuildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGu= idCName)) =20 - elif 'Dynamic' in BuildData.Pcds[key].Type: - SourcePcdDict['Dynamic'].add((BuildData.Pcds[k= ey].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) - elif 'FixedAtBuild' in BuildData.Pcds[key].Type: - SourcePcdDict['FixedAtBuild'].add((BuildData.P= cds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + elif TAB_PCDS_DYNAMIC in BuildData.Pcds[key].Type: + SourcePcdDict[TAB_PCDS_DYNAMIC].add((BuildData= .Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) + elif TAB_PCDS_FIXED_AT_BUILD in BuildData.Pcds[key= ].Type: + SourcePcdDict[TAB_PCDS_FIXED_AT_BUILD].add((Bu= ildData.Pcds[key].TokenCName, BuildData.Pcds[key].TokenSpaceGuidCName)) else: pass # @@ -788,7 +788,7 @@ class WorkspaceAutoGen(AutoGen): # Here we just need to get FILE_GUID from INF = file, use 'COMMON' as ARCH attribute. and use=20 # BuildObject from one of AutoGenObjectList is= enough. # - InfObj =3D self.AutoGenObjectList[0].BuildData= base.WorkspaceDb.BuildObject[PathClassObj, TAB_COMMON, self.BuildTarget, se= lf.ToolChain] + InfObj =3D self.AutoGenObjectList[0].BuildData= base.WorkspaceDb.BuildObject[PathClassObj, TAB_ARCH_COMMON, self.BuildTarge= t, self.ToolChain] if InfObj.Guid.upper() not in _GuidDict: _GuidDict[InfObj.Guid.upper()] =3D FfsFile else: @@ -869,9 +869,9 @@ class WorkspaceAutoGen(AutoGen): =20 def _CheckPcdDefineAndType(self): PcdTypeList =3D [ - "FixedAtBuild", "PatchableInModule", "FeatureFlag", - "Dynamic", #"DynamicHii", "DynamicVpd", - "DynamicEx", # "DynamicExHii", "DynamicExVpd" + TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCD= S_FEATURE_FLAG, + TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd", + TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd" ] =20 # This dict store PCDs which are not used by any modules with spec= ified arches @@ -886,10 +886,10 @@ class WorkspaceAutoGen(AutoGen): continue =20 # Try to remove Hii and Vpd suffix - if PcdType.startswith("DynamicEx"): - PcdType =3D "DynamicEx" - elif PcdType.startswith("Dynamic"): - PcdType =3D "Dynamic" + if PcdType.startswith(TAB_PCDS_DYNAMIC_EX): + PcdType =3D TAB_PCDS_DYNAMIC_EX + elif PcdType.startswith(TAB_PCDS_DYNAMIC): + PcdType =3D TAB_PCDS_DYNAMIC =20 for Package in Pa.PackageList: # Key of DEC's Pcds dictionary is PcdCName, TokenSpace= Guid, PcdType @@ -1286,7 +1286,7 @@ class PlatformAutoGen(AutoGen): continue else: DscPcd =3D self.NonDynamicPcdDict[(Pcd.TokenCName,Pcd.= TokenSpaceGuidCName)] - if DscPcd.Type !=3D "FixedAtBuild": + if DscPcd.Type !=3D TAB_PCDS_FIXED_AT_BUILD: continue if key in ShareFixedAtBuildPcdsSameValue and ShareFixedAtB= uildPcdsSameValue[key]: =20 LibAuto.ConstPcd[key] =3D FixedAtBuildPcds[key] @@ -2066,28 +2066,28 @@ class PlatformAutoGen(AutoGen): # for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in ["Dynamic", "DynamicDefault", "DynamicV= pd", "DynamicHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in ["DynamicEx", "DynamicExDefault", "Dyna= micExVpd", "DynamicExHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in ["Dynamic", "DynamicDefault", "DynamicV= pd", "DynamicHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in ["DynamicEx", "DynamicExDefault", "Dyna= micExVpd", "DynamicExHii"]: + if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 @@ -2331,7 +2331,7 @@ class PlatformAutoGen(AutoGen): ToPcd.Type =3D FromPcd.Type elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [= None, ''])\ and (ToPcd.Type !=3D FromPcd.Type) and (ToPcd.Type in From= Pcd.Type): - if ToPcd.Type.strip() =3D=3D "DynamicEx": + if ToPcd.Type.strip() =3D=3D TAB_PCDS_DYNAMIC_EX: ToPcd.Type =3D FromPcd.Type elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [Non= e, ''] \ and ToPcd.Type !=3D FromPcd.Type: @@ -2881,7 +2881,7 @@ class ModuleAutoGen(AutoGen): if self._FixedAtBuildPcds: return self._FixedAtBuildPcds for Pcd in self.ModulePcdList: - if Pcd.Type !=3D "FixedAtBuild": + if Pcd.Type !=3D TAB_PCDS_FIXED_AT_BUILD: continue if Pcd not in self._FixedAtBuildPcds: self._FixedAtBuildPcds.append(Pcd) @@ -3418,7 +3418,7 @@ class ModuleAutoGen(AutoGen): if self._BinaryFileList is None: self._BinaryFileList =3D [] for F in self.Module.Binaries: - if F.Target not in [TAB_COMMON, '*'] and F.Target !=3D sel= f.BuildTarget: + if F.Target not in [TAB_ARCH_COMMON, '*'] and F.Target != =3D self.BuildTarget: continue self._BinaryFileList.append(F) self._ApplyBuildRule(F, F.Type) @@ -3931,12 +3931,12 @@ class ModuleAutoGen(AutoGen): for Pcd in self.ModulePcdList + self.LibraryPcdList: if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: PatchablePcds +=3D [Pcd] - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, 'PatchableInModule')) + PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, TAB_PCDS_PATCHABLE_IN_MODULE)) elif Pcd.Type in GenC.gDynamicExPcd: if Pcd not in Pcds: Pcds +=3D [Pcd] - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'DynamicEx')) - PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, 'Dynamic')) + PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC_EX)) + PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC)) PcdTokenSpaceList.append(Pcd.TokenSpaceGuidCName) GuidList =3D OrderedDict() GuidList.update(self.GuidList) @@ -3964,8 +3964,8 @@ class ModuleAutoGen(AutoGen): if Pkg in Packages: continue for VfrPcd in VfrPcds: - if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, 'Dynam= icEx') in Pkg.Pcds or - (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, 'Dynam= ic') in Pkg.Pcds): + if ((VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC_EX) in Pkg.Pcds or + (VfrPcd.TokenCName, VfrPcd.TokenSpaceGuidCName, TAB_PC= DS_DYNAMIC) in Pkg.Pcds): Packages +=3D [Pkg] break =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239532216254.21092386052965; Fri, 20 Apr 2018 08:52:12 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 347CF226EA5A2; Fri, 20 Apr 2018 08:51:57 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BA6EA22512158 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811548" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:26 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 06/27] BaseTools: simplify if call X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" the variable is a string type since we just used .strip() on it. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- 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/Sourc= e/Python/Common/Expression.py index 9a3415ccaabe..99929938fb5a 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -815,7 +815,7 @@ class ValueExpressionEx(ValueExpression): except BadExpression, Value: if self.PcdType in ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BO= OLEAN']: PcdValue =3D PcdValue.strip() - if type(PcdValue) =3D=3D type('') and PcdValue.startswith(= '{') and PcdValue.endswith('}'): + if PcdValue.startswith('{') and PcdValue.endswith('}'): PcdValue =3D SplitPcdValueString(PcdValue[1:-1]) if type(PcdValue) =3D=3D type([]): TmpValue =3D 0 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239549537857.9288222512536; Fri, 20 Apr 2018 08:52:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 22DD6226EA5D8; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DA2E022637DDC for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811551" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:27 -0700 Message-Id: <33a59704e3586a42b9ab964b3f54a197b0ed36ea.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 07/27] BaseTools: Workspace - refactor GetStructurePcdInfo X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" the function doesn't use self and can be static defaultdict replaces dict and removes the dict initialization code Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Workspace/DscBuildData.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index be3f7b6881e8..904c52d9576a 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -39,7 +39,7 @@ import Common.GlobalData as GlobalData import subprocess from Common.Misc import SaveFileOnChange from Workspace.BuildClassObject import PlatformBuildClassObject, Structure= Pcd, PcdClassObject, ModuleBuildClassObject -from collections import OrderedDict +from collections import OrderedDict,defaultdict =20 variablePattern =3D re.compile(r'[\t\s]*0[xX][a-fA-F0-9]+$') =20 @@ -1187,11 +1187,10 @@ class DscBuildData(PlatformBuildClassObject): options[Key] +=3D ' ' + Option return self._ModuleTypeOptions[Edk, ModuleType] =20 - def GetStructurePcdInfo(self, PcdSet): - structure_pcd_data =3D {} + @staticmethod + def GetStructurePcdInfo(PcdSet): + structure_pcd_data =3D defaultdict(list) for item in PcdSet: - if (item[0],item[1]) not in structure_pcd_data: - structure_pcd_data[(item[0],item[1])] =3D [] structure_pcd_data[(item[0],item[1])].append(item) =20 return structure_pcd_data @@ -1298,7 +1297,7 @@ class DscBuildData(PlatformBuildClassObject): S_PcdSet.append([ TokenSpaceGuid.split(".")[0],TokenSpaceG= uid.split(".")[1], PcdCName,SkuName, default_store,Dummy5, AnalyzePcdExpres= sion(Setting)[0]]) =20 # handle pcd value override - StrPcdSet =3D self.GetStructurePcdInfo(S_PcdSet) + StrPcdSet =3D DscBuildData.GetStructurePcdInfo(S_PcdSet) S_pcd_set =3D OrderedDict() for str_pcd in StrPcdSet: str_pcd_obj =3D Pcds.get((str_pcd[1], str_pcd[0]), None) --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239528535185.51229892322203; Fri, 20 Apr 2018 08:52:08 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 03D98226EA5B8; Fri, 20 Apr 2018 08:51:57 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A77572251212F for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:54 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811555" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:28 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 08/27] BaseTools: AutoGen - remove dictionary populated, but never accessed X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index 5937558e7038..4f4a8d856842 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -980,7 +980,6 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH): Changed =3D SaveFileOnChange(DbFileName, DbFile.getvalue(), True) def CreatePcdDataBase(PcdDBData): delta =3D {} - basedata =3D {} for skuname,skuid in PcdDBData: if len(PcdDBData[(skuname,skuid)][1]) !=3D len(PcdDBData[(TAB_DEFA= ULT,"0")][1]): EdkLogger.ERROR("The size of each sku in one pcd are not same") @@ -988,7 +987,6 @@ def CreatePcdDataBase(PcdDBData): if skuname =3D=3D TAB_DEFAULT: continue delta[(skuname,skuid)] =3D [(index,data,hex(data)) for index,data = in enumerate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1= ][index] !=3D PcdDBData[(TAB_DEFAULT,"0")][1][index]] - basedata[(skuname,skuid)] =3D [(index,PcdDBData[(TAB_DEFAULT,"0")]= [1][index],hex(PcdDBData[(TAB_DEFAULT,"0")][1][index])) for index,data in e= numerate(PcdDBData[(skuname,skuid)][1]) if PcdDBData[(skuname,skuid)][1][in= dex] !=3D PcdDBData[(TAB_DEFAULT,"0")][1][index]] databasebuff =3D PcdDBData[(TAB_DEFAULT,"0")][0] =20 for skuname,skuid in delta: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239614427609.5491541141022; Fri, 20 Apr 2018 08:53:34 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B19A42279CF04; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C486B226EA5AF for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811558" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:29 -0700 Message-Id: <9c119de789811301553e959a17c91acd8f144cdd.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 09/27] BaseTools: AutoGen - remove unused variables. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/GenMake.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/= Python/AutoGen/GenMake.py index 1bb5163e73e0..a37350742240 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -427,8 +427,6 @@ cleanlib: self.ResultFileList =3D [] self.IntermediateDirectoryList =3D ["$(DEBUG_DIR)", "$(OUTPUT_DIR)= "] =20 - self.SourceFileDatabase =3D {} # {file type : file path} - self.DestFileDatabase =3D {} # {file type : file path} self.FileBuildTargetList =3D [] # [(src, target string)] self.BuildTargetList =3D [] # [target string] self.PendingBuildTargetList =3D [] # [FileBuildRule objects] --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239536208156.93185658589255; Fri, 20 Apr 2018 08:52:16 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 72502226EA5BE; Fri, 20 Apr 2018 08:51:57 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DC9BF22637DF3 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811561" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:30 -0700 Message-Id: <57fb19e3c6a12f152c512a5dcdd19a8042173c0d.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 10/27] BaseTools: Remove extra .keys() X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Yonghong Zhu Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/GenFds/Fv.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python= /GenFds/Fv.py index 5228e155267f..71bcd4c72170 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -316,7 +316,7 @@ class FV (FvClassObject): ' %s' %ErasePloarity + \ T_CHAR_LF) if not (self.FvAttributeDict is None): - for FvAttribute in self.FvAttributeDict: + for FvAttribute in self.FvAttributeDict.keys() : if FvAttribute =3D=3D "FvUsedSizeEnable": if self.FvAttributeDict[FvAttribute].upper() in ('TRUE= ', '1') : self.UsedSizeEnable =3D True --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239595488323.54380064016345; Fri, 20 Apr 2018 08:53:15 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0DB542279CEF1; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A38BA226EA5AA for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811564" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:31 -0700 Message-Id: <713dcb2a513561fe7d62fcfd9df09cde1712ff91.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" make defaultdict to avoid initialize inner items to empty the dict, call clear instead of making a new object Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Workspace/MetaFileParser.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 550359f9abb2..99f6fcd0dc30 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -31,7 +31,7 @@ from Common.Misc import GuidStructureStringToGuidString, = CheckPcdDatum, PathClas from Common.Expression import * from CommonDataClass.Exceptions import * from Common.LongFilePathSupport import OpenLongFilePath as open - +from collections import defaultdict from MetaFileTable import MetaFileStorage from MetaFileCommentParser import CheckInfComment =20 @@ -163,7 +163,7 @@ class MetaFileParser(object): self._FileDir =3D self.MetaFile.Dir self._Defines =3D {} self._FileLocalMacros =3D {} - self._SectionsMacroDict =3D {} + self._SectionsMacroDict =3D defaultdict(dict) =20 # for recursive parsing self._Owner =3D [Owner] @@ -421,17 +421,16 @@ class MetaFileParser(object): def _ConstructSectionMacroDict(self, Name, Value): ScopeKey =3D [(Scope[0], Scope[1],Scope[2]) for Scope in self._Sco= pe] ScopeKey =3D tuple(ScopeKey) - SectionDictKey =3D self._SectionType, ScopeKey # # DecParser SectionType is a list, will contain more than one item= only in Pcd Section # As Pcd section macro usage is not alllowed, so here it is safe # if type(self) =3D=3D DecParser: SectionDictKey =3D self._SectionType[0], ScopeKey - if SectionDictKey not in self._SectionsMacroDict: - self._SectionsMacroDict[SectionDictKey] =3D {} - SectionLocalMacros =3D self._SectionsMacroDict[SectionDictKey] - SectionLocalMacros[Name] =3D Value + else: + SectionDictKey =3D self._SectionType, ScopeKey + + self._SectionsMacroDict[SectionDictKey][Name] =3D Value =20 ## Get section Macros that are applicable to current line, which may c= ome from other sections=20 ## that share the same name while scope is wider @@ -936,7 +935,7 @@ class DscParser(MetaFileParser): self._SubsectionType =3D MODEL_UNKNOWN self._SubsectionName =3D '' self._Owner[-1] =3D -1 - OwnerId =3D {} + OwnerId.clear() continue # subsection header elif Line[0] =3D=3D TAB_OPTION_START and Line[-1] =3D=3D TAB_O= PTION_END: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239544193691.1267145824887; Fri, 20 Apr 2018 08:52:24 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E99C5226EA5D4; Fri, 20 Apr 2018 08:51:59 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id EAE892251212F for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811568" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:32 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 12/27] BaseTools: remove dict from DscBuildData X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" the dict is not needed as BaseTools can check the set Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Workspace/DscBuildData.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 904c52d9576a..eb435cece480 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1953,13 +1953,11 @@ class DscBuildData(PlatformBuildClassObject): InitByteValue =3D "" CApp =3D PcdMainCHeader =20 - Includes =3D {} IncludeFiles =3D set() for PcdName in StructuredPcds: Pcd =3D StructuredPcds[PcdName] for IncludeFile in Pcd.StructuredPcdIncludeFile: - if IncludeFile not in Includes: - Includes[IncludeFile] =3D True + if IncludeFile not in IncludeFiles: IncludeFiles.add(IncludeFile) CApp =3D CApp + '#include <%s>\n' % (IncludeFile) CApp =3D CApp + '\n' --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239586449145.1534562106699; Fri, 20 Apr 2018 08:53:06 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B4E482279CEE8; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7692A226EA5A2 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811583" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:33 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 13/27] BaseTools: replace string constants used for module types X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" replace raw strings in the code (note: except UPT) with constants. SUP_MODULE_BASE was 'BASE' SUP_MODULE_SEC was 'SEC' SUP_MODULE_PEI_CORE was 'PEI_CORE' SUP_MODULE_PEIM was 'PEIM' SUP_MODULE_DXE_CORE was 'DXE_CORE' SUP_MODULE_DXE_DRIVER was 'DXE_DRIVER' SUP_MODULE_DXE_RUNTIME_DRIVER was 'DXE_RUNTIME_DRIVER' SUP_MODULE_DXE_SAL_DRIVER was 'DXE_SAL_DRIVER' SUP_MODULE_DXE_SMM_DRIVER was 'DXE_SMM_DRIVER' SUP_MODULE_UEFI_DRIVER was 'UEFI_DRIVER' SUP_MODULE_UEFI_APPLICATION was 'UEFI_APPLICATION' SUP_MODULE_USER_DEFINED was 'USER_DEFINED' SUP_MODULE_SMM_CORE was 'SMM_CORE' SUP_MODULE_MM_STANDALONE was 'MM_STANDALONE' SUP_MODULE_MM_CORE_STANDALONE was 'MM_CORE_STANDALONE' Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 20 ++-- BaseTools/Source/Python/AutoGen/BuildEngine.py | 10 +- BaseTools/Source/Python/AutoGen/GenC.py | 120 ++++++++++-----= ----- BaseTools/Source/Python/AutoGen/GenDepex.py | 33 +++--- BaseTools/Source/Python/Common/DataType.py | 2 +- BaseTools/Source/Python/Ecc/Check.py | 4 +- BaseTools/Source/Python/GenFds/CompressSection.py | 3 +- BaseTools/Source/Python/GenFds/DataSection.py | 2 +- BaseTools/Source/Python/GenFds/DepexSection.py | 11 +- BaseTools/Source/Python/GenFds/EfiSection.py | 17 +-- BaseTools/Source/Python/GenFds/FdfParser.py | 16 +-- BaseTools/Source/Python/GenFds/Ffs.py | 41 +++---- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 30 ++--- BaseTools/Source/Python/GenFds/FvImageSection.py | 5 +- BaseTools/Source/Python/GenFds/GuidSection.py | 5 +- BaseTools/Source/Python/GenFds/UiSection.py | 3 +- BaseTools/Source/Python/GenFds/VerSection.py | 3 +- BaseTools/Source/Python/Workspace/InfBuildData.py | 48 ++++---- BaseTools/Source/Python/Workspace/WorkspaceCommon.py | 2 +- BaseTools/Source/Python/build/BuildReport.py | 56 ++++----- BaseTools/Source/Python/build/build.py | 10 +- 21 files changed, 225 insertions(+), 216 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 3a2976181ac1..9c3bf864e360 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1431,7 +1431,7 @@ class PlatformAutoGen(AutoGen): # used by DXE module, it should be stored in DXE PCD d= atabase. # The default Phase is DXE # - if M.ModuleType in ["PEIM", "PEI_CORE"]: + if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_: self._DynaPcdList_.append(PcdFromModule) @@ -1473,7 +1473,7 @@ class PlatformAutoGen(AutoGen): # make sure that the "VOID*" kind of datum has MaxDatu= mSize set if PcdFromModule.DatumType =3D=3D "VOID*" and PcdFromM= odule.MaxDatumSize in [None, '']: NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) - if M.ModuleType in ["PEIM", "PEI_CORE"]: + if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in GenC.gDynamicExPcd: self._DynaPcdList_.append(PcdFromModule) @@ -2204,7 +2204,7 @@ class PlatformAutoGen(AutoGen): LibraryModule.LibraryClass.append(LibraryClassObje= ct(LibraryClassName, [ModuleType])) elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) =3D=3D 0 \ - or (ModuleType !=3D 'USER_DEFINED' + or (ModuleType !=3D SUP_MODULE_USER_DEFINED and ModuleType not in LibraryModule.LibraryCl= ass[0].SupModList): # only USER_DEFINED can link against any library i= nstance despite of its SupModList EdkLogger.error("build", OPTION_MISSING, @@ -3970,8 +3970,8 @@ class ModuleAutoGen(AutoGen): break =20 ModuleType =3D self.ModuleType - if ModuleType =3D=3D 'UEFI_DRIVER' and self.DepexGenerated: - ModuleType =3D 'DXE_DRIVER' + if ModuleType =3D=3D SUP_MODULE_UEFI_DRIVER and self.DepexGenerate= d: + ModuleType =3D SUP_MODULE_DXE_DRIVER =20 DriverType =3D '' if self.PcdIsDriver !=3D '': @@ -4048,11 +4048,11 @@ class ModuleAutoGen(AutoGen): AsBuiltInfDict['binary_item'] +=3D ['BIN|' + File] if self.DepexGenerated: self.OutputFile.add(self.Name + '.depex') - if self.ModuleType in ['PEIM']: + if self.ModuleType in [SUP_MODULE_PEIM]: AsBuiltInfDict['binary_item'] +=3D ['PEI_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in ['DXE_DRIVER', 'DXE_RUNTIME_DRIVER', 'DX= E_SAL_DRIVER', 'UEFI_DRIVER']: + if self.ModuleType in [SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_R= UNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_UEFI_DRIVER]: AsBuiltInfDict['binary_item'] +=3D ['DXE_DEPEX|' + self.Na= me + '.depex'] - if self.ModuleType in ['DXE_SMM_DRIVER']: + if self.ModuleType in [SUP_MODULE_DXE_SMM_DRIVER]: AsBuiltInfDict['binary_item'] +=3D ['SMM_DEPEX|' + self.Na= me + '.depex'] =20 Bin =3D self._GenOffsetBin() @@ -4378,8 +4378,8 @@ class ModuleAutoGen(AutoGen): return =20 for ModuleType in self.DepexList: - # Ignore empty [depex] section or [depex] section for "USER_DE= FINED" module - if len(self.DepexList[ModuleType]) =3D=3D 0 or ModuleType =3D= =3D "USER_DEFINED": + # Ignore empty [depex] section or [depex] section for SUP_MODU= LE_USER_DEFINED module + if len(self.DepexList[ModuleType]) =3D=3D 0 or ModuleType =3D= =3D SUP_MODULE_USER_DEFINED: continue =20 Dpx =3D GenDepex.DependencyExpression(self.DepexList[ModuleTyp= e], ModuleType, True) diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py b/BaseTools/Sou= rce/Python/AutoGen/BuildEngine.py index bbd1a4d5b257..a4f39b0b2925 100644 --- a/BaseTools/Source/Python/AutoGen/BuildEngine.py +++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py @@ -612,11 +612,11 @@ if __name__ =3D=3D '__main__': EdkLogger.Initialize() if len(sys.argv) > 1: Br =3D BuildRule(sys.argv[1]) - print str(Br[".c", "DXE_DRIVER", "IA32", "MSFT"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]) print - print str(Br[".c", "DXE_DRIVER", "IA32", "INTEL"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]) print - print str(Br[".c", "DXE_DRIVER", "IA32", "GCC"][1]) + print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]) print print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print @@ -624,7 +624,7 @@ if __name__ =3D=3D '__main__': print print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]) print - print str(Br[".s", "SEC", "IPF", "COMMON"][1]) + print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]) print - print str(Br[".s", "SEC"][1]) + print str(Br[".s", SUP_MODULE_SEC][1]) =20 diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 6706629722fc..7bc352274e66 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -651,7 +651,7 @@ ${END} ] =20 gLibraryStructorPrototype =3D { -'BASE' : TemplateString("""${BEGIN} +SUP_MODULE_BASE : TemplateString("""${BEGIN} RETURN_STATUS EFIAPI ${Function} ( @@ -688,7 +688,7 @@ ${Function} ( } =20 gLibraryStructorCall =3D { -'BASE' : TemplateString("""${BEGIN} +SUP_MODULE_BASE : TemplateString("""${BEGIN} Status =3D ${Function} (); ASSERT_EFI_ERROR (Status);${END} """), @@ -711,7 +711,7 @@ gLibraryStructorCall =3D { =20 ## Library Constructor and Destructor Templates gLibraryString =3D { -'BASE' : TemplateString(""" +SUP_MODULE_BASE : TemplateString(""" ${BEGIN}${FunctionPrototype}${END} =20 VOID @@ -774,21 +774,21 @@ ${FunctionCall}${END} gBasicHeaderFile =3D "Base.h" =20 gModuleTypeHeaderFile =3D { - "BASE" : [gBasicHeaderFile], - "SEC" : ["PiPei.h", "Library/DebugLib.h"], - "PEI_CORE" : ["PiPei.h", "Library/DebugLib.h", "Library/Pei= CoreEntryPoint.h"], - "PEIM" : ["PiPei.h", "Library/DebugLib.h", "Library/Pei= mEntryPoint.h"], - "DXE_CORE" : ["PiDxe.h", "Library/DebugLib.h", "Library/Dxe= CoreEntryPoint.h"], - "DXE_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_SMM_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_RUNTIME_DRIVER": ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "DXE_SAL_DRIVER" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "UEFI_DRIVER" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriverEntryPoin= t.h"], - "UEFI_APPLICATION" : ["Uefi.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplicationEntr= yPoint.h"], - "SMM_CORE" : ["PiDxe.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/UefiDriverEntryPoint.h"], - "MM_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], - "MM_CORE_STANDALONE" : ["PiSmm.h", "Library/BaseLib.h", "Library/Debu= gLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], - "USER_DEFINED" : [gBasicHeaderFile] + SUP_MODULE_BASE : [gBasicHeaderFile], + SUP_MODULE_SEC : ["PiPei.h", "Library/DebugLib.h"], + SUP_MODULE_PEI_CORE : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeiCoreEntryPoint.h"], + SUP_MODULE_PEIM : ["PiPei.h", "Library/DebugLib.h", "Li= brary/PeimEntryPoint.h"], + SUP_MODULE_DXE_CORE : ["PiDxe.h", "Library/DebugLib.h", "Li= brary/DxeCoreEntryPoint.h"], + SUP_MODULE_DXE_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_SMM_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_RUNTIME_DRIVER: ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_DXE_SAL_DRIVER : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_UEFI_DRIVER : ["Uefi.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiDriver= EntryPoint.h"], + SUP_MODULE_UEFI_APPLICATION : ["Uefi.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiBootServicesTableLib.h", "Library/UefiApplic= ationEntryPoint.h"], + SUP_MODULE_SMM_CORE : ["PiDxe.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/UefiDriverEntryPoint.h"], + SUP_MODULE_MM_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/SmmDriverStandaloneEntryPoint.h"], + SUP_MODULE_MM_CORE_STANDALONE : ["PiSmm.h", "Library/BaseLib.h", "Lib= rary/DebugLib.h", "Library/SmmCoreStandaloneEntryPoint.h"], + SUP_MODULE_USER_DEFINED : [gBasicHeaderFile] } =20 ## Autogen internal worker macro to define DynamicEx PCD name includes bot= h the TokenSpaceGuidName=20 @@ -1408,17 +1408,17 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Au= toGenH): if len(Lib.ConstructorList) <=3D 0: continue Dict =3D {'Function':Lib.ConstructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - ConstructorPrototypeString.Append(gLibraryStructorPrototype['B= ASE'].Replace(Dict)) - ConstructorCallingString.Append(gLibraryStructorCall['BASE'].R= eplace(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: + if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + ConstructorPrototypeString.Append(gLibraryStructorPrototype[SU= P_MODULE_BASE].Replace(Dict)) + ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODUL= E_BASE].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['P= EI'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Re= place(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','= DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION','SMM_CORE']: + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_= DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['D= XE'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['DXE'].Re= place(Dict)) - elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_COR= E_STANDALONE]: ConstructorPrototypeString.Append(gLibraryStructorPrototype['M= M'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['MM'].Rep= lace(Dict)) =20 @@ -1439,14 +1439,14 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Au= toGenH): if Info.IsLibrary: AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) + elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: + elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CO= RE_STANDALONE]: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) =20 ## Create code for library destructor @@ -1470,17 +1470,17 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): if len(Lib.DestructorList) <=3D 0: continue Dict =3D {'Function':Lib.DestructorList} - if Lib.ModuleType in ['BASE', 'SEC']: - DestructorPrototypeString.Append(gLibraryStructorPrototype['BA= SE'].Replace(Dict)) - DestructorCallingString.Append(gLibraryStructorCall['BASE'].Re= place(Dict)) - elif Lib.ModuleType in ['PEI_CORE','PEIM']: + if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP= _MODULE_BASE].Replace(Dict)) + DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE= _BASE].Replace(Dict)) + elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: DestructorPrototypeString.Append(gLibraryStructorPrototype['PE= I'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['PEI'].Rep= lace(Dict)) - elif Lib.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER','= DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPLI= CATION', 'SMM_CORE']: + elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_= DRIVER,SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_SMM_CORE]: DestructorPrototypeString.Append(gLibraryStructorPrototype['DX= E'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['DXE'].Rep= lace(Dict)) - elif Lib.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Lib.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_COR= E_STANDALONE]: DestructorPrototypeString.Append(gLibraryStructorPrototype['MM= '].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['MM'].Repl= ace(Dict)) =20 @@ -1501,14 +1501,14 @@ def CreateLibraryDestructorCode(Info, AutoGenC, Aut= oGenH): if Info.IsLibrary: AutoGenH.Append("${BEGIN}${FunctionPrototype}${END}", Dict) else: - if Info.ModuleType in ['BASE', 'SEC']: - AutoGenC.Append(gLibraryString['BASE'].Replace(Dict)) - elif Info.ModuleType in ['PEI_CORE','PEIM']: + if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: + AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) + elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) - elif Info.ModuleType in ['DXE_CORE','DXE_DRIVER','DXE_SMM_DRIVER',= 'DXE_RUNTIME_DRIVER', - 'DXE_SAL_DRIVER','UEFI_DRIVER','UEFI_APPL= ICATION','SMM_CORE']: + elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, + SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: AutoGenC.Append(gLibraryString['DXE'].Replace(Dict)) - elif Info.ModuleType in ['MM_STANDALONE','MM_CORE_STANDALONE']: + elif Info.ModuleType in [SUP_MODULE_MM_STANDALONE,SUP_MODULE_MM_CO= RE_STANDALONE]: AutoGenC.Append(gLibraryString['MM'].Replace(Dict)) =20 =20 @@ -1519,7 +1519,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): # @param AutoGenH The TemplateString object for header file # def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return # # Module Entry Points @@ -1539,7 +1539,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): 'UefiSpecVersion': UefiSpecVersion + 'U' } =20 - if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE', 'MM_CORE_ST= ANDALONE']: + if Info.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODULE_DXE_CORE, SUP_M= ODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE]: if Info.SourceFileList: if NumEntryPoints !=3D 1: EdkLogger.error( @@ -1549,43 +1549,43 @@ def CreateModuleEntryPointCode(Info, AutoGenC, Auto= GenH): File=3Dstr(Info), ExtraData=3D ", ".join(Info.Module.ModuleEntryPointList) ) - if Info.ModuleType =3D=3D 'PEI_CORE': + if Info.ModuleType =3D=3D SUP_MODULE_PEI_CORE: AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'DXE_CORE': + elif Info.ModuleType =3D=3D SUP_MODULE_DXE_CORE: AutoGenC.Append(gDxeCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gDxeCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'SMM_CORE': + elif Info.ModuleType =3D=3D SUP_MODULE_SMM_CORE: AutoGenC.Append(gSmmCoreEntryPointString.Replace(Dict)) AutoGenH.Append(gSmmCoreEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'MM_CORE_STANDALONE': + elif Info.ModuleType =3D=3D SUP_MODULE_MM_CORE_STANDALONE: AutoGenC.Append(gMmCoreStandaloneEntryPointString.Replace(Dict)) AutoGenH.Append(gMmCoreStandaloneEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'PEIM': + elif Info.ModuleType =3D=3D SUP_MODULE_PEIM: if NumEntryPoints < 2: AutoGenC.Append(gPeimEntryPointString[NumEntryPoints].Replace(= Dict)) else: AutoGenC.Append(gPeimEntryPointString[2].Replace(Dict)) AutoGenH.Append(gPeimEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType in ['DXE_RUNTIME_DRIVER','DXE_DRIVER','DXE_SAL_DR= IVER','UEFI_DRIVER']: + elif Info.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIVER,SUP_MODULE_DXE_= DRIVER,SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER]: if NumEntryPoints < 2: AutoGenC.Append(gUefiDriverEntryPointString[NumEntryPoints].Re= place(Dict)) else: AutoGenC.Append(gUefiDriverEntryPointString[2].Replace(Dict)) AutoGenH.Append(gUefiDriverEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'DXE_SMM_DRIVER': + elif Info.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER: if NumEntryPoints =3D=3D 0: AutoGenC.Append(gDxeSmmEntryPointString[0].Replace(Dict)) else: AutoGenC.Append(gDxeSmmEntryPointString[1].Replace(Dict)) AutoGenH.Append(gDxeSmmEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'MM_STANDALONE': + elif Info.ModuleType =3D=3D SUP_MODULE_MM_STANDALONE: if NumEntryPoints < 2: AutoGenC.Append(gMmStandaloneEntryPointString[NumEntryPoints].= Replace(Dict)) else: AutoGenC.Append(gMmStandaloneEntryPointString[2].Replace(Dict)) AutoGenH.Append(gMmStandaloneEntryPointPrototype.Replace(Dict)) - elif Info.ModuleType =3D=3D 'UEFI_APPLICATION': + elif Info.ModuleType =3D=3D SUP_MODULE_UEFI_APPLICATION: if NumEntryPoints < 2: AutoGenC.Append(gUefiApplicationEntryPointString[NumEntryPoint= s].Replace(Dict)) else: @@ -1599,7 +1599,7 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGe= nH): # @param AutoGenH The TemplateString object for header file # def CreateModuleUnloadImageCode(Info, AutoGenC, AutoGenH): - if Info.IsLibrary or Info.ModuleType in ['USER_DEFINED', 'SEC']: + if Info.IsLibrary or Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_= MODULE_SEC]: return # # Unload Image Handlers @@ -1619,7 +1619,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoG= enH): # @param AutoGenH The TemplateString object for header file # def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1643,7 +1643,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH= ): # @param AutoGenH The TemplateString object for header file # def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1667,7 +1667,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, Auto= GenH): # @param AutoGenH The TemplateString object for header file # def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" @@ -1704,7 +1704,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): # Add extern declarations to AutoGen.h if one or more Token Space GUID= s were found if TokenSpaceList: AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in = this module\n\n") - if Info.ModuleType in ["USER_DEFINED", "BASE"]: + if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: GuidType =3D "GUID" else: GuidType =3D "EFI_GUID" =20 diff --git a/BaseTools/Source/Python/AutoGen/GenDepex.py b/BaseTools/Source= /Python/AutoGen/GenDepex.py index 9acea8f6bfed..100f1250b31f 100644 --- a/BaseTools/Source/Python/AutoGen/GenDepex.py +++ b/BaseTools/Source/Python/AutoGen/GenDepex.py @@ -24,26 +24,27 @@ from Common.Misc import SaveFileOnChange from Common.Misc import GuidStructureStringToGuidString from Common import EdkLogger as EdkLogger from Common.BuildVersion import gBUILD_VERSION +from Common.DataType import * =20 ## Regular expression for matching "DEPENDENCY_START ... DEPENDENCY_END" gStartClosePattern =3D re.compile(".*DEPENDENCY_START(.+)DEPENDENCY_END.*"= , re.S) =20 ## Mapping between module type and EFI phase gType2Phase =3D { - "BASE" : None, - "SEC" : "PEI", - "PEI_CORE" : "PEI", - "PEIM" : "PEI", - "DXE_CORE" : "DXE", - "DXE_DRIVER" : "DXE", - "DXE_SMM_DRIVER" : "DXE", - "DXE_RUNTIME_DRIVER": "DXE", - "DXE_SAL_DRIVER" : "DXE", - "UEFI_DRIVER" : "DXE", - "UEFI_APPLICATION" : "DXE", - "SMM_CORE" : "DXE", - "MM_STANDALONE" : "MM", - "MM_CORE_STANDALONE" : "MM", + SUP_MODULE_BASE : None, + SUP_MODULE_SEC : "PEI", + SUP_MODULE_PEI_CORE : "PEI", + SUP_MODULE_PEIM : "PEI", + SUP_MODULE_DXE_CORE : "DXE", + SUP_MODULE_DXE_DRIVER : "DXE", + SUP_MODULE_DXE_SMM_DRIVER : "DXE", + SUP_MODULE_DXE_RUNTIME_DRIVER: "DXE", + SUP_MODULE_DXE_SAL_DRIVER : "DXE", + SUP_MODULE_UEFI_DRIVER : "DXE", + SUP_MODULE_UEFI_APPLICATION : "DXE", + SUP_MODULE_SMM_CORE : "DXE", + SUP_MODULE_MM_STANDALONE : "MM", + SUP_MODULE_MM_CORE_STANDALONE : "MM", } =20 ## Convert dependency expression string into EFI internal representation @@ -299,12 +300,12 @@ class DependencyExpression: NewOperand.append(Token) =20 # don't generate depex if only TRUE operand left - if self.ModuleType =3D=3D 'PEIM' and len(NewOperand) =3D=3D 1 and = NewOperand[0] =3D=3D 'TRUE': + if self.ModuleType =3D=3D SUP_MODULE_PEIM and len(NewOperand) =3D= =3D 1 and NewOperand[0] =3D=3D 'TRUE': self.PostfixNotation =3D [] return =20 # don't generate depex if all operands are architecture protocols - if self.ModuleType in ['UEFI_DRIVER', 'DXE_DRIVER', 'DXE_RUNTIME_D= RIVER', 'DXE_SAL_DRIVER', 'DXE_SMM_DRIVER', 'MM_STANDALONE'] and \ + if self.ModuleType in [SUP_MODULE_UEFI_DRIVER, SUP_MODULE_DXE_DRIV= ER, SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, SUP_MODULE_DX= E_SMM_DRIVER, SUP_MODULE_MM_STANDALONE] and \ Op =3D=3D 'AND' and \ self.ArchProtocols =3D=3D set([GuidStructureStringToGuidString(= Guid) for Guid in AllOperand]): self.PostfixNotation =3D [] diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 1e632f3abdbf..0bd55494df66 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -80,7 +80,7 @@ SUP_MODULE_LIST_STRING =3D TAB_VALUE_SPLIT.join(SUP_MODUL= E_LIST) =20 EDK_COMPONENT_TYPE_LIBRARY =3D 'LIBRARY' EDK_COMPONENT_TYPE_SECUARITY_CORE =3D 'SECUARITY_CORE' -EDK_COMPONENT_TYPE_PEI_CORE =3D 'PEI_CORE' +EDK_COMPONENT_TYPE_PEI_CORE =3D SUP_MODULE_PEI_CORE EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER =3D 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM =3D 'PIC_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM =3D 'RELOCATABLE_PEIM' diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index 27783e617b92..c0e8006dcc51 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -744,7 +744,7 @@ class Check(object): if Item not in LibraryClasses[List[0]]: LibraryClasses[List[0]].append(Item) =20 - if Record[2] !=3D 'BASE' and Record[2] not in SupModType: + if Record[2] !=3D SUP_MODULE_BASE and Record[2] not in Sup= ModType: EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FIL= E_CHECK_LIBRARY_INSTANCE_2, OtherMsg=3D"The Library Class '%s' does not spe= cify its supported module types" % (List[0]), BelongsToTable=3D'Inf', Belon= gsToItem=3DRecord[0]) =20 SqlCommand =3D """select A.ID, A.Value1, B.Value3 from Inf as = A left join Inf as B @@ -763,7 +763,7 @@ class Check(object): =20 for Record in RecordSet: if Record[1] in LibraryClasses: - if Record[2] not in LibraryClasses[Record[1]] and 'BAS= E' not in RecordDict[Record[1]]: + if Record[2] not in LibraryClasses[Record[1]] and SUP_= MODULE_BASE not in RecordDict[Record[1]]: if not EccGlobalData.gException.IsException(ERROR_= META_DATA_FILE_CHECK_LIBRARY_INSTANCE_1, Record[1]): EccGlobalData.gDb.TblReport.Insert(ERROR_META_= DATA_FILE_CHECK_LIBRARY_INSTANCE_1, OtherMsg=3D"The type of Library Class [= %s] defined in Inf file does not match the type of the module" % (Record[1]= ), BelongsToTable=3D'Inf', BelongsToItem=3DRecord[0]) else: diff --git a/BaseTools/Source/Python/GenFds/CompressSection.py b/BaseTools/= Source/Python/GenFds/CompressSection.py index 08ab48669f45..4ae14f27b3e1 100644 --- a/BaseTools/Source/Python/GenFds/CompressSection.py +++ b/BaseTools/Source/Python/GenFds/CompressSection.py @@ -21,6 +21,7 @@ import subprocess import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import CompressSectionClassObject +from Common.DataType import * =20 ## generate compress section # @@ -82,7 +83,7 @@ class CompressSection (CompressSectionClassObject) : OutputFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ Ffs.SectionSuffix['COMPRESS'] OutputFile =3D os.path.normpath(OutputFile) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Sour= ce/Python/GenFds/DataSection.py index 40e345eee77e..3c435c2fcc65 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -119,7 +119,7 @@ class DataSection (DataSectionClassObject): ) self.SectFileName =3D TeFile =20 - OutputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecN= um + Ffs.SectionSuffix.get(self.SecType)) + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_S= EC + SecNum + Ffs.SectionSuffix.get(self.SecType)) OutputFile =3D os.path.normpath(OutputFile) GenFdsGlobalVariable.GenerateSection(OutputFile, [self.SectFileNam= e], Section.Section.SectionType.get(self.SecType), IsMakefile =3D IsMakefil= e) FileList =3D [OutputFile] diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Sou= rce/Python/GenFds/DepexSection.py index 4ed1aa779292..d04160e890f1 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -25,6 +25,7 @@ from AutoGen.GenDepex import DependencyExpression from Common import EdkLogger from Common.BuildToolError import * from Common.Misc import PathClass +from Common.DataType import * =20 ## generate data section # @@ -94,24 +95,24 @@ class DepexSection (DepexSectionClassObject): self.ExpressionProcessed =3D True =20 if self.DepexType =3D=3D 'PEI_DEPEX_EXP': - ModuleType =3D 'PEIM' + ModuleType =3D SUP_MODULE_PEIM SecType =3D 'PEI_DEPEX' elif self.DepexType =3D=3D 'DXE_DEPEX_EXP': - ModuleType =3D 'DXE_DRIVER' + ModuleType =3D SUP_MODULE_DXE_DRIVER SecType =3D 'DXE_DEPEX' elif self.DepexType =3D=3D 'SMM_DEPEX_EXP': - ModuleType =3D 'DXE_SMM_DRIVER' + ModuleType =3D SUP_MODULE_DXE_SMM_DRIVER SecType =3D 'SMM_DEPEX' else: EdkLogger.error("GenFds", FORMAT_INVALID, "Depex type %s is not valid for module %s" % (= self.DepexType, ModuleName)) =20 - InputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecNu= m + '.depex') + InputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + '.depex') InputFile =3D os.path.normpath(InputFile) Depex =3D DependencyExpression(self.Expression, ModuleType) Depex.Generate(InputFile) =20 - OutputFile =3D os.path.join (OutputPath, ModuleName + 'SEC' + SecN= um + '.dpx') + OutputFile =3D os.path.join (OutputPath, ModuleName + SUP_MODULE_S= EC + SecNum + '.dpx') OutputFile =3D os.path.normpath(OutputFile) =20 GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Sect= ion.Section.SectionType.get (SecType), IsMakefile=3DIsMakefile) diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Sourc= e/Python/GenFds/EfiSection.py index 5bb1ae6f664c..1be23b4bf7fd 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -27,6 +27,7 @@ from Common.BuildToolError import * from Common.Misc import PeImageClass from Common.LongFilePathSupport import OpenLongFilePath as open from Common.LongFilePathSupport import CopyLongFilePath +from Common.DataType import * =20 ## generate rule section # @@ -66,7 +67,7 @@ class EfiSection (EfiSectionClassObject): StringData =3D FfsInf.__ExtendMacro__(self.StringData) ModuleNameStr =3D FfsInf.__ExtendMacro__('$(MODULE_NAME)') NoStrip =3D True - if FfsInf.ModuleType in ('SEC', 'PEI_CORE', 'PEIM') and Sectio= nType in ('TE', 'PE32'): + if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, = SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'): if FfsInf.KeepReloc is not None: NoStrip =3D FfsInf.KeepReloc elif FfsInf.KeepRelocFromRule is not None: @@ -122,7 +123,7 @@ class EfiSection (EfiSectionClassObject): BuildNumTuple =3D tuple() =20 Num =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DStringData, Ver=3DBuildNum, @@ -133,7 +134,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) f =3D open(File, 'r') VerString =3D f.read() f.close() @@ -162,7 +163,7 @@ class EfiSection (EfiSectionClassObject): else: EdkLogger.error("GenFds", GENFDS_ERROR, "File: %s = miss Version Section value" %InfFileName) Num =3D SecNum - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_VERSION', #Ui=3DVerString, Ver=3DBuildNum, @@ -183,7 +184,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -192,7 +193,7 @@ class EfiSection (EfiSectionClassObject): for File in FileList: Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join(OutputPath, ModuleName + '= SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join(OutputPath, ModuleName + S= UP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) f =3D open(File, 'r') UiString =3D f.read() f.close() @@ -216,7 +217,7 @@ class EfiSection (EfiSectionClassObject): Num =3D SecNum if IsMakefile and StringData =3D=3D ModuleNameStr: StringData =3D "$(MODULE_NAME)" - OutputFile =3D os.path.join( OutputPath, ModuleName + 'SEC= ' + str(Num) + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + SUP_= MODULE_SEC + str(Num) + Ffs.SectionSuffix.get(SectionType)) GenFdsGlobalVariable.GenerateSection(OutputFile, [], 'EFI_= SECTION_USER_INTERFACE', Ui=3DStringData, IsMa= kefile=3DIsMakefile) OutputFileList.append(OutputFile) @@ -237,7 +238,7 @@ class EfiSection (EfiSectionClassObject): """ Copy Map file to FFS output path """ Index =3D Index + 1 Num =3D '%s.%d' %(SecNum , Index) - OutputFile =3D os.path.join( OutputPath, ModuleName + = 'SEC' + Num + Ffs.SectionSuffix.get(SectionType)) + OutputFile =3D os.path.join( OutputPath, ModuleName + = SUP_MODULE_SEC + Num + Ffs.SectionSuffix.get(SectionType)) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict) =20 #Get PE Section alignment when align is set to AUTO diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index a106253527c4..4ec114a81883 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2633,7 +2633,7 @@ class FdfParser: # @staticmethod def __FileCouldHaveRelocFlag (FileType): - if FileType in ('SEC', 'PEI_CORE', 'PEIM', 'PEI_DXE_COMBO'): + if FileType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PE= IM, 'PEI_DXE_COMBO'): return True else: return False @@ -3633,12 +3633,12 @@ class FdfParser: =20 if not self.__GetNextWord(): raise Warning("expected Module type", self.FileName, self.Curr= entLineNumber) - if self.__Token.upper() not in ("SEC", "PEI_CORE", "PEIM", "DXE_CO= RE", \ - "DXE_DRIVER", "DXE_SAL_DRIVER", \ - "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ - "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFI= NED", "DEFAULT", "BASE", \ + if self.__Token.upper() not in (SUP_MODULE_SEC, SUP_MODULE_PEI_COR= E, SUP_MODULE_PEIM, SUP_MODULE_DXE_CORE, \ + SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRI= VER, \ + SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUN= TIME_DRIVER, \ + SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLI= CATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \ "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC= _PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE", "MM_STANDALON= E", "MM_CORE_STANDALONE"): + "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_= MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown Module type '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) return self.__Token =20 @@ -3680,8 +3680,8 @@ class FdfParser: raise Warning("expected FFS type", self.FileName, self.Current= LineNumber) =20 Type =3D self.__Token.strip().upper() - if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\ - "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLI= CATION", "FV_IMAGE", "SMM", "SMM_CORE", "MM_STANDALONE", "MM_CORE_STANDALON= E"): + if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_= CORE, SUP_MODULE_PEIM,\ + "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_COR= E, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STA= NDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown FV type '%s'" % self.__Token, self.File= Name, self.CurrentLineNumber) =20 if not self.__IsToken("=3D"): diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index a4178121118b..fc760ae8beda 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -16,6 +16,7 @@ # Import Modules # from CommonDataClass.FdfClass import FDClassObject +from Common.DataType import * =20 ## generate FFS # @@ -24,27 +25,27 @@ class Ffs(FDClassObject): =20 # mapping between MODULE type in FDF (from INF) and file type for GenF= fs ModuleTypeToFileType =3D { - 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', - 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', - 'PEIM' : 'EFI_FV_FILETYPE_PEIM', - 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', - 'DXE_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_SAL_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_SMM_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER', - 'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', - 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', - 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', - 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' + SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', + SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', + SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', + SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', + SUP_MODULE_DXE_DRIVER : 'EFI_FV_FILETYPE_DRIVER', + SUP_MODULE_DXE_SAL_DRIVER : 'EFI_FV_FILETYPE_DRIVER', + SUP_MODULE_DXE_SMM_DRIVER : 'EFI_FV_FILETYPE_DRIVER', + SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER', + SUP_MODULE_UEFI_DRIVER : 'EFI_FV_FILETYPE_DRIVER', + SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION', + SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', + SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', + SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALON= E' } =20 # mapping between FILE type in FDF and file type for GenFfs FdfFvFileTypeToFileType =3D { - 'SEC' : 'EFI_FV_FILETYPE_SECURITY_CORE', - 'PEI_CORE' : 'EFI_FV_FILETYPE_PEI_CORE', - 'PEIM' : 'EFI_FV_FILETYPE_PEIM', - 'DXE_CORE' : 'EFI_FV_FILETYPE_DXE_CORE', + SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', + SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', + SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', + SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', @@ -52,9 +53,9 @@ class Ffs(FDClassObject): 'RAW' : 'EFI_FV_FILETYPE_RAW', 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', 'SMM' : 'EFI_FV_FILETYPE_SMM', - 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE', - 'MM_STANDALONE' : 'EFI_FV_FILETYPE_MM_STANDALONE', - 'MM_CORE_STANDALONE' : 'EFI_FV_FILETYPE_MM_CORE_STANDALONE' + SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', + SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', + SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALON= E' } =20 # mapping between section type in FDF and file suffix diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index 37624f3fa9d4..d31d03d43a18 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -88,7 +88,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.FinalTargetSuffixMap.setdefault(os.path.splitext(File= )[1], []).append(File) =20 # Check if current INF module has DEPEX - if '.depex' not in self.FinalTargetSuffixMap and self.InfModul= e.ModuleType !=3D "USER_DEFINED" \ + if '.depex' not in self.FinalTargetSuffixMap and self.InfModul= e.ModuleType !=3D SUP_MODULE_USER_DEFINED \ and not self.InfModule.DxsFile and not self.InfModule.Libr= aryClass: ModuleType =3D self.InfModule.ModuleType PlatformDataBase =3D GenFdsGlobalVariable.WorkSpace.BuildO= bject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVa= riable.TargetName, GenFdsGlobalVariable.ToolChainTag] @@ -224,10 +224,10 @@ class FfsInfStatement(FfsInfStatementClassObject): if len(self.SourceFileList) !=3D 0 and not self.InDsc: EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in= DSC file; Is it really a binary module?" % (self.InfFileName)) =20 - if self.ModuleType =3D=3D 'SMM_CORE' and int(self.PiSpecVersion, 1= 6) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_SMM_CORE and int(self.PiSpecV= ersion, 16) < 0x0001000A: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE modu= le type can't be used in the module with PI_SPECIFICATION_VERSION less than= 0x0001000A", File=3Dself.InfFileName) =20 =20 - if self.ModuleType =3D=3D 'MM_CORE_STANDALONE' and int(self.PiSpec= Version, 16) < 0x00010032: + if self.ModuleType =3D=3D SUP_MODULE_MM_CORE_STANDALONE and int(se= lf.PiSpecVersion, 16) < 0x00010032: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "MM_CORE_STAND= ALONE module type can't be used in the module with PI_SPECIFICATION_VERSION= less than 0x00010032", File=3Dself.InfFileName) =20 if Inf._Defs is not None and len(Inf._Defs) > 0: @@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED # =20 - if FileType !=3D 'PE32' and self.ModuleType !=3D "USER_DEFINED": + if FileType !=3D 'PE32' and self.ModuleType !=3D SUP_MODULE_USER_D= EFINED: return EfiFile =20 # @@ -488,14 +488,14 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv File Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) >=3D 0x0001000A: if Rule.FvFileType =3D=3D 'DRIVER': Rule.FvFileType =3D 'SMM' # # Framework SMM Driver has no SMM FV file type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) < 0x0001000A: - if Rule.FvFileType =3D=3D 'SMM' or Rule.FvFileType =3D=3D 'SMM= _CORE': + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) < 0x0001000A: + if Rule.FvFileType =3D=3D 'SMM' or Rule.FvFileType =3D=3D SUP_= MODULE_SMM_CORE: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework= SMM module doesn't support SMM or SMM_CORE FV file type", File=3Dself.InfF= ileName) # # For the rule only has simpleFile @@ -738,17 +738,17 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv Section Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) >=3D 0x0001000A: if SectionType =3D=3D 'DXE_DEPEX': SectionType =3D 'SMM_DEPEX' # # Framework SMM Driver has no SMM_DEPEX section type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpecVers= ion, 16) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) < 0x0001000A: if SectionType =3D=3D 'SMM_DEPEX': EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework= SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFileNam= e) NoStrip =3D True - if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'): + if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MO= DULE_PEIM): if self.KeepReloc is not None: NoStrip =3D self.KeepReloc elif Rule.KeepReloc is not None: @@ -761,7 +761,7 @@ class FfsInfStatement(FfsInfStatementClassObject): =20 SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' += SecNum + Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum Index =3D Index + 1 OutputFile =3D os.path.join(self.OutputPath, GenSecOutputF= ile) File =3D GenFdsGlobalVariable.MacroExtend(File, Dict, self= .CurrentArch) @@ -804,7 +804,7 @@ class FfsInfStatement(FfsInfStatementClassObject): else: SecNum =3D '%d' %Index GenSecOutputFile=3D self.__ExtendMacro__(Rule.NameGuid) + \ - Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' += SecNum + Ffs.Ffs.SectionSuffix[SectionType] + SUP_MOD= ULE_SEC + SecNum OutputFile =3D os.path.join(self.OutputPath, GenSecOutputFile) GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(GenSecInp= utFile, Dict, self.CurrentArch) =20 @@ -902,7 +902,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # @retval string File name of the generated section file # def __GenComplexFileSection__(self, Rule, FvChildAddr, FvParentAddr, I= sMakefile =3D False): - if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'): + if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MO= DULE_PEIM): if Rule.KeepReloc is not None: self.KeepRelocFromRule =3D Rule.KeepReloc SectFiles =3D [] @@ -941,13 +941,13 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Convert Fv Section Type for PI1.1 SMM driver. # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpec= Version, 16) >=3D 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) >=3D 0x0001000A: if Sect.SectionType =3D=3D 'DXE_DEPEX': Sect.SectionType =3D 'SMM_DEPEX' # # Framework SMM Driver has no SMM_DEPEX section type # - if self.ModuleType =3D=3D 'DXE_SMM_DRIVER' and int(self.PiSpec= Version, 16) < 0x0001000A: + if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) < 0x0001000A: if Sect.SectionType =3D=3D 'SMM_DEPEX': EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Frame= work SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFil= eName) # diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/S= ource/Python/GenFds/FvImageSection.py index 5026a3ffca2f..eb84b44bbec4 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -24,6 +24,7 @@ import Common.LongFilePathOs as os from CommonDataClass.FdfClass import FvImageSectionClassObject from Common import EdkLogger from Common.BuildToolError import * +from Common.DataType import * =20 ## generate FV image section # @@ -74,7 +75,7 @@ class FvImageSection(FvImageSectionClassObject): if FvAlignmentValue > MaxFvAlignment: MaxFvAlignment =3D FvAlignmentValue =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC'= + Num + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_M= ODULE_SEC + Num + Ffs.SectionSuffix.get("FV_IMAGE")) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileNa= me], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 @@ -138,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject): # # Prepare the parameter of GenSection # - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + S= ecNum + Ffs.SectionSuffix.get("FV_IMAGE")) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODUL= E_SEC + SecNum + Ffs.SectionSuffix.get("FV_IMAGE")) GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName],= 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=3DIsMakefile) OutputFileList.append(OutputFile) =20 diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py b/BaseTools/Sour= ce/Python/GenFds/GuidSection.py index 08665a3d4d49..1105689e0d79 100644 --- a/BaseTools/Source/Python/GenFds/GuidSection.py +++ b/BaseTools/Source/Python/GenFds/GuidSection.py @@ -28,6 +28,7 @@ from Common.BuildToolError import * from FvImageSection import FvImageSection from Common.LongFilePathSupport import OpenLongFilePath as open from GenFds import FindExtendTool +from Common.DataType import * =20 ## generate GUIDed section # @@ -121,7 +122,7 @@ class GuidSection(GuidSectionClassObject) : OutputFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ Ffs.SectionSuffix['GUIDED'] OutputFile =3D os.path.normpath(OutputFile) @@ -156,7 +157,7 @@ class GuidSection(GuidSectionClassObject) : TempFile =3D OutputPath + \ os.sep + \ ModuleName + \ - 'SEC' + \ + SUP_MODULE_SEC + \ SecNum + \ '.tmp' TempFile =3D os.path.normpath(TempFile) diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source= /Python/GenFds/UiSection.py index 6340520602ee..084f761e1285 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -22,6 +22,7 @@ import Common.LongFilePathOs as os from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import UiSectionClassObject from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.DataType import SUP_MODULE_SEC =20 ## generate UI section # @@ -57,7 +58,7 @@ class UiSection (UiSectionClassObject): self.StringData =3D FfsInf.__ExtendMacro__(self.StringData) self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + 'SEC' + SecNu= m + Ffs.SectionSuffix.get('UI')) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + Ffs.SectionSuffix.get('UI')) =20 if self.StringData is not None : NameString =3D self.StringData diff --git a/BaseTools/Source/Python/GenFds/VerSection.py b/BaseTools/Sourc= e/Python/GenFds/VerSection.py index 11e974b9936e..456a430079bb 100644 --- a/BaseTools/Source/Python/GenFds/VerSection.py +++ b/BaseTools/Source/Python/GenFds/VerSection.py @@ -22,6 +22,7 @@ import subprocess from GenFdsGlobalVariable import GenFdsGlobalVariable from CommonDataClass.FdfClass import VerSectionClassObject from Common.LongFilePathSupport import OpenLongFilePath as open +from Common.DataType import SUP_MODULE_SEC =20 ## generate version section # @@ -59,7 +60,7 @@ class VerSection (VerSectionClassObject): self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 OutputFile =3D os.path.join(OutputPath, - ModuleName + 'SEC' + SecNum + Ffs.Sectio= nSuffix.get('VERSION')) + ModuleName + SUP_MODULE_SEC + SecNum + F= fs.SectionSuffix.get('VERSION')) OutputFile =3D os.path.normpath(OutputFile) =20 # Get String Data diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index a725a2a2a772..f2d36d0ee0d4 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -68,22 +68,22 @@ class InfBuildData(ModuleBuildClassObject): =20 # dict used to convert Component type to Module type _MODULE_TYPE_ =3D { - "LIBRARY" : "BASE", - "SECURITY_CORE" : "SEC", - "PEI_CORE" : "PEI_CORE", - "COMBINED_PEIM_DRIVER" : "PEIM", - "PIC_PEIM" : "PEIM", - "RELOCATABLE_PEIM" : "PEIM", - "PE32_PEIM" : "PEIM", - "BS_DRIVER" : "DXE_DRIVER", - "RT_DRIVER" : "DXE_RUNTIME_DRIVER", - "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", - "DXE_SMM_DRIVER" : "DXE_SMM_DRIVER", - # "SMM_DRIVER" : "DXE_SMM_DRIVER", - # "BS_DRIVER" : "DXE_SMM_DRIVER", - # "BS_DRIVER" : "UEFI_DRIVER", - "APPLICATION" : "UEFI_APPLICATION", - "LOGO" : "BASE", + "LIBRARY" : SUP_MODULE_BASE, + "SECURITY_CORE" : SUP_MODULE_SEC, + SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, + "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, + "PIC_PEIM" : SUP_MODULE_PEIM, + "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, + "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, + "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, + SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER, + # "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, + # "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, + # "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER, + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } =20 # regular expression for converting XXX_FLAGS in [nmake] section to ne= w type @@ -461,9 +461,9 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if self._ModuleType is None: - self._ModuleType =3D 'BASE' + self._ModuleType =3D SUP_MODULE_BASE if self._ModuleType not in SUP_MODULE_LIST: - self._ModuleType =3D "USER_DEFINED" + self._ModuleType =3D SUP_MODULE_USER_DEFINED return self._ModuleType =20 ## Retrieve COMPONENT_TYPE @@ -472,7 +472,7 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if self._ComponentType is None: - self._ComponentType =3D 'USER_DEFINED' + self._ComponentType =3D SUP_MODULE_USER_DEFINED return self._ComponentType =20 ## Retrieve "BUILD_TYPE" @@ -481,7 +481,7 @@ class InfBuildData(ModuleBuildClassObject): if self._Header_ is None: self._GetHeaderInfo() if not self._BuildType: - self._BuildType =3D "BASE" + self._BuildType =3D SUP_MODULE_BASE return self._BuildType =20 ## Retrieve file guid @@ -899,14 +899,14 @@ class InfBuildData(ModuleBuildClassObject): =20 # PEIM and DXE drivers must have a valid [Depex] section if len(self.LibraryClass) =3D=3D 0 and len(RecordList) =3D=3D = 0: - if self.ModuleType =3D=3D 'DXE_DRIVER' or self.ModuleType = =3D=3D 'PEIM' or self.ModuleType =3D=3D 'DXE_SMM_DRIVER' or \ - self.ModuleType =3D=3D 'DXE_SAL_DRIVER' or self.Module= Type =3D=3D 'DXE_RUNTIME_DRIVER': + if self.ModuleType =3D=3D SUP_MODULE_DXE_DRIVER or self.Mo= duleType =3D=3D SUP_MODULE_PEIM or self.ModuleType =3D=3D SUP_MODULE_DXE_SM= M_DRIVER or \ + self.ModuleType =3D=3D SUP_MODULE_DXE_SAL_DRIVER or se= lf.ModuleType =3D=3D SUP_MODULE_DXE_RUNTIME_DRIVER: EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, "No [= Depex] section or no valid expression in [Depex] section for [%s] module" \ % self.ModuleType, File=3Dself.MetaFil= e) =20 - if len(RecordList) !=3D 0 and self.ModuleType =3D=3D 'USER_DEF= INED': + if len(RecordList) !=3D 0 and self.ModuleType =3D=3D SUP_MODUL= E_USER_DEFINED: for Record in RecordList: - if Record[4] not in ['PEIM', 'DXE_DRIVER', 'DXE_SMM_DR= IVER']: + if Record[4] not in [SUP_MODULE_PEIM, SUP_MODULE_DXE_D= RIVER, SUP_MODULE_DXE_SMM_DRIVER]: EdkLogger.error('build', FORMAT_INVALID, "'%s' module must specify the type= of [Depex] section" % self.ModuleType, File=3Dself.MetaFile) diff --git a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py b/BaseToo= ls/Source/Python/Workspace/WorkspaceCommon.py index 736ef6253453..573100081815 100644 --- a/BaseTools/Source/Python/Workspace/WorkspaceCommon.py +++ b/BaseTools/Source/Python/Workspace/WorkspaceCommon.py @@ -134,7 +134,7 @@ def _GetModuleLibraryInstances(Module, Platform, BuildD= atabase, Arch, Target, To LibraryModule.LibraryClass.append(LibraryClassObject(L= ibraryClassName, [ModuleType])) elif LibraryModule.LibraryClass is None \ or len(LibraryModule.LibraryClass) =3D=3D 0 \ - or (ModuleType !=3D 'USER_DEFINED' + or (ModuleType !=3D SUP_MODULE_USER_DEFINED and ModuleType not in LibraryModule.LibraryClass[= 0].SupModList): # only USER_DEFINED can link against any library insta= nce despite of its SupModList return [] diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 635c311f1a48..2dfd78cb9538 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -48,18 +48,18 @@ import collections from Common.Expression import * =20 gComponentType2ModuleType =3D { - "LIBRARY" : "BASE", - "SECURITY_CORE" : "SEC", - "PEI_CORE" : "PEI_CORE", - "COMBINED_PEIM_DRIVER" : "PEIM", - "PIC_PEIM" : "PEIM", - "RELOCATABLE_PEIM" : "PEIM", - "PE32_PEIM" : "PEIM", - "BS_DRIVER" : "DXE_DRIVER", - "RT_DRIVER" : "DXE_RUNTIME_DRIVER", - "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", - "APPLICATION" : "UEFI_APPLICATION", - "LOGO" : "BASE", + "LIBRARY" : SUP_MODULE_BASE, + "SECURITY_CORE" : SUP_MODULE_SEC, + SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, + "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, + "PIC_PEIM" : SUP_MODULE_PEIM, + "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, + "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, + "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, } =20 ## Pattern to extract contents in EDK DXS files @@ -122,20 +122,20 @@ gPcdTypeMap =3D { =20 ## The look up table to map module type to driver type gDriverTypeMap =3D { - 'SEC' : '0x3 (SECURITY_CORE)', - 'PEI_CORE' : '0x4 (PEI_CORE)', - 'PEIM' : '0x6 (PEIM)', - 'DXE_CORE' : '0x5 (DXE_CORE)', - 'DXE_DRIVER' : '0x7 (DRIVER)', - 'DXE_SAL_DRIVER' : '0x7 (DRIVER)', - 'DXE_SMM_DRIVER' : '0x7 (DRIVER)', - 'DXE_RUNTIME_DRIVER': '0x7 (DRIVER)', - 'UEFI_DRIVER' : '0x7 (DRIVER)', - 'UEFI_APPLICATION' : '0x9 (APPLICATION)', - 'SMM_CORE' : '0xD (SMM_CORE)', + SUP_MODULE_SEC : '0x3 (SECURITY_CORE)', + SUP_MODULE_PEI_CORE : '0x4 (PEI_CORE)', + SUP_MODULE_PEIM : '0x6 (PEIM)', + SUP_MODULE_DXE_CORE : '0x5 (DXE_CORE)', + SUP_MODULE_DXE_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_SAL_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_SMM_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_DXE_RUNTIME_DRIVER: '0x7 (DRIVER)', + SUP_MODULE_UEFI_DRIVER : '0x7 (DRIVER)', + SUP_MODULE_UEFI_APPLICATION : '0x9 (APPLICATION)', + SUP_MODULE_SMM_CORE : '0xD (SMM_CORE)', 'SMM_DRIVER' : '0xA (SMM)', # Extension of module type to support= PI 1.1 SMM drivers - 'MM_STANDALONE' : '0xE (MM_STANDALONE)', - 'MM_CORE_STANDALONE' : '0xF (MM_CORE_STANDALONE)' + SUP_MODULE_MM_STANDALONE : '0xE (MM_STANDALONE)', + SUP_MODULE_MM_CORE_STANDALONE : '0xF (MM_CORE_STANDALONE)' } =20 ## The look up table of the supported opcode in the dependency expression = binaries @@ -424,7 +424,7 @@ class DepexReport(object): if not ModuleType: ModuleType =3D gComponentType2ModuleType.get(M.ComponentType, = "") =20 - if ModuleType in ["SEC", "PEI_CORE", "DXE_CORE", "SMM_CORE", "MM_C= ORE_STANDALONE", "UEFI_APPLICATION"]: + if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_= DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UE= FI_APPLICATION]: return =20 for Source in M.SourceFileList: @@ -591,7 +591,7 @@ class ModuleReport(object): # # If a module complies to PI 1.1, promote Module type to "SMM_= DRIVER" # - if ModuleType =3D=3D "DXE_SMM_DRIVER": + if ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER: PiSpec =3D M.Module.Specification.get("PI_SPECIFICATION_VE= RSION", "0x00010000") if int(PiSpec, 0) >=3D 0x0001000A: ModuleType =3D "SMM_DRIVER" @@ -1382,7 +1382,7 @@ class PredictionReport(object): # their source code to find PPI/Protocol produce or consume # information. # - if Module.ModuleType =3D=3D "BASE": + if Module.ModuleType =3D=3D SUP_MODULE_BASE: continue # # Add module referenced source files diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 36bb1fecf7e5..81d59dd3eedf 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1587,22 +1587,22 @@ class Build(): if not ImageClass.IsValid: EdkLogger.error("build", FILE_PARSE_FAILURE, Extra= Data=3DImageClass.ErrorInfo) ImageInfo =3D PeImageInfo(Module.Name, Module.Guid, Mo= dule.Arch, Module.OutputDir, Module.DebugDir, ImageClass) - if Module.ModuleType in ['PEI_CORE', 'PEIM', 'COMBINED= _PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', 'DXE_CORE']: + if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODU= LE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE= _DXE_CORE]: PeiModuleList[Module.MetaFile] =3D ImageInfo PeiSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['BS_DRIVER', 'DXE_DRIVER', = 'UEFI_DRIVER']: + elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE= _DRIVER, SUP_MODULE_UEFI_DRIVER]: BtModuleList[Module.MetaFile] =3D ImageInfo BtSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['DXE_RUNTIME_DRIVER', 'RT_D= RIVER', 'DXE_SAL_DRIVER', 'SAL_RT_DRIVER']: + elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIV= ER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']: RtModuleList[Module.MetaFile] =3D ImageInfo #IPF runtime driver needs to be at 2 page alignmen= t. if IsIpfPlatform and ImageInfo.Image.Size % 0x2000= !=3D 0: ImageInfo.Image.Size =3D (ImageInfo.Image.Size= / 0x2000 + 1) * 0x2000 RtSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['SMM_CORE', 'DXE_SMM_DRIVER= ', 'MM_STANDALONE', 'MM_CORE_STANDALONE']: + elif Module.ModuleType in [SUP_MODULE_SMM_CORE, SUP_MO= DULE_DXE_SMM_DRIVER, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALON= E]: SmmModuleList[Module.MetaFile] =3D ImageInfo SmmSize +=3D ImageInfo.Image.Size - if Module.ModuleType =3D=3D 'DXE_SMM_DRIVER': + if Module.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRI= VER: PiSpecVersion =3D Module.Module.Specification.= get('PI_SPECIFICATION_VERSION', '0x00000000') # for PI specification < PI1.1, DXE_SMM_DRIVER= also runs as BOOT time driver. if int(PiSpecVersion, 16) < 0x0001000A: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239565650693.6906258568383; Fri, 20 Apr 2018 08:52:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B262522512158; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1894B2272960F for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811588" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:34 -0700 Message-Id: <0b41afa05a1cb9805122cec7cd54a58fee8319c5.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 14/27] BaseTools: Define and use a set for common list X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" share a set for both PEI module types Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++-- BaseTools/Source/Python/AutoGen/GenC.py | 8 ++++---- BaseTools/Source/Python/Common/DataType.py | 1 + 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 9c3bf864e360..60088c87a03b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -1431,7 +1431,7 @@ class PlatformAutoGen(AutoGen): # used by DXE module, it should be stored in DXE PCD d= atabase. # The default Phase is DXE # - if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: + if M.ModuleType in SUP_MODULE_SET_PEI: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_: self._DynaPcdList_.append(PcdFromModule) @@ -1473,7 +1473,7 @@ class PlatformAutoGen(AutoGen): # make sure that the "VOID*" kind of datum has MaxDatu= mSize set if PcdFromModule.DatumType =3D=3D "VOID*" and PcdFromM= odule.MaxDatumSize in [None, '']: NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) - if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CO= RE]: + if M.ModuleType in SUP_MODULE_SET_PEI: PcdFromModule.Phase =3D "PEI" if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in GenC.gDynamicExPcd: self._DynaPcdList_.append(PcdFromModule) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 7bc352274e66..57ff699a968a 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1411,7 +1411,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: ConstructorPrototypeString.Append(gLibraryStructorPrototype[SU= P_MODULE_BASE].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODUL= E_BASE].Replace(Dict)) - elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: + elif Lib.ModuleType in SUP_MODULE_SET_PEI: ConstructorPrototypeString.Append(gLibraryStructorPrototype['P= EI'].Replace(Dict)) ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Re= place(Dict)) elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, @@ -1441,7 +1441,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, Auto= GenH): else: if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) - elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: + elif Info.ModuleType in SUP_MODULE_SET_PEI: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: @@ -1473,7 +1473,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP= _MODULE_BASE].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE= _BASE].Replace(Dict)) - elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: + elif Lib.ModuleType in SUP_MODULE_SET_PEI: DestructorPrototypeString.Append(gLibraryStructorPrototype['PE= I'].Replace(Dict)) DestructorCallingString.Append(gLibraryStructorCall['PEI'].Rep= lace(Dict)) elif Lib.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,= SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, @@ -1503,7 +1503,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoG= enH): else: if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]: AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict)) - elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]: + elif Info.ModuleType in SUP_MODULE_SET_PEI: AutoGenC.Append(gLibraryString['PEI'].Replace(Dict)) elif Info.ModuleType in [SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER= ,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI= _DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]: diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 0bd55494df66..06e8defcf927 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -77,6 +77,7 @@ SUP_MODULE_LIST =3D [SUP_MODULE_BASE, SUP_MODULE_SEC, SUP= _MODULE_PEI_CORE, SUP_MOD SUP_MODULE_DXE_RUNTIME_DRIVER, SUP_MODULE_DXE_SAL_DRIVE= R, SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_UEFI_DRIVER, \ SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, S= UP_MODULE_SMM_CORE, SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE] SUP_MODULE_LIST_STRING =3D TAB_VALUE_SPLIT.join(SUP_MODULE_LIST) +SUP_MODULE_SET_PEI =3D {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE} =20 EDK_COMPONENT_TYPE_LIBRARY =3D 'LIBRARY' EDK_COMPONENT_TYPE_SECUARITY_CORE =3D 'SECUARITY_CORE' --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239590818850.5478413565037; Fri, 20 Apr 2018 08:53:10 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DC3182279CEED; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 6A34F226EA5A1 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811589" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:35 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 15/27] BaseTools: Share a dictionary instead of keeping multiples X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Move a dictionary to a shared location and use from there Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/DataType.py | 15 ++++++++++++ BaseTools/Source/Python/Workspace/InfBuildData.py | 24 ++------------------ BaseTools/Source/Python/build/BuildReport.py | 19 ++-------------- 3 files changed, 19 insertions(+), 39 deletions(-) diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 06e8defcf927..ab9acb417331 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -92,6 +92,21 @@ EDK_COMPONENT_TYPE_APPLICATION =3D 'APPLICATION' EDK_NAME =3D 'EDK' EDKII_NAME =3D 'EDKII' =20 +COMPONENT_TO_MODULE_MAP_DICT =3D { + "LIBRARY" : SUP_MODULE_BASE, + "SECURITY_CORE" : SUP_MODULE_SEC, + SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, + "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, + "PIC_PEIM" : SUP_MODULE_PEIM, + "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, + "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, + "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, + "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, + "LOGO" : SUP_MODULE_BASE, +} + BINARY_FILE_TYPE_FW =3D 'FW' BINARY_FILE_TYPE_GUID =3D 'GUID' BINARY_FILE_TYPE_PREEFORM =3D 'PREEFORM' diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index f2d36d0ee0d4..d64a281a98f7 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -66,26 +66,6 @@ class InfBuildData(ModuleBuildClassObject): TAB_COMPONENTS_SOURCE_OVERRIDE_PATH : "_SourceOverridePath= ", } =20 - # dict used to convert Component type to Module type - _MODULE_TYPE_ =3D { - "LIBRARY" : SUP_MODULE_BASE, - "SECURITY_CORE" : SUP_MODULE_SEC, - SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, - "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, - "PIC_PEIM" : SUP_MODULE_PEIM, - "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, - "PE32_PEIM" : SUP_MODULE_PEIM, - "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, - "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, - "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, - SUP_MODULE_DXE_SMM_DRIVER : SUP_MODULE_DXE_SMM_DRIVER, - # "SMM_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, - # "BS_DRIVER" : SUP_MODULE_DXE_SMM_DRIVER, - # "BS_DRIVER" : SUP_MODULE_UEFI_DRIVER, - "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, - "LOGO" : SUP_MODULE_BASE, - } - # regular expression for converting XXX_FLAGS in [nmake] section to ne= w type _NMAKE_FLAG_PATTERN_ =3D re.compile("(?:EBC_)?([A-Z]+)_(?:STD_|PROJ_|A= RCH_)?FLAGS(?:_DLL|_ASL|_EXE)?", re.UNICODE) # dict used to convert old tool name used in [nmake] section to new on= es @@ -362,8 +342,8 @@ class InfBuildData(ModuleBuildClassObject): EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "COMPONENT_TYPE is not given", File=3Dself= .MetaFile) self._BuildType =3D self._ComponentType.upper() - if self._ComponentType in self._MODULE_TYPE_: - self._ModuleType =3D self._MODULE_TYPE_[self._ComponentTyp= e] + if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT: + self._ModuleType =3D COMPONENT_TO_MODULE_MAP_DICT[self._Co= mponentType] if self._ComponentType =3D=3D 'LIBRARY': self._LibraryClass =3D [LibraryClassObject(self._BaseName,= SUP_MODULE_LIST)] # make use some [nmake] section macros diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 2dfd78cb9538..5846c2870d2e 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -47,21 +47,6 @@ from Common.DataType import * import collections from Common.Expression import * =20 -gComponentType2ModuleType =3D { - "LIBRARY" : SUP_MODULE_BASE, - "SECURITY_CORE" : SUP_MODULE_SEC, - SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, - "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, - "PIC_PEIM" : SUP_MODULE_PEIM, - "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, - "PE32_PEIM" : SUP_MODULE_PEIM, - "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, - "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, - "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, - "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, - "LOGO" : SUP_MODULE_BASE, -} - ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern =3D re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END"= , re.DOTALL) =20 @@ -422,7 +407,7 @@ class DepexReport(object): self._DepexFileName =3D os.path.join(M.BuildDir, "OUTPUT", M.Modul= e.BaseName + ".depex") ModuleType =3D M.ModuleType if not ModuleType: - ModuleType =3D gComponentType2ModuleType.get(M.ComponentType, = "") + ModuleType =3D COMPONENT_TO_MODULE_MAP_DICT.get(M.ComponentTyp= e, "") =20 if ModuleType in [SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_= DXE_CORE, SUP_MODULE_SMM_CORE, SUP_MODULE_MM_CORE_STANDALONE, SUP_MODULE_UE= FI_APPLICATION]: return @@ -587,7 +572,7 @@ class ModuleReport(object): if not M.IsLibrary: ModuleType =3D M.ModuleType if not ModuleType: - ModuleType =3D gComponentType2ModuleType.get(M.ComponentTy= pe, "") + ModuleType =3D COMPONENT_TO_MODULE_MAP_DICT.get(M.Componen= tType, "") # # If a module complies to PI 1.1, promote Module type to "SMM_= DRIVER" # --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239569254851.0975849099524; Fri, 20 Apr 2018 08:52:49 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 11C942274F3C7; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 24E8B22742AA5 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811592" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:36 -0700 Message-Id: <7ca2c5bf88ad69bc5ae86b73ee1aa696792c5794.1524239027.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 16/27] BaseTools: Replace EDK Component strings with predefined constant X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY' EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE' EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM' EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM' EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER' EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER' EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER' EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION' Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Common/DataType.py | 28 ++++++++++---------- BaseTools/Source/Python/GenFds/FdfParser.py | 6 ++--- BaseTools/Source/Python/GenFds/Ffs.py | 2 +- BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/build/BuildReport.py | 6 ++--- BaseTools/Source/Python/build/build.py | 8 +++--- 6 files changed, 26 insertions(+), 26 deletions(-) diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index ab9acb417331..74ed711abc52 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -80,7 +80,7 @@ SUP_MODULE_LIST_STRING =3D TAB_VALUE_SPLIT.join(SUP_MODUL= E_LIST) SUP_MODULE_SET_PEI =3D {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE} =20 EDK_COMPONENT_TYPE_LIBRARY =3D 'LIBRARY' -EDK_COMPONENT_TYPE_SECUARITY_CORE =3D 'SECUARITY_CORE' +EDK_COMPONENT_TYPE_SECURITY_CORE =3D 'SECURITY_CORE' EDK_COMPONENT_TYPE_PEI_CORE =3D SUP_MODULE_PEI_CORE EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER =3D 'COMBINED_PEIM_DRIVER' EDK_COMPONENT_TYPE_PIC_PEIM =3D 'PIC_PEIM' @@ -93,18 +93,18 @@ EDK_NAME =3D 'EDK' EDKII_NAME =3D 'EDKII' =20 COMPONENT_TO_MODULE_MAP_DICT =3D { - "LIBRARY" : SUP_MODULE_BASE, - "SECURITY_CORE" : SUP_MODULE_SEC, - SUP_MODULE_PEI_CORE : SUP_MODULE_PEI_CORE, - "COMBINED_PEIM_DRIVER" : SUP_MODULE_PEIM, - "PIC_PEIM" : SUP_MODULE_PEIM, - "RELOCATABLE_PEIM" : SUP_MODULE_PEIM, - "PE32_PEIM" : SUP_MODULE_PEIM, - "BS_DRIVER" : SUP_MODULE_DXE_DRIVER, - "RT_DRIVER" : SUP_MODULE_DXE_RUNTIME_DRIVER, - "SAL_RT_DRIVER" : SUP_MODULE_DXE_SAL_DRIVER, - "APPLICATION" : SUP_MODULE_UEFI_APPLICATION, - "LOGO" : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_LIBRARY : SUP_MODULE_BASE, + EDK_COMPONENT_TYPE_SECURITY_CORE : SUP_MODULE_SEC, + EDK_COMPONENT_TYPE_PEI_CORE : SUP_MODULE_PEI_CORE, + EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_PIC_PEIM : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_RELOCATABLE_PEIM : SUP_MODULE_PEIM, + "PE32_PEIM" : SUP_MODULE_PEIM, + EDK_COMPONENT_TYPE_BS_DRIVER : SUP_MODULE_DXE_DRIVER, + EDK_COMPONENT_TYPE_RT_DRIVER : SUP_MODULE_DXE_RUNTIME_DR= IVER, + EDK_COMPONENT_TYPE_SAL_RT_DRIVER : SUP_MODULE_DXE_SAL_DRIVER, + EDK_COMPONENT_TYPE_APPLICATION : SUP_MODULE_UEFI_APPLICATI= ON, + "LOGO" : SUP_MODULE_BASE, } =20 BINARY_FILE_TYPE_FW =3D 'FW' @@ -125,7 +125,7 @@ BINARY_FILE_TYPE_UI =3D 'UI' BINARY_FILE_TYPE_BIN =3D 'BIN' BINARY_FILE_TYPE_FV =3D 'FV' =20 -PLATFORM_COMPONENT_TYPE_LIBRARY =3D 'LIBRARY' +PLATFORM_COMPONENT_TYPE_LIBRARY =3D EDK_COMPONENT_TYPE_LIBRARY PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS =3D 'LIBRARY_CLASS' PLATFORM_COMPONENT_TYPE_MODULE =3D 'MODULE' =20 diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 4ec114a81883..e117a3717d42 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -3637,8 +3637,8 @@ class FdfParser: SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRI= VER, \ SUP_MODULE_DXE_SMM_DRIVER, SUP_MODULE_DXE_RUN= TIME_DRIVER, \ SUP_MODULE_UEFI_DRIVER, SUP_MODULE_UEFI_APPLI= CATION, SUP_MODULE_USER_DEFINED, "DEFAULT", SUP_MODULE_BASE, \ - "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC= _PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIV= ER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_= MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): + EDK_COMPONENT_TYPE_SECURITY_CORE, EDK_COMPONE= NT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, EDK_COMPONENT_TY= PE_RELOCATABLE_PEIM, \ + "PE32_PEIM", EDK_COMPONENT_TYPE_BS= _DRIVER, EDK_COMPONENT_TYPE_RT_DRIVER, EDK_COMPONENT_TYPE_SAL_RT_DRIVER, ED= K_COMPONENT_TYPE_APPLICATION, "ACPITABLE", SUP_MODULE_SMM_CORE, SUP_MODULE_= MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown Module type '%s'" % self.__Token, self.= FileName, self.CurrentLineNumber) return self.__Token =20 @@ -3681,7 +3681,7 @@ class FdfParser: =20 Type =3D self.__Token.strip().upper() if Type not in ("RAW", "FREEFORM", SUP_MODULE_SEC, SUP_MODULE_PEI_= CORE, SUP_MODULE_PEIM,\ - "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_COR= E, "APPLICATION", "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, SUP_MODULE_MM_STA= NDALONE, SUP_MODULE_MM_CORE_STANDALONE): + "PEI_DXE_COMBO", "DRIVER", SUP_MODULE_DXE_COR= E, EDK_COMPONENT_TYPE_APPLICATION, "FV_IMAGE", "SMM", SUP_MODULE_SMM_CORE, = SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE): raise Warning("Unknown FV type '%s'" % self.__Token, self.File= Name, self.CurrentLineNumber) =20 if not self.__IsToken("=3D"): diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index fc760ae8beda..f15d2330ce58 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -48,7 +48,7 @@ class Ffs(FDClassObject): SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', 'FREEFORM' : 'EFI_FV_FILETYPE_FREEFORM', 'DRIVER' : 'EFI_FV_FILETYPE_DRIVER', - 'APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', + EDK_COMPONENT_TYPE_APPLICATION : 'EFI_FV_FILETYPE_APPLICATIO= N', 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', 'RAW' : 'EFI_FV_FILETYPE_RAW', 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index d64a281a98f7..27ef163eb40c 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -344,7 +344,7 @@ class InfBuildData(ModuleBuildClassObject): self._BuildType =3D self._ComponentType.upper() if self._ComponentType in COMPONENT_TO_MODULE_MAP_DICT: self._ModuleType =3D COMPONENT_TO_MODULE_MAP_DICT[self._Co= mponentType] - if self._ComponentType =3D=3D 'LIBRARY': + if self._ComponentType =3D=3D EDK_COMPONENT_TYPE_LIBRARY: self._LibraryClass =3D [LibraryClassObject(self._BaseName,= SUP_MODULE_LIST)] # make use some [nmake] section macros Macros =3D self._Macros diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 5846c2870d2e..02e01a1fa2ab 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -599,7 +599,7 @@ class ModuleReport(object): self.ModulePcdSet.setdefault((Pcd.TokenCName, Pcd.TokenSpa= ceGuidCName, Pcd.Type), (Pcd.InfDefaultValue, Pcd.DefaultValue)) =20 self.LibraryReport =3D None - if "LIBRARY" in ReportType: + if EDK_COMPONENT_TYPE_LIBRARY in ReportType: self.LibraryReport =3D LibraryReport(M) =20 self.DepexReport =3D None @@ -702,7 +702,7 @@ class ModuleReport(object): if "PCD" in ReportType: GlobalPcdReport.GenerateReport(File, self.ModulePcdSet) =20 - if "LIBRARY" in ReportType: + if EDK_COMPONENT_TYPE_LIBRARY in ReportType: self.LibraryReport.GenerateReport(File) =20 if "DEPEX" in ReportType: @@ -2097,7 +2097,7 @@ class BuildReport(object): if ReportTypeItem not in self.ReportType: self.ReportType.append(ReportTypeItem) else: - self.ReportType =3D ["PCD", "LIBRARY", "BUILD_FLAGS", "DEP= EX", "HASH", "FLASH", "FIXED_ADDRESS"] + self.ReportType =3D ["PCD", EDK_COMPONENT_TYPE_LIBRARY, "B= UILD_FLAGS", "DEPEX", "HASH", "FLASH", "FIXED_ADDRESS"] ## # Adds platform report to the list # diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 81d59dd3eedf..29ad0c7228c7 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1587,13 +1587,13 @@ class Build(): if not ImageClass.IsValid: EdkLogger.error("build", FILE_PARSE_FAILURE, Extra= Data=3DImageClass.ErrorInfo) ImageInfo =3D PeImageInfo(Module.Name, Module.Guid, Mo= dule.Arch, Module.OutputDir, Module.DebugDir, ImageClass) - if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODU= LE_PEIM, 'COMBINED_PEIM_DRIVER', 'PIC_PEIM', 'RELOCATABLE_PEIM', SUP_MODULE= _DXE_CORE]: + if Module.ModuleType in [SUP_MODULE_PEI_CORE, SUP_MODU= LE_PEIM, EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PE= IM, EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, SUP_MODULE_DXE_CORE]: PeiModuleList[Module.MetaFile] =3D ImageInfo PeiSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in ['BS_DRIVER', SUP_MODULE_DXE= _DRIVER, SUP_MODULE_UEFI_DRIVER]: + elif Module.ModuleType in [EDK_COMPONENT_TYPE_BS_DRIVE= R, SUP_MODULE_DXE_DRIVER, SUP_MODULE_UEFI_DRIVER]: BtModuleList[Module.MetaFile] =3D ImageInfo BtSize +=3D ImageInfo.Image.Size - elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIV= ER, 'RT_DRIVER', SUP_MODULE_DXE_SAL_DRIVER, 'SAL_RT_DRIVER']: + elif Module.ModuleType in [SUP_MODULE_DXE_RUNTIME_DRIV= ER, EDK_COMPONENT_TYPE_RT_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, EDK_COMPONENT_= TYPE_SAL_RT_DRIVER]: RtModuleList[Module.MetaFile] =3D ImageInfo #IPF runtime driver needs to be at 2 page alignmen= t. if IsIpfPlatform and ImageInfo.Image.Size % 0x2000= !=3D 0: @@ -2356,7 +2356,7 @@ def MyOptionParser(): Parser.add_option("-D", "--define", action=3D"append", type=3D"string"= , dest=3D"Macros", help=3D"Macro: \"Name [=3D Value]\".") =20 Parser.add_option("-y", "--report-file", action=3D"store", dest=3D"Rep= ortFile", help=3D"Create/overwrite the report to the specified filename.") - Parser.add_option("-Y", "--report-type", action=3D"append", type=3D"ch= oice", choices=3D['PCD','LIBRARY','FLASH','DEPEX','BUILD_FLAGS','FIXED_ADDR= ESS','HASH','EXECUTION_ORDER'], dest=3D"ReportType", default=3D[], + Parser.add_option("-Y", "--report-type", action=3D"append", type=3D"ch= oice", choices=3D['PCD',EDK_COMPONENT_TYPE_LIBRARY,'FLASH','DEPEX','BUILD_F= LAGS','FIXED_ADDRESS','HASH','EXECUTION_ORDER'], dest=3D"ReportType", defau= lt=3D[], help=3D"Flags that control the type of build report to generate. = Must be one of: [PCD, LIBRARY, FLASH, DEPEX, BUILD_FLAGS, FIXED_ADDRESS, HA= SH, EXECUTION_ORDER]. "\ "To specify more than one flag, repeat this option on the com= mand line and the default flag set is [PCD, LIBRARY, FLASH, DEPEX, HASH, BU= ILD_FLAGS, FIXED_ADDRESS]") Parser.add_option("-F", "--flag", action=3D"store", type=3D"string", d= est=3D"Flag", --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239609986424.4723045587672; Fri, 20 Apr 2018 08:53:29 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 87BC22279CEFF; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A9970226EA5AB for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811595" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:37 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 17/27] BaseTools: DataType - cleanup list constants X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" remove unused ones convert lists used for membership testing to sets use shared ones not local ones Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 32 ++++++++--------- BaseTools/Source/Python/AutoGen/GenC.py | 36 ++++++++--------= ---- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 4 +-- BaseTools/Source/Python/Common/DataType.py | 29 ++++++---------- BaseTools/Source/Python/Ecc/Configuration.py | 2 +- BaseTools/Source/Python/Ecc/c.py | 2 +- BaseTools/Source/Python/GenFds/FdfParser.py | 2 +- BaseTools/Source/Python/GenFds/Ffs.py | 20 +---------- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 1 - BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/Workspace/MetaFileParser.py | 4 +-- BaseTools/Source/Python/build/build.py | 4 +-- 12 files changed, 53 insertions(+), 85 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 60088c87a03b..2f60c17439c0 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -508,8 +508,8 @@ class WorkspaceAutoGen(AutoGen): if (BuildData.Pcds[key].TokenCName, BuildData.Pcds= [key].TokenSpaceGuidCName) =3D=3D SinglePcd: for item in GlobalData.MixedPcd[SinglePcd]: Pcd_Type =3D item[0].split('_')[-1] - if (Pcd_Type =3D=3D BuildData.Pcds[key].Ty= pe) or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in= GenC.gDynamicExPcd) or \ - (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and B= uildData.Pcds[key].Type in GenC.gDynamicPcd): + if (Pcd_Type =3D=3D BuildData.Pcds[key].Ty= pe) or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and BuildData.Pcds[key].Type in= PCD_DYNAMIC_EX_TYPE_SET) or \ + (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and B= uildData.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET): Value =3D BuildData.Pcds[key] Value.TokenCName =3D BuildData.Pcds[ke= y].TokenCName + '_' + Pcd_Type if len(key) =3D=3D 2: @@ -1363,8 +1363,8 @@ class PlatformAutoGen(AutoGen): if (self.Platform.Pcds[key].TokenCName, self.Platform.Pcds= [key].TokenSpaceGuidCName) =3D=3D SinglePcd: for item in GlobalData.MixedPcd[SinglePcd]: Pcd_Type =3D item[0].split('_')[-1] - if (Pcd_Type =3D=3D self.Platform.Pcds[key].Type) = or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in= GenC.gDynamicExPcd) or \ - (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and self.Plat= form.Pcds[key].Type in GenC.gDynamicPcd): + if (Pcd_Type =3D=3D self.Platform.Pcds[key].Type) = or (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC_EX and self.Platform.Pcds[key].Type in= PCD_DYNAMIC_EX_TYPE_SET) or \ + (Pcd_Type =3D=3D TAB_PCDS_DYNAMIC and self.Plat= form.Pcds[key].Type in PCD_DYNAMIC_TYPE_SET): Value =3D self.Platform.Pcds[key] Value.TokenCName =3D self.Platform.Pcds[key].T= okenCName + '_' + Pcd_Type if len(key) =3D=3D 2: @@ -1404,7 +1404,7 @@ class PlatformAutoGen(AutoGen): # Check the PCD from DSC or not=20 PcdFromModule.IsFromDsc =3D (PcdFromModule.TokenCName, Pcd= FromModule.TokenSpaceGuidCName) in self.Platform.Pcds =20 - if PcdFromModule.Type in GenC.gDynamicPcd or PcdFromModule= .Type in GenC.gDynamicExPcd: + if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET or PcdFromMo= dule.Type in PCD_DYNAMIC_EX_TYPE_SET: if F.Path not in FdfModuleList: # If one of the Source built modules listed in the= DSC is not listed=20 # in FDF modules, and the INF lists a PCD can only= use the PcdsDynamic=20 @@ -1414,7 +1414,7 @@ class PlatformAutoGen(AutoGen): # be included in a flash image in order to be func= tional. These Dynamic=20 # PCD will not be added into the Database unless i= t is used by other=20 # modules that are included in the FDF file. - if PcdFromModule.Type in GenC.gDynamicPcd and \ + if PcdFromModule.Type in PCD_DYNAMIC_TYPE_SET and \ PcdFromModule.IsFromBinaryInf =3D=3D False: # Print warning message to let the developer m= ake a determine. continue @@ -1423,7 +1423,7 @@ class PlatformAutoGen(AutoGen): # access method (it is only listed in the DEC file= that declares the=20 # PCD as PcdsDynamicEx), then DO NOT break the bui= ld; DO NOT add the=20 # PCD to the Platform's PCD Database. - if PcdFromModule.Type in GenC.gDynamicExPcd: + if PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET: continue # # If a dynamic PCD used by a PEM module/PEI module & D= XE module, @@ -1465,7 +1465,7 @@ class PlatformAutoGen(AutoGen): PcdFromModule.IsFromBinaryInf =3D True PcdFromModule.IsFromDsc =3D False # Only allow the DynamicEx and Patchable PCD in AsBuil= d INF - if PcdFromModule.Type not in GenC.gDynamicExPcd and Pc= dFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE: + if PcdFromModule.Type not in PCD_DYNAMIC_EX_TYPE_SET a= nd PcdFromModule.Type not in TAB_PCDS_PATCHABLE_IN_MODULE: EdkLogger.error("build", AUTOGEN_ERROR, "PCD setti= ng error", File=3Dself.MetaFile, ExtraData=3D"\n\tExisted %s PCD %s= in:\n\t\t%s\n" @@ -1475,11 +1475,11 @@ class PlatformAutoGen(AutoGen): NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) if M.ModuleType in SUP_MODULE_SET_PEI: PcdFromModule.Phase =3D "PEI" - if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in GenC.gDynamicExPcd: + if PcdFromModule not in self._DynaPcdList_ and PcdFrom= Module.Type in PCD_DYNAMIC_EX_TYPE_SET: self._DynaPcdList_.append(PcdFromModule) elif PcdFromModule not in self._NonDynaPcdList_ and Pc= dFromModule.Type in TAB_PCDS_PATCHABLE_IN_MODULE: self._NonDynaPcdList_.append(PcdFromModule) - if PcdFromModule in self._DynaPcdList_ and PcdFromModu= le.Phase =3D=3D 'PEI' and PcdFromModule.Type in GenC.gDynamicExPcd: + if PcdFromModule in self._DynaPcdList_ and PcdFromModu= le.Phase =3D=3D 'PEI' and PcdFromModule.Type in PCD_DYNAMIC_EX_TYPE_SET: # Overwrite the phase of any the same PCD existing= , if Phase is PEI. # It is to solve the case that a dynamic PCD used = by a PEM module/PEI=20 # module & DXE module at a same time. @@ -2066,28 +2066,28 @@ class PlatformAutoGen(AutoGen): # for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "PEI": - if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in [TAB_PCDS_DYNAMIC, "DynamicDefault", "D= ynamicVpd", "DynamicHii"]: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 =20 for Pcd in self.DynamicPcdList: if Pcd.Phase =3D=3D "DXE": - if Pcd.Type in [TAB_PCDS_DYNAMIC_EX, "DynamicExDefault= ", "DynamicExVpd", "DynamicExHii"]: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: EdkLogger.debug(EdkLogger.DEBUG_5, "%s %s (%s) -> = %d" % (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Pcd.Phase, TokenNumber)) self._PcdTokenNumber[Pcd.TokenCName, Pcd.TokenSpac= eGuidCName] =3D TokenNumber TokenNumber +=3D 1 @@ -2383,7 +2383,7 @@ class PlatformAutoGen(AutoGen): ToPcd.MaxDatumSize =3D str(len(Value) - 1) =20 # apply default SKU for dynamic PCDS if specified one is not avail= able - if (ToPcd.Type in PCD_DYNAMIC_TYPE_LIST or ToPcd.Type in PCD_DYNAM= IC_EX_TYPE_LIST) \ + if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMI= C_EX_TYPE_SET) \ and ToPcd.SkuInfoList in [None, {}, '']: if self.Platform.SkuName in self.Platform.SkuIds: SkuName =3D self.Platform.SkuName @@ -3932,7 +3932,7 @@ class ModuleAutoGen(AutoGen): if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE: PatchablePcds +=3D [Pcd] PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGuidCNa= me, TAB_PCDS_PATCHABLE_IN_MODULE)) - elif Pcd.Type in GenC.gDynamicExPcd: + elif Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Pcd not in Pcds: Pcds +=3D [Pcd] PcdCheckList.append((Pcd.TokenCName, Pcd.TokenSpaceGui= dCName, TAB_PCDS_DYNAMIC_EX)) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 57ff699a968a..86b21de31eee 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -43,12 +43,6 @@ gItemTypeStringDatabase =3D { =20 _NumericDataTypesList =3D ['UINT8', 'UINT16', 'UINT32', 'UINT64', 'BOOLEAN= '] =20 -## Dynamic PCD types -gDynamicPcd =3D [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_PCDS_DYNA= MIC_VPD, TAB_PCDS_DYNAMIC_HII] - -## Dynamic-ex PCD types -gDynamicExPcd =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_P= CDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] - ## Datum size gDatumSizeStringDatabase =3D {'UINT8':'8','UINT16':'16','UINT32':'32','UIN= T64':'64','BOOLEAN':'BOOLEAN','VOID*':'8'} gDatumSizeStringDatabaseH =3D {'UINT8':'8','UINT16':'16','UINT32':'32','UI= NT64':'64','BOOLEAN':'BOOL','VOID*':'PTR'} @@ -804,7 +798,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): # Even it is the Library, the PCD is saved in the ModulePcdList PcdList =3D Info.ModulePcdList for Pcd in PcdList: - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: ExTokenCNameList.append(Pcd.TokenCName) PcdExList.append(Pcd) if len(ExTokenCNameList) =3D=3D 0: @@ -850,7 +844,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in GlobalData= .MixedPcd[PcdItem]: RealTokenCName =3D PcdItem[0] break - if Pcd.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D TokenCN= ame: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCName =3D= =3D TokenCName: Index =3D Index + 1 if Index =3D=3D 1: AutoGenH.Append('\n#define __PCD_%s_VAL_CMP(GuidPtr) = (' % (RealTokenCName)) @@ -923,7 +917,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): if Pcd.PcdValueFromComm: Pcd.DefaultValue =3D Pcd.PcdValueFromComm =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: TokenNumber =3D int(Pcd.TokenValue, 0) # Add TokenSpaceGuidValue value to PcdTokenName to discriminate th= e DynamicEx PCDs with=20 # different Guids but same TokenCName @@ -939,7 +933,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd): # will not be added into the Database unless it is used by oth= er modules that are=20 # included in the FDF file.=20 # In this case, just assign an invalid token number to make it= pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: TokenNumber =3D 0 else: EdkLogger.error("build", AUTOGEN_ERROR, @@ -962,14 +956,14 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): SetModeStatusName =3D '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH[Pcd= .DatumType] + '_S_' + TokenCName if Pcd.DatumType in gDatumSizeStringDataba= seH else '_PCD_SET_MODE_' + gDatumSizeStringDatabaseH['VOID*'] + '_S_' + To= kenCName GetModeSizeName =3D '_PCD_GET_MODE_SIZE' + '_' + TokenCName =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if Info.IsLibrary: PcdList =3D Info.LibraryPcdList else: PcdList =3D Info.ModulePcdList PcdExCNameTest =3D 0 for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D P= cdModule.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCNam= e =3D=3D PcdModule.TokenCName: PcdExCNameTest +=3D 1 # get out early once we found > 1... if PcdExCNameTest > 1: @@ -998,10 +992,10 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd= ): else: AutoGenH.Append('#define %s(Value) LibPcdSetEx%s(&%s, %s,= (Value))\n' % (SetModeName, DatumSizeLib, Pcd.TokenSpaceGuidCName, PcdToke= nName)) AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s= , (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, = PcdTokenName)) - elif Pcd.Type in gDynamicPcd: + elif Pcd.Type in PCD_DYNAMIC_TYPE_SET: PcdCNameTest =3D 0 for PcdModule in Info.LibraryPcdList + Info.ModulePcdList: - if PcdModule.Type in gDynamicPcd and Pcd.TokenCName =3D=3D Pcd= Module.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_TYPE_SET and Pcd.TokenCName = =3D=3D PcdModule.TokenCName: PcdCNameTest +=3D 1 # get out early once we found > 1... if PcdCNameTest > 1: @@ -1227,7 +1221,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): # # Write PCDs # - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: TokenNumber =3D int(Pcd.TokenValue, 0) else: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) not in PcdTokenNumber: @@ -1239,7 +1233,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): # will not be added into the Database unless it is used by oth= er modules that are=20 # included in the FDF file.=20 # In this case, just assign an invalid token number to make it= pass build. - if Pcd.Type in PCD_DYNAMIC_TYPE_LIST: + if Pcd.Type in PCD_DYNAMIC_TYPE_SET: TokenNumber =3D 0 else: EdkLogger.error("build", AUTOGEN_ERROR, @@ -1268,7 +1262,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): Type =3D '(VOID *)' Array =3D '[]' PcdItemType =3D Pcd.Type - if PcdItemType in gDynamicExPcd: + if PcdItemType in PCD_DYNAMIC_EX_TYPE_SET: PcdExTokenName =3D '_PCD_TOKEN_' + TokenSpaceGuidCName + '_' + Tok= enCName AutoGenH.Append('\n#define %s %dU\n' % (PcdExTokenName, TokenNumb= er)) =20 @@ -1278,7 +1272,7 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pc= d): PcdList =3D Info.ModulePcdList PcdExCNameTest =3D 0 for PcdModule in PcdList: - if PcdModule.Type in gDynamicExPcd and Pcd.TokenCName =3D=3D P= cdModule.TokenCName: + if PcdModule.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenCNam= e =3D=3D PcdModule.TokenCName: PcdExCNameTest +=3D 1 # get out early once we found > 1... if PcdExCNameTest > 1: @@ -1309,13 +1303,13 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, = Pcd): AutoGenH.Append('#define %s(Value) LibPcdSetEx%sS(&%s, %s= , (Value))\n' % (SetModeStatusName, DatumSizeLib, Pcd.TokenSpaceGuidCName, = PcdTokenName)) else: AutoGenH.Append('#define _PCD_TOKEN_%s %dU\n' % (TokenCName, Toke= nNumber)) - if PcdItemType in gDynamicPcd: + if PcdItemType in PCD_DYNAMIC_TYPE_SET: PcdList =3D [] PcdCNameList =3D [] PcdList.extend(Info.LibraryPcdList) PcdList.extend(Info.ModulePcdList) for PcdModule in PcdList: - if PcdModule.Type in gDynamicPcd: + if PcdModule.Type in PCD_DYNAMIC_TYPE_SET: PcdCNameList.append(PcdModule.TokenCName) if PcdCNameList.count(Pcd.TokenCName) > 1: EdkLogger.error("build", AUTOGEN_ERROR, "More than one Dynamic= Pcds [%s] are different Guids but same CName.They need to be changed to Dy= namicEx type to avoid the confliction.\n" % (TokenCName), ExtraData=3D"[%s]= " % str(Info.MetaFile.Path)) @@ -1695,7 +1689,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): # Collect Token Space GUIDs used by DynamicEc PCDs TokenSpaceList =3D [] for Pcd in Info.ModulePcdList: - if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in To= kenSpaceList: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET and Pcd.TokenSpaceGuidCName= not in TokenSpaceList: TokenSpaceList +=3D [Pcd.TokenSpaceGuidCName] =20 SkuMgr =3D Info.Workspace.Platform.SkuIdMgr diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index 4f4a8d856842..afd690bc5b1b 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -1200,7 +1200,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): # TokenSpaceGuidStructure =3D Pcd.TokenSpaceGuidValue TokenSpaceGuid =3D GuidStructureStringToGuidValueName(TokenSpaceGu= idStructure) - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: if TokenSpaceGuid not in GuidList: GuidList +=3D [TokenSpaceGuid] Dict['GUID_STRUCTURE'].append(TokenSpaceGuidStructure) @@ -1568,7 +1568,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): Dict['VARDEF_HEADER'][GeneratedTokenNumber] =3D '' =20 =20 - if Pcd.Type in gDynamicExPcd: + if Pcd.Type in PCD_DYNAMIC_EX_TYPE_SET: =20 if Phase =3D=3D 'DXE': GeneratedTokenNumber +=3D NumberOfPeiLocalTokens diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 74ed711abc52..13e9c96dd51b 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -54,8 +54,7 @@ TAB_ARCH_ARM =3D 'ARM' TAB_ARCH_EBC =3D 'EBC' TAB_ARCH_AARCH64 =3D 'AARCH64' =20 -ARCH_LIST =3D [TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM, TA= B_ARCH_EBC, TAB_ARCH_AARCH64] -ARCH_LIST_FULL =3D [TAB_ARCH_COMMON] + ARCH_LIST +ARCH_SET_FULL =3D {TAB_ARCH_IA32, TAB_ARCH_X64, TAB_ARCH_IPF, TAB_ARCH_ARM= , TAB_ARCH_EBC, TAB_ARCH_AARCH64, TAB_ARCH_COMMON} =20 SUP_MODULE_BASE =3D 'BASE' SUP_MODULE_SEC =3D 'SEC' @@ -216,11 +215,8 @@ TAB_PCDS_DYNAMIC_DEFAULT =3D 'DynamicDefault' TAB_PCDS_DYNAMIC_VPD =3D 'DynamicVpd' TAB_PCDS_DYNAMIC_HII =3D 'DynamicHii' =20 -PCD_DYNAMIC_TYPE_LIST =3D [TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB= _PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII] -PCD_DYNAMIC_EX_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEF= AULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] - -## Dynamic-ex PCD types -gDynamicExPcd =3D [TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFAULT, TAB_P= CDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII] +PCD_DYNAMIC_TYPE_SET =3D {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_= PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII} +PCD_DYNAMIC_EX_TYPE_SET =3D {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFA= ULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII} =20 TAB_PCDS_FIXED_AT_BUILD_NULL =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD TAB_PCDS_FIXED_AT_BUILD_COMMON =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TA= B_SPLIT + TAB_ARCH_COMMON @@ -273,9 +269,6 @@ TAB_PCDS_DYNAMIC_ARM =3D TAB_PCDS + TAB_PCDS_DYNAMIC + = TAB_SPLIT + TAB_ARCH_ARM TAB_PCDS_DYNAMIC_EBC =3D TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARC= H_EBC TAB_PCDS_DYNAMIC_AARCH64 =3D TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB= _ARCH_AARCH64 =20 -TAB_PCD_DYNAMIC_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYN= AMIC_VPD_NULL, TAB_PCDS_DYNAMIC_HII_NULL] -TAB_PCD_DYNAMIC_EX_TYPE_LIST =3D [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PC= DS_DYNAMIC_EX_VPD_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL] - TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE =3D 'PcdLoadFixAddressPe= iCodePageNumber' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE =3D 'UINT32' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE =3D 'PcdLoadFixAddressBo= otTimeCodePageNumber' @@ -284,10 +277,10 @@ TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE= =3D 'PcdLoadFixAddressRuntim TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE =3D 'UINT3= 2' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE =3D 'PcdLoadFixAddressSm= mCodePageNumber' TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE =3D 'UINT32' -TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST =3D [TAB_PCDS_PATCHABLE_LOAD_FIX_= ADDRESS_PEI_PAGE_SIZE, \ +TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET =3D {TAB_PCDS_PATCHABLE_LOAD_FIX_= ADDRESS_PEI_PAGE_SIZE, \ TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_DXE_PAGE_SIZE, \ TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_RUNTIME_PAGE_SIZE, \ - TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_SMM_PAGE_SIZE] + TAB_PCDS_PATCHABLE_LOAD_FIX_AD= DRESS_SMM_PAGE_SIZE} =20 ## The mapping dictionary from datum type to its maximum number. MAX_VAL_TYPE =3D {"BOOLEAN":0x01, TAB_UINT8:0xFF, TAB_UINT16:0xFFFF, TAB_U= INT32:0xFFFFFFFF, TAB_UINT64:0xFFFFFFFFFFFFFFFF} @@ -485,10 +478,10 @@ TAB_UNKNOWN =3D 'UNKNOWN' DATABASE_PATH =3D ":memory:" #"BuildDatabase.db" =20 # used by ECC -MODIFIER_LIST =3D ['IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVI= CE', 'EFI_BOOTSERVICE', 'EFIAPI'] +MODIFIER_SET =3D {'IN', 'OUT', 'OPTIONAL', 'UNALIGNED', 'EFI_RUNTIMESERVIC= E', 'EFI_BOOTSERVICE', 'EFIAPI'} =20 # Dependency Expression -DEPEX_SUPPORTED_OPCODE =3D ["BEFORE", "AFTER", "PUSH", "AND", "OR", "NOT",= "END", "SOR", "TRUE", "FALSE", '(', ')'] +DEPEX_SUPPORTED_OPCODE_SET =3D {"BEFORE", "AFTER", "PUSH", "AND", "OR", "N= OT", "END", "SOR", "TRUE", "FALSE", '(', ')'} =20 TAB_STATIC_LIBRARY =3D "STATIC-LIBRARY-FILE" TAB_DYNAMIC_LIBRARY =3D "DYNAMIC-LIBRARY-FILE" @@ -520,10 +513,10 @@ PCDS_DYNAMICEX_DEFAULT =3D "PcdsDynamicExDefault" PCDS_DYNAMICEX_VPD =3D "PcdsDynamicExVpd" PCDS_DYNAMICEX_HII =3D "PcdsDynamicExHii" =20 -SECTIONS_HAVE_ITEM_PCD =3D [PCDS_DYNAMIC_DEFAULT.upper(),PCDS_DYNAMIC_VPD.= upper(),PCDS_DYNAMIC_HII.upper(), \ - PCDS_DYNAMICEX_DEFAULT.upper(),PCDS_DYNAMICEX_VP= D.upper(),PCDS_DYNAMICEX_HII.upper()] +SECTIONS_HAVE_ITEM_PCD_SET =3D {PCDS_DYNAMIC_DEFAULT.upper(),PCDS_DYNAMIC_= VPD.upper(),PCDS_DYNAMIC_HII.upper(), \ + PCDS_DYNAMICEX_DEFAULT.upper(),PCDS_DYNAMICE= X_VPD.upper(),PCDS_DYNAMICEX_HII.upper()} # Section allowed to have items after arch -SECTIONS_HAVE_ITEM_AFTER_ARCH =3D [TAB_LIBRARY_CLASSES.upper(), TAB_DEPEX.= upper(), TAB_USER_EXTENSIONS.upper(), +SECTIONS_HAVE_ITEM_AFTER_ARCH_SET =3D {TAB_LIBRARY_CLASSES.upper(), TAB_DE= PEX.upper(), TAB_USER_EXTENSIONS.upper(), PCDS_DYNAMIC_DEFAULT.upper(), PCDS_DYNAMIC_VPD.upper(), PCDS_DYNAMIC_HII.upper(), @@ -531,4 +524,4 @@ SECTIONS_HAVE_ITEM_AFTER_ARCH =3D [TAB_LIBRARY_CLASSES.= upper(), TAB_DEPEX.upper(), PCDS_DYNAMICEX_VPD.upper(), PCDS_DYNAMICEX_HII.upper(), TAB_BUILD_OPTIONS.upper(), - TAB_INCLUDES.upper()] + TAB_INCLUDES.upper()} diff --git a/BaseTools/Source/Python/Ecc/Configuration.py b/BaseTools/Sourc= e/Python/Ecc/Configuration.py index b523858e1b1f..b5b583be8c4a 100644 --- a/BaseTools/Source/Python/Ecc/Configuration.py +++ b/BaseTools/Source/Python/Ecc/Configuration.py @@ -53,7 +53,7 @@ class Configuration(object): =20 # List customized Modifer here, split with ',' # Defaultly use the definition in class DataType - self.ModifierList =3D MODIFIER_LIST + self.ModifierSet =3D MODIFIER_SET =20 ## General Checking self.GeneralCheckAll =3D 0 diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc= /c.py index 175e2d2e0439..93ee1990ba28 100644 --- a/BaseTools/Source/Python/Ecc/c.py +++ b/BaseTools/Source/Python/Ecc/c.py @@ -830,7 +830,7 @@ def GetDataTypeFromModifier(ModifierStr): MList =3D ModifierStr.split() ReturnType =3D '' for M in MList: - if M in EccGlobalData.gConfig.ModifierList: + if M in EccGlobalData.gConfig.ModifierSet: continue # remove array sufix if M.startswith('[') or M.endswith(']'): diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index e117a3717d42..23c04123af1b 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -3587,7 +3587,7 @@ class FdfParser: raise Warning("expected '.'", self.FileName, self.CurrentLineN= umber) =20 Arch =3D self.__SkippedChars.rstrip(".") - if Arch.upper() not in ARCH_LIST_FULL: + if Arch.upper() not in ARCH_SET_FULL: raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.= CurrentLineNumber) =20 ModuleType =3D self.__GetModuleType() diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index f15d2330ce58..f6a7f4b007f9 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -1,7 +1,7 @@ ## @file # process FFS generation # -# Copyright (c) 2007, 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 B= SD License @@ -22,24 +22,6 @@ from Common.DataType import * # # class Ffs(FDClassObject): - =20 - # mapping between MODULE type in FDF (from INF) and file type for GenF= fs - ModuleTypeToFileType =3D { - SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', - SUP_MODULE_PEI_CORE : 'EFI_FV_FILETYPE_PEI_CORE', - SUP_MODULE_PEIM : 'EFI_FV_FILETYPE_PEIM', - SUP_MODULE_DXE_CORE : 'EFI_FV_FILETYPE_DXE_CORE', - SUP_MODULE_DXE_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_SAL_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_SMM_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_DXE_RUNTIME_DRIVER: 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_UEFI_DRIVER : 'EFI_FV_FILETYPE_DRIVER', - SUP_MODULE_UEFI_APPLICATION : 'EFI_FV_FILETYPE_APPLICATION', - SUP_MODULE_SMM_CORE : 'EFI_FV_FILETYPE_SMM_CORE', - SUP_MODULE_MM_STANDALONE : 'EFI_FV_FILETYPE_MM_STANDALONE', - SUP_MODULE_MM_CORE_STANDALONE : 'EFI_FV_FILETYPE_MM_CORE_STANDALON= E' - } - =20 # mapping between FILE type in FDF and file type for GenFfs FdfFvFileTypeToFileType =3D { SUP_MODULE_SEC : 'EFI_FV_FILETYPE_SECURITY_CORE', diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/Source/Python/GenFds/OptRomInfStatement.py index 62d731fb9cca..8f8761b20589 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -93,7 +93,6 @@ class OptRomInfStatement (FfsInfStatement): # Rule =3D self.__GetRule__() GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf fil= e : %s" %self.InfFileName) - #FileType =3D Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType] # # For the rule only has simpleFile # diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 27ef163eb40c..94f142e8e617 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -901,7 +901,7 @@ class InfBuildData(ModuleBuildClassObject): Depex[Arch, ModuleType] =3D [] DepexList =3D Depex[Arch, ModuleType] for Token in TokenList: - if Token in DEPEX_SUPPORTED_OPCODE: + if Token in DEPEX_SUPPORTED_OPCODE_SET: DepexList.append(Token) elif Token.endswith(".inf"): # module file name ModuleFile =3D os.path.normpath(Token) diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTool= s/Source/Python/Workspace/MetaFileParser.py index 99f6fcd0dc30..f0c8012f5eef 100644 --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py @@ -310,7 +310,7 @@ class MetaFileParser(object): if self._SectionName in self.DataType: self._SectionType =3D self.DataType[self._SectionName] # Check if the section name is valid - if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH = and len(ItemList) > 3: + if self._SectionName not in SECTIONS_HAVE_ITEM_AFTER_ARCH_= SET and len(ItemList) > 3: EdkLogger.error("Parser", FORMAT_UNKNOWN_ERROR, "%s is= not a valid section name" % Item, self.MetaFile, self._LineIndex + 1, se= lf._CurrentLine) elif self._Version >=3D 0x00010005: @@ -328,7 +328,7 @@ class MetaFileParser(object): =20 # S2 may be Platform or ModuleType if len(ItemList) > 2: - if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD: + if self._SectionName.upper() in SECTIONS_HAVE_ITEM_PCD_SET: S2 =3D ItemList[2] else: S2 =3D ItemList[2].upper() diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Pyth= on/build/build.py index 29ad0c7228c7..be56aecb79ef 100644 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -1616,12 +1616,12 @@ class Build(): if OutputImageFile !=3D '': ModuleIsPatch =3D False for Pcd in Module.ModulePcdList: - if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE and Pc= d.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST: + if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE and Pc= d.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET: ModuleIsPatch =3D True break if not ModuleIsPatch: for Pcd in Module.LibraryPcdList: - if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE an= d Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST: + if Pcd.Type =3D=3D TAB_PCDS_PATCHABLE_IN_MODULE an= d Pcd.TokenCName in TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SET: ModuleIsPatch =3D True break =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239553723110.19922783016239; Fri, 20 Apr 2018 08:52:33 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5A65C226EA5DC; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 02BF22263DD82 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811597" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:38 -0700 Message-Id: <17a73267bf707542e2b0a24193b6e8e0482dac05.1524239028.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 18/27] BaseTools: Replace PCD type strings with predefined constant X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 4 +-- BaseTools/Source/Python/AutoGen/GenC.py | 4 +-- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 2 +- BaseTools/Source/Python/Common/DataType.py | 3 ++ BaseTools/Source/Python/Common/MigrationUtilities.py | 2 +- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 2 +- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +-- BaseTools/Source/Python/Workspace/DecBuildData.py | 22 +++++++------- BaseTools/Source/Python/Workspace/DscBuildData.py | 22 +++++++------- BaseTools/Source/Python/Workspace/InfBuildData.py | 26 ++++++++------= --- BaseTools/Source/Python/build/BuildReport.py | 30 ++++++++++----= ------ 11 files changed, 62 insertions(+), 59 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 2f60c17439c0..9b2164ed8216 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -870,8 +870,8 @@ class WorkspaceAutoGen(AutoGen): def _CheckPcdDefineAndType(self): PcdTypeList =3D [ TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, TAB_PCD= S_FEATURE_FLAG, - TAB_PCDS_DYNAMIC, #"DynamicHii", "DynamicVpd", - TAB_PCDS_DYNAMIC_EX, # "DynamicExHii", "DynamicExVpd" + TAB_PCDS_DYNAMIC, #TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_VPD, + TAB_PCDS_DYNAMIC_EX, # TAB_PCDS_DYNAMIC_EX_HII, TAB_PCDS_DYNAM= IC_EX_VPD ] =20 # This dict store PCDs which are not used by any modules with spec= ified arches diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 86b21de31eee..6b2ee87b2211 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -28,8 +28,8 @@ from IdfClassObject import * =20 ## PCD type string gItemTypeStringDatabase =3D { - TAB_PCDS_FEATURE_FLAG : 'FixedAtBuild', - TAB_PCDS_FIXED_AT_BUILD : 'FixedAtBuild', + TAB_PCDS_FEATURE_FLAG : TAB_PCDS_FIXED_AT_BUILD, + TAB_PCDS_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE: 'BinaryPatch', TAB_PCDS_DYNAMIC : '', TAB_PCDS_DYNAMIC_DEFAULT : '', diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index afd690bc5b1b..9374ca4820ef 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -1217,7 +1217,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, = DynamicPcdList, Phase): Pcd.InitString =3D 'UNINIT' =20 if Pcd.DatumType =3D=3D 'VOID*': - if Pcd.Type not in ["DynamicVpd", "DynamicExVpd"]: + if Pcd.Type not in [TAB_PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_EX_= VPD]: Pcd.TokenTypeList =3D ['PCD_TYPE_STRING'] else: Pcd.TokenTypeList =3D [] diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 13e9c96dd51b..40a162adf33c 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -218,6 +218,9 @@ TAB_PCDS_DYNAMIC_HII =3D 'DynamicHii' PCD_DYNAMIC_TYPE_SET =3D {TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_DEFAULT, TAB_= PCDS_DYNAMIC_VPD, TAB_PCDS_DYNAMIC_HII} PCD_DYNAMIC_EX_TYPE_SET =3D {TAB_PCDS_DYNAMIC_EX, TAB_PCDS_DYNAMIC_EX_DEFA= ULT, TAB_PCDS_DYNAMIC_EX_VPD, TAB_PCDS_DYNAMIC_EX_HII} =20 +# leave as a list for order +PCD_TYPE_LIST =3D [TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE, = TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX] + TAB_PCDS_FIXED_AT_BUILD_NULL =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD TAB_PCDS_FIXED_AT_BUILD_COMMON =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TA= B_SPLIT + TAB_ARCH_COMMON TAB_PCDS_FIXED_AT_BUILD_IA32 =3D TAB_PCDS + TAB_PCDS_FIXED_AT_BUILD + TAB_= SPLIT + TAB_ARCH_IA32 diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseToo= ls/Source/Python/Common/MigrationUtilities.py index e9f1cabcb794..0c93c72a60f6 100644 --- a/BaseTools/Source/Python/Common/MigrationUtilities.py +++ b/BaseTools/Source/Python/Common/MigrationUtilities.py @@ -34,7 +34,7 @@ def SetCommon(Common, XmlCommon): XmlTag =3D "Usage" Common.Usage =3D XmlAttribute(XmlCommon, XmlTag).split() =20 - XmlTag =3D "FeatureFlag" + XmlTag =3D TAB_PCDS_FEATURE_FLAG Common.FeatureFlag =3D XmlAttribute(XmlCommon, XmlTag) =20 XmlTag =3D "SupArchList" diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index d31d03d43a18..8893fcbda1fc 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -249,7 +249,7 @@ class FfsInfStatement(FfsInfStatementClassObject): Pcd =3D InfPcds[PcdKey] if not hasattr(Pcd, 'Offset'): continue - if Pcd.Type !=3D 'PatchableInModule': + if Pcd.Type !=3D TAB_PCDS_PATCHABLE_IN_MODULE: continue # Override Patchable PCD value by the value from DSC PatchPcd =3D None diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index 6a3873940ec0..e692e4e98504 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -809,7 +809,7 @@ class GenFdsGlobalVariable: for Key in PcdDict: PcdObj =3D PcdDict[Key] if (PcdObj.TokenCName =3D=3D TokenCName) and (PcdObj.Token= SpaceGuidCName =3D=3D TokenSpace): - if PcdObj.Type !=3D 'FixedAtBuild': + if PcdObj.Type !=3D TAB_PCDS_FIXED_AT_BUILD: EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not= FixedAtBuild type." % PcdPattern) if PcdObj.DatumType !=3D 'VOID*': EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not= VOID* datum type." % PcdPattern) @@ -825,7 +825,7 @@ class GenFdsGlobalVariable: for Key in PcdDict: PcdObj =3D PcdDict[Key] if (PcdObj.TokenCName =3D=3D TokenCName) and (PcdObj.T= okenSpaceGuidCName =3D=3D TokenSpace): - if PcdObj.Type !=3D 'FixedAtBuild': + if PcdObj.Type !=3D TAB_PCDS_FIXED_AT_BUILD: EdkLogger.error("GenFds", GENFDS_ERROR, "%s is= not FixedAtBuild type." % PcdPattern) if PcdObj.DatumType !=3D 'VOID*': EdkLogger.error("GenFds", GENFDS_ERROR, "%s is= not VOID* datum type." % PcdPattern) diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py b/BaseTools/= Source/Python/Workspace/DecBuildData.py index 31870e078cec..1fbd095f743c 100644 --- a/BaseTools/Source/Python/Workspace/DecBuildData.py +++ b/BaseTools/Source/Python/Workspace/DecBuildData.py @@ -27,17 +27,17 @@ from Workspace.BuildClassObject import PackageBuildClas= sObject, StructurePcd, Pc class DecBuildData(PackageBuildClassObject): # dict used to convert PCD type in database to string used by build to= ol _PCD_TYPE_STRING_ =3D { - MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild", - MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule", - MODEL_PCD_FEATURE_FLAG : "FeatureFlag", - MODEL_PCD_DYNAMIC : "Dynamic", - MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic", - MODEL_PCD_DYNAMIC_HII : "DynamicHii", - MODEL_PCD_DYNAMIC_VPD : "DynamicVpd", - MODEL_PCD_DYNAMIC_EX : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii", - MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd", + MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD, + MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE, + MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG, + MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII, + MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD, + MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII, + MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD, } =20 # dict used to convert part of [Defines] to members of DecBuildData di= rectly diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index eb435cece480..373441521723 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -164,17 +164,17 @@ def GetDependencyList(FileStack,SearchPathList): class DscBuildData(PlatformBuildClassObject): # dict used to convert PCD type in database to string used by build to= ol _PCD_TYPE_STRING_ =3D { - MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild", - MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule", - MODEL_PCD_FEATURE_FLAG : "FeatureFlag", - MODEL_PCD_DYNAMIC : "Dynamic", - MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic", - MODEL_PCD_DYNAMIC_HII : "DynamicHii", - MODEL_PCD_DYNAMIC_VPD : "DynamicVpd", - MODEL_PCD_DYNAMIC_EX : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii", - MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd", + MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD, + MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE, + MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG, + MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII, + MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD, + MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII, + MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD, } =20 # dict used to convert part of [Defines] to members of DscBuildData di= rectly diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 94f142e8e617..157f7a2d2de8 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -28,17 +28,17 @@ from Workspace.BuildClassObject import ModuleBuildClass= Object, LibraryClassObjec class InfBuildData(ModuleBuildClassObject): # dict used to convert PCD type in database to string used by build to= ol _PCD_TYPE_STRING_ =3D { - MODEL_PCD_FIXED_AT_BUILD : "FixedAtBuild", - MODEL_PCD_PATCHABLE_IN_MODULE : "PatchableInModule", - MODEL_PCD_FEATURE_FLAG : "FeatureFlag", - MODEL_PCD_DYNAMIC : "Dynamic", - MODEL_PCD_DYNAMIC_DEFAULT : "Dynamic", - MODEL_PCD_DYNAMIC_HII : "DynamicHii", - MODEL_PCD_DYNAMIC_VPD : "DynamicVpd", - MODEL_PCD_DYNAMIC_EX : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_DEFAULT : "DynamicEx", - MODEL_PCD_DYNAMIC_EX_HII : "DynamicExHii", - MODEL_PCD_DYNAMIC_EX_VPD : "DynamicExVpd", + MODEL_PCD_FIXED_AT_BUILD : TAB_PCDS_FIXED_AT_BUILD, + MODEL_PCD_PATCHABLE_IN_MODULE : TAB_PCDS_PATCHABLE_IN_MODULE, + MODEL_PCD_FEATURE_FLAG : TAB_PCDS_FEATURE_FLAG, + MODEL_PCD_DYNAMIC : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_DEFAULT : TAB_PCDS_DYNAMIC, + MODEL_PCD_DYNAMIC_HII : TAB_PCDS_DYNAMIC_HII, + MODEL_PCD_DYNAMIC_VPD : TAB_PCDS_DYNAMIC_VPD, + MODEL_PCD_DYNAMIC_EX : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_DEFAULT : TAB_PCDS_DYNAMIC_EX, + MODEL_PCD_DYNAMIC_EX_HII : TAB_PCDS_DYNAMIC_EX_HII, + MODEL_PCD_DYNAMIC_EX_VPD : TAB_PCDS_DYNAMIC_EX_VPD, } =20 # dict used to convert part of [Defines] to members of InfBuildData di= rectly @@ -1026,13 +1026,13 @@ class InfBuildData(ModuleBuildClassObject): # if platform doesn't give its type, use 'lowest' one in t= he # following order, if any # - # "FixedAtBuild", "PatchableInModule", "FeatureFlag", "D= ynamic", "DynamicEx" + # TAB_PCDS_FIXED_AT_BUILD, TAB_PCDS_PATCHABLE_IN_MODULE,= TAB_PCDS_FEATURE_FLAG, TAB_PCDS_DYNAMIC, TAB_PCDS_DYNAMIC_EX # _GuidDict.update(Package.Guids) PcdType =3D self._PCD_TYPE_STRING_[Type] if Type =3D=3D MODEL_PCD_DYNAMIC: Pcd.Pending =3D True - for T in ["FixedAtBuild", "PatchableInModule", "Featur= eFlag", "Dynamic", "DynamicEx"]: + for T in PCD_TYPE_LIST: if (PcdRealName, TokenSpaceGuid) in GlobalData.Mix= edPcd: for item in GlobalData.MixedPcd[(PcdRealName, = TokenSpaceGuid)]: if str(item[0]).endswith(T) and (item[0], = item[1], T) in Package.Pcds: diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index 02e01a1fa2ab..c8948b5cfbd9 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -94,15 +94,15 @@ gSubSectionSep =3D "-" * gLineMaxLength =20 ## The look up table to map PCD type to pair of report display type and DE= C type gPcdTypeMap =3D { - 'FixedAtBuild' : ('FIXED', 'FixedAtBuild'), - 'PatchableInModule': ('PATCH', 'PatchableInModule'), - 'FeatureFlag' : ('FLAG', 'FeatureFlag'), - 'Dynamic' : ('DYN', 'Dynamic'), - 'DynamicHii' : ('DYNHII', 'Dynamic'), - 'DynamicVpd' : ('DYNVPD', 'Dynamic'), - 'DynamicEx' : ('DEX', 'DynamicEx'), - 'DynamicExHii' : ('DEXHII', 'DynamicEx'), - 'DynamicExVpd' : ('DEXVPD', 'DynamicEx'), + TAB_PCDS_FIXED_AT_BUILD : ('FIXED', TAB_PCDS_FIXED_AT_BUILD), + TAB_PCDS_PATCHABLE_IN_MODULE: ('PATCH', TAB_PCDS_PATCHABLE_IN_MODULE), + TAB_PCDS_FEATURE_FLAG : ('FLAG', TAB_PCDS_FEATURE_FLAG), + TAB_PCDS_DYNAMIC : ('DYN', TAB_PCDS_DYNAMIC), + TAB_PCDS_DYNAMIC_HII : ('DYNHII', TAB_PCDS_DYNAMIC), + TAB_PCDS_DYNAMIC_VPD : ('DYNVPD', TAB_PCDS_DYNAMIC), + TAB_PCDS_DYNAMIC_EX : ('DEX', TAB_PCDS_DYNAMIC_EX), + TAB_PCDS_DYNAMIC_EX_HII : ('DEXHII', TAB_PCDS_DYNAMIC_EX), + TAB_PCDS_DYNAMIC_EX_VPD : ('DEXVPD', TAB_PCDS_DYNAMIC_EX), } =20 ## The look up table to map module type to driver type @@ -784,7 +784,7 @@ class PcdReport(object): Pcd =3D Pa.Platform.Pcds[item] if not Pcd.Type: # check the Pcd in FDF file, whether it is used in mod= ule first - for T in ["FixedAtBuild", "PatchableInModule", "Featur= eFlag", "Dynamic", "DynamicEx"]: + for T in PCD_TYPE_LIST: PcdList =3D self.AllPcds.setdefault(Pcd.TokenSpace= GuidCName, {}).setdefault(T, []) if Pcd in PcdList: Pcd.Type =3D T @@ -792,7 +792,7 @@ class PcdReport(object): if not Pcd.Type: PcdTypeFlag =3D False for package in Pa.PackageList: - for T in ["FixedAtBuild", "PatchableInModule", "Fe= atureFlag", "Dynamic", "DynamicEx"]: + for T in PCD_TYPE_LIST: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, T= ) in package.Pcds: Pcd.Type =3D T PcdTypeFlag =3D True @@ -804,10 +804,10 @@ class PcdReport(object): if not Pcd.DatumType: PcdType =3D Pcd.Type # Try to remove Hii and Vpd suffix - if PcdType.startswith("DynamicEx"): - PcdType =3D "DynamicEx" - elif PcdType.startswith("Dynamic"): - PcdType =3D "Dynamic" + if PcdType.startswith(TAB_PCDS_DYNAMIC_EX): + PcdType =3D TAB_PCDS_DYNAMIC_EX + elif PcdType.startswith(TAB_PCDS_DYNAMIC): + PcdType =3D TAB_PCDS_DYNAMIC for package in Pa.PackageList: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdTy= pe) in package.Pcds: Pcd.DatumType =3D package.Pcds[(Pcd.TokenCName= , Pcd.TokenSpaceGuidCName, PcdType)].DatumType --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239623429432.97911709580774; Fri, 20 Apr 2018 08:53:43 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 0ED1C2279CF0E; Fri, 20 Apr 2018 08:52:03 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id ECF47226EA5B5 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811600" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:39 -0700 Message-Id: <67ec988deb43275c4d34f124ade40e79d05d9691.1524239028.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 19/27] BaseTools: Replace Binary File type strings with predefined constant X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" BINARY_FILE_TYPE_FW was 'FW' BINARY_FILE_TYPE_GUID was 'GUID' BINARY_FILE_TYPE_PREEFORM was 'PREEFORM' BINARY_FILE_TYPE_UEFI_APP was 'UEFI_APP' BINARY_FILE_TYPE_UNI_UI was 'UNI_UI' BINARY_FILE_TYPE_UNI_VER was 'UNI_VER' BINARY_FILE_TYPE_LIB was 'LIB' BINARY_FILE_TYPE_PE32 was 'PE32' BINARY_FILE_TYPE_PIC was 'PIC' BINARY_FILE_TYPE_PEI_DEPEX was 'PEI_DEPEX' BINARY_FILE_TYPE_DXE_DEPEX was 'DXE_DEPEX' BINARY_FILE_TYPE_SMM_DEPEX was 'SMM_DEPEX' BINARY_FILE_TYPE_TE was 'TE' BINARY_FILE_TYPE_VER was 'VER' BINARY_FILE_TYPE_UI was 'UI' BINARY_FILE_TYPE_BIN was 'BIN' BINARY_FILE_TYPE_FV was 'FV' Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 12 +-- BaseTools/Source/Python/AutoGen/GenC.py | 8 +- BaseTools/Source/Python/AutoGen/GenPcdDb.py | 4 +- BaseTools/Source/Python/Common/Expression.py | 2 +- BaseTools/Source/Python/Common/Misc.py | 4 +- BaseTools/Source/Python/GenFds/DataSection.py | 6 +- BaseTools/Source/Python/GenFds/DepexSection.py | 6 +- BaseTools/Source/Python/GenFds/EfiSection.py | 10 +-- BaseTools/Source/Python/GenFds/Fd.py | 3 +- BaseTools/Source/Python/GenFds/FdfParser.py | 92 ++++++++++----= ------ BaseTools/Source/Python/GenFds/Ffs.py | 14 +-- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 22 ++--- BaseTools/Source/Python/GenFds/Fv.py | 4 +- BaseTools/Source/Python/GenFds/GenFds.py | 10 +-- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 4 +- BaseTools/Source/Python/GenFds/OptRomInfStatement.py | 2 +- BaseTools/Source/Python/GenFds/Region.py | 5 +- BaseTools/Source/Python/GenFds/Section.py | 46 +++++----- BaseTools/Source/Python/GenFds/UiSection.py | 2 +- BaseTools/Source/Python/Trim/Trim.py | 2 +- BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +- BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- BaseTools/Source/Python/build/BuildReport.py | 12 +-- 23 files changed, 138 insertions(+), 136 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 9b2164ed8216..534fbe79fad9 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -923,7 +923,7 @@ class WorkspaceAutoGen(AutoGen): ## Return the directory to store FV files def _GetFvDir(self): if self._FvDir is None: - self._FvDir =3D path.join(self.BuildDir, 'FV') + self._FvDir =3D path.join(self.BuildDir, BINARY_FILE_TYPE_FV) return self._FvDir =20 ## Return the directory to store all intermediate and final files built @@ -1326,7 +1326,7 @@ class PlatformAutoGen(AutoGen): =20 def UpdateNVStoreMaxSize(self,OrgVpdFile): if self.VariableInfo: - VpdMapFilePath =3D os.path.join(self.BuildDir, "FV", "%s.map" = % self.Platform.VpdToolGuid) + VpdMapFilePath =3D os.path.join(self.BuildDir, BINARY_FILE_TYP= E_FV, "%s.map" % self.Platform.VpdToolGuid) PcdNvStoreDfBuffer =3D [item for item in self._DynamicPcdList = if item.TokenCName =3D=3D "PcdNvStoreDefaultValueBuffer" and item.TokenSpac= eGuidCName =3D=3D "gEfiMdeModulePkgTokenSpaceGuid"] =20 if PcdNvStoreDfBuffer: @@ -1719,7 +1719,7 @@ class PlatformAutoGen(AutoGen): =20 # Process VPD map file generated by third party BPDG tool if NeedProcessVpdMapFile: - VpdMapFilePath =3D os.path.join(self.BuildDir, "FV", "= %s.map" % self.Platform.VpdToolGuid) + VpdMapFilePath =3D os.path.join(self.BuildDir, BINARY_= FILE_TYPE_FV, "%s.map" % self.Platform.VpdToolGuid) if os.path.exists(VpdMapFilePath): VpdFile.Read(VpdMapFilePath) =20 @@ -1770,7 +1770,7 @@ class PlatformAutoGen(AutoGen): self.AllPcdList =3D self._NonDynamicPcdList + self._DynamicPcdList =20 def FixVpdOffset(self,VpdFile ): - FvPath =3D os.path.join(self.BuildDir, "FV") + FvPath =3D os.path.join(self.BuildDir, BINARY_FILE_TYPE_FV) if not os.path.exists(FvPath): try: os.makedirs(FvPath) @@ -1783,7 +1783,7 @@ class PlatformAutoGen(AutoGen): # retrieve BPDG tool's path from tool_def.txt according to VPD= _TOOL_GUID defined in DSC file. BPDGToolName =3D None for ToolDef in self.ToolDefinition.values(): - if ToolDef.has_key("GUID") and ToolDef["GUID"] =3D=3D self= .Platform.VpdToolGuid: + if ToolDef.has_key(BINARY_FILE_TYPE_GUID) and ToolDef[BINA= RY_FILE_TYPE_GUID] =3D=3D self.Platform.VpdToolGuid: if not ToolDef.has_key("PATH"): EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, = "PATH attribute was not provided for BPDG guid tool %s in tools_def.txt" % = self.Platform.VpdToolGuid) BPDGToolName =3D ToolDef["PATH"] @@ -3032,7 +3032,7 @@ class ModuleAutoGen(AutoGen): def _GetFfsOutputDir(self): if self._FfsOutputDir is None: if GlobalData.gFdfParser is not None: - self._FfsOutputDir =3D path.join(self.PlatformInfo.BuildDi= r, "FV", "Ffs", self.Guid + self.Name) + self._FfsOutputDir =3D path.join(self.PlatformInfo.BuildDi= r, BINARY_FILE_TYPE_FV, "Ffs", self.Guid + self.Name) else: self._FfsOutputDir =3D '' return self._FfsOutputDir diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index 6b2ee87b2211..ca54ac107e5d 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1614,7 +1614,7 @@ def CreateModuleUnloadImageCode(Info, AutoGenC, AutoG= enH): # def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH): if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: - GuidType =3D "GUID" + GuidType =3D BINARY_FILE_TYPE_GUID else: GuidType =3D "EFI_GUID" =20 @@ -1638,7 +1638,7 @@ def CreateGuidDefinitionCode(Info, AutoGenC, AutoGenH= ): # def CreateProtocolDefinitionCode(Info, AutoGenC, AutoGenH): if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: - GuidType =3D "GUID" + GuidType =3D BINARY_FILE_TYPE_GUID else: GuidType =3D "EFI_GUID" =20 @@ -1662,7 +1662,7 @@ def CreateProtocolDefinitionCode(Info, AutoGenC, Auto= GenH): # def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH): if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: - GuidType =3D "GUID" + GuidType =3D BINARY_FILE_TYPE_GUID else: GuidType =3D "EFI_GUID" =20 @@ -1699,7 +1699,7 @@ def CreatePcdCode(Info, AutoGenC, AutoGenH): if TokenSpaceList: AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in = this module\n\n") if Info.ModuleType in [SUP_MODULE_USER_DEFINED, SUP_MODULE_BASE]: - GuidType =3D "GUID" + GuidType =3D BINARY_FILE_TYPE_GUID else: GuidType =3D "EFI_GUID" =20 for Item in TokenSpaceList: diff --git a/BaseTools/Source/Python/AutoGen/GenPcdDb.py b/BaseTools/Source= /Python/AutoGen/GenPcdDb.py index 9374ca4820ef..63228795c001 100644 --- a/BaseTools/Source/Python/AutoGen/GenPcdDb.py +++ b/BaseTools/Source/Python/AutoGen/GenPcdDb.py @@ -972,7 +972,7 @@ def CreatePcdDatabaseCode (Info, AutoGenC, AutoGenH): AutoGenC.Append(AdditionalAutoGenC.String) =20 if Info.IsBinaryModule: - DbFileName =3D os.path.join(Info.PlatformInfo.BuildDir, "FV", Phas= e + "PcdDataBase.raw") + DbFileName =3D os.path.join(Info.PlatformInfo.BuildDir, BINARY_FIL= E_TYPE_FV, Phase + "PcdDataBase.raw") else: DbFileName =3D os.path.join(Info.OutputDir, Phase + "PcdDataBase.r= aw") DbFile =3D StringIO() @@ -1054,7 +1054,7 @@ def NewCreatePcdDatabasePhaseSpecificAutoGen(Platform= ,Phase): PcdDriverAutoGenData[(skuname,skuid)] =3D (AdditionalAutoGenH,= AdditionalAutoGenC) VarCheckTableData[(skuname,skuid)] =3D VarCheckTab if Platform.Platform.VarCheckFlag: - dest =3D os.path.join(Platform.BuildDir, 'FV') + dest =3D os.path.join(Platform.BuildDir, BINARY_FILE_TYPE_FV) VarCheckTable =3D CreateVarCheckBin(VarCheckTableData) VarCheckTable.dump(dest, Phase) AdditionalAutoGenH, AdditionalAutoGenC =3D CreateAutoGen(PcdDrive= rAutoGenData) diff --git a/BaseTools/Source/Python/Common/Expression.py b/BaseTools/Sourc= e/Python/Common/Expression.py index 99929938fb5a..4b7d65583dc8 100644 --- a/BaseTools/Source/Python/Common/Expression.py +++ b/BaseTools/Source/Python/Common/Expression.py @@ -950,7 +950,7 @@ class ValueExpressionEx(ValueExpression): Size =3D 0 ValueStr =3D '' TokenSpaceGuidName =3D '' - if Item.startswith('GUID') and Item.endswith('= )'): + if Item.startswith(BINARY_FILE_TYPE_GUID) and = Item.endswith(')'): try: TokenSpaceGuidName =3D re.search('GUID= \((\w+)\)', Item).group(1) except: diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Pyth= on/Common/Misc.py index 4a6a29c7ae80..61617ed589b3 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -1219,7 +1219,7 @@ class tdict: =20 def IsFieldValueAnArray (Value): Value =3D Value.strip() - if Value.startswith('GUID') and Value.endswith(')'): + if Value.startswith(BINARY_FILE_TYPE_GUID) and Value.endswith(')'): return True if Value.startswith('L"') and Value.endswith('"') and len(list(Value[= 2:-1])) > 1: return True @@ -1316,7 +1316,7 @@ def ParseFieldValue (Value): if Size > 8: raise BadExpression('Value (%s) Size larger than %d' % (Value,= Size)) return Value, 8 - if Value.startswith('GUID') and Value.endswith(')'): + if Value.startswith(BINARY_FILE_TYPE_GUID) and Value.endswith(')'): Value =3D Value.split('(', 1)[1][:-1].strip() if Value[0] =3D=3D '{' and Value[-1] =3D=3D '}': TmpValue =3D GuidStructureStringToGuidString(Value) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Sour= ce/Python/GenFds/DataSection.py index 3c435c2fcc65..c066d4383549 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -81,7 +81,7 @@ class DataSection (DataSectionClassObject): CopyLongFilePath(MapFile, CopyMapFile) =20 #Get PE Section alignment when align is set to AUTO - if self.Alignment =3D=3D 'Auto' and self.SecType in ('TE', 'PE32'): + if self.Alignment =3D=3D 'Auto' and self.SecType in (BINARY_FILE_T= YPE_TE, BINARY_FILE_TYPE_PE32): ImageObj =3D PeImageClass (Filename) if ImageObj.SectionAlignment < 0x400: self.Alignment =3D str (ImageObj.SectionAlignment) @@ -91,7 +91,7 @@ class DataSection (DataSectionClassObject): self.Alignment =3D str (ImageObj.SectionAlignment / 0x1000= 00) + 'M' =20 NoStrip =3D True - if self.SecType in ('TE', 'PE32'): + if self.SecType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32): if self.KeepReloc is not None: NoStrip =3D self.KeepReloc =20 @@ -109,7 +109,7 @@ class DataSection (DataSectionClassObject): ) self.SectFileName =3D StrippedFile =20 - if self.SecType =3D=3D 'TE': + if self.SecType =3D=3D BINARY_FILE_TYPE_TE: TeFile =3D os.path.join( OutputPath, ModuleName + 'Te.raw') GenFdsGlobalVariable.GenerateFirmwareImage( TeFile, diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Sou= rce/Python/GenFds/DepexSection.py index d04160e890f1..f42162d5a27e 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -96,13 +96,13 @@ class DepexSection (DepexSectionClassObject): =20 if self.DepexType =3D=3D 'PEI_DEPEX_EXP': ModuleType =3D SUP_MODULE_PEIM - SecType =3D 'PEI_DEPEX' + SecType =3D BINARY_FILE_TYPE_PEI_DEPEX elif self.DepexType =3D=3D 'DXE_DEPEX_EXP': ModuleType =3D SUP_MODULE_DXE_DRIVER - SecType =3D 'DXE_DEPEX' + SecType =3D BINARY_FILE_TYPE_DXE_DEPEX elif self.DepexType =3D=3D 'SMM_DEPEX_EXP': ModuleType =3D SUP_MODULE_DXE_SMM_DRIVER - SecType =3D 'SMM_DEPEX' + SecType =3D BINARY_FILE_TYPE_SMM_DEPEX else: EdkLogger.error("GenFds", FORMAT_INVALID, "Depex type %s is not valid for module %s" % (= self.DepexType, ModuleName)) diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Sourc= e/Python/GenFds/EfiSection.py index 1be23b4bf7fd..5405d0a8da13 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -67,7 +67,7 @@ class EfiSection (EfiSectionClassObject): StringData =3D FfsInf.__ExtendMacro__(self.StringData) ModuleNameStr =3D FfsInf.__ExtendMacro__('$(MODULE_NAME)') NoStrip =3D True - if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, = SUP_MODULE_PEIM) and SectionType in ('TE', 'PE32'): + if FfsInf.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, = SUP_MODULE_PEIM) and SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_= PE32): if FfsInf.KeepReloc is not None: NoStrip =3D FfsInf.KeepReloc elif FfsInf.KeepRelocFromRule is not None: @@ -171,9 +171,9 @@ class EfiSection (EfiSectionClassObject): OutputFileList.append(OutputFile) =20 # - # If Section Type is 'UI' + # If Section Type is BINARY_FILE_TYPE_UI # - elif SectionType =3D=3D 'UI': + elif SectionType =3D=3D BINARY_FILE_TYPE_UI: =20 InfOverrideUiString =3D False if FfsInf.Ui is not None: @@ -242,7 +242,7 @@ class EfiSection (EfiSectionClassObject): File =3D GenFdsGlobalVariable.MacroExtend(File, Dict) =20 #Get PE Section alignment when align is set to AUTO - if self.Alignment =3D=3D 'Auto' and (SectionType =3D= =3D 'PE32' or SectionType =3D=3D 'TE'): + if self.Alignment =3D=3D 'Auto' and (SectionType =3D= =3D BINARY_FILE_TYPE_PE32 or SectionType =3D=3D BINARY_FILE_TYPE_TE): ImageObj =3D PeImageClass (File) if ImageObj.SectionAlignment < 0x400: Align =3D str (ImageObj.SectionAlignment) @@ -287,7 +287,7 @@ class EfiSection (EfiSectionClassObject): =20 """For TE Section call GenFw to generate TE image""" =20 - if SectionType =3D=3D 'TE': + if SectionType =3D=3D BINARY_FILE_TYPE_TE: TeFile =3D os.path.join( OutputPath, ModuleName + = 'Te.raw') GenFdsGlobalVariable.GenerateFirmwareImage( TeFile, diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python= /GenFds/Fd.py index cc4124ad902e..188ca28cd7ce 100644 --- a/BaseTools/Source/Python/GenFds/Fd.py +++ b/BaseTools/Source/Python/GenFds/Fd.py @@ -27,6 +27,7 @@ from Common import EdkLogger from Common.BuildToolError import * from Common.Misc import SaveFileOnChange from GenFds import GenFds +from Common.DataType import BINARY_FILE_TYPE_FV =20 ## generate FD # @@ -158,7 +159,7 @@ class FD(FDClassObject): FvAddDict =3D{} FvList =3D [] for RegionObj in self.RegionList: - if RegionObj.RegionType =3D=3D 'FV': + if RegionObj.RegionType =3D=3D BINARY_FILE_TYPE_FV: if len(RegionObj.RegionDataList) =3D=3D 1: RegionData =3D RegionObj.RegionDataList[0] FvList.append(RegionData.upper()) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index 23c04123af1b..b8848a25b4b2 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1850,7 +1850,7 @@ class FdfParser: if not self.__GetNextWord(): return True =20 - if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE", "I= NF"): + if not self.__Token in ("SET", BINARY_FILE_TYPE_FV, "FILE", "DATA"= , "CAPSULE", "INF"): # # If next token is a word which is not a valid FV type, it mig= ht be part of [PcdOffset[|PcdSize]] # Or it might be next region's offset described by an expressi= on which starts with a PCD. @@ -1881,7 +1881,7 @@ class FdfParser: if not self.__GetNextWord(): return True =20 - elif self.__Token =3D=3D "FV": + elif self.__Token =3D=3D BINARY_FILE_TYPE_FV: self.__UndoToken() self.__GetRegionFvType( RegionObj) =20 @@ -1925,8 +1925,8 @@ class FdfParser: # def __GetRegionFvType(self, RegionObj): =20 - if not self.__IsKeyword( "FV"): - raise Warning("expected Keyword 'FV'", self.FileName, self.Cur= rentLineNumber) + if not self.__IsKeyword( BINARY_FILE_TYPE_FV): + raise Warning("expected Keyword BINARY_FILE_TYPE_FV", self.Fil= eName, self.CurrentLineNumber) =20 if not self.__IsToken( "=3D"): raise Warning("expected '=3D'", self.FileName, self.CurrentLin= eNumber) @@ -1934,10 +1934,10 @@ class FdfParser: if not self.__GetNextToken(): raise Warning("expected FV name", self.FileName, self.CurrentL= ineNumber) =20 - RegionObj.RegionType =3D "FV" + RegionObj.RegionType =3D BINARY_FILE_TYPE_FV RegionObj.RegionDataList.append((self.__Token).upper()) =20 - while self.__IsKeyword( "FV"): + while self.__IsKeyword( BINARY_FILE_TYPE_FV): =20 if not self.__IsToken( "=3D"): raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) @@ -2535,7 +2535,7 @@ class FdfParser: if self.__GetStringData(): FfsInfObj.Version =3D self.__Token =20 - if self.__IsKeyword( "UI"): + if self.__IsKeyword( BINARY_FILE_TYPE_UI): if not self.__IsToken( "=3D"): raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) if not self.__GetNextToken(): @@ -2648,7 +2648,7 @@ class FdfParser: # @staticmethod def __SectionCouldHaveRelocFlag (SectionType): - if SectionType in ('TE', 'PE32'): + if SectionType in (BINARY_FILE_TYPE_TE, BINARY_FILE_TYPE_PE32): return True else: return False @@ -2681,7 +2681,7 @@ class FdfParser: if not self.__GetNextToken(): raise Warning("expected File name or section data", self.FileN= ame, self.CurrentLineNumber) =20 - if self.__Token =3D=3D "FV": + if self.__Token =3D=3D BINARY_FILE_TYPE_FV: if not self.__IsToken( "=3D"): raise Warning("expected '=3D'", self.FileName, self.Curren= tLineNumber) if not self.__GetNextToken(): @@ -2888,7 +2888,7 @@ class FdfParser: VerSectionObj.FileName =3D self.__Token Obj.SectionList.append(VerSectionObj) =20 - elif self.__IsKeyword( "UI"): + elif self.__IsKeyword( BINARY_FILE_TYPE_UI): if AlignValue =3D=3D 'Auto': raise Warning("Auto alignment can only be used in PE32 or = TE section ", self.FileName, self.CurrentLineNumber) if not self.__IsToken( "=3D"): @@ -2972,10 +2972,10 @@ class FdfParser: self.SetFileBufferPos(OldPos) return False =20 - if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_I= MAGE", "RAW", "DXE_DEPEX",\ - "UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID= ", "SMM_DEPEX"): + if self.__Token not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BIN= ARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE= _DXE_DEPEX,\ + BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE= _TYPE_PEI_DEPEX, "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX): raise Warning("Unknown section type '%s'" % self.__Token, = self.FileName, self.CurrentLineNumber) - if AlignValue =3D=3D 'Auto'and (not self.__Token =3D=3D 'PE32'= ) and (not self.__Token =3D=3D 'TE'): + if AlignValue =3D=3D 'Auto'and (not self.__Token =3D=3D BINARY= _FILE_TYPE_PE32) and (not self.__Token =3D=3D BINARY_FILE_TYPE_TE): raise Warning("Auto alignment can only be used in PE32 or = TE section ", self.FileName, self.CurrentLineNumber) =20 # DataSection @@ -3393,7 +3393,7 @@ class FdfParser: # def __GetFvStatement(self, CapsuleObj, FMPCapsule =3D False): =20 - if not self.__IsKeyword("FV"): + if not self.__IsKeyword(BINARY_FILE_TYPE_FV): return False =20 if not self.__IsToken("=3D"): @@ -3541,7 +3541,7 @@ class FdfParser: AfileBaseName =3D os.path.basename(AfileName) =20 if os.path.splitext(AfileBaseName)[1] not in [".bin",".BIN",".Bin= ",".dat",".DAT",".Dat",".data",".DATA",".Data"]: - raise Warning('invalid binary file type, should be one of "bin= ","BIN","Bin","dat","DAT","Dat","data","DATA","Data"', \ + raise Warning('invalid binary file type, should be one of "bin= ",BINARY_FILE_TYPE_BIN,"Bin","dat","DAT","Dat","data","DATA","Data"', \ self.FileName, self.CurrentLineNumber) =20 if not os.path.isabs(AfileName): @@ -3774,8 +3774,8 @@ class FdfParser: =20 SectionName =3D self.__Token =20 - if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IM= AGE", "RAW", "DXE_DEPEX",\ - "UI", "PEI_DEPEX", "VERSION", "SUBTYPE= _GUID", "SMM_DEPEX"): + if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINA= RY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_= DXE_DEPEX,\ + BINARY_FILE_TYPE_UI, BINARY_FILE_TYPE_= PEI_DEPEX, "VERSION", "SUBTYPE_GUID", BINARY_FILE_TYPE_SMM_DEPEX): raise Warning("Unknown leaf section name '%s'" % SectionNa= me, self.FileName, self.CurrentLineNumber) =20 =20 @@ -3790,7 +3790,7 @@ class FdfParser: if self.__Token not in ("Auto", "8", "16", "32", "64", "12= 8", "512", "1K", "4K", "32K" ,"64K", "128K", "256K", "512K", "1M", "2M", "4M", = "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Toke= n, self.FileName, self.CurrentLineNumber) - if self.__Token =3D=3D 'Auto' and (not SectionName =3D=3D = 'PE32') and (not SectionName =3D=3D 'TE'): + if self.__Token =3D=3D 'Auto' and (not SectionName =3D=3D = BINARY_FILE_TYPE_PE32) and (not SectionName =3D=3D BINARY_FILE_TYPE_TE): raise Warning("Auto alignment can only be used in PE32= or TE section ", self.FileName, self.CurrentLineNumber) SectAlignment =3D self.__Token =20 @@ -3831,8 +3831,8 @@ class FdfParser: return False SectionName =3D self.__Token =20 - if SectionName not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE"= , "RAW", "DXE_DEPEX",\ - "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_= DEPEX"): + if SectionName not in ("COMPAT16", BINARY_FILE_TYPE_PE32, BINARY_F= ILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE_TYPE_DXE_= DEPEX,\ + BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE= _TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX): self.__UndoToken() return False =20 @@ -3862,8 +3862,8 @@ class FdfParser: FvImageSectionObj.FvName =3D None =20 else: - if not self.__IsKeyword("FV"): - raise Warning("expected 'FV'", self.FileName, self.Cur= rentLineNumber) + if not self.__IsKeyword(BINARY_FILE_TYPE_FV): + raise Warning("expected BINARY_FILE_TYPE_FV", self.Fil= eName, self.CurrentLineNumber) FvImageSectionObj.FvFileType =3D self.__Token =20 if self.__GetAlignment(): @@ -3875,8 +3875,8 @@ class FdfParser: if self.__IsToken('|'): FvImageSectionObj.FvFileExtension =3D self.__GetFileEx= tension() elif self.__GetNextToken(): - if self.__Token not in ("}", "COMPAT16", "PE32", "PIC"= , "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\ - "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_= DEPEX"): + if self.__Token not in ("}", "COMPAT16", BINARY_FILE_T= YPE_PE32, BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BIN= ARY_FILE_TYPE_DXE_DEPEX,\ + BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE= _TYPE_PEI_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX): FvImageSectionObj.FvFileName =3D self.__Token else: self.__UndoToken() @@ -3938,7 +3938,7 @@ class FdfParser: if self.__Token not in ("Auto", "8", "16", "32", "64", "128", = "512", "1K", "4K", "32K" ,"64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M"= , "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, s= elf.FileName, self.CurrentLineNumber) - if self.__Token =3D=3D 'Auto' and (not SectionName =3D=3D 'PE3= 2') and (not SectionName =3D=3D 'TE'): + if self.__Token =3D=3D 'Auto' and (not SectionName =3D=3D BINA= RY_FILE_TYPE_PE32) and (not SectionName =3D=3D BINARY_FILE_TYPE_TE): raise Warning("Auto alignment can only be used in PE32 or = TE section ", self.FileName, self.CurrentLineNumber) EfiSectionObj.Alignment =3D self.__Token =20 @@ -3957,8 +3957,8 @@ class FdfParser: if self.__IsToken('|'): EfiSectionObj.FileExtension =3D self.__GetFileExtension() elif self.__GetNextToken(): - if self.__Token not in ("}", "COMPAT16", "PE32", "PIC", "TE", = "FV_IMAGE", "RAW", "DXE_DEPEX",\ - "UI", "VERSION", "PEI_DEPEX", "GUID", "SMM_DEPEX"): + if self.__Token not in ("}", "COMPAT16", BINARY_FILE_TYPE_PE32= , BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_TE, "FV_IMAGE", "RAW", BINARY_FILE= _TYPE_DXE_DEPEX,\ + BINARY_FILE_TYPE_UI, "VERSION", BINARY_FILE_TYPE_PE= I_DEPEX, BINARY_FILE_TYPE_GUID, BINARY_FILE_TYPE_SMM_DEPEX): =20 if self.__Token.startswith('PCD'): self.__UndoToken() @@ -3992,7 +3992,7 @@ class FdfParser: # @staticmethod def __RuleSectionCouldBeOptional(SectionType): - if SectionType in ("DXE_DEPEX", "UI", "VERSION", "PEI_DEPEX", "RAW= ", "SMM_DEPEX"): + if SectionType in (BINARY_FILE_TYPE_DXE_DEPEX, BINARY_FILE_TYPE_UI= , "VERSION", BINARY_FILE_TYPE_PEI_DEPEX, "RAW", BINARY_FILE_TYPE_SMM_DEPEX): return True else: return False @@ -4022,7 +4022,7 @@ class FdfParser: # @staticmethod def __RuleSectionCouldHaveString(SectionType): - if SectionType in ("UI", "VERSION"): + if SectionType in (BINARY_FILE_TYPE_UI, "VERSION"): return True else: return False @@ -4039,32 +4039,32 @@ class FdfParser: if SectionType =3D=3D "COMPAT16": if FileType not in ("COMPAT16", "SEC_COMPAT16"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "PE32": - if FileType not in ("PE32", "SEC_PE32"): + elif SectionType =3D=3D BINARY_FILE_TYPE_PE32: + if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_PE32"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "PIC": - if FileType not in ("PIC", "PIC"): + elif SectionType =3D=3D BINARY_FILE_TYPE_PIC: + if FileType not in (BINARY_FILE_TYPE_PIC, BINARY_FILE_TYPE_PIC= ): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "TE": - if FileType not in ("TE", "SEC_TE"): + elif SectionType =3D=3D BINARY_FILE_TYPE_TE: + if FileType not in (BINARY_FILE_TYPE_TE, "SEC_TE"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) elif SectionType =3D=3D "RAW": - if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"): + if FileType not in (BINARY_FILE_TYPE_BIN, "SEC_BIN", "RAW", "A= SL", "ACPI"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "DXE_DEPEX" or SectionType =3D=3D "SMM_DEP= EX": - if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"): + elif SectionType =3D=3D BINARY_FILE_TYPE_DXE_DEPEX or SectionType = =3D=3D BINARY_FILE_TYPE_SMM_DEPEX: + if FileType not in (BINARY_FILE_TYPE_DXE_DEPEX, "SEC_DXE_DEPEX= ", BINARY_FILE_TYPE_SMM_DEPEX): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "UI": - if FileType not in ("UI", "SEC_UI"): + elif SectionType =3D=3D BINARY_FILE_TYPE_UI: + if FileType not in (BINARY_FILE_TYPE_UI, "SEC_UI"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) elif SectionType =3D=3D "VERSION": if FileType not in ("VERSION", "SEC_VERSION"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "PEI_DEPEX": - if FileType not in ("PEI_DEPEX", "SEC_PEI_DEPEX"): + elif SectionType =3D=3D BINARY_FILE_TYPE_PEI_DEPEX: + if FileType not in (BINARY_FILE_TYPE_PEI_DEPEX, "SEC_PEI_DEPEX= "): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) - elif SectionType =3D=3D "GUID": - if FileType not in ("PE32", "SEC_GUID"): + elif SectionType =3D=3D BINARY_FILE_TYPE_GUID: + if FileType not in (BINARY_FILE_TYPE_PE32, "SEC_GUID"): raise Warning("Incorrect section file type '%s'" % FileTyp= e, self.FileName, self.CurrentLineNumber) =20 ## __GetRuleEncapsulationSection() method @@ -4501,7 +4501,7 @@ class FdfParser: =20 FfsFileObj =3D OptRomFileStatement.OptRomFileStatement() =20 - if not self.__IsKeyword("EFI") and not self.__IsKeyword("BIN"): + if not self.__IsKeyword("EFI") and not self.__IsKeyword(BINARY_FIL= E_TYPE_BIN): raise Warning("expected Binary type (EFI/BIN)", self.FileName,= self.CurrentLineNumber) FfsFileObj.FileType =3D self.__Token =20 @@ -4582,7 +4582,7 @@ class FdfParser: if FdName.upper() in self.Profile.FdDict: FdObj =3D self.Profile.FdDict[FdName.upper()] for elementRegion in FdObj.RegionList: - if elementRegion.RegionType =3D=3D 'FV': + if elementRegion.RegionType =3D=3D BINARY_FILE_TYPE_FV: for elementRegionData in elementRegion.RegionDataList: if elementRegionData.endswith(".fv"): continue diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Pytho= n/GenFds/Ffs.py index f6a7f4b007f9..44ad01cb7354 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -42,12 +42,12 @@ class Ffs(FDClassObject): =20 # mapping between section type in FDF and file suffix SectionSuffix =3D { - 'PE32' : '.pe32', - 'PIC' : '.pic', - 'TE' : '.te', - 'DXE_DEPEX' : '.dpx', + BINARY_FILE_TYPE_PE32 : '.pe32', + BINARY_FILE_TYPE_PIC : '.pic', + BINARY_FILE_TYPE_TE : '.te', + BINARY_FILE_TYPE_DXE_DEPEX : '.dpx', 'VERSION' : '.ver', - 'UI' : '.ui', + BINARY_FILE_TYPE_UI : '.ui', 'COMPAT16' : '.com16', 'RAW' : '.raw', 'FREEFORM_SUBTYPE_GUID': '.guid', @@ -55,8 +55,8 @@ class Ffs(FDClassObject): 'FV_IMAGE' : 'fv.sec', 'COMPRESS' : '.com', 'GUIDED' : '.guided', - 'PEI_DEPEX' : '.dpx', - 'SMM_DEPEX' : '.dpx' + BINARY_FILE_TYPE_PEI_DEPEX : '.dpx', + BINARY_FILE_TYPE_SMM_DEPEX : '.dpx' } =20 ## The constructor diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index 8893fcbda1fc..b92fa4d8033c 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject): # # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED # =20 - if FileType !=3D 'PE32' and self.ModuleType !=3D SUP_MODULE_USER_D= EFINED: + if FileType !=3D BINARY_FILE_TYPE_PE32 and self.ModuleType !=3D SU= P_MODULE_USER_DEFINED: return EfiFile =20 # @@ -739,13 +739,13 @@ class FfsInfStatement(FfsInfStatementClassObject): # Convert Fv Section Type for PI1.1 SMM driver. # if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) >=3D 0x0001000A: - if SectionType =3D=3D 'DXE_DEPEX': - SectionType =3D 'SMM_DEPEX' + if SectionType =3D=3D BINARY_FILE_TYPE_DXE_DEPEX: + SectionType =3D BINARY_FILE_TYPE_SMM_DEPEX # # Framework SMM Driver has no SMM_DEPEX section type # if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(self.P= iSpecVersion, 16) < 0x0001000A: - if SectionType =3D=3D 'SMM_DEPEX': + if SectionType =3D=3D BINARY_FILE_TYPE_SMM_DEPEX: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework= SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFileNam= e) NoStrip =3D True if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MO= DULE_PEIM): @@ -767,7 +767,7 @@ class FfsInfStatement(FfsInfStatementClassObject): File =3D GenFdsGlobalVariable.MacroExtend(File, Dict, self= .CurrentArch) =20 #Get PE Section alignment when align is set to AUTO - if self.Alignment =3D=3D 'Auto' and (SectionType =3D=3D 'P= E32' or SectionType =3D=3D 'TE'): + if self.Alignment =3D=3D 'Auto' and (SectionType =3D=3D BI= NARY_FILE_TYPE_PE32 or SectionType =3D=3D BINARY_FILE_TYPE_TE): ImageObj =3D PeImageClass (File) if ImageObj.SectionAlignment < 0x400: self.Alignment =3D str (ImageObj.SectionAlignment) @@ -790,7 +790,7 @@ class FfsInfStatement(FfsInfStatementClassObject): ) File =3D StrippedFile =20 - if SectionType =3D=3D 'TE': + if SectionType =3D=3D BINARY_FILE_TYPE_TE: TeFile =3D os.path.join( self.OutputPath, self.ModuleG= uid + 'Te.raw') GenFdsGlobalVariable.GenerateFirmwareImage( TeFile, @@ -809,7 +809,7 @@ class FfsInfStatement(FfsInfStatementClassObject): GenSecInputFile =3D GenFdsGlobalVariable.MacroExtend(GenSecInp= utFile, Dict, self.CurrentArch) =20 #Get PE Section alignment when align is set to AUTO - if self.Alignment =3D=3D 'Auto' and (SectionType =3D=3D 'PE32'= or SectionType =3D=3D 'TE'): + if self.Alignment =3D=3D 'Auto' and (SectionType =3D=3D BINARY= _FILE_TYPE_PE32 or SectionType =3D=3D BINARY_FILE_TYPE_TE): ImageObj =3D PeImageClass (GenSecInputFile) if ImageObj.SectionAlignment < 0x400: self.Alignment =3D str (ImageObj.SectionAlignment) @@ -833,7 +833,7 @@ class FfsInfStatement(FfsInfStatementClassObject): ) GenSecInputFile =3D StrippedFile =20 - if SectionType =3D=3D 'TE': + if SectionType =3D=3D BINARY_FILE_TYPE_TE: TeFile =3D os.path.join( self.OutputPath, self.ModuleGuid = + 'Te.raw') GenFdsGlobalVariable.GenerateFirmwareImage( TeFile, @@ -942,13 +942,13 @@ class FfsInfStatement(FfsInfStatementClassObject): # Convert Fv Section Type for PI1.1 SMM driver. # if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) >=3D 0x0001000A: - if Sect.SectionType =3D=3D 'DXE_DEPEX': - Sect.SectionType =3D 'SMM_DEPEX' + if Sect.SectionType =3D=3D BINARY_FILE_TYPE_DXE_DEPEX: + Sect.SectionType =3D BINARY_FILE_TYPE_SMM_DEPEX # # Framework SMM Driver has no SMM_DEPEX section type # if self.ModuleType =3D=3D SUP_MODULE_DXE_SMM_DRIVER and int(se= lf.PiSpecVersion, 16) < 0x0001000A: - if Sect.SectionType =3D=3D 'SMM_DEPEX': + if Sect.SectionType =3D=3D BINARY_FILE_TYPE_SMM_DEPEX: EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Frame= work SMM module doesn't support SMM_DEPEX section type", File=3Dself.InfFil= eName) # # process the inside FvImage from FvSection or GuidSection diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python= /GenFds/Fv.py index 71bcd4c72170..024081734a2b 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -80,7 +80,7 @@ class FV (FvClassObject): if self.CapsuleName is not None: for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.val= ues(): for RegionObj in FdObj.RegionList: - if RegionObj.RegionType =3D=3D 'FV': + if RegionObj.RegionType =3D=3D BINARY_FILE_TYPE_FV: for RegionData in RegionObj.RegionDataList: if RegionData.endswith(".fv"): continue @@ -236,7 +236,7 @@ class FV (FvClassObject): =20 for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values(= ): for RegionObj in FdObj.RegionList: - if RegionObj.RegionType !=3D 'FV': + if RegionObj.RegionType !=3D BINARY_FILE_TYPE_FV: continue for RegionData in RegionObj.RegionDataList: # diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Py= thon/GenFds/GenFds.py index 54c7d828305f..8bedd9f74411 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -315,7 +315,7 @@ def main(): for Fd in FdfParserObj.Profile.FdDict: FdObj =3D FdfParserObj.Profile.FdDict[Fd] for RegionObj in FdObj.RegionList: - if RegionObj.RegionType !=3D 'FV': + if RegionObj.RegionType !=3D BINARY_FILE_TYPE_FV: continue for RegionData in RegionObj.RegionDataList: if FvObj.UiFvName.upper() =3D=3D RegionData.up= per(): @@ -405,7 +405,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, Name= Guid): KeyList[1] + \ '_' + \ KeyList[2] - if Key in KeyStringList and KeyList[4] =3D=3D 'GUID': + if Key in KeyStringList and KeyList[4] =3D=3D BINARY_FILE_TYPE= _GUID: ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' ToolPath =3D ToolDefinition.get(ToolPathKey) @@ -447,7 +447,7 @@ def FindExtendTool(KeyStringList, CurrentArchList, Name= Guid): if NameGuid =3D=3D BuildOption[Op]: KeyList =3D Op.split('_') Key =3D KeyList[0] + '_' + KeyList[1] +'_' + KeyList[2] - if Key in KeyStringList and KeyList[4] =3D=3D 'GUID': + if Key in KeyStringList and KeyList[4] =3D=3D BINARY_F= ILE_TYPE_GUID: ToolPathKey =3D Key + '_' + KeyList[3] + '_PATH' ToolOptionKey =3D Key + '_' + KeyList[3] + '_FLAGS' if ToolPathKey in BuildOption: @@ -589,7 +589,7 @@ class GenFds : if FdObj is None: for ElementFd in GenFdsGlobalVariable.FdfParser.Profile.FdDict= .values(): for ElementRegion in ElementFd.RegionList: - if ElementRegion.RegionType =3D=3D 'FV': + if ElementRegion.RegionType =3D=3D BINARY_FILE_TYPE_FV: for ElementRegionData in ElementRegion.RegionDataL= ist: if ElementRegionData is not None and ElementRe= gionData.upper() =3D=3D FvObj.UiFvName: if FvObj.BlockSizeList !=3D []: @@ -601,7 +601,7 @@ class GenFds : return DefaultBlockSize else: for ElementRegion in FdObj.RegionList: - if ElementRegion.RegionType =3D=3D 'FV': + if ElementRegion.RegionType =3D=3D BINARY_FILE_TYPE_FV: for ElementRegionData in ElementRegion.RegionDataL= ist: if ElementRegionData is not None and ElementRe= gionData.upper() =3D=3D FvObj.UiFvName: if FvObj.BlockSizeList !=3D []: diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index e692e4e98504..878b13d13c2d 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -288,7 +288,7 @@ class GenFdsGlobalVariable: # GenFdsGlobalVariable.OutputDirDict =3D OutputDir GenFdsGlobalVariable.FdfParser =3D FdfParser GenFdsGlobalVariable.WorkSpace =3D WorkSpace - GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVariable.O= utputDirDict[ArchList[0]], 'FV') + GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVariable.O= utputDirDict[ArchList[0]], DataType.BINARY_FILE_TYPE_FV) if not os.path.exists(GenFdsGlobalVariable.FvDir) : os.makedirs(GenFdsGlobalVariable.FvDir) GenFdsGlobalVariable.FfsDir =3D os.path.join(GenFdsGlobalVariable.= FvDir, 'Ffs') @@ -349,7 +349,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.PlatformName =3D WorkSpace.Db.BuildObject= [GenFdsGlobalVariable.ActivePlatform, Arch, Glob= alData.gGlobalDefines['TARGET'], Glob= alData.gGlobalDefines['TOOLCHAIN']].PlatformName - GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVariable.O= utputDirDict[ArchList[0]], 'FV') + GenFdsGlobalVariable.FvDir =3D os.path.join(GenFdsGlobalVariable.O= utputDirDict[ArchList[0]], DataType.BINARY_FILE_TYPE_FV) if not os.path.exists(GenFdsGlobalVariable.FvDir): os.makedirs(GenFdsGlobalVariable.FvDir) GenFdsGlobalVariable.FfsDir =3D os.path.join(GenFdsGlobalVariable.= FvDir, 'Ffs') diff --git a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py b/BaseToo= ls/Source/Python/GenFds/OptRomInfStatement.py index 8f8761b20589..a865ac4436d5 100644 --- a/BaseTools/Source/Python/GenFds/OptRomInfStatement.py +++ b/BaseTools/Source/Python/GenFds/OptRomInfStatement.py @@ -141,7 +141,7 @@ class OptRomInfStatement (FfsInfStatement): =20 OutputFileList =3D [] for Sect in Rule.SectionList: - if Sect.SectionType =3D=3D 'PE32': + if Sect.SectionType =3D=3D BINARY_FILE_TYPE_PE32: if Sect.FileName is not None: GenSecInputFile =3D self.__ExtendMacro__(Sect.FileName) OutputFileList.append(GenSecInputFile) diff --git a/BaseTools/Source/Python/GenFds/Region.py b/BaseTools/Source/Py= thon/GenFds/Region.py index 44f122a71216..9d632b6321e2 100644 --- a/BaseTools/Source/Python/GenFds/Region.py +++ b/BaseTools/Source/Python/GenFds/Region.py @@ -26,6 +26,7 @@ from Common import EdkLogger from Common.BuildToolError import * from Common.LongFilePathSupport import OpenLongFilePath as open from Common.MultipleWorkspace import MultipleWorkspace as mws +from Common.DataType import BINARY_FILE_TYPE_FV =20 ## generate Region # @@ -80,10 +81,10 @@ class Region(RegionClassObject): GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x= %X' % self.Offset) GenFdsGlobalVariable.InfLogger(" Region Size =3D 0x%X" % Siz= e) GenFdsGlobalVariable.SharpCounter =3D 0 - if Flag and (self.RegionType !=3D 'FV'): + if Flag and (self.RegionType !=3D BINARY_FILE_TYPE_FV): return =20 - if self.RegionType =3D=3D 'FV': + if self.RegionType =3D=3D BINARY_FILE_TYPE_FV: # # Get Fv from FvDict # diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/P= ython/GenFds/Section.py index 4b368b3ada9d..5895998158b6 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -20,7 +20,7 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable import Common.LongFilePathOs as os, glob from Common import EdkLogger from Common.BuildToolError import * -from Common.DataType import TAB_ARCH_COMMON +from Common.DataType import * =20 ## section base class # @@ -29,37 +29,37 @@ class Section (SectionClassObject): SectionType =3D { 'RAW' : 'EFI_SECTION_RAW', 'FREEFORM' : 'EFI_SECTION_FREEFORM_SUBTYPE_GUID', - 'PE32' : 'EFI_SECTION_PE32', - 'PIC' : 'EFI_SECTION_PIC', - 'TE' : 'EFI_SECTION_TE', + BINARY_FILE_TYPE_PE32 : 'EFI_SECTION_PE32', + BINARY_FILE_TYPE_PIC : 'EFI_SECTION_PIC', + BINARY_FILE_TYPE_TE : 'EFI_SECTION_TE', 'FV_IMAGE' : 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', - 'DXE_DEPEX' : 'EFI_SECTION_DXE_DEPEX', - 'PEI_DEPEX' : 'EFI_SECTION_PEI_DEPEX', + BINARY_FILE_TYPE_DXE_DEPEX : 'EFI_SECTION_DXE_DEPEX', + BINARY_FILE_TYPE_PEI_DEPEX : 'EFI_SECTION_PEI_DEPEX', 'GUIDED' : 'EFI_SECTION_GUID_DEFINED', 'COMPRESS' : 'EFI_SECTION_COMPRESSION', - 'UI' : 'EFI_SECTION_USER_INTERFACE', - 'SMM_DEPEX' : 'EFI_SECTION_SMM_DEPEX' + BINARY_FILE_TYPE_UI : 'EFI_SECTION_USER_INTERFACE', + BINARY_FILE_TYPE_SMM_DEPEX : 'EFI_SECTION_SMM_DEPEX' } =20 BinFileType =3D { - 'GUID' : '.guid', + BINARY_FILE_TYPE_GUID : '.guid', 'ACPI' : '.acpi', 'ASL' : '.asl' , - 'UEFI_APP' : '.app', - 'LIB' : '.lib', - 'PE32' : '.pe32', - 'PIC' : '.pic', - 'PEI_DEPEX' : '.depex', + BINARY_FILE_TYPE_UEFI_APP : '.app', + BINARY_FILE_TYPE_LIB : '.lib', + BINARY_FILE_TYPE_PE32 : '.pe32', + BINARY_FILE_TYPE_PIC : '.pic', + BINARY_FILE_TYPE_PEI_DEPEX : '.depex', 'SEC_PEI_DEPEX' : '.depex', - 'TE' : '.te', - 'UNI_VER' : '.ver', - 'VER' : '.ver', - 'UNI_UI' : '.ui', - 'UI' : '.ui', - 'BIN' : '.bin', + BINARY_FILE_TYPE_TE : '.te', + BINARY_FILE_TYPE_UNI_VER : '.ver', + BINARY_FILE_TYPE_VER : '.ver', + BINARY_FILE_TYPE_UNI_UI : '.ui', + BINARY_FILE_TYPE_UI : '.ui', + BINARY_FILE_TYPE_BIN : '.bin', 'RAW' : '.raw', 'COMPAT16' : '.comp16', - 'FV' : '.fv' + BINARY_FILE_TYPE_FV : '.fv' } =20 SectFileType =3D { @@ -128,8 +128,8 @@ class Section (SectionClassObject): for File in FfsInf.BinFileList: if File.Arch =3D=3D TAB_ARCH_COMMON or FfsInf.CurrentArch = =3D=3D File.Arch: if File.Type =3D=3D FileType or (int(FfsInf.PiSpecVers= ion, 16) >=3D 0x0001000A \ - and FileType =3D=3D 'DXE_= DPEX'and File.Type =3D=3D 'SMM_DEPEX') \ - or (FileType =3D=3D 'TE'a= nd File.Type =3D=3D 'PE32'): + and FileType =3D=3D 'DXE_= DPEX' and File.Type =3D=3D BINARY_FILE_TYPE_SMM_DEPEX) \ + or (FileType =3D=3D BINAR= Y_FILE_TYPE_TE and File.Type =3D=3D BINARY_FILE_TYPE_PE32): if '*' in FfsInf.TargetOverrideList or File.Target= =3D=3D '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOve= rrideList =3D=3D []: FileList.append(FfsInf.PatchEfiFile(File.Path,= File.Type)) else: diff --git a/BaseTools/Source/Python/GenFds/UiSection.py b/BaseTools/Source= /Python/GenFds/UiSection.py index 084f761e1285..31d3edebb4ef 100644 --- a/BaseTools/Source/Python/GenFds/UiSection.py +++ b/BaseTools/Source/Python/GenFds/UiSection.py @@ -58,7 +58,7 @@ class UiSection (UiSectionClassObject): self.StringData =3D FfsInf.__ExtendMacro__(self.StringData) self.FileName =3D FfsInf.__ExtendMacro__(self.FileName) =20 - OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + Ffs.SectionSuffix.get('UI')) + OutputFile =3D os.path.join(OutputPath, ModuleName + SUP_MODULE_SE= C + SecNum + Ffs.SectionSuffix.get(BINARY_FILE_TYPE_UI)) =20 if self.StringData is not None : NameString =3D self.StringData diff --git a/BaseTools/Source/Python/Trim/Trim.py b/BaseTools/Source/Python= /Trim/Trim.py index 3eb7fa39209d..3afe759667ac 100644 --- a/BaseTools/Source/Python/Trim/Trim.py +++ b/BaseTools/Source/Python/Trim/Trim.py @@ -303,7 +303,7 @@ def TrimPreprocessedVfr(Source, Target): FoundTypedef =3D False TypedefEnd =3D Index # keep all "typedef struct" except to GUID, EFI_PLABEL and PAL= _CALL_RETURN - if Line.strip("} ;\r\n") in ["GUID", "EFI_PLABEL", "PAL_CALL_R= ETURN"]: + if Line.strip("} ;\r\n") in [BINARY_FILE_TYPE_GUID, "EFI_PLABE= L", "PAL_CALL_RETURN"]: for i in range(TypedefStart, TypedefEnd+1): Lines[i] =3D "\n" =20 diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 373441521723..6943fab4e5c8 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -1506,7 +1506,7 @@ class DscBuildData(PlatformBuildClassObject): def get_length(value): Value =3D value.strip() if len(value) > 1: - if Value.startswith('GUID') and Value.endswith(')'): + if Value.startswith(BINARY_FILE_TYPE_GUID) and Value.endsw= ith(')'): return 16 if Value.startswith('L"') and Value.endswith('"'): return len(Value[2:-1]) diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index 157f7a2d2de8..cf5e1df3a523 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -71,7 +71,7 @@ class InfBuildData(ModuleBuildClassObject): # dict used to convert old tool name used in [nmake] section to new on= es _TOOL_CODE_ =3D { "C" : "CC", - "LIB" : "SLINK", + BINARY_FILE_TYPE_LIB : "SLINK", "LINK" : "DLINK", } =20 diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Sourc= e/Python/build/BuildReport.py index c8948b5cfbd9..f551c3ac8f91 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -208,7 +208,7 @@ def FindIncludeFiles(Source, IncludePathList, IncludeFi= les): FileName =3D "Protocol/%(Key)s/%(Key)s.h" % {"Key" : Key} elif "PPI" in Type: FileName =3D "Ppi/%(Key)s/%(Key)s.h" % {"Key" : Key} - elif "GUID" in Type: + elif BINARY_FILE_TYPE_GUID in Type: FileName =3D "Guid/%(Key)s/%(Key)s.h" % {"Key" : Key} else: continue @@ -1410,7 +1410,7 @@ class PredictionReport(object): if Wa.FdfProfile: for Fd in Wa.FdfProfile.FdDict: for FdRegion in Wa.FdfProfile.FdDict[Fd].RegionList: - if FdRegion.RegionType !=3D "FV": + if FdRegion.RegionType !=3D BINARY_FILE_TYPE_FV: continue for FvName in FdRegion.RegionDataList: if FvName in self._FvList: @@ -1686,7 +1686,7 @@ class FdRegionReport(object): # If the input FdRegion is not a firmware volume, # we are done. # - if self.Type !=3D "FV": + if self.Type !=3D BINARY_FILE_TYPE_FV: return =20 # @@ -1780,7 +1780,7 @@ class FdRegionReport(object): FileWrite(File, "Type: %s" % Type) FileWrite(File, "Base Address: 0x%X" % BaseAddress) =20 - if self.Type =3D=3D "FV": + if self.Type =3D=3D BINARY_FILE_TYPE_FV: FvTotalSize =3D 0 FvTakenSize =3D 0 FvFreeSize =3D 0 @@ -1843,7 +1843,7 @@ class FdRegionReport(object): if (len(self.FvList) > 0): for FvItem in self.FvList: Info =3D self.FvInfo[FvItem] - self._GenerateReport(File, Info[0], "FV", Info[1], Info[2]= , FvItem) + self._GenerateReport(File, Info[0], BINARY_FILE_TYPE_FV, I= nfo[1], Info[2], FvItem) else: self._GenerateReport(File, "FD Region", self.Type, self.BaseAd= dress, self.Size) =20 @@ -1869,7 +1869,7 @@ class FdReport(object): self.BaseAddress =3D Fd.BaseAddress self.Size =3D Fd.Size self.FdRegionList =3D [FdRegionReport(FdRegion, Wa) for FdRegion i= n Fd.RegionList] - self.FvPath =3D os.path.join(Wa.BuildDir, "FV") + self.FvPath =3D os.path.join(Wa.BuildDir, BINARY_FILE_TYPE_FV) self.VpdFilePath =3D os.path.join(self.FvPath, "%s.map" % Wa.Platf= orm.VpdToolGuid) self.VPDBaseAddress =3D 0 self.VPDSize =3D 0 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239557648174.1718326964468; Fri, 20 Apr 2018 08:52:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 80BDC226EA5DE; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 002DD22512158 for ; Fri, 20 Apr 2018 08:51:55 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811604" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:40 -0700 Message-Id: <527eb22a29ce2bc447e3836ded0ac84c7cb6b8db.1524239028.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 20/27] BaseTools: remove duplicate variable X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/DataType.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/BaseTools/Source/Python/Common/DataType.py b/BaseTools/Source/= Python/Common/DataType.py index 40a162adf33c..5c8cc82fc915 100644 --- a/BaseTools/Source/Python/Common/DataType.py +++ b/BaseTools/Source/Python/Common/DataType.py @@ -128,8 +128,6 @@ PLATFORM_COMPONENT_TYPE_LIBRARY =3D EDK_COMPONENT_TYPE_= LIBRARY PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS =3D 'LIBRARY_CLASS' PLATFORM_COMPONENT_TYPE_MODULE =3D 'MODULE' =20 -TAB_LIBRARIES =3D 'Libraries' - TAB_SOURCES =3D 'Sources' TAB_SOURCES_COMMON =3D TAB_SOURCES + TAB_SPLIT + TAB_ARCH_COMMON TAB_SOURCES_IA32 =3D TAB_SOURCES + TAB_SPLIT + TAB_ARCH_IA32 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239565136634.5462801415594; Fri, 20 Apr 2018 08:52:45 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id DC68A2272963F; Fri, 20 Apr 2018 08:52:00 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0D1422263DD90 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811605" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:41 -0700 Message-Id: <10e4d41daeb48bfecd562cb95736d35f7a0f0015.1524239028.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 21/27] BaseTools: replace string with predefined constant X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/Ecc/Check.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BaseTools/Source/Python/Ecc/Check.py b/BaseTools/Source/Python= /Ecc/Check.py index c0e8006dcc51..6490670b0ddb 100644 --- a/BaseTools/Source/Python/Ecc/Check.py +++ b/BaseTools/Source/Python/Ecc/Check.py @@ -787,7 +787,7 @@ class Check(object): continue SqlCommand =3D """select Value3 from Inf where Belongs= ToFile =3D (select ID from File where lower(FullP= ath) =3D lower('%s')) - and Value2 =3D '%s'""" % (LibraryIns, = 'LIBRARY_CLASS') + and Value2 =3D '%s'""" % (LibraryIns, = PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS) RecordSet =3D EccGlobalData.gDb.TblInf.Exec(SqlCommand) IsFound =3D False for Record in RecordSet: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239599893238.2897727913837; Fri, 20 Apr 2018 08:53:19 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 370222279CEF6; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9716B226EA5A8 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811606" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:42 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 22/27] BaseTools: remove redundant if comparison X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" inherently python will check string and list for None and having data if in [None, ''] and similar are superflous. Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 26 ++++++++------= -- BaseTools/Source/Python/AutoGen/GenC.py | 2 +- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 4 +-- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 32 ++++++++++----= ------ BaseTools/Source/Python/Workspace/DscBuildData.py | 8 ++--- BaseTools/Source/Python/Workspace/InfBuildData.py | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 534fbe79fad9..871afedcde4b 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -420,14 +420,14 @@ class WorkspaceAutoGen(AutoGen): if BuildData.Pcds[key].Pending: if key in Platform.Pcds: PcdInPlatform =3D Platform.Pcds[key] - if PcdInPlatform.Type not in [None, '']: + if PcdInPlatform.Type: BuildData.Pcds[key].Type =3D PcdInPlat= form.Type =20 if BuildData.MetaFile in Platform.Modules: PlatformModule =3D Platform.Modules[str(Bu= ildData.MetaFile)] if key in PlatformModule.Pcds: PcdInPlatform =3D PlatformModule.Pcds[= key] - if PcdInPlatform.Type not in [None, ''= ]: + if PcdInPlatform.Type: BuildData.Pcds[key].Type =3D PcdIn= Platform.Type =20 if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type: @@ -1394,7 +1394,7 @@ class PlatformAutoGen(AutoGen): =20 for PcdFromModule in M.ModulePcdList + M.LibraryPcdList: # make sure that the "VOID*" kind of datum has MaxDatumSiz= e set - if PcdFromModule.DatumType =3D=3D "VOID*" and PcdFromModul= e.MaxDatumSize in [None, '']: + if PcdFromModule.DatumType =3D=3D "VOID*" and not PcdFromM= odule.MaxDatumSize: NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModule.T= okenSpaceGuidCName, PcdFromModule.TokenCName, F)) =20 # Check the PCD from Binary INF or Source INF @@ -1471,7 +1471,7 @@ class PlatformAutoGen(AutoGen): ExtraData=3D"\n\tExisted %s PCD %s= in:\n\t\t%s\n" % (PcdFromModule.Type, PcdFromModu= le.TokenCName, InfName)) # make sure that the "VOID*" kind of datum has MaxDatu= mSize set - if PcdFromModule.DatumType =3D=3D "VOID*" and PcdFromM= odule.MaxDatumSize in [None, '']: + if PcdFromModule.DatumType =3D=3D "VOID*" and not PcdF= romModule.MaxDatumSize: NoDatumTypePcdList.add("%s.%s [%s]" % (PcdFromModu= le.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName)) if M.ModuleType in SUP_MODULE_SET_PEI: PcdFromModule.Phase =3D "PEI" @@ -1999,7 +1999,7 @@ class PlatformAutoGen(AutoGen): BuildRuleFile =3D None if TAB_TAT_DEFINES_BUILD_RULE_CONF in self.Workspace.TargetTxt= .TargetTxtDictionary: BuildRuleFile =3D self.Workspace.TargetTxt.TargetTxtDictio= nary[TAB_TAT_DEFINES_BUILD_RULE_CONF] - if BuildRuleFile in [None, '']: + if not BuildRuleFile: BuildRuleFile =3D gDefaultBuildRuleFile self._BuildRule =3D BuildRule(BuildRuleFile) if self._BuildRule._FileVersion =3D=3D "": @@ -2327,13 +2327,13 @@ class PlatformAutoGen(AutoGen): TokenCName =3D PcdItem[0] break if FromPcd is not None: - if ToPcd.Pending and FromPcd.Type not in [None, '']: + if ToPcd.Pending and FromPcd.Type: ToPcd.Type =3D FromPcd.Type - elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in [= None, ''])\ + elif (ToPcd.Type) and (FromPcd.Type)\ and (ToPcd.Type !=3D FromPcd.Type) and (ToPcd.Type in From= Pcd.Type): if ToPcd.Type.strip() =3D=3D TAB_PCDS_DYNAMIC_EX: ToPcd.Type =3D FromPcd.Type - elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [Non= e, ''] \ + elif ToPcd.Type and FromPcd.Type \ and ToPcd.Type !=3D FromPcd.Type: EdkLogger.error("build", OPTION_CONFLICT, "Mismatched PCD = type", ExtraData=3D"%s.%s is defined as [%s] in m= odule %s, but as [%s] in platform."\ @@ -2369,11 +2369,11 @@ class PlatformAutoGen(AutoGen): ToPcd.validlists =3D FromPcd.validlists ToPcd.expressions =3D FromPcd.expressions =20 - if FromPcd is not None and ToPcd.DatumType =3D=3D "VOID*" and ToPc= d.MaxDatumSize in ['', None]: + if FromPcd is not None and ToPcd.DatumType =3D=3D "VOID*" and not = ToPcd.MaxDatumSize: EdkLogger.debug(EdkLogger.DEBUG_9, "No MaxDatumSize specified = for PCD %s.%s" \ % (ToPcd.TokenSpaceGuidCName, TokenCName)) Value =3D ToPcd.DefaultValue - if Value in [None, '']: + if not Value: ToPcd.MaxDatumSize =3D '1' elif Value[0] =3D=3D 'L': ToPcd.MaxDatumSize =3D str((len(Value) - 2) * 2) @@ -2384,7 +2384,7 @@ class PlatformAutoGen(AutoGen): =20 # apply default SKU for dynamic PCDS if specified one is not avail= able if (ToPcd.Type in PCD_DYNAMIC_TYPE_SET or ToPcd.Type in PCD_DYNAMI= C_EX_TYPE_SET) \ - and ToPcd.SkuInfoList in [None, {}, '']: + and not ToPcd.SkuInfoList: if self.Platform.SkuName in self.Platform.SkuIds: SkuName =3D self.Platform.SkuName else: @@ -2445,10 +2445,10 @@ class PlatformAutoGen(AutoGen): # use PCD value to calculate the MaxDatumSize when it is not speci= fied for Name, Guid in Pcds: Pcd =3D Pcds[Name, Guid] - if Pcd.DatumType =3D=3D "VOID*" and Pcd.MaxDatumSize in ['', N= one]: + if Pcd.DatumType =3D=3D "VOID*" and not Pcd.MaxDatumSize: Pcd.MaxSizeUserSet =3D None Value =3D Pcd.DefaultValue - if Value in [None, '']: + if not Value: Pcd.MaxDatumSize =3D '1' elif Value[0] =3D=3D 'L': Pcd.MaxDatumSize =3D str((len(Value) - 2) * 2) diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Pyt= hon/AutoGen/GenC.py index ca54ac107e5d..a020d5f5e58a 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -867,7 +867,7 @@ def DynExPcdTokenNumberMapping(Info, AutoGenH): def GetPcdSize(Pcd): if Pcd.DatumType not in _NumericDataTypesList: Value =3D Pcd.DefaultValue - if Value in [None, '']: + if not Value: return 1 elif Value[0] =3D=3D 'L': return (len(Value) - 2) * 2 diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/= Source/Python/GenFds/FfsInfStatement.py index b92fa4d8033c..a26097813bcc 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -297,7 +297,7 @@ class FfsInfStatement(FfsInfStatementClassObject): =20 # Check value, if value are equal, no need to patch if Pcd.DatumType =3D=3D "VOID*": - if Pcd.InfDefaultValue =3D=3D DefaultValue or DefaultValue= in [None, '']: + if Pcd.InfDefaultValue =3D=3D DefaultValue or not DefaultV= alue: continue # Get the string size from FDF or DSC if DefaultValue[0] =3D=3D 'L': @@ -310,7 +310,7 @@ class FfsInfStatement(FfsInfStatementClassObject): if DscOverride: Pcd.MaxDatumSize =3D PatchPcd.MaxDatumSize # If no defined the maximum size in DSC, try to get curren= t size from INF - if Pcd.MaxDatumSize in ['', None]: + if not Pcd.MaxDatumSize: Pcd.MaxDatumSize =3D str(len(Pcd.InfDefaultValue.split= (','))) else: Base1 =3D Base2 =3D 10 diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseT= ools/Source/Python/GenFds/GenFdsGlobalVariable.py index 878b13d13c2d..3a745dc4175e 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -102,7 +102,7 @@ class GenFdsGlobalVariable: TargetTxt.LoadTargetTxtFile(BuildConfigurationFile) if DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF in TargetTxt.Targe= tTxtDictionary: BuildRuleFile =3D TargetTxt.TargetTxtDictionary[DataType.T= AB_TAT_DEFINES_BUILD_RULE_CONF] - if BuildRuleFile in [None, '']: + if not BuildRuleFile: BuildRuleFile =3D 'Conf/build_rule.txt' GenFdsGlobalVariable.__BuildRuleDatabase =3D BuildRule(BuildRu= leFile) ToolDefinitionFile =3D TargetTxt.TargetTxtDictionary[DataType.= TAB_TAT_DEFINES_TOOL_CHAIN_CONF] @@ -441,15 +441,15 @@ class GenFdsGlobalVariable: def GenerateSection(Output, Input, Type=3DNone, CompressionType=3DNone= , Guid=3DNone, GuidHdrLen=3DNone, GuidAttr=3D[], Ui=3DNone, Ver= =3DNone, InputAlign=3DNone, BuildNumber=3DNone, DummyFile=3DNone, IsMakefil= e=3DFalse): Cmd =3D ["GenSec"] - if Type not in [None, '']: + if Type: Cmd +=3D ["-s", Type] - if CompressionType not in [None, '']: + if CompressionType: Cmd +=3D ["-c", CompressionType] if Guid is not None: Cmd +=3D ["-g", Guid] if DummyFile is not None: Cmd +=3D ["--dummy", DummyFile] - if GuidHdrLen not in [None, '']: + if GuidHdrLen: Cmd +=3D ["-l", GuidHdrLen] if len(GuidAttr) !=3D 0: #Add each guided attribute @@ -461,7 +461,7 @@ class GenFdsGlobalVariable: Cmd +=3D ["--sectionalign", SecAlign] =20 CommandFile =3D Output + '.txt' - if Ui not in [None, '']: + if Ui: #Cmd +=3D ["-n", '"' + Ui + '"'] if IsMakefile: if Ui =3D=3D "$(MODULE_NAME)": @@ -480,7 +480,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.SectionHeader.pack_into(SectionData, = 0, Len & 0xff, (Len >> 8) & 0xff, (Len >> 16) & 0xff, 0x15) SaveFileOnChange(Output, SectionData.tostring()) =20 - elif Ver not in [None, '']: + elif Ver: Cmd +=3D ["-n", Ver] if BuildNumber: Cmd +=3D ["-j", BuildNumber] @@ -529,7 +529,7 @@ class GenFdsGlobalVariable: Cmd +=3D ["-x"] if CheckSum: Cmd +=3D ["-s"] - if Align not in [None, '']: + if Align: if Align not in mFfsValidAlign: Align =3D GenFdsGlobalVariable.GetAlignment (Align) for index in range(0, len(mFfsValidAlign) - 1): @@ -541,7 +541,7 @@ class GenFdsGlobalVariable: Cmd +=3D ["-o", Output] for I in range(0, len(Input)): Cmd +=3D ("-i", Input[I]) - if SectionAlign not in [None, '', []] and SectionAlign[I] not = in [None, '']: + if SectionAlign and SectionAlign[I]: Cmd +=3D ("-n", SectionAlign[I]) =20 CommandFile =3D Output + '.txt' @@ -566,7 +566,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs upda= te because of newer %s" % (Output, Input)) =20 Cmd =3D ["GenFv"] - if BaseAddress not in [None, '']: + if BaseAddress: Cmd +=3D ["-r", BaseAddress] =20 if ForceRebase =3D=3D False: @@ -578,9 +578,9 @@ class GenFdsGlobalVariable: Cmd +=3D ["-c"] if Dump: Cmd +=3D ["-p"] - if AddressFile not in [None, '']: + if AddressFile: Cmd +=3D ["-a", AddressFile] - if MapFile not in [None, '']: + if MapFile: Cmd +=3D ["-m", MapFile] if FileSystemGuid: Cmd +=3D ["-g", FileSystemGuid] @@ -597,7 +597,7 @@ class GenFdsGlobalVariable: GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs upda= te because of newer %s" % (Output, Input)) =20 Cmd =3D ["GenVtf"] - if BaseAddress not in [None, ''] and FvSize not in [None, ''] \ + if BaseAddress and FvSize \ and len(BaseAddress) =3D=3D len(FvSize): for I in range(0, len(BaseAddress)): Cmd +=3D ["-r", BaseAddress[I], "-s", FvSize[I]] @@ -618,13 +618,13 @@ class GenFdsGlobalVariable: Cmd =3D ["GenFw"] if Type.lower() =3D=3D "te": Cmd +=3D ["-t"] - if SubType not in [None, '']: + if SubType: Cmd +=3D ["-e", SubType] - if TimeStamp not in [None, '']: + if TimeStamp: Cmd +=3D ["-s", TimeStamp] - if Align not in [None, '']: + if Align: Cmd +=3D ["-a", Align] - if Padding not in [None, '']: + if Padding: Cmd +=3D ["-p", Padding] if Zero: Cmd +=3D ["-z"] diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py b/BaseTools/= Source/Python/Workspace/DscBuildData.py index 6943fab4e5c8..91a9928c00d2 100644 --- a/BaseTools/Source/Python/Workspace/DscBuildData.py +++ b/BaseTools/Source/Python/Workspace/DscBuildData.py @@ -641,10 +641,10 @@ class DscBuildData(PlatformBuildClassObject): self._SkuIds =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_SKU_ID, self._Arch] for Record in RecordList: - if Record[0] in [None, '']: + if not Record[0]: EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID nu= mber', File=3Dself.MetaFile, Line=3DRecord[-1= ]) - if Record[1] in [None, '']: + if not Record[1]: EdkLogger.error('build', FORMAT_INVALID, 'No Sku ID na= me', File=3Dself.MetaFile, Line=3DRecord[-1= ]) if not Pattern.match(Record[0]) and not HexPattern.match(R= ecord[0]): @@ -669,10 +669,10 @@ class DscBuildData(PlatformBuildClassObject): self.DefaultStores =3D OrderedDict() RecordList =3D self._RawData[MODEL_EFI_DEFAULT_STORES, self._A= rch] for Record in RecordList: - if Record[0] in [None, '']: + if not Record[0]: EdkLogger.error('build', FORMAT_INVALID, 'No DefaultSt= ores ID number', File=3Dself.MetaFile, Line=3DRecord[-1= ]) - if Record[1] in [None, '']: + if not Record[1]: EdkLogger.error('build', FORMAT_INVALID, 'No DefaultSt= ores ID name', File=3Dself.MetaFile, Line=3DRecord[-1= ]) if not Pattern.match(Record[0]) and not HexPattern.match(R= ecord[0]): diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py b/BaseTools/= Source/Python/Workspace/InfBuildData.py index cf5e1df3a523..602746de32f7 100644 --- a/BaseTools/Source/Python/Workspace/InfBuildData.py +++ b/BaseTools/Source/Python/Workspace/InfBuildData.py @@ -1116,7 +1116,7 @@ class InfBuildData(ModuleBuildClassObject): Pcd.DatumType =3D PcdInPackage.DatumType Pcd.MaxDatumSize =3D PcdInPackage.MaxDatumSize Pcd.InfDefaultValue =3D Pcd.DefaultValue - if Pcd.DefaultValue in [None, '']: + if not Pcd.DefaultValue: Pcd.DefaultValue =3D PcdInPackage.DefaultValue else: try: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239605040357.670623339288; Fri, 20 Apr 2018 08:53:25 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5ED762279CEFB; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B01F4226EA5AC for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811607" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:43 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 23/27] BaseTools: AutoGen - use dafultdict instead of dict X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" since we manually make each entry a set(), just use defaultdict(set) Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey --- BaseTools/Source/Python/AutoGen/AutoGen.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/= Python/AutoGen/AutoGen.py index 871afedcde4b..fbc3f1516c86 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -355,10 +355,9 @@ class WorkspaceAutoGen(AutoGen): # but the path (self.MetaFile.Path) is the real path for key in self.FdfProfile.InfDict: if key =3D=3D 'ArchTBD': - MetaFile_cache =3D {} + MetaFile_cache =3D defaultdict(set) for Arch in self.ArchList: Current_Platform_cache =3D self.BuildDatabase[self= .MetaFile, Arch, Target, Toolchain] - MetaFile_cache[Arch] =3D set() for Pkey in Current_Platform_cache.Modules: MetaFile_cache[Arch].add(Current_Platform_cach= e.Modules[Pkey].MetaFile) for Inf in self.FdfProfile.InfDict[key]: --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239582201523.6220209098025; Fri, 20 Apr 2018 08:53:02 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 8BAD42279CEE4; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3AD832274F3EF for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811610" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:44 -0700 Message-Id: <4d420ce32eff48b14794ef86420af7ba9b417d73.1524239028.git.jaben.carsey@intel.com> X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 24/27] BaseTools: GenFds - simplify testing for Hex number X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/GlobalData.py | 1 + BaseTools/Source/Python/GenFds/FdfParser.py | 9 +-------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/BaseTools/Source/Python/Common/GlobalData.py b/BaseTools/Sourc= e/Python/Common/GlobalData.py index f58dc5a8dda2..e3131b86cc60 100644 --- a/BaseTools/Source/Python/Common/GlobalData.py +++ b/BaseTools/Source/Python/Common/GlobalData.py @@ -62,6 +62,7 @@ gGuidPatternEnd =3D re.compile(r'{}$'.format(_GuidPattern= )) ## Regular expressions for HEX matching g4HexChar =3D re.compile(r'{}{{4}}'.format(_HexChar)) gHexPattern =3D re.compile(r'0[xX]{}+'.format(_HexChar)) +gHexPatternAll =3D re.compile(r'0[xX]{}+$'.format(_HexChar)) =20 ## Regular expressions for string identifier checking gIdentifierPattern =3D re.compile('^[a-zA-Z][a-zA-Z0-9_]*$', re.UNICODE) diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source= /Python/GenFds/FdfParser.py index b8848a25b4b2..fe4f2df0e1e1 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1183,13 +1183,6 @@ class FdfParser: =20 self.__GetOneChar() =20 - def __IsHex(self, HexStr): - if not HexStr.upper().startswith("0X"): - return False - if len(self.__Token) <=3D 2: - return False - return True if all(x in string.hexdigits for x in HexStr[2:]) else= False - ## __GetNextHexNumber() method # # Get next HEX data before a seperator @@ -1202,7 +1195,7 @@ class FdfParser: def __GetNextHexNumber(self): if not self.__GetNextToken(): return False - if self.__IsHex(self.__Token): + if gHexPatternAll.match(self.__Token): return True else: self.__UndoToken() --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239618777949.5408871407963; Fri, 20 Apr 2018 08:53:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D9A572279CF09; Fri, 20 Apr 2018 08:52:02 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id BE04D226EA5AD for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:53 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811613" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:45 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 25/27] BaseTools: AutoGen - use defaultdict to auto initialize X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/AutoGen/GenVar.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/BaseTools/Source/Python/AutoGen/GenVar.py b/BaseTools/Source/P= ython/AutoGen/GenVar.py index 37c168a84b43..99c6ed640c00 100644 --- a/BaseTools/Source/Python/AutoGen/GenVar.py +++ b/BaseTools/Source/Python/AutoGen/GenVar.py @@ -128,7 +128,7 @@ class VariableMgr(object): return var_value def process_variable_data(self): =20 - var_data =3D dict() + var_data =3D collections.defaultdict(collections.OrderedDict) =20 indexedvarinfo =3D collections.OrderedDict() for item in self.VarInfo: @@ -155,8 +155,6 @@ class VariableMgr(object): for item in default_data_buffer: default_data_array +=3D unpack("B",item) =20 - if (DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEFAULT) = not in var_data: - var_data[(DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES= _DEFAULT)] =3D collections.OrderedDict() var_data[(DataType.TAB_DEFAULT,DataType.TAB_DEFAULT_STORES_DEF= AULT)][index] =3D (default_data_buffer,sku_var_info[(DataType.TAB_DEFAULT,D= ataType.TAB_DEFAULT_STORES_DEFAULT)]) =20 for (skuid,defaultstoragename) in indexedvarinfo.get(index): @@ -177,8 +175,6 @@ class VariableMgr(object): =20 data_delta =3D self.calculate_delta(default_data_array, ot= hers_data_array) =20 - if (skuid,defaultstoragename) not in var_data: - var_data[(skuid,defaultstoragename)] =3D collections.O= rderedDict() var_data[(skuid,defaultstoragename)][index] =3D (data_delt= a,sku_var_info[(skuid,defaultstoragename)]) return var_data =20 --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1524239573151708.400395528223; Fri, 20 Apr 2018 08:52:53 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 3EEA22274F3D4; Fri, 20 Apr 2018 08:52:01 -0700 (PDT) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2CADF22512131 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:54 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811616" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:46 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/Common/MigrationUtilities.py | 568 ---------------= ----- BaseTools/Source/Python/Makefile | 1 - 2 files changed, 569 deletions(-) diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py b/BaseToo= ls/Source/Python/Common/MigrationUtilities.py deleted file mode 100644 index 0c93c72a60f6..000000000000 --- a/BaseTools/Source/Python/Common/MigrationUtilities.py +++ /dev/null @@ -1,568 +0,0 @@ -## @file -# Contains several utilitities shared by migration tools. -# -# 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 BS= D License -# which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. -# - -## -# Import Modules -# -import Common.LongFilePathOs as os -import re -import EdkLogger -from optparse import OptionParser -from Common.BuildToolError import * -from XmlRoutines import * -from CommonDataClass.CommonClass import * -from Common.LongFilePathSupport import OpenLongFilePath as open - -## Set all fields of CommonClass object. -# -# Set all attributes of CommonClass object from XML Dom object of XmlCommo= n. -# -# @param Common The destine CommonClass object. -# @param XmlCommon The source XML Dom object. -# -def SetCommon(Common, XmlCommon): - XmlTag =3D "Usage" - Common.Usage =3D XmlAttribute(XmlCommon, XmlTag).split() - - XmlTag =3D TAB_PCDS_FEATURE_FLAG - Common.FeatureFlag =3D XmlAttribute(XmlCommon, XmlTag) - =20 - XmlTag =3D "SupArchList" - Common.SupArchList =3D XmlAttribute(XmlCommon, XmlTag).split() - =20 - XmlTag =3D XmlNodeName(XmlCommon) + "/" + "HelpText" - Common.HelpText =3D XmlElement(XmlCommon, XmlTag) - - -## Set some fields of CommonHeaderClass object. -# -# Set Name, Guid, FileName and FullPath fields of CommonHeaderClass object= from -# XML Dom object of XmlCommonHeader, NameTag and FileName. -# -# @param CommonHeader The destine CommonClass object. -# @param XmlCommonHeader The source XML Dom object. -# @param NameTag The name tag in XML Dom object. -# @param FileName The file name of the XML file. -# -def SetIdentification(CommonHeader, XmlCommonHeader, NameTag, FileName): - XmlParentTag =3D XmlNodeName(XmlCommonHeader) - =20 - XmlTag =3D XmlParentTag + "/" + NameTag - CommonHeader.Name =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParentTag + "/" + "GuidValue" - CommonHeader.Guid =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParentTag + "/" + "Version" - CommonHeader.Version =3D XmlElement(XmlCommonHeader, XmlTag) - - CommonHeader.FileName =3D os.path.basename(FileName) - CommonHeader.FullPath =3D os.path.abspath(FileName) - - -## Regular expression to match specification and value. -mReSpecification =3D re.compile(r"(?P\w+)\s+(?P\w*)") - -## Add specification to specification dictionary. -# -# Abstract specification name, value pair from Specification String and ad= d them -# to specification dictionary. -# -# @param SpecificationDict The destine Specification dictionary. -# @param SpecificationString The source Specification String from which t= he -# specification name and value pair is abstrac= ted. -# -def AddToSpecificationDict(SpecificationDict, SpecificationString): - """Abstract specification name, value pair from Specification String""" - for SpecificationMatch in mReSpecification.finditer(SpecificationStrin= g): - Specification =3D SpecificationMatch.group("Specification") - Value =3D SpecificationMatch.group("Value") - SpecificationDict[Specification] =3D Value - -## Set all fields of CommonHeaderClass object. -# -# Set all attributes of CommonHeaderClass object from XML Dom object of -# XmlCommonHeader, NameTag and FileName. -# -# @param CommonHeader The destine CommonClass object. -# @param XmlCommonHeader The source XML Dom object. -# @param NameTag The name tag in XML Dom object. -# @param FileName The file name of the XML file. -# -def SetCommonHeader(CommonHeader, XmlCommonHeader): - """Set all attributes of CommonHeaderClass object from XmlCommonHeader= """ - XmlParent =3D XmlNodeName(XmlCommonHeader) - =20 - XmlTag =3D XmlParent + "/" + "Abstract" - CommonHeader.Abstract =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Description" - CommonHeader.Description =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Copyright" - CommonHeader.Copyright =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "License" - CommonHeader.License =3D XmlElement(XmlCommonHeader, XmlTag) - - XmlTag =3D XmlParent + "/" + "Specification" - Specification =3D XmlElement(XmlCommonHeader, XmlTag) - - AddToSpecificationDict(CommonHeader.Specification, Specification) - - XmlTag =3D XmlParent + "/" + "ModuleType" - CommonHeader.ModuleType =3D XmlElement(XmlCommonHeader, XmlTag) - - -## Load a new Cloned Record class object. -# -# Read an input XML ClonedRecord DOM object and return an object of Cloned= Record -# contained in the DOM object. -# -# @param XmlCloned A child XML DOM object in a Common XML DOM. -# -# @retvel ClonedRecord A new Cloned Record object created by XmlCl= oned. -# -def LoadClonedRecord(XmlCloned): - ClonedRecord =3D ClonedRecordClass() - - XmlTag =3D "Id" - ClonedRecord.Id =3D int(XmlAttribute(XmlCloned, XmlTag)) - - XmlTag =3D "FarGuid" - ClonedRecord.FarGuid =3D XmlAttribute(XmlCloned, XmlTag) - - XmlTag =3D "Cloned/PackageGuid" - ClonedRecord.PackageGuid =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/PackageVersion" - ClonedRecord.PackageVersion =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/ModuleGuid" - ClonedRecord.ModuleGuid =3D XmlElement(XmlCloned, XmlTag) - =20 - XmlTag =3D "Cloned/ModuleVersion" - ClonedRecord.ModuleVersion =3D XmlElement(XmlCloned, XmlTag) - =20 - return ClonedRecord - - -## Load a new Guid/Protocol/Ppi common class object. -# -# Read an input XML Guid/Protocol/Ppi DOM object and return an object of -# Guid/Protocol/Ppi contained in the DOM object. -# -# @param XmlGuidProtocolPpiCommon A child XML DOM object in a Common XML = DOM. -# -# @retvel GuidProtocolPpiCommon A new GuidProtocolPpiCommon class object -# created by XmlGuidProtocolPpiCommon. -# -def LoadGuidProtocolPpiCommon(XmlGuidProtocolPpiCommon): - GuidProtocolPpiCommon =3D GuidProtocolPpiCommonClass() - =20 - XmlTag =3D "Name" - GuidProtocolPpiCommon.Name =3D XmlAttribute(XmlGuidProtocolPpiCommon, = XmlTag) - - XmlParent =3D XmlNodeName(XmlGuidProtocolPpiCommon) - if XmlParent =3D=3D "Entry": - XmlTag =3D "%s/C_Name" % XmlParent - elif XmlParent =3D=3D "GuidCNames": - XmlTag =3D "%s/GuidCName" % XmlParent - else: - XmlTag =3D "%s/%sCName" % (XmlParent, XmlParent) - =20 - GuidProtocolPpiCommon.CName =3D XmlElement(XmlGuidProtocolPpiCommon, X= mlTag) - =20 - XmlTag =3D XmlParent + "/" + "GuidValue" - GuidProtocolPpiCommon.Guid =3D XmlElement(XmlGuidProtocolPpiCommon, Xm= lTag) - =20 - if XmlParent.endswith("Notify"): - GuidProtocolPpiCommon.Notify =3D True - - XmlTag =3D "GuidTypeList" - GuidTypes =3D XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag) - GuidProtocolPpiCommon.GuidTypeList =3D GuidTypes.split() - =20 - XmlTag =3D "SupModuleList" - SupModules =3D XmlAttribute(XmlGuidProtocolPpiCommon, XmlTag) - GuidProtocolPpiCommon.SupModuleList =3D SupModules.split() - - SetCommon(GuidProtocolPpiCommon, XmlGuidProtocolPpiCommon) - - return GuidProtocolPpiCommon - - -## Load a new Pcd class object. -# -# Read an input XML Pcd DOM object and return an object of Pcd -# contained in the DOM object. -# -# @param XmlPcd A child XML DOM object in a Common XML DOM. -# -# @retvel Pcd A new Pcd object created by XmlPcd. -# -def LoadPcd(XmlPcd): - """Return a new PcdClass object equivalent to XmlPcd""" - Pcd =3D PcdClass() - - XmlTag =3D "PcdEntry/C_Name" - Pcd.CName =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/Token" - Pcd.Token =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/TokenSpaceGuidCName" - Pcd.TokenSpaceGuidCName =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/DatumType" - Pcd.DatumType =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/MaxDatumSize" - Pcd.MaxDatumSize =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/DefaultValue" - Pcd.DefaultValue =3D XmlElement(XmlPcd, XmlTag) - - XmlTag =3D "PcdItemType" - Pcd.ItemType =3D XmlAttribute(XmlPcd, XmlTag) - - XmlTag =3D "PcdEntry/ValidUsage" - Pcd.ValidUsage =3D XmlElement(XmlPcd, XmlTag).split() - - XmlTag =3D "SupModuleList" - Pcd.SupModuleList =3D XmlAttribute(XmlPcd, XmlTag).split() - - SetCommon(Pcd, XmlPcd) - - return Pcd - - -## Load a new LibraryClass class object. -# -# Read an input XML LibraryClass DOM object and return an object of Librar= yClass -# contained in the DOM object. -# -# @param XmlLibraryClass A child XML DOM object in a Common XML DOM. -# -# @retvel LibraryClass A new LibraryClass object created by XmlLibra= ryClass. -# -def LoadLibraryClass(XmlLibraryClass): - LibraryClass =3D LibraryClassClass() - - XmlTag =3D "LibraryClass/Keyword" - LibraryClass.LibraryClass =3D XmlElement(XmlLibraryClass, XmlTag) - if LibraryClass.LibraryClass =3D=3D "": - XmlTag =3D "Name" - LibraryClass.LibraryClass =3D XmlAttribute(XmlLibraryClass, XmlTag) - =20 - XmlTag =3D "LibraryClass/IncludeHeader" - LibraryClass.IncludeHeader =3D XmlElement(XmlLibraryClass, XmlTag) - =20 - XmlTag =3D "RecommendedInstanceVersion" - RecommendedInstanceVersion =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.RecommendedInstanceVersion =3D RecommendedInstanceVersion - =20 - XmlTag =3D "RecommendedInstanceGuid" - RecommendedInstanceGuid =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.RecommendedInstanceGuid =3D RecommendedInstanceGuid - =20 - XmlTag =3D "SupModuleList" - SupModules =3D XmlAttribute(XmlLibraryClass, XmlTag) - LibraryClass.SupModuleList =3D SupModules.split() - =20 - SetCommon(LibraryClass, XmlLibraryClass) - =20 - return LibraryClass - - -## Load a new Build Option class object. -# -# Read an input XML BuildOption DOM object and return an object of Build O= ption -# contained in the DOM object. -# -# @param XmlBuildOption A child XML DOM object in a Common XML DOM. -# -# @retvel BuildOption A new Build Option object created by XmlBui= ldOption. -# -def LoadBuildOption(XmlBuildOption): - """Return a new BuildOptionClass object equivalent to XmlBuildOption""" - BuildOption =3D BuildOptionClass() - =20 - BuildOption.Option =3D XmlElementData(XmlBuildOption) - - XmlTag =3D "BuildTargets" - BuildOption.BuildTargetList =3D XmlAttribute(XmlBuildOption, XmlTag).s= plit() - =20 - XmlTag =3D "ToolChainFamily" - BuildOption.ToolChainFamily =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "TagName" - BuildOption.TagName =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "ToolCode" - BuildOption.ToolCode =3D XmlAttribute(XmlBuildOption, XmlTag) - =20 - XmlTag =3D "SupArchList" - BuildOption.SupArchList =3D XmlAttribute(XmlBuildOption, XmlTag).split= () - =20 - return BuildOption - - -## Load a new User Extensions class object. -# -# Read an input XML UserExtensions DOM object and return an object of User -# Extensions contained in the DOM object. -# -# @param XmlUserExtensions A child XML DOM object in a Common XML DOM. -# -# @retvel UserExtensions A new User Extensions object created by -# XmlUserExtensions. -# -def LoadUserExtensions(XmlUserExtensions): - UserExtensions =3D UserExtensionsClass() - =20 - XmlTag =3D "UserID" - UserExtensions.UserID =3D XmlAttribute(XmlUserExtensions, XmlTag) - =20 - XmlTag =3D "Identifier" - UserExtensions.Identifier =3D XmlAttribute(XmlUserExtensions, XmlTag) - =20 - UserExtensions.Content =3D XmlElementData(XmlUserExtensions) - =20 - return UserExtensions - - -## Store content to a text file object. -# -# Write some text file content to a text file object. The contents may echo -# in screen in a verbose way. -# -# @param TextFile The text file object. -# @param Content The string object to be written to a text fil= e. -# -def StoreTextFile(TextFile, Content): - EdkLogger.verbose(Content) - TextFile.write(Content) - - -## Add item to a section. -# -# Add an Item with specific CPU architecture to section dictionary. -# The possible duplication is ensured to be removed. -# -# @param Section Section dictionary indexed by CPU architectur= e. -# @param Arch CPU architecture: Ia32, X64, Ipf, ARM, AARCH6= 4, Ebc or Common. -# @param Item The Item to be added to section dictionary. -# -def AddToSection(Section, Arch, Item): - SectionArch =3D Section.get(Arch, []) - if Item not in SectionArch: - SectionArch.append(Item) - Section[Arch] =3D SectionArch - - -## Get section contents. -# -# Return the content of section named SectionName. -# the contents is based on Methods and ObjectLists. -# -# @param SectionName The name of the section. -# @param Method A function returning a string item of an obje= ct. -# @param ObjectList The list of object. -# -# @retval Section The string content of a section. -# -def GetSection(SectionName, Method, ObjectList): - SupportedArches =3D ["common", "Ia32", "X64", "Ipf", "Ebc", "ARM", "AA= RCH64"] - SectionDict =3D {} - for Object in ObjectList: - Item =3D Method(Object) - if Item =3D=3D "": - continue - Item =3D " %s" % Item - Arches =3D Object.SupArchList - if len(Arches) =3D=3D 0: - AddToSection(SectionDict, "common", Item) - else: - for Arch in SupportedArches: - if Arch.upper() in Arches: - AddToSection(SectionDict, Arch, Item) - - Section =3D "" - for Arch in SupportedArches: - SectionArch =3D "\n".join(SectionDict.get(Arch, [])) - if SectionArch !=3D "": - Section +=3D "[%s.%s]\n%s\n" % (SectionName, Arch, SectionArch) - Section +=3D "\n" - if Section !=3D "": - Section +=3D "\n" - return Section - - -## Store file header to a text file. -# -# Write standard file header to a text file. The content includes copyrigh= t, -# abstract, description and license extracted from CommonHeader class obje= ct. -# -# @param TextFile The text file object. -# @param CommonHeader The source CommonHeader class object. -# -def StoreHeader(TextFile, CommonHeader): - CopyRight =3D CommonHeader.Copyright - Abstract =3D CommonHeader.Abstract - Description =3D CommonHeader.Description - License =3D CommonHeader.License - - Header =3D "#/** @file\n#\n" - Header +=3D "# " + Abstract + "\n#\n" - Header +=3D "# " + Description.strip().replace("\n", "\n# ") + "\n" - Header +=3D "# " + CopyRight + "\n#\n" - Header +=3D "# " + License.replace("\n", "\n# ").replace(" ", " ") - Header +=3D "\n#\n#**/\n\n" - - StoreTextFile(TextFile, Header) - -## Store file header to a text file. -# -# Write Defines section to a text file. DefinesTupleList determines the co= ntent. -# -# @param TextFile The text file object. -# @param DefinesTupleList The list of (Tag, Value) to be added as one i= tem. -# -def StoreDefinesSection(TextFile, DefinesTupleList): - Section =3D "[Defines]\n" - for DefineItem in DefinesTupleList: - Section +=3D " %-30s =3D %s\n" % DefineItem - - Section +=3D "\n\n" - StoreTextFile(TextFile, Section) - - -## Return one User Extension section. -# -# Read the input UserExtentsions class object and return one section. -# -# @param UserExtensions An input UserExtensions class object. -# -# @retval UserExtensionSection A section representing UserExtensions objec= t. -# -def GetUserExtensions(UserExtensions): - UserId =3D UserExtensions.UserID - Identifier =3D UserExtensions.Identifier - Content =3D UserExtensions.Content - - return "[UserExtensions.%s.%s]\n %s\n\n" % (UserId, Identifier, Conte= nt) - -## Regular expression to match an equation. -mReEquation =3D re.compile(r"\s*(\S+)\s*=3D\s*(\S*)\s*") - -## Return a value tuple matching information in a text fle. -# -# Parse the text file and return a value tuple corresponding to an input t= ag -# tuple. In case of any error, an tuple of empty strings is returned. -# -# @param FileName The file name of the text file. -# @param TagTuple A tuple of tags as the key to the value. -# -# @param ValueTupe The returned tuple corresponding to the tag t= uple. -# -def GetTextFileInfo(FileName, TagTuple): - ValueTuple =3D [""] * len(TagTuple) - try: - for Line in open(FileName): - Line =3D Line.split("#", 1)[0] - MatchEquation =3D mReEquation.match(Line) - if MatchEquation: - Tag =3D MatchEquation.group(1).upper() - Value =3D MatchEquation.group(2) - for Index in range(len(TagTuple)): - if TagTuple[Index] =3D=3D Tag: - ValueTuple[Index] =3D Value - except: - EdkLogger.info("IO Error in reading file %s" % FileName) - =20 - return ValueTuple - - -## Return a value tuple matching information in an XML fle. -# -# Parse the XML file and return a value tuple corresponding to an input tag -# tuple. In case of any error, an tuple of empty strings is returned. -# -# @param FileName The file name of the XML file. -# @param TagTuple A tuple of tags as the key to the value. -# -# @param ValueTupe The returned tuple corresponding to the tag t= uple. -# -def GetXmlFileInfo(FileName, TagTuple): - XmlDom =3D XmlParseFile(FileName) - return tuple([XmlElement(XmlDom, XmlTag) for XmlTag in TagTuple]) - - -## Parse migration command line options -# -# Use standard Python module optparse to parse command line option of this= tool. -# -# @param Source The source file type. -# @param Destinate The destinate file type. -# -# @retval Options A optparse object containing the parsed optio= ns. -# @retval InputFile Path of an source file to be migrated. -# -def MigrationOptionParser(Source, Destinate, ToolName, VersionNumber=3D1.0= ): - # use clearer usage to override default usage message - UsageString =3D "%s [-a] [-v|-q] [-o ] " % To= olName - Version =3D "%s Version %.2f" % (ToolName, VersionNumber) - Copyright =3D "Copyright (c) 2007, Intel Corporation. All rights reser= ved." - =20 - Parser =3D OptionParser(description=3DCopyright, version=3DVersion, us= age=3DUsageString) - Parser.add_option("-o", "--output", dest=3D"OutputFile", help=3D"The n= ame of the %s file to be created." % Destinate) - Parser.add_option("-a", "--auto", dest=3D"AutoWrite", action=3D"store_= true", default=3DFalse, help=3D"Automatically create the %s file using the = name of the %s file and replacing file extension" % (Source, Destinate)) - Parser.add_option("-q", "--quiet", action=3D"store_true", type=3DNone,= help=3D"Disable all messages except FATAL ERRORS.") - Parser.add_option("-v", "--verbose", action=3D"store_true", type=3DNon= e, help=3D"Turn on verbose output with informational messages printed.") - - Options, Args =3D Parser.parse_args() - - # Set logging level - if Options.verbose: - EdkLogger.setLevel(EdkLogger.VERBOSE) - elif Options.quiet: - EdkLogger.setLevel(EdkLogger.QUIET) - else: - EdkLogger.setLevel(EdkLogger.INFO) - =20 - # error check - if len(Args) =3D=3D 0: - raise MigrationError(PARAMETER_MISSING, name=3D"Input file", usage= =3DParser.get_usage()) - if len(Args) > 1: - raise MigrationError(PARAMETER_INVALID, name=3D"Too many input fil= es", usage=3DParser.get_usage()) - - InputFile =3D Args[0] - if not os.path.exists(InputFile): - raise MigrationError(FILE_NOT_FOUND, name=3DInputFile) - - if Options.OutputFile: - if Options.AutoWrite: - raise MigrationError(OPTION_CONFLICT, arg1=3D"-o", arg2=3D"-a"= , usage=3DParser.get_usage()) - else: - if Options.AutoWrite: - Options.OutputFile =3D os.path.splitext(InputFile)[0] + "." + = Destinate.lower() - else: - raise MigrationError(OPTION_MISSING, name=3D"-o", usage=3DPars= er.get_usage()) - - return Options, InputFile - -# This acts like the main() function for the script, unless it is 'import'= ed -# into another script. -if __name__ =3D=3D '__main__': - pass diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Mak= efile index a51207d3d831..7652d2b80901 100644 --- a/BaseTools/Source/Python/Makefile +++ b/BaseTools/Source/Python/Makefile @@ -45,7 +45,6 @@ COMMON_PYTHON=3D$(BASE_TOOLS_PATH)\Source\Python\Common\B= uildToolError.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathOs.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathOsPath.p= y \ $(BASE_TOOLS_PATH)\Source\Python\Common\LongFilePathSupport.= py \ - $(BASE_TOOLS_PATH)\Source\Python\Common\MigrationUtilities.p= y \ $(BASE_TOOLS_PATH)\Source\Python\Common\Misc.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\Parsing.py \ $(BASE_TOOLS_PATH)\Source\Python\Common\String.py \ --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Thu May 2 15:26:02 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 152423962804053.66267126366574; Fri, 20 Apr 2018 08:53:48 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 33EFA2279CF12; Fri, 20 Apr 2018 08:52:03 -0700 (PDT) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id E9E3C226EA5B4 for ; Fri, 20 Apr 2018 08:51:56 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Apr 2018 08:51:55 -0700 Received: from jcarsey-desk1.amr.corp.intel.com ([10.7.159.144]) by orsmga003.jf.intel.com with ESMTP; 20 Apr 2018 08:51:54 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=jaben.carsey@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,302,1520924400"; d="scan'208";a="44811618" From: Jaben Carsey To: edk2-devel@lists.01.org Date: Fri, 20 Apr 2018 08:51:47 -0700 Message-Id: X-Mailer: git-send-email 2.16.2.windows.1 In-Reply-To: References: In-Reply-To: References: Subject: [edk2] [PATCH v1 27/27] BaseTools: CommonClass - remove unused classes X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Liming Gao MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" CommonDataClass/CommonClass has only 1 used class: SkuInfoClass remove all unused classes Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Jaben Carsey Reviewed-by: Yonghong Zhu =20 --- BaseTools/Source/Python/CommonDataClass/CommonClass.py | 397 +------------= ------- 1 file changed, 1 insertion(+), 396 deletions(-) diff --git a/BaseTools/Source/Python/CommonDataClass/CommonClass.py b/BaseT= ools/Source/Python/CommonDataClass/CommonClass.py index 6a8262e5e964..e29f5211d5c7 100644 --- a/BaseTools/Source/Python/CommonDataClass/CommonClass.py +++ b/BaseTools/Source/Python/CommonDataClass/CommonClass.py @@ -1,7 +1,7 @@ ## @file # This file is used to define common items of class object # -# 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 BS= D License # which accompanies this distribution. The full text of the license may= be found at @@ -11,240 +11,6 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMP= LIED. =20 =20 -# -# Generate help text -# -def GenerateHelpText(Text, Lang): - if Text: - Ht =3D HelpTextClass() - Ht.Lang =3D Lang - Ht.String =3D Text - =20 - return Ht - =20 - return None - -## CommonClass -# -# This class defined common items used in Module/Platform/Package files -#=20 -# @param object: Inherited from object class -# @param Usage: Input value for Usage, default is []=20 -# @param FeatureFlag: Input value for FeatureFalg, default is '' -# @param SupArchList: Input value for SupArchList, default is [] -# @param HelpText: Input value for HelpText, default is '' -# -# @var Usage: To store value for Usage, selection scope is in bel= ow list -# ALWAYS_CONSUMED | SOMETIMES_CONSUMED | ALWAYS_PRODU= CED | SOMETIMES_PRODUCED | TO_START | BY_START | PRIVATE -# @var FeatureFlag: To store value for FeatureFlag -# @var SupArchList: To store value for SupArchList, selection scope is = in below list -# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 -# @var HelpText: To store value for HelpText -# -class CommonClass(object): - def __init__(self, Usage =3D None, FeatureFlag =3D '', SupArchList =3D= None, HelpText =3D ''): - self.Usage =3D Usage - if self.Usage is None: - self.Usage =3D [] - self.FeatureFlag =3D FeatureFlag - self.SupArchList =3D SupArchList - if self.SupArchList is None: - self.SupArchList =3D [] - self.HelpText =3D HelpText - self.HelpTextList =3D [] - -## CommonHeaderClass -# -# This class defined common items used in Module/Platform/Package files -#=20 -# @param object: Inherited from object class -# -# @var Abstract: To store value for Abstract -# @var Description: To store value for Description -# @var Copyright: To store value for Copyright -# @var License: To store value for License -# @var Specification: To store value for Specification -# -class CommonHeaderClass(object): - def __init__(self): - self.Abstract =3D '' - self.Description =3D '' - self.Copyright =3D '' - self.License =3D '' - self.Specification =3D {} - -## HelpTextClass -# -# This class defined HelpText item used in PKG file -#=20 -# @param object: Inherited from object class -# -# @var Lang: To store value for Lang -# @var String: To store value for String -# -class HelpTextClass(object): - def __init__(self): - self.Lang =3D '' - self.String =3D '' - =20 -## DefineClass -# -# This class defined item DEFINE used in Module/Platform/Package files -# -# @param object: Inherited from object class -# -# @var Define: To store value for Define, it is a set structure as -# { (DefineName, Arch) : DefineValue, ... } -# -class DefineClass(object): - def __init__(self): - self.Define =3D {} - -## ClonedRecordClass -# -# This class defined ClonedRecord items used in Module/Platform/Package fi= les -#=20 -# @param object: Inherited from object class -# -# @var Id: To store value for Id -# @var FarGuid: To store value for FarGuid -# @var PackageGuid: To store value for PackageGuid -# @var PackageVersion: To store value for PackageVersion -# @var ModuleGuid: To store value for ModuleGuid -# @var ModuleVersion: To store value for ModuleVersion -# -class ClonedRecordClass(object): - def __init__(self): - self.Id =3D 0 - self.FarGuid =3D '' - self.PackageGuid =3D '' - self.PackageVersion =3D '' - self.ModuleGuid =3D '' - self.ModuleVersion =3D '' - -## IdentificationClass -# -# This class defined Identification items used in Module/Platform/Package = files -#=20 -# @param object: Inherited from object class -# -# @var Name: To store value for Name -# ModuleName(Inf) / PackageName(Dec) / PlatformName(Dsc) -# @var Guid: To store value for Guid -# @var Version: To store value for Version -# @var FileName: To store value for FileName -# @var FullPath: To store value for FullPath -# -class IdentificationClass(object): - def __init__(self): - self.Name =3D '' - self.BaseName =3D '' - self.Guid =3D '' - self.Version =3D '' - self.FileName =3D '' - self.FullPath =3D '' - self.RelaPath =3D '' - self.PackagePath =3D '' - self.ModulePath =3D '' - self.CombinePath =3D '' - -## IncludeStatementClass -# -# This class defined IncludeFiles item used in Module/Platform/Package fil= es -#=20 -# @param object: Inherited from object class -# -# @var IncludeFiles: To store value for IncludeFiles -# It is a set structure as { IncludeFile : [Arch1, Arc= h2, ...], ... } -# -class IncludeStatementClass(object): - def __init__(self): - self.IncludeFiles =3D {} =20 - -## GuidProtocolPpiCommonClass -# -# This class defined Guid, Protocol and Ppi like items used in Module/Plat= form/Package files -#=20 -# @param CommonClass: Inherited from CommonClass class -# -# @var Name: To store value for Name -# @var CName: To store value for CName -# @var Guid: To store value for Guid -# @var Notify: To store value for Notify -# @var GuidTypeList: To store value for GuidTypeList, selection scope is= in below list -# DATA_HUB_RECORD | EFI_EVENT | EFI_SYSTEM_CONFIGURAT= ION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOKEN_SPACE_GUID -# @var SupModuleList: To store value for SupModuleList, selection scope i= s in below list -# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | DXE_DRIVE= R | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRIVER | UE= FI_APPLICATION | USER_DEFINED | SMM_CORE | MM_STANDALONE | MM_CORE_STANDALO= NE -# -class GuidProtocolPpiCommonClass(CommonClass): - def __init__(self): - self.Name =3D '' - self.CName =3D '' - self.Guid =3D '' - self.VariableName =3D '' - self.Notify =3D False - self.GuidTypeList =3D [] - self.GuidTypeLists =3D [] - self.SupModuleList =3D [] =20 - CommonClass.__init__(self) - -## LibraryClassClass -# -# This class defined Library item used in Module/Platform/Package files -#=20 -# @param CommonClass: Inherited from CommonClass class -# @param DefineClass: Inherited from DefineClass class -# -# @var LibraryClass: To store value for LibraryClass -# @var IncludeHeader: To store value for IncludeHeader -# @var RecommendedInstanceVersion: To store value for RecommendedInstance= Version -# @var RecommendedInstanceGuid: To store value for RecommendedInstance= Guid -# @var RecommendedInstance: To store value for RecommendedInstance= , selection scope is in below list -# DATA_HUB_RECORD | EFI_EVENT | EFI_SYST= EM_CONFIGURATION_TABLE | EFI_VARIABLE | GUID | HII_PACKAGE_LIST | HOB | TOK= EN_SPACE_GUID -# @var SupModuleList: To store value for SupModuleList, sele= ction scope is in below list -# BASE | SEC | PEI_CORE | PEIM | DXE_COR= E | DXE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEF= I_DRIVER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE | MM_STANDALONE | MM_= CORE_STANDALONE -# -class LibraryClassClass(CommonClass, DefineClass): - def __init__(self): - self.LibraryClass =3D '' - self.IncludeHeader =3D '' - self.RecommendedInstanceVersion =3D '' - self.RecommendedInstanceGuid =3D '' - self.RecommendedInstance =3D '' - self.SupModuleList =3D [] - CommonClass.__init__(self) - DefineClass.__init__(self) - -## GuidClass -# -# This class defined Guid item used in Module/Platform/Package files -#=20 -# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommon= Class class -# -class GuidClass(GuidProtocolPpiCommonClass): - def __init__(self): - GuidProtocolPpiCommonClass.__init__(self) - -## ProtocolClass -# -# This class defined Protocol item used in Module/Platform/Package files -#=20 -# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommon= Class class -# -class ProtocolClass(GuidProtocolPpiCommonClass): - def __init__(self): - GuidProtocolPpiCommonClass.__init__(self) - -## PpiClass -# -# This class defined Ppi item used in Module/Platform/Package files -#=20 -# @param GuidProtocolPpiCommonClass: Inherited from GuidProtocolPpiCommon= Class class -# -class PpiClass(GuidProtocolPpiCommonClass): =20 - def __init__(self): - GuidProtocolPpiCommonClass.__init__(self) - ## SkuInfoClass # # This class defined SkuInfo item used in Module/Platform/Package files @@ -314,164 +80,3 @@ class SkuInfoClass(object): 'VpdOffset =3D ' + str(self.VpdOffset) + "," + \ 'DefaultValue =3D ' + str(self.DefaultValue) + "," return Rtn -## PcdErrorClass -# -# -# -class PcdErrorClass(object): - def __init__(self): - self.ValidValueList =3D '' - self.ValidValueListLang =3D '' - self.ValidValueRange =3D '' - self.Expression =3D '' - self.ErrorNumber =3D '' - self.ErrorMessage =3D [] - -## PcdClass -# -# This class defined Pcd item used in Module/Platform/Package files -#=20 -# @param CommonClass: Inherited from CommonClass class -# @param CName: Input value for CName, default is '' -# @param Token: Input value for Token, default is '' -# @param TokenSpaceGuidCName: Input value for TokenSpaceGuidCName, defaul= t is '' -# @param DatumType: Input value for DatumType, default is '' -# @param MaxDatumSize: Input value for MaxDatumSize, default is '' -# @param DefaultValue: Input value for DefaultValue, default is '' -# @param ItemType: Input value for ItemType, default is '' -# @param ValidUsage: Input value for ValidUsage, default is [] -# @param SkuInfoList: Input value for SkuInfoList, default is {} -# @param SupModuleList: Input value for SupModuleList, default is [] -# -# @var CName: To store value for CName -# @var Token: To store value for Token -# @var TokenSpaceGuidCName: To store value for TokenSpaceGuidCName -# @var DatumType: To store value for DatumType, selection sco= pe is in below list -# UINT8 | UINT16 | UINT32 | UINT64 | VOID* | = BOOLEAN=20 -# @var MaxDatumSize: To store value for MaxDatumSize -# @var DefaultValue: To store value for DefaultValue -# @var ItemType: To store value for ItemType, selection scop= e is in below list -# FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_I= N_MODULE | DYNAMIC | DYNAMIC_EX -# @var ValidUsage: To store value for ValidUsage, selection sc= ope is in below list -# FEATURE_FLAG | FIXED_AT_BUILD | PATCHABLE_I= N_MODULE | DYNAMIC | DYNAMIC_EX -# @var SkuInfoList: To store value for SkuInfoList -# It is a set structure as { [SkuIdName] : Sk= uInfoClass }=20 -# @var SupModuleList: To store value for SupModuleList, selection= scope is in below list -# BASE | SEC | PEI_CORE | PEIM | DXE_CORE | D= XE_DRIVER | DXE_RUNTIME_DRIVER | DXE_SAL_DRIVER | DXE_SMM_DRIVER | UEFI_DRI= VER | UEFI_APPLICATION | USER_DEFINED | SMM_CORE | MM_STANDALONE | MM_CORE_= STANDALONE -# -class PcdClass(CommonClass): - def __init__(self, CName =3D '', Token =3D '', TokenSpaceGuidCName =3D= '', DatumType =3D '', MaxDatumSize =3D '', DefaultValue =3D '', ItemType = =3D '', ValidUsage =3D None, SkuInfoList =3D None, SupModuleList =3D None): - self.CName =3D CName - self.Token =3D Token - self.TokenSpaceGuidCName =3D TokenSpaceGuidCName - self.DatumType =3D DatumType - self.MaxDatumSize =3D MaxDatumSize - self.DefaultValue =3D DefaultValue - self.ItemType =3D ItemType - self.ValidUsage =3D ValidUsage - self.PcdItemType =3D '' - self.TokenSpaceGuidValue =3D '' - self.PcdUsage =3D '' - self.PcdCName =3D '' - self.Value =3D '' - self.Offset =3D '' - if self.ValidUsage is None: - self.ValidUsage =3D [] - self.SkuInfoList =3D SkuInfoList - if self.SkuInfoList is None: - self.SkuInfoList =3D {} - self.SupModuleList =3D SupModuleList - if self.SupModuleList is None: - self.SupModuleList =3D [] - CommonClass.__init__(self) - self.PcdErrors =3D [] - -## BuildOptionClass -# -# This class defined BuildOption item used in Module/Platform/Package files -#=20 -# @param IncludeStatementClass: Inherited from IncludeStatementClass class -# @param ToolChainFamily: Input value for ToolChainFamily, default = is '' -# @param ToolChain: Input value for ToolChain, default is '' -# @param Option: Input value for Option, default is '' -# -# @var Statement: To store value for Statement -# It is a string in a special format as "Fa= mily:Target_TagName_Tarch_ToolCode_FLAGS =3D String" -# @var ToolChainFamily: To store value for ToolChainFamily -# @var ToolChain: To store value for ToolChain -# @var Option: To store value for Option -# @var BuildTarget: To store value for BuildTarget -# @var TagName: To store value for TagName -# @var ToolCode: To store value for ToolCode -# @var SupArchList: To store value for SupArchList, selection= scope is in below list -# EBC | IA32 | X64 | IPF | ARM | PPC | AARC= H64 -# -class BuildOptionClass(IncludeStatementClass): - def __init__(self, ToolChainFamily =3D '', ToolChain =3D '', Option = =3D ''): - IncludeStatementClass.__init__(self) - self.Statement =3D '' =20 - self.ToolChainFamily =3D ToolChainFamily - self.ToolChain =3D ToolChain - self.Option =3D Option - self.BuildTarget =3D '' - self.TagName =3D '' - self.ToolCode =3D '' - self.SupArchList =3D [] - -## IncludeClass -# -# This class defined Include item used in Module/Platform/Package files -#=20 -# @param CommonClass: Inherited from CommonClass class -# -# @var FilePath: To store value for FilePath -# @var ModuleType: To store value for ModuleType -# @var Comment: To store value for Comment -# -class IncludeClass(CommonClass): - def __init__(self): - self.FilePath =3D '' - self.ModuleType =3D '' - self.SupModuleList =3D [] - self.Comment =3D '' - CommonClass.__init__(self) =20 - -## FileClass -# -# -class FileClass(CommonClass): - def __init__(self): - self.Filename =3D '' - self.Executable =3D '' - self.Family =3D '' - self.FileType =3D '' - CommonClass.__init__(self) - =20 - -## MiscFileClass -# -# -class MiscFileClass(CommonHeaderClass): - def __init__(self): - CommonHeaderClass.__init__(self) - self.Name =3D '' - self.Files =3D [] - =20 - -## UserExtensionsClass -# -# This class defined UserExtensions item used in Module/Platform/Package f= iles -#=20 -# @param object: Inherited from object class -# -# @var UserID: To store value for UserID -# @var Identifier: To store value for Identifier -# @var Content: To store value for Content -# =20 -class UserExtensionsClass(object): - def __init__(self): - self.UserID =3D '' - self.Identifier =3D 0 - self.Content =3D '' - self.Defines =3D [] - self.BuildOptions =3D [] --=20 2.16.2.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel