aboutsummaryrefslogtreecommitdiff
path: root/hw/sd/milkymist-memcard.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-14 11:23:44 +0200
committerPhilippe Mathieu-Daudé <f4bug@amsat.org>2020-08-21 16:35:35 +0200
commit62a21be60f8fdf0223fa099fb4e7a495eaf55cf9 (patch)
tree006638d6c214186881ebbc211308ab10b76b8dbe /hw/sd/milkymist-memcard.c
parente35c343dd9c18d4d3e6424e2fab38f08085875d6 (diff)
downloadqemu-62a21be60f8fdf0223fa099fb4e7a495eaf55cf9.zip
qemu-62a21be60f8fdf0223fa099fb4e7a495eaf55cf9.tar.gz
qemu-62a21be60f8fdf0223fa099fb4e7a495eaf55cf9.tar.bz2
hw/sd: Use sdbus_write_data() instead of sdbus_write_byte when possible
Use the recently added sdbus_write_data() to write multiple bytes at once, instead of looping calling sdbus_write_byte(). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200814092346.21825-6-f4bug@amsat.org>
Diffstat (limited to 'hw/sd/milkymist-memcard.c')
-rw-r--r--hw/sd/milkymist-memcard.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/hw/sd/milkymist-memcard.c b/hw/sd/milkymist-memcard.c
index e8d055b..12e091a 100644
--- a/hw/sd/milkymist-memcard.c
+++ b/hw/sd/milkymist-memcard.c
@@ -181,6 +181,7 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value,
unsigned size)
{
MilkymistMemcardState *s = opaque;
+ uint32_t val32;
trace_milkymist_memcard_memory_write(addr, value);
@@ -209,10 +210,8 @@ static void memcard_write(void *opaque, hwaddr addr, uint64_t value,
if (!s->enabled) {
break;
}
- sdbus_write_byte(&s->sdbus, (value >> 24) & 0xff);
- sdbus_write_byte(&s->sdbus, (value >> 16) & 0xff);
- sdbus_write_byte(&s->sdbus, (value >> 8) & 0xff);
- sdbus_write_byte(&s->sdbus, value & 0xff);
+ val32 = cpu_to_be32(value);
+ sdbus_write_data(&s->sdbus, &val32, sizeof(val32));
break;
case R_ENABLE:
s->regs[addr] = value;