Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/acpitools/acpidump - Decode ACPI_HEST_GENERIC_V2.
details: https://anonhg.NetBSD.org/src/rev/f014230664ed
branches: trunk
changeset: 356080:f014230664ed
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Thu Aug 31 06:53:58 2017 +0000
description:
- 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.
diffstat:
usr.sbin/acpitools/acpidump/acpi.c | 271 ++++++++++++++++++++++++++++++++-
usr.sbin/acpitools/acpidump/acpidump.8 | 5 +-
2 files changed, 272 insertions(+), 4 deletions(-)
diffs (truncated from 416 to 300 lines):
diff -r 239c8a7009ec -r f014230664ed usr.sbin/acpitools/acpidump/acpi.c
--- a/usr.sbin/acpitools/acpidump/acpi.c Thu Aug 31 05:09:38 2017 +0000
+++ b/usr.sbin/acpitools/acpidump/acpi.c Thu Aug 31 06:53:58 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.18 2017/08/21 02:58:49 msaitoh Exp $ */
+/* $NetBSD: acpi.c,v 1.19 2017/08/31 06:53:58 msaitoh Exp $ */
/*-
* Copyright (c) 1998 Doug Rabson
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: acpi.c,v 1.18 2017/08/21 02:58:49 msaitoh Exp $");
+__RCSID("$NetBSD: acpi.c,v 1.19 2017/08/31 06:53:58 msaitoh 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"
@@ -100,6 +101,8 @@
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_waet(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wdat(ACPI_TABLE_HEADER *sdp);
static void acpi_handle_wdrt(ACPI_TABLE_HEADER *sdp);
@@ -113,6 +116,8 @@
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;
@@ -361,6 +366,9 @@
case ACPI_HEST_TYPE_GENERIC_ERROR:
printf("Generic Hardware Error Source\n");
break;
+ case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
+ printf("Generic Hardware Error Source version 2\n");
+ break;
case ACPI_HEST_TYPE_RESERVED:
default:
printf("Reserved\n");
@@ -420,6 +428,24 @@
case ACPI_HEST_NOTIFY_NMI:
printf("NMI");
break;
+ case ACPI_HEST_NOTIFY_CMCI:
+ printf("CMCI");
+ break;
+ case ACPI_HEST_NOTIFY_MCE:
+ printf("MCE");
+ break;
+ case ACPI_HEST_NOTIFY_GPIO:
+ printf("GPIO-Signal");
+ break;
+ case ACPI_HEST_NOTIFY_SEA:
+ printf("ARMv8 SEA");
+ break;
+ case ACPI_HEST_NOTIFY_SEI:
+ printf("ARMv8 SEI");
+ break;
+ case ACPI_HEST_NOTIFY_GSIV:
+ printf("External Interrupt - GSIV");
+ break;
case ACPI_HEST_NOTIFY_RESERVED:
printf("RESERVED");
break;
@@ -656,6 +682,21 @@
}
static void
+acpi_print_hest_generic_v2(ACPI_HEST_GENERIC_V2 *data)
+{
+
+ /* The first 64 bytes are the same as ACPI_HEST_GENERIC */
+ acpi_print_hest_generic((ACPI_HEST_GENERIC *)data);
+
+ printf("\tError Status Address");
+ acpi_print_gas(&data->ReadAckRegister);
+ printf("\tRead Ack Preserve=0x%016jx\n",
+ (uintmax_t)data->ReadAckPreserve);
+ printf("\tRead Ack Write=0x%016jx\n",
+ (uintmax_t)data->ReadAckWrite);
+}
+
+static void
acpi_handle_hest(ACPI_TABLE_HEADER *sdp)
{
ACPI_TABLE_HEST *hest;
@@ -717,6 +758,11 @@
pos += sizeof(ACPI_HEST_GENERIC);
break;
+ case ACPI_HEST_TYPE_GENERIC_ERROR_V2:
+ acpi_print_hest_generic_v2(subtable);
+ pos += sizeof(ACPI_HEST_GENERIC_V2);
+ break;
+
case ACPI_HEST_TYPE_RESERVED:
default:
pos += sizeof(ACPI_HEST_HEADER);
@@ -820,6 +866,27 @@
}
static void
+acpi_walk_nfit(ACPI_TABLE_HEADER *table, void *first,
+ void (*action)(ACPI_NFIT_HEADER *))
+{
+ ACPI_NFIT_HEADER *subtable;
+ char *end;
+
+ subtable = first;
+ end = (char *)table + table->Length;
+ while ((char *)subtable < end) {
+ printf("\n");
+ if (subtable->Length < sizeof(ACPI_NFIT_HEADER)) {
+ warnx("invalid subtable length %u", subtable->Length);
+ return;
+ }
+ action(subtable);
+ subtable = (ACPI_NFIT_HEADER *)((char *)subtable +
+ subtable->Length);
+ }
+}
+
+static void
acpi_print_cpu(u_char cpu_id)
{
@@ -954,6 +1021,17 @@
"Corrected Platform Error" };
static void
+acpi_print_gicm_flags(ACPI_MADT_GENERIC_MSI_FRAME *gicm)
+{
+ uint32_t flags = gicm->Flags;
+
+ printf("\tFLAGS={ ");
+ if (flags & ACPI_MADT_OVERRIDE_SPI_VALUES)
+ printf("SPI Count/Base Select");
+ printf("}\n");
+}
+
+static void
acpi_print_madt(ACPI_SUBTABLE_HEADER *mp)
{
ACPI_MADT_LOCAL_APIC *lapic;
@@ -969,6 +1047,7 @@
ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi;
ACPI_MADT_GENERIC_INTERRUPT *gicc;
ACPI_MADT_GENERIC_DISTRIBUTOR *gicd;
+ ACPI_MADT_GENERIC_MSI_FRAME *gicm;
ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr;
ACPI_MADT_GENERIC_TRANSLATOR *gict;
@@ -1066,6 +1145,13 @@
printf("\tVector Base=%d\n", gicd->GlobalIrqBase);
printf("\tGIC VERSION=%d\n", (u_int)gicd->Version);
break;
+ case ACPI_MADT_TYPE_GENERIC_MSI_FRAME:
+ gicm = (ACPI_MADT_GENERIC_MSI_FRAME*)mp;
+ printf("\tBase ADDR=%016jx\n", (uintmax_t)gicm->BaseAddress);
+ acpi_print_gicm_flags(gicm);
+ printf("\tSPI Count=%u\n", gicm->SpiCount);
+ printf("\tSPI Base=%u\n", gicm->SpiBase);
+ break;
case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR:
gicr = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)mp;
printf("\tBase ADDR=%016jx\n", (uintmax_t)gicr->BaseAddress);
@@ -1217,6 +1303,12 @@
case ACPI_EINJ_GET_COMMAND_STATUS:
printf("Get Command Status");
break;
+ case ACPI_EINJ_SET_ERROR_TYPE_WITH_ADDRESS:
+ printf("Set Error Type With Address");
+ break;
+ case ACPI_EINJ_GET_EXECUTE_TIMINGS:
+ printf("Get Execute Operation Timings");
+ break;
case ACPI_EINJ_ACTION_RESERVED:
printf("Preserved");
break;
@@ -1353,6 +1445,9 @@
case ACPI_ERST_GET_ERROR_ATTRIBUTES:
printf("Get Error Attributes");
break;
+ case ACPI_ERST_EXECUTE_TIMINGS:
+ printf("Execute Operation Timings");
+ break;
case ACPI_ERST_ACTION_RESERVED:
printf("Reserved");
break;
@@ -1839,6 +1934,176 @@
printf(END_COMMENT);
}
+static const char *nfit_types[] = {
+ [ACPI_NFIT_TYPE_SYSTEM_ADDRESS] = "System Address",
+ [ACPI_NFIT_TYPE_MEMORY_MAP] = "Memory Map",
+ [ACPI_NFIT_TYPE_INTERLEAVE] = "Interleave",
+ [ACPI_NFIT_TYPE_SMBIOS] = "SMBIOS",
+ [ACPI_NFIT_TYPE_CONTROL_REGION] = "Control Region",
+ [ACPI_NFIT_TYPE_DATA_REGION] = "Data Region",
+ [ACPI_NFIT_TYPE_FLUSH_ADDRESS] = "Flush Address"
+};
+
+
+static void
+acpi_print_nfit(ACPI_NFIT_HEADER *nfit)
+{
+ char *uuidstr;
+ uint32_t status;
+
+ ACPI_NFIT_SYSTEM_ADDRESS *sysaddr;
+ ACPI_NFIT_MEMORY_MAP *mmap;
+ ACPI_NFIT_INTERLEAVE *ileave;
+ ACPI_NFIT_SMBIOS *smbios __unused;
+ ACPI_NFIT_CONTROL_REGION *ctlreg;
+ ACPI_NFIT_DATA_REGION *datareg;
+ ACPI_NFIT_FLUSH_ADDRESS *fladdr;
+
+ if (nfit->Type < __arraycount(nfit_types))
+ printf("\tType=%s\n", nfit_types[nfit->Type]);
+ else
+ printf("\tType=%u (unknown)\n", nfit->Type);
+ switch (nfit->Type) {
+ case ACPI_NFIT_TYPE_SYSTEM_ADDRESS:
+ sysaddr = (ACPI_NFIT_SYSTEM_ADDRESS *)nfit;
+ printf("\tRangeIndex=%u\n", (u_int)sysaddr->RangeIndex);
+ printf("\tProximityDomain=%u\n",
+ (u_int)sysaddr->ProximityDomain);
+ uuid_to_string((uuid_t *)(sysaddr->RangeGuid),
+ &uuidstr, &status);
+ if (status != uuid_s_ok)
+ errx(1, "uuid_to_string: status=%u", status);
+ printf("\tRangeGuid=%s\n", uuidstr);
+ free(uuidstr);
+ printf("\tAddress=0x%016jx\n", (uintmax_t)sysaddr->Address);
+ printf("\tLength=0x%016jx\n", (uintmax_t)sysaddr->Length);
+ printf("\tMemoryMapping=0x%016jx\n",
+ (uintmax_t)sysaddr->MemoryMapping);
+
+#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_## flag, #flag)
+
+ printf("\tFlags=");
+ PRINTFLAG(sysaddr->Flags, ADD_ONLINE_ONLY);
+ PRINTFLAG(sysaddr->Flags, PROXIMITY_VALID);
+ PRINTFLAG_END();
+
+#undef PRINTFLAG
+
+ break;
+ case ACPI_NFIT_TYPE_MEMORY_MAP:
+ mmap = (ACPI_NFIT_MEMORY_MAP *)nfit;
+ printf("\tDeviceHandle=%u\n", (u_int)mmap->DeviceHandle);
+ printf("\tPhysicalId=%u\n", (u_int)mmap->PhysicalId);
+ printf("\tRegionId=%u\n", (u_int)mmap->RegionId);
+ printf("\tRangeIndex=%u\n", (u_int)mmap->RangeIndex);
+ printf("\tRegionIndex=%u\n", (u_int)mmap->RegionIndex);
+ printf("\tRegionSize=0x%016jx\n", (uintmax_t)mmap->RegionSize);
+ printf("\tRegionOffset=0x%016jx\n",
+ (uintmax_t)mmap->RegionOffset);
+ printf("\tAddress=0x%016jx\n", (uintmax_t)mmap->Address);
+ printf("\tInterleaveIndex=%u\n", (u_int)mmap->InterleaveIndex);
+ printf("\tInterleaveWays=%u\n", (u_int)mmap->InterleaveWays);
+
+#define PRINTFLAG(var, flag) printflag((var), ACPI_NFIT_MEM_## flag, #flag)
+
+ printf("\tFlags=");
+ PRINTFLAG(mmap->Flags, SAVE_FAILED);
+ PRINTFLAG(mmap->Flags, RESTORE_FAILED);
+ PRINTFLAG(mmap->Flags, FLUSH_FAILED);
+ PRINTFLAG(mmap->Flags, NOT_ARMED);
+ PRINTFLAG(mmap->Flags, HEALTH_OBSERVED);
+ PRINTFLAG(mmap->Flags, HEALTH_ENABLED);
+ PRINTFLAG(mmap->Flags, MAP_FAILED);
+ PRINTFLAG_END();
+
+#undef PRINTFLAG
+
+ break;
+ case ACPI_NFIT_TYPE_INTERLEAVE:
+ ileave = (ACPI_NFIT_INTERLEAVE *)nfit;
+ printf("\tInterleaveIndex=%u\n",
+ (u_int)ileave->InterleaveIndex);
+ printf("\tLineCount=%u\n", (u_int)ileave->LineCount);
+ printf("\tLineSize=%u\n", (u_int)ileave->LineSize);
+ /* XXX ileave->LineOffset[i] output is not supported */
Home |
Main Index |
Thread Index |
Old Index