Patchwork [v2,04/13] qdev: drop iobase properties from isa bus

login
register
mail settings
Submitter Gerd Hoffmann
Date Sept. 10, 2009, 9:43 a.m.
Message ID <1252575815-7824-5-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/33297/
State Superseded
Headers show

Comments

Gerd Hoffmann - Sept. 10, 2009, 9:43 a.m.
Lot of ISA devices work at fixed addresses, so having iobase
as bus property doesn't make much sense.  Devices which can
have different iobases will get a device property.

Also simply hard-code stuff which can't be configured anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/fdc.c        |   17 +++++++++--------
 hw/fdc.h        |    4 +---
 hw/isa-bus.c    |   10 +---------
 hw/isa.h        |    4 +---
 hw/mips_malta.c |    4 ++--
 hw/pc.c         |    4 ++--
 hw/pckbd.c      |    8 ++++----
 hw/ppc_prep.c   |    2 +-
 hw/sun4u.c      |    4 ++--
 9 files changed, 23 insertions(+), 34 deletions(-)

Patch

diff --git a/hw/fdc.c b/hw/fdc.c
index db57710..d761e62 100644
--- a/hw/fdc.c
+++ b/hw/fdc.c
@@ -1871,14 +1871,14 @@  static void fdctrl_connect_drives(fdctrl_t *fdctrl, BlockDriverState **fds)
     }
 }
 
-fdctrl_t *fdctrl_init_isa(int isairq, int dma_chann,
-                          uint32_t io_base,
-                          BlockDriverState **fds)
+fdctrl_t *fdctrl_init_isa(BlockDriverState **fds)
 {
     fdctrl_t *fdctrl;
     ISADevice *dev;
+    int isairq = 6;
+    int dma_chann = 2;
 
-    dev = isa_create_simple("isa-fdc", io_base, 0, isairq, -1);
+    dev = isa_create_simple("isa-fdc", isairq, -1);
     fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state);
 
     fdctrl->dma_chann = dma_chann;
