[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 02/10] hw/sd/sdcard: Fix calculation of size when using eMMC boot
From: |
Cédric Le Goater |
Subject: |
[PULL 02/10] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions |
Date: |
Mon, 4 Nov 2024 11:14:53 +0100 |
From: Jan Luebbe <jlu@pengutronix.de>
The sd_bootpart_offset() function calculates the *runtime* offset which
changes as the guest switches between accessing the main user data area
and the boot partitions by writing to the EXT_CSD_PART_CONFIG_ACC_MASK
bits, so it shouldn't be used to calculate the main user data area size.
Instead, subtract the boot_part_size directly (twice, as there are two
identical boot partitions defined by the eMMC spec).
Suggested-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Fixes: c8cb19876d3e ("hw/sd/sdcard: Support boot area in emmc image")
Tested-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
---
hw/sd/sd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index b2e2d58e013e..f9bd03f3fd9e 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -834,7 +834,9 @@ static void sd_reset(DeviceState *dev)
sect = 0;
}
size = sect << HWBLOCK_SHIFT;
- size -= sd_bootpart_offset(sd);
+ if (sd_is_emmc(sd)) {
+ size -= sd->boot_part_size * 2;
+ }
sect = sd_addr_to_wpnum(size) + 1;
--
2.47.0
- [PULL 00/10] aspeed queue, Cédric Le Goater, 2024/11/04
- [PULL 01/10] hw/arm: enable at24c with aspeed, Cédric Le Goater, 2024/11/04
- [PULL 03/10] hw/arm/aspeed_ast27x0: Use bsa.h for PPI definitions, Cédric Le Goater, 2024/11/04
- [PULL 02/10] hw/sd/sdcard: Fix calculation of size when using eMMC boot partitions,
Cédric Le Goater <=
- [PULL 04/10] hw/arm/aspeed_ast27x0: Avoid hardcoded '256' in IRQ calculation, Cédric Le Goater, 2024/11/04
- [PULL 05/10] aspeed/soc: Support RTC for AST2700, Cédric Le Goater, 2024/11/04
- [PULL 07/10] hw/timer/aspeed: Fix interrupt status does not be cleared for AST2600, Cédric Le Goater, 2024/11/04
- [PULL 08/10] hw/sd/aspeed_sdhci: Introduce Capabilities Register 2 for SD slot 0 and 1, Cédric Le Goater, 2024/11/04
- [PULL 06/10] hw/timer/aspeed: Fix coding style, Cédric Le Goater, 2024/11/04
- [PULL 09/10] aspeed: Support create flash devices via command line for AST1030, Cédric Le Goater, 2024/11/04
- [PULL 10/10] aspeed: Don't set always boot properties of the emmc device, Cédric Le Goater, 2024/11/04
- Re: [PULL 00/10] aspeed queue, Cédric Le Goater, 2024/11/04