Module Name: src
Committed By: jmcneill
Date: Mon Oct 15 11:33:09 UTC 2018
Modified Files:
src/sys/dev/acpi: acpi_timer.c
Log Message:
Do not attach a timecounter when PM_TMR_LEN is 0. According to ACPI 6.2
section 5.2.9 ("Fixed ACPI Description Table (FADT)"), a value of zero
here means that the PM timer is not supported.
To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/dev/acpi/acpi_timer.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/acpi/acpi_timer.c
diff -u src/sys/dev/acpi/acpi_timer.c:1.22 src/sys/dev/acpi/acpi_timer.c:1.23
--- src/sys/dev/acpi/acpi_timer.c:1.22 Fri Dec 27 18:51:44 2013
+++ src/sys/dev/acpi/acpi_timer.c Mon Oct 15 11:33:09 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_timer.c,v 1.22 2013/12/27 18:51:44 christos Exp $ */
+/* $NetBSD: acpi_timer.c,v 1.23 2018/10/15 11:33:09 jmcneill Exp $ */
/*-
* Copyright (c) 2006 Matthias Drochner <[email protected]>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.22 2013/12/27 18:51:44 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.23 2018/10/15 11:33:09 jmcneill Exp $");
#include <sys/types.h>
#include <sys/systm.h>
@@ -52,6 +52,12 @@ static struct timecounter acpi_timecount
NULL,
};
+static bool
+acpitimer_supported(void)
+{
+ return AcpiGbl_FADT.PmTimerLength != 0;
+}
+
int
acpitimer_init(struct acpi_softc *sc)
{
@@ -59,6 +65,9 @@ acpitimer_init(struct acpi_softc *sc)
uint32_t bits;
int i, j;
+ if (!acpitimer_supported())
+ return -1;
+
rv = AcpiGetTimerResolution(&bits);
if (ACPI_FAILURE(rv))
@@ -88,6 +97,9 @@ int
acpitimer_detach(void)
{
+ if (!acpitimer_supported())
+ return -1;
+
return tc_detach(&acpi_timecounter);
}