From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@gmail.com>, avi@redhat.com
Subject: [Qemu-devel] [PATCH v4 04/11] mcf_intc: convert to memory API
Date: Thu, 24 Nov 2011 14:31:15 +0100 [thread overview]
Message-ID: <1322141482-12173-5-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1322141482-12173-1-git-send-email-benoit.canet@gmail.com>
Signed-off-by: Benoît Canet <benoit.canet@gmail.com>
---
hw/mcf.h | 4 +++-
hw/mcf5208.c | 2 +-
hw/mcf_intc.c | 33 +++++++++++++++------------------
3 files changed, 19 insertions(+), 20 deletions(-)
diff --git a/hw/mcf.h b/hw/mcf.h
index 2f88ff0..baa790b 100644
--- a/hw/mcf.h
+++ b/hw/mcf.h
@@ -15,7 +15,9 @@ void mcf_uart_mm_init(struct MemoryRegion *sysmem,
qemu_irq irq, CharDriverState *chr);
/* mcf_intc.c */
-qemu_irq *mcf_intc_init(target_phys_addr_t base, CPUState *env);
+qemu_irq *mcf_intc_init(struct MemoryRegion *sysmem,
+ target_phys_addr_t base,
+ CPUState *env);
/* mcf_fec.c */
void mcf_fec_init(struct MemoryRegion *sysmem, NICInfo *nd,
diff --git a/hw/mcf5208.c b/hw/mcf5208.c
index e03d80b..ec608a1 100644
--- a/hw/mcf5208.c
+++ b/hw/mcf5208.c
@@ -221,7 +221,7 @@ static void mcf5208evb_init(ram_addr_t ram_size,
memory_region_add_subregion(address_space_mem, 0x80000000, sram);
/* Internal peripherals. */
- pic = mcf_intc_init(0xfc048000, env);
+ pic = mcf_intc_init(address_space_mem, 0xfc048000, env);
mcf_uart_mm_init(address_space_mem, 0xfc060000, pic[26], serial_hds[0]);
mcf_uart_mm_init(address_space_mem, 0xfc064000, pic[27], serial_hds[1]);
diff --git a/hw/mcf_intc.c b/hw/mcf_intc.c
index 99092e7..0b498dd 100644
--- a/hw/mcf_intc.c
+++ b/hw/mcf_intc.c
@@ -7,8 +7,10 @@
*/
#include "hw.h"
#include "mcf.h"
+#include "exec-memory.h"
typedef struct {
+ MemoryRegion iomem;
uint64_t ipr;
uint64_t imr;
uint64_t ifr;
@@ -41,7 +43,8 @@ static void mcf_intc_update(mcf_intc_state *s)
m68k_set_irq_level(s->env, best_level, s->active_vector);
}
-static uint32_t mcf_intc_read(void *opaque, target_phys_addr_t addr)
+static uint64_t mcf_intc_read(void *opaque, target_phys_addr_t addr,
+ unsigned size)
{
int offset;
mcf_intc_state *s = (mcf_intc_state *)opaque;
@@ -73,7 +76,8 @@ static uint32_t mcf_intc_read(void *opaque, target_phys_addr_t addr)
}
}
-static void mcf_intc_write(void *opaque, target_phys_addr_t addr, uint32_t val)
+static void mcf_intc_write(void *opaque, target_phys_addr_t addr,
+ uint64_t val, unsigned size)
{
int offset;
mcf_intc_state *s = (mcf_intc_state *)opaque;
@@ -127,31 +131,24 @@ static void mcf_intc_reset(mcf_intc_state *s)
s->active_vector = 24;
}
-static CPUReadMemoryFunc * const mcf_intc_readfn[] = {
- mcf_intc_read,
- mcf_intc_read,
- mcf_intc_read
+static const MemoryRegionOps mcf_intc_ops = {
+ .read = mcf_intc_read,
+ .write = mcf_intc_write,
+ .endianness = DEVICE_NATIVE_ENDIAN,
};
-static CPUWriteMemoryFunc * const mcf_intc_writefn[] = {
- mcf_intc_write,
- mcf_intc_write,
- mcf_intc_write
-};
-
-qemu_irq *mcf_intc_init(target_phys_addr_t base, CPUState *env)
+qemu_irq *mcf_intc_init(MemoryRegion *sysmem,
+ target_phys_addr_t base,
+ CPUState *env)
{
mcf_intc_state *s;
- int iomemtype;
s = g_malloc0(sizeof(mcf_intc_state));
s->env = env;
mcf_intc_reset(s);
- iomemtype = cpu_register_io_memory(mcf_intc_readfn,
- mcf_intc_writefn, s,
- DEVICE_NATIVE_ENDIAN);
- cpu_register_physical_memory(base, 0x100, iomemtype);
+ memory_region_init_io(&s->iomem, &mcf_intc_ops, s, "mcf", 0x100);
+ memory_region_add_subregion(sysmem, base, &s->iomem);
return qemu_allocate_irqs(mcf_intc_set_irq, s, 64);
}
--
1.7.7.3
next prev parent reply other threads:[~2011-11-24 13:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 13:31 [Qemu-devel] [PATCH v4 00/11] more memory API conversions Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 01/11] mcf5206: convert to memory API Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 02/11] mcf_uart: " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 03/11] mcf_fec: " Benoît Canet
2011-11-24 13:31 ` Benoît Canet [this message]
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 05/11] lm32_uart: " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 06/11] lm32_sys: " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 07/11] bonito: convert north bridge register mapping " Benoît Canet
2011-11-24 13:43 ` Peter Maydell
2011-11-24 13:48 ` Avi Kivity
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 08/11] bonito: convert north bridge pci config " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 09/11] bonito: convert south " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 10/11] bonito: convert ldma " Benoît Canet
2011-11-24 13:31 ` [Qemu-devel] [PATCH v4 11/11] bonito: convert cop " Benoît Canet
2011-11-24 13:44 ` [Qemu-devel] [PATCH v4 00/11] more memory API conversions Avi Kivity
2011-11-27 8:38 ` Avi Kivity
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=1322141482-12173-5-git-send-email-benoit.canet@gmail.com \
--to=benoit.canet@gmail.com \
--cc=avi@redhat.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).