summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-04-25 22:08:22 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2020-04-26 12:31:34 +0100
commit01069e6610e62a5b2aa886930d75a5cf644f4138 (patch)
tree32a4e59f7aae0c052d64074c0eadaedc35aa0fa2
parent2e2ff674df4c78d2e83b68ab224238de1b3274c3 (diff)
downloadqemu-openbios-01069e6610e62a5b2aa886930d75a5cf644f4138.tar.gz
SPARC32: fix kernel and initrd mapping to match SILO
The previous attempt to fix this was wrong in that I misinterpreted what SILO was doing: whilst it detects a free region of memory for the kernel/initrd, it simply maps the areas at fixed addresses rather than allocating them. Fixes: f633f31 "SPARC32: mark initrd memory as mapped and in use before booting kernel" Fixes: c87d0eb "SPARC32: mark kernel memory as mapped" Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
-rw-r--r--arch/sparc32/boot.h3
-rw-r--r--arch/sparc32/openbios.c31
2 files changed, 19 insertions, 15 deletions
diff --git a/arch/sparc32/boot.h b/arch/sparc32/boot.h
index 366e0f6a..d225a31b 100644
--- a/arch/sparc32/boot.h
+++ b/arch/sparc32/boot.h
@@ -6,6 +6,9 @@
* the copyright and warranty status of this work.
*/
+#define INITRD_VIRT_ADDR 0x60000000
+#define IMAGE_VIRT_ADDR 0x4000
+
// linux_load.c
int linux_load(struct sys_info *info, const char *file, const char *cmdline);
diff --git a/arch/sparc32/openbios.c b/arch/sparc32/openbios.c
index 9ec28bf6..9af4e180 100644
--- a/arch/sparc32/openbios.c
+++ b/arch/sparc32/openbios.c
@@ -925,10 +925,8 @@ arch_init( void )
if (kernel_size) {
kernel_image = fw_cfg_read_i32(FW_CFG_KERNEL_ADDR);
- /* Mark the kernel memory as mapped 1:1 and in use */
- ofmem_claim_phys(PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_size), 0);
- ofmem_claim_virt(PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_size), 0);
- ofmem_map(PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_image), PAGE_ALIGN(kernel_size), -1);
+ /* Map krnel memory a similar way to SILO */
+ ofmem_map(PAGE_ALIGN(kernel_image), IMAGE_VIRT_ADDR, PAGE_ALIGN(kernel_size), -1);
}
kernel_cmdline = (const char *) fw_cfg_read_i32(FW_CFG_KERNEL_CMDLINE);
@@ -944,19 +942,22 @@ arch_init( void )
if (initrd_size) {
initrd_image = fw_cfg_read_i32(FW_CFG_INITRD_ADDR);
- /* Mark initrd memory as mapped 1:1 and in use */
- ofmem_claim_phys(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), 0);
- ofmem_claim_virt(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), 0);
- ofmem_map(PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_image), PAGE_ALIGN(initrd_size), -1);
+ /* Map krnel memory a similar way to SILO */
+ ofmem_map(PAGE_ALIGN(initrd_image), INITRD_VIRT_ADDR, PAGE_ALIGN(initrd_size), -1);
}
- /* Setup nvram variables */
- push_str("/options");
- fword("find-device");
- push_str(cmdline);
- fword("encode-string");
- push_str("boot-file");
- fword("property");
+ if (kernel_size)
+ printk("kernel phys 0x%x virt 0x%x size 0x%x\n", kernel_image, 0x4000, kernel_size);
+ if (initrd_size)
+ printk("initrd phys 0x%x virt 0x%x size 0x%x\n", initrd_image, INITRD_VIRT_ADDR, initrd_size);
+
+ /* Setup nvram variables */
+ push_str("/options");
+ fword("find-device");
+ push_str(cmdline);
+ fword("encode-string");
+ push_str("boot-file");
+ fword("property");
boot_device = fw_cfg_read_i16(FW_CFG_BOOT_DEVICE);