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

This commit is contained in:
msaitoh 2018-10-03 09:46:11 +00:00
parent 562d0b6bb9
commit 3de33cabd4
2 changed files with 81 additions and 4 deletions

View File

@ -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_dbg2(ACPI_TABLE_HEADER *sdp);
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);
@ -1708,6 +1709,79 @@ acpi_handle_hpet(ACPI_TABLE_HEADER *sdp)
printf(END_COMMENT);
}
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)
{
@ -3323,6 +3397,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp)
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))

View File

@ -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>
@ -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 @@ utility dumps contents of the following tables:
.It FADT
.It HEST
.It HPET
.It LPIT
.It MADT
.It MCFG
.It MSCT