From 759a0ec2ad17ba3915464d7e5b37af9003c2478f Mon Sep 17 00:00:00 2001 From: Rander Wang Date: Tue, 30 May 2023 21:54:16 +0800 Subject: [PATCH] ASoC: SOF: add exception node in sof debugfs directory It is used for binary dump of exception information. Signed-off-by: Rander Wang --- sound/soc/sof/ipc4.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/sound/soc/sof/ipc4.c b/sound/soc/sof/ipc4.c index d29a6e2bf995af..9d8ec6ea0e5539 100644 --- a/sound/soc/sof/ipc4.c +++ b/sound/soc/sof/ipc4.c @@ -542,6 +542,20 @@ static int sof_ipc4_init_msg_memory(struct snd_sof_dev *sdev) return 0; } +static void sof_ipc4_create_exception_debugfs_node(struct snd_sof_dev *sdev) +{ + u32 telemetry_data_offset; + + /* strip the first magic number dword */ + telemetry_data_offset = sdev->debug_box.offset + sizeof(u32) + + (SOF_IPC4_DEBUG_TELEMETRY_SLOT_ID + 1) * SOF_IPC4_DEBUG_SLOT_SIZE; + + snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM, + telemetry_data_offset, + SOF_IPC4_DEBUG_SLOT_SIZE, "exception", + SOF_DEBUGFS_ACCESS_D0_ONLY); +} + 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; @@ -569,6 +583,7 @@ static int ipc4_fw_ready(struct snd_sof_dev *sdev, struct sof_ipc4_msg *ipc4_msg sdev->debug_box.offset = snd_sof_dsp_get_window_offset(sdev, SOF_IPC4_DEBUG_WINDOW_IDX); + sof_ipc4_create_exception_debugfs_node(sdev); dev_dbg(sdev->dev, "mailbox upstream 0x%x - size 0x%x\n", inbox_offset, inbox_size);