From: Avi Kivity <avi@redhat.com>
To: qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: [Qemu-devel] [PATCH 03/25] etrax-timer: Convert to MemoryRegion
Date: Sun, 2 Oct 2011 16:26:34 +0200 [thread overview]
Message-ID: <1317565616-12997-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1317565616-12997-1-git-send-email-avi@redhat.com>
From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
hw/etraxfs_timer.c | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/hw/etraxfs_timer.c b/hw/etraxfs_timer.c
index b08e574..57dc739 100644
--- a/hw/etraxfs_timer.c
+++ b/hw/etraxfs_timer.c
@@ -43,6 +43,7 @@
struct etrax_timer {
SysBusDevice busdev;
+ MemoryRegion mmio;
qemu_irq irq;
qemu_irq nmi;
@@ -72,7 +73,8 @@ struct etrax_timer {
uint32_t r_masked_intr;
};
-static uint32_t timer_readl (void *opaque, target_phys_addr_t addr)
+static uint64_t
+timer_read(void *opaque, target_phys_addr_t addr, unsigned int size)
{
struct etrax_timer *t = opaque;
uint32_t r = 0;
@@ -239,9 +241,11 @@ static inline void timer_watchdog_update(struct etrax_timer *t, uint32_t value)
}
static void
-timer_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
+timer_write(void *opaque, target_phys_addr_t addr,
+ uint64_t val64, unsigned int size)
{
struct etrax_timer *t = opaque;
+ uint32_t value = val64;
switch (addr)
{
@@ -281,14 +285,14 @@ static inline void timer_watchdog_update(struct etrax_timer *t, uint32_t value)
}
}
-static CPUReadMemoryFunc * const timer_read[] = {
- NULL, NULL,
- &timer_readl,
-};
-
-static CPUWriteMemoryFunc * const timer_write[] = {
- NULL, NULL,
- &timer_writel,
+static const MemoryRegionOps timer_ops = {
+ .read = timer_read,
+ .write = timer_write,
+ .endianness = DEVICE_LITTLE_ENDIAN,
+ .valid = {
+ .min_access_size = 4,
+ .max_access_size = 4
+ }
};
static void etraxfs_timer_reset(void *opaque)
@@ -307,7 +311,6 @@ static void etraxfs_timer_reset(void *opaque)
static int etraxfs_timer_init(SysBusDevice *dev)
{
struct etrax_timer *t = FROM_SYSBUS(typeof (*t), dev);
- int timer_regs;
t->bh_t0 = qemu_bh_new(timer0_hit, t);
t->bh_t1 = qemu_bh_new(timer1_hit, t);
@@ -319,10 +322,8 @@ static int etraxfs_timer_init(SysBusDevice *dev)
sysbus_init_irq(dev, &t->irq);
sysbus_init_irq(dev, &t->nmi);
- timer_regs = cpu_register_io_memory(timer_read, timer_write, t,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, 0x5c, timer_regs);
-
+ memory_region_init_io(&t->mmio, &timer_ops, t, "etraxfs-timer", 0x5c);
+ sysbus_init_mmio_region(dev, &t->mmio);
qemu_register_reset(etraxfs_timer_reset, t);
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 ` Avi Kivity [this message]
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 ` [Qemu-devel] [PATCH 22/25] milkymist-tmu2: " Avi Kivity
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-4-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.