tools: sof-ri-info: move parsing adsp mft outside cse mft

There might be binaries where cse mft is not included.
And adsp mft begins at std offset 0x2000 from the optional
extended manifest.

Signed-off-by: Marcin Maka <marcin.maka@linux.intel.com>
This commit is contained in:
Marcin Maka 2020-05-20 13:24:29 +02:00
parent dcefb7f753
commit 8885b465df
1 changed files with 11 additions and 6 deletions

View File

@ -316,7 +316,7 @@ def parse_extended_manifest(reader):
return ext_mft
def parse_cse_manifest(reader, add_module_entries):
def parse_cse_manifest(reader):
""" Parses CSE manifest form sof binary
"""
cse_mft = CseManifest(reader.get_offset())
@ -359,6 +359,9 @@ def parse_cse_manifest(reader, add_module_entries):
hdr_entry.add_a(Ahex('entry_length', entry_length))
hdr.add_comp(hdr_entry)
reader.info('CSE Entry name {} length {}'.format(entry_name,
entry_length))
if '.man' in entry_name:
entry = CssManifest(entry_name, entry_offset)
cur_off = reader.set_offset(reader.ext_mft_length + entry_offset)
@ -371,10 +374,8 @@ def parse_cse_manifest(reader, add_module_entries):
entry.name = '{} ({})'.format(entry_name, entry.name)
reader.set_offset(cur_off)
else:
# override offset with precise one
cur_off = reader.set_offset(reader.ext_mft_length + 0x2000)
entry = parse_adsp_manifest(reader, entry_name, add_module_entries)
reader.set_offset(cur_off)
# indicate the place, the entry is enumerated. mft parsed later
entry = Component('adsp_mft_cse_entry', entry_name, entry_offset)
cse_mft.add_comp(entry)
nb_index += 1
@ -576,7 +577,10 @@ def parse_fw_bin(path, verbose, add_module_entries):
parsed_bin.add_a(Astring('file_name', reader.file_name))
parsed_bin.add_a(Auint('file_size', reader.file_size))
parsed_bin.add_comp(parse_extended_manifest(reader))
parsed_bin.add_comp(parse_cse_manifest(reader, add_module_entries))
parsed_bin.add_comp(parse_cse_manifest(reader))
reader.set_offset(reader.ext_mft_length + 0x2000)
parsed_bin.add_comp(parse_adsp_manifest(reader, 'cavs0015',
add_module_entries))
reader.info('Parsing finished', show_offset = False)
return parsed_bin
@ -587,6 +591,7 @@ class BinReader():
def __init__(self, path, verbose):
self.verbose = verbose
self.cur_offset = 0
self.ext_mft_length = 0
self.info('Reading SOF ri image ' + path)
self.file_name = path
# read the content