summary refs log tree commit diff stats
path: root/hw/acpi.h
diff options
context:
space:
mode:
authorIsaku Yamahata <yamahata@valinux.co.jp>2011-03-25 19:54:38 +0900
committerAurelien Jarno <aurelien@aurel32.net>2011-04-09 18:39:05 +0200
commita54d41a8b985cc7ff9d4bc52e6ca20a09216b394 (patch)
tree5ee739f336ffaff9ba0d008bef2c0b165528de3d /hw/acpi.h
parent5145b3d1cc4dc77d82086d99b0690a76e1073071 (diff)
downloadfocaccia-qemu-a54d41a8b985cc7ff9d4bc52e6ca20a09216b394.tar.gz
focaccia-qemu-a54d41a8b985cc7ff9d4bc52e6ca20a09216b394.zip
acpi, acpi_piix, vt82c686: factor out PM_TMR logic
factor out PM_TMR logic. Later This will be used by ich9 acpi.
Also fixes the same bug in vt82c686.c that was fixed by the following
commits.

> commit 055479feab63607b8042bb8ebb2e0523f17cbc4e
> Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
> Date:   Wed Jan 21 16:31:20 2009 +0000
>
>     Always return latest pmsts instead of the old one (Xiantao Zhang)
>
>     It may lead to the issue when booting windows guests with acpi=1
>     if return the old pmsts.
>
>     Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
>     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Diffstat (limited to 'hw/acpi.h')
-rw-r--r--hw/acpi.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/hw/acpi.h b/hw/acpi.h
index 5949958067..fc425012b3 100644
--- a/hw/acpi.h
+++ b/hw/acpi.h
@@ -74,5 +74,29 @@
 #define ACPI_BITMASK_ARB_DISABLE                0x0001
 
 /* PM_TMR */
+struct ACPIPMTimer;
+typedef struct ACPIPMTimer ACPIPMTimer;
+
+typedef void (*acpi_update_sci_fn)(ACPIPMTimer *tmr);
+
+struct ACPIPMTimer {
+    QEMUTimer *timer;
+    int64_t overflow_time;
+
+    acpi_update_sci_fn update_sci;
+};
+
+void acpi_pm_tmr_update(ACPIPMTimer *tmr, bool enable);
+void acpi_pm_tmr_calc_overflow_time(ACPIPMTimer *tmr);
+uint32_t acpi_pm_tmr_get(ACPIPMTimer *tmr);
+void acpi_pm_tmr_init(ACPIPMTimer *tmr, acpi_update_sci_fn update_sci);
+void acpi_pm_tmr_reset(ACPIPMTimer *tmr);
+
+#include "qemu-timer.h"
+static inline int64_t acpi_pm_tmr_get_clock(void)
+{
+    return muldiv64(qemu_get_clock_ns(vm_clock), PM_TIMER_FREQUENCY,
+                    get_ticks_per_sec());
+}
 
 #endif /* !QEMU_HW_ACPI_H */