From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43767) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz6sM-00033Q-FY for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:13:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wz6sB-0001lb-Ns for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:13:46 -0400 Received: from mail-lb0-x231.google.com ([2a00:1450:4010:c04::231]:52481) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wz6sB-0001lD-Fd for qemu-devel@nongnu.org; Mon, 23 Jun 2014 12:13:35 -0400 Received: by mail-lb0-f177.google.com with SMTP id u10so4748665lbd.8 for ; Mon, 23 Jun 2014 09:13:34 -0700 (PDT) From: Max Filippov Date: Mon, 23 Jun 2014 20:12:53 +0400 Message-Id: <1403539976-22581-7-git-send-email-jcmvbkbc@gmail.com> In-Reply-To: <1403539976-22581-1-git-send-email-jcmvbkbc@gmail.com> References: <1403539976-22581-1-git-send-email-jcmvbkbc@gmail.com> Subject: [Qemu-devel] [PATCH 6/9] hw/xtensa/xtfpga: add memory info to bootparam List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Max Filippov , Waldemar Brodkorb Signed-off-by: Max Filippov --- hw/xtensa/bootparam.h | 9 +++++++++ hw/xtensa/xtfpga.c | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/hw/xtensa/bootparam.h b/hw/xtensa/bootparam.h index e839bee..955f4e8 100644 --- a/hw/xtensa/bootparam.h +++ b/hw/xtensa/bootparam.h @@ -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; diff --git a/hw/xtensa/xtfpga.c b/hw/xtensa/xtfpga.c index 689d078..97e5842 100644 --- a/hw/xtensa/xtfpga.c +++ b/hw/xtensa/xtfpga.c @@ -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, -- 1.8.1.4