Skip to content

Commit 1857434

Browse files
committed
tools: sof_ri_info: fix CSE v2.5 detection and module config count
Address review feedback on the manifest dumper: - The legacy v1.x CsePartitionDirHeader is 16 bytes while the v2.5 header is 20 bytes, so a "header_length > 12" test sent legacy images down the v2.5 path, mislabelling their checksum byte as not_used and consuming the first entry dword as checksum32. Discriminate on the v2.5 header length (>= 20) so 16-byte headers stay on the legacy path. - Module configs are not one-per-module-entry: each module advertises its own cfg_count and the configs are packed contiguously, so the total written can exceed num_module_entries. Sum every module's cfg_count and dump that many configs instead of dropping the extras. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
1 parent 5fa4400 commit 1857434

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

tools/sof_ri_info/sof_ri_info.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,14 +852,17 @@ def parse_cse_manifest(reader):
852852
header_length = reader.read_b()
853853
hdr.add_a(Ahex('header_length', header_length))
854854
legacy_or_unused = reader.read_b()
855-
if header_length > 12:
855+
# The v2.5 header (length 20) moves the checksum to a trailing CRC32 dword
856+
# and leaves this byte unused. The legacy v1.x header (length 16) keeps the
857+
# single-byte BSD checksum here, so discriminate on the v2.5 header length.
858+
if header_length >= 20:
856859
hdr.add_a(Ahex('not_used', legacy_or_unused))
857860
else:
858861
hdr.add_a(Ahex('checksum', legacy_or_unused))
859862
hdr.add_a(Astring('partition_name', reader.read_string(4)))
860863

861864
# CSE v2.5 extends header with a CRC32 checksum dword
862-
if header_length > 12:
865+
if header_length >= 20:
863866
hdr.add_a(Ahex('checksum32', reader.read_dw()))
864867

865868
reader.set_offset(cse_mft.file_offset + header_length)
@@ -1283,11 +1286,16 @@ def parse_adsp_manifest(reader, name):
12831286
adsp_mft = AdspManifest(name, reader.get_offset())
12841287
adsp_mft.add_comp(parse_adsp_manifest_hdr(reader))
12851288
num_module_entries = adsp_mft.cdir['adsp_mft_hdr'].adir['num_module_entries'].val
1289+
# Each module advertises its own cfg_count; the configs are packed
1290+
# contiguously after the module entries, so the total number written is the
1291+
# sum of every module's cfg_count (which can exceed num_module_entries).
1292+
num_mod_configs = 0
12861293
for i in range(0, num_module_entries):
12871294
mod_entry = parse_adsp_manifest_mod_entry(i, reader)
12881295
adsp_mft.add_comp(mod_entry)
1296+
num_mod_configs += mod_entry.adir['cfg_count'].val
12891297

1290-
for i in range(0, num_module_entries):
1298+
for i in range(0, num_mod_configs):
12911299
mod_cfg = parse_adsp_manifest_mod_config(i, reader)
12921300
adsp_mft.add_comp(mod_cfg)
12931301

0 commit comments

Comments
 (0)