diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2011-04-05 18:40:19 +0000 |
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2011-04-05 18:40:19 +0000 |
| commit | 9abd8cd05b764311626e324b82feefbf0d248984 (patch) | |
| tree | 49b6fb33f7040c5d37b47f9088e95cd712c00f47 | |
| parent | f5459d4cad6bb85b1e5ac49456bc7d3a237b98e6 (diff) | |
Notes
| -rw-r--r-- | sys/dev/acpica/acpi_timer.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c index 5be8fbc2c3aca..67f47d9ed0c37 100644 --- a/sys/dev/acpica/acpi_timer.c +++ b/sys/dev/acpica/acpi_timer.c @@ -306,12 +306,12 @@ SYSCTL_PROC(_machdep, OID_AUTO, acpi_timer_freq, CTLTYPE_INT | CTLFLAG_RW, static int acpi_timer_test() { - uint32_t last, this; - int min, max, n, delta; - register_t s; + uint32_t last, this; + int delta, max, max2, min, n; + register_t s; min = INT32_MAX; - max = 0; + max = max2 = 0; /* Test the timer with interrupts disabled to get accurate results. */ s = intr_disable(); @@ -319,18 +319,21 @@ acpi_timer_test() for (n = 0; n < N; n++) { this = acpi_timer_read(); delta = acpi_TimerDelta(this, last); - if (delta > max) + if (delta > max) { + max2 = max; max = delta; + } else if (delta > max2) + max2 = delta; if (delta < min) min = delta; last = this; } intr_restore(s); - delta = max - min; - if (delta > 2 && vm_guest == VM_GUEST_NO) + delta = max2 - min; + if ((max - min > 8 || delta > 3) && vm_guest == VM_GUEST_NO) n = 0; - else if (min < 0 || max == 0) + else if (min < 0 || max == 0 || max2 == 0) n = 0; else n = 1; |
