Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi Do not attach a timecounter when PM_TMR_LEN is ...



details:   https://anonhg.NetBSD.org/src/rev/960a2fe73c41
branches:  trunk
changeset: 445153:960a2fe73c41
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Mon Oct 15 11:33:09 2018 +0000

description:
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:

 sys/dev/acpi/acpi_timer.c |  16 ++++++++++++++--
 1 files changed, 14 insertions(+), 2 deletions(-)

diffs (51 lines):

diff -r 8bce38e25e08 -r 960a2fe73c41 sys/dev/acpi/acpi_timer.c
--- a/sys/dev/acpi/acpi_timer.c Mon Oct 15 10:01:32 2018 +0000
+++ b/sys/dev/acpi/acpi_timer.c Mon Oct 15 11:33:09 2018 +0000
@@ -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@localhost>
@@ -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 @@
        NULL,
 };
 
+static bool
+acpitimer_supported(void)
+{
+       return AcpiGbl_FADT.PmTimerLength != 0;
+}
+
 int
 acpitimer_init(struct acpi_softc *sc)
 {
@@ -59,6 +65,9 @@
        uint32_t bits;
        int i, j;
 
+       if (!acpitimer_supported())
+               return -1;
+
        rv = AcpiGetTimerResolution(&bits);
 
        if (ACPI_FAILURE(rv))
@@ -88,6 +97,9 @@
 acpitimer_detach(void)
 {
 
+       if (!acpitimer_supported())
+               return -1;
+
        return tc_detach(&acpi_timecounter);
 }
 



Home | Main Index | Thread Index | Old Index