From 292627bb5e45007eb99d1a7915075eb16dea14ff Mon Sep 17 00:00:00 2001 From: Max Filippov Date: Sun, 30 Oct 2011 21:24:26 +0400 Subject: xtensa_lx60: pass kernel arguments from -append Create boot parameters in the end of SRAM region, insert kernel arguments specified in -append there. Signed-off-by: Max Filippov --- hw/xtensa_lx60.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'hw/xtensa_lx60.c') diff --git a/hw/xtensa_lx60.c b/hw/xtensa_lx60.c index cb047d27c..069b21cae 100644 --- a/hw/xtensa_lx60.c +++ b/hw/xtensa_lx60.c @@ -34,6 +34,7 @@ #include "pc.h" #include "sysbus.h" #include "flash.h" +#include "xtensa_bootparam.h" typedef struct LxBoardDesc { size_t flash_size; @@ -188,10 +189,6 @@ static void lx_init(const LxBoardDesc *board, memory_region_init_ram(ram, NULL, "xtensa.sram", ram_size); memory_region_add_subregion(system_memory, 0, ram); - rom = g_malloc(sizeof(*rom)); - memory_region_init_ram(rom, NULL, "xtensa.rom", 0x1000); - memory_region_add_subregion(system_memory, 0xfe000000, rom); - system_io = g_malloc(sizeof(*system_io)); memory_region_init(system_io, "system.io", 224 * 1024 * 1024); memory_region_add_subregion(system_memory, 0xf0000000, system_io); @@ -223,6 +220,25 @@ static void lx_init(const LxBoardDesc *board, /* Use presence of kernel file name as 'boot from SRAM' switch. */ if (kernel_filename) { + rom = g_malloc(sizeof(*rom)); + memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size); + memory_region_add_subregion(system_memory, 0xfe000000, rom); + + /* Put kernel bootparameters to the end of that SRAM */ + if (kernel_cmdline) { + size_t cmdline_size = strlen(kernel_cmdline) + 1; + size_t bp_size = sizeof(BpTag[4]) + cmdline_size; + uint32_t tagptr = (0xfe000000 + board->sram_size - bp_size) & ~0xff; + + env->regs[2] = tagptr; + + tagptr = put_tag(tagptr, 0x7b0b, 0, NULL); + if (cmdline_size > 1) { + tagptr = put_tag(tagptr, 0x1001, + cmdline_size, kernel_cmdline); + } + tagptr = put_tag(tagptr, 0x7e0b, 0, NULL); + } uint64_t elf_entry; uint64_t elf_lowaddr; int success = load_elf(kernel_filename, translate_phys_addr, env, -- cgit v1.2.3