qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/5] hw/sparc64/niagara: Pass available memory region size to add


From: Philippe Mathieu-Daudé
Subject: [PATCH 1/5] hw/sparc64/niagara: Pass available memory region size to add_rom_or_fail
Date: Mon, 9 Mar 2020 15:43:49 +0100

In few commits we'll let rom_add_file_fixed() take a 'size'
argument holding the maximum file length that can be loaded
as ROM. In preparation, modify the Niagara machine, so the
generic change will be easier to review.

Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
 hw/sparc64/niagara.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index ab5ef8c5b3..f58d008d3d 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -85,7 +85,8 @@ typedef struct NiagaraBoardState {
 #define NIAGARA_OBP_OFFSET  0x80000ULL
 #define PROM_SIZE_MAX       (4 * MiB)
 
-static void add_rom_or_fail(const char *file, const hwaddr addr)
+static void add_rom_or_fail(const char *file, const hwaddr addr,
+                            uint64_t region_size)
 {
     /* XXX remove qtest_enabled() check once firmware files are
      * in the qemu tree
@@ -126,13 +127,15 @@ static void niagara_init(MachineState *machine)
                            &error_fatal);
     memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom);
 
-    add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE);
-    add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE);
-    add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE);
+    add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE, NIAGARA_NVRAM_SIZE);
+    add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE, NIAGARA_MD_ROM_SIZE);
+    add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE, NIAGARA_HV_ROM_SIZE);
 
-    add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE);
-    add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET);
-    add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET);
+    add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE, NIAGARA_Q_OFFSET);
+    add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET,
+                    NIAGARA_OBP_OFFSET);
+    add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET,
+                    PROM_SIZE_MAX - NIAGARA_OBP_OFFSET);
 
     /* the virtual ramdisk is kind of initrd, but it resides
        outside of the partition RAM */
-- 
2.21.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]