From: Alexander Graf <agraf@suse.de>
To: qemu-devel qemu-devel <qemu-devel@nongnu.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
xen-devel@lists.xensource.com,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>,
"qemu-ppc@nongnu.org List" <qemu-ppc@nongnu.org>,
Avi Kivity <avi@redhat.com>, Scott Wood <scottwood@freescale.com>,
malc <av1474@comtv.ru>,
David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 09/14] rtl8139: convert PIO to new memory api read/write
Date: Mon, 8 Oct 2012 14:23:48 +0200 [thread overview]
Message-ID: <1349699033-6703-10-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1349699033-6703-1-git-send-email-agraf@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
---
hw/rtl8139.c | 78 ++++++++++++++++++++++++++-------------------------------
1 files changed, 36 insertions(+), 42 deletions(-)
diff --git a/hw/rtl8139.c b/hw/rtl8139.c
index b7c82ee..6be6883 100644
--- a/hw/rtl8139.c
+++ b/hw/rtl8139.c
@@ -3186,38 +3186,6 @@ static uint32_t rtl8139_io_readl(void *opaque, uint8_t addr)
/* */
-static void rtl8139_ioport_writeb(void *opaque, uint32_t addr, uint32_t val)
-{
- rtl8139_io_writeb(opaque, addr & 0xFF, val);
-}
-
-static void rtl8139_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
-{
- rtl8139_io_writew(opaque, addr & 0xFF, val);
-}
-
-static void rtl8139_ioport_writel(void *opaque, uint32_t addr, uint32_t val)
-{
- rtl8139_io_writel(opaque, addr & 0xFF, val);
-}
-
-static uint32_t rtl8139_ioport_readb(void *opaque, uint32_t addr)
-{
- return rtl8139_io_readb(opaque, addr & 0xFF);
-}
-
-static uint32_t rtl8139_ioport_readw(void *opaque, uint32_t addr)
-{
- return rtl8139_io_readw(opaque, addr & 0xFF);
-}
-
-static uint32_t rtl8139_ioport_readl(void *opaque, uint32_t addr)
-{
- return rtl8139_io_readl(opaque, addr & 0xFF);
-}
-
-/* */
-
static void rtl8139_mmio_writeb(void *opaque, target_phys_addr_t addr, uint32_t val)
{
rtl8139_io_writeb(opaque, addr & 0xFF, val);
@@ -3381,18 +3349,44 @@ static const VMStateDescription vmstate_rtl8139 = {
/***********************************************************/
/* PCI RTL8139 definitions */
-static const MemoryRegionPortio rtl8139_portio[] = {
- { 0, 0x100, 1, .read = rtl8139_ioport_readb, },
- { 0, 0x100, 1, .write = rtl8139_ioport_writeb, },
- { 0, 0x100, 2, .read = rtl8139_ioport_readw, },
- { 0, 0x100, 2, .write = rtl8139_ioport_writew, },
- { 0, 0x100, 4, .read = rtl8139_ioport_readl, },
- { 0, 0x100, 4, .write = rtl8139_ioport_writel, },
- PORTIO_END_OF_LIST()
-};
+static void rtl8139_ioport_write(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned size)
+{
+ switch (size) {
+ case 1:
+ rtl8139_io_writeb(opaque, addr, val);
+ break;
+ case 2:
+ rtl8139_io_writew(opaque, addr, val);
+ break;
+ case 4:
+ rtl8139_io_writel(opaque, addr, val);
+ break;
+ }
+}
+
+static uint64_t rtl8139_ioport_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
+{
+ switch (size) {
+ case 1:
+ return rtl8139_io_readb(opaque, addr);
+ case 2:
+ return rtl8139_io_readw(opaque, addr);
+ case 4:
+ return rtl8139_io_readl(opaque, addr);
+ }
+
+ return -1;
+}
static const MemoryRegionOps rtl8139_io_ops = {
- .old_portio = rtl8139_portio,
+ .read = rtl8139_ioport_read,
+ .write = rtl8139_ioport_write,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 4,
+ },
.endianness = DEVICE_LITTLE_ENDIAN,
};
--
1.6.0.2
next prev parent reply other threads:[~2012-10-08 12:23 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 12:23 [PATCH 00/14] Remove old_portio users for memory region PIO mapping Alexander Graf
2012-10-08 12:23 ` [PATCH 01/14] ac97: convert PIO to new memory api read/write Alexander Graf
2012-10-08 12:23 ` [PATCH 02/14] virtio-pci: " Alexander Graf
2012-10-08 12:23 ` [PATCH 03/14] es1370: " Alexander Graf
2012-10-08 12:23 ` [PATCH 04/14] i8254: " Alexander Graf
2012-10-08 12:23 ` [PATCH 05/14] m48t59: " Alexander Graf
2012-10-08 12:23 ` [PATCH 06/14] mc146818rtc: " Alexander Graf
2012-10-08 12:23 ` [PATCH 07/14] pc port92: " Alexander Graf
2012-10-08 12:23 ` [PATCH 08/14] pckbd: " Alexander Graf
2012-10-08 12:23 ` Alexander Graf [this message]
2012-10-08 12:23 ` [PATCH 10/14] serial: " Alexander Graf
2012-10-08 12:23 ` [PATCH 11/14] vmport: " Alexander Graf
2012-10-08 12:23 ` [PATCH 12/14] xen_platform: " Alexander Graf
2012-10-08 12:23 ` [PATCH 13/14] PPC: e500: Map PIO space into core memory region Alexander Graf
2012-10-08 20:20 ` Scott Wood
2012-10-08 20:48 ` Alexander Graf
2012-10-08 21:05 ` Scott Wood
2012-10-08 21:08 ` Alexander Graf
2012-10-08 21:30 ` Scott Wood
2012-10-08 12:23 ` [PATCH 14/14] PPC: pseries: Remove hack for PIO window Alexander Graf
2012-10-08 16:18 ` [PATCH 00/14] Remove old_portio users for memory region PIO mapping Andreas Färber
2012-10-08 16:32 ` Alexander Graf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349699033-6703-10-git-send-email-agraf@suse.de \
--to=agraf@suse.de \
--cc=aliguori@us.ibm.com \
--cc=av1474@comtv.ru \
--cc=avi@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=scottwood@freescale.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).