From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 22/25] milkymist-tmu2: convert to memory API
Date: Sun, 2 Oct 2011 16:26:53 +0200 [thread overview]
Message-ID: <1317565616-12997-23-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1317565616-12997-1-git-send-email-avi@redhat.com>
From: Michael Walle <michael@walle.cc>
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/milkymist-tmu2.c | 32 ++++++++++++++++----------------
1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/hw/milkymist-tmu2.c b/hw/milkymist-tmu2.c
index 953d42f..aad0ed0 100644
--- a/hw/milkymist-tmu2.c
+++ b/hw/milkymist-tmu2.c
@@ -77,6 +77,7 @@ struct vertex {
struct MilkymistTMU2State {
SysBusDevice busdev;
+ MemoryRegion regs_region;
CharDriverState *chr;
qemu_irq irq;
@@ -309,7 +310,8 @@ static void tmu2_start(MilkymistTMU2State *s)
qemu_irq_pulse(s->irq);
}
-static uint32_t tmu2_read(void *opaque, target_phys_addr_t addr)
+static uint64_t tmu2_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
MilkymistTMU2State *s = opaque;
uint32_t r = 0;
@@ -370,7 +372,8 @@ static void tmu2_check_registers(MilkymistTMU2State *s)
}
}
-static void tmu2_write(void *opaque, target_phys_addr_t addr, uint32_t value)
+static void tmu2_write(void *opaque, target_phys_addr_t addr, uint64_t value,
+ unsigned size)
{
MilkymistTMU2State *s = opaque;
@@ -414,16 +417,14 @@ static void tmu2_write(void *opaque, target_phys_addr_t addr, uint32_t value)
tmu2_check_registers(s);
}
-static CPUReadMemoryFunc * const tmu2_read_fn[] = {
- NULL,
- NULL,
- &tmu2_read,
-};
-
-static CPUWriteMemoryFunc * const tmu2_write_fn[] = {
- NULL,
- NULL,
- &tmu2_write,
+static const MemoryRegionOps tmu2_mmio_ops = {
+ .read = tmu2_read,
+ .write = tmu2_write,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4,
+ },
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
static void milkymist_tmu2_reset(DeviceState *d)
@@ -439,7 +440,6 @@ static void milkymist_tmu2_reset(DeviceState *d)
static int milkymist_tmu2_init(SysBusDevice *dev)
{
MilkymistTMU2State *s = FROM_SYSBUS(typeof(*s), dev);
- int tmu2_regs;
if (tmu2_glx_init(s)) {
return 1;
@@ -447,9 +447,9 @@ static int milkymist_tmu2_init(SysBusDevice *dev)
sysbus_init_irq(dev, &s->irq);
- tmu2_regs = cpu_register_io_memory(tmu2_read_fn, tmu2_write_fn, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, R_MAX * 4, tmu2_regs);
+ memory_region_init_io(&s->regs_region, &tmu2_mmio_ops, s,
+ "milkymist-tmu2", R_MAX * 4);
+ sysbus_init_mmio_region(dev, &s->regs_region);
return 0;
}
--
1.7.6.3
next prev parent reply other threads:[~2011-10-02 14:27 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 14:26 [Qemu-devel] [PULL 00/25] Memory API conversion, batch 10 Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 01/25] etrax-pic: Convert to MemoryRegion Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 02/25] etrax-ser: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 03/25] etrax-timer: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 04/25] etrax-dma: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 05/25] etrax-eth: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 06/25] serial: Convert serial_mm_init " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 07/25] serial: Use enum device_endian in serial_mm_init parameter Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 08/25] serial: Remove ioregister parameter from serial_mm_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 09/25] serial: Add MemoryRegion parameter to serial_mm_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 10/25] ppc405: Pass in address_space_mem to ppc405{cr, ep}_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 11/25] ppc440: Pass in address_space_mem to ppc440ep_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 12/25] pxa: Pass in address_space to pxa{255, 270}_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 13/25] sm501: Pass address_space_mem to sm501_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 14/25] sun4u: Pass address_space_mem to sun4uv_init Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 15/25] hw/smc91c111: Convert to MemoryRegion Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 16/25] openpic: Memory API conversion for mpic Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 17/25] milkymist-ac97: convert to memory API Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 18/25] milkymist-hpdmc: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 19/25] milkymist-memcard: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 20/25] milkymist-pfpu: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 21/25] milkymist-sysctl: " Avi Kivity
2011-10-02 14:26 ` Avi Kivity [this message]
2011-10-02 14:26 ` [Qemu-devel] [PATCH 23/25] milkymist-uart: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 24/25] milkymist-vgafb: " Avi Kivity
2011-10-02 14:26 ` [Qemu-devel] [PATCH 25/25] milkymist-{minimac2, softusb}: rename memory names Avi Kivity
2011-10-09 10:33 ` [Qemu-devel] [PULL 00/25] Memory API conversion, batch 10 Avi Kivity
2011-10-09 11:01 ` Blue Swirl
2011-10-09 12:07 ` Avi Kivity
2011-10-09 12:50 ` Blue Swirl
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=1317565616-12997-23-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/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).