[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 020/136] arm/mcimx6ul-evk: use memdev for RAM
From: |
Paolo Bonzini |
Subject: |
[PULL 020/136] arm/mcimx6ul-evk: use memdev for RAM |
Date: |
Tue, 25 Feb 2020 12:49:10 +0100 |
From: Igor Mammedov <address@hidden>
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 <address@hidden>
Reviewed-by: Andrew Jones <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Message-Id: <address@hidden>
---
hw/arm/mcimx6ul-evk.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/hw/arm/mcimx6ul-evk.c b/hw/arm/mcimx6ul-evk.c
index e90b393..23a71ed 100644
--- a/hw/arm/mcimx6ul-evk.c
+++ b/hw/arm/mcimx6ul-evk.c
@@ -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);
-
- object_property_set_bool(OBJECT(&s->soc), true, "realized", &error_fatal);
+ 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);
- 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)
--
1.8.3.1
- [PULL 013/136] arm/digic_boards: use memdev for RAM, (continued)
- [PULL 013/136] arm/digic_boards: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 010/136] arm/aspeed: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 015/136] arm/imx25_pdk: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 022/136] arm/mps2-tz: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 023/136] arm/mps2: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 025/136] arm/nseries: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 017/136] arm/integratorcp: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 027/136] arm/palm: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 024/136] arm/musicpal: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 019/136] arm/kzm: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 020/136] arm/mcimx6ul-evk: use memdev for RAM,
Paolo Bonzini <=
- [PULL 021/136] arm/mcimx7d-sabre: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 028/136] arm/sabrelite: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 032/136] arm/vexpress: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 026/136] arm/omap_sx1: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 031/136] arm/versatilepb: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 029/136] arm/raspi: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 035/136] arm/xilinx_zynq: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 039/136] null-machine: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 034/136] arm/xilinx_zynq: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 038/136] s390x/s390-virtio-ccw: use memdev for RAM, Paolo Bonzini, 2020/02/25