From nobody Sun Nov 9 16:03:51 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.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; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551210024573922.0654030861868; Tue, 26 Feb 2019 11:40:24 -0800 (PST) Received: from localhost ([127.0.0.1]:60280 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyiaS-0006MM-Jc for importer@patchew.org; Tue, 26 Feb 2019 14:40:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46390) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gyiVL-0002cP-So for qemu-devel@nongnu.org; Tue, 26 Feb 2019 14:35:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gyiV8-0006dj-8r for qemu-devel@nongnu.org; Tue, 26 Feb 2019 14:34:54 -0500 Received: from mx1.redhat.com ([209.132.183.28]:34868) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gyiUy-0006CE-Fu; Tue, 26 Feb 2019 14:34:42 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8AE8189AC6; Tue, 26 Feb 2019 19:34:26 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-92.ams2.redhat.com [10.36.116.92]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5454419C71; Tue, 26 Feb 2019 19:34:25 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 28759113303F; Tue, 26 Feb 2019 20:34:08 +0100 (CET) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Tue, 26 Feb 2019 20:34:05 +0100 Message-Id: <20190226193408.23862-9-armbru@redhat.com> In-Reply-To: <20190226193408.23862-1-armbru@redhat.com> References: <20190226193408.23862-1-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 26 Feb 2019 19:34:26 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 08/11] r2d: Flash memory creation is confused about size, mark FIXME 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: kwolf@redhat.com, qemu-block@nongnu.org, alex.bennee@linaro.org, Magnus Damm , mreitz@redhat.com, qemu-ppc@nongnu.org, lersek@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" pflash_cfi02_register() takes a size in bytes, a block size in bytes and a number of blocks. r2d_init() passes FLASH_SIZE, 16 * KiB, FLASH_SIZE >> 16. Does not compute: size doesn't match block size * number of blocks. The latter happens to win. I tried to find documentation on the physical hardware, no luck. For now, adjust the byte size passed to match the actual size created, and add a FIXME comment. Cc: Magnus Damm Signed-off-by: Markus Armbruster --- hw/sh4/r2d.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/sh4/r2d.c b/hw/sh4/r2d.c index dcdb3728cb..ed18d1f351 100644 --- a/hw/sh4/r2d.c +++ b/hw/sh4/r2d.c @@ -290,7 +290,14 @@ static void r2d_init(MachineState *machine) =20 /* onboard flash memory */ dinfo =3D drive_get(IF_PFLASH, 0, 0); - pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE, + /* + * FIXME The code is confused about the size of the flash. It + * used to pass FLASH_SIZE bytes, in FLASH_SIZE >> 16 blocks of + * 16KiB each, which does not compute, but creates one of + * FLASH_SIZE / 4 bytes anyway. The current code does so too, but + * whether it's the right size is anybody's guess. + */ + pflash_cfi02_register(0x0, NULL, "r2d.flash", FLASH_SIZE / 4, dinfo ? blk_by_legacy_dinfo(dinfo) : NULL, 16 * KiB, FLASH_SIZE >> 16, 1, 4, 0x0000, 0x0000, 0x0000, 0x0000, --=20 2.17.2