diff mbox

[8/9] sm501: Pass address_space_mem to sm501_init.

Message ID 1313104041-1641-9-git-send-email-rth@twiddle.net
State New
Headers show

Commit Message

Richard Henderson Aug. 11, 2011, 11:07 p.m. UTC
Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 hw/devices.h |    6 +++++-
 hw/r2d.c     |    3 ++-
 hw/sm501.c   |    7 +++----
 3 files changed, 10 insertions(+), 6 deletions(-)

Comments

Peter Maydell Aug. 17, 2011, 10:30 p.m. UTC | #1
On 12 August 2011 00:07, Richard Henderson <rth@twiddle.net> wrote:
> diff --git a/hw/devices.h b/hw/devices.h
> index 07fda83..36c21e7 100644
> --- a/hw/devices.h
> +++ b/hw/devices.h
> @@ -1,6 +1,9 @@
>  #ifndef QEMU_DEVICES_H
>  #define QEMU_DEVICES_H
>
> +/* ??? Not all users of this file can include cpu-common.h.  */
> +typedef struct MemoryRegion MemoryRegion;
> +

This breaks compilation of Avi's memory-region branch:
In file included from /home/petmay01/git/qemu/hw/smc91c111.c:12:0:
/home/petmay01/git/qemu/hw/devices.h:5:29: error: redefinition of
typedef ‘MemoryRegion’
/home/petmay01/git/qemu/memory.h:29:29: note: previous declaration of
‘MemoryRegion’ was here

-- PMM
diff mbox

Patch

diff --git a/hw/devices.h b/hw/devices.h
index 07fda83..36c21e7 100644
--- a/hw/devices.h
+++ b/hw/devices.h
@@ -1,6 +1,9 @@ 
 #ifndef QEMU_DEVICES_H
 #define QEMU_DEVICES_H
 
+/* ??? Not all users of this file can include cpu-common.h.  */
+typedef struct MemoryRegion MemoryRegion;
+
 /* Devices that have nowhere better to go.  */
 
 /* smc91c111.c */
@@ -57,7 +60,8 @@  qemu_irq *tc6393xb_gpio_in_get(TC6393xbState *s);
 qemu_irq tc6393xb_l3v_get(TC6393xbState *s);
 
 /* sm501.c */
-void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq,
+void sm501_init(MemoryRegion *address_space_mem, uint32_t base,
+                uint32_t local_mem_bytes, qemu_irq irq,
                 CharDriverState *chr);
 
 #endif
diff --git a/hw/r2d.c b/hw/r2d.c
index e9ec58f..1338cd7 100644
--- a/hw/r2d.c
+++ b/hw/r2d.c
@@ -262,7 +262,8 @@  static void r2d_init(MemoryRegion *address_space_mem,
     sysbus_create_varargs("sh_pci", 0x1e200000, irq[PCI_INTA], irq[PCI_INTB],
                           irq[PCI_INTC], irq[PCI_INTD], NULL);
 
-    sm501_init(0x10000000, SM501_VRAM_SIZE, irq[SM501], serial_hds[2]);
+    sm501_init(address_space_mem, 0x10000000, SM501_VRAM_SIZE,
+               irq[SM501], serial_hds[2]);
 
     /* onboard CF (True IDE mode, Master only). */
     dinfo = drive_get(IF_IDE, 0, 0);
diff --git a/hw/sm501.c b/hw/sm501.c
index 56db3b9..8ec498f 100644
--- a/hw/sm501.c
+++ b/hw/sm501.c
@@ -30,7 +30,6 @@ 
 #include "sysbus.h"
 #include "qdev-addr.h"
 #include "range.h"
-#include "exec-memory.h"
 
 /*
  * Status: 2010/05/07
@@ -1386,8 +1385,8 @@  static void sm501_update_display(void *opaque)
 	sm501_draw_crt(s);
 }
 
-void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq,
-                CharDriverState *chr)
+void sm501_init(MemoryRegion *address_space_mem, uint32_t base,
+                uint32_t local_mem_bytes, qemu_irq irq, CharDriverState *chr)
 {
     SM501State * s;
     DeviceState *dev;
@@ -1441,7 +1440,7 @@  void sm501_init(uint32_t base, uint32_t local_mem_bytes, qemu_irq irq,
 
     /* bridge to serial emulation module */
     if (chr) {
-        serial_mm_init(get_system_memory(),
+        serial_mm_init(address_space_mem,
                        base + MMIO_BASE_OFFSET + SM501_UART0, 2,
                        NULL, /* TODO : chain irq to IRL */
                        115200, chr, DEVICE_NATIVE_ENDIAN);