diff options
author | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-06-20 18:47:27 +0200 |
---|---|---|
committer | Philippe Mathieu-Daudé <philmd@linaro.org> | 2024-06-24 10:41:42 +0200 |
commit | eac7ce3de78ee96c3e2b3eb2678682e44078bcdf (patch) | |
tree | 62ca69fe962cbfd5a3fd6ffcbfad6382caa3c7b6 | |
parent | 904547845c559d7530a20792d599a77d8e2ae442 (diff) | |
download | qemu-eac7ce3de78ee96c3e2b3eb2678682e44078bcdf.zip qemu-eac7ce3de78ee96c3e2b3eb2678682e44078bcdf.tar.gz qemu-eac7ce3de78ee96c3e2b3eb2678682e44078bcdf.tar.bz2 |
hw/sd/sdcard: Use Load/Store API to fill some CID/CSD registers
The ld/st API helps noticing CID or CSD bytes refer
to the same field. Multi-bytes fields are stored MSB
first in CID / CSD.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Tested-by: Cédric Le Goater <clg@redhat.com>
Message-Id: <20240621080554.18986-7-philmd@linaro.org>
-rw-r--r-- | hw/sd/sd.c | 9 |
1 files changed, 2 insertions, 7 deletions
@@ -393,10 +393,7 @@ static void sd_set_cid(SDState *sd) sd->cid[6] = PNM[3]; sd->cid[7] = PNM[4]; sd->cid[8] = PRV; /* Fake product revision (PRV) */ - sd->cid[9] = 0xde; /* Fake serial number (PSN) */ - sd->cid[10] = 0xad; - sd->cid[11] = 0xbe; - sd->cid[12] = 0xef; + stl_be_p(&sd->cid[9], 0xdeadbeef); /* Fake serial number (PSN) */ sd->cid[13] = 0x00 | /* Manufacture date (MDT) */ ((MDT_YR - 2000) / 10); sd->cid[14] = ((MDT_YR % 10) << 4) | MDT_MON; @@ -462,9 +459,7 @@ static void sd_set_csd(SDState *sd, uint64_t size) sd->csd[4] = 0x5b; sd->csd[5] = 0x59; sd->csd[6] = 0x00; - sd->csd[7] = (size >> 16) & 0xff; - sd->csd[8] = (size >> 8) & 0xff; - sd->csd[9] = (size & 0xff); + st24_be_p(&sd->csd[7], size); sd->csd[10] = 0x7f; sd->csd[11] = 0x80; sd->csd[12] = 0x0a; |