From patchwork Mon Jan 23 21:21:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artyom Tarasenko X-Patchwork-Id: 9533519 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 0A8096042D for ; Mon, 23 Jan 2017 21:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E58F0283E1 for ; Mon, 23 Jan 2017 21:23:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C657E2841D; Mon, 23 Jan 2017 21:23:02 +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 4B329283E1 for ; Mon, 23 Jan 2017 21:23:02 +0000 (UTC) Received: from localhost ([::1]:44499 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVm4q-0006h8-PM for patchwork-qemu-devel@patchwork.kernel.org; Mon, 23 Jan 2017 16:23:00 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58806) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVm47-0006Mj-A8 for qemu-devel@nongnu.org; Mon, 23 Jan 2017 16:22:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVm43-0007QD-Ag for qemu-devel@nongnu.org; Mon, 23 Jan 2017 16:22:15 -0500 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:36347) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cVm43-0007Q9-4e for qemu-devel@nongnu.org; Mon, 23 Jan 2017 16:22:11 -0500 Received: by mail-wm0-x242.google.com with SMTP id r126so29481829wmr.3 for ; Mon, 23 Jan 2017 13:22:11 -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; bh=xVd81PKonVyWk46fmA56Z5IxWXpm5bVfNXHB6qFuSXc=; b=SZlqRnzYyj0evsj/M4WUlS/zJenhYEsXvWTs4cTj+O6EPadRX9TKF5Z0w473KkWe4y Fr7VEgrn3uAbKGu3AtKvHTSWjYRH3K6t5IyFIWfBCilMaGl0TS73tjCqD1FLC1Q8tr/k NZckNQrvWqYi8NLwcQLakZj5WRCOfDkQnzsjzAgm/rKRku3Lkt/4UXpo5U2pPRCB8krt /bVJMPyidPPLe+zkEsL3R4RxRVTqWRgdSdSTCBFDayQR9e+2HEMxTniQu29OQ0qqBmk2 rdHR9SOlaor+4bYtRwRuKn+yunFatZvUYCbsY71ZYMLX41+qfW4cDa/gcMjvZwEQxmfv zXFg== 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; bh=xVd81PKonVyWk46fmA56Z5IxWXpm5bVfNXHB6qFuSXc=; b=Kj381W+7ZE7e654JOIw6JwjmlDKVNMvpqV4cDuUKsfxvWy5XVEJf6slKXb/IXWLXHj 0ZzAsKaljQ/Ve6tzLPIbImXKK+QGhmDaOKzP1vE/NIdP2SAkN9IyV7eKwDA+zfHEdqVo xQmGtycmxGlWYczi4V1Pb093mROoV7vpqy1tPjlEkwWZmkWma5BR5cKhmljVjLhC809T 8jygY8cMdkK9n5gkBKc1blT72F00ulf+eLCw/a5uWsiK1MMsd5+3eCdciK5xE4aNySUw r/yOp3rtCI/uREGdOHlB8cPLDXqPOpPP/7dZ+NR7b2GSYbNJEOGTn4sUXQ4S3vNlrnkY Cc2A== X-Gm-Message-State: AIkVDXLsGisVgk9MGqYpp2nMGKcLo0/6tVFvCLbALD11q3yxDwx4rCpP9cx2AbWzpoAFdw== X-Received: by 10.223.166.106 with SMTP id k97mr26272520wrc.170.1485206530059; Mon, 23 Jan 2017 13:22:10 -0800 (PST) Received: from localhost (x55b4d8ad.dyn.telefonica.de. [85.180.216.173]) by smtp.gmail.com with ESMTPSA id m78sm23060173wmd.8.2017.01.23.13.22.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Jan 2017 13:22:09 -0800 (PST) From: Artyom Tarasenko To: qemu-devel@nongnu.org Date: Mon, 23 Jan 2017 22:21:58 +0100 Message-Id: <1485206518-32403-1-git-send-email-atar4qemu@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::242 Subject: [Qemu-devel] [PATCH 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 Suggested-by: Peter Maydell Signed-off-by: Artyom Tarasenko --- hw/sparc64/niagara.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c index b55d4bb..e945b5a 100644 --- a/hw/sparc64/niagara.c +++ b/hw/sparc64/niagara.c @@ -35,6 +35,7 @@ #include "hw/timer/sun4v-rtc.h" #include "exec/address-spaces.h" #include "sysemu/block-backend.h" +#include "qemu/error-report.h" typedef struct NiagaraBoardState { @@ -85,6 +86,14 @@ 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) +{ + if (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 +128,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 */