Index: usr.sbin/acpi/acpidump/acpi.c =================================================================== --- usr.sbin/acpi/acpidump/acpi.c +++ usr.sbin/acpi/acpidump/acpi.c @@ -68,6 +68,7 @@ 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 @@ 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_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); Index: usr.sbin/acpi/acpidump/acpidump.8 =================================================================== --- usr.sbin/acpi/acpidump/acpidump.8 +++ usr.sbin/acpi/acpidump/acpidump.8 @@ -103,8 +103,10 @@ .It FACS .It FADT .It HPET +.It LIPT .It MADT .It MCFG +.IT NFIT .It RSD PTR .It RSDT .It WDDT