summaryrefslogtreecommitdiff
path: root/hw/acpi.c
diff options
context:
space:
mode:
authorBlue Swirl <blauwirbel@gmail.com>2009-08-09 08:42:19 +0000
committerBlue Swirl <blauwirbel@gmail.com>2009-08-09 08:42:19 +0000
commitead41da7bc694f9803c87b26986d465bb1ba4e32 (patch)
treef00d2747772fbf49fcc46cefcd8f30bec97154a2 /hw/acpi.c
parent853e9ed11c14d5f5be09f812b85e9a7aa8eb773d (diff)
downloadqemu-ead41da7bc694f9803c87b26986d465bb1ba4e32.tar.gz
qemu-ead41da7bc694f9803c87b26986d465bb1ba4e32.tar.bz2
qemu-ead41da7bc694f9803c87b26986d465bb1ba4e32.zip
Use qemu_irq for system_powerdown
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Diffstat (limited to 'hw/acpi.c')
-rw-r--r--hw/acpi.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/hw/acpi.c b/hw/acpi.c
index 056e4c6344..37a5d9823b 100644
--- a/hw/acpi.c
+++ b/hw/acpi.c
@@ -496,6 +496,20 @@ static void piix4_reset(void *opaque)
}
}
+static void piix4_powerdown(void *opaque, int irq, int power_failing)
+{
+#if defined(TARGET_I386)
+ PIIX4PMState *s = opaque;
+
+ if (!s) {
+ qemu_system_shutdown_request();
+ } else if (s->pmen & PWRBTN_EN) {
+ s->pmsts |= PWRBTN_EN;
+ pm_update_sci(s);
+ }
+#endif
+}
+
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
qemu_irq sci_irq)
{
@@ -545,6 +559,8 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
s->tmr_timer = qemu_new_timer(vm_clock, pm_tmr_timer, s);
+ qemu_system_powerdown = *qemu_allocate_irqs(piix4_powerdown, s, 1);
+
register_savevm("piix4_pm", 0, 1, pm_save, pm_load, s);
s->smbus = i2c_init_bus(NULL, "i2c");
@@ -554,18 +570,6 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
return s->smbus;
}
-#if defined(TARGET_I386)
-void qemu_system_powerdown(void)
-{
- if (!pm_state) {
- qemu_system_shutdown_request();
- } else if (pm_state->pmen & PWRBTN_EN) {
- pm_state->pmsts |= PWRBTN_EN;
- pm_update_sci(pm_state);
- }
-}
-#endif
-
#define GPE_BASE 0xafe0
#define PCI_BASE 0xae00
#define PCI_EJ_BASE 0xae08