mirror of https://github.com/xemu-project/xemu.git
aspeed: Tune eMMC device properties to reflect HW strapping
When the boot-from-eMMC HW strapping bit is set, use the 'boot-config' property to set the boot config register to boot from the first boot area partition of the eMMC device. Also set the boot partition size of the device. 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> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
This commit is contained in:
parent
eea55625df
commit
e554e45b44
hw/arm
|
@ -327,7 +327,8 @@ void aspeed_board_init_flashes(AspeedSMCState *s, const char *flashtype,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc)
|
static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc,
|
||||||
|
bool boot_emmc)
|
||||||
{
|
{
|
||||||
DeviceState *card;
|
DeviceState *card;
|
||||||
|
|
||||||
|
@ -335,6 +336,11 @@ static void sdhci_attach_drive(SDHCIState *sdhci, DriveInfo *dinfo, bool emmc)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
card = qdev_new(emmc ? TYPE_EMMC : TYPE_SD_CARD);
|
card = qdev_new(emmc ? TYPE_EMMC : TYPE_SD_CARD);
|
||||||
|
if (emmc) {
|
||||||
|
qdev_prop_set_uint64(card, "boot-partition-size", 1 * MiB);
|
||||||
|
qdev_prop_set_uint8(card, "boot-config",
|
||||||
|
boot_emmc ? 0x1 << 3 : 0x0);
|
||||||
|
}
|
||||||
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
|
qdev_prop_set_drive_err(card, "drive", blk_by_legacy_dinfo(dinfo),
|
||||||
&error_fatal);
|
&error_fatal);
|
||||||
qdev_realize_and_unref(card,
|
qdev_realize_and_unref(card,
|
||||||
|
@ -365,6 +371,7 @@ static void aspeed_machine_init(MachineState *machine)
|
||||||
AspeedSoCClass *sc;
|
AspeedSoCClass *sc;
|
||||||
int i;
|
int i;
|
||||||
DriveInfo *emmc0 = NULL;
|
DriveInfo *emmc0 = NULL;
|
||||||
|
bool boot_emmc;
|
||||||
|
|
||||||
bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
|
bmc->soc = ASPEED_SOC(object_new(amc->soc_name));
|
||||||
object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
|
object_property_add_child(OBJECT(machine), "soc", OBJECT(bmc->soc));
|
||||||
|
@ -437,19 +444,21 @@ static void aspeed_machine_init(MachineState *machine)
|
||||||
|
|
||||||
for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
|
for (i = 0; i < bmc->soc->sdhci.num_slots; i++) {
|
||||||
sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
|
sdhci_attach_drive(&bmc->soc->sdhci.slots[i],
|
||||||
drive_get(IF_SD, 0, i), false);
|
drive_get(IF_SD, 0, i), false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boot_emmc = sc->boot_from_emmc(bmc->soc);
|
||||||
|
|
||||||
if (bmc->soc->emmc.num_slots) {
|
if (bmc->soc->emmc.num_slots) {
|
||||||
emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
|
emmc0 = drive_get(IF_SD, 0, bmc->soc->sdhci.num_slots);
|
||||||
sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true);
|
sdhci_attach_drive(&bmc->soc->emmc.slots[0], emmc0, true, boot_emmc);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bmc->mmio_exec) {
|
if (!bmc->mmio_exec) {
|
||||||
DeviceState *dev = ssi_get_cs(bmc->soc->fmc.spi, 0);
|
DeviceState *dev = ssi_get_cs(bmc->soc->fmc.spi, 0);
|
||||||
BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
|
BlockBackend *fmc0 = dev ? m25p80_get_blk(dev) : NULL;
|
||||||
|
|
||||||
if (fmc0) {
|
if (fmc0 && !boot_emmc) {
|
||||||
uint64_t rom_size = memory_region_size(&bmc->soc->spi_boot);
|
uint64_t rom_size = memory_region_size(&bmc->soc->spi_boot);
|
||||||
aspeed_install_boot_rom(bmc, fmc0, rom_size);
|
aspeed_install_boot_rom(bmc, fmc0, rom_size);
|
||||||
} else if (emmc0) {
|
} else if (emmc0) {
|
||||||
|
|
Loading…
Reference in New Issue