Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 43490
b: refs/heads/master
c: 562f9c5
h: refs/heads/master
v: v3
  • Loading branch information
john stultz authored and Linus Torvalds committed Dec 8, 2006
1 parent 8f88b93 commit bf08004
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a2ee8649ba6d71416712e798276bf7c40b64e6e5
refs/heads/master: 562f9c574e0707f9159a729ea41faf53b221cd30
36 changes: 36 additions & 0 deletions trunk/drivers/clocksource/acpi_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,39 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
acpi_pm_check_graylist);
#endif

#ifndef CONFIG_X86_64
#include "mach_timer.h"
#define PMTMR_EXPECTED_RATE \
((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (CLOCK_TICK_RATE>>10))
/*
* Some boards have the PMTMR running way too fast. We check
* the PMTMR rate against PIT channel 2 to catch these cases.
*/
static int verify_pmtmr_rate(void)
{
u32 value1, value2;
unsigned long count, delta;

mach_prepare_counter();
value1 = read_pmtmr();
mach_countup(&count);
value2 = read_pmtmr();
delta = (value2 - value1) & ACPI_PM_MASK;

/* Check that the PMTMR delta is within 5% of what we expect */
if (delta < (PMTMR_EXPECTED_RATE * 19) / 20 ||
delta > (PMTMR_EXPECTED_RATE * 21) / 20) {
printk(KERN_INFO "PM-Timer running at invalid rate: %lu%% "
"of normal - aborting.\n",
100UL * delta / PMTMR_EXPECTED_RATE);
return -1;
}

return 0;
}
#else
#define verify_pmtmr_rate() (0)
#endif

static int __init init_acpi_pm_clocksource(void)
{
Expand Down Expand Up @@ -173,6 +206,9 @@ static int __init init_acpi_pm_clocksource(void)
return -ENODEV;

pm_good:
if (verify_pmtmr_rate() != 0)
return -ENODEV;

return clocksource_register(&clocksource_acpi_pm);
}

Expand Down

0 comments on commit bf08004

Please sign in to comment.