mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-24 12:09:58 +00:00
arm/mcimx6ul-evk: 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 MCIMX6ULEVK Signed-off-by: Igor Mammedov <imammedo@redhat.com> Reviewed-by: Andrew Jones <drjones@redhat.com> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20200219160953.13771-21-imammedo@redhat.com>
This commit is contained in:
parent
3865cfacfe
commit
14dbfa556b
@ -19,15 +19,10 @@
|
||||
#include "qemu/error-report.h"
|
||||
#include "sysemu/qtest.h"
|
||||
|
||||
typedef struct {
|
||||
FslIMX6ULState soc;
|
||||
MemoryRegion ram;
|
||||
} MCIMX6ULEVK;
|
||||
|
||||
static void mcimx6ul_evk_init(MachineState *machine)
|
||||
{
|
||||
static struct arm_boot_info boot_info;
|
||||
MCIMX6ULEVK *s = g_new0(MCIMX6ULEVK, 1);
|
||||
FslIMX6ULState *s;
|
||||
int i;
|
||||
|
||||
if (machine->ram_size > FSL_IMX6UL_MMDC_SIZE) {
|
||||
@ -43,15 +38,12 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
.nb_cpus = machine->smp.cpus,
|
||||
};
|
||||
|
||||
object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc),
|
||||
TYPE_FSL_IMX6UL, &error_fatal, NULL);
|
||||
s = FSL_IMX6UL(object_new(TYPE_FSL_IMX6UL));
|
||||
object_property_add_child(OBJECT(machine), "soc", OBJECT(s), &error_fatal);
|
||||
object_property_set_bool(OBJECT(s), true, "realized", &error_fatal);
|
||||
|
||||
object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
|
||||
|
||||
memory_region_allocate_system_memory(&s->ram, NULL, "mcimx6ul-evk.ram",
|
||||
machine->ram_size);
|
||||
memory_region_add_subregion(get_system_memory(),
|
||||
FSL_IMX6UL_MMDC_ADDR, &s->ram);
|
||||
memory_region_add_subregion(get_system_memory(), FSL_IMX6UL_MMDC_ADDR,
|
||||
machine->ram);
|
||||
|
||||
for (i = 0; i < FSL_IMX6UL_NUM_USDHCS; i++) {
|
||||
BusState *bus;
|
||||
@ -61,7 +53,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
|
||||
di = drive_get_next(IF_SD);
|
||||
blk = di ? blk_by_legacy_dinfo(di) : NULL;
|
||||
bus = qdev_get_child_bus(DEVICE(&s->soc.usdhc[i]), "sd-bus");
|
||||
bus = qdev_get_child_bus(DEVICE(&s->usdhc[i]), "sd-bus");
|
||||
carddev = qdev_create(bus, TYPE_SD_CARD);
|
||||
qdev_prop_set_drive(carddev, "drive", blk, &error_fatal);
|
||||
object_property_set_bool(OBJECT(carddev), true,
|
||||
@ -69,7 +61,7 @@ static void mcimx6ul_evk_init(MachineState *machine)
|
||||
}
|
||||
|
||||
if (!qtest_enabled()) {
|
||||
arm_load_kernel(&s->soc.cpu, machine, &boot_info);
|
||||
arm_load_kernel(&s->cpu, machine, &boot_info);
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,5 +70,6 @@ static void mcimx6ul_evk_machine_init(MachineClass *mc)
|
||||
mc->desc = "Freescale i.MX6UL Evaluation Kit (Cortex A7)";
|
||||
mc->init = mcimx6ul_evk_init;
|
||||
mc->max_cpus = FSL_IMX6UL_NUM_CPUS;
|
||||
mc->default_ram_id = "mcimx6ul-evk.ram";
|
||||
}
|
||||
DEFINE_MACHINE("mcimx6ul-evk", mcimx6ul_evk_machine_init)
|
||||
|
Loading…
Reference in New Issue
Block a user