Hide acpi_timer_test behind a tunable

When hw.acpi.timer_test_enabled is set to 0, this makes acpi_timer_test
return 1 without actually testing the ACPI timer; this results in the
ACPI-fast timecounter always being used rather than potentially using
ACPI-safe.

The ACPI timer testing was introduced in 2002 as a workaround for
errata in Pentium II and Pentium III chipsets, and is unlikely to be
needed in 2021.

While I'm here, add TSENTER/TSEXIT to make it easier to see the time
spent on the test (if it is enabled).

Reviewed by:	allanjude, imp
MFC After:	1 week
This commit is contained in:
Colin Percival 2021-09-07 16:58:18 -07:00
parent 19261079b7
commit 3c253d03d9

View File

@ -79,6 +79,8 @@ static int acpi_timer_sysctl_freq(SYSCTL_HANDLER_ARGS);
static void acpi_timer_boot_test(void);
static int acpi_timer_test(void);
static int acpi_timer_test_enabled = 1;
TUNABLE_INT("hw.acpi.timer_test_enabled", &acpi_timer_test_enabled);
static device_method_t acpi_timer_methods[] = {
DEVMETHOD(device_identify, acpi_timer_identify),
@ -404,6 +406,12 @@ acpi_timer_test()
int delta, max, max2, min, n;
register_t s;
/* Skip the test based on the hw.acpi.timer_test_enabled tunable. */
if (!acpi_timer_test_enabled)
return (1);
TSENTER();
min = INT32_MAX;
max = max2 = 0;
@ -434,6 +442,8 @@ acpi_timer_test()
if (bootverbose)
printf(" %d/%d", n, delta);
TSEXIT();
return (n);
}
#undef N