q800: move VIA2 device to Q800MachineState
Also change the instantiation of the VIA2 device to use object_initialize_child(). Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20230621085353.113233-14-mark.cave-ayland@ilande.co.uk> Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
parent
6d32c0643f
commit
d7942e166a
|
@ -212,7 +212,6 @@ static void q800_machine_init(MachineState *machine)
|
|||
hwaddr parameters_base;
|
||||
CPUState *cs;
|
||||
DeviceState *dev;
|
||||
DeviceState *via2_dev;
|
||||
DeviceState *escc_orgate;
|
||||
SysBusESPState *sysbus_esp;
|
||||
ESPState *esp;
|
||||
|
@ -285,9 +284,10 @@ static void q800_machine_init(MachineState *machine)
|
|||
qdev_realize_and_unref(dev, adb_bus, &error_fatal);
|
||||
|
||||
/* VIA 2 */
|
||||
via2_dev = qdev_new(TYPE_MOS6522_Q800_VIA2);
|
||||
sysbus = SYS_BUS_DEVICE(via2_dev);
|
||||
sysbus_realize_and_unref(sysbus, &error_fatal);
|
||||
object_initialize_child(OBJECT(machine), "via2", &m->via2,
|
||||
TYPE_MOS6522_Q800_VIA2);
|
||||
sysbus = SYS_BUS_DEVICE(&m->via2);
|
||||
sysbus_realize(sysbus, &error_fatal);
|
||||
memory_region_add_subregion(&m->macio, VIA_BASE - IO_BASE + VIA_SIZE,
|
||||
sysbus_mmio_get_region(sysbus, 1));
|
||||
sysbus_connect_irq(sysbus, 0,
|
||||
|
@ -382,9 +382,13 @@ static void q800_machine_init(MachineState *machine)
|
|||
sysbus = SYS_BUS_DEVICE(dev);
|
||||
sysbus_realize_and_unref(sysbus, &error_fatal);
|
||||
/* SCSI and SCSI data IRQs are negative edge triggered */
|
||||
sysbus_connect_irq(sysbus, 0, qemu_irq_invert(qdev_get_gpio_in(via2_dev,
|
||||
sysbus_connect_irq(sysbus, 0,
|
||||
qemu_irq_invert(
|
||||
qdev_get_gpio_in(DEVICE(&m->via2),
|
||||
VIA2_IRQ_SCSI_BIT)));
|
||||
sysbus_connect_irq(sysbus, 1, qemu_irq_invert(qdev_get_gpio_in(via2_dev,
|
||||
sysbus_connect_irq(sysbus, 1,
|
||||
qemu_irq_invert(
|
||||
qdev_get_gpio_in(DEVICE(&m->via2),
|
||||
VIA2_IRQ_SCSI_DATA_BIT)));
|
||||
memory_region_add_subregion(&m->macio, ESP_BASE - IO_BASE,
|
||||
sysbus_mmio_get_region(sysbus, 0));
|
||||
|
@ -411,11 +415,12 @@ static void q800_machine_init(MachineState *machine)
|
|||
sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE +
|
||||
MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE);
|
||||
qdev_connect_gpio_out(dev, 9,
|
||||
qdev_get_gpio_in_named(via2_dev, "nubus-irq",
|
||||
qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-irq",
|
||||
VIA2_NUBUS_IRQ_INTVIDEO));
|
||||
for (i = 1; i < VIA2_NUBUS_IRQ_NB; i++) {
|
||||
qdev_connect_gpio_out(dev, 9 + i,
|
||||
qdev_get_gpio_in_named(via2_dev, "nubus-irq",
|
||||
qdev_get_gpio_in_named(DEVICE(&m->via2),
|
||||
"nubus-irq",
|
||||
VIA2_NUBUS_IRQ_9 + i));
|
||||
}
|
||||
|
||||
|
@ -424,7 +429,7 @@ static void q800_machine_init(MachineState *machine)
|
|||
* IRQ via GLUE for use by SONIC Ethernet in classic mode
|
||||
*/
|
||||
qdev_connect_gpio_out(DEVICE(&m->glue), GLUE_IRQ_NUBUS_9,
|
||||
qdev_get_gpio_in_named(via2_dev, "nubus-irq",
|
||||
qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-irq",
|
||||
VIA2_NUBUS_IRQ_9));
|
||||
|
||||
nubus = &NUBUS_BRIDGE(dev)->bus;
|
||||
|
|
|
@ -41,6 +41,7 @@ struct Q800MachineState {
|
|||
MemoryRegion rom;
|
||||
GLUEState glue;
|
||||
MOS6522Q800VIA1State via1;
|
||||
MOS6522Q800VIA2State via2;
|
||||
MemoryRegion macio;
|
||||
MemoryRegion macio_alias;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue