mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
hw/sd: Use sdbus_read_data() instead of sdbus_read_byte() when possible
Use the recently added sdbus_read_data() to read multiple bytes at once, instead of looping calling sdbus_read_byte(). Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200814092346.21825-8-f4bug@amsat.org>
This commit is contained in:
parent
6505a91a77
commit
618e0be1ba
3 changed files with 13 additions and 32 deletions
|
@ -337,9 +337,7 @@ static uint32_t allwinner_sdhost_process_desc(AwSdHostState *s,
|
|||
|
||||
/* Read from SD bus */
|
||||
} else {
|
||||
for (uint32_t i = 0; i < buf_bytes; i++) {
|
||||
buf[i] = sdbus_read_byte(&s->sdbus);
|
||||
}
|
||||
sdbus_read_data(&s->sdbus, buf, buf_bytes);
|
||||
cpu_physical_memory_write((desc->addr & DESC_SIZE_MASK) + num_done,
|
||||
buf, buf_bytes);
|
||||
}
|
||||
|
@ -518,10 +516,8 @@ static uint64_t allwinner_sdhost_read(void *opaque, hwaddr offset,
|
|||
break;
|
||||
case REG_SD_FIFO: /* Read/Write FIFO */
|
||||
if (sdbus_data_ready(&s->sdbus)) {
|
||||
res = sdbus_read_byte(&s->sdbus);
|
||||
res |= sdbus_read_byte(&s->sdbus) << 8;
|
||||
res |= sdbus_read_byte(&s->sdbus) << 16;
|
||||
res |= sdbus_read_byte(&s->sdbus) << 24;
|
||||
sdbus_read_data(&s->sdbus, &res, sizeof(uint32_t));
|
||||
le32_to_cpus(&res);
|
||||
allwinner_sdhost_update_transfer_cnt(s, sizeof(uint32_t));
|
||||
allwinner_sdhost_auto_stop(s);
|
||||
allwinner_sdhost_update_irq(s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue