[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 25/25] hw/sd: Add boot config support
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 25/25] hw/sd: Add boot config support |
Date: |
Mon, 30 May 2022 21:38:16 +0200 |
From: Joel Stanley <joel@jms.id.au>
Introduced "boot-config" property to set CSD 179, the boot config
register.
With this correctly set we can use the enable bit to detect if partition
support is enabled.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/sd/sd.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 26ddf3e92d..da909ec59f 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -116,6 +116,7 @@ struct SDState {
uint8_t spec_version;
BlockBackend *blk;
bool spi;
+ uint8_t boot_config;
/* Runtime changeables */
@@ -453,6 +454,8 @@ static void mmc_set_ext_csd(SDState *sd, uint64_t size)
sd->ext_csd[159] = 0x00; /* Max enhanced area size */
sd->ext_csd[158] = 0x00; /* ... */
sd->ext_csd[157] = 0xEC; /* ... */
+
+ sd->ext_csd[EXT_CSD_PART_CONFIG] = sd->boot_config;
}
static void sd_emmc_set_csd(SDState *sd, uint64_t size)
@@ -878,8 +881,14 @@ static uint32_t sd_emmc_bootpart_offset(SDState *sd)
{
unsigned int access = sd->ext_csd[EXT_CSD_PART_CONFIG] &
EXT_CSD_PART_CONFIG_ACC_MASK;
+ unsigned int enable = sd->ext_csd[EXT_CSD_PART_CONFIG] &
+ EXT_CSD_PART_CONFIG_EN_MASK;
unsigned int boot_capacity = sd_boot_capacity_bytes(sd);
+ if (!enable) {
+ return 0;
+ }
+
switch (access) {
case EXT_CSD_PART_CONFIG_ACC_DEFAULT:
return boot_capacity * 2;
@@ -2548,6 +2557,7 @@ static Property sd_properties[] = {
* board to ensure that ssi transfers only occur when the chip select
* is asserted. */
DEFINE_PROP_BOOL("spi", SDState, spi, false),
+ DEFINE_PROP_UINT8("boot-config", SDState, boot_config, 0x0),
DEFINE_PROP_END_OF_LIST()
};
--
2.36.1
- [PATCH v2 16/25] hw/sd: Add sd_emmc_cmd_ALL_SEND_CID() handler, (continued)
- [PATCH v2 16/25] hw/sd: Add sd_emmc_cmd_ALL_SEND_CID() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 17/25] hw/sd: Add sd_emmc_cmd_SEND_RELATIVE_ADDR() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 18/25] hw/sd: Add sd_emmc_cmd_APP_CMD() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 19/25] hw/sd: add sd_emmc_cmd_SEND_TUNING_BLOCK() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 20/25] hw/sd: Add CMD21 tuning sequence, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 21/25] hw/sd: Add mmc switch function support, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 22/25] hw/sd: Add sd_emmc_cmd_SEND_EXT_CSD() handler, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 23/25] hw/sd: Support boot area in emmc image, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 24/25] hw/sd: Subtract bootarea size from blk, Philippe Mathieu-Daudé, 2022/05/30
- [PATCH v2 25/25] hw/sd: Add boot config support,
Philippe Mathieu-Daudé <=
- Re: [PATCH v2 00/25] hw/sd: Rework models for eMMC support, Cédric Le Goater, 2022/05/31
- Re: [PATCH v2 00/25] hw/sd: Rework models for eMMC support, Cédric Le Goater, 2022/05/31