aboutsummaryrefslogtreecommitdiff
path: root/hw/acpi/core.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2013-12-13 17:22:07 +0100
committerMichael S. Tsirkin <mst@redhat.com>2013-12-23 13:12:34 +0200
commit063135032808700a5a6b0b4a781f31252da2e762 (patch)
tree3a7f9a09c87b420ccaa6de96269a0c724f652f56 /hw/acpi/core.c
parente4f308bbf9f360ee2af5b94b87aef170d8f20dc4 (diff)
acpi: factor out common pm_update_sci() into acpi core
... and rename it into acpi_update_sci() since it changes SCI on only on PM registers status. Signed-off-by: Igor Mammedov <imammedo@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/acpi/core.c')
-rw-r--r--hw/acpi/core.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/hw/acpi/core.c b/hw/acpi/core.c
index 58308a3406..79414b44c7 100644
--- a/hw/acpi/core.c
+++ b/hw/acpi/core.c
@@ -662,3 +662,21 @@ uint32_t acpi_gpe_ioport_readb(ACPIREGS *ar, uint32_t addr)
return val;
}
+
+void acpi_update_sci(ACPIREGS *regs, qemu_irq irq)
+{
+ int sci_level, pm1a_sts;
+
+ pm1a_sts = acpi_pm1_evt_get_sts(regs);
+
+ sci_level = ((pm1a_sts &
+ regs->pm1.evt.en & ACPI_BITMASK_PM1_COMMON_ENABLED) != 0) ||
+ ((regs->gpe.sts[0] & regs->gpe.en[0]) != 0);
+
+ qemu_set_irq(irq, sci_level);
+
+ /* schedule a timer interruption if needed */
+ acpi_pm_tmr_update(regs,
+ (regs->pm1.evt.en & ACPI_BITMASK_TIMER_ENABLE) &&
+ !(pm1a_sts & ACPI_BITMASK_TIMER_STATUS));
+}