summaryrefslogtreecommitdiff
path: root/arch/x86_64/kernel/pmtimer.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64/kernel/pmtimer.c')
-rw-r--r--arch/x86_64/kernel/pmtimer.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/pmtimer.c b/arch/x86_64/kernel/pmtimer.c
index 8b2655ae4e61..5c51d10408a6 100644
--- a/arch/x86_64/kernel/pmtimer.c
+++ b/arch/x86_64/kernel/pmtimer.c
@@ -80,6 +80,26 @@ int pmtimer_mark_offset(void)
return lost - 1;
}
+static unsigned pmtimer_wait_tick(void)
+{
+ u32 a, b;
+ for (a = b = inl(pmtmr_ioport) & ACPI_PM_MASK;
+ a == b;
+ b = inl(pmtmr_ioport) & ACPI_PM_MASK)
+ ;
+ return b;
+}
+
+/* note: wait time is rounded up to one tick */
+void pmtimer_wait(unsigned us)
+{
+ u32 a, b;
+ a = pmtimer_wait_tick();
+ do {
+ b = inl(pmtmr_ioport);
+ } while (cyc2us(b - a) < us);
+}
+
void pmtimer_resume(void)
{
last_pmtmr_tick = inl(pmtmr_ioport);