send_bytes = sizeof(struct sof_ipc_ctrl_value_chan) *
                cdata->num_elems;
                if (send)
-                       snd_sof_dsp_block_write(sdev, sdev->mmio_bar,
-                                               scontrol->readback_offset,
-                                               cdata->chanv, send_bytes);
+                       err = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM,
+                                                     scontrol->readback_offset,
+                                                     cdata->chanv, send_bytes);
 
                else
-                       snd_sof_dsp_block_read(sdev, sdev->mmio_bar,
-                                              scontrol->readback_offset,
-                                              cdata->chanv, send_bytes);
-               return 0;
+                       err = snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_IRAM,
+                                                    scontrol->readback_offset,
+                                                    cdata->chanv, send_bytes);
+
+               if (err)
+                       dev_err_once(sdev->dev, "error: %s TYPE_IRAM failed\n",
+                                    send ? "write to" :  "read from");
+               return err;
        }
 
        cdata->rhdr.hdr.cmd = SOF_IPC_GLB_COMP_MSG | ipc_cmd;
 
 }
 
 /* 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 bar, u32 offset)
+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;
                return -ENOMEM;
 
        /* get first header */
-       snd_sof_dsp_block_read(sdev, bar, offset, ext_data,
+       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, bar, offset + sizeof(*ext_hdr),
-                                  (void *)((u8 *)ext_data + sizeof(*ext_hdr)),
-                                  ext_hdr->hdr.size - sizeof(*ext_hdr));
+               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);
 
                /* move to next header */
                offset += ext_hdr->hdr.size;
-               snd_sof_dsp_block_read(sdev, bar, offset, ext_data,
+               snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_SRAM, offset, ext_data,
                                       sizeof(*ext_hdr));
                ext_hdr = ext_data;
        }
  */
 static void sof_get_windows(struct snd_sof_dev *sdev)
 {
+       int bar = snd_sof_dsp_get_bar_index(sdev, SOF_FW_BLK_TYPE_SRAM);
        struct sof_ipc_window_elem *elem;
        u32 outbox_offset = 0;
        u32 stream_offset = 0;
        u32 debug_size = 0;
        u32 debug_offset = 0;
        int window_offset;
-       int bar;
        int i;
 
        if (!sdev->info_window) {
                return;
        }
 
-       bar = snd_sof_dsp_get_bar_index(sdev, SOF_FW_BLK_TYPE_SRAM);
-       if (bar < 0) {
-               dev_err(sdev->dev, "error: have no bar mapping\n");
-               return;
-       }
-
        for (i = 0; i < sdev->info_window->num_windows; i++) {
                elem = &sdev->info_window->window[i];
 
 {
        struct sof_ipc_fw_ready *fw_ready = &sdev->fw_ready;
        int offset;
-       int bar;
        int ret;
 
        /* mailbox must be on 4k boundary */
                return offset;
        }
 
-       bar = snd_sof_dsp_get_bar_index(sdev, SOF_FW_BLK_TYPE_SRAM);
-       if (bar < 0) {
-               dev_err(sdev->dev, "error: have no bar mapping\n");
-               return -EINVAL;
-       }
-
        dev_dbg(sdev->dev, "ipc: DSP is ready 0x%8.8x offset 0x%x\n",
                msg_id, offset);
 
        if (!sdev->first_boot)
                return 0;
 
-       /* copy data from the DSP FW ready offset */
-       snd_sof_dsp_block_read(sdev, bar, offset, fw_ready, sizeof(*fw_ready));
+       /*
+        * 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);
                return ret;
 
        /* now check for extended data */
-       snd_sof_fw_parse_ext_data(sdev, bar, offset +
-                                 sizeof(struct sof_ipc_fw_ready));
+       snd_sof_fw_parse_ext_data(sdev, offset + sizeof(struct sof_ipc_fw_ready));
 
        sof_get_windows(sdev);
 
                                struct snd_sof_mod_hdr *module)
 {
        struct snd_sof_blk_hdr *block;
-       int count, bar;
+       int count, ret;
        u32 offset;
        size_t remaining;
 
                case SOF_FW_BLK_TYPE_DRAM:
                case SOF_FW_BLK_TYPE_SRAM:
                        offset = block->offset;
-                       bar = snd_sof_dsp_get_bar_index(sdev, block->type);
-                       if (bar < 0) {
-                               dev_err(sdev->dev,
-                                       "error: no BAR mapping for block type 0x%x\n",
-                                       block->type);
-                               return bar;
-                       }
                        break;
                default:
                        dev_err(sdev->dev, "error: bad type 0x%x for block 0x%x\n",
                                block->size);
                        return -EINVAL;
                }
-               snd_sof_dsp_block_write(sdev, bar, offset,
-                                       block + 1, block->size);
+               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");
 
 }
 
 /* block IO */
