Re: [edk2-devel] [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD
Sure Chasel, thanks for the feedback. Will work on it. -Original Message- From: Chiu, Chasel Sent: Monday, October 18, 2021 1:10 PM To: Loo, Tung Lun ; devel@edk2.groups.io Cc: Ma, Maurice ; Desimone, Nathaniel L ; Zeng, Star Subject: RE: [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD Hi Tung Lun, Should we update ConfigEditorUserManual.md for this new function? Thanks, Chasel > -Original Message- > From: Loo, Tung Lun > Sent: Friday, October 15, 2021 8:39 AM > To: devel@edk2.groups.io > Cc: Loo, Tung Lun ; Ma, Maurice > ; Desimone, Nathaniel L > ; Zeng, Star ; > Chiu, Chasel > Subject: [PATCH] IntelFsp2Pkg: Add support for config editor to handle > multiple UPD > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3692 > > In several use cases in bootloader, there are multiple instances of > UPD with same signature header. As such, using previous version of > config editor to edit those will result in only overriding the first > found instance. This patch provides the flexibility to modify the instance > specified. > > Cc: Maurice Ma > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Chasel Chiu > > Signed-off-by: Loo Tung Lun > --- > IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 94 > ++- > --- > 1 file changed, 62 insertions(+), 32 deletions(-) > > diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > index b593885807..91c4180085 100644 > --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > @@ -1351,24 +1351,20 @@ option format '%s' !" % option) > act_cfg['value'] > option = act_cfg['option'] - > cfg_val = ''-bin_val = '' for > i in option.split(','): > if act_cfg['value'] in i:-bin_val = i+ > self.data_diff += \+'\n\nBinary: > ' \++ > act_cfg['name'] + ': ' \++ i + '\n' > elif > config_val in i:-cfg_val = i- >if cfg_val != '' and > bin_val != '':-self.data_diff += '\n\nBinary: >' \- > + act_cfg['name'] \-+ ': ' + > bin_val.replace(' ', '') \- > + '\nConfig file: ' \-+ act_cfg['name'] + > ': ' \- > + cfg_val.replace(' ', '') + '\n'+ > self.data_diff += \+ > '\nConfig file: ' \++ act_cfg['name'] > + ': ' + i > else:-self.data_diff += '\n\nBinary:' \+ > self.data_diff += '\n\nBinary: ' \ + > act_cfg['name'] + ': ' + > act_cfg['value'] \-+ '\nConfig file: ' + > act_cfg['name'] \+ > + '\nConfig file: ' + act_cfg['name'] \ + ': > ' + config_val + '\n' > def set_field_value(self, top, value_bytes, force=False):@@ -1477,33 > +1473,67 @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) > def get_bin_segment(self, bin_data): cfg_segs = > self.get_cfg_segment() > bin_segs = []+fsp_instance = [] for seg in cfg_segs: >key = > seg[0].encode()+print("key ", key) if key == 0: > bin_segs.append([seg[0], 0, len(bin_data)]) break > pos = > bin_data.find(key)-if pos >= 0:-# ensure no other > match for the > key-next_pos = bin_data.find(key, pos + len(seg[0]))- >if > next_pos >= 0:-if key == b'$SKLFSP$' or key == > b'$BSWFSP$':- > string = ('Warning: Multiple matches for %s in '- > 'binary!\n\nA > workaround applied to such '- 'FSP 1.x > binary to use second'- > ' match instead of first match!' % key)- > messagebox.showwarning('Warning!', string)-pos = > next_pos- > else:-print("Warning: Multiple matches for '%s' "- > "in binary, the 1st instance will be used !"- % > seg[0])- > bin_segs.append([seg[0], pos, seg[2]])- > self.binseg_dict[seg[0]] = pos- > else:+while pos != -1:+fsp_instance.append(pos)+ > pos = > bin_data.find(key, pos + len(seg[0]))+if len(fsp_instance) <= 0: > bin_segs.append([seg[0], -1, seg[2]]) > self.binseg_dict[seg[0]] = -1- > continue++elif len(fsp_instance) == 1:+ > bin_segs.append([seg[0], > fsp_instance[0], seg[2]])+
Re: [edk2-devel] [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD
Hi Tung Lun, Should we update ConfigEditorUserManual.md for this new function? Thanks, Chasel > -Original Message- > From: Loo, Tung Lun > Sent: Friday, October 15, 2021 8:39 AM > To: devel@edk2.groups.io > Cc: Loo, Tung Lun ; Ma, Maurice > ; Desimone, Nathaniel L > ; Zeng, Star ; Chiu, > Chasel > Subject: [PATCH] IntelFsp2Pkg: Add support for config editor to handle > multiple > UPD > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3692 > > In several use cases in bootloader, there are multiple instances of UPD with > same signature header. As such, using previous version of config editor to > edit > those will result in only overriding the first found instance. This patch > provides > the flexibility to modify the instance specified. > > Cc: Maurice Ma > Cc: Nate DeSimone > Cc: Star Zeng > Cc: Chasel Chiu > > Signed-off-by: Loo Tung Lun > --- > IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 94 > ++- > --- > 1 file changed, 62 insertions(+), 32 deletions(-) > > diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > index b593885807..91c4180085 100644 > --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py > @@ -1351,24 +1351,20 @@ option format '%s' !" % option) > act_cfg['value'] > option = act_cfg['option'] - > cfg_val = ''-bin_val = '' for > i in option.split(','): > if act_cfg['value'] in i:-bin_val = i+ > self.data_diff += \+'\n\nBinary: > ' \++ > act_cfg['name'] + ': ' \++ i + '\n' > elif > config_val in i:-cfg_val = i- >if cfg_val != '' and > bin_val != '':-self.data_diff += '\n\nBinary: >' \- > + act_cfg['name'] \-+ ': ' + > bin_val.replace(' ', '') \- > + '\nConfig file: ' \-+ act_cfg['name'] + > ': ' \- > + cfg_val.replace(' ', '') + '\n'+ > self.data_diff += \+ > '\nConfig file: ' \++ act_cfg['name'] > + ': ' + i > else:-self.data_diff += '\n\nBinary:' \+ > self.data_diff += '\n\nBinary: ' \ + > act_cfg['name'] + ': ' + > act_cfg['value'] \-+ '\nConfig file: ' + > act_cfg['name'] \+ > + '\nConfig file: ' + act_cfg['name'] \ + ': > ' + config_val + '\n' > def set_field_value(self, top, value_bytes, force=False):@@ -1477,33 +1473,67 > @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) > def get_bin_segment(self, bin_data): cfg_segs = > self.get_cfg_segment() > bin_segs = []+fsp_instance = [] for seg in cfg_segs: >key = > seg[0].encode()+print("key ", key) if key == 0: > bin_segs.append([seg[0], 0, len(bin_data)]) break > pos = > bin_data.find(key)-if pos >= 0:-# ensure no other > match for the > key-next_pos = bin_data.find(key, pos + len(seg[0]))- >if > next_pos >= 0:-if key == b'$SKLFSP$' or key == > b'$BSWFSP$':- > string = ('Warning: Multiple matches for %s in '- > 'binary!\n\nA > workaround applied to such '- 'FSP 1.x > binary to use second'- > ' match instead of first match!' % key)- > messagebox.showwarning('Warning!', string)-pos = > next_pos- > else:-print("Warning: Multiple matches for '%s' "- > "in binary, the 1st instance will be used !"- % > seg[0])- > bin_segs.append([seg[0], pos, seg[2]])- > self.binseg_dict[seg[0]] = pos- > else:+while pos != -1:+fsp_instance.append(pos)+ > pos = > bin_data.find(key, pos + len(seg[0]))+if len(fsp_instance) <= 0: > bin_segs.append([seg[0], -1, seg[2]]) > self.binseg_dict[seg[0]] = -1- > continue++elif len(fsp_instance) == 1:+ > bin_segs.append([seg[0], > fsp_instance[0], seg[2]])+self.binseg_dict[seg[0]] = > fsp_instance[0]+ > fsp_instance.clear()++else:++fsp_instance_root = > tkinter.Tk()++ > canvas1 = tkinter.Canvas(fsp_instance_root,+ >width=400, > height=400)+canvas1.pack()++entry1 = >
[edk2-devel] [PATCH] IntelFsp2Pkg: Add support for config editor to handle multiple UPD
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3692 In several use cases in bootloader, there are multiple instances of UPD with same signature header. As such, using previous version of config editor to edit those will result in only overriding the first found instance. This patch provides the flexibility to modify the instance specified. Cc: Maurice Ma Cc: Nate DeSimone Cc: Star Zeng Cc: Chasel Chiu Signed-off-by: Loo Tung Lun --- IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 94 ++ 1 file changed, 62 insertions(+), 32 deletions(-) diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py index b593885807..91c4180085 100644 --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py @@ -1351,24 +1351,20 @@ option format '%s' !" % option) act_cfg['value'] option = act_cfg['option'] -cfg_val = '' -bin_val = '' for i in option.split(','): if act_cfg['value'] in i: -bin_val = i +self.data_diff += \ +'\n\nBinary: ' \ ++ act_cfg['name'] + ': ' \ ++ i + '\n' elif config_val in i: -cfg_val = i -if cfg_val != '' and bin_val != '': -self.data_diff += '\n\nBinary:' \ -+ act_cfg['name'] \ -+ ': ' + bin_val.replace(' ', '') \ -+ '\nConfig file: ' \ -+ act_cfg['name'] + ': ' \ -+ cfg_val.replace(' ', '') + '\n' +self.data_diff += \ +'\nConfig file: ' \ ++ act_cfg['name'] + ': ' + i else: -self.data_diff += '\n\nBinary:' \ +self.data_diff += '\n\nBinary: ' \ + act_cfg['name'] + ': ' + act_cfg['value'] \ -+ '\nConfig file: ' + act_cfg['name'] \ ++ '\nConfig file: ' + act_cfg['name'] \ + ': ' + config_val + '\n' def set_field_value(self, top, value_bytes, force=False): @@ -1477,33 +1473,67 @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) def get_bin_segment(self, bin_data): cfg_segs = self.get_cfg_segment() bin_segs = [] +fsp_instance = [] for seg in cfg_segs: key = seg[0].encode() +print("key ", key) if key == 0: bin_segs.append([seg[0], 0, len(bin_data)]) break pos = bin_data.find(key) -if pos >= 0: -# ensure no other match for the key -next_pos = bin_data.find(key, pos + len(seg[0])) -if next_pos >= 0: -if key == b'$SKLFSP$' or key == b'$BSWFSP$': -string = ('Warning: Multiple matches for %s in ' - 'binary!\n\nA workaround applied to such ' - 'FSP 1.x binary to use second' - ' match instead of first match!' % key) -messagebox.showwarning('Warning!', string) -pos = next_pos -else: -print("Warning: Multiple matches for '%s' " - "in binary, the 1st instance will be used !" - % seg[0]) -bin_segs.append([seg[0], pos, seg[2]]) -self.binseg_dict[seg[0]] = pos -else: +while pos != -1: +fsp_instance.append(pos) +pos = bin_data.find(key, pos + len(seg[0])) +if len(fsp_instance) <= 0: bin_segs.append([seg[0], -1, seg[2]]) self.binseg_dict[seg[0]] = -1 -continue + +elif len(fsp_instance) == 1: +bin_segs.append([seg[0], fsp_instance[0], seg[2]]) +self.binseg_dict[seg[0]] = fsp_instance[0] +fsp_instance.clear() + +else: + +fsp_instance_root = tkinter.Tk() + +canvas1 = tkinter.Canvas(fsp_instance_root, + width=400, height=400) +canvas1.pack() + +entry1 = tkinter.Entry(fsp_instance_root) +