aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2016-07-10 19:08:56 +0100
committerDavid Gibson <david@gibson.dropbear.id.au>2016-07-18 10:40:27 +1000
commite12f50b900bcc2079954c40828dcc167e4ace5cb (patch)
tree699020c1eb238206b069ff8f5159b70bb64a8a34
parent3f0d4128dc641f082c3631d610f843b0cdbb6e61 (diff)
downloadqemu-e12f50b900bcc2079954c40828dcc167e4ace5cb.zip
qemu-e12f50b900bcc2079954c40828dcc167e4ace5cb.tar.gz
qemu-e12f50b900bcc2079954c40828dcc167e4ace5cb.tar.bz2
dbdma: fix load_word/store_word value endianness
The values to read/write to/from physical memory are copied directly to the physical address with no endian swapping required. Also add some extra information to debugging output while we are here. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-rw-r--r--hw/misc/macio/mac_dbdma.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/hw/misc/macio/mac_dbdma.c b/hw/misc/macio/mac_dbdma.c
index c4ee381..c5dd0ac 100644
--- a/hw/misc/macio/mac_dbdma.c
+++ b/hw/misc/macio/mac_dbdma.c
@@ -350,9 +350,8 @@ static void load_word(DBDMA_channel *ch, int key, uint32_t addr,
uint16_t len)
{
dbdma_cmd *current = &ch->current;
- uint32_t val;
- DBDMA_DPRINTFCH(ch, "load_word\n");
+ DBDMA_DPRINTFCH(ch, "load_word %d bytes, addr=%08x\n", len, addr);
/* only implements KEY_SYSTEM */
@@ -362,14 +361,7 @@ static void load_word(DBDMA_channel *ch, int key, uint32_t addr,
return;
}
- dma_memory_read(&address_space_memory, addr, &val, len);
-
- if (len == 2)
- val = (val << 16) | (current->cmd_dep & 0x0000ffff);
- else if (len == 1)
- val = (val << 24) | (current->cmd_dep & 0x00ffffff);
-
- current->cmd_dep = val;
+ dma_memory_read(&address_space_memory, addr, &current->cmd_dep, len);
if (conditional_wait(ch))
goto wait;
@@ -389,9 +381,9 @@ static void store_word(DBDMA_channel *ch, int key, uint32_t addr,
uint16_t len)
{
dbdma_cmd *current = &ch->current;
- uint32_t val;
- DBDMA_DPRINTFCH(ch, "store_word\n");
+ DBDMA_DPRINTFCH(ch, "store_word %d bytes, addr=%08x pa=%x\n",
+ len, addr, le32_to_cpu(current->cmd_dep));
/* only implements KEY_SYSTEM */
@@ -401,13 +393,7 @@ static void store_word(DBDMA_channel *ch, int key, uint32_t addr,
return;
}
- val = current->cmd_dep;
- if (len == 2)
- val >>= 16;
- else if (len == 1)
- val >>= 24;
-
- dma_memory_write(&address_space_memory, addr, &val, len);
+ dma_memory_write(&address_space_memory, addr, &current->cmd_dep, len);
if (conditional_wait(ch))
goto wait;