-static inline void snd_sof_dsp_block_read(struct snd_sof_dev *sdev, u32 bar,
-                                         u32 offset, void *dest, size_t bytes)
+static inline int snd_sof_dsp_block_read(struct snd_sof_dev *sdev,
+                                        enum snd_sof_fw_blk_type blk_type,
+                                        u32 offset, void *dest, size_t bytes)
 {
-       sof_ops(sdev)->block_read(sdev, bar, offset, dest, bytes);
+       return sof_ops(sdev)->block_read(sdev, blk_type, offset, dest, bytes);
 }
 
-static inline void snd_sof_dsp_block_write(struct snd_sof_dev *sdev, u32 bar,
-                                          u32 offset, void *src, size_t bytes)
+static inline int snd_sof_dsp_block_write(struct snd_sof_dev *sdev,
+                                         enum snd_sof_fw_blk_type blk_type,
+                                         u32 offset, void *src, size_t bytes)
 {
-       sof_ops(sdev)->block_write(sdev, bar, offset, src, bytes);
+       return sof_ops(sdev)->block_write(sdev, blk_type, offset, src, bytes);
 }
 
 /* ipc */
 
                      void __iomem *addr); /* optional */
 
        /* memcpy IO */
-       void (*block_read)(struct snd_sof_dev *sof_dev, u32 bar,
-                          u32 offset, void *dest,
-                          size_t size); /* mandatory */
-       void (*block_write)(struct snd_sof_dev *sof_dev, u32 bar,
-                           u32 offset, void *src,
-                           size_t size); /* mandatory */
+       int (*block_read)(struct snd_sof_dev *sof_dev,
+                         enum snd_sof_fw_blk_type type, u32 offset,
+                         void *dest, size_t size); /* mandatory */
+       int (*block_write)(struct snd_sof_dev *sof_dev,
+                          enum snd_sof_fw_blk_type type, u32 offset,
+                          void *src, size_t size); /* mandatory */
 
        /* doorbell */
        irqreturn_t (*irq_handler)(int irq, void *context); /* optional */
                       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 bar, u32 offset, void *src,
-                    size_t size);
-void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
-                   size_t size);
+int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
+                   u32 offset, void *src, size_t size);
+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);
 
 
 #include <sound/soc.h>
 #include <sound/sof.h>
 #include "sof-priv.h"
+#include "ops.h"
 
 /*
  * Register IO
  * Memory copy.
  */
 
-void sof_block_write(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *src,
-                    size_t size)
+int sof_block_write(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
+                   u32 offset, void *src, size_t size)
 {
-       void __iomem *dest = sdev->bar[bar] + offset;
+       int bar = snd_sof_dsp_get_bar_index(sdev, blk_type);
        const u8 *src_byte = src;
+       void __iomem *dest;
        u32 affected_mask;
        u32 tmp;
        int m, n;
 
+       if (bar < 0)
+               return bar;
+
+       dest = sdev->bar[bar] + offset;
+
        m = size / 4;
        n = size % 4;
 
                tmp |= *(u32 *)(src_byte + m * 4) & affected_mask;
                iowrite32(tmp, dest + m * 4);
        }
+
+       return 0;
 }
 EXPORT_SYMBOL(sof_block_write);
 
-void sof_block_read(struct snd_sof_dev *sdev, u32 bar, u32 offset, void *dest,
-                   size_t size)
+int sof_block_read(struct snd_sof_dev *sdev, enum snd_sof_fw_blk_type blk_type,
+                  u32 offset, void *dest, size_t size)
 {
-       void __iomem *src = sdev->bar[bar] + offset;
+       int bar = snd_sof_dsp_get_bar_index(sdev, blk_type);
+
+       if (bar < 0)
+               return bar;
+
+       memcpy_fromio(dest, sdev->bar[bar] + offset, size);
 
-       memcpy_fromio(dest, src, size);
+       return 0;
 }
 EXPORT_SYMBOL(sof_block_read);