[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 29/86] arm:sabrelite: use memdev for RAM
From: |
Igor Mammedov |
Subject: |
[PATCH v2 29/86] arm:sabrelite: use memdev for RAM |
Date: |
Wed, 15 Jan 2020 16:06:44 +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>
---
CC: address@hidden
CC: address@hidden
CC: 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
- Re: [PATCH v2 16/86] arm:imx25_pdk: use memdev for RAM, (continued)
- [PATCH v2 15/86] arm:imx25_pdk: drop RAM size fixup, Igor Mammedov, 2020/01/15
- [PATCH v2 20/86] arm:mcimx6ul-evk: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 21/86] arm:mcimx7d-sabre: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 23/86] arm:mps2: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 22/86] arm:mps2-tz: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 24/86] arm:musicpal: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 25/86] arm:nseries: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 27/86] arm:palm: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 26/86] arm:omap_sx1: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 29/86] arm:sabrelite: use memdev for RAM,
Igor Mammedov <=
- [PATCH v2 28/86] arm:raspi: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 31/86] arm:versatilepb: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 30/86] arm:sbsa-ref: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 32/86] arm:vexpress: use memdev for RAM, Igor Mammedov, 2020/01/15
- [PATCH v2 36/86] arm:xlnx-versal-virt: use memdev for RAM, Igor Mammedov, 2020/01/15