summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2022-04-21 11:07:35 +0300
committerMark Brown <broonie@kernel.org>2022-04-25 13:58:49 +0100
commit19faf9ee06224c5db669539a10eae7c63f52f2e6 (patch)
treed311954edd137f8d6fca33c9e268de8a8c44352b
parent0fc88b5d42c646ecf4040f65c0f22cb9df42e69a (diff)
downloadlinux-19faf9ee06224c5db669539a10eae7c63f52f2e6.tar.bz2
ASoC: SOF: loader: Remove the old fw_ready related code
The fw_ready is handled internally to ipc3, we can remove the old code from the loader.c along with the functions only used by the fw_ready() Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Ajit Pandey <ajitkumar.pandey@amd.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Link: https://lore.kernel.org/r/20220421080735.31698-7-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/sof/ipc.c15
-rw-r--r--sound/soc/sof/loader.c227
-rw-r--r--sound/soc/sof/sof-priv.h9
3 files changed, 1 insertions, 250 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index 6f8ac3fb195f..48ea58dbc998 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -188,21 +188,6 @@ int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
}
EXPORT_SYMBOL(snd_sof_ipc_valid);
-int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev)
-{
- struct snd_sof_ipc_msg *msg;
-
- msg = &sdev->ipc->msg;
-
- msg->reply_data = devm_kzalloc(sdev->dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL);
- if (!msg->reply_data)
- return -ENOMEM;
-
- sdev->ipc->max_payload_size = SOF_IPC_MSG_MAX_SIZE;
-
- return 0;
-}
-
struct snd_sof_ipc *snd_sof_ipc_init(struct snd_sof_dev *sdev)
{
struct snd_sof_ipc *ipc;
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 697f03565a70..b0d192749734 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -86,69 +86,6 @@ static int get_cc_info(struct snd_sof_dev *sdev,
return 0;
}
-/* parse the extended FW boot data structures from FW boot message */
-static int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 offset)
-{
- struct sof_ipc_ext_data_hdr *ext_hdr;
- void *ext_data;
- int ret = 0;
-
- ext_data = kzalloc(PAGE_SIZE, GFP_KERNEL);
- if (!ext_data)
- return -ENOMEM;
-
- /* get first header */
- snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, ext_data,
- sizeof(*ext_hdr));
- ext_hdr = ext_data;
-
- while (ext_hdr->hdr.cmd == SOF_IPC_FW_READY) {
- /* read in ext structure */
- snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM,
- offset + sizeof(*ext_hdr),
- (void *)((u8 *)ext_data + sizeof(*ext_hdr)),
- ext_hdr->hdr.size - sizeof(*ext_hdr));
-
- dev_dbg(sdev->dev, "found ext header type %d size 0x%x\n",
- ext_hdr->type, ext_hdr->hdr.size);
-
- /* process structure data */
- switch (ext_hdr->type) {
- case SOF_IPC_EXT_WINDOW:
- ret = get_ext_windows(sdev, ext_hdr);
- break;
- case SOF_IPC_EXT_CC_INFO:
- ret = get_cc_info(sdev, ext_hdr);
- break;
- case SOF_IPC_EXT_UNUSED:
- case SOF_IPC_EXT_PROBE_INFO:
- case SOF_IPC_EXT_USER_ABI_INFO:
- /* They are supported but we don't do anything here */
- break;
- default:
- dev_info(sdev->dev, "unknown ext header type %d size 0x%x\n",
- ext_hdr->type, ext_hdr->hdr.size);
- ret = 0;
- break;
- }
-
- if (ret < 0) {
- dev_err(sdev->dev, "error: failed to parse ext data type %d\n",
- ext_hdr->type);
- break;
- }
-
- /* move to next header */
- offset += ext_hdr->hdr.size;
- snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, ext_data,
- sizeof(*ext_hdr));
- ext_hdr = ext_data;
- }
-
- kfree(ext_data);
- return ret;
-}
-
static int ext_man_get_fw_version(struct snd_sof_dev *sdev,
const struct sof_ext_man_elem_header *hdr)
{
@@ -358,170 +295,6 @@ static int snd_sof_fw_ext_man_parse(struct snd_sof_dev *sdev,
return ext_man_size;
}
-/*
- * IPC Firmware ready.
- */
-static void sof_get_windows(struct snd_sof_dev *sdev)
-{
- struct sof_ipc_window_elem *elem;
- u32 outbox_offset = 0;
- u32 stream_offset = 0;
- u32 inbox_offset = 0;
- u32 outbox_size = 0;
- u32 stream_size = 0;
- u32 inbox_size = 0;
- u32 debug_size = 0;
- u32 debug_offset = 0;
- int window_offset;
- int i;
-
- if (!sdev->info_window) {
- dev_err(sdev->dev, "error: have no window info\n");
- return;
- }
-
- for (i = 0; i < sdev->info_window->num_windows; i++) {
- elem = &sdev->info_window->window[i];
-
- window_offset = snd_sof_dsp_get_window_offset(sdev, elem->id);
- if (window_offset < 0) {
- dev_warn(sdev->dev, "warn: no offset for window %d\n",
- elem->id);
- continue;
- }
-
- switch (elem->type) {
- case SOF_IPC_REGION_UPBOX:
- inbox_offset = window_offset + elem->offset;
- inbox_size = elem->size;
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- inbox_offset,
- elem->size, "inbox",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_DOWNBOX:
- outbox_offset = window_offset + elem->offset;
- outbox_size = elem->size;
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- outbox_offset,
- elem->size, "outbox",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_TRACE:
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- window_offset + elem->offset,
- elem->size, "etrace",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_DEBUG:
- debug_offset = window_offset + elem->offset;
- debug_size = elem->size;
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- window_offset + elem->offset,
- elem->size, "debug",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_STREAM:
- stream_offset = window_offset + elem->offset;
- stream_size = elem->size;
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- stream_offset,
- elem->size, "stream",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_REGS:
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- window_offset + elem->offset,
- elem->size, "regs",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- case SOF_IPC_REGION_EXCEPTION:
- sdev->dsp_oops_offset = window_offset + elem->offset;
- snd_sof_debugfs_add_region_item(sdev, SOF_FW_BLK_TYPE_SRAM,
- window_offset + elem->offset,
- elem->size, "exception",
- SOF_DEBUGFS_ACCESS_D0_ONLY);
- break;
- default:
- dev_err(sdev->dev, "error: get illegal window info\n");
- return;
- }
- }
-
- if (outbox_size == 0 || inbox_size == 0) {
- dev_err(sdev->dev, "error: get illegal mailbox window\n");
- return;
- }
-
- sdev->dsp_box.offset = inbox_offset;
- sdev->dsp_box.size = inbox_size;
-
- sdev->host_box.offset = outbox_offset;
- sdev->host_box.size = outbox_size;
-
- sdev->stream_box.offset = stream_offset;
- 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",
- inbox_offset, inbox_size);
- dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
- outbox_offset, outbox_size);
- dev_dbg(sdev->dev, " stream region 0x%x - size 0x%x\n",
- 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 */
-int sof_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
-{
- struct sof_ipc_fw_ready *fw_ready = &sdev->fw_ready;
- int offset;
- int ret;
-
- /* mailbox must be on 4k boundary */
- offset = snd_sof_dsp_get_mailbox_offset(sdev);
- if (offset < 0) {
- dev_err(sdev->dev, "error: have no mailbox offset\n");
- return offset;
- }
-
- dev_dbg(sdev->dev, "ipc: DSP is ready 0x%8.8x offset 0x%x\n",
- msg_id, offset);
-
- /* no need to re-check version/ABI for subsequent boots */
- if (!sdev->first_boot)
- return 0;
-
- /*
- * copy data from the DSP FW ready offset
- * Subsequent error handling is not needed for BLK_TYPE_SRAM
- */
- ret = snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, fw_ready,
- sizeof(*fw_ready));
- if (ret) {
- dev_err(sdev->dev,
- "error: unable to read fw_ready, read from TYPE_SRAM failed\n");
- return ret;
- }
-
- /* make sure ABI version is compatible */
- ret = snd_sof_ipc_valid(sdev);
- if (ret < 0)
- return ret;
-
- /* now check for extended data */
- snd_sof_fw_parse_ext_data(sdev, offset + sizeof(struct sof_ipc_fw_ready));
-
- sof_get_windows(sdev);
-
- return sof_ipc_init_msg_memory(sdev);
-}
-EXPORT_SYMBOL(sof_fw_ready);
-
/* generic module parser for mmaped DSPs */
int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev,
struct snd_sof_mod_hdr *module)
diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h
index 6a09e5a73a50..382187e89e54 100644
--- a/sound/soc/sof/sof-priv.h
+++ b/sound/soc/sof/sof-priv.h
@@ -181,11 +181,6 @@ struct snd_sof_dsp_ops {
int (*load_firmware)(struct snd_sof_dev *sof_dev); /* mandatory */
int (*load_module)(struct snd_sof_dev *sof_dev,
struct snd_sof_mod_hdr *hdr); /* optional */
- /*
- * FW ready checks for ABI compatibility and creates
- * memory windows at first boot
- */
- int (*fw_ready)(struct snd_sof_dev *sdev, u32 msg_id); /* mandatory */
/* connect pcm substream to a host stream */
int (*pcm_open)(struct snd_sof_dev *sdev,
@@ -614,7 +609,7 @@ int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg
void *reply_data, size_t reply_bytes);
int sof_ipc_send_msg(struct snd_sof_dev *sdev, void *msg_data, size_t msg_bytes,
size_t reply_bytes);
-int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev);
+
static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_id)
{
snd_sof_ipc_get_reply(sdev);
@@ -685,8 +680,6 @@ int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
u32 offset, void *dest, size_t size);
-int sof_fw_ready(struct snd_sof_dev *sdev, u32 msg_id);
-
int sof_ipc_msg_data(struct snd_sof_dev *sdev,
struct snd_pcm_substream *substream,
void *p, size_t sz);