diff options
Diffstat (limited to 'arch/x86_64/kernel/pmtimer.c')
-rw-r--r-- | arch/x86_64/kernel/pmtimer.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/arch/x86_64/kernel/pmtimer.c b/arch/x86_64/kernel/pmtimer.c index feb5f108dd26..5c51d10408a6 100644 --- a/arch/x86_64/kernel/pmtimer.c +++ b/arch/x86_64/kernel/pmtimer.c | |||
@@ -80,6 +80,31 @@ int pmtimer_mark_offset(void) | |||
80 | return lost - 1; | 80 | return lost - 1; |
81 | } | 81 | } |
82 | 82 | ||
83 | static unsigned pmtimer_wait_tick(void) | ||
84 | { | ||
85 | u32 a, b; | ||
86 | for (a = b = inl(pmtmr_ioport) & ACPI_PM_MASK; | ||
87 | a == b; | ||
88 | b = inl(pmtmr_ioport) & ACPI_PM_MASK) | ||
89 | ; | ||
90 | return b; | ||
91 | } | ||
92 | |||
93 | /* note: wait time is rounded up to one tick */ | ||
94 | void pmtimer_wait(unsigned us) | ||
95 | { | ||
96 | u32 a, b; | ||
97 | a = pmtimer_wait_tick(); | ||
98 | do { | ||
99 | b = inl(pmtmr_ioport); | ||
100 | } while (cyc2us(b - a) < us); | ||
101 | } | ||
102 | |||
103 | void pmtimer_resume(void) | ||
104 | { | ||
105 | last_pmtmr_tick = inl(pmtmr_ioport); | ||
106 | } | ||
107 | |||
83 | unsigned int do_gettimeoffset_pm(void) | 108 | unsigned int do_gettimeoffset_pm(void) |
84 | { | 109 | { |
85 | u32 now, offset, delta = 0; | 110 | u32 now, offset, delta = 0; |