[edk2-devel] [PATCH 1/1] BaseTools: Add comments in StructurePcd DSC file.

Yuwei Chen yuwei.chen at intel.com
Mon Nov 30 08:04:44 UTC 2020


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 added after the corresponding Pcd values in
StructurePcd.dsc file.

Cc: Bob Feng <bob.c.feng at intel.com>
Cc: Liming Gao <gaoliming at byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen at intel.com>
---
 BaseTools/Scripts/ConvertFceToStructurePcd.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index aeda3ff26dfe..6b3a81c6a7be 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -278,6 +278,7 @@ class Config(object):
     part = []
     for x in section[1:]:
         line=x.split('\n')[0]
+        comment = value_re.findall(line) # the string \\... in "Q...." line
         line=value_re.sub('',line) #delete \\... in "Q...." line
         list1=line.split(' ')
         value=self.value_parser(list1)
@@ -289,7 +290,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[0]
             part.append(text)
     return(part)
 
@@ -479,10 +480,10 @@ 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])
+          title='%s%s|L"%s"|%s|0x00||%s            #%s\n'%(PCD_NAME,c_name,c_name,self.guid.guid_parser(c_guid),self.attribute_dict[c_attribute],c_comment)
           if struct in all_struct:
             lstfile = stru_lst[struct]
             struct_dict=all_struct[struct]
@@ -498,7 +499,7 @@ class mainprocess(object):
             ERRORMSG.append("ERROR: Struct %s can't found in lst file" %struct)
           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)
+            info = "%s%s.%s|%s            #%s\n"%(PCD_NAME,c_name,offset_name,c_value,c_comment)
             inf = "%s%s\n"%(PCD_NAME,c_name)
             inf_list.append(inf)
             tmp_info[info]=title
-- 
2.27.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#68074): https://edk2.groups.io/g/devel/message/68074
Mute This Topic: https://groups.io/mt/78603740/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-





More information about the edk2-devel-archive mailing list