Skip to content

Commit

Permalink
SPARC32: mark initrd memory as mapped and in use before booting kernel
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
  • Loading branch information
mcayland committed Feb 8, 2019
1 parent c87d0eb commit f633f31
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions arch/sparc32/boot.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

uint32_t kernel_image;
uint32_t kernel_size;
uint32_t initrd_image;
uint32_t initrd_size;
uint32_t qemu_cmdline;
uint32_t cmdline_size;
char boot_device;
Expand Down
10 changes: 10 additions & 0 deletions arch/sparc32/openbios.c
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,16 @@ arch_init( void )
obp_arg.argv[1] = cmdline;
qemu_cmdline = (uint32_t)cmdline;

initrd_size = fw_cfg_read_i32(FW_CFG_INITRD_SIZE);
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);
}

/* Setup nvram variables */
push_str("/options");
fword("find-device");
Expand Down
2 changes: 2 additions & 0 deletions include/drivers/drivers.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ void ob_intr(int intr);
/* arch/sparc32/boot.c */
extern uint32_t kernel_image;
extern uint32_t kernel_size;
extern uint32_t initrd_image;
extern uint32_t initrd_size;
extern uint32_t qemu_cmdline;
extern uint32_t cmdline_size;
extern char boot_device;
Expand Down

0 comments on commit f633f31

Please sign in to comment.