summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/dev/acpica/acpi_timer.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c
index 5be8fbc..67f47d9 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;
OpenPOWER on IntegriCloud