From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.1118.1607309006744428826 for ; Sun, 06 Dec 2020 18:43:26 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: yuwei.chen@intel.com) IronPort-SDR: bwOCb1bHiRekeAlFpaC8jm3Gj9W+mbIjOZvTUSqEmRF630/TJlIjvBYnoWKZpZe/1rjCuSqUq3 1+fp9W/CaM2w== X-IronPort-AV: E=McAfee;i="6000,8403,9827"; a="172863273" X-IronPort-AV: E=Sophos;i="5.78,398,1599548400"; d="scan'208";a="172863273" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2020 18:43:25 -0800 IronPort-SDR: udwoc4siiMhUNmJ3Rx+PrInJYZ/+2OncLXdx1vh23TvGb4nkxpecLTmvKE+vUKHids6NYYUtFz NQMYl9npnIpg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.78,398,1599548400"; d="scan'208";a="362931766" Received: from yuweipc.ccr.corp.intel.com ([10.239.158.34]) by orsmga008.jf.intel.com with ESMTP; 06 Dec 2020 18:43:24 -0800 From: "Yuwei Chen" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao Subject: [Patch v2 1/1] BaseTools: Add comments in StructurePcd DSC file. Date: Mon, 7 Dec 2020 10:43:23 +0800 Message-Id: <20201207024323.321-1-yuwei.chen@intel.com> X-Mailer: git-send-email 2.27.0.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently VFR files have variables comments which will not be added into StructurePcd.dsc file. Thus, it is not convenient for developer to Modify Pcds. To solve this problem, The comments will be modified to user friendly format and added after the corresponding Pcd values in StructurePcd.dsc file. Cc: Bob Feng Cc: Liming Gao Signed-off-by: Yuwei Chen --- BaseTools/Scripts/ConvertFceToStructurePcd.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py index aeda3ff26dfe..4bf790640fd2 100644 --- a/BaseTools/Scripts/ConvertFceToStructurePcd.py +++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py @@ -52,6 +52,7 @@ infstatement = '''[Pcd] SECTION='PcdsDynamicHii' PCD_NAME='gStructPcdTokenSpaceGuid.Pcd' +Max_Pcd_Len = 100 WARNING=[] ERRORMSG=[] @@ -278,6 +279,9 @@ class Config(object): part = [] for x in section[1:]: line=x.split('\n')[0] + comment_list = value_re.findall(line) # the string \\... in "Q...." line + comment_list[0] = comment_list[0].replace('//', '') + comment = comment_list[0].strip() line=value_re.sub('',line) #delete \\... in "Q...." line list1=line.split(' ') value=self.value_parser(list1) @@ -289,7 +293,7 @@ class Config(object): if attribute[0] in ['0x3','0x7']: offset = int(offset[0], 16) #help = help_re.findall(x) - text = offset, name[0], guid[0], value, attribute[0] + text = offset, name[0], guid[0], value, attribute[0], comment part.append(text) return(part) @@ -479,7 +483,7 @@ class mainprocess(object): tmp_id=[id_key] #['0_0',[(struct,[name...]),(struct,[name...])]] tmp_info={} #{name:struct} for section in config_dict[id_key]: - c_offset,c_name,c_guid,c_value,c_attribute = section + c_offset,c_name,c_guid,c_value,c_attribute,c_comment = section if c_name in efi_dict: struct = efi_dict[c_name] title='%s%s|L"%s"|%s|0x00||%s\n'%(PCD_NAME,c_name,c_name,self.guid.guid_parser(c_guid),self.attribute_dict[c_attribute]) @@ -499,9 +503,11 @@ class mainprocess(object): if c_offset in struct_dict: offset_name=struct_dict[c_offset] info = "%s%s.%s|%s\n"%(PCD_NAME,c_name,offset_name,c_value) + blank_length = Max_Pcd_Len - len(info) + info_comment = "%s%s.%s|%s%s# %s\n"%(PCD_NAME,c_name,offset_name,c_value,blank_length*" ",c_comment) inf = "%s%s\n"%(PCD_NAME,c_name) inf_list.append(inf) - tmp_info[info]=title + tmp_info[info_comment]=title else: print("ERROR: Can't find offset %s with struct name %s"%(c_offset,struct)) ERRORMSG.append("ERROR: Can't find offset %s with name %s"%(c_offset,struct)) -- 2.27.0.windows.1