From nobody Fri May  9 17:02:18 2025
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=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1591376076; cv=none;
	d=zohomail.com; s=zohoarc;
	b=mSgEbNN9o65Qc4AqOU8afJTPZtW7Y3CENvQgnog0jqxRS1Fu4nAkFXC7dmN1J+oxvrrqFUhFHLHbYxIflZuvY6lZ9UBqTCxtIMTDgx3ypc3lEelSzFPDXx+BVIf6h4jmnP06icr+8kytqddvcNtPuUq9Iv8U7BCw3hYGPFPO1nA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1591376076;
 h=Content-Type:Content-Transfer-Encoding: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=cM/nenshJFdr/xOFmEA2BlgzqbESOdnacOqE/yTx7cc=;
	b=nvWiMII06fmnoOFOAETwkC97h+cbcO/5GbFwFYGhTN1Qwnc1k8wIqrAEUQEuEm/cpTQ26hnzVhHQ5wErpF09VXN3nxheawNGhcAeoAH8qEmPA6tggxKzvdCzY7vOOcc2rBw/WHKFX8f3ST3eGe0ZoczmsoxwqonKH0EA2cRn3Ik=
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=<peter.maydell@linaro.org> (p=none dis=none)
 header.from=<peter.maydell@linaro.org>
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1591376076977626.9991264023646;
 Fri, 5 Jun 2020 09:54:36 -0700 (PDT)
Received: from localhost ([::1]:38260 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1jhFc3-0001Ur-NX
	for importer@patchew.org; Fri, 05 Jun 2020 12:54:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:40530)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1jhFY1-0001Wb-1c
 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 12:50:25 -0400
Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:52495)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1jhFXz-0001fi-FB
 for qemu-devel@nongnu.org; Fri, 05 Jun 2020 12:50:24 -0400
Received: by mail-wm1-x341.google.com with SMTP id r9so9048251wmh.2
 for <qemu-devel@nongnu.org>; Fri, 05 Jun 2020 09:50:23 -0700 (PDT)
Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148])
 by smtp.gmail.com with ESMTPSA id c140sm12272724wmd.18.2020.06.05.09.50.20
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 05 Jun 2020 09:50:21 -0700 (PDT)
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=cM/nenshJFdr/xOFmEA2BlgzqbESOdnacOqE/yTx7cc=;
 b=HMIWoObQKqDqwtD4kVek/6HJj3mlAFwFTqg0umhwfKwz5KPwbVgK7HVDK4CCSUqPPI
 zvn4T57IW98INGNa17b2AREnP10oPB4BNBFJXvX8CYvMCrePBK0i+QMFM0VHUBFsWg0e
 G41F2A+Fkn7dVOogFXAP7TXgzQxEi23BpO26QiyvdT9xZBe5X5Q8QpEltJUlDd8KB1AL
 7Sigc1uICwjGivSmG6haQyYitvwZPghdL0MzhhUG2v36zrq/Ol/PTnoiNLEgd0Va2LEw
 NEbthbQKxK5sxNMTjgoclyh2KwKQqfGpAIyhfiiR5mJFZjlUCjfHiAD6AKdbYdC+E6CT
 UnDQ==
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=cM/nenshJFdr/xOFmEA2BlgzqbESOdnacOqE/yTx7cc=;
 b=n99oAKAuEX0K9nVPu2aMOhTc6VleNE6GO3Th3N1Nue2G684KlDLLL69tfRETjFsbF9
 ML7B5GR6i+LMlzu4Yx6uaMNxS5HH1LeEoSvt/RBNHXiS5hAgU98DxKx97hC1JdQmm6ht
 kUyZVJLpxQdRmMylFFzCXWV0MFRP1bgtcCt0UkG+urj8j8hSY4wcNwCmnfP3dzGDHqcX
 SHyHvCiDaTXWGhXno6VpNJEai9bu4NFMiVz8F3xlKeVADoON+kBKPQOncP53+ru9hBMI
 dy+YhfGOuPL4Id9V3B1XGk1rWIb00hxmwt55KVJLAKdyEkKV3LJlVKiLMHpZBG05sE4H
 fysQ==
X-Gm-Message-State: AOAM532FOAs7wt5+lFOHLswtVqt9aK+7qqyeTPI0C5ay98Bmv+TFUjQs
 dHwXbvIknz96QdMY9zzlkn+4kfFpgy5PJw==
X-Google-Smtp-Source: 
 ABdhPJykdUIU2pmojqyggMkI55Zbh9nPuR3lUwtKN4Sg70vpskB04kWwuaeUdUVTjsHKUQcUu54lNw==
X-Received: by 2002:a7b:c852:: with SMTP id c18mr3691831wml.77.1591375821845;
 Fri, 05 Jun 2020 09:50:21 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 11/29] hw/adc/stm32f2xx_adc: Correct memory region size and
 access size
Date: Fri,  5 Jun 2020 17:49:49 +0100
Message-Id: <20200605165007.12095-12-peter.maydell@linaro.org>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20200605165007.12095-1-peter.maydell@linaro.org>
References: <20200605165007.12095-1-peter.maydell@linaro.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
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=2a00:1450:4864:20::341;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x341.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: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, 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_PASS=-0.001,
 URIBL_BLOCKED=0.001 autolearn=_AUTOLEARN
X-Spam_action: no action
X-BeenThere: qemu-devel@nongnu.org
X-Mailman-Version: 2.1.23
Precedence: list
List-Id: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)

From: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>

The ADC region size is 256B, split as:
 - [0x00 - 0x4f] defined
 - [0x50 - 0xff] reserved

All registers are 32-bit (thus when the datasheet mentions the
last defined register is 0x4c, it means its address range is
0x4c .. 0x4f.

This model implementation is also 32-bit. Set MemoryRegionOps
'impl' fields.

See:
  'RM0033 Reference manual Rev 8', Table 10.13.18 "ADC register map".

Reported-by: Seth Kintigh <skintigh@gmail.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daud=C3=A9 <f4bug@amsat.org>
Message-id: 20200603055915.17678-1-f4bug@amsat.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 hw/adc/stm32f2xx_adc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/adc/stm32f2xx_adc.c b/hw/adc/stm32f2xx_adc.c
index 4f9d485ecf2..01a0b14e69d 100644
--- a/hw/adc/stm32f2xx_adc.c
+++ b/hw/adc/stm32f2xx_adc.c
@@ -246,6 +246,8 @@ static const MemoryRegionOps stm32f2xx_adc_ops =3D {
     .read =3D stm32f2xx_adc_read,
     .write =3D stm32f2xx_adc_write,
     .endianness =3D DEVICE_NATIVE_ENDIAN,
+    .impl.min_access_size =3D 4,
+    .impl.max_access_size =3D 4,
 };
=20
 static const VMStateDescription vmstate_stm32f2xx_adc =3D {
@@ -278,7 +280,7 @@ static void stm32f2xx_adc_init(Object *obj)
     sysbus_init_irq(SYS_BUS_DEVICE(obj), &s->irq);
=20
     memory_region_init_io(&s->mmio, obj, &stm32f2xx_adc_ops, s,
-                          TYPE_STM32F2XX_ADC, 0xFF);
+                          TYPE_STM32F2XX_ADC, 0x100);
     sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->mmio);
 }
=20
--=20
2.20.1