hw/xtensa/xtfpga: add memory info to bootparam
authorMax Filippov <jcmvbkbc@gmail.com>
Mon, 23 Jun 2014 13:24:48 +0000 (17:24 +0400)
committerMax Filippov <jcmvbkbc@gmail.com>
Sat, 28 Jun 2014 22:32:42 +0000 (02:32 +0400)
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
hw/xtensa/bootparam.h
hw/xtensa/xtfpga.c

index e839bee5764ef225c635cda6fea5e81d800b66ac..955f4e86e3da77d9da39e25048f0a88cadaa16c9 100644 (file)
@@ -16,6 +16,15 @@ typedef struct BpTag {
     uint16_t size;
 } BpTag;
 
+typedef struct BpMemInfo {
+    uint32_t type;
+    uint32_t start;
+    uint32_t end;
+} BpMemInfo;
+
+#define MEMORY_TYPE_CONVENTIONAL        0x1000
+#define MEMORY_TYPE_NONE                0x2000
+
 static inline size_t get_tag_size(size_t data_size)
 {
     return data_size + sizeof(BpTag) + 4;
index 689d07843b45f28dcd00df5780d867aa34d6fa1a..97e5842e6d5e5aa057ef4b777998811872b8b74d 100644 (file)
@@ -237,9 +237,14 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
 
     /* Use presence of kernel file name as 'boot from SRAM' switch. */
     if (kernel_filename) {
-        size_t bp_size = 2 * get_tag_size(0);
+        size_t bp_size = 3 * get_tag_size(0); /* first/last and memory tags */
         uint32_t tagptr = 0xfe000000 + board->sram_size;
         uint32_t cur_tagptr;
+        BpMemInfo memory_location = {
+            .type = tswap32(MEMORY_TYPE_CONVENTIONAL),
+            .start = tswap32(0),
+            .end = tswap32(machine->ram_size),
+        };
 
         rom = g_malloc(sizeof(*rom));
         memory_region_init_ram(rom, NULL, "lx60.sram", board->sram_size);
@@ -253,6 +258,8 @@ static void lx_init(const LxBoardDesc *board, MachineState *machine)
         /* Put kernel bootparameters to the end of that SRAM */
         tagptr = (tagptr - bp_size) & ~0xff;
         cur_tagptr = put_tag(tagptr, BP_TAG_FIRST, 0, NULL);
+        cur_tagptr = put_tag(cur_tagptr, BP_TAG_MEMORY,
+                             sizeof(memory_location), &memory_location);
 
         if (kernel_cmdline) {
             cur_tagptr = put_tag(cur_tagptr, BP_TAG_COMMAND_LINE,