arm/sabrelite: use memdev for RAM
memory_region_allocate_system_memory() API is going away, so replace it with memdev allocated MemoryRegion. The later is initialized by generic code, so board only needs to opt in to memdev scheme by providing MachineClass::default_ram_id and using MachineState::ram instead of manually initializing RAM memory region. PS: remove no longer needed IMX6Sabrelite Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20200219160953.13771-29-imammedo@redhat.com>
This commit is contained in:
parent
7f1679dc2c
commit
778f43267a
@ -19,11 +19,6 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/qtest.h"
|
||||
|
||||
typedef struct IMX6Sabrelite {
|
||||
FslIMX6State soc;
|
||||
MemoryRegion ram;
|
||||
} IMX6Sabrelite;
|
||||
|
||||
static struct arm_boot_info sabrelite_binfo = {
|
||||
/* DDR memory start */
|
||||
.loader_start = FSL_IMX6_MMDC_ADDR,
|
||||
@ -45,7 +40,7 @@ static void sabrelite_reset_secondary(ARMCPU *cpu,
|
||||
|
||||
static void sabrelite_init(MachineState *machine)
|
||||
{
|
||||
IMX6Sabrelite *s = g_new0(IMX6Sabrelite, 1);
|
||||
FslIMX6State *s;
|
||||
Error *err = NULL;
|
||||
|
||||
/* Check the amount of memory is compatible with the SOC */
|
||||
@ -55,19 +50,16 @@ static void sabrelite_init(MachineState *machine)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
|
||||
TYPE_FSL_IMX6, &error_abort, NULL);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->soc), true, "realized", &err);
|
||||
s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
|
||||
object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fatal);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_report("%s", error_get_pretty(err));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "sabrelite.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
|
||||
&s->ram);
|
||||
machine->ram);
|
||||
|
||||
{
|
||||
/*
|
||||
@ -78,7 +70,7 @@ static void sabrelite_init(MachineState *machine)
|
||||
/* Add the sst25vf016b NOR FLASH memory to first SPI */
|
||||
Object *spi_dev;
|
||||
|
||||
spi_dev = object_resolve_path_component(OBJECT(&s->soc), "spi1");
|
||||
spi_dev = object_resolve_path_component(OBJECT(s), "spi1");
|
||||
if (spi_dev) {
|
||||
SSIBus *spi_bus;
|
||||
|
||||
@ -109,7 +101,7 @@ static void sabrelite_init(MachineState *machine)
|
||||
sabrelite_binfo.secondary_cpu_reset_hook = sabrelite_reset_secondary;
|
||||
|
||||
if (!qtest_enabled()) {
|
||||
arm_load_kernel(&s->soc.cpu[0], machine, &sabrelite_binfo);
|
||||
arm_load_kernel(&s->cpu[0], machine, &sabrelite_binfo);
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +111,7 @@ static void sabrelite_machine_init(MachineClass *mc)
|
||||
mc->init = sabrelite_init;
|
||||
mc->max_cpus = FSL_IMX6_NUM_CPUS;
|
||||
mc->ignore_memory_transaction_failures = true;
|
||||
mc->default_ram_id = "sabrelite.ram";
|
||||
}
|
||||
|
||||
DEFINE_MACHINE("sabrelite", sabrelite_machine_init)
|
||||
|
Loading…
Reference in New Issue
Block a user