aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2018-02-22 15:12:54 +0000
committerPeter Maydell <peter.maydell@linaro.org>2018-02-22 15:12:54 +0000
commitd6911486550b794f879584821a0ec4d40e61a47b (patch)
tree5ef060e7bb1d781599a68dc074950f650128eb00 /hw
parent946897ce1897d50a9a432828a44e80be746066f7 (diff)
sdcard: check the card is in correct state for APP CMD (CMD55)
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/sd/sd.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index ff7ace3491..d6dd2b9a15 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -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;