[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 31/86] arm:sabrelite: use memdev for RAM
From: |
Igor Mammedov |
Subject: |
[PATCH 31/86] arm:sabrelite: use memdev for RAM |
Date: |
Tue, 31 Dec 2019 14:03:15 +0100 |
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 <address@hidden>
---
hw/arm/sabrelite.c | 23 ++++++++---------------
1 file changed, 8 insertions(+), 15 deletions(-)
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
index 96cc455..e31694b 100644
--- a/hw/arm/sabrelite.c
+++ b/hw/arm/sabrelite.c
@@ -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)
--
2.7.4
- [PATCH 29/86] arm:palm: use memdev for RAM, (continued)
- [PATCH 29/86] arm:palm: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 27/86] arm:nseries: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 23/86] arm:mcimx7d-sabre: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 28/86] arm:omap_sx1: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 13/86] arm:collie: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 32/86] arm:sbsa-ref: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 33/86] arm:versatilepb: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 30/86] arm:raspi: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 37/86] arm:xilinx_zynq: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 42/86] cris:axis_dev88: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 31/86] arm:sabrelite: use memdev for RAM,
Igor Mammedov <=
- [PATCH 35/86] arm:virt: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 41/86] null-machine: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 36/86] arm:xilinx_zynq: drop RAM size fixup, Igor Mammedov, 2019/12/31
- [PATCH 43/86] hppa: drop RAM size fixup, Igor Mammedov, 2019/12/31
- [PATCH 34/86] arm:vexpress: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 39/86] arm:xlnx-zcu102: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 46/86] x86:pc: use memdev for RAM, Igor Mammedov, 2019/12/31
- [PATCH 45/86] x86:microvm: use memdev for RAM, Igor Mammedov, 2019/12/31