diff options
| author | jmcneill <jmcneill@NetBSD.org> | 2018-10-15 11:33:09 +0000 |
|---|---|---|
| committer | jmcneill <jmcneill@NetBSD.org> | 2018-10-15 11:33:09 +0000 |
| commit | a43b0fb9ea8aa46c45e42fb0b101ce2c05b4e2ce (patch) | |
| tree | fdbcb904b11b162b74038637396c8a01d163a96e /sys/dev/acpi | |
| parent | 7970a7c95d8caa841334016f93685caba1eacd49 (diff) | |
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.
Diffstat (limited to 'sys/dev/acpi')
| -rw-r--r-- | sys/dev/acpi/acpi_timer.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/dev/acpi/acpi_timer.c b/sys/dev/acpi/acpi_timer.c index 774082e9da0..ae8414a1c61 100644 --- a/sys/dev/acpi/acpi_timer.c +++ b/sys/dev/acpi/acpi_timer.c @@ -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 <drochner@NetBSD.org> @@ -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_timecounter = { 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); } |
