From nobody Mon Feb 9 22:38:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=reject dis=none) header.from=google.com ARC-Seal: i=1; a=rsa-sha256; t=1594966322; cv=none; d=zohomail.com; s=zohoarc; b=CWe0kmVNwkAxYoYSDwrlWBSonrvno1bMzPsC88mF+ZerL2oop/nxjeM0iVRGy39zGPtcc37o18+BAtrXn/ZXscIVw76d7VFwEKxuuFUsBofzqOrzyOAQ6iUdI3FDie60QEToXvnKW5f8pNmKYZnZjN9jEBEgNkxYqRSpmrPpT0Q= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594966322; h=Content-Type:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=frc86mILmkHC+wqWcKw1PPJTa/OZk2Y3JpwlzSnJqMM=; b=Z+7aLwZm0OXyPasmF3nhuQ2dkN5CKuU8ikQHAIO/JU5b+iUdDiOl1zUoXqznaXJsBv59JCafaZUPp/G5IvViQ4hXZF0HjlMBMuWNtN247fTjXInXj8vi5QplnK0NBLtlleXMzRR0EE6/xqLrWmX6fH5Tuc5bnUtl1Q9XSofJXgQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=reject dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1594966322490933.3963123882437; Thu, 16 Jul 2020 23:12:02 -0700 (PDT) Received: from localhost ([::1]:36690 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jwJbF-0000iE-86 for importer@patchew.org; Fri, 17 Jul 2020 02:12:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60138) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <3LT8RXwsKCu4XiaYddUceUdWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--hskinnemoen.bounces.google.com>) id 1jwJSy-0003i4-LD for qemu-devel@nongnu.org; Fri, 17 Jul 2020 02:03:28 -0400 Received: from mail-pg1-x549.google.com ([2607:f8b0:4864:20::549]:37628) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <3LT8RXwsKCu4XiaYddUceUdWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--hskinnemoen.bounces.google.com>) id 1jwJSx-0005HE-1w for qemu-devel@nongnu.org; Fri, 17 Jul 2020 02:03:28 -0400 Received: by mail-pg1-x549.google.com with SMTP id h5so7200291pgq.4 for ; Thu, 16 Jul 2020 23:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=frc86mILmkHC+wqWcKw1PPJTa/OZk2Y3JpwlzSnJqMM=; b=T1puZXUBXlcMoWFROgqScO4xHSDWK+e87YnMYExRLrvuOElQ1MiJjWpRy9oWD00nYY e3TtVfyQq0btj5BpL9h1tTV1DmZzVGXo9203v9qOB8TJZ8rnGPebuQLb2Kk3p134Q6Z1 ZmsxSzqlv6g77zysQCmoNU1qW9aPtyot4Z5ZFzJIC2wiyhORxU4jnnt6c1st8jaLuL/p qm1icrFywU5nfUrMZoYzntgvNw/wnDQ3OqMEDzikN0XG/+w5u+Su/Gq/XUJSkHUcgu+9 Gyc8suo9S5Ld6gjeKt+tV/4vdUZFNmRF8dXZ2bJk3n5snZVsiasvCeL874XauV1DyrYk lVfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=frc86mILmkHC+wqWcKw1PPJTa/OZk2Y3JpwlzSnJqMM=; b=BM3TItZxBLBSlXq7NQP9gDkAVBza+illoWn6sfkrUh2RemviqNcWxoZD12Lwr7Fkq3 Gm9pAwXx5I/2BYSxqHAlhrKXl076EXYARXtxjN1dTgnElnmC1F+Bk4LQ3+7nIAAJFHYk F8q62+WcfFHPLYbRNdOUWraa4yts49lRrlEHU1x1eCtDf2U50YYFNOGMYmoi0c+iZkZR h22ukT+5+2P73hNtonzR6n+KMWWZir1pVNm0fRKMznG7GPSHnCq0kWu1BJqI8Kqnza3N 9LOPXybW3foeeM3mryp5kNFKU3EouFXjBC0b7qbcSYp7Bfv4vkTE7MeaKtQmgnLhjfwo eTFg== X-Gm-Message-State: AOAM532Hp8SU2YvfCJ3N1jCoqF6ABiJtz6+MO6tz9IBzpyXgcu7RxO7a HZa4u1s5tYRjoWZ3WkieDE1zmyEWvjZMKYAkgQkKaIMFcA3quJAT5RrheefmiwxKDdJD06KDRoc 1gutfhXR3dUOSqXt85MnUY+LlesAZfUkhiKTMlfh/ODdjZHQDAoD5EQqoRFmGRR2xOYeP7DS6Dg == X-Google-Smtp-Source: ABdhPJyJcR0Nj1CMZAmFs/XMLczYOutOsMaasTMgPmxSpuR2lkPCg9vekBOeG1LGukIOwTfdWFEyVZYMrSP7UwdQcg== X-Received: by 2002:a17:90b:194f:: with SMTP id nk15mr8495696pjb.189.1594965805094; Thu, 16 Jul 2020 23:03:25 -0700 (PDT) Date: Thu, 16 Jul 2020 23:02:52 -0700 In-Reply-To: <20200717060258.1602319-1-hskinnemoen@google.com> Message-Id: <20200717060258.1602319-8-hskinnemoen@google.com> Mime-Version: 1.0 References: <20200717060258.1602319-1-hskinnemoen@google.com> X-Mailer: git-send-email 2.28.0.rc0.105.gf9edc3c819-goog Subject: [PATCH v6 07/13] hw/arm: Load -bios image as a boot ROM for npcm7xx From: Havard Skinnemoen To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Cc: Avi.Fishman@nuvoton.com, kfting@nuvoton.com, Havard Skinnemoen Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::549; envelope-from=3LT8RXwsKCu4XiaYddUceUdWeeWbU.SecgUck-TUlUbdedWdk.ehW@flex--hskinnemoen.bounces.google.com; helo=mail-pg1-x549.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -105 X-Spam_score: -10.6 X-Spam_bar: ---------- X-Spam_report: (-10.6 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, USER_IN_DEF_DKIM_WL=-7.5 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @google.com) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" If a -bios option is specified on the command line, load the image into the internal ROM memory region, which contains the first instructions run by the CPU after reset. If -bios is not specified, the vbootrom included with qemu is loaded by default. Reviewed-by: Tyrone Ting Signed-off-by: Havard Skinnemoen Reviewed-by: C=C3=A9dric Le Goater --- hw/arm/npcm7xx_boards.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c index 0b9dce2b35..f32557e0e1 100644 --- a/hw/arm/npcm7xx_boards.c +++ b/hw/arm/npcm7xx_boards.c @@ -18,12 +18,41 @@ =20 #include "hw/arm/npcm7xx.h" #include "hw/core/cpu.h" +#include "hw/loader.h" #include "qapi/error.h" +#include "qemu-common.h" #include "qemu/units.h" +#include "sysemu/sysemu.h" =20 #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7 #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff =20 +static const char npcm7xx_default_bootrom[] =3D "npcm7xx_bootrom.bin"; + +static void npcm7xx_load_bootrom(NPCM7xxState *soc) +{ + g_autofree char *filename =3D NULL; + const char *bootrom; + int ret; + + if (bios_name) { + bootrom =3D bios_name; + } else { + bootrom =3D npcm7xx_default_bootrom; + } + + filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bootrom); + if (!filename) { + error_report("Could not find ROM image '%s'", bootrom); + exit(1); + } + ret =3D load_image_mr(filename, &soc->irom); + if (ret < 0) { + error_report("Failed to load ROM image '%s'", filename); + exit(1); + } +} + static void npcm7xx_connect_dram(NPCM7xxState *soc, MemoryRegion *dram) { memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, dram= ); @@ -60,6 +89,7 @@ static void npcm750_evb_init(MachineState *machine) npcm7xx_connect_dram(soc, machine->ram); qdev_realize(DEVICE(soc), NULL, &error_fatal); =20 + npcm7xx_load_bootrom(soc); npcm7xx_load_kernel(machine, soc); } =20 @@ -71,6 +101,7 @@ static void quanta_gsj_init(MachineState *machine) npcm7xx_connect_dram(soc, machine->ram); qdev_realize(DEVICE(soc), NULL, &error_fatal); =20 + npcm7xx_load_bootrom(soc); npcm7xx_load_kernel(machine, soc); } =20 --=20 2.28.0.rc0.105.gf9edc3c819-goog