From patchwork Mon Jun 9 14:57:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 31580 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B05E020675 for ; Mon, 9 Jun 2014 15:08:35 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wm4sf35801624obc.6 for ; Mon, 09 Jun 2014 08:08:35 -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:in-reply-to:references: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=aqeC/X99puSvqDRpMLylXVSxChoFx27d2dfDGfmQRWY=; b=JSAEv2fBnTHBhQf8nVec5c3YfPtAlT2nSouQcrF9qspQ7ZfZnt53CUHi/3sUrVD/u3 9Dtim0N9l+qVFxjzPjB6IDGmIe09XYPcP9i4lv1WVbnxF5BBACebcVfygt7qFDOkhrW7 ZzxQ+VLH4gA6CvgdwUiDxsVWHi2AFClZSdHQIrtiSOJh5zgoCbQWcaqvrsESuBPAILYw 4rVfZiEnuTNltHId8JEkgYogl7RJ0bbvpvnIaxHSYqJtfFKm1UvVc9pzkr5oPyJABjhb 92gG/Ri4p8NCFBJLMVZdmHMzBoplO94qPSFg6rlJczgqBqc9tHKwZ2o4WvAPxeamUkZN ctAw== X-Gm-Message-State: ALoCoQlVipdh/xHbr+gt94MeyNu90XUh6XN0oydrJstiYCC+2NSHGpyudxh7wewvxQ5Nvit17U+N X-Received: by 10.182.128.234 with SMTP id nr10mr1535013obb.0.1402326515223; Mon, 09 Jun 2014 08:08:35 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.37.164 with SMTP id r33ls1730285qgr.2.gmail; Mon, 09 Jun 2014 08:08:35 -0700 (PDT) X-Received: by 10.220.114.70 with SMTP id d6mr13274096vcq.5.1402326515005; Mon, 09 Jun 2014 08:08:35 -0700 (PDT) Received: from mail-vc0-f182.google.com (mail-vc0-f182.google.com [209.85.220.182]) by mx.google.com with ESMTPS id d8si11950906vdb.85.2014.06.09.08.08.34 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 09 Jun 2014 08:08:34 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; Received: by mail-vc0-f182.google.com with SMTP id il7so6521852vcb.27 for ; Mon, 09 Jun 2014 08:08:34 -0700 (PDT) X-Received: by 10.220.15.8 with SMTP id i8mr10234387vca.45.1402326514910; Mon, 09 Jun 2014 08:08:34 -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.221.54.6 with SMTP id vs6csp153028vcb; Mon, 9 Jun 2014 08:08:34 -0700 (PDT) X-Received: by 10.224.79.198 with SMTP id q6mr4897529qak.99.1402326514219; Mon, 09 Jun 2014 08:08:34 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id q109si23377194qgd.68.2014.06.09.08.08.34 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 09 Jun 2014 08:08:34 -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]:33697 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu1BZ-0003ye-PN for patch@linaro.org; Mon, 09 Jun 2014 11:08:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55223) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu119-00059t-CO for qemu-devel@nongnu.org; Mon, 09 Jun 2014 10:57:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wu118-0005i4-AV for qemu-devel@nongnu.org; Mon, 09 Jun 2014 10:57:47 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48572) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wu118-0005dP-4Q for qemu-devel@nongnu.org; Mon, 09 Jun 2014 10:57:46 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1Wu110-00069Q-3C for qemu-devel@nongnu.org; Mon, 09 Jun 2014 15:57:38 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 9 Jun 2014 15:57:19 +0100 Message-Id: <1402325858-23615-2-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1402325858-23615-1-git-send-email-peter.maydell@linaro.org> References: <1402325858-23615-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 01/20] 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: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.182 as permitted sender) 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 From: Grant Likely 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 [PMM: folded long line, removed stray \n from error message, use correct variable for printing image name, exit(1) rather than 0] Reviewed-by: Peter Crosthwaite Signed-off-by: Peter Maydell --- hw/arm/vexpress.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 33ff422..f311595 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,18 @@ static void vexpress_common_init(VEDBoardInfo *daughterboard, daughterboard->init(daughterboard, machine->ram_size, machine->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'", bios_name); + exit(1); + } + } + /* Motherboard peripherals: the wiring is the same but the * addresses vary between the legacy and A-Series memory maps. */