[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 24/32] hw/sd: Subtract bootarea size from blk
From: |
Cédric Le Goater |
Subject: |
[PATCH 24/32] hw/sd: Subtract bootarea size from blk |
Date: |
Mon, 3 Jul 2023 15:25:01 +0200 |
From: Joel Stanley <joel@jms.id.au>
The userdata size is derived from the file the user passes on the
command line, but we must take into account the boot areas.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
hw/sd/sd.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 6da17a8d0972..1df7c7ac9dae 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -674,6 +674,7 @@ static unsigned sd_boot_capacity_bytes(SDState *sd)
static void sd_reset(DeviceState *dev)
{
SDState *sd = SD_CARD(dev);
+ SDCardClass *sc = SD_CARD_GET_CLASS(sd);
uint64_t size;
uint64_t sect;
@@ -685,6 +686,10 @@ static void sd_reset(DeviceState *dev)
}
size = sect << 9;
+ if (sc->bootpart_offset) {
+ size -= sd_boot_capacity_bytes(sd) * 2;
+ }
+
sect = sd_addr_to_wpnum(size) + 1;
sd->state = sd_idle_state;
--
2.41.0
- [PATCH 14/32] hw/sd: Basis for eMMC support, (continued)
- [PATCH 14/32] hw/sd: Basis for eMMC support, Cédric Le Goater, 2023/07/03
- [PATCH 15/32] hw/sd: Add emmc_cmd_SEND_OP_CMD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 16/32] hw/sd: Add emmc_cmd_ALL_SEND_CID() handler, Cédric Le Goater, 2023/07/03
- [PATCH 17/32] hw/sd: Add emmc_cmd_SEND_RELATIVE_ADDR() handler, Cédric Le Goater, 2023/07/03
- [PATCH 18/32] hw/sd: Add emmc_cmd_APP_CMD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 21/32] hw/sd: Add mmc switch function support, Cédric Le Goater, 2023/07/03
- [PATCH 22/32] hw/sd: Add emmc_cmd_SEND_EXT_CSD() handler, Cédric Le Goater, 2023/07/03
- [PATCH 19/32] hw/sd: add emmc_cmd_SEND_TUNING_BLOCK() handler, Cédric Le Goater, 2023/07/03
- [PATCH 20/32] hw/sd: Add CMD21 tuning sequence, Cédric Le Goater, 2023/07/03
- [PATCH 23/32] hw/sd: Support boot area in emmc image, Cédric Le Goater, 2023/07/03
- [PATCH 24/32] hw/sd: Subtract bootarea size from blk,
Cédric Le Goater <=
- [PATCH 25/32] hw/sd: Add boot config support, Cédric Le Goater, 2023/07/03
- [PATCH 26/32] hw/sd: Fix SET_BLOCK_COUNT command argument, Cédric Le Goater, 2023/07/03
- [PATCH 28/32] hw/arm/aspeed: Add eMMC device, Cédric Le Goater, 2023/07/03
- [PATCH 30/32] hw/arm/aspeed: Set boot device to emmc, Cédric Le Goater, 2023/07/03
- [PATCH 31/32] aspeed: Set bootconfig, Cédric Le Goater, 2023/07/03
- [PATCH 27/32] hw/sd: Update CMD1 definition for MMC, Cédric Le Goater, 2023/07/03
- [PATCH 32/32] aspeed: Introduce a 'boot-emmc' property for AST2600 based machines, Cédric Le Goater, 2023/07/03
- [PATCH 29/32] hw/arm/aspeed: Load eMMC first boot area as a boot rom, Cédric Le Goater, 2023/07/03