diff options
-rw-r--r-- | hw/fdc.c | 6 | ||||
-rw-r--r-- | hw/isa-bus.c | 38 | ||||
-rw-r--r-- | hw/isa.h | 6 | ||||
-rw-r--r-- | hw/mips_malta.c | 2 | ||||
-rw-r--r-- | hw/pc.c | 2 | ||||
-rw-r--r-- | hw/pckbd.c | 4 | ||||
-rw-r--r-- | hw/sun4u.c | 2 |
7 files changed, 21 insertions, 39 deletions
@@ -1875,10 +1875,9 @@ 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", isairq, -1); + dev = isa_create_simple("isa-fdc"); fdctrl = &(DO_UPCAST(fdctrl_isabus_t, busdev, dev)->state); fdctrl->dma_chann = dma_chann; @@ -1969,6 +1968,7 @@ 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; + int isairq = 6; register_ioport_read(iobase + 0x01, 5, 1, &fdctrl_read_port, fdctrl); @@ -1978,7 +1978,7 @@ static int isabus_fdc_init1(ISADevice *dev) &fdctrl_write_port, fdctrl); register_ioport_write(iobase + 0x07, 1, 1, &fdctrl_write_port, fdctrl); - isa_init_irq(&isa->busdev, &fdctrl->irq); + isa_init_irq(&isa->busdev, &fdctrl->irq, isairq); return fdctrl_init_common(fdctrl); } diff --git a/hw/isa-bus.c b/hw/isa-bus.c index fde066a..bfd0fff 100644 --- a/hw/isa-bus.c +++ b/hw/isa-bus.c @@ -57,20 +57,6 @@ void isa_bus_irqs(qemu_irq *irqs) isabus->irqs = irqs; } -void isa_connect_irq(ISADevice *dev, int devnr, int isairq) -{ - assert(devnr >= 0 && devnr < dev->nirqs); - if (isabus->assigned & (1 << isairq)) { - fprintf(stderr, "isa irq %d already assigned\n", isairq); - exit(1); - } - if (dev->irqs[devnr]) { - isabus->assigned |= (1 << isairq); - dev->isairq[devnr] = isairq; - *dev->irqs[devnr] = isabus->irqs[isairq]; - } -} - /* * isa_reserve_irq() reserves the ISA irq and returns the corresponding * qemu_irq entry for the i8259. @@ -92,10 +78,16 @@ qemu_irq isa_reserve_irq(int isairq) return isabus->irqs[isairq]; } -void isa_init_irq(ISADevice *dev, qemu_irq *p) +void isa_init_irq(ISADevice *dev, qemu_irq *p, int isairq) { - assert(dev->nirqs < ARRAY_SIZE(dev->irqs)); - dev->irqs[dev->nirqs] = p; + assert(dev->nirqs < ARRAY_SIZE(dev->isairq)); + if (isabus->assigned & (1 << isairq)) { + fprintf(stderr, "isa irq %d already assigned\n", isairq); + exit(1); + } + isabus->assigned |= (1 << isairq); + dev->isairq[dev->nirqs] = isairq; + *p = isabus->irqs[isairq]; dev->nirqs++; } @@ -117,25 +109,17 @@ void isa_qdev_register(ISADeviceInfo *info) qdev_register(&info->qdev); } -ISADevice *isa_create_simple(const char *name, uint32_t irq, uint32 irq2) +ISADevice *isa_create_simple(const char *name) { DeviceState *dev; - ISADevice *isa; if (!isabus) { fprintf(stderr, "Tried to create isa device %s with no isa bus present.\n", name); return NULL; } dev = qdev_create(&isabus->qbus, name); - isa = DO_UPCAST(ISADevice, qdev, dev); qdev_init(dev); - if (irq != -1) { - isa_connect_irq(isa, 0, irq); - } - if (irq2 != -1) { - isa_connect_irq(isa, 1, irq2); - } - return isa; + return DO_UPCAST(ISADevice, qdev, dev); } static void isabus_dev_print(Monitor *mon, DeviceState *dev, int indent) @@ -13,7 +13,6 @@ typedef struct ISADeviceInfo ISADeviceInfo; struct ISADevice { DeviceState qdev; uint32_t isairq[2]; - qemu_irq *irqs[2]; int nirqs; }; @@ -25,11 +24,10 @@ struct ISADeviceInfo { ISABus *isa_bus_new(DeviceState *dev); void isa_bus_irqs(qemu_irq *irqs); -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_init_irq(ISADevice *dev, qemu_irq *p, int isairq); void isa_qdev_register(ISADeviceInfo *info); -ISADevice *isa_create_simple(const char *name, uint32_t irq, uint32_t irq2); +ISADevice *isa_create_simple(const char *name); extern target_phys_addr_t isa_mem_base; diff --git a/hw/mips_malta.c b/hw/mips_malta.c index 3222e16..32c7102 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", 1, 12); + isa_dev = isa_create_simple("i8042"); rtc_state = rtc_init(0x70, isa_reserve_irq(8), 2000); serial_init(0x3f8, isa_reserve_irq(4), 115200, serial_hds[0]); @@ -1373,7 +1373,7 @@ static void pc_init1(ram_addr_t ram_size, } } - isa_dev = isa_create_simple("i8042", 1, 12); + isa_dev = isa_create_simple("i8042"); DMA_init(0); #ifdef HAS_AUDIO audio_init(pci_enabled ? pci_bus : NULL, isa_irq); @@ -450,8 +450,8 @@ static int i8042_initfn(ISADevice *dev) { KBDState *s = &(DO_UPCAST(ISAKBDState, dev, dev)->kbd); - isa_init_irq(dev, &s->irq_kbd); - isa_init_irq(dev, &s->irq_mouse); + isa_init_irq(dev, &s->irq_kbd, 1); + isa_init_irq(dev, &s->irq_mouse, 12); kbd_reset(s); register_savevm("pckbd", 0, 3, kbd_save, kbd_load, s); @@ -617,7 +617,7 @@ static void sun4uv_init(ram_addr_t RAM_size, pci_cmd646_ide_init(pci_bus, hd, 1); - isa_create_simple("i8042", 1, 12); + isa_create_simple("i8042"); for(i = 0; i < MAX_FD; i++) { dinfo = drive_get(IF_FLOPPY, 0, i); fd[i] = dinfo ? dinfo->bdrv : NULL; |