//
#include <linux/firmware.h>
-#include <sound/sof.h>
-#include <sound/sof/ext_manifest.h>
#include "sof-priv.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)
{
struct snd_sof_pdata *plat_data = sdev->pdata;