diff options
author | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-09-03 18:05:41 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <f4bug@amsat.org> | 2020-10-21 13:19:01 +0200 |
commit | 6a9e5cc61c52af53c71ac24411324427650e6755 (patch) | |
tree | 595b44038299bb3bd4432aed95b9b504ce15d6dd /hw/sd | |
parent | dfba99f17feb6d4a129da19d38df1bcd8579d1c3 (diff) | |
download | qemu-6a9e5cc61c52af53c71ac24411324427650e6755.zip qemu-6a9e5cc61c52af53c71ac24411324427650e6755.tar.gz qemu-6a9e5cc61c52af53c71ac24411324427650e6755.tar.bz2 |
hw/sd/sdhci: Stop multiple transfers when block count is cleared
Clearing BlockCount stops multiple transfers.
See "SD Host Controller Simplified Specification Version 2.00":
- 2.2.3. Block Count Register (Offset 006h)
- Table 2-8 : Determination of Transfer Type
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Tested-by: Alexander Bulekov <alxndr@bu.edu>
Message-Id: <20200903172806.489710-2-f4bug@amsat.org>
Diffstat (limited to 'hw/sd')
-rw-r--r-- | hw/sd/sdhci.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index c849c3d..61e469b 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -731,6 +731,12 @@ static void sdhci_do_adma(SDHCIState *s) ADMADescr dscr = {}; int i; + if (s->trnmod & SDHC_TRNS_BLK_CNT_EN && !s->blkcnt) { + /* Stop Multiple Transfer */ + sdhci_end_transfer(s); + return; + } + for (i = 0; i < SDHC_ADMA_DESCS_PER_DELAY; ++i) { s->admaerr &= ~SDHC_ADMAERR_LENGTH_MISMATCH; @@ -756,7 +762,6 @@ static void sdhci_do_adma(SDHCIState *s) switch (dscr.attr & SDHC_ADMA_ATTR_ACT_MASK) { case SDHC_ADMA_ATTR_ACT_TRAN: /* data transfer */ - if (s->trnmod & SDHC_TRNS_READ) { while (length) { if (s->data_count == 0) { |