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: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Jan Kiszka 2012-02-01 20:31:40 +01:00 committed by Anthony Liguori
parent b1277b03d4
commit 319ba9f527
9 changed files with 12 additions and 12 deletions

View File

@ -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. */

View File

@ -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);

View File

@ -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(),
};

View File

@ -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;
}

View File

@ -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);

View File

@ -192,7 +192,7 @@ static void mips_jazz_init(MemoryRegion *address_space,
isa_bus_irqs(isa_bus, i8259);
cpu_exit_irq = qemu_allocate_irqs(cpu_request_exit, NULL, 1);
DMA_init(0, cpu_exit_irq);
pit = pit_init(isa_bus, 0x40, 0);
pit = pit_init(isa_bus, 0x40, 0, NULL);
pcspk_init(pit);
/* ISA IO space at 0x90000000 */

View File

@ -970,7 +970,7 @@ void mips_malta_init (ram_addr_t ram_size,
isa_get_irq(NULL, 9), NULL, NULL, 0);
/* TODO: Populate SPD eeprom data. */
smbus_eeprom_init(smbus, 8, NULL, 0);
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);

View File

@ -270,7 +270,7 @@ void mips_r4k_init (ram_addr_t ram_size,
isa_mmio_init(0x14000000, 0x00010000);
isa_mem_base = 0x10000000;
pit = pit_init(isa_bus, 0x40, 0);
pit = pit_init(isa_bus, 0x40, 0, NULL);
for(i = 0; i < MAX_SERIAL_PORTS; i++) {
if (serial_hds[i]) {

View File

@ -1162,7 +1162,7 @@ void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
qemu_register_boot_set(pc_boot_set, *rtc_state);
pit = pit_init(isa_bus, 0x40, 0);
pit = pit_init(isa_bus, 0x40, 0, NULL);
pcspk_init(pit);
for(i = 0; i < MAX_SERIAL_PORTS; i++) {