hw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22)
commit7028187bd003f62e11f41cc8c6a26c1c12755cad
authorPhilippe Mathieu-Daudé <philmd@linaro.org>
Fri, 14 Jun 2024 13:28:10 +0000 (14 15:28 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 2 Jul 2024 08:08:28 +0000 (2 10:08 +0200)
treef216e8bda3931640315e581a14963423c5c1bdb6
parente55cbe727b07f1c39f57c1af842ff2fca9bc2d4a
hw/sd/sdcard: Send NUM_WR_BLOCKS bits MSB first (ACMD22)

Per sections 3.6.1 (SD Bus Protocol), 4.3.4 "Data Write"
and 7.3.2 (Responses):

  In the CMD line the Most Significant Bit is transmitted first.

Use the stl_be_p() helper to store the value in big-endian.

Fixes: a1bb27b1e9 ("Initial SD card emulation")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Tested-by: Cédric Le Goater <clg@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20240628070216.92609-9-philmd@linaro.org>
hw/sd/sd.c