Commit 319ba9f5 authored by Jan Kiszka's avatar Jan Kiszka Committed by Anthony Liguori
Browse files

i8254: Pass alternative IRQ output object on initialization



HPET legacy emulation will require control over the PIT IRQ output. To
enable this, add support for an alternative IRQ output object to the PIT
factory function. If the isa_irq number is < 0, this object will be
used.

This also removes the IRQ number property from the PIT class as we now
use a generic GPIO output pin that is connected by the factory function.

Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent b1277b03
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -73,7 +73,7 @@ static void clipper_init(ram_addr_t ram_size,
                           clipper_pci_map_irq);

    rtc_init(isa_bus, 1980, rtc_irq);
    pit_init(isa_bus, 0x40, 0);
    pit_init(isa_bus, 0x40, 0, NULL);
    isa_create_simple(isa_bus, "i8042");

    /* VGA setup.  Don't bother loading the bios.  */
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ static void i82378_init(DeviceState *dev, I82378State *s)
    isa_bus_irqs(isabus, s->i8259);

    /* 1 82C54 (pit) */
    pit = pit_init(isabus, 0x40, 0);
    pit = pit_init(isabus, 0x40, 0, NULL);

    /* speaker */
    pcspk_init(pit);
+1 −3
Original line number Diff line number Diff line
@@ -57,7 +57,6 @@ typedef struct PITChannelState {
typedef struct PITState {
    ISADevice dev;
    MemoryRegion ioports;
    uint32_t irq;
    uint32_t iobase;
    PITChannelState channels[3];
} PITState;
@@ -532,7 +531,7 @@ static int pit_initfn(ISADevice *dev)
    s = &pit->channels[0];
    /* the timer 0 is connected to an IRQ */
    s->irq_timer = qemu_new_timer_ns(vm_clock, pit_irq_timer, s);
    s->irq = isa_get_irq(dev, pit->irq);
    qdev_init_gpio_out(&dev->qdev, &s->irq, 1);

    memory_region_init_io(&pit->ioports, &pit_ioport_ops, pit, "pit", 4);
    isa_register_ioport(dev, &pit->ioports, pit->iobase);
@@ -543,7 +542,6 @@ static int pit_initfn(ISADevice *dev)
}

static Property pit_properties[] = {
    DEFINE_PROP_UINT32("irq", PITState, irq,  -1),
    DEFINE_PROP_HEX32("iobase", PITState, iobase,  -1),
    DEFINE_PROP_END_OF_LIST(),
};
+4 −2
Original line number Diff line number Diff line
@@ -30,14 +30,16 @@

#define PIT_FREQ 1193182

static inline ISADevice *pit_init(ISABus *bus, int base, int irq)
static inline ISADevice *pit_init(ISABus *bus, int base, int isa_irq,
                                  qemu_irq alt_irq)
{
    ISADevice *dev;

    dev = isa_create(bus, "isa-pit");
    qdev_prop_set_uint32(&dev->qdev, "iobase", base);
    qdev_prop_set_uint32(&dev->qdev, "irq", irq);
    qdev_init_nofail(&dev->qdev);
    qdev_connect_gpio_out(&dev->qdev, 0,
                          isa_irq >= 0 ? isa_get_irq(dev, isa_irq) : alt_irq);

    return dev;
}
+1 −1
Original line number Diff line number Diff line
@@ -364,7 +364,7 @@ static void mips_fulong2e_init(ram_addr_t ram_size, const char *boot_device,
    smbus_eeprom_init(smbus, 1, eeprom_spd, sizeof(eeprom_spd));

    /* init other devices */
    pit = pit_init(isa_bus, 0x40, 0);
    pit = pit_init(isa_bus, 0x40, 0, NULL);
    cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
    DMA_init(0, cpu_exit_irq);

Loading