hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01
PATCH 1/1 hw/sd/sdcard: Return ILLEGAL for CMD19/CMD23 prior SD spec v3.01
From: Philippe Mathieu-Daudé <[email protected]>
CMD19 (SEND_TUNING_BLOCK) and CMD23 (SET_BLOCK_COUNT) were added in the Physical SD spec v3.01. When earlier spec version is requested, we should return ILLEGAL.
--- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
hw/sd/sd.c +2 -2
@@ -1263,7 +1263,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }if (sd->state == sd_transfer_state) { sd->state = sd_sendingdata_state;
@@ -1274,7 +1274,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }switch (sd->state) {case sd_transfer_state:
Signature · 1 line
2.35.1
Quoted 5 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
CMD19 (
SEND_TUNING_BLOCK) and CMD23 (SET_BLOCK_COUNT) were added in the Physical SD spec v3.01. When earlier spec version
nits: it should be spec v3.00, despite the fact that in QEMU we have been using a name v3.01 to indicate v3.00.
Quoted 21 lines
is requested, we should return ILLEGAL.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/sd/sd.c +1
-1@@ -1263,7 +1263,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }if (sd->state == sd_transfer_state) { sd->state = sd_sendingdata_state;
hw/sd/sd.c static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
Quoted 9 lines
hw/sd/sd.c +1
-2@@ -1274,7 +1274,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }switch (sd->state) {case sd_transfer_state: --
Quoted 10 lines · Bin Meng
Quoted 5 lines · Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé <[email protected]>
CMD19 (
SEND_TUNING_BLOCK) and CMD23 (SET_BLOCK_COUNT) were added in the Physical SD spec v3.01. When earlier spec versionnits: it should be spec v3.00, despite the fact that in QEMU we have been using a name v3.01 to indicate v3.00.
Only the "Physical Layer Simplified Specification"s are public:
https://www.sdcard.org/downloads/pls/archives/
I'll rename to "Physical Layer Simplified Specification v3.01" so it is clearer.
Quoted 23 lines
Quoted 23 lines
is requested, we should return ILLEGAL.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- hw/sd/sd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)hw/sd/sd.c +1
-1@@ -1263,7 +1263,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)case 19 :/* CMD19: SEND_TUNING_BLOCK (SD) */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }if (sd->state == sd_transfer_state) { sd->state = sd_sendingdata_state;@@ -1274,7 +1274,7 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
Quoted 10 lines
hw/sd/sd.c static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
Quoted 8 lines
hw/sd/sd.c +1
-2case 23 :/* CMD23: SET_BLOCK_COUNT */ if (sd->spec_version < SD_PHY_SPECv3_01_VERS) { -break ; + goto bad_cmd; }switch (sd->state) {case sd_transfer_state: --Reviewed-by Bin Meng <[email protected]>
Thanks! Queued.