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 --- arch/sparc32/boot.h | 3 +++ arch/sparc32/openbios.c | 31 ++++++++++++++++--------------- 2 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/arch/sparc32/boot.h b/arch/sparc32/boot.h index 366e0f6..d225a31 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 9ec28bf..8c830fa 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 kernel memory in 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 initrd memory in 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);