Skip to content

Commit

Permalink
ASoC: SOF: ipc4: add a helper function to search debug slot
Browse files Browse the repository at this point in the history
Currently IPC4 supports GDB slot, telemetry slot and
debug slot. This helper function will be used to get
the slot offset in debug windows for further processing.

Signed-off-by: Rander Wang <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
Reviewed-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Guennadi Liakhovetski <[email protected]>
Signed-off-by: Peter Ujfalusi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
RanderWang authored and broonie committed Sep 19, 2023
1 parent 4287205 commit a397899
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sound/soc/sof/ipc4-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,7 @@ void sof_ipc4_update_cpc_from_manifest(struct snd_sof_dev *sdev,
struct sof_ipc4_fw_module *fw_module,
struct sof_ipc4_base_module_cfg *basecfg);

size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
u32 slot_type);

#endif
23 changes: 23 additions & 0 deletions sound/soc/sof/ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,29 @@ static int sof_ipc4_init_msg_memory(struct snd_sof_dev *sdev)
return 0;
}

size_t sof_ipc4_find_debug_slot_offset_by_type(struct snd_sof_dev *sdev,
u32 slot_type)
{
size_t slot_desc_type_offset;
u32 type;
int i;

/* The type is the second u32 in the slot descriptor */
slot_desc_type_offset = sdev->debug_box.offset + sizeof(u32);
for (i = 0; i < SOF_IPC4_MAX_DEBUG_SLOTS; i++) {
sof_mailbox_read(sdev, slot_desc_type_offset, &type, sizeof(type));

if (type == slot_type)
return sdev->debug_box.offset + (i + 1) * SOF_IPC4_DEBUG_SLOT_SIZE;

slot_desc_type_offset += SOF_IPC4_DEBUG_DESCRIPTOR_SIZE;
}

dev_dbg(sdev->dev, "Slot type %#x is not available in debug window\n", slot_type);
return 0;
}
EXPORT_SYMBOL(sof_ipc4_find_debug_slot_offset_by_type);

static int ipc4_fw_ready(struct snd_sof_dev *sdev, struct sof_ipc4_msg *ipc4_msg)
{
int inbox_offset, inbox_size, outbox_offset, outbox_size;
Expand Down

0 comments on commit a397899

Please sign in to comment.