acpidump(8): Add ACPI LPIT (Low Power Idle Table)

The LPIT is the part of the "standardized" way that one can enumerate
various power state information on Intel platforms.

The documentation for this change can be found here:
http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf

Reviewed By: jhb
Approved By: jhb
Differential Revision: https://reviews.freebsd.org/D15931
This commit is contained in:
Ben Widawsky 2018-07-11 01:37:01 +00:00
parent a84a458c6f
commit 5857fba5fd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336185
2 changed files with 78 additions and 1 deletions

View File

@ -68,6 +68,7 @@ static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wddt(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_lpit(ACPI_TABLE_HEADER *sdp);
static void acpi_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
uint32_t flags);
static void acpi_print_srat_memory(ACPI_SRAT_MEM_AFFINITY *mp);
@ -715,6 +716,79 @@ acpi_handle_wddt(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_print_srat_cpu(uint32_t apic_id, uint32_t proximity_domain,
uint32_t flags)
@ -1693,6 +1767,8 @@ acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp)
acpi_handle_nfit(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_WDDT, 4))
acpi_handle_wddt(sdp);
else if (!memcmp(sdp->Signature, ACPI_SIG_LPIT, 4))
acpi_handle_lpit(sdp);
else {
printf(BEGIN_COMMENT);
acpi_print_sdt(sdp);

View File

@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
.Dd June 20, 2018
.Dd July 10, 2018
.Dt ACPIDUMP 8
.Os
.Sh NAME
@ -103,6 +103,7 @@ utility dumps contents of the following tables:
.It FACS
.It FADT
.It HPET
.It LPIT
.It MADT
.It MCFG
.It NFIT