ASoC: SOF: loader: Remove snd_sof_parse_module_memcpy() as it is not used
The snd_sof_parse_module_memcpy() is no longer used and we have the implementation of it in ipc3-loader.c which is a default mode to load module(s) with IPC3 if the snd_sof_load_firmware_memcpy() is used for loading the firmware. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Rander Wang <rander.wang@intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220425221129.124615-10-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
committed by
Mark Brown
parent
77b677d139
commit
910bd536d3
@ -11,94 +11,9 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <linux/firmware.h>
|
#include <linux/firmware.h>
|
||||||
#include <sound/sof.h>
|
|
||||||
#include <sound/sof/ext_manifest.h>
|
|
||||||
#include "sof-priv.h"
|
#include "sof-priv.h"
|
||||||
#include "ops.h"
|
#include "ops.h"
|
||||||
|
|
||||||
/* generic module parser for mmaped DSPs */
|
|
||||||
int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev,
|
|
||||||
struct snd_sof_mod_hdr *module)
|
|
||||||
{
|
|
||||||
struct snd_sof_blk_hdr *block;
|
|
||||||
int count, ret;
|
|
||||||
u32 offset;
|
|
||||||
size_t remaining;
|
|
||||||
|
|
||||||
dev_dbg(sdev->dev, "new module size 0x%x blocks 0x%x type 0x%x\n",
|
|
||||||
module->size, module->num_blocks, module->type);
|
|
||||||
|
|
||||||
block = (struct snd_sof_blk_hdr *)((u8 *)module + sizeof(*module));
|
|
||||||
|
|
||||||
/* module->size doesn't include header size */
|
|
||||||
remaining = module->size;
|
|
||||||
for (count = 0; count < module->num_blocks; count++) {
|
|
||||||
/* check for wrap */
|
|
||||||
if (remaining < sizeof(*block)) {
|
|
||||||
dev_err(sdev->dev, "error: not enough data remaining\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* minus header size of block */
|
|
||||||
remaining -= sizeof(*block);
|
|
||||||
|
|
||||||
if (block->size == 0) {
|
|
||||||
dev_warn(sdev->dev,
|
|
||||||
"warning: block %d size zero\n", count);
|
|
||||||
dev_warn(sdev->dev, " type 0x%x offset 0x%x\n",
|
|
||||||
block->type, block->offset);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (block->type) {
|
|
||||||
case SOF_FW_BLK_TYPE_RSRVD0:
|
|
||||||
case SOF_FW_BLK_TYPE_ROM...SOF_FW_BLK_TYPE_RSRVD14:
|
|
||||||
continue; /* not handled atm */
|
|
||||||
case SOF_FW_BLK_TYPE_IRAM:
|
|
||||||
case SOF_FW_BLK_TYPE_DRAM:
|
|
||||||
case SOF_FW_BLK_TYPE_SRAM:
|
|
||||||
offset = block->offset;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
dev_err(sdev->dev, "error: bad type 0x%x for block 0x%x\n",
|
|
||||||
block->type, count);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev_dbg(sdev->dev,
|
|
||||||
"block %d type 0x%x size 0x%x ==> offset 0x%x\n",
|
|
||||||
count, block->type, block->size, offset);
|
|
||||||
|
|
||||||
/* checking block->size to avoid unaligned access */
|
|
||||||
if (block->size % sizeof(u32)) {
|
|
||||||
dev_err(sdev->dev, "error: invalid block size 0x%x\n",
|
|
||||||
block->size);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
ret = snd_sof_dsp_block_write(sdev, block->type, offset,
|
|
||||||
block + 1, block->size);
|
|
||||||
if (ret < 0) {
|
|
||||||
dev_err(sdev->dev, "error: write to block type 0x%x failed\n",
|
|
||||||
block->type);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (remaining < block->size) {
|
|
||||||
dev_err(sdev->dev, "error: not enough data remaining\n");
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* minus body size of block */
|
|
||||||
remaining -= block->size;
|
|
||||||
/* next block */
|
|
||||||
block = (struct snd_sof_blk_hdr *)((u8 *)block + sizeof(*block)
|
|
||||||
+ block->size);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(snd_sof_parse_module_memcpy);
|
|
||||||
|
|
||||||
int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev)
|
int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev)
|
||||||
{
|
{
|
||||||
struct snd_sof_pdata *plat_data = sdev->pdata;
|
struct snd_sof_pdata *plat_data = sdev->pdata;
|
||||||
|
@ -608,8 +608,6 @@ extern struct snd_compress_ops sof_compressed_ops;
|
|||||||
int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev);
|
int snd_sof_load_firmware_raw(struct snd_sof_dev *sdev);
|
||||||
int snd_sof_load_firmware_memcpy(struct snd_sof_dev *sdev);
|
int snd_sof_load_firmware_memcpy(struct snd_sof_dev *sdev);
|
||||||
int snd_sof_run_firmware(struct snd_sof_dev *sdev);
|
int snd_sof_run_firmware(struct snd_sof_dev *sdev);
|
||||||
int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev,
|
|
||||||
struct snd_sof_mod_hdr *module);
|
|
||||||
void snd_sof_fw_unload(struct snd_sof_dev *sdev);
|
void snd_sof_fw_unload(struct snd_sof_dev *sdev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user