qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] hw/smc91c111: Convert to MemoryRegion
@ 2011-08-24 17:28 Peter Maydell
  2011-08-25  9:04 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Maydell @ 2011-08-24 17:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Avi Kivity, patches

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is against master and doesn't depend on or conflict with anything
that's in Avi's branch. (I needed this because I've just rebased qemu-linaro
on master and one of the omap3 boards connects an smc91c111 up to the
omap_gpmc, which means it needs to be able to expose a MemoryRegion*.)

 hw/smc91c111.c |   29 +++++++++++++----------------
 1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/hw/smc91c111.c b/hw/smc91c111.c
index 3a8a85c..fc8c498 100644
--- a/hw/smc91c111.c
+++ b/hw/smc91c111.c
@@ -43,7 +43,7 @@ typedef struct {
     uint8_t data[NUM_PACKETS][2048];
     uint8_t int_level;
     uint8_t int_mask;
-    int mmio_index;
+    MemoryRegion mmio;
 } smc91c111_state;
 
 static const VMStateDescription vmstate_smc91c111 = {
@@ -717,16 +717,15 @@ static ssize_t smc91c111_receive(VLANClientState *nc, const uint8_t *buf, size_t
     return size;
 }
 
-static CPUReadMemoryFunc * const smc91c111_readfn[] = {
-    smc91c111_readb,
-    smc91c111_readw,
-    smc91c111_readl
-};
-
-static CPUWriteMemoryFunc * const smc91c111_writefn[] = {
-    smc91c111_writeb,
-    smc91c111_writew,
-    smc91c111_writel
+static const MemoryRegionOps smc91c111_mem_ops = {
+    /* The special case for 32 bit writes to 0xc means we can't just
+     * set .impl.min/max_access_size to 1, unfortunately
+     */
+    .old_mmio = {
+        .read = { smc91c111_readb, smc91c111_readw, smc91c111_readl, },
+        .write = { smc91c111_writeb, smc91c111_writew, smc91c111_writel, },
+    },
+    .endianness = DEVICE_NATIVE_ENDIAN,
 };
 
 static void smc91c111_cleanup(VLANClientState *nc)
@@ -747,11 +746,9 @@ static NetClientInfo net_smc91c111_info = {
 static int smc91c111_init1(SysBusDevice *dev)
 {
     smc91c111_state *s = FROM_SYSBUS(smc91c111_state, dev);
-
-    s->mmio_index = cpu_register_io_memory(smc91c111_readfn,
-                                           smc91c111_writefn, s,
-                                           DEVICE_NATIVE_ENDIAN);
-    sysbus_init_mmio(dev, 16, s->mmio_index);
+    memory_region_init_io(&s->mmio, &smc91c111_mem_ops, s,
+                          "smc91c111-mmio", 16);
+    sysbus_init_mmio_region(dev, &s->mmio);
     sysbus_init_irq(dev, &s->irq);
     qemu_macaddr_default_if_unset(&s->conf.macaddr);
     s->nic = qemu_new_nic(&net_smc91c111_info, &s->conf,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] hw/smc91c111: Convert to MemoryRegion
  2011-08-24 17:28 [Qemu-devel] [PATCH] hw/smc91c111: Convert to MemoryRegion Peter Maydell
@ 2011-08-25  9:04 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2011-08-25  9:04 UTC (permalink / raw)
  To: Peter Maydell; +Cc: qemu-devel, patches

On 08/24/2011 08:28 PM, Peter Maydell wrote:
> Signed-off-by: Peter Maydell<peter.maydell@linaro.org>
> ---
> This is against master and doesn't depend on or conflict with anything
> that's in Avi's branch. (I needed this because I've just rebased qemu-linaro
> on master and one of the omap3 boards connects an smc91c111 up to the
> omap_gpmc, which means it needs to be able to expose a MemoryRegion*.)
>

Thanks, applied to memory/queue.  If you need this in soon, feel free to 
ask Anthony to merge it.

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-25  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-24 17:28 [Qemu-devel] [PATCH] hw/smc91c111: Convert to MemoryRegion Peter Maydell
2011-08-25  9:04 ` Avi Kivity

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).