summary refs log tree commit diff stats
path: root/hw/sd/sd.c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-06-25 05:36:27 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-02 10:08:32 +0200
commiteef0d42995c0638c336ae0ceb4e487b409094250 (patch)
tree2d417d16a75dd11fd5bf07e18ccf684a6d2da9e0 /hw/sd/sd.c
parent374c93ecea604dd3fb675d6306644875922d56ff (diff)
downloadfocaccia-qemu-eef0d42995c0638c336ae0ceb4e487b409094250.tar.gz
focaccia-qemu-eef0d42995c0638c336ae0ceb4e487b409094250.zip
hw/sd/sdcard: Duplicate READ_SINGLE_BLOCK / READ_MULTIPLE_BLOCK cases
In order to modify the READ_SINGLE_BLOCK case in the
next commit, duplicate it first.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240628070216.92609-22-philmd@linaro.org>
Diffstat (limited to 'hw/sd/sd.c')
-rw-r--r--hw/sd/sd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 6b02e0a178..43e0a2d925 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -1390,6 +1390,24 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
         break;
 
     case 17:  /* CMD17:  READ_SINGLE_BLOCK */
+        addr = sd_req_get_address(sd, req);
+        switch (sd->state) {
+        case sd_transfer_state:
+
+            if (!address_in_range(sd, "READ_SINGLE_BLOCK", addr, sd->blk_len)) {
+                return sd_r1;
+            }
+
+            sd->state = sd_sendingdata_state;
+            sd->data_start = addr;
+            sd->data_offset = 0;
+            return sd_r1;
+
+        default:
+            break;
+        }
+        break;
+
     case 18:  /* CMD18:  READ_MULTIPLE_BLOCK */
         addr = sd_req_get_address(sd, req);
         switch (sd->state) {