[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 012/136] arm/cubieboard: use memdev for RAM
From: |
Paolo Bonzini |
Subject: |
[PULL 012/136] arm/cubieboard: use memdev for RAM |
Date: |
Tue, 25 Feb 2020 12:49:02 +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:
While at it, get rid of no longer needed CubieBoardState wrapper.
Signed-off-by: Igor Mammedov <address@hidden>
Reviewed-by: Andrew Jones <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Message-Id: <address@hidden>
---
hw/arm/cubieboard.c | 25 ++++++++-----------------
1 file changed, 8 insertions(+), 17 deletions(-)
diff --git a/hw/arm/cubieboard.c b/hw/arm/cubieboard.c
index 6dc2f1d..089f9a3 100644
--- a/hw/arm/cubieboard.c
+++ b/hw/arm/cubieboard.c
@@ -28,52 +28,42 @@ static struct arm_boot_info cubieboard_binfo = {
.board_id = 0x1008,
};
-typedef struct CubieBoardState {
- AwA10State *a10;
- MemoryRegion sdram;
-} CubieBoardState;
-
static void cubieboard_init(MachineState *machine)
{
- CubieBoardState *s = g_new(CubieBoardState, 1);
+ AwA10State *a10 = AW_A10(object_new(TYPE_AW_A10));
Error *err = NULL;
- s->a10 = AW_A10(object_new(TYPE_AW_A10));
-
- object_property_set_int(OBJECT(&s->a10->emac), 1, "phy-addr", &err);
+ object_property_set_int(OBJECT(&a10->emac), 1, "phy-addr", &err);
if (err != NULL) {
error_reportf_err(err, "Couldn't set phy address: ");
exit(1);
}
- object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &err);
+ object_property_set_int(OBJECT(&a10->timer), 32768, "clk0-freq", &err);
if (err != NULL) {
error_reportf_err(err, "Couldn't set clk0 frequency: ");
exit(1);
}
- object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq",
- &err);
+ object_property_set_int(OBJECT(&a10->timer), 24000000, "clk1-freq", &err);
if (err != NULL) {
error_reportf_err(err, "Couldn't set clk1 frequency: ");
exit(1);
}
- object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
+ object_property_set_bool(OBJECT(a10), true, "realized", &err);
if (err != NULL) {
error_reportf_err(err, "Couldn't realize Allwinner A10: ");
exit(1);
}
- memory_region_allocate_system_memory(&s->sdram, NULL, "cubieboard.ram",
- machine->ram_size);
memory_region_add_subregion(get_system_memory(), AW_A10_SDRAM_BASE,
- &s->sdram);
+ machine->ram);
/* TODO create and connect IDE devices for ide_drive_get() */
cubieboard_binfo.ram_size = machine->ram_size;
- arm_load_kernel(&s->a10->cpu, machine, &cubieboard_binfo);
+ arm_load_kernel(&a10->cpu, machine, &cubieboard_binfo);
}
static void cubieboard_machine_init(MachineClass *mc)
@@ -84,6 +74,7 @@ static void cubieboard_machine_init(MachineClass *mc)
mc->block_default_type = IF_IDE;
mc->units_per_default_bus = 1;
mc->ignore_memory_transaction_failures = true;
+ mc->default_ram_id = "cubieboard.ram";
}
DEFINE_MACHINE("cubieboard", cubieboard_machine_init)
--
1.8.3.1
- [PULL 000/136] Misc patches for 2020-02-25 (refactoring and Coccinelle edition), Paolo Bonzini, 2020/02/25
- [PULL 003/136] machine: alias -mem-path and -mem-prealloc into memory-foo backend, Paolo Bonzini, 2020/02/25
- [PULL 007/136] vl.c: ensure that ram_size matches size of machine.memory-backend, Paolo Bonzini, 2020/02/25
- [PULL 011/136] arm/collie: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 004/136] machine: introduce convenience MachineState::ram, Paolo Bonzini, 2020/02/25
- [PULL 002/136] machine: introduce memory-backend property, Paolo Bonzini, 2020/02/25
- [PULL 006/136] vl.c: move -m parsing after memory backends has been processed, Paolo Bonzini, 2020/02/25
- [PULL 012/136] arm/cubieboard: use memdev for RAM,
Paolo Bonzini <=
- [PULL 009/136] arm/aspeed: actually check RAM size, Paolo Bonzini, 2020/02/25
- [PULL 008/136] alpha/dp264: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 014/136] arm/highbank: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 016/136] arm/imx25_pdk: use memdev for RAM, Paolo Bonzini, 2020/02/25
- [PULL 018/136] arm/kzm: drop RAM size fixup, Paolo Bonzini, 2020/02/25
- [PULL 005/136] initialize MachineState::ram in NUMA case, Paolo Bonzini, 2020/02/25
- [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