qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Benoît Canet" <benoit.canet@gmail.com>
To: qemu-devel@nongnu.org
Cc: "Benoît Canet" <benoit.canet@gmail.com>
Subject: [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic to memory API
Date: Thu, 13 Oct 2011 21:45:14 +0200	[thread overview]
Message-ID: <1318535119-979-3-git-send-email-benoit.canet@gmail.com> (raw)
In-Reply-To: <1318535119-979-1-git-send-email-benoit.canet@gmail.com>

---
 hw/integratorcp.c |   29 +++++++++++------------------
 1 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/hw/integratorcp.c b/hw/integratorcp.c
index 0dc84c4..e3a5f24 100644
--- a/hw/integratorcp.c
+++ b/hw/integratorcp.c
@@ -279,6 +279,7 @@ static int integratorcm_init(SysBusDevice *dev)
 typedef struct icp_pic_state
 {
   SysBusDevice busdev;
+  MemoryRegion iomem;
   uint32_t level;
   uint32_t irq_enabled;
   uint32_t fiq_enabled;
@@ -306,7 +307,8 @@ static void icp_pic_set_irq(void *opaque, int irq, int level)
     icp_pic_update(s);
 }
 
-static uint32_t icp_pic_read(void *opaque, target_phys_addr_t offset)
+static uint64_t icp_pic_read(void *opaque, target_phys_addr_t offset,
+                             unsigned size)
 {
     icp_pic_state *s = (icp_pic_state *)opaque;
 
@@ -335,7 +337,7 @@ static uint32_t icp_pic_read(void *opaque, target_phys_addr_t offset)
 }
 
 static void icp_pic_write(void *opaque, target_phys_addr_t offset,
-                          uint32_t value)
+                          uint64_t value, unsigned size)
 {
     icp_pic_state *s = (icp_pic_state *)opaque;
 
@@ -371,30 +373,21 @@ static void icp_pic_write(void *opaque, target_phys_addr_t offset,
     icp_pic_update(s);
 }
 
-static CPUReadMemoryFunc * const icp_pic_readfn[] = {
-   icp_pic_read,
-   icp_pic_read,
-   icp_pic_read
-};
-
-static CPUWriteMemoryFunc * const icp_pic_writefn[] = {
-   icp_pic_write,
-   icp_pic_write,
-   icp_pic_write
-};
+static const MemoryRegionOps icp_pic_ops = {                                                                          
+    .read = icp_pic_read,                                                                                             
+    .write = icp_pic_write,                                                                                           
+    .endianness = DEVICE_NATIVE_ENDIAN,                                                                             
+}; 
 
 static int icp_pic_init(SysBusDevice *dev)
 {
     icp_pic_state *s = FROM_SYSBUS(icp_pic_state, dev);
-    int iomemtype;
 
     qdev_init_gpio_in(&dev->qdev, icp_pic_set_irq, 32);
     sysbus_init_irq(dev, &s->parent_irq);
     sysbus_init_irq(dev, &s->parent_fiq);
-    iomemtype = cpu_register_io_memory(icp_pic_readfn,
-                                       icp_pic_writefn, s,
-                                       DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 0x00800000, iomemtype);
+    memory_region_init_io(&s->iomem, &icp_pic_ops, s, "icp-pic", 0x00800000);
+    sysbus_init_mmio_region(dev, &s->iomem);
     return 0;
 }
 
-- 
1.7.5.4

  parent reply	other threads:[~2011-10-13 19:55 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13 19:45 [Qemu-devel] [PATCH] finish to convert integratorcp.c and stellaris.c to the new memory API Benoît Canet
2011-10-13 19:45 ` [Qemu-devel] [PATCH 1/7] integratorcp: convert core to " Benoît Canet
2011-10-17 14:14   ` Peter Maydell
2011-10-17 14:24     ` Avi Kivity
2011-10-13 19:45 ` Benoît Canet [this message]
2011-10-17 14:16   ` [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic " Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 3/7] integratorcp: convert control " Benoît Canet
2011-10-17 14:17   ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 4/7] stellaris: convert sys " Benoît Canet
2011-10-17 14:28   ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 5/7] stellaris: convert i2c " Benoît Canet
2011-10-17 14:28   ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 6/7] stellaris: convert adc " Benoît Canet
2011-10-17 14:07   ` Peter Maydell
2011-10-13 19:45 ` [Qemu-devel] [PATCH 7/7] stellaris: convert gptm " Benoît Canet
2011-10-17 14:29   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2011-10-17 15:28 [Qemu-devel] [PATCH 0/7] V2. Finish to convert integratorcp and stellaris " Benoît Canet
2011-10-17 15:28 ` [Qemu-devel] [PATCH 2/7] integratorcp: convert icp pic " Benoît Canet
2011-10-18 11:37   ` Peter Maydell

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=1318535119-979-3-git-send-email-benoit.canet@gmail.com \
    --to=benoit.canet@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).