From patchwork Fri Mar 28 17:57:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Likely X-Patchwork-Id: 27370 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0614E20062 for ; Fri, 28 Mar 2014 17:57:58 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf18802378iec.8 for ; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:date :message-id:cc:subject:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list; bh=AIC01+IltLKV3ZGaFcJ5ljeeT6aqfdC+PFOPNaUmmaw=; b=WTdkmdJ/COXUHoRQps8gceZiku1Ol0cHhY05I9T0ENSGziHvVM67OonQZTfR4tFwvK jxqACwcO5fBRVlIlNP9fcJefUn55jhFj6UFEaUgXZ5OcVKWxS8jxwwHXQLyzV9MfMkHH O0BvCPMFgCdPssy0kh0s9UjSP2/aMYHU5QCJbEDEl7j4htCdeZ81jYQHyd94GTRN4VtQ R5AepfMiJzGLE8S9G8LzDoCK2RCtpmC7YBjD48guruzGLsjV8RpWYyNKGRqr1zXvVMQF eErldPuhLkRnsWsFnuUQT0S0U0vR4LiKCa0YFKc/uRwac0SBPaDuz1VdjB8tg5uyD6wA 6piQ== X-Gm-Message-State: ALoCoQmO1YsrEePh32Y3m/CWJwDZgAwSKrKs7K02VNgtcQvGTmgcSRHT7uYsGO0hQer+7fSgGv1a X-Received: by 10.182.125.134 with SMTP id mq6mr3680083obb.1.1396029478448; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.17.3 with SMTP id 3ls1519864qgc.83.gmail; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) X-Received: by 10.52.166.103 with SMTP id zf7mr1391696vdb.30.1396029478352; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id x18si1267474vcf.207.2014.03.28.10.57.58 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 10:57:58 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id hu19so6325928vcb.29 for ; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) X-Received: by 10.221.40.10 with SMTP id to10mr2581732vcb.22.1396029478278; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp28144vcv; Fri, 28 Mar 2014 10:57:58 -0700 (PDT) X-Received: by 10.140.43.228 with SMTP id e91mr10433446qga.35.1396029477989; Fri, 28 Mar 2014 10:57:57 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l5si562461qai.54.2014.03.28.10.57.57 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 28 Mar 2014 10:57:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:35298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WTb2T-0004FP-NN for patch@linaro.org; Fri, 28 Mar 2014 13:57:57 -0400 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) X-Received: by 10.68.190.200 with SMTP id gs8mr10058791pbc.130.1396029428348; Fri, 28 Mar 2014 10:57:08 -0700 (PDT) Received: from trevor.secretlab.ca ([12.232.193.53]) by mx.google.com with ESMTPSA id ja8sm25920833pbd.3.2014.03.28.10.57.07 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 28 Mar 2014 10:57:07 -0700 (PDT) Received: by trevor.secretlab.ca (Postfix, from userid 1000) id 81727C41FF4; Fri, 28 Mar 2014 17:57:06 +0000 (GMT) From: Grant Likely To: qemu-devel@nongnu.org Date: Fri, 28 Mar 2014 10:57:00 -0700 Message-Id: <1396029420-23346-1-git-send-email-grant.likely@linaro.org> X-Mailer: git-send-email 1.8.3.2 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.44 Cc: Grant Likely , Peter Maydell Subject: [Qemu-devel] [PATCH] vexpress: Add support for the -bios flag to provide firmware X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: grant.likely@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 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. */