diff mbox series

[v3,88/88] hw/hppa: Map PDC ROM and I/O memory area into lower memory

Message ID 20231102013016.369010-89-richard.henderson@linaro.org
State New
Headers show
Series target/hppa: Implement hppa64 cpu | expand

Commit Message

Richard Henderson Nov. 2, 2023, 1:30 a.m. UTC
From: Helge Deller <deller@gmx.de>

When running a 64-bit CPU in 32-bit mode (e.g. when using a
32-bit kernel) the PDC ROM and I/O area has to be accessible
in the 0xf0000000 memory region.

Signed-off-by: Helge Deller <deller@gmx.de>
---
 hw/hppa/machine.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/hw/hppa/machine.c b/hw/hppa/machine.c
index a3222d3a96..e488914bba 100644
--- a/hw/hppa/machine.c
+++ b/hw/hppa/machine.c
@@ -603,6 +603,7 @@  static void machine_HP_C3700_init(MachineState *machine)
     AstroState *astro;
     DeviceState *astro_dev;
     MemoryRegion *addr_space = get_system_memory();
+    MemoryRegion *io_low_alias = g_new(MemoryRegion, 2);
     TranslateFn *translate;
 
     /* Create CPUs and RAM.  */
@@ -614,6 +615,20 @@  static void machine_HP_C3700_init(MachineState *machine)
         exit(1);
     }
 
+    /* map PDC ROM into lower memory region, needed if PSW.W=0 */
+    memory_region_init_alias(&io_low_alias[0], NULL, "firmware-alias",
+                             addr_space, translate(NULL, FIRMWARE_START),
+                             FIRMWARE_END - FIRMWARE_START);
+    memory_region_add_subregion(addr_space, (uint32_t) FIRMWARE_START,
+                             &io_low_alias[0]);
+
+    /* map all of I/O area into lower memory region, needed if PSW.W=0 */
+    memory_region_init_alias(&io_low_alias[1], NULL, "iomem-alias",
+                             addr_space, translate(NULL, 0xf1000000UL),
+                             0xf000000UL);
+    memory_region_add_subregion(addr_space, (uint32_t) 0xf1000000UL,
+                             &io_low_alias[1]);
+
     /* Init Astro and the Elroys (PCI host bus chips).  */
     astro = astro_init();
     astro_dev = DEVICE(astro);