Skip to content

Commit dfdf748

Browse files
Dominik BrodowskiIngo Molnar
authored andcommitted
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 <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
1 parent 4ff4b9e commit dfdf748

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

drivers/clocksource/acpi_pm.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_LE,
151151
*/
152152
static int verify_pmtmr_rate(void)
153153
{
154-
u32 value1, value2;
154+
cycle_t value1, value2;
155155
unsigned long count, delta;
156156

157157
mach_prepare_counter();
158-
value1 = read_pmtmr();
158+
value1 = clocksource_acpi_pm.read();
159159
mach_countup(&count);
160-
value2 = read_pmtmr();
160+
value2 = clocksource_acpi_pm.read();
161161
delta = (value2 - value1) & ACPI_PM_MASK;
162162

163163
/* Check that the PMTMR delta is within 5% of what we expect */
@@ -177,7 +177,7 @@ static int verify_pmtmr_rate(void)
177177

178178
static int __init init_acpi_pm_clocksource(void)
179179
{
180-
u32 value1, value2;
180+
cycle_t value1, value2;
181181
unsigned int i;
182182

183183
if (!pmtmr_ioport)
@@ -187,21 +187,21 @@ static int __init init_acpi_pm_clocksource(void)
187187
clocksource_acpi_pm.shift);
188188

189189
/* "verify" this timing source: */
190-
value1 = read_pmtmr();
190+
value1 = clocksource_acpi_pm.read();
191191
for (i = 0; i < 10000; i++) {
192-
value2 = read_pmtmr();
192+
value2 = clocksource_acpi_pm.read();
193193
if (value2 == value1)
194194
continue;
195195
if (value2 > value1)
196196
goto pm_good;
197197
if ((value2 < value1) && ((value2) < 0xFFF))
198198
goto pm_good;
199199
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);
201201
return -EINVAL;
202202
}
203203
printk(KERN_INFO "PM-Timer had no reasonable result:"
204-
" 0x%#x - aborting.\n", value1);
204+
" 0x%#llx - aborting.\n", value1);
205205
return -ENODEV;
206206

207207
pm_good:

0 commit comments

Comments
 (0)