From nobody Wed Apr 16 16:08:18 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.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 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153476197776325.809560587694932; Mon, 20 Aug 2018 03:46:17 -0700 (PDT) Received: from localhost ([::1]:46097 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frhhM-0000FW-3F for importer@patchew.org; Mon, 20 Aug 2018 06:46:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37143) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1frhUI-0003tl-Ky for qemu-devel@nongnu.org; Mon, 20 Aug 2018 06:32:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1frhUH-0005av-NZ for qemu-devel@nongnu.org; Mon, 20 Aug 2018 06:32:42 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:44574) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1frhUH-0005Zs-AX for qemu-devel@nongnu.org; Mon, 20 Aug 2018 06:32:41 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1frhUG-0003Bn-1A for qemu-devel@nongnu.org; Mon, 20 Aug 2018 11:32:40 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 20 Aug 2018 11:32:04 +0100 Message-Id: <20180820103212.2810-18-peter.maydell@linaro.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180820103212.2810-1-peter.maydell@linaro.org> References: <20180820103212.2810-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: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 17/25] hw/timer/m48t59: Move away from old_mmio accessors 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Move the m48t59 device away from using old_mmio MemoryRegionOps accessors. Signed-off-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daud=C3=A9 Tested-by: Mark Cave-Ayland Message-id: 20180802180602.22047-1-peter.maydell@linaro.org --- hw/timer/m48t59.c | 59 +++++++++-------------------------------------- 1 file changed, 11 insertions(+), 48 deletions(-) diff --git a/hw/timer/m48t59.c b/hw/timer/m48t59.c index f2991762ab0..ca3ed445de7 100644 --- a/hw/timer/m48t59.c +++ b/hw/timer/m48t59.c @@ -493,66 +493,29 @@ static uint64_t NVRAM_readb(void *opaque, hwaddr addr= , unsigned size) return retval; } =20 -static void nvram_writeb (void *opaque, hwaddr addr, uint32_t value) -{ - M48t59State *NVRAM =3D opaque; - - m48t59_write(NVRAM, addr, value & 0xff); -} - -static void nvram_writew (void *opaque, hwaddr addr, uint32_t value) -{ - M48t59State *NVRAM =3D opaque; - - m48t59_write(NVRAM, addr, (value >> 8) & 0xff); - m48t59_write(NVRAM, addr + 1, value & 0xff); -} - -static void nvram_writel (void *opaque, hwaddr addr, uint32_t value) -{ - M48t59State *NVRAM =3D opaque; - - m48t59_write(NVRAM, addr, (value >> 24) & 0xff); - m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff); - m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff); - m48t59_write(NVRAM, addr + 3, value & 0xff); -} - -static uint32_t nvram_readb (void *opaque, hwaddr addr) +static uint64_t nvram_read(void *opaque, hwaddr addr, unsigned size) { M48t59State *NVRAM =3D opaque; =20 return m48t59_read(NVRAM, addr); } =20 -static uint32_t nvram_readw (void *opaque, hwaddr addr) +static void nvram_write(void *opaque, hwaddr addr, uint64_t value, + unsigned size) { M48t59State *NVRAM =3D opaque; - uint32_t retval; =20 - retval =3D m48t59_read(NVRAM, addr) << 8; - retval |=3D m48t59_read(NVRAM, addr + 1); - return retval; -} - -static uint32_t nvram_readl (void *opaque, hwaddr addr) -{ - M48t59State *NVRAM =3D opaque; - uint32_t retval; - - retval =3D m48t59_read(NVRAM, addr) << 24; - retval |=3D m48t59_read(NVRAM, addr + 1) << 16; - retval |=3D m48t59_read(NVRAM, addr + 2) << 8; - retval |=3D m48t59_read(NVRAM, addr + 3); - return retval; + return m48t59_write(NVRAM, addr, value); } =20 static const MemoryRegionOps nvram_ops =3D { - .old_mmio =3D { - .read =3D { nvram_readb, nvram_readw, nvram_readl, }, - .write =3D { nvram_writeb, nvram_writew, nvram_writel, }, - }, - .endianness =3D DEVICE_NATIVE_ENDIAN, + .read =3D nvram_read, + .write =3D nvram_write, + .impl.min_access_size =3D 1, + .impl.max_access_size =3D 1, + .valid.min_access_size =3D 1, + .valid.max_access_size =3D 4, + .endianness =3D DEVICE_BIG_ENDIAN, }; =20 static const VMStateDescription vmstate_m48t59 =3D { --=20 2.18.0