Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-8]: src/usr.sbin/acpitools/acpidump Pull up following revision(s)...
details: https://anonhg.NetBSD.org/src/rev/08c7c865fc25
branches: netbsd-8
changeset: 434419:08c7c865fc25
user: martin <martin%NetBSD.org@localhost>
date: Wed Nov 22 15:54:09 2017 +0000
description:
Pull up following revision(s) (requested by msaitoh in ticket #378):
usr.sbin/acpitools/acpidump/acpi_user.c: revision 1.4
usr.sbin/acpitools/acpidump/acpi.c: revision 1.20
usr.sbin/acpitools/acpidump/acpidump.c: revision 1.7
usr.sbin/acpitools/acpidump/acpi.c: revision 1.21
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.10
usr.sbin/acpitools/acpidump/acpi.c: revision 1.22
usr.sbin/acpitools/acpidump/acpidump.h: revision 1.6
usr.sbin/acpitools/acpidump/acpi.c: revision 1.23
usr.sbin/acpitools/acpidump/acpidump.h: revision 1.7
usr.sbin/acpitools/acpidump/acpi.c: revision 1.24
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.8
usr.sbin/acpitools/acpidump/acpi.c: revision 1.25
usr.sbin/acpitools/acpidump/acpidump.8: revision 1.9
usr.sbin/acpitools/acpidump/acpi.c: revision 1.26
usr.sbin/acpitools/acpidump/acpi.c: revision 1.28
usr.sbin/acpitools/acpidump/acpi.c: revision 1.16
usr.sbin/acpitools/acpidump/acpi.c: revision 1.17
usr.sbin/acpitools/acpidump/acpi.c: revision 1.18
usr.sbin/acpitools/acpidump/acpi.c: revision 1.19
Sync with FreeBSD's r321294:
- Dump TCG ACPI spec table (TCPA) more.
- Dump DMA Remapping Reporting table (DMAR).
- Consistently cast ACPICA 64-bit integer types when we print them.
- Display the 'Flags' field in the HPET Description Table.
- Do not crash when RSDT/XSDT contains an empty entry.
- Print 64-bit addresses clearly with leading zeros to avoid confusions.
- Create temp file safely.
- Add missing flags into FADT.
- Print some new ACPI 5.1 MADT entries.
- Use __arraycount().
- Warn and exit loop on invalid subtable length.
- Fix the type used to hold the value returned from getopt. On arm64 char is
unsigned so will never be -1.
Check DSDT signature in acpi_handle_fadt() for broken ACPI table.
Add new function acpi_select_address() derived from acpi_get_fadt_revision().
On some systems, 32bit address is used for (X)Dsdt even if (X)Facs uses 64bit.
Don't assume an address size from FADT revision.
- Decode ACPI_HEST_GENERIC_V2.
- Decode ACPI_MADT_GENERIC_MSI_FRAME.
- Add NMI, CMCI, MCE, GPIO-Signal, ARMv8 SEA, ARMv8 SEI and GSIV
in acpi_print_hest_notify().
- Add ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS and ACPI_EINJ_GET_EXECUTE_TIMINGS
in acpi_print_einj_action().
- Add ACPI_ERST_EXECUTE_TIMINGS in acpi_print_erst_action().
- Decode NFIT (NVDIMM Firmware Interface Table) from FreeBSD.
Part of FreeBSD r323045:
- Print Valid Field in ACPI_NFIT_CONTROL_REGION with 0x%02x.
- Fix Flags of ACPI_NFIT_CONTROL_REGION.
- Add "Performance Server" and "Tablet" for Preferred_PM_Profile.
- Don't print FADT_RESET_REG if FADT version is 1.
- Print FADT ArmBootFlags, MinorRevision, SleepControl, SleepStatus and
HypervisorId.
- Print "{}" even if any flags aren't set.
Decode the following entries:
- DBG2 (Debug Port Table 2)
- SPMI (Server Platform Management Interface Table)
- WDDT (Watchdog Timer Description Table)
- UEFI (UEFI, not fully decoded yet)
Fix calculation the offset of the Action Table in WDAT to print each
entries correctly.
- Calculate offset of a sub header correctly in acpi_handle_hest() to print
all of sub entries in HEST correctly.
- Print a SpaceID number for unknown ID in acpi_print_gas().
- Use PRINTFLAG() in acpi_print_hest_notify().
- Use %u instead of %d for unsigned values in acpi_print_hest_generic().
- Space, tab and newline change for consistency output.
- Print a type number for unknown HEST sub entry ID.
Don't define GAS address ID constants in acpidump.h and use actypes.h's
definitions. No functional change.
Cosmetic change (tab and newline).
diffstat:
usr.sbin/acpitools/acpidump/acpi.c | 1559 ++++++++++++++++++++++++++----
usr.sbin/acpitools/acpidump/acpi_user.c | 10 +-
usr.sbin/acpitools/acpidump/acpidump.8 | 12 +-
usr.sbin/acpitools/acpidump/acpidump.c | 8 +-
usr.sbin/acpitools/acpidump/acpidump.h | 89 +-
5 files changed, 1402 insertions(+), 276 deletions(-)
diffs (truncated from 2422 to 300 lines):
diff -r 7292b195eea8 -r 08c7c865fc25 usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c Wed Nov 22 15:35:52 2017 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c Wed Nov 22 15:54:09 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.15 2016/02/27 16:40:22 christos Exp $ */
+/* $NetBSD: acpi.c,v 1.15.8.1 2017/11/22 15:54:09 martin Exp $ */
/*-
* Copyright (c) 1998 Doug Rabson
@@ -26,11 +26,11 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/usr.sbin/acpi/acpidump/acpi.c,v 1.37 2009/08/25 20:35:57 jhb Exp $
+ * $FreeBSD: head/usr.sbin/acpi/acpidump/acpi.c 321299 2017-07-20 17:36:17Z emaste $
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.15 2016/02/27 16:40:22 christos Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.15.8.1 2017/11/22 15:54:09 martin Exp $");
#include <sys/param.h>
#include <sys/endian.h>
@@ -46,6 +46,7 @@
#include <string.h>
#include <unistd.h>
#include <stddef.h>
+#include <uuid.h>
#include "acpidump.h"
@@ -56,7 +57,7 @@
static void acpi_print_gas(ACPI_GENERIC_ADDRESS *gas);
static void acpi_print_pci(uint16_t vendorid, uint16_t deviceid,
uint8_t seg, uint8_t bus, uint8_t device, uint8_t func);
-static void acpi_print_pci_sbfd(uint8_t seg, uint8_t bus, uint8_t device,
+static void acpi_print_pci_sbdf(uint8_t seg, uint8_t bus, uint8_t device,
uint8_t func);
#ifdef notyet
static void acpi_print_hest_generic_status(ACPI_HEST_GENERIC_STATUS *);
@@ -66,7 +67,7 @@
void (*print_action)(ACPI_WHEA_HEADER *),
void (*print_ins)(ACPI_WHEA_HEADER *),
void (*print_flags)(ACPI_WHEA_HEADER *));
-static int acpi_get_fadt_revision(ACPI_TABLE_FADT *fadt);
+static uint64_t acpi_select_address(uint32_t, uint64_t);
static void acpi_handle_fadt(ACPI_TABLE_HEADER *fadt);
static void acpi_print_cpu(u_char cpu_id);
static void acpi_print_cpu_uid(uint32_t uid, char *uid_string);
@@ -81,6 +82,7 @@
static void acpi_handle_boot(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_cpep(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_dbgp(ACPI_TABLE_HEADER *sdp);
+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);
@@ -92,6 +94,7 @@
static void acpi_handle_sbst(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_spcr(ACPI_TABLE_HEADER *sdp);
+static void acpi_handle_spmi(ACPI_TABLE_HEADER *sdp);
static void acpi_print_srat_cpu(uint32_t apic_id,
uint32_t proximity_domain,
uint32_t flags, uint32_t clockdomain);
@@ -99,8 +102,12 @@
static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat);
static void acpi_handle_srat(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_tcpa(ACPI_TABLE_HEADER *sdp);
+static void acpi_print_nfit(ACPI_NFIT_HEADER *nfit);
+static void acpi_handle_nfit(ACPI_TABLE_HEADER *sdp);
+static void acpi_handle_uefi(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_waet(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wdat(ACPI_TABLE_HEADER *sdp);
+static void acpi_handle_wddt(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wdrt(ACPI_TABLE_HEADER *sdp);
static void acpi_print_sdt(ACPI_TABLE_HEADER *sdp);
static void acpi_dump_bytes(ACPI_TABLE_HEADER *sdp);
@@ -112,10 +119,79 @@
static void acpi_handle_rsdt(ACPI_TABLE_HEADER *rsdp);
static void acpi_walk_subtables(ACPI_TABLE_HEADER *table, void *first,
void (*action)(ACPI_SUBTABLE_HEADER *));
+static void acpi_walk_nfit(ACPI_TABLE_HEADER *table, void *first,
+ void (*action)(ACPI_NFIT_HEADER *));
/* Size of an address. 32-bit for ACPI 1.0, 64-bit for ACPI 2.0 and up. */
static int addr_size;
+/* Strings used in the TCPA table */
+static const char *tcpa_event_type_strings[] = {
+ "PREBOOT Certificate",
+ "POST Code",
+ "Unused",
+ "No Action",
+ "Separator",
+ "Action",
+ "Event Tag",
+ "S-CRTM Contents",
+ "S-CRTM Version",
+ "CPU Microcode",
+ "Platform Config Flags",
+ "Table of Devices",
+ "Compact Hash",
+ "IPL",
+ "IPL Partition Data",
+ "Non-Host Code",
+ "Non-Host Config",
+ "Non-Host Info"
+};
+
+static const char *TCPA_pcclient_strings[] = {
+ "<undefined>",
+ "SMBIOS",
+ "BIS Certificate",
+ "POST BIOS ROM Strings",
+ "ESCD",
+ "CMOS",
+ "NVRAM",
+ "Option ROM Execute",
+ "Option ROM Configurateion",
+ "<undefined>",
+ "Option ROM Microcode Update ",
+ "S-CRTM Version String",
+ "S-CRTM Contents",
+ "POST Contents",
+ "Table of Devices",
+};
+
+#define PRINTFLAG_END() printflag_end()
+
+static char pf_sep = '{';
+
+static void
+printflag_end(void)
+{
+
+ if (pf_sep == ',') {
+ printf("}");
+ } else if (pf_sep == '{') {
+ printf("{}");
+ }
+ pf_sep = '{';
+ printf("\n");
+}
+
+static void
+printflag(uint64_t var, uint64_t mask, const char *name)
+{
+
+ if (var & mask) {
+ printf("%c%s", pf_sep, name);
+ pf_sep = ',';
+ }
+}
+
static void
acpi_print_string(char *s, size_t length)
{
@@ -135,34 +211,44 @@
acpi_print_gas(ACPI_GENERIC_ADDRESS *gas)
{
switch(gas->SpaceId) {
- case ACPI_GAS_MEMORY:
- printf("0x%08lx:%u[%u] (Memory)", (u_long)gas->Address,
- gas->BitOffset, gas->BitWidth);
+ case ACPI_ADR_SPACE_SYSTEM_MEMORY:
+ if (gas->BitWidth <= 32)
+ printf("0x%08x:%u[%u] (Memory)",
+ (u_int)gas->Address, gas->BitOffset,
+ gas->BitWidth);
+ else
+ printf("0x%016jx:%u[%u] (Memory)",
+ (uintmax_t)gas->Address, gas->BitOffset,
+ gas->BitWidth);
break;
- case ACPI_GAS_IO:
- printf("0x%02lx:%u[%u] (IO)", (u_long)gas->Address,
- gas->BitOffset, gas->BitWidth);
+ case ACPI_ADR_SPACE_SYSTEM_IO:
+ printf("0x%02x:%u[%u] (IO)", (u_int)gas->Address,
+ gas->BitOffset, gas->BitWidth);
break;
- case ACPI_GAS_PCI:
+ case ACPI_ADR_SPACE_PCI_CONFIG:
printf("%x:%x+0x%x (PCI)", (uint16_t)(gas->Address >> 32),
(uint16_t)((gas->Address >> 16) & 0xffff),
(uint16_t)gas->Address);
break;
/* XXX How to handle these below? */
- case ACPI_GAS_EMBEDDED:
+ case ACPI_ADR_SPACE_EC:
printf("0x%x:%u[%u] (EC)", (uint16_t)gas->Address,
gas->BitOffset, gas->BitWidth);
break;
- case ACPI_GAS_SMBUS:
+ case ACPI_ADR_SPACE_SMBUS:
printf("0x%x:%u[%u] (SMBus)", (uint16_t)gas->Address,
gas->BitOffset, gas->BitWidth);
break;
- case ACPI_GAS_CMOS:
- case ACPI_GAS_PCIBAR:
- case ACPI_GAS_DATATABLE:
- case ACPI_GAS_FIXED:
+ case ACPI_ADR_SPACE_CMOS:
+ case ACPI_ADR_SPACE_PCI_BAR_TARGET:
+ case ACPI_ADR_SPACE_IPMI:
+ case ACPI_ADR_SPACE_GPIO:
+ case ACPI_ADR_SPACE_GSBUS:
+ case ACPI_ADR_SPACE_PLATFORM_COMM:
+ case ACPI_ADR_SPACE_FIXED_HARDWARE:
default:
- printf("0x%08lx (?)", (u_long)gas->Address);
+ printf("0x%016jx (SpaceID=%hhu)", (uintmax_t)gas->Address,
+ gas->SpaceId);
break;
}
}
@@ -188,7 +274,7 @@
}
static void
-acpi_print_pci_sbfd(uint8_t seg, uint8_t bus, uint8_t device, uint8_t func)
+acpi_print_pci_sbdf(uint8_t seg, uint8_t bus, uint8_t device, uint8_t func)
{
if (bus == 0xff && device == 0xff && func == 0xff) {
printf("\tPCI Device=NONE\n");
@@ -234,7 +320,7 @@
{
printf("\n");
printf("\tBank Number=%d\n", bank->BankNumber);
- printf("\tClear Status On Init={ %s }\n",
+ printf("\tClear Status On Init={%s}\n",
bank->ClearStatusOnInit ? "NO" : "YES");
printf("\tStatus Data Format={ ");
switch (bank->StatusFormat) {
@@ -261,40 +347,43 @@
static void
acpi_print_hest_header(ACPI_HEST_HEADER *hest)
{
- printf("\tType={ ");
+ printf("\tType={");
switch (hest->Type) {
case ACPI_HEST_TYPE_IA32_CHECK:
printf("IA32 Machine Check Exception");
break;
case ACPI_HEST_TYPE_IA32_CORRECTED_CHECK:
- printf("IA32 Corrected Machine Check\n");
+ printf("IA32 Corrected Machine Check");
break;
case ACPI_HEST_TYPE_IA32_NMI:
- printf("IA32 Non-Maskable Interrupt\n");
+ printf("IA32 Non-Maskable Interrupt");
break;
case ACPI_HEST_TYPE_NOT_USED3:
case ACPI_HEST_TYPE_NOT_USED4:
case ACPI_HEST_TYPE_NOT_USED5:
- printf("unused type: %d\n", hest->Type);
+ printf("unused type: %d", hest->Type);
break;
case ACPI_HEST_TYPE_AER_ROOT_PORT:
- printf("PCI Express Root Port AER\n");
+ printf("PCI Express Root Port AER");
break;
case ACPI_HEST_TYPE_AER_ENDPOINT:
- printf("PCI Express Endpoint AER\n");
+ printf("PCI Express Endpoint AER");
break;
case ACPI_HEST_TYPE_AER_BRIDGE:
- printf("PCI Express/PCI-X Bridge AER\n");
+ printf("PCI Express/PCI-X Bridge AER");
break;
case ACPI_HEST_TYPE_GENERIC_ERROR:
- printf("Generic Hardware Error Source\n");
+ printf("Generic Hardware Error Source");
+ break;
+ case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
+ printf("Generic Hardware Error Source version 2");
break;
case ACPI_HEST_TYPE_RESERVED:
default:
- printf("Reserved\n");
+ printf("Reserved (%d)", hest->Type);
break;
}
- printf(" }\n");
+ printf("}\n");
printf("\tSourceId=%d\n", hest->SourceId);
}
@@ -315,7 +404,7 @@
data->RecordsToPreallocate);
printf("\tMax. Sections per Record=%d\n", data->MaxSectionsPerRecord);
if (!(data->Flags & ACPI_HEST_GLOBAL))
- acpi_print_pci_sbfd(0, data->Bus, data->Device, data->Function);
+ acpi_print_pci_sbdf(0, data->Bus, data->Device, data->Function);
printf("\tDevice Control=0x%x\n", data->DeviceControl);
printf("\tUncorrectable Error Mask Register=0x%x\n",
data->UncorrectableMask);
@@ -331,7 +420,7 @@
acpi_print_hest_notify(ACPI_HEST_NOTIFY *notify)
Home |
Main Index |
Thread Index |
Old Index