qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] hw/sd/sdhci: Factor sdhci_sdma_transfer() out


From: Bernhard Beschow
Subject: Re: [PATCH] hw/sd/sdhci: Factor sdhci_sdma_transfer() out
Date: Sun, 12 Jan 2025 13:12:31 +0000


Am 9. Januar 2025 12:20:29 UTC schrieb "Philippe Mathieu-Daudé" 
<philmd@linaro.org>:
>Factor sdhci_sdma_transfer() out of sdhci_data_transfer().
>Re-use it in sdhci_write(), so we don't try to run multi
>block transfer for a single block.
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Bernhard Beschow <shentey@gmail.com>

>---
> hw/sd/sdhci.c | 22 +++++++++++-----------
> 1 file changed, 11 insertions(+), 11 deletions(-)
>
>diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
>index 299cd4bc1b6..332ea13fe55 100644
>--- a/hw/sd/sdhci.c
>+++ b/hw/sd/sdhci.c
>@@ -694,6 +694,15 @@ static void sdhci_sdma_transfer_single_block(SDHCIState 
>*s)
>     sdhci_end_transfer(s);
> }
> 
>+static void sdhci_sdma_transfer(SDHCIState *s)
>+{
>+    if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
>+        sdhci_sdma_transfer_single_block(s);
>+    } else {
>+        sdhci_sdma_transfer_multi_blocks(s);
>+    }
>+}
>+
> typedef struct ADMADescr {
>     hwaddr addr;
>     uint16_t length;
>@@ -925,12 +934,7 @@ static void sdhci_data_transfer(void *opaque)
>     if (s->trnmod & SDHC_TRNS_DMA) {
>         switch (SDHC_DMA_TYPE(s->hostctl1)) {
>         case SDHC_CTRL_SDMA:
>-            if ((s->blkcnt == 1) || !(s->trnmod & SDHC_TRNS_MULTI)) {
>-                sdhci_sdma_transfer_single_block(s);
>-            } else {
>-                sdhci_sdma_transfer_multi_blocks(s);
>-            }
>-
>+            sdhci_sdma_transfer(s);
>             break;
>         case SDHC_CTRL_ADMA1_32:
>             if (!(s->capareg & R_SDHC_CAPAB_ADMA1_MASK)) {
>@@ -1174,11 +1178,7 @@ sdhci_write(void *opaque, hwaddr offset, uint64_t val, 
>unsigned size)
>             if (!(mask & 0xFF000000) && s->blkcnt &&
>                 (s->blksize & BLOCK_SIZE_MASK) &&
>                 SDHC_DMA_TYPE(s->hostctl1) == SDHC_CTRL_SDMA) {
>-                if (s->trnmod & SDHC_TRNS_MULTI) {
>-                    sdhci_sdma_transfer_multi_blocks(s);
>-                } else {
>-                    sdhci_sdma_transfer_single_block(s);
>-                }
>+                sdhci_sdma_transfer(s);
>             }
>         }
>         break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]