acpi_timer.c (220336) | acpi_timer.c (220369) |
---|---|
1/*- 2 * Copyright (c) 2000, 2001 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2000, 2001 Michael Smith 3 * Copyright (c) 2000 BSDi 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_timer.c 220336 2011-04-04 17:44:26Z jkim $"); | 29__FBSDID("$FreeBSD: head/sys/dev/acpica/acpi_timer.c 220369 2011-04-05 18:40:19Z jkim $"); |
30 31#include "opt_acpi.h" 32#include <sys/param.h> 33#include <sys/bus.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/timetc.h> --- 263 unchanged lines hidden (view full) --- 301 * ] Workaround: Read the register twice and compare. 302 * ] Status: This will not be fixed in the PIIX4 or PIIX4E, it is fixed 303 * ] in the PIIX4M. 304 */ 305#define N 2000 306static int 307acpi_timer_test() 308{ | 30 31#include "opt_acpi.h" 32#include <sys/param.h> 33#include <sys/bus.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/sysctl.h> 37#include <sys/timetc.h> --- 263 unchanged lines hidden (view full) --- 301 * ] Workaround: Read the register twice and compare. 302 * ] Status: This will not be fixed in the PIIX4 or PIIX4E, it is fixed 303 * ] in the PIIX4M. 304 */ 305#define N 2000 306static int 307acpi_timer_test() 308{ |
309 uint32_t last, this; 310 int min, max, n, delta; 311 register_t s; | 309 uint32_t last, this; 310 int delta, max, max2, min, n; 311 register_t s; |
312 313 min = INT32_MAX; | 312 313 min = INT32_MAX; |
314 max = 0; | 314 max = max2 = 0; |
315 316 /* Test the timer with interrupts disabled to get accurate results. */ 317 s = intr_disable(); 318 last = acpi_timer_read(); 319 for (n = 0; n < N; n++) { 320 this = acpi_timer_read(); 321 delta = acpi_TimerDelta(this, last); | 315 316 /* Test the timer with interrupts disabled to get accurate results. */ 317 s = intr_disable(); 318 last = acpi_timer_read(); 319 for (n = 0; n < N; n++) { 320 this = acpi_timer_read(); 321 delta = acpi_TimerDelta(this, last); |
322 if (delta > max) | 322 if (delta > max) { 323 max2 = max; |
323 max = delta; | 324 max = delta; |
325 } else if (delta > max2) 326 max2 = delta; |
|
324 if (delta < min) 325 min = delta; 326 last = this; 327 } 328 intr_restore(s); 329 | 327 if (delta < min) 328 min = delta; 329 last = this; 330 } 331 intr_restore(s); 332 |
330 delta = max - min; 331 if (delta > 2 && vm_guest == VM_GUEST_NO) | 333 delta = max2 - min; 334 if ((max - min > 8 || delta > 3) && vm_guest == VM_GUEST_NO) |
332 n = 0; | 335 n = 0; |
333 else if (min < 0 || max == 0) | 336 else if (min < 0 || max == 0 || max2 == 0) |
334 n = 0; 335 else 336 n = 1; 337 if (bootverbose) 338 printf(" %d/%d", n, delta); 339 340 return (n); 341} --- 32 unchanged lines hidden --- | 337 n = 0; 338 else 339 n = 1; 340 if (bootverbose) 341 printf(" %d/%d", n, delta); 342 343 return (n); 344} --- 32 unchanged lines hidden --- |