Commit e17b7389 authored by Iulian Olaru's avatar Iulian Olaru Committed by Mark Brown

ASoC: SOF: loader: Add debug box region

This patch adds an IPC initiated debug box region in the snd_sof_dev
structure, defined in soc/sof/sof-priv.h. It is initialized at loading,
in the sof_get_windows function from soc/sof/loader.c, in a similar manner
with the stream box and host box.

This region is useful because the firmware will put an error message
here so the kernel can read it in case of a dsp oops.
Signed-off-by: default avatarIulian Olaru <iulianolaru249@yahoo.com>
Reviewed-by: default avatarDaniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200825235854.1588034-5-ranjani.sridharan@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 60b7c1ba
...@@ -310,6 +310,8 @@ static void sof_get_windows(struct snd_sof_dev *sdev) ...@@ -310,6 +310,8 @@ static void sof_get_windows(struct snd_sof_dev *sdev)
u32 outbox_size = 0; u32 outbox_size = 0;
u32 stream_size = 0; u32 stream_size = 0;
u32 inbox_size = 0; u32 inbox_size = 0;
u32 debug_size = 0;
u32 debug_offset = 0;
int window_offset; int window_offset;
int bar; int bar;
int i; int i;
...@@ -363,6 +365,8 @@ static void sof_get_windows(struct snd_sof_dev *sdev) ...@@ -363,6 +365,8 @@ static void sof_get_windows(struct snd_sof_dev *sdev)
SOF_DEBUGFS_ACCESS_D0_ONLY); SOF_DEBUGFS_ACCESS_D0_ONLY);
break; break;
case SOF_IPC_REGION_DEBUG: case SOF_IPC_REGION_DEBUG:
debug_offset = window_offset + elem->offset;
debug_size = elem->size;
snd_sof_debugfs_io_item(sdev, snd_sof_debugfs_io_item(sdev,
sdev->bar[bar] + sdev->bar[bar] +
window_offset + window_offset +
...@@ -412,12 +416,17 @@ static void sof_get_windows(struct snd_sof_dev *sdev) ...@@ -412,12 +416,17 @@ static void sof_get_windows(struct snd_sof_dev *sdev)
sdev->stream_box.offset = stream_offset; sdev->stream_box.offset = stream_offset;
sdev->stream_box.size = stream_size; sdev->stream_box.size = stream_size;
sdev->debug_box.offset = debug_offset;
sdev->debug_box.size = debug_size;
dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n", dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
inbox_offset, inbox_size); inbox_offset, inbox_size);
dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n", dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
outbox_offset, outbox_size); outbox_offset, outbox_size);
dev_dbg(sdev->dev, " stream region 0x%x - size 0x%x\n", dev_dbg(sdev->dev, " stream region 0x%x - size 0x%x\n",
stream_offset, stream_size); stream_offset, stream_size);
dev_dbg(sdev->dev, " debug region 0x%x - size 0x%x\n",
debug_offset, debug_size);
} }
/* check for ABI compatibility and create memory windows on first boot */ /* check for ABI compatibility and create memory windows on first boot */
......
...@@ -383,6 +383,7 @@ struct snd_sof_dev { ...@@ -383,6 +383,7 @@ struct snd_sof_dev {
struct snd_sof_mailbox dsp_box; /* DSP initiated IPC */ struct snd_sof_mailbox dsp_box; /* DSP initiated IPC */
struct snd_sof_mailbox host_box; /* Host initiated IPC */ struct snd_sof_mailbox host_box; /* Host initiated IPC */
struct snd_sof_mailbox stream_box; /* Stream position update */ struct snd_sof_mailbox stream_box; /* Stream position update */
struct snd_sof_mailbox debug_box; /* Debug info updates */
struct snd_sof_ipc_msg *msg; struct snd_sof_ipc_msg *msg;
int ipc_irq; int ipc_irq;
u32 next_comp_id; /* monotonic - reset during S3 */ u32 next_comp_id; /* monotonic - reset during S3 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment