Skip to content

Commit

Permalink
soc: intel_adsp: tools: cavstool.py: Add debug_slot_offset_by_type()
Browse files Browse the repository at this point in the history
Add debug_slot_offset_by_type() for getting debug window slot offset
by type identifier. How to find the correct slot and what types there
are is documented here:

soc/intel/intel_adsp/common/include/adsp_debug_window.h

In a normal situation a client program would try to find a specific
slot right after DSP boot. Because of that the we can not expect it to
be there immediately. Instead we need to try multiple times and give
firmware some time to update the debug slot descriptor table.

Signed-off-by: Jyri Sarha <[email protected]>
  • Loading branch information
Jyri Sarha committed Oct 3, 2024
1 parent 44d101a commit 204db73
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions soc/intel/intel_adsp/tools/cavstool.py
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,26 @@ def debug_offset():
def debug_slot_offset(num):
return debug_offset() + DEBUG_SLOT_SIZE * (1 + num)

def debug_slot_offset_by_type(the_type, timeout_s=0.2):
ADSP_DW_SLOT_COUNT=15
hertz = 100
attempts = timeout_s * hertz
while attempts > 0:
data = win_read(debug_offset(), 0, ADSP_DW_SLOT_COUNT * 3 * 4)
for i in range(ADSP_DW_SLOT_COUNT):
start_index = i * (3 * 4)
end_index = (i + 1) * (3 * 4)
desc = data[start_index:end_index]
resource_id, type_id, vma = struct.unpack('<III', desc)
if type_id == the_type:
log.info("found desc %u resource_id 0x%08x type_id 0x%08x vma 0x%08x",
i, resource_id, type_id, vma)
return debug_slot_offset(i)
log.debug("not found, %u attempts left", attempts)
attempts -= 1
time.sleep(1 / hertz)
return None

def shell_base_offset():
return debug_offset() + DEBUG_SLOT_SIZE * (1 + DEBUG_SLOT_SHELL)

Expand Down

0 comments on commit 204db73

Please sign in to comment.