[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option
From: |
Cédric Le Goater |
Subject: |
[PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option |
Date: |
Sun, 21 Jul 2024 10:13:55 +0200 |
From: Cédric Le Goater <clg@kaod.org>
The default behavior of some Aspeed machines is to boot from the eMMC
device, like the rainier-bmc. Others like ast2600-evb could also boot
from eMMC if the HW strapping boot-from-eMMC bit was set. Add a
property to set or unset this bit. This is useful to test boot images.
For now, only activate this property on the ast2600-evb and rainier-bmc
machines for which eMMC images are available or can be built.
Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Tested-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
docs/system/arm/aspeed.rst | 2 ++
hw/arm/aspeed.c | 30 ++++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
index cd9559e3e291..6733ffd2b941 100644
--- a/docs/system/arm/aspeed.rst
+++ b/docs/system/arm/aspeed.rst
@@ -123,6 +123,8 @@ To boot the machine from the flash image, use an MTD drive :
Options specific to Aspeed machines are :
+ * ``boot-emmc`` to set or unset boot from eMMC (AST2600).
+
* ``execute-in-place`` which emulates the boot from the CE0 flash
device by using the FMC controller to load the instructions, and
not simply from RAM. This takes a little longer.
diff --git a/hw/arm/aspeed.c b/hw/arm/aspeed.c
index 9939559f6dd0..5cdef873a5fc 100644
--- a/hw/arm/aspeed.c
+++ b/hw/arm/aspeed.c
@@ -1178,6 +1178,34 @@ static void
aspeed_machine_class_init_cpus_defaults(MachineClass *mc)
mc->valid_cpu_types = sc->valid_cpu_types;
}
+static bool aspeed_machine_ast2600_get_boot_from_emmc(Object *obj, Error
**errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+
+ return !!(bmc->hw_strap1 & SCU_AST2600_HW_STRAP_BOOT_SRC_EMMC);
+}
+
+static void aspeed_machine_ast2600_set_boot_from_emmc(Object *obj, bool value,
+ Error **errp)
+{
+ AspeedMachineState *bmc = ASPEED_MACHINE(obj);
+
+ if (value) {
+ bmc->hw_strap1 |= SCU_AST2600_HW_STRAP_BOOT_SRC_EMMC;
+ } else {
+ bmc->hw_strap1 &= ~SCU_AST2600_HW_STRAP_BOOT_SRC_EMMC;
+ }
+}
+
+static void aspeed_machine_ast2600_class_emmc_init(ObjectClass *oc)
+{
+ object_class_property_add_bool(oc, "boot-emmc",
+ aspeed_machine_ast2600_get_boot_from_emmc,
+ aspeed_machine_ast2600_set_boot_from_emmc);
+ object_class_property_set_description(oc, "boot-emmc",
+ "Set or unset boot from EMMC");
+}
+
static void aspeed_machine_class_init(ObjectClass *oc, void *data)
{
MachineClass *mc = MACHINE_CLASS(oc);
@@ -1377,6 +1405,7 @@ static void
aspeed_machine_ast2600_evb_class_init(ObjectClass *oc, void *data)
amc->i2c_init = ast2600_evb_i2c_init;
mc->default_ram_size = 1 * GiB;
aspeed_machine_class_init_cpus_defaults(mc);
+ aspeed_machine_ast2600_class_emmc_init(oc);
};
static void aspeed_machine_tacoma_class_init(ObjectClass *oc, void *data)
@@ -1449,6 +1478,7 @@ static void aspeed_machine_rainier_class_init(ObjectClass
*oc, void *data)
amc->i2c_init = rainier_bmc_i2c_init;
mc->default_ram_size = 1 * GiB;
aspeed_machine_class_init_cpus_defaults(mc);
+ aspeed_machine_ast2600_class_emmc_init(oc);
};
#define FUJI_BMC_RAM_SIZE ASPEED_RAM_SIZE(2 * GiB)
--
2.45.2
- [PULL 00/15] aspeed queue, Cédric Le Goater, 2024/07/21
- [PULL 02/15] aspeed: Change type of eMMC device, Cédric Le Goater, 2024/07/21
- [PULL 06/15] aspeed: Tune eMMC device properties to reflect HW strapping, Cédric Le Goater, 2024/07/21
- [PULL 03/15] aspeed: Load eMMC first boot area as a boot rom, Cédric Le Goater, 2024/07/21
- [PULL 01/15] aspeed/smc: Fix possible integer overflow, Cédric Le Goater, 2024/07/21
- [PULL 04/15] aspeed/scu: Add boot-from-eMMC HW strapping bit for AST2600 SoC, Cédric Le Goater, 2024/07/21
- [PULL 05/15] aspeed: Introduce a AspeedSoCClass 'boot_from_emmc' handler, Cédric Le Goater, 2024/07/21
- [PULL 07/15] aspeed: Add boot-from-eMMC HW strapping bit to rainier-bmc machine, Cédric Le Goater, 2024/07/21
- [PULL 09/15] aspeed: Introduce a 'boot-emmc' machine option,
Cédric Le Goater <=
- [PULL 08/15] aspeed: Introduce a 'hw_strap1' machine attribute, Cédric Le Goater, 2024/07/21
- [PULL 11/15] aspeed/adc: Add AST2700 support, Cédric Le Goater, 2024/07/21
- [PULL 10/15] tests/avocado/machine_aspeed.py: Add eMMC boot tests, Cédric Le Goater, 2024/07/21
- [PULL 12/15] aspeed/soc: support ADC for AST2700, Cédric Le Goater, 2024/07/21
- [PULL 15/15] aspeed: fix coding style, Cédric Le Goater, 2024/07/21
- [PULL 14/15] hw/i2c/aspeed: rename the I2C class pool attribute to share_pool, Cédric Le Goater, 2024/07/21
- [PULL 13/15] hw/i2c/aspeed: support to set the different memory size, Cédric Le Goater, 2024/07/21
- Re: [PULL 00/15] aspeed queue, Richard Henderson, 2024/07/22