[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 61/64] hw/nios2: Move memory regions into Nios2Machine
From: |
Richard Henderson |
Subject: |
[PATCH v7 61/64] hw/nios2: Move memory regions into Nios2Machine |
Date: |
Thu, 21 Apr 2022 08:17:32 -0700 |
Convert to contiguous allocation, as much as possible so far.
The two timer objects are not exposed for subobject allocation.
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
hw/nios2/10m50_devboard.c | 30 ++++++++++++++++--------------
1 file changed, 16 insertions(+), 14 deletions(-)
diff --git a/hw/nios2/10m50_devboard.c b/hw/nios2/10m50_devboard.c
index bdc3ffd50d..dda4ab2bf5 100644
--- a/hw/nios2/10m50_devboard.c
+++ b/hw/nios2/10m50_devboard.c
@@ -38,6 +38,11 @@
struct Nios2MachineState {
MachineState parent_obj;
+
+ MemoryRegion phys_tcm;
+ MemoryRegion phys_tcm_alias;
+ MemoryRegion phys_ram;
+ MemoryRegion phys_ram_alias;
};
#define TYPE_NIOS2_MACHINE MACHINE_TYPE_NAME("10m50-ghrd")
@@ -47,13 +52,10 @@ OBJECT_DECLARE_TYPE(Nios2MachineState, MachineClass,
NIOS2_MACHINE)
static void nios2_10m50_ghrd_init(MachineState *machine)
{
+ Nios2MachineState *nms = NIOS2_MACHINE(machine);
Nios2CPU *cpu;
DeviceState *dev;
MemoryRegion *address_space_mem = get_system_memory();
- MemoryRegion *phys_tcm = g_new(MemoryRegion, 1);
- MemoryRegion *phys_tcm_alias = g_new(MemoryRegion, 1);
- MemoryRegion *phys_ram = g_new(MemoryRegion, 1);
- MemoryRegion *phys_ram_alias = g_new(MemoryRegion, 1);
ram_addr_t tcm_base = 0x0;
ram_addr_t tcm_size = 0x1000; /* 1 kiB, but QEMU limit is 4 kiB */
ram_addr_t ram_base = 0x08000000;
@@ -62,22 +64,22 @@ static void nios2_10m50_ghrd_init(MachineState *machine)
int i;
/* Physical TCM (tb_ram_1k) with alias at 0xc0000000 */
- memory_region_init_ram(phys_tcm, NULL, "nios2.tcm", tcm_size,
+ memory_region_init_ram(&nms->phys_tcm, NULL, "nios2.tcm", tcm_size,
&error_abort);
- memory_region_init_alias(phys_tcm_alias, NULL, "nios2.tcm.alias",
- phys_tcm, 0, tcm_size);
- memory_region_add_subregion(address_space_mem, tcm_base, phys_tcm);
+ memory_region_init_alias(&nms->phys_tcm_alias, NULL, "nios2.tcm.alias",
+ &nms->phys_tcm, 0, tcm_size);
+ memory_region_add_subregion(address_space_mem, tcm_base, &nms->phys_tcm);
memory_region_add_subregion(address_space_mem, 0xc0000000 + tcm_base,
- phys_tcm_alias);
+ &nms->phys_tcm_alias);
/* Physical DRAM with alias at 0xc0000000 */
- memory_region_init_ram(phys_ram, NULL, "nios2.ram", ram_size,
+ memory_region_init_ram(&nms->phys_ram, NULL, "nios2.ram", ram_size,
&error_abort);
- memory_region_init_alias(phys_ram_alias, NULL, "nios2.ram.alias",
- phys_ram, 0, ram_size);
- memory_region_add_subregion(address_space_mem, ram_base, phys_ram);
+ memory_region_init_alias(&nms->phys_ram_alias, NULL, "nios2.ram.alias",
+ &nms->phys_ram, 0, ram_size);
+ memory_region_add_subregion(address_space_mem, ram_base, &nms->phys_ram);
memory_region_add_subregion(address_space_mem, 0xc0000000 + ram_base,
- phys_ram_alias);
+ &nms->phys_ram_alias);
/* Create CPU -- FIXME */
cpu = NIOS2_CPU(cpu_create(TYPE_NIOS2_CPU));
--
2.34.1
- [PATCH v7 48/64] target/nios2: Create gen_jumpr, (continued)
- [PATCH v7 48/64] target/nios2: Create gen_jumpr, Richard Henderson, 2022/04/21
- [PATCH v7 40/64] target/nios2: Remove CPU_INTERRUPT_NMI, Richard Henderson, 2022/04/21
- [PATCH v7 51/64] target/nios2: Use tcg_gen_lookup_and_goto_ptr, Richard Henderson, 2022/04/21
- [PATCH v7 45/64] target/nios2: Introduce dest_gpr, Richard Henderson, 2022/04/21
- [PATCH v7 47/64] target/nios2: Enable unaligned traps for system mode, Richard Henderson, 2022/04/21
- [PATCH v7 46/64] target/nios2: Drop CR_STATUS_EH from tb->flags, Richard Henderson, 2022/04/21
- [PATCH v7 49/64] target/nios2: Hoist set of is_jmp into gen_goto_tb, Richard Henderson, 2022/04/21
- [PATCH v7 50/64] target/nios2: Use gen_goto_tb for DISAS_TOO_MANY, Richard Henderson, 2022/04/21
- [PATCH v7 52/64] target/nios2: Implement Misaligned destination exception, Richard Henderson, 2022/04/21
- [PATCH v7 58/64] linux-user/nios2: Handle various SIGILL exceptions, Richard Henderson, 2022/04/21
- [PATCH v7 61/64] hw/nios2: Move memory regions into Nios2Machine,
Richard Henderson <=
- [PATCH v7 56/64] target/nios2: Implement EIC interrupt processing, Richard Henderson, 2022/04/21
- [PATCH v7 55/64] target/nios2: Update helper_eret for shadow registers, Richard Henderson, 2022/04/21
- [PATCH v7 59/64] hw/intc: Vectored Interrupt Controller (VIC), Richard Henderson, 2022/04/21
- [PATCH v7 64/64] tests/tcg/nios2: Add test-shadow-1, Richard Henderson, 2022/04/21
- [PATCH v7 53/64] target/nios2: Introduce shadow register sets, Richard Henderson, 2022/04/21
- [PATCH v7 60/64] hw/nios2: Introduce Nios2MachineState, Richard Henderson, 2022/04/21
- [PATCH v7 54/64] target/nios2: Implement rdprs, wrprs, Richard Henderson, 2022/04/21