Use new IO registration functions

From: Blue Swirl <blauwirbel@gmail.com>

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---

 hw/m48t59.c      |   56 +++---------------------------------------------------
 hw/pcnet.c       |   15 ++------------
 hw/sparc32_dma.c |   15 ++------------
 3 files changed, 7 insertions(+), 79 deletions(-)


diff --git a/hw/m48t59.c b/hw/m48t59.c
index 0cfdab3..17cc363 100644
--- a/hw/m48t59.c
+++ b/hw/m48t59.c
@@ -516,24 +516,6 @@ static void nvram_writeb (void *opaque, target_phys_addr_t addr, uint32_t value)
     m48t59_write(NVRAM, addr, value & 0xff);
 }
 
-static void nvram_writew (void *opaque, target_phys_addr_t addr, uint32_t value)
-{
-    m48t59_t *NVRAM = opaque;
-
-    m48t59_write(NVRAM, addr, (value >> 8) & 0xff);
-    m48t59_write(NVRAM, addr + 1, value & 0xff);
-}
-
-static void nvram_writel (void *opaque, target_phys_addr_t addr, uint32_t value)
-{
-    m48t59_t *NVRAM = opaque;
-
-    m48t59_write(NVRAM, addr, (value >> 24) & 0xff);
-    m48t59_write(NVRAM, addr + 1, (value >> 16) & 0xff);
-    m48t59_write(NVRAM, addr + 2, (value >> 8) & 0xff);
-    m48t59_write(NVRAM, addr + 3, value & 0xff);
-}
-
 static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
 {
     m48t59_t *NVRAM = opaque;
@@ -543,40 +525,6 @@ static uint32_t nvram_readb (void *opaque, target_phys_addr_t addr)
     return retval;
 }
 
-static uint32_t nvram_readw (void *opaque, target_phys_addr_t addr)
-{
-    m48t59_t *NVRAM = opaque;
-    uint32_t retval;
-
-    retval = m48t59_read(NVRAM, addr) << 8;
-    retval |= m48t59_read(NVRAM, addr + 1);
-    return retval;
-}
-
-static uint32_t nvram_readl (void *opaque, target_phys_addr_t addr)
-{
-    m48t59_t *NVRAM = opaque;
-    uint32_t retval;
-
-    retval = m48t59_read(NVRAM, addr) << 24;
-    retval |= m48t59_read(NVRAM, addr + 1) << 16;
-    retval |= m48t59_read(NVRAM, addr + 2) << 8;
-    retval |= m48t59_read(NVRAM, addr + 3);
-    return retval;
-}
-
-static CPUWriteMemoryFunc *nvram_write[] = {
-    &nvram_writeb,
-    &nvram_writew,
-    &nvram_writel,
-};
-
-static CPUReadMemoryFunc *nvram_read[] = {
-    &nvram_readb,
-    &nvram_readw,
-    &nvram_readl,
-};
-
 static void m48t59_save(QEMUFile *f, void *opaque)
 {
     m48t59_t *s = opaque;
@@ -632,7 +580,9 @@ m48t59_t *m48t59_init (qemu_irq IRQ, target_phys_addr_t mem_base,
         register_ioport_write(io_base, 0x04, 1, NVRAM_writeb, s);
     }
     if (mem_base != 0) {
-        s->mem_index = cpu_register_io_memory(0, nvram_read, nvram_write, s);
+        s->mem_index = cpu_register_8bit_io_memory(0, nvram_readb,
+                                                   nvram_writeb,
+                                                   s, 1, 1);
         cpu_register_physical_memory(mem_base, size, s->mem_index);
     }
     if (type == 59) {
diff --git a/hw/pcnet.c b/hw/pcnet.c
index 654340b..c69c451 100644
--- a/hw/pcnet.c
+++ b/hw/pcnet.c
@@ -2100,18 +2100,6 @@ static uint32_t lance_mem_readw(void *opaque, target_phys_addr_t addr)
     return val & 0xffff;
 }
 
-static CPUReadMemoryFunc *lance_mem_read[3] = {
-    NULL,
-    lance_mem_readw,
-    NULL,
-};
-
-static CPUWriteMemoryFunc *lance_mem_write[3] = {
-    NULL,
-    lance_mem_writew,
-    NULL,
-};
-
 static void lance_cleanup(VLANClientState *vc)
 {
     PCNetState *d = vc->opaque;
@@ -2135,7 +2123,8 @@ void lance_init(NICInfo *nd, target_phys_addr_t leaddr, void *dma_opaque,
     d = qemu_mallocz(sizeof(PCNetState));
 
     d->mmio_index =
-        cpu_register_io_memory(0, lance_mem_read, lance_mem_write, d);
+        cpu_register_16bit_io_memory(0, lance_mem_readw, lance_mem_writew, d,
+                                      0, 0);
 
     d->dma_opaque = dma_opaque;
 
diff --git a/hw/sparc32_dma.c b/hw/sparc32_dma.c
index b1495dd..757f7ef 100644
--- a/hw/sparc32_dma.c
+++ b/hw/sparc32_dma.c
@@ -199,18 +199,6 @@ static void dma_mem_writel(void *opaque, target_phys_addr_t addr, uint32_t val)
     s->dmaregs[saddr] = val;
 }
 
-static CPUReadMemoryFunc *dma_mem_read[3] = {
-    NULL,
-    NULL,
-    dma_mem_readl,
-};
-
-static CPUWriteMemoryFunc *dma_mem_write[3] = {
-    NULL,
-    NULL,
-    dma_mem_writel,
-};
-
 static void dma_reset(void *opaque)
 {
     DMAState *s = opaque;
@@ -252,7 +240,8 @@ void *sparc32_dma_init(target_phys_addr_t daddr, qemu_irq parent_irq,
     s->irq = parent_irq;
     s->iommu = iommu;
 
-    dma_io_memory = cpu_register_io_memory(0, dma_mem_read, dma_mem_write, s);
+    dma_io_memory = cpu_register_32bit_io_memory(0, dma_mem_readl, dma_mem_writel, s,
+                                             0, 1);
     cpu_register_physical_memory(daddr, DMA_SIZE, dma_io_memory);
 
     register_savevm("sparc32_dma", daddr, 2, dma_save, dma_load, s);
