diff options
author | njl <njl@FreeBSD.org> | 2004-04-24 16:25:00 +0000 |
---|---|---|
committer | njl <njl@FreeBSD.org> | 2004-04-24 16:25:00 +0000 |
commit | 4c2bf4f1b4ce666c9c869253d951b4da1b23d33e (patch) | |
tree | 107baedc7d699997af20f2a320aefa9f9b8c89ee /sys/dev/acpica | |
parent | 0eae77e31527f2f606c42d97545ba060e0f6af6a (diff) | |
download | FreeBSD-src-4c2bf4f1b4ce666c9c869253d951b4da1b23d33e.zip FreeBSD-src-4c2bf4f1b4ce666c9c869253d951b4da1b23d33e.tar.gz |
Disable interrupts while testing the timer. Not doing this unnecessarily
added an arbitrary delay to our readings, causing us to use the ACPI-safe
read method when not necessary. Submitted by: bde
Old:
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks BAD min = 3, max = 19, width = 16
ACPI timer looks GOOD min = 3, max = 5, width = 2
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-safe" frequency 3579545 Hz quality 1000
New:
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
ACPI timer looks GOOD min = 3, max = 4, width = 1
Timecounter "ACPI-fast" frequency 3579545 Hz quality 1000
Also, reduce unnecesary overhead in ACPI-fast by remove the barrier for
reads. The timer in the ACPI-fast case is known to increase monotonically
so there is no need to serialize access to it.
Diffstat (limited to 'sys/dev/acpica')
-rw-r--r-- | sys/dev/acpica/acpi_timer.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/acpica/acpi_timer.c b/sys/dev/acpica/acpi_timer.c index 69342a1..2de7810 100644 --- a/sys/dev/acpica/acpi_timer.c +++ b/sys/dev/acpica/acpi_timer.c @@ -99,12 +99,7 @@ static struct timecounter acpi_timer_timecounter = { static u_int acpi_timer_read() { - uint32_t tv; - - tv = bus_space_read_4(acpi_timer_bst, acpi_timer_bsh, 0); - bus_space_barrier(acpi_timer_bst, acpi_timer_bsh, 0, 4, - BUS_SPACE_BARRIER_READ); - return (tv); + return (bus_space_read_4(acpi_timer_bst, acpi_timer_bsh, 0)); } /* @@ -277,9 +272,13 @@ acpi_timer_test() { uint32_t last, this; int min, max, n, delta; + register_t s; min = 10000000; max = 0; + + /* Test the timer with interrupts disabled to get accurate results. */ + s = intr_disable(); last = acpi_timer_read(); for (n = 0; n < N; n++) { this = acpi_timer_read(); @@ -290,6 +289,8 @@ acpi_timer_test() min = delta; last = this; } + intr_restore(s); + if (max - min > 2) n = 0; else if (min < 0 || max == 0) |