From patchwork Fri Jun 1 14:12:21 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 137530 Delivered-To: patches@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp991972lji; Fri, 1 Jun 2018 07:12:28 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKI0JdivcPUXfCH+aVGFgf9NS8QjbY6S4sngrI9u/uTwWMx+aFeaRl4thGtDbFchQ1zxYhI X-Received: by 2002:a1c:9ec2:: with SMTP id h185-v6mr2956344wme.68.1527862348015; Fri, 01 Jun 2018 07:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527862348; cv=none; d=google.com; s=arc-20160816; b=X9OPtjf76xa8PrsASSQ1h2N26Dv+xWA6FEgr/Y/h5TR2t0iIV2Y6t0W5pGkGCcEBSd bR4YLrLzr74enSKZz9NsP3x4yamwFFuL6qozdGj6gp0oeCvSs4iY2EUqBbJ3FJP7hF/i DN0TiE6iZR8p8fosdQUZKhK9TNVdESMEn4bFGrbf9MMk14YEP3HOXoj4SSEYIsdlPzJf Rp2m8IMZKrOZCi/9H89xh+H7QALeo3YgsAfVRTN8c3NvOTJfGq9Uab9aIVXVBs5U2xJ3 ZWcSx5itoc1ou4Pam3JIJfC1eNsR9KTjgPxYeT1yhstfbc80IA3oK+g0FpTIJxhT3Dig Nu+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=efv/44YN/WI64ZzTdEsBSzfL4nChTvmbkVXvhlNLho0=; b=Zi8UJkzgdzkAuEAJPWGPFjVD/pT7Ynkpy7ROxLGj9V42UhY1rBw8Gtv7HN8zCDz63b Er/N+rBv10WjuwdnA/RHrhjTjc6xfe5ufmjOb3u46szy/waVBcWICT+o9gD3YTP76Qa/ szypQO2mVGBx5Q5AWW5LWkmaaczoDdRWSTDw29VZpL2LKSpX/9XU9HecOLURKfQEqRzh NXSYggm1BotVYQAAL9B//uGwxG7yay84Fhqx6NPom+thf78ZlZh1MkTIFogJAv59d5qS TY2R3Zs5BRB3GvYLYDuhcpTk9Og8y+hD2BUq7aqWfW/ZNXNeRPA1VHCHgg0BjKvJ8zwI 46+Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id h9-v6si5643222wrp.127.2018.06.01.07.12.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Jun 2018 07:12:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fOkn5-000439-FE; Fri, 01 Jun 2018 15:12:27 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Kevin Wolf , Max Reitz , "Michael S. Tsirkin" , Paolo Bonzini , Thomas Huth , Aurelien Jarno , qemu-block@nongnu.org, Yongbok Kim Subject: [PATCH 4/6] hw/watchdog/wdt_i6300esb: Convert away from old_mmio Date: Fri, 1 Jun 2018 15:12:21 +0100 Message-Id: <20180601141223.26630-5-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180601141223.26630-1-peter.maydell@linaro.org> References: <20180601141223.26630-1-peter.maydell@linaro.org> Convert the wdt_i6300esb device away from using the old_mmio field of MemoryRegionOps. Signed-off-by: Peter Maydell --- hw/watchdog/wdt_i6300esb.c | 48 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c index e596b0804d..7b59469888 100644 --- a/hw/watchdog/wdt_i6300esb.c +++ b/hw/watchdog/wdt_i6300esb.c @@ -361,19 +361,43 @@ static void i6300esb_mem_writel(void *vp, hwaddr addr, uint32_t val) } } +static uint64_t i6300esb_mem_readfn(void *opaque, hwaddr addr, unsigned size) +{ + switch (size) { + case 1: + return i6300esb_mem_readb(opaque, addr); + case 2: + return i6300esb_mem_readw(opaque, addr); + case 4: + return i6300esb_mem_readl(opaque, addr); + default: + g_assert_not_reached(); + } +} + +static void i6300esb_mem_writefn(void *opaque, hwaddr addr, + uint64_t value, unsigned size) +{ + switch (size) { + case 1: + i6300esb_mem_writeb(opaque, addr, value); + break; + case 2: + i6300esb_mem_writew(opaque, addr, value); + break; + case 4: + i6300esb_mem_writel(opaque, addr, value); + break; + default: + g_assert_not_reached(); + } +} + static const MemoryRegionOps i6300esb_ops = { - .old_mmio = { - .read = { - i6300esb_mem_readb, - i6300esb_mem_readw, - i6300esb_mem_readl, - }, - .write = { - i6300esb_mem_writeb, - i6300esb_mem_writew, - i6300esb_mem_writel, - }, - }, + .read = i6300esb_mem_readfn, + .write = i6300esb_mem_writefn, + .valid.min_access_size = 1, + .valid.max_access_size = 4, .endianness = DEVICE_LITTLE_ENDIAN, };