From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: blauwirbel@gmail.com, "Benoît Canet" <benoit.canet@gmail.com>,
avi@redhat.com
Subject: [Qemu-devel] [PATCH 11/14] sun4c_intctl: convert to memory API
Date: Tue, 15 Nov 2011 12:14:01 +0100 [thread overview]
Message-ID: <1321355644-1982-12-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1321355644-1982-1-git-send-email-benoit.canet@gmail.com>
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
hw/sun4c_intctl.c | 32 +++++++++++++++-----------------
1 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/hw/sun4c_intctl.c b/hw/sun4c_intctl.c
index 5c7fdef..4d01d1c 100644
--- a/hw/sun4c_intctl.c
+++ b/hw/sun4c_intctl.c
@@ -46,6 +46,7 @@
typedef struct Sun4c_INTCTLState {
SysBusDevice busdev;
+ MemoryRegion iomem;
#ifdef DEBUG_IRQ_COUNT
uint64_t irq_count;
#endif
@@ -60,7 +61,8 @@ typedef struct Sun4c_INTCTLState {
static void sun4c_check_interrupts(void *opaque);
-static uint32_t sun4c_intctl_mem_readb(void *opaque, target_phys_addr_t addr)
+static uint64_t sun4c_intctl_mem_readb(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
Sun4c_INTCTLState *s = opaque;
uint32_t ret;
@@ -72,7 +74,7 @@ static uint32_t sun4c_intctl_mem_readb(void *opaque, target_phys_addr_t addr)
}
static void sun4c_intctl_mem_writeb(void *opaque, target_phys_addr_t addr,
- uint32_t val)
+ uint64_t val, unsigned size)
{
Sun4c_INTCTLState *s = opaque;
@@ -82,16 +84,14 @@ static void sun4c_intctl_mem_writeb(void *opaque, target_phys_addr_t addr,
sun4c_check_interrupts(s);
}
-static CPUReadMemoryFunc * const sun4c_intctl_mem_read[3] = {
- sun4c_intctl_mem_readb,
- NULL,
- NULL,
-};
-
-static CPUWriteMemoryFunc * const sun4c_intctl_mem_write[3] = {
- sun4c_intctl_mem_writeb,
- NULL,
- NULL,
+static const MemoryRegionOps sun4c_intctl_mem_ops = {
+ .read = sun4c_intctl_mem_readb,
+ .write = sun4c_intctl_mem_writeb,
+ .endianness = DEVICE_NATIVE_ENDIAN,
+ .impl = {
+ .min_access_size = 1,
+ .max_access_size = 1,
+ },
};
void sun4c_pic_info(Monitor *mon, void *opaque)
@@ -192,13 +192,11 @@ static void sun4c_intctl_reset(DeviceState *d)
static int sun4c_intctl_init1(SysBusDevice *dev)
{
Sun4c_INTCTLState *s = FROM_SYSBUS(Sun4c_INTCTLState, dev);
- int io_memory;
unsigned int i;
- io_memory = cpu_register_io_memory(sun4c_intctl_mem_read,
- sun4c_intctl_mem_write, s,
- DEVICE_NATIVE_ENDIAN);
- sysbus_init_mmio(dev, INTCTL_SIZE, io_memory);
+ memory_region_init_io(&s->iomem, &sun4c_intctl_mem_ops, s,
+ "interrupt-controller", INTCTL_SIZE);
+ sysbus_init_mmio_region(dev, &s->iomem);
qdev_init_gpio_in(&dev->qdev, sun4c_set_irq, 8);
for (i = 0; i < MAX_PILS; i++) {
--
1.7.5.4
next prev parent reply other threads:[~2011-11-15 11:14 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-15 11:13 [Qemu-devel] [PATCH 00/14] Convert Sun devices to memory API Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 01/14] slavio_misc: convert apc " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 02/14] slavio_misc: convert configuration " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 03/14] slavio_misc: convert diagnostic " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 04/14] slavio_misc: convert modem " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 05/14] slavio_misc: convert leds " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 06/14] slavio_misc: convert system control " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 07/14] slavio_misc: convert aux1 " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 08/14] slavio_misc: convert aux2 " Benoît Canet
2011-11-15 11:13 ` [Qemu-devel] [PATCH 09/14] slavio_intctl: convert master interrupt controller " Benoît Canet
2011-11-15 11:14 ` [Qemu-devel] [PATCH 10/14] slavio_intctl: convert slaves interrupt controllers " Benoît Canet
2011-11-15 11:14 ` Benoît Canet [this message]
2011-11-15 11:14 ` [Qemu-devel] [PATCH 12/14] slavio_timer: convert " Benoît Canet
2011-11-15 11:14 ` [Qemu-devel] [PATCH 13/14] sun4m_iommu: " Benoît Canet
2011-11-15 11:14 ` [Qemu-devel] [PATCH 14/14] esp: Fix memory API conversion Benoît Canet
2011-11-15 12:20 ` [Qemu-devel] [PATCH 00/14] Convert Sun devices to memory API Avi Kivity
2011-11-15 15:22 ` Benoît Canet
2011-11-15 17:48 ` Avi Kivity
2011-11-15 20:03 ` Benoît Canet
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=1321355644-1982-12-git-send-email-benoit.canet@gmail.com \
--to=benoit.canet@gmail.com \
--cc=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--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).