summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-08-09 07:27:29 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-08-09 07:27:29 +0000
commitb2b6f6ec3996925ebc85e77c5ac31ff34e8783f6 (patch)
tree80fa3584ac178ca7cc2aa89021e5295744473b83 /hw
parent74ff8d90a11bdcbfabf0da10e4556cf139c096f7 (diff)
Sparc32: use qemu_irq for system_powerdown
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw')
-rw-r--r--hw/slavio_misc.c4
-rw-r--r--hw/sun4m.c34
-rw-r--r--hw/sun4m.h3
3 files changed, 19 insertions, 22 deletions
diff --git a/hw/slavio_misc.c b/hw/slavio_misc.c
index 5dbdd7a20..c8dcd3338 100644
--- a/hw/slavio_misc.c
+++ b/hw/slavio_misc.c
@@ -95,7 +95,7 @@ static void slavio_misc_reset(void *opaque)
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;
@@ -492,6 +492,8 @@ static void slavio_misc_init1(SysBusDevice *dev)
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);
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 101c56b1b..5e47240af 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -268,13 +268,6 @@ static void dummy_cpu_set_irq(void *opaque, int irq, int level)
{
}
-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;
@@ -458,10 +451,17 @@ static void slavio_timer_init_all(target_phys_addr_t addr, qemu_irq master_irq,
#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;
@@ -494,8 +494,7 @@ static void *slavio_misc_init(target_phys_addr_t base,
}
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)
@@ -826,9 +825,9 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
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]);
}
@@ -1615,8 +1614,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
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 */
diff --git a/hw/sun4m.h b/hw/sun4m.h
index e015b09e7..9f540920a 100644
--- a/hw/sun4m.h
+++ b/hw/sun4m.h
@@ -30,9 +30,6 @@ void slavio_irq_info(Monitor *mon, void *opaque);
void sun4c_pic_info(Monitor *mon, void *opaque);
void sun4c_irq_info(Monitor *mon, void *opaque);
-/* slavio_misc.c */
-void slavio_set_power_fail(void *opaque, int power_failing);
-
/* sparc32_dma.c */
#include "sparc32_dma.h"