@@ -1968,14 +1968,15 @@  static int isabus_fdc_init1(ISADevice *dev)
 {
     fdctrl_isabus_t *isa = DO_UPCAST(fdctrl_isabus_t, busdev, dev);
     fdctrl_t *fdctrl = &isa->state;
+    int iobase = 0x3f0;
 
-    register_ioport_read(isa->busdev.iobase[0] + 0x01, 5, 1,
+    register_ioport_read(iobase + 0x01, 5, 1,
                          &fdctrl_read_port, fdctrl);
-    register_ioport_read(isa->busdev.iobase[0] + 0x07, 1, 1,
+    register_ioport_read(iobase + 0x07, 1, 1,
                          &fdctrl_read_port, fdctrl);
-    register_ioport_write(isa->busdev.iobase[0] + 0x01, 5, 1,
+    register_ioport_write(iobase + 0x01, 5, 1,
                           &fdctrl_write_port, fdctrl);
-    register_ioport_write(isa->busdev.iobase[0] + 0x07, 1, 1,
+    register_ioport_write(iobase + 0x07, 1, 1,
                           &fdctrl_write_port, fdctrl);
     isa_init_irq(&isa->busdev, &fdctrl->irq);
 
diff --git a/hw/fdc.h b/hw/fdc.h
index 04d64ea..1b81ec1 100644
--- a/hw/fdc.h
+++ b/hw/fdc.h
@@ -3,9 +3,7 @@ 
 
 typedef struct fdctrl_t fdctrl_t;
 
-fdctrl_t *fdctrl_init_isa(int isairq, int dma_chann,
-                          uint32_t io_base,
-                          BlockDriverState **fds);
+fdctrl_t *fdctrl_init_isa(BlockDriverState **fds);
 fdctrl_t *fdctrl_init_sysbus(qemu_irq irq, int dma_chann,
                              target_phys_addr_t mmio_base,
                              BlockDriverState **fds);
diff --git a/hw/isa-bus.c b/hw/isa-bus.c
index 2843b51..fde066a 100644
--- a/hw/isa-bus.c
+++ b/hw/isa-bus.c
@@ -35,11 +35,6 @@  static struct BusInfo isa_bus_info = {
     .name      = "ISA",
     .size      = sizeof(ISABus),
     .print_dev = isabus_dev_print,
-    .props     = (Property[]) {
-        DEFINE_PROP_HEX32("iobase",  ISADevice, iobase[0], -1),
-        DEFINE_PROP_HEX32("iobase2", ISADevice, iobase[1], -1),
-        DEFINE_PROP_END_OF_LIST(),
-    }
 };
 
 ISABus *isa_bus_new(DeviceState *dev)
@@ -122,8 +117,7 @@  void isa_qdev_register(ISADeviceInfo *info)
     qdev_register(&info->qdev);
 }
 
-ISADevice *isa_create_simple(const char *name, uint32_t iobase, uint32_t iobase2,
-                             uint32_t irq, uint32 irq2)
+ISADevice *isa_create_simple(const char *name, uint32_t irq, uint32 irq2)
 {
     DeviceState *dev;
     ISADevice *isa;
@@ -134,8 +128,6 @@  ISADevice *isa_create_simple(const char *name, uint32_t iobase, uint32_t iobase2
     }
     dev = qdev_create(&isabus->qbus, name);
     isa = DO_UPCAST(ISADevice, qdev, dev);
-    isa->iobase[0] = iobase;
-    isa->iobase[1] = iobase2;
     qdev_init(dev);
     if (irq != -1) {
         isa_connect_irq(isa, 0, irq);
diff --git a/hw/isa.h b/hw/isa.h
index d98acd5..24c5c66 100644
--- a/hw/isa.h
+++ b/hw/isa.h
@@ -12,7 +12,6 @@  typedef struct ISADeviceInfo ISADeviceInfo;
 
 struct ISADevice {
     DeviceState qdev;
-    uint32_t iobase[2];
     uint32_t isairq[2];
     qemu_irq *irqs[2];
     int nirqs;
@@ -30,8 +29,7 @@  void isa_connect_irq(ISADevice *dev, int devirq, int isairq);
 qemu_irq isa_reserve_irq(int isairq);
 void isa_init_irq(ISADevice *dev, qemu_irq *p);
 void isa_qdev_register(ISADeviceInfo *info);
-ISADevice *isa_create_simple(const char *name, uint32_t iobase, uint32_t iobase2,
-                             uint32_t irq, uint32_t irq2);
+ISADevice *isa_create_simple(const char *name, uint32_t irq, uint32_t irq2);
 
 extern target_phys_addr_t isa_mem_base;
 
diff --git a/hw/mips_malta.c b/hw/mips_malta.c
index bb6364b..3222e16 100644
--- a/hw/mips_malta.c
+++ b/hw/mips_malta.c
@@ -921,7 +921,7 @@  void mips_malta_init (ram_addr_t ram_size,
     DMA_init(0);
 
     /* Super I/O */
-    isa_dev = isa_create_simple("i8042", 0x60, 0x64, 1, 12);
+    isa_dev = isa_create_simple("i8042", 1, 12);
  
     rtc_state = rtc_init(0x70, isa_reserve_irq(8), 2000);
     serial_init(0x3f8, isa_reserve_irq(4), 115200, serial_hds[0]);
@@ -932,7 +932,7 @@  void mips_malta_init (ram_addr_t ram_size,
         dinfo = drive_get(IF_FLOPPY, 0, i);
         fd[i] = dinfo ? dinfo->bdrv : NULL;
     }
-    floppy_controller = fdctrl_init_isa(6, 2, 0x3f0, fd);
+    floppy_controller = fdctrl_init_isa(fd);
 
     /* Sound card */
 #ifdef HAS_AUDIO
diff --git a/hw/pc.c b/hw/pc.c
index 872cb3a..0219961 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1373,7 +1373,7 @@  static void pc_init1(ram_addr_t ram_size,
         }
     }
 
-    isa_dev = isa_create_simple("i8042", 0x60, 0x64, 1, 12);
+    isa_dev = isa_create_simple("i8042", 1, 12);
     DMA_init(0);
 #ifdef HAS_AUDIO
     audio_init(pci_enabled ? pci_bus : NULL, isa_irq);
@@ -1383,7 +1383,7 @@  static void pc_init1(ram_addr_t ram_size,
         dinfo = drive_get(IF_FLOPPY, 0, i);
         fd[i] = dinfo ? dinfo->bdrv : NULL;
     }
-    floppy_controller = fdctrl_init_isa(6, 2, 0x3f0, fd);
+    floppy_controller = fdctrl_init_isa(fd);
 
     cmos_init(below_4g_mem_size, above_4g_mem_size, boot_device, hd);
 
diff --git a/hw/pckbd.c b/hw/pckbd.c
index 3f83320..b4b65a6 100644
--- a/hw/pckbd.c
+++ b/hw/pckbd.c
@@ -455,10 +455,10 @@  static int i8042_initfn(ISADevice *dev)
 
     kbd_reset(s);
     register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s);
-    register_ioport_read(dev->iobase[0], 1, 1, kbd_read_data, s);
-    register_ioport_write(dev->iobase[0], 1, 1, kbd_write_data, s);
-    register_ioport_read(dev->iobase[1], 1, 1, kbd_read_status, s);
-    register_ioport_write(dev->iobase[1], 1, 1, kbd_write_command, s);
+    register_ioport_read(0x60, 1, 1, kbd_read_data, s);
+    register_ioport_write(0x60, 1, 1, kbd_write_data, s);
+    register_ioport_read(0x64, 1, 1, kbd_read_status, s);
+    register_ioport_write(0x64, 1, 1, kbd_write_command, s);
 
     s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
     s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
diff --git a/hw/ppc_prep.c b/hw/ppc_prep.c
index 8ba434d..927d404 100644
--- a/hw/ppc_prep.c
+++ b/hw/ppc_prep.c
@@ -719,7 +719,7 @@  static void ppc_prep_init (ram_addr_t ram_size,
         dinfo = drive_get(IF_FLOPPY, 0, i);
         fd[i] = dinfo ? dinfo->bdrv : NULL;
     }
-    fdctrl_init_isa(6, 2, 0x3f0, fd);
+    fdctrl_init_isa(fd);
 
     /* Register speaker port */
     register_ioport_read(0x61, 1, 1, speaker_ioport_read, NULL);
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 03855d3..b71df1f 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -617,12 +617,12 @@  static void sun4uv_init(ram_addr_t RAM_size,
 
     pci_cmd646_ide_init(pci_bus, hd, 1);
 
-    isa_create_simple("i8042", 0x60, 0x64, 1, 12);
+    isa_create_simple("i8042", 1, 12);
     for(i = 0; i < MAX_FD; i++) {
         dinfo = drive_get(IF_FLOPPY, 0, i);
         fd[i] = dinfo ? dinfo->bdrv : NULL;
     }
-    fdctrl_init_isa(6, 2, 0x3f0, fd);
+    fdctrl_init_isa(fd);
     /* FIXME: wire up interrupts.  */
     nvram = m48t59_init(NULL/*8*/, 0, 0x0074, NVRAM_SIZE, 59);