s->config = s->aux1 = s->aux2 = s->mctrl = 0;
}
-void slavio_set_power_fail(void *opaque, int power_failing)
+static void slavio_set_power_fail(void *opaque, int irq, int power_failing)
{
MiscState *s = opaque;
slavio_aux2_mem_write, s);
sysbus_init_mmio(dev, MISC_SIZE, io);
+ qdev_init_gpio_in(&dev->qdev, slavio_set_power_fail, 1);
+
register_savevm("slavio_misc", -1, 1, slavio_misc_save, slavio_misc_load,
s);
qemu_register_reset(slavio_misc_reset, s);
{
}
-static void *slavio_misc;
-
-void qemu_system_powerdown(void)
-{
- slavio_set_power_fail(slavio_misc, 1);
-}
-
static void main_cpu_reset(void *opaque)
{
CPUState *env = opaque;
#define MISC_MDM 0x01b00000
#define MISC_SYS 0x01f00000
-static void *slavio_misc_init(target_phys_addr_t base,
- target_phys_addr_t aux1_base,
- target_phys_addr_t aux2_base, qemu_irq irq,
- qemu_irq fdc_tc)
+static qemu_irq slavio_powerdown;
+
+void qemu_system_powerdown(void)
+{
+ qemu_irq_raise(slavio_powerdown);
+}
+
+static void slavio_misc_init(target_phys_addr_t base,
+ target_phys_addr_t aux1_base,
+ target_phys_addr_t aux2_base, qemu_irq irq,
+ qemu_irq fdc_tc)
{
DeviceState *dev;
SysBusDevice *s;
}
sysbus_connect_irq(s, 0, irq);
sysbus_connect_irq(s, 1, fdc_tc);
-
- return s;
+ slavio_powerdown = qdev_get_gpio_in(dev, 0);
}
static void ecc_init(target_phys_addr_t base, qemu_irq irq, uint32_t version)
serial_hds[0], serial_hds[1], ESCC_CLOCK, 1);
cpu_halt = qemu_allocate_irqs(cpu_halt_signal, NULL, 1);
- slavio_misc = slavio_misc_init(hwdef->slavio_base,
- hwdef->aux1_base, hwdef->aux2_base,
- slavio_irq[30], fdc_tc);
+ slavio_misc_init(hwdef->slavio_base, hwdef->aux1_base, hwdef->aux2_base,
+ slavio_irq[30], fdc_tc);
+
if (hwdef->apc_base) {
apc_init(hwdef->apc_base, cpu_halt[0]);
}
slavio_irq[1], serial_hds[0], serial_hds[1],
ESCC_CLOCK, 1);
- slavio_misc = slavio_misc_init(0, hwdef->aux1_base, 0,
- slavio_irq[1], fdc_tc);
+ slavio_misc_init(0, hwdef->aux1_base, 0, slavio_irq[1], fdc_tc);
if (hwdef->fd_base != (target_phys_addr_t)-1) {
/* there is zero or one floppy drive */