[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[qemu-xen staging-4.14] hw/sd/sdcard: Restrict Class 6 commands to SCSD cards



commit 557980ba70dba65bde208b03b902f419921b307a
Author:     Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
AuthorDate: Wed Jun 3 19:59:16 2020 +0200
Commit:     Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
CommitDate: Wed Sep 2 19:06:19 2020 -0500

    hw/sd/sdcard: Restrict Class 6 commands to SCSD cards
    
    Only SCSD cards support Class 6 (Block Oriented Write Protection)
    commands.
    
      "SD Specifications Part 1 Physical Layer Simplified Spec. v3.01"
    
      4.3.14 Command Functional Difference in Card Capacity Types
    
      * Write Protected Group
    
      SDHC and SDXC do not support write-protected groups. Issuing
      CMD28, CMD29 and CMD30 generates the ILLEGAL_COMMAND error.
    
    Cc: qemu-stable@xxxxxxxxxx
    Reviewed-by: Peter Maydell <peter.maydell@xxxxxxxxxx>
    Signed-off-by: Philippe Mathieu-Daudé <f4bug@xxxxxxxxx>
    Reviewed-by: Alistair Francis <alistair.francis@xxxxxxx>
    Message-Id: <20200630133912.9428-7-f4bug@xxxxxxxxx>
    (cherry picked from commit 9157dd597d293ab7f599f4d96c3fe8a6e07c633d)
    Signed-off-by: Michael Roth <mdroth@xxxxxxxxxxxxxxxxxx>
---
 hw/sd/sd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 3c06a0ac6d..da39590f58 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -905,6 +905,11 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, 
SDRequest req)
         sd->multi_blk_cnt = 0;
     }
 
+    if (sd_cmd_class[req.cmd] == 6 && FIELD_EX32(sd->ocr, OCR, CARD_CAPACITY)) 
{
+        /* Only Standard Capacity cards support class 6 commands */
+        return sd_illegal;
+    }
+
     switch (req.cmd) {
     /* Basic commands (Class 0 and Class 1) */
     case 0:    /* CMD0:   GO_IDLE_STATE */
--
generated by git-patchbot for /home/xen/git/qemu-xen.git#staging-4.14



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.