Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/acpitools/acpidump Add ACPI LPIT (Low Power Idle Ta...



details:   https://anonhg.NetBSD.org/src/rev/e91ed8166384
branches:  trunk
changeset: 836207:e91ed8166384
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Oct 03 09:46:11 2018 +0000

description:
Add ACPI LPIT (Low Power Idle Table) from FreeBSD r336185.

diffstat:

 usr.sbin/acpitools/acpidump/acpi.c     |  80 +++++++++++++++++++++++++++++++++-
 usr.sbin/acpitools/acpidump/acpidump.8 |   5 +-
 2 files changed, 81 insertions(+), 4 deletions(-)

diffs (141 lines):

diff -r 1fc160802fd7 -r e91ed8166384 usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c        Wed Oct 03 09:24:36 2018 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c        Wed Oct 03 09:46:11 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.29 2017/09/28 06:55:08 msaitoh Exp $ */
+/* $NetBSD: acpi.c,v 1.30 2018/10/03 09:46:11 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.29 2017/09/28 06:55:08 msaitoh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.30 2018/10/03 09:46:11 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/endian.h>
@@ -86,6 +86,7 @@
 static void    acpi_handle_einj(ACPI_TABLE_HEADER *sdp);
 static void    acpi_handle_erst(ACPI_TABLE_HEADER *sdp);
 static void    acpi_handle_hest(ACPI_TABLE_HEADER *sdp);
+static void    acpi_handle_lpit(ACPI_TABLE_HEADER *sdp);
 static void    acpi_handle_madt(ACPI_TABLE_HEADER *sdp);
 static void    acpi_handle_msct(ACPI_TABLE_HEADER *sdp);
 static void    acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp);
@@ -1709,6 +1710,79 @@
 }
 
 static void
+acpi_print_native_lpit(ACPI_LPIT_NATIVE *nl)
+{
+       printf("\tEntryTrigger=");
+       acpi_print_gas(&nl->EntryTrigger);
+       printf("\tResidency=%u\n", nl->Residency);
+       printf("\tLatency=%u\n", nl->Latency);
+       if (nl->Header.Flags & ACPI_LPIT_NO_COUNTER)
+               printf("\tResidencyCounter=Not Present");
+       else {
+               printf("\tResidencyCounter=");
+               acpi_print_gas(&nl->ResidencyCounter);
+       }
+       if (nl->CounterFrequency)
+               printf("\tCounterFrequency=%ju\n", nl->CounterFrequency);
+       else
+               printf("\tCounterFrequency=TSC\n");
+}
+
+static void
+acpi_print_lpit(ACPI_LPIT_HEADER *lpit)
+{
+       if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
+               printf("\tType=ACPI_LPIT_TYPE_NATIVE_CSTATE\n");
+       else
+               warnx("unknown LPIT type %u", lpit->Type);
+
+       printf("\tLength=%u\n", lpit->Length);
+       printf("\tUniqueId=0x%04x\n", lpit->UniqueId);
+#define        PRINTFLAG(var, flag)    printflag((var), ACPI_LPIT_## flag, #flag)
+       printf("\tFlags=");
+       PRINTFLAG(lpit->Flags, STATE_DISABLED);
+       PRINTFLAG_END();
+#undef PRINTFLAG
+
+       if (lpit->Type == ACPI_LPIT_TYPE_NATIVE_CSTATE)
+               return acpi_print_native_lpit((ACPI_LPIT_NATIVE *)lpit);
+}
+
+static void
+acpi_walk_lpit(ACPI_TABLE_HEADER *table, void *first,
+    void (*action)(ACPI_LPIT_HEADER *))
+{
+       ACPI_LPIT_HEADER *subtable;
+       char *end;
+
+       subtable = first;
+       end = (char *)table + table->Length;
+       while ((char *)subtable < end) {
+               printf("\n");
+               if (subtable->Length < sizeof(ACPI_LPIT_HEADER)) {
+                       warnx("invalid subtable length %u", subtable->Length);
+                       return;
+               }
+               action(subtable);
+               subtable = (ACPI_LPIT_HEADER *)((char *)subtable +
+                   subtable->Length);
+       }
+}
+
+static void
+acpi_handle_lpit(ACPI_TABLE_HEADER *sdp)
+{
+       ACPI_TABLE_LPIT *lpit;
+
+       printf(BEGIN_COMMENT);
+       acpi_print_sdt(sdp);
+       lpit = (ACPI_TABLE_LPIT *)sdp;
+       acpi_walk_lpit(sdp, (lpit + 1), acpi_print_lpit);
+
+       printf(END_COMMENT);
+}
+
+static void
 acpi_handle_msct(ACPI_TABLE_HEADER *sdp)
 {
        ACPI_TABLE_MSCT *msct;
@@ -3323,6 +3397,8 @@
                        acpi_handle_hpet(sdp);
                else if (!memcmp(sdp->Signature, ACPI_SIG_ECDT, 4))
                        acpi_handle_ecdt(sdp);
+               else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4))
+                       acpi_handle_lpit(sdp);
                else if (!memcmp(sdp->Signature, ACPI_SIG_MCFG, 4))
                        acpi_handle_mcfg(sdp);
                else if (!memcmp(sdp->Signature, ACPI_SIG_SBST, 4))
diff -r 1fc160802fd7 -r e91ed8166384 usr.sbin/acpitools/acpidump/acpidump.8
--- a/usr.sbin/acpitools/acpidump/acpidump.8    Wed Oct 03 09:24:36 2018 +0000
+++ b/usr.sbin/acpitools/acpidump/acpidump.8    Wed Oct 03 09:46:11 2018 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: acpidump.8,v 1.10 2017/09/01 18:35:50 msaitoh Exp $
+.\" $NetBSD: acpidump.8,v 1.11 2018/10/03 09:46:11 msaitoh Exp $
 .\" ACPI (ACPI Package)
 .\"
 .\" Copyright (c) 1999 Doug Rabson <dfr%FreeBSD.org@localhost>
@@ -30,7 +30,7 @@
 .\"
 .\" $FreeBSD: head/usr.sbin/acpi/acpidump/acpidump.8 267668 2014-06-20 09:57:27Z bapt $
 .\"
-.Dd September 1, 2017
+.Dd October 3, 2018
 .Dt ACPIDUMP 8
 .Os
 .Sh NAME
@@ -110,6 +110,7 @@
 .It FADT
 .It HEST
 .It HPET
+.It LPIT
 .It MADT
 .It MCFG
 .It MSCT



Home | Main Index | Thread Index | Old Index