aboutsummaryrefslogtreecommitdiff
path: root/hw/xtensa_lx60.c
diff options
context:
space:
mode:
authorMax Filippov <jcmvbkbc@gmail.com>2011-10-30 21:24:26 +0400
committerMax Filippov <jcmvbkbc@gmail.com>2011-11-02 05:05:52 +0400
commit292627bb5e45007eb99d1a7915075eb16dea14ff (patch)
tree8257975b8a49364643e2db0bf7b9f410809281b9 /hw/xtensa_lx60.c
parent82b25dc8b04766fde3982fec448ebfd48233f4d4 (diff)
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 <jcmvbkbc@gmail.com>
Diffstat (limited to 'hw/xtensa_lx60.c')
-rw-r--r--hw/xtensa_lx60.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/hw/xtensa_lx60.c b/hw/xtensa_lx60.c
index cb047d27ce..069b21cae8 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,