Deleted Added
full compact
acpi_timer.c (136270) acpi_timer.c (137151)
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:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 *
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:

--- 10 unchanged lines hidden (view full) ---

19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
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 * $FreeBSD: head/sys/dev/acpica/acpi_timer.c 136270 2004-10-08 17:56:47Z njl $
27 * $FreeBSD: head/sys/dev/acpica/acpi_timer.c 137151 2004-11-03 09:09:13Z phk $
28 */
29#include "opt_acpi.h"
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/sysctl.h>
35#include <sys/timetc.h>

--- 133 unchanged lines hidden (view full) ---

169 acpi_timer_boot_test();
170
171 /*
172 * If all tests of the counter succeed, use the ACPI-fast method. If
173 * at least one failed, default to using the safe routine, which reads
174 * the timer multiple times to get a consistent value before returning.
175 */
176 j = 0;
28 */
29#include "opt_acpi.h"
30#include <sys/param.h>
31#include <sys/bus.h>
32#include <sys/kernel.h>
33#include <sys/module.h>
34#include <sys/sysctl.h>
35#include <sys/timetc.h>

--- 133 unchanged lines hidden (view full) ---

169 acpi_timer_boot_test();
170
171 /*
172 * If all tests of the counter succeed, use the ACPI-fast method. If
173 * at least one failed, default to using the safe routine, which reads
174 * the timer multiple times to get a consistent value before returning.
175 */
176 j = 0;
177 if (bootverbose)
178 printf("ACPI timer:");
177 for (i = 0; i < 10; i++)
178 j += acpi_timer_test();
179 for (i = 0; i < 10; i++)
180 j += acpi_timer_test();
181 if (bootverbose)
182 printf(" -> %d\n", j);
179 if (j == 10) {
180 acpi_timer_timecounter.tc_name = "ACPI-fast";
181 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
182 } else {
183 acpi_timer_timecounter.tc_name = "ACPI-safe";
184 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
185 }
186 tc_init(&acpi_timer_timecounter);

--- 131 unchanged lines hidden (view full) ---

318 intr_restore(s);
319
320 if (max - min > 2)
321 n = 0;
322 else if (min < 0 || max == 0)
323 n = 0;
324 else
325 n = 1;
183 if (j == 10) {
184 acpi_timer_timecounter.tc_name = "ACPI-fast";
185 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount;
186 } else {
187 acpi_timer_timecounter.tc_name = "ACPI-safe";
188 acpi_timer_timecounter.tc_get_timecount = acpi_timer_get_timecount_safe;
189 }
190 tc_init(&acpi_timer_timecounter);

--- 131 unchanged lines hidden (view full) ---

322 intr_restore(s);
323
324 if (max - min > 2)
325 n = 0;
326 else if (min < 0 || max == 0)
327 n = 0;
328 else
329 n = 1;
326 if (bootverbose) {
327 printf("ACPI timer looks %s min = %d, max = %d, width = %d\n",
328 n ? "GOOD" : "BAD ",
329 min, max, max - min);
330 }
330 if (bootverbose)
331 printf(" %d/%d", n, max-min);
331
332 return (n);
333}
334#undef N
335
336/*
337 * Test harness for verifying ACPI timer behaviour.
338 * Boot with debug.acpi.timer_test set to invoke this.

--- 27 unchanged lines hidden ---
332
333 return (n);
334}
335#undef N
336
337/*
338 * Test harness for verifying ACPI timer behaviour.
339 * Boot with debug.acpi.timer_test set to invoke this.

--- 27 unchanged lines hidden ---