]> git.proxmox.com Git - mirror_qemu.git/commitdiff
sdcard: check the card is in correct state for APP CMD (CMD55)
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>
Thu, 22 Feb 2018 15:12:54 +0000 (15:12 +0000)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 22 Feb 2018 15:12:54 +0000 (15:12 +0000)
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@xilinx.com>
Message-id: 20180215221325.7611-14-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/sd/sd.c

index ff7ace34919f78bf3cdbee5930f6f50a44124c1f..d6dd2b9a15df79ab8f0b5b0c0f9b976ae6922d99 100644 (file)
@@ -1386,6 +1386,14 @@ static sd_rsp_type_t sd_normal_command(SDState *sd,
 
     /* Application specific commands (Class 8) */
     case 55:   /* CMD55:  APP_CMD */
+        switch (sd->state) {
+        case sd_ready_state:
+        case sd_identification_state:
+        case sd_inactive_state:
+            return sd_illegal;
+        default:
+            break;
+        }
         if (!sd->spi) {
             if (sd->rca != rca) {
                 return sd_r0;