From owner-svn-src-head@freebsd.org Wed Jul 11 01:37:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 72B5A1046C5B; Wed, 11 Jul 2018 01:37:02 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 10ADD759F9; Wed, 11 Jul 2018 01:37:02 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E242B4267; Wed, 11 Jul 2018 01:37:01 +0000 (UTC) (envelope-from bwidawsk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6B1b1cq046882; Wed, 11 Jul 2018 01:37:01 GMT (envelope-from bwidawsk@FreeBSD.org) Received: (from bwidawsk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6B1b1ne046881; Wed, 11 Jul 2018 01:37:01 GMT (envelope-from bwidawsk@FreeBSD.org) Message-Id: <201807110137.w6B1b1ne046881@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bwidawsk set sender to bwidawsk@FreeBSD.org using -f From: Ben Widawsky Date: Wed, 11 Jul 2018 01:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336185 - head/usr.sbin/acpi/acpidump X-SVN-Group: head X-SVN-Commit-Author: bwidawsk X-SVN-Commit-Paths: head/usr.sbin/acpi/acpidump X-SVN-Commit-Revision: 336185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Jul 2018 01:37:02 -0000 Author: bwidawsk Date: Wed Jul 11 01:37:01 2018 New Revision: 336185 URL: https://svnweb.freebsd.org/changeset/base/336185 Log: 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 Modified: head/usr.sbin/acpi/acpidump/acpi.c head/usr.sbin/acpi/acpidump/acpidump.8 Modified: head/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- head/usr.sbin/acpi/acpidump/acpi.c Tue Jul 10 23:30:19 2018 (r336184) +++ head/usr.sbin/acpi/acpidump/acpi.c Wed Jul 11 01:37:01 2018 (r336185) @@ -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); @@ -716,6 +717,79 @@ acpi_handle_wddt(ACPI_TABLE_HEADER *sdp) } 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); Modified: head/usr.sbin/acpi/acpidump/acpidump.8 ============================================================================== --- head/usr.sbin/acpi/acpidump/acpidump.8 Tue Jul 10 23:30:19 2018 (r336184) +++ head/usr.sbin/acpi/acpidump/acpidump.8 Wed Jul 11 01:37:01 2018 (r336185) @@ -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