Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Jul 2018 18:38:08 -0700
From:      Ben Widawsky <bwidawsk@freebsd.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r336185 - head/usr.sbin/acpi/acpidump
Message-ID:  <20180711013808.mflhpmbqysf5ep44@smtp.freebsd.org>
In-Reply-To: <201807110137.w6B1b1ne046881@repo.freebsd.org>
References:  <201807110137.w6B1b1ne046881@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Here is sample output from the tool:
LPIT: Length=148, Revision=1, Checksum=32,
      OEMID=INTEL, OEM Table ID=SKL, OEM Revision=0x0,
      Creator ID=MSFT, Creator Revision=0x5f

      Type=ACPI_LPIT_TYPE_NATIVE_CSTATE
      Length=56
      UniqueId=0x0000
      Flags=
      EntryTrigger=0x0000000000000060 (?)     Residency=30000
      Latency=3000
      ResidencyCounter=0x0000000000000632 (?) CounterFrequency=TSC

      Type=ACPI_LPIT_TYPE_NATIVE_CSTATE
      Length=56
      UniqueId=0x0001
      Flags=
      EntryTrigger=0x0000000000000060 (?)     Residency=30000
      Latency=3000
      ResidencyCounter=0x0000000000000632 (?) CounterFrequency=TSC


On 18-07-11 01:37:01, Ben Widawsky wrote:
> 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
> _______________________________________________
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180711013808.mflhpmbqysf5ep44>