21 #include <linux/timex.h>
22 #include <linux/errno.h>
24 #include <linux/pci.h>
35 static inline u32 read_pmtmr(
void)
82 __setup(
"acpi_pm_good", acpi_pm_good_setup);
89 static inline void acpi_pm_need_workaround(
void)
91 clocksource_acpi_pm.
read = acpi_pm_read_slow;
92 clocksource_acpi_pm.
rating = 120;
113 " Due to workarounds for a bug,\n"
114 "* this clock source is slow. Consider trying"
115 " other clock sources\n");
117 acpi_pm_need_workaround();
121 acpi_pm_check_blacklist);
129 " workarounds for a bug,\n"
130 "* this clock source is slow. If you are sure your timer"
132 "* this bug, please use \"acpi_pm_good\" to disable the"
135 acpi_pm_need_workaround();
138 acpi_pm_check_graylist);
140 acpi_pm_check_graylist);
143 #ifndef CONFIG_X86_64
145 #define PMTMR_EXPECTED_RATE \
146 ((CALIBRATE_LATCH * (PMTMR_TICKS_PER_SEC >> 10)) / (PIT_TICK_RATE>>10))
151 static int verify_pmtmr_rate(
void)
156 mach_prepare_counter();
157 value1 = clocksource_acpi_pm.
read(&clocksource_acpi_pm);
158 mach_countup(&count);
159 value2 = clocksource_acpi_pm.
read(&clocksource_acpi_pm);
166 "of normal - aborting.\n",
174 #define verify_pmtmr_rate() (0)
178 #define ACPI_PM_MONOTONICITY_CHECKS 10
180 #define ACPI_PM_READ_CHECKS 10000
182 static int __init init_acpi_pm_clocksource(
void)
185 unsigned int i,
j = 0;
193 value1 = clocksource_acpi_pm.
read(&clocksource_acpi_pm);
195 value2 = clocksource_acpi_pm.
read(&clocksource_acpi_pm);
196 if (value2 == value1)
200 if ((value2 < value1) && ((value2) < 0xFFF))
203 " 0x%#llx, 0x%#llx - aborting.\n",
208 if (i == ACPI_PM_READ_CHECKS) {
210 " (0x%#llx) - aborting.\n", value1);
216 if (verify_pmtmr_rate() != 0){
221 return clocksource_register_hz(&clocksource_acpi_pm,
250 __setup(
"pmtmr=", parse_pmtmr);