From patchwork Sun Feb 26 22:29:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9592445 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A166A6042B for ; Sun, 26 Feb 2017 22:30:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92ABE283C2 for ; Sun, 26 Feb 2017 22:30:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86B27283FB; Sun, 26 Feb 2017 22:30:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0F852283C2 for ; Sun, 26 Feb 2017 22:30:56 +0000 (UTC) Received: from localhost ([::1]:48699 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci7LD-00088x-MD for patchwork-qemu-devel@patchwork.kernel.org; Sun, 26 Feb 2017 17:30:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48946) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ci7Kp-00087m-JY for qemu-devel@nongnu.org; Sun, 26 Feb 2017 17:30:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ci7Km-0000AP-EM for qemu-devel@nongnu.org; Sun, 26 Feb 2017 17:30:31 -0500 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]:33795) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ci7Km-0000AI-89 for qemu-devel@nongnu.org; Sun, 26 Feb 2017 17:30:28 -0500 Received: by mail-wr0-x242.google.com with SMTP id m5so2456310wrm.1 for ; Sun, 26 Feb 2017 14:30:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=bGyIPHxF87zcFSkDi97RpSc3uzZ1nbqiUwgBOIi+NYY=; b=thTETyXqcUAQRJQ4G2mTg3UdOe5vFe+bFmTlKx0x4wBEy/aT60tSDOeEw7/ueT3dQL aWd3IWmNd1Pw0o1NUhdgrah9OeSCMZh3OJ5aivxsWlC1KDqHzK58mFq1z7wsgs34V8CB F4vGWAXoOeM2TtAzPZoyoDdnb3IZinXSt+71cTlZjXurh7/Fe45otMpjzy/0AXaFMqtx 4PjaZ5FGBk07IRht3YsXPlsSlSuPArPilw2na/ufGCWjV/HvNsW5e6JL7/7G/ZCDa+Om 9NlBSHSBle8X/lsIp45obPt8nW4dZ3y33gnNIsjg4lWuGEhfDDzzZqds/a7UWKbUxKIQ D9Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=bGyIPHxF87zcFSkDi97RpSc3uzZ1nbqiUwgBOIi+NYY=; b=lfyvTFLkEaMwpoG4at+eIzLpEi97hy2IEexIHWoLLjx5w1AyCysLAhNL5v796ZU8pJ bQY5Wej0694/ujXB9q+3H7k/h1L44o6LZT3kDGoHRnMC99SOGGupNZCIKAVw58ZZBMHW pWzc4fcnfk1xQB2KP4LUmb3UXUXgVJ+GZAlRmpkjuIYwU2LXkkm0c6bVrYU13dEMUZga REYGQ2c2jTI04SIDOdWbLj+uXw+RE/YW9MuhD200fVf63Z432N2dJhXVu7bHKNEavgtx yN+qaiSno1isbqPC2VgmV6KEkL3n2ZvqIVRAWqQcorxoONId9GBESBOuoYA0Yr6vAxT1 O2/w== X-Gm-Message-State: AMke39mLhb6F9Apn1EiqXqMOisLfpUqeqShxTMMLZ6f4LNc5Ko/UGGIYXQV8HKhQAXBo8Q== X-Received: by 10.223.162.18 with SMTP id p18mr11579501wra.7.1488148227329; Sun, 26 Feb 2017 14:30:27 -0800 (PST) Received: from localhost (x55b4d024.dyn.telefonica.de. [85.180.208.36]) by smtp.gmail.com with ESMTPSA id v1sm3785821wra.65.2017.02.26.14.30.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 Feb 2017 14:30:26 -0800 (PST) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Sun, 26 Feb 2017 23:29:15 +0100 Message-Id: <1488148156-2036-2-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1488148156-2036-1-git-send-email-atar4qemu@gmail.com> References: <1488148156-2036-1-git-send-email-atar4qemu@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c0c::242 Subject: [Qemu-devel] [PULL 1/2] niagara: fail if a firmware file is missing X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, Artyom Tarasenko Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP fail if a firmware file is missing and not qtest_enabled(), the later is necessary to allow some basic tests if firmware is not available Suggested-by: Peter Maydell Signed-off-by: Artyom Tarasenko --- hw/sparc64/niagara.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index b55d4bb..edde86e 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -35,6 +35,8 @@ #include "hw/timer/sun4v-rtc.h" #include "exec/address-spaces.h" #include "sysemu/block-backend.h" +#include "qemu/error-report.h" +#include "sysemu/qtest.h" typedef struct NiagaraBoardState { @@ -85,6 +87,17 @@ typedef struct NiagaraBoardState { #define NIAGARA_OBP_OFFSET 0x80000ULL #define PROM_SIZE_MAX (4 * 1024 * 1024) +static void add_rom_or_fail(const char *file, const hwaddr addr) +{ + /* XXX remove qtest_enabled() check once firmware files are + * in the qemu tree + */ + if (!qtest_enabled() && rom_add_file_fixed(file, addr, -1)) { + error_report("Unable to load a firmware for -M niagara"); + exit(1); + } + +} /* Niagara hardware initialisation */ static void niagara_init(MachineState *machine) { @@ -119,14 +132,13 @@ static void niagara_init(MachineState *machine) "sun4v.prom", PROM_SIZE_MAX); memory_region_add_subregion(sysmem, NIAGARA_PROM_BASE, &s->prom); - rom_add_file_fixed("nvram1", NIAGARA_NVRAM_BASE, -1); - rom_add_file_fixed("1up-md.bin", NIAGARA_MD_ROM_BASE, -1); - rom_add_file_fixed("1up-hv.bin", NIAGARA_HV_ROM_BASE, -1); + add_rom_or_fail("nvram1", NIAGARA_NVRAM_BASE); + add_rom_or_fail("1up-md.bin", NIAGARA_MD_ROM_BASE); + add_rom_or_fail("1up-hv.bin", NIAGARA_HV_ROM_BASE); - rom_add_file_fixed("reset.bin", NIAGARA_PROM_BASE, -1); - rom_add_file_fixed("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET, -1); - rom_add_file_fixed("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET, - -1); + add_rom_or_fail("reset.bin", NIAGARA_PROM_BASE); + add_rom_or_fail("q.bin", NIAGARA_PROM_BASE + NIAGARA_Q_OFFSET); + add_rom_or_fail("openboot.bin", NIAGARA_PROM_BASE + NIAGARA_OBP_OFFSET); /* the virtual ramdisk is kind of initrd, but it resides outside of the partition RAM */