From patchwork Thu Feb 13 14:41:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 183394 Delivered-To: patch@linaro.org Received: by 2002:a92:1f12:0:0:0:0:0 with SMTP id i18csp651644ile; Thu, 13 Feb 2020 07:20:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwrI7Gmrl7MfY76PQEBD2fANuZZeTqTwBOb60/xDl5Dl+lYtvwVOIn1WdKiptJiRKF99o2H X-Received: by 2002:a05:620a:676:: with SMTP id a22mr1310586qkh.429.1581607230370; Thu, 13 Feb 2020 07:20:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581607230; cv=none; d=google.com; s=arc-20160816; b=g/OMDa8q1MtbYWefmNXkfZWVy+Fs1C4XIgOaeumTET3n4XJ2GWlPgTObtL5SPW1oVV u2Gog5h/CnR71Mz1zu0O7Fc5Fi+iv+E3//cl5OYC3U3Cn7ECilvvGezkG3rY3iRA5VwD roTPaWaqtN3wfxmGd29v5jzcqwARJ13WpXJOat0YU8l/xb4E9GTDaEfuKVBk+ukzsfaF OIDjU/wYDEo3VYjonZ2oTWFsQxZaZyCyvt1Qvil0AA3p7uJal1b419EJozAYSPtMOvVe AeZWbWY7EA+TsrmgQtPnIq8MdTM9dhZ2Ep9HBvEjpX841UdSZzgE+bw9d6m0YTe4epyS dt1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=H2gaLGMf5euvRIXxKTQ5zYLvx8BCFxjRX5PrMkWbQvc=; b=X0AO94JWfUQ9LWppuhyQr8fl2Ke7WgFBuZHFN8Bu9MBwVljApwizVUIvyESAVRqHdj JAzxaDSbbNuJC8gn1NFAlZP4RlPtpWdXcdp5oG62mNeuKMAYoN/mu1cf/R8IWuhVvrtJ lYkICtK7sVLfcAdrc8WAjd/POXS5BfFjvjuyqxeF76u9Ts/w6uCrKv8lfn+V99neAk+d xosGb6yZA1PeGrheoBk57E+OvQxaOIcKmiGZ4ZRRTaoCTkHOgD4Ai64MDCgHgUW0xCe1 NqjTJw3QGG9qi8z9YK6rvn4hEqBSib+OrxOwa9aTl3hpMRlTOBcPbdoMw/reU6mXkB9u ZCUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SoKsJ7ZJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x16si1356951qta.188.2020.02.13.07.20.30 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Feb 2020 07:20:30 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SoKsJ7ZJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2GI1-0004L5-Ns for patch@linaro.org; Thu, 13 Feb 2020 10:20:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:60603) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j2FhP-0004qb-Gr for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:41 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j2FhN-0002QS-Tu for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:39 -0500 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]:53668) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1j2FhN-0002NB-LR for qemu-devel@nongnu.org; Thu, 13 Feb 2020 09:42:37 -0500 Received: by mail-wm1-x343.google.com with SMTP id s10so6542783wmh.3 for ; Thu, 13 Feb 2020 06:42:37 -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=H2gaLGMf5euvRIXxKTQ5zYLvx8BCFxjRX5PrMkWbQvc=; b=SoKsJ7ZJIlfsqCATGm3t1EyJ43/X+p7ji9LtUAQ6vmoETh2SBKYtjlK5U6Ij7ZAYfx pwLwnQOOb381oZjYW6zGU3B/cTRNJc+MWwKhqoKgbiOOd53LB8BoBwoe8A+9hpBgaUBi 0rzQE8mVni2rWBgCfkt2jUD6m76sK+ANDuxyhGMT+lUCFjS17kUS4B1ChSjkuPNnqmpZ P8SVL7LzSLTCamZUlqFv1k20dGYQSiae1+ySEsNOwORur9O6m6E06HmVV3eQaK1oIFcF D7Yl3/3sW68UYhdgx9te8rkyY/oUN/I4WW8WVIW/YyoqGRDXlRxQxqN4Ji9JrbQDB7Rb YfxQ== 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=H2gaLGMf5euvRIXxKTQ5zYLvx8BCFxjRX5PrMkWbQvc=; b=G3q2KJn2DOPvgcqb+W5rQ6bflmOiUj/Zn9VYQmFdIylzLo7Q50gKQUdE7vqQz+Pi4d CNE1m7RV2Ewpdbb2Rl1bJKjFU9+oYyYDyCBzKLHGNWm5A1LulvEwU+Qs8SFLpaEvIa0X Y9tFo7Y/2Qg3gXD/9QFtOBXULtPT8QtU223wUEHqFO7E4CYOeSmt/egSH6ZV6415HTb6 kHSysZXsvbPl8sh49fo5b1TlVavH7/wIUkcWc8VgX5MvuZqdSRvMoXTJ8oNxjck7L77N qRkvT9Jkmex7vqZZzHmKGaPdsyzdW/zoJmmBNGbv+UK5QCETG/QTCax68zqZ/JsB6VGZ V1/w== X-Gm-Message-State: APjAAAVYP9X4ev4sIf0ThwC+0KDcWxDUMHBBCVE53evAtLHhP7FwTino s9cHIGvPgR9D3rxrWyatCBDmgOo87IE= X-Received: by 2002:a1c:2786:: with SMTP id n128mr6010122wmn.47.1581604955432; 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.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Feb 2020 06:42:34 -0800 (PST) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 43/46] hw/arm/raspi: Extract the board model from the board revision Date: Thu, 13 Feb 2020 14:41:42 +0000 Message-Id: <20200213144145.818-44-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 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::343 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Philippe Mathieu-Daudé The board revision encode the model type. Add a helper to extract the model, and use it. Signed-off-by: Philippe Mathieu-Daudé Message-id: 20200208165645.15657-12-f4bug@amsat.org Reviewed-by: Peter Maydell Signed-off-by: Peter Maydell --- hw/arm/raspi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) -- 2.20.1 diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c index f0dcffbc2ef..0537fc0a2d1 100644 --- a/hw/arm/raspi.c +++ b/hw/arm/raspi.c @@ -101,6 +101,20 @@ static const char *board_soc_type(uint32_t board_rev) return soc_types[proc_id]; } +static const char *board_type(uint32_t board_rev) +{ + static const char *types[] = { + "A", "B", "A+", "B+", "2B", "Alpha", "CM1", NULL, "3B", "Zero", + "CM3", NULL, "Zero W", "3B+", "3A+", NULL, "CM3+", "4B", + }; + assert(FIELD_EX32(board_rev, REV_CODE, STYLE)); /* Only new style */ + int bt = FIELD_EX32(board_rev, REV_CODE, TYPE); + if (bt >= ARRAY_SIZE(types) || !types[bt]) { + return "Unknown"; + } + return types[bt]; +} + static void write_smpboot(ARMCPU *cpu, const struct arm_boot_info *info) { static const uint32_t smpboot[] = { @@ -287,7 +301,7 @@ static void raspi2_machine_class_init(ObjectClass *oc, void *data) uint32_t board_rev = (uint32_t)(uintptr_t)data; rmc->board_rev = board_rev; - mc->desc = "Raspberry Pi 2B"; + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1; @@ -308,7 +322,7 @@ static void raspi3_machine_class_init(ObjectClass *oc, void *data) uint32_t board_rev = (uint32_t)(uintptr_t)data; rmc->board_rev = board_rev; - mc->desc = "Raspberry Pi 3B"; + mc->desc = g_strdup_printf("Raspberry Pi %s", board_type(board_rev)); mc->init = raspi_machine_init; mc->block_default_type = IF_SD; mc->no_parallel = 1;