From nobody Tue Apr 15 12:31:55 2025 Delivered-To: importer@patchew.org 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; 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=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1581607291471987.8103721894709; Thu, 13 Feb 2020 07:21:31 -0800 (PST) Received: from localhost ([::1]:54328 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2G8Q-00078U-SE for importer@patchew.org; Thu, 13 Feb 2020 10:10:34 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60535) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2FhO-0004mm-74 for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2FhN-0002Oi-1N for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:38 -0500 Received: from mail-wm1-x344.google.com ([2a00:1450:4864:20::344]:51731) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2FhM-0002Jr-Qo for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:36 -0500 Received: by mail-wm1-x344.google.com with SMTP id t23so6545453wmi.1 for ; Thu, 13 Feb 2020 06:42:35 -0800 (PST) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id e22sm3362454wme.45.2020.02.13.06.42.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 06:42:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=GWz1pjVoz6EtEwxuWeaelwOEmy5EO8eEws/ey/K03f8=; b=BhmP95Exm/gK6DIhdwZvHR2w/qXWOLQX6K1tO4UzwadBpAEOX6iZjrIr4We4QPyzav XeiOY7BCkxyr00YSJilvGDmnE25aX5KN5kq5ezQ5n+kcz0ivD2hk5/26w5hyOAX8g+3s Nu1kCvHqIHD5GY3VTqObTGf/A6gXZurBxxwXjAJBgjOPTx9Lr5qGgdRQBHpUCf76dRhn k6NtpmPwTezQjIlFhfMyDn+DDj4OAAu2cTkWz+DifJm8T+DAbMDcuWbdKwqdGU3lSMx0 9XqClUUONZjdi+nSGBl0Kd0viV/G3sK4rOC3GNn6ziqy/aL0b7ZRkANt3e5pLLLP1D8v 4D/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=GWz1pjVoz6EtEwxuWeaelwOEmy5EO8eEws/ey/K03f8=; b=eomcmT/0j+jy8mfej+g/2sHexm/gckMZiP5atyp4zPJeCbKHKi9MQy1KkEWZI0PcWi ymmN+8mD/ESGSWx1q9Fu3eHLEU0lH4h/8++6tUwDL35xY+bxtwZbiRx5zec2x0mzdzrE PeHgL3rsPbOeIp+jDQu6Mt3TyylIvjiHhyNMEBv4bEoozTpbpMN+xTPUDvMmLm/pOZBZ 78URAzJjpdqAx2iMej35Hg7tuolbBD9cxAx5JAm6Daki6fbVnvCgT9/4A4ss0hMR9P5W 5ifLXCHlfzrAICgj8QMu9zml3s6teblaqPsB3CT5GRP5vUj+RvQZeM7h1o0wBAFJ83jA yo2g== X-Gm-Message-State: APjAAAXbtGY5hxbXQVbLXYUAFoc/zPqY2F+AkwNM9vnqr/o0ApNTspVx OmNc16JsBQtLxcevqKsL6f5yFX6s1zM= X-Google-Smtp-Source: APXvYqxZlRYvB5OlqBUmfdFnmCVMqixBq/pjTIZEgq+x+O5IsGATa3zecZpTB3Fmly7voxqV9wdUgw== X-Received: by 2002:a05:600c:22d3:: with SMTP id 19mr6111153wmg.20.1581604949515; Thu, 13 Feb 2020 06:42:29 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 37/46] hw/arm/raspi: Extract the processor type from the board revision Date: Thu, 13 Feb 2020 14:41:36 +0000 Message-Id: <20200213144145.818-38-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200213144145.818-1-peter.maydell@linaro.org> References: <20200213144145.818-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::344 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 @linaro.org) From: Philippe Mathieu-Daud=C3=A9 The board revision encode the processor type. Add a helper to extract the type, and use it. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Message-id: 20200208165645.15657-6-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/raspi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index dcd8d2d6d38..7a2ca97347e 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -67,6 +67,21 @@ static int board_version(uint32_t board_rev) return board_processor_id(board_rev) + 1; } =20 +static const char *board_soc_type(uint32_t board_rev) +{ + static const char *soc_types[] =3D { + NULL, TYPE_BCM2836, TYPE_BCM2837, + }; + int proc_id =3D board_processor_id(board_rev); + + if (proc_id >=3D ARRAY_SIZE(soc_types) || !soc_types[proc_id]) { + error_report("Unsupported processor id '%d' (board revision: 0x%x)= ", + proc_id, board_rev); + exit(1); + } + return soc_types[proc_id]; +} + static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] =3D { @@ -213,8 +228,7 @@ static void raspi_init(MachineState *machine, uint32_t = board_rev) } =20 object_initialize_child(OBJECT(machine), "soc", &s->soc, sizeof(s->soc= ), - version =3D=3D 3 ? TYPE_BCM2837 : TYPE_BCM2836, - &error_abort, NULL); + board_soc_type(board_rev), &error_abort, NULL); =20 /* Allocate and map RAM */ memory_region_allocate_system_memory(&s->ram, OBJECT(machine), "ram", --=20 2.20.1