From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTb1o-0003Sz-Pf for qemu-devel@nongnu.org; Fri, 28 Mar 2014 13:57:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WTb1h-0004S2-Nc for qemu-devel@nongnu.org; Fri, 28 Mar 2014 13:57:16 -0400 Received: from mail-pa0-f44.google.com ([209.85.220.44]:39134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTb1h-0004Rr-I4 for qemu-devel@nongnu.org; Fri, 28 Mar 2014 13:57:09 -0400 Received: by mail-pa0-f44.google.com with SMTP id bj1so5318426pad.31 for ; Fri, 28 Mar 2014 10:57:08 -0700 (PDT) Sender: Grant Likely From: Grant Likely Date: Fri, 28 Mar 2014 10:57:00 -0700 Message-Id: <1396029420-23346-1-git-send-email-grant.likely@linaro.org> Subject: [Qemu-devel] [PATCH] vexpress: Add support for the -bios flag to provide firmware List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Grant Likely , Peter Maydell Right now to run firmware inside the QEMU VExpress model requires padding out the firmware image to the size of the virtual flash and passing it in via the -pflash argument. If the firmware image is passed without padding, then QEMU will fail. Also, when passed as a -pflash argument, QEMU treats the file as persistent storage and will modify the file. The -bios flag provides the semantics that we want for providing a firmware image. This patch maps the contents of the -bios file into the address space at the boot flash location. Tested with the vexpress-a15 model and the Tianocore port. Signed-off-by: Grant Likely Tested-by: Roy Franz Cc: Peter Maydell --- hw/arm/vexpress.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 67628af58840..80c549caa662 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -28,6 +28,7 @@ #include "net/net.h" #include "sysemu/sysemu.h" #include "hw/boards.h" +#include "hw/loader.h" #include "exec/address-spaces.h" #include "sysemu/blockdev.h" #include "hw/block/flash.h" @@ -528,6 +529,17 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard, daughterboard->init(daughterboard, args->ram_size, args->cpu_model, pic); + /* + * If a bios file was provided, attempt to map it into memory + */ + if (bios_name) { + const char *fn = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (!fn || load_image_targphys(fn, map[VE_NORFLASH0], VEXPRESS_FLASH_SIZE) < 0) { + error_report("Could not load rom image '%s'.\n", fn); + exit(0); + } + } + /* Motherboard peripherals: the wiring is the same but the * addresses vary between the legacy and A-Series memory maps. */ -- 1.8.3.2