Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions sound/soc/sof/hw-spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
* Memory copy.
*/

static void spi_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
size_t size)
static void spi_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset,
void *dest, size_t size)
{
u8 *buf;
int ret;
Expand All @@ -62,8 +62,8 @@ static void spi_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
}
}

static void spi_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
size_t size)
static void spi_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset,
void *src, size_t size)
{
int ret;
u8 *buf;
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,8 @@ static int bdw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ static int byt_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/hda-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,8 @@ int hda_dsp_ipc_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));

/* make sure ABI version is compatible */
ret = snd_sof_ipc_valid(sdev);
Expand Down
11 changes: 6 additions & 5 deletions sound/soc/sof/intel/hda.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,16 @@ static void hda_dsp_get_registers(struct snd_sof_dev *sdev,
u32 *stack, size_t stack_words)
{
/* first read registers */
sof_block_read(sdev, sdev->dsp_oops_offset, xoops, sizeof(*xoops));
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset, xoops,
sizeof(*xoops));

/* then get panic info */
sof_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops),
panic_info, sizeof(*panic_info));
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset +
sizeof(*xoops), panic_info, sizeof(*panic_info));

/* then get the stack */
sof_block_read(sdev, sdev->dsp_oops_offset + sizeof(*xoops) +
sizeof(*panic_info), stack,
sof_block_read(sdev, sdev->mmio_bar, sdev->dsp_oops_offset +
sizeof(*xoops) + sizeof(*panic_info), stack,
stack_words * sizeof(u32));
}

Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/hsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,8 @@ static int hsw_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
return 0;

/* copy data from the DSP FW ready offset */
sof_block_read(sdev, offset, fw_ready, sizeof(*fw_ready));
sof_block_read(sdev, sdev->mmio_bar, offset, fw_ready,
sizeof(*fw_ready));

snd_sof_dsp_mailbox_init(sdev, fw_ready->dspbox_offset,
fw_ready->dspbox_size,
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -627,8 +627,8 @@ int snd_sof_ipc_set_comp_data(struct snd_sof_ipc *ipc,
/* read firmware volume */
if (scontrol->readback_offset != 0) {
/* we can read value header via mmaped region */
snd_sof_dsp_block_write(sdev, scontrol->readback_offset,
cdata->chanv,
snd_sof_dsp_block_write(sdev, sdev->mmio_bar,
scontrol->readback_offset, cdata->chanv,
sizeof(struct sof_ipc_ctrl_value_chan) *
cdata->num_elems);

Expand Down Expand Up @@ -669,8 +669,8 @@ int snd_sof_ipc_get_comp_data(struct snd_sof_ipc *ipc,
/* read firmware byte counters */
if (scontrol->readback_offset != 0) {
/* we can read values via mmaped region */
snd_sof_dsp_block_read(sdev, scontrol->readback_offset,
cdata->chanv,
snd_sof_dsp_block_read(sdev, sdev->mmio_bar,
scontrol->readback_offset, cdata->chanv,
sizeof(struct sof_ipc_ctrl_value_chan) *
cdata->num_elems);

Expand Down
9 changes: 5 additions & 4 deletions sound/soc/sof/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,14 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 offset)
return -ENOMEM;

/* get first header */
snd_sof_dsp_block_read(sdev, offset, ext_data, sizeof(*ext_hdr));
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset, ext_data,
sizeof(*ext_hdr));
ext_hdr = (struct sof_ipc_ext_data_hdr *)ext_data;

while (ext_hdr->hdr.cmd == SOF_IPC_FW_READY) {
/* read in ext structure */
offset += sizeof(*ext_hdr);
snd_sof_dsp_block_read(sdev, offset,
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset,
ext_data + sizeof(*ext_hdr),
ext_hdr->hdr.size - sizeof(*ext_hdr));

Expand All @@ -77,7 +78,7 @@ int snd_sof_fw_parse_ext_data(struct snd_sof_dev *sdev, u32 offset)

/* move to next header */
offset += ext_hdr->hdr.size;
snd_sof_dsp_block_read(sdev, offset, ext_data,
snd_sof_dsp_block_read(sdev, sdev->mmio_bar, offset, ext_data,
sizeof(*ext_hdr));
ext_hdr = (struct sof_ipc_ext_data_hdr *)ext_data;
}
Expand Down Expand Up @@ -146,7 +147,7 @@ int snd_sof_parse_module_memcpy(struct snd_sof_dev *sdev,
block->size);
return -EINVAL;
}
snd_sof_dsp_block_write(sdev, offset,
snd_sof_dsp_block_write(sdev, sdev->mmio_bar, offset,
(void *)block + sizeof(*block),
block->size);

Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,18 +182,18 @@ static inline u64 snd_sof_dsp_read64(struct snd_sof_dev *sdev, u32 bar,
}

/* block IO */
static inline void snd_sof_dsp_block_read(struct snd_sof_dev *sdev,
static inline void snd_sof_dsp_block_read(struct snd_sof_dev *sdev, u32 bar,
u32 offset, void *dest, size_t bytes)
{
if (sof_ops(sdev)->block_read)
sof_ops(sdev)->block_read(sdev, offset, dest, bytes);
sof_ops(sdev)->block_read(sdev, bar, offset, dest, bytes);
}

static inline void snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
static inline void snd_sof_dsp_block_write(struct snd_sof_dev *sdev, u32 bar,
u32 offset, void *src, size_t bytes)
{
if (sof_ops(sdev)->block_write)
sof_ops(sdev)->block_write(sdev, offset, src, bytes);
sof_ops(sdev)->block_write(sdev, bar, offset, src, bytes);
}

/* mailbox */
Expand Down
8 changes: 4 additions & 4 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ struct snd_sof_dsp_ops {
u64 (*read64)(struct snd_sof_dev *sof_dev, void __iomem *addr);

/* memcpy IO */
void (*block_read)(struct snd_sof_dev *sof_dev,
void (*block_read)(struct snd_sof_dev *sof_dev, u32 bar,
u32 offset, void *dest, size_t size);
void (*block_write)(struct snd_sof_dev *sof_dev,
void (*block_write)(struct snd_sof_dev *sof_dev, u32 bar,
u32 offset, void *src, size_t size);

/* doorbell */
Expand Down Expand Up @@ -558,9 +558,9 @@ void sof_mailbox_write(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes);
void sof_mailbox_read(struct snd_sof_dev *sdev, u32 offset,
void *message, size_t bytes);
void sof_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
size_t size);
void sof_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
size_t size);

#endif
8 changes: 4 additions & 4 deletions sound/soc/sof/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ EXPORT_SYMBOL(sof_mailbox_read);
* Memory copy.
*/

void sof_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
size_t size)
{
void __iomem *dest = sdev->bar[sdev->mmio_bar] + offset;
void __iomem *dest = sdev->bar[bar] + offset;
const u8 *src_byte = src;
u32 affected_mask;
u32 tmp = 0;
Expand Down Expand Up @@ -152,10 +152,10 @@ void sof_block_write(struct snd_sof_dev *sdev, u32 offset, void *src,
}
EXPORT_SYMBOL(sof_block_write);

void sof_block_read(struct snd_sof_dev *sdev, u32 offset, void *dest,
void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
size_t size)
{
void __iomem *src = sdev->bar[sdev->mmio_bar] + offset;
void __iomem *src = sdev->bar[bar] + offset;

memcpy_fromio(dest, src, size);
}
Expand Down