aboutsummaryrefslogtreecommitdiff
path: root/hw/sd
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2024-06-12 23:32:18 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2024-07-02 10:08:32 +0200
commit29d247ad63a7cfc0c3b2ec2662c71853e35d6a17 (patch)
tree5db8534f66b4c15511f2dd8b124bfb9f4e872494 /hw/sd
parent1dfa77d4e63b7794d7bb9a81f2b6b26a1af082d8 (diff)
downloadqemu-29d247ad63a7cfc0c3b2ec2662c71853e35d6a17.zip
qemu-29d247ad63a7cfc0c3b2ec2662c71853e35d6a17.tar.gz
qemu-29d247ad63a7cfc0c3b2ec2662c71853e35d6a17.tar.bz2
hw/sd/sdcard: Add sd_cmd_LOCK_UNLOCK handler (CMD42)
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-64-philmd@linaro.org>
Diffstat (limited to 'hw/sd')
-rw-r--r--hw/sd/sd.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index be94371..da34458 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -242,7 +242,6 @@ static const char *sd_cmd_name(SDState *sd, uint8_t cmd)
[25] = "WRITE_MULTIPLE_BLOCK",
[26] = "MANUF_RSVD",
[40] = "DPS_spec",
- [42] = "LOCK_UNLOCK",
[54] = "SDIO_RSVD", [55] = "APP_CMD",
[56] = "GEN_CMD",
[60] = "MANUF_RSVD", [61] = "MANUF_RSVD",
@@ -1611,6 +1610,12 @@ static sd_rsp_type_t sd_cmd_ERASE(SDState *sd, SDRequest req)
return sd_r1b;
}
+/* CMD42 */
+static sd_rsp_type_t sd_cmd_LOCK_UNLOCK(SDState *sd, SDRequest req)
+{
+ return sd_cmd_to_receivingdata(sd, req, 0, 0);
+}
+
static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
{
uint16_t rca;
@@ -1699,10 +1704,6 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
case 26: /* CMD26: PROGRAM_CID */
return sd_cmd_to_receivingdata(sd, req, 0, sizeof(sd->cid));
- /* Lock card commands (Class 7) */
- case 42: /* CMD42: LOCK_UNLOCK */
- return sd_cmd_to_receivingdata(sd, req, 0, 0);
-
/* Application specific commands (Class 8) */
case 55: /* CMD55: APP_CMD */
rca = sd_req_get_rca(sd, req);
@@ -2318,6 +2319,7 @@ static const SDProto sd_proto_spi = {
[36] = {10, sd_spi, "SEND_PSI", sd_cmd_optional},
[37] = {10, sd_spi, "CONTROL_ASSD_SYSTEM", sd_cmd_optional},
[38] = {5, sd_spi, "ERASE", sd_cmd_ERASE},
+ [42] = {7, sd_spi, "LOCK_UNLOCK", sd_cmd_LOCK_UNLOCK},
[50] = {10, sd_spi, "DIRECT_SECURE_READ", sd_cmd_optional},
[52] = {9, sd_spi, "IO_RW_DIRECT", sd_cmd_optional},
[53] = {9, sd_spi, "IO_RW_EXTENDED", sd_cmd_optional},
@@ -2362,6 +2364,7 @@ static const SDProto sd_proto_sd = {
[36] = {10, sd_adtc, "SEND_PSI", sd_cmd_optional},
[37] = {10, sd_ac, "CONTROL_ASSD_SYSTEM", sd_cmd_optional},
[38] = {5, sd_ac, "ERASE", sd_cmd_ERASE},
+ [42] = {7, sd_adtc, "LOCK_UNLOCK", sd_cmd_LOCK_UNLOCK},
[43] = {1, sd_ac, "Q_MANAGEMENT", sd_cmd_optional},
[44] = {1, sd_ac, "Q_TASK_INFO_A", sd_cmd_optional},
[45] = {1, sd_ac, "Q_TASK_INFO_B", sd_cmd_optional},