Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi acpi_timer: use ACPI-Fast if WAET timer one rea...



details:   https://anonhg.NetBSD.org/src/rev/5b014b698266
branches:  trunk
changeset: 984822:5b014b698266
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sun Jul 25 01:43:08 2021 +0000

description:
acpi_timer: use ACPI-Fast if WAET timer one read flag is set

The Windows ACPI Emulated Devices Table (WAET) has a hint to inform the OS
that a single read of the PM timer is reliable. Honour this flag.

diffstat:

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

diffs (45 lines):

diff -r de6ae07dc2a7 -r 5b014b698266 sys/dev/acpi/acpi_timer.c
--- a/sys/dev/acpi/acpi_timer.c Sun Jul 25 00:11:43 2021 +0000
+++ b/sys/dev/acpi/acpi_timer.c Sun Jul 25 01:43:08 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_timer.c,v 1.26 2020/05/29 12:30:41 rin Exp $ */
+/* $NetBSD: acpi_timer.c,v 1.27 2021/07/25 01:43:08 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.26 2020/05/29 12:30:41 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_timer.c,v 1.27 2021/07/25 01:43:08 jmcneill Exp $");
 
 #include <sys/types.h>
 #include <sys/systm.h>
@@ -61,6 +61,7 @@
 acpitimer_init(struct acpi_softc *sc)
 {
 #if (!ACPI_REDUCED_HARDWARE)
+       ACPI_TABLE_WAET *waet;
        ACPI_STATUS rv;
        uint32_t bits;
        int i, j;
@@ -79,6 +80,18 @@
        for (i = j = 0; i < 10; i++)
                j += acpitimer_test();
 
+       rv = AcpiGetTable(ACPI_SIG_WAET, 0, (ACPI_TABLE_HEADER **)&waet);
+       if (ACPI_SUCCESS(rv)) {
+               /*
+                * Windows ACPI Emulated Devices Table (WAET) has a hint
+                * to let the OS know that a single read of the PM timer
+                * provides a reliable value.
+                */
+               if ((waet->Flags & ACPI_WAET_TIMER_ONE_READ) != 0) {
+                       j += 10;
+               }
+       }
+
        if (j >= 10) {
                acpi_timecounter.tc_name = "ACPI-Fast";
                acpi_timecounter.tc_get_timecount = acpitimer_read_fast;



Home | Main Index | Thread Index | Old Index