diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-09-05 17:05:33 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-06 09:33:31 -0400 |
commit | dfdf748a61a21b7397b9f57c83de722de71dc56a (patch) | |
tree | 78fce25782a3a313a4d8db4464a849e66cc77fa8 /drivers/clocksource/acpi_pm.c | |
parent | 4ff4b9e19a80b73959ebeb28d1df40176686f0a8 (diff) |
clocksource, acpi_pm.c: use proper read function also in errata mode
On all hardware (some Intel ICH4, PIIX4 and PIIX4E chipsets) affected by a
hardware errata there's about a 4.2% chance that initialization of the
ACPI PMTMR fails. On those chipsets, we need to read out the timer value
at least three times to get a correct result, for every once in a while
(i.e. within a 3 ns window every 69.8 ns) the read returns a bogus
result. During normal operation we work around this issue, but during
initialization reading a bogus value may lead to -EINVAL even though the
hardware is usable.
Thanks to Andreas Mohr for spotting this issue.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/clocksource/acpi_pm.c')
-rw-r--r-- | drivers/clocksource/acpi_pm.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/clocksource/acpi_pm.c b/drivers/clocksource/acpi_pm.c index 5ca1d80de182..860d033bc74f 100644 --- a/drivers/clocksource/acpi_pm.c +++ b/drivers/clocksource/acpi_pm.c | |||
@@ -151,13 +151,13 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE, | |||
151 | */ | 151 | */ |
152 | static int verify_pmtmr_rate(void) | 152 | static int verify_pmtmr_rate(void) |
153 | { | 153 | { |
154 | u32 value1, value2; | 154 | cycle_t value1, value2; |
155 | unsigned long count, delta; | 155 | unsigned long count, delta; |
156 | 156 | ||
157 | mach_prepare_counter(); | 157 | mach_prepare_counter(); |
158 | value1 = read_pmtmr(); | 158 | value1 = clocksource_acpi_pm.read(); |
159 | mach_countup(&count); | 159 | mach_countup(&count); |
160 | value2 = read_pmtmr(); | 160 | value2 = clocksource_acpi_pm.read(); |
161 | delta = (value2 - value1) & ACPI_PM_MASK; | 161 | delta = (value2 - value1) & ACPI_PM_MASK; |
162 | 162 | ||
163 | /* Check that the PMTMR delta is within 5% of what we expect */ | 163 | /* Check that the PMTMR delta is within 5% of what we expect */ |
@@ -177,7 +177,7 @@ static int verify_pmtmr_rate(void) | |||
177 | 177 | ||
178 | static int __init init_acpi_pm_clocksource(void) | 178 | static int __init init_acpi_pm_clocksource(void) |
179 | { | 179 | { |
180 | u32 value1, value2; | 180 | cycle_t value1, value2; |
181 | unsigned int i; | 181 | unsigned int i; |
182 | 182 | ||
183 | if (!pmtmr_ioport) | 183 | if (!pmtmr_ioport) |
@@ -187,9 +187,9 @@ static int __init init_acpi_pm_clocksource(void) | |||
187 | clocksource_acpi_pm.shift); | 187 | clocksource_acpi_pm.shift); |
188 | 188 | ||
189 | /* "verify" this timing source: */ | 189 | /* "verify" this timing source: */ |
190 | value1 = read_pmtmr(); | 190 | value1 = clocksource_acpi_pm.read(); |
191 | for (i = 0; i < 10000; i++) { | 191 | for (i = 0; i < 10000; i++) { |
192 | value2 = read_pmtmr(); | 192 | value2 = clocksource_acpi_pm.read(); |
193 | if (value2 == value1) | 193 | if (value2 == value1) |
194 | continue; | 194 | continue; |
195 | if (value2 > value1) | 195 | if (value2 > value1) |
@@ -197,11 +197,11 @@ static int __init init_acpi_pm_clocksource(void) | |||
197 | if ((value2 < value1) && ((value2) < 0xFFF)) | 197 | if ((value2 < value1) && ((value2) < 0xFFF)) |
198 | goto pm_good; | 198 | goto pm_good; |
199 | printk(KERN_INFO "PM-Timer had inconsistent results:" | 199 | printk(KERN_INFO "PM-Timer had inconsistent results:" |
200 | " 0x%#x, 0x%#x - aborting.\n", value1, value2); | 200 | " 0x%#llx, 0x%#llx - aborting.\n", value1, value2); |
201 | return -EINVAL; | 201 | return -EINVAL; |
202 | } | 202 | } |
203 | printk(KERN_INFO "PM-Timer had no reasonable result:" | 203 | printk(KERN_INFO "PM-Timer had no reasonable result:" |
204 | " 0x%#x - aborting.\n", value1); | 204 | " 0x%#llx - aborting.\n", value1); |
205 | return -ENODEV; | 205 | return -ENODEV; |
206 | 206 | ||
207 | pm_good: | 207 | pm_good: |