summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/common/dmtable.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/common/dmtable.c')
-rw-r--r--sys/contrib/dev/acpica/common/dmtable.c305
1 files changed, 235 insertions, 70 deletions
diff --git a/sys/contrib/dev/acpica/common/dmtable.c b/sys/contrib/dev/acpica/common/dmtable.c
index 4b96575..a706453 100644
--- a/sys/contrib/dev/acpica/common/dmtable.c
+++ b/sys/contrib/dev/acpica/common/dmtable.c
@@ -117,6 +117,8 @@
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acdisasm.h>
#include <contrib/dev/acpica/include/actables.h>
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/compiler/dtcompiler.h>
/* This module used for application-level code only */
@@ -125,20 +127,12 @@
/* Local Prototypes */
-static ACPI_DMTABLE_DATA *
-AcpiDmGetTableData (
- char *Signature);
-
static void
AcpiDmCheckAscii (
UINT8 *Target,
char *RepairedName,
UINT32 Count);
-UINT8
-AcpiTbGenerateChecksum (
- ACPI_TABLE_HEADER *Table);
-
/* These tables map a subtable type to a description string */
@@ -161,6 +155,74 @@ static const char *AcpiDmDmarSubnames[] =
"Unknown SubTable Type" /* Reserved */
};
+static const char *AcpiDmEinjActions[] =
+{
+ "Begin Operation",
+ "Get Trigger Table",
+ "Set Error Type",
+ "Get Error Type",
+ "End Operation",
+ "Execute Operation",
+ "Check Busy Status",
+ "Get Command Status",
+ "Unknown Action"
+};
+
+static const char *AcpiDmEinjInstructions[] =
+{
+ "Read Register",
+ "Read Register Value",
+ "Write Register",
+ "Write Register Value",
+ "Noop",
+ "Unknown Instruction"
+};
+
+static const char *AcpiDmErstActions[] =
+{
+ "Begin Write Operation",
+ "Begin Read Operation",
+ "Begin Clear Operation",
+ "End Operation",
+ "Set Record Offset",
+ "Execute Operation",
+ "Check Busy Status",
+ "Get Command Status",
+ "Get Record Identifier",
+ "Set Record Identifier",
+ "Get Record Count",
+ "Begin Dummy Write",
+ "Unused/Unknown Action",
+ "Get Error Address Range",
+ "Get Error Address Length",
+ "Get Error Attributes",
+ "Unknown Action"
+};
+
+static const char *AcpiDmErstInstructions[] =
+{
+ "Read Register",
+ "Read Register Value",
+ "Write Register",
+ "Write Register Value",
+ "Noop",
+ "Load Var1",
+ "Load Var2",
+ "Store Var1",
+ "Add",
+ "Subtract",
+ "Add Value",
+ "Subtract Value",
+ "Stall",
+ "Stall While True",
+ "Skip Next If True",
+ "GoTo",
+ "Set Source Address",
+ "Set Destination Address",
+ "Move Data",
+ "Unknown Instruction"
+};
+
static const char *AcpiDmHestSubnames[] =
{
"IA-32 Machine Check Exception",
@@ -237,56 +299,59 @@ static const char *AcpiDmFadtProfiles[] =
*
* ACPI Table Data, indexed by signature.
*
- * Each entry contains: Signature, Table Info, Handler, Description
+ * Each entry contains: Signature, Table Info, Handler, DtHandler,
+ * Template, Description
*
- * Simple tables have only a TableInfo structure, complex tables have a handler.
- * This table must be NULL terminated. RSDP and FACS are special-cased
- * elsewhere.
+ * Simple tables have only a TableInfo structure, complex tables have a
+ * handler. This table must be NULL terminated. RSDP and FACS are
+ * special-cased elsewhere.
*
******************************************************************************/
-static ACPI_DMTABLE_DATA AcpiDmTableData[] =
+ACPI_DMTABLE_DATA AcpiDmTableData[] =
{
- {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
- {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
- {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"},
- {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
- {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
- {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
- {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
- {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"},
- {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"},
- {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
- {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"},
- {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
- {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, "I/O Virtualization Reporting Structure"},
- {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
- {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
- {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, "Management Controller Host Interface table"},
- {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, "Maximum System Characteristics Table"},
- {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
- {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
- {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"},
- {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
- {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
- {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
- {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
- {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
- {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, "UEFI Boot Optimization Table"},
- {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, "Windows ACPI Emulated Devices Table"},
- {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, "Watchdog Action Table"},
- {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
- {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
- {NULL, NULL, NULL, NULL}
+ {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, DtCompileAsf, TemplateAsf, "Alert Standard Format table"},
+ {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, NULL, TemplateBoot, "Simple Boot Flag Table"},
+ {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, NULL, TemplateBert, "Boot Error Record Table"},
+ {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, DtCompileCpep, TemplateCpep, "Corrected Platform Error Polling table"},
+ {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, NULL, TemplateDbgp, "Debug Port table"},
+ {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, DtCompileDmar, TemplateDmar, "DMA Remapping table"},
+ {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, NULL, TemplateEcdt, "Embedded Controller Boot Resources Table"},
+ {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, DtCompileEinj, TemplateEinj, "Error Injection table"},
+ {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, DtCompileErst, TemplateErst, "Error Record Serialization Table"},
+ {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, DtCompileFadt, TemplateFadt, "Fixed ACPI Description Table"},
+ {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, DtCompileHest, TemplateHest, "Hardware Error Source Table"},
+ {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, NULL, TemplateHpet, "High Precision Event Timer table"},
+ {ACPI_SIG_IVRS, NULL, AcpiDmDumpIvrs, DtCompileIvrs, TemplateIvrs, "I/O Virtualization Reporting Structure"},
+ {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, DtCompileMadt, TemplateMadt, "Multiple APIC Description Table"},
+ {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, DtCompileMcfg, TemplateMcfg, "Memory Mapped Configuration table"},
+ {ACPI_SIG_MCHI, AcpiDmTableInfoMchi, NULL, NULL, TemplateMchi, "Management Controller Host Interface table"},
+ {ACPI_SIG_MSCT, NULL, AcpiDmDumpMsct, DtCompileMsct, TemplateMsct, "Maximum System Characteristics Table"},
+ {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, DtCompileRsdt, TemplateRsdt, "Root System Description Table"},
+ {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, NULL, TemplateSbst, "Smart Battery Specification Table"},
+ {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, NULL, NULL, "Software Licensing Description Table"},
+ {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, DtCompileSlit, TemplateSlit, "System Locality Information Table"},
+ {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, NULL, TemplateSpcr, "Serial Port Console Redirection table"},
+ {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, NULL, TemplateSpmi, "Server Platform Management Interface table"},
+ {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, DtCompileSrat, TemplateSrat, "System Resource Affinity Table"},
+ {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, NULL, TemplateTcpa, "Trusted Computing Platform Alliance table"},
+ {ACPI_SIG_UEFI, AcpiDmTableInfoUefi, NULL, NULL, TemplateUefi, "UEFI Boot Optimization Table"},
+ {ACPI_SIG_WAET, AcpiDmTableInfoWaet, NULL, NULL, TemplateWaet, "Windows ACPI Emulated Devices Table"},
+ {ACPI_SIG_WDAT, NULL, AcpiDmDumpWdat, DtCompileWdat, TemplateWdat, "Watchdog Action Table"},
+ {ACPI_SIG_WDDT, AcpiDmTableInfoWddt, NULL, NULL, TemplateWddt, "Watchdog Description Table"},
+ {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, NULL, TemplateWdrt, "Watchdog Resource Table"},
+ {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, DtCompileXsdt, TemplateXsdt, "Extended System Description Table"},
+ {NULL, NULL, NULL, NULL, NULL, NULL}
};
/*******************************************************************************
*
- * FUNCTION: AcpiTbGenerateChecksum
+ * FUNCTION: AcpiDmGenerateChecksum
*
- * PARAMETERS: Table - Pointer to a valid ACPI table (with a
- * standard ACPI header)
+ * PARAMETERS: Table - Pointer to table to be checksummed
+ * Length - Length of the table
+ * OriginalChecksum - Value of the checksum field
*
* RETURN: 8 bit checksum of buffer
*
@@ -295,19 +360,21 @@ static ACPI_DMTABLE_DATA AcpiDmTableData[] =
******************************************************************************/
UINT8
-AcpiTbGenerateChecksum (
- ACPI_TABLE_HEADER *Table)
+AcpiDmGenerateChecksum (
+ void *Table,
+ UINT32 Length,
+ UINT8 OriginalChecksum)
{
UINT8 Checksum;
/* Sum the entire table as-is */
- Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length);
+ Checksum = AcpiTbChecksum ((UINT8 *) Table, Length);
/* Subtract off the existing checksum value in the table */
- Checksum = (UINT8) (Checksum - Table->Checksum);
+ Checksum = (UINT8) (Checksum - OriginalChecksum);
/* Compute the final checksum */
@@ -328,7 +395,7 @@ AcpiTbGenerateChecksum (
*
******************************************************************************/
-static ACPI_DMTABLE_DATA *
+ACPI_DMTABLE_DATA *
AcpiDmGetTableData (
char *Signature)
{
@@ -432,10 +499,13 @@ AcpiDmDumpDataTable (
}
}
- /* Always dump the raw table data */
+ if (!Gbl_DoTemplates || Gbl_VerboseTemplates)
+ {
+ /* Dump the raw table data */
- AcpiOsPrintf ("\nRaw Table Data\n\n");
- AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
+ AcpiOsPrintf ("\nRaw Table Data\n\n");
+ AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
+ }
}
@@ -463,15 +533,31 @@ AcpiDmLineHeader (
char *Name)
{
- if (ByteLength)
+ if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
{
- AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ",
- Offset, Offset, ByteLength, Name);
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%.3d] %34s : ",
+ ByteLength, Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("%40s : ",
+ Name);
+ }
}
- else
+ else /* Normal disassembler or verbose template */
{
- AcpiOsPrintf ("%43s : ",
- Name);
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %28s : ",
+ Offset, Offset, ByteLength, Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("%43s : ",
+ Name);
+ }
}
}
@@ -483,15 +569,31 @@ AcpiDmLineHeader2 (
UINT32 Value)
{
- if (ByteLength)
+ if (Gbl_DoTemplates && !Gbl_VerboseTemplates) /* Terse template */
{
- AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ",
- Offset, Offset, ByteLength, Name, Value);
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%.3d] %30s % 3d : ",
+ ByteLength, Name, Value);
+ }
+ else
+ {
+ AcpiOsPrintf ("%36s % 3d : ",
+ Name, Value);
+ }
}
- else
+ else /* Normal disassembler or verbose template */
{
- AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ",
- Offset, Offset, Name, Value);
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %4.4d% 3d] %24s % 3d : ",
+ Offset, Offset, ByteLength, Name, Value);
+ }
+ else
+ {
+ AcpiOsPrintf ("[%3.3Xh %4.4d ] %24s % 3d : ",
+ Offset, Offset, Name, Value);
+ }
}
}
@@ -511,6 +613,8 @@ AcpiDmLineHeader2 (
*
* DESCRIPTION: Display ACPI table contents by walking the Info table.
*
+ * Note: This function must remain in sync with DtGetFieldLength.
+ *
******************************************************************************/
ACPI_STATUS
@@ -571,6 +675,10 @@ AcpiDmDumpTable (
case ACPI_DMT_ASF:
case ACPI_DMT_HESTNTYP:
case ACPI_DMT_FADTPM:
+ case ACPI_DMT_EINJACT:
+ case ACPI_DMT_EINJINST:
+ case ACPI_DMT_ERSTACT:
+ case ACPI_DMT_ERSTINST:
ByteLength = 1;
break;
case ACPI_DMT_UINT16:
@@ -705,7 +813,11 @@ AcpiDmDumpTable (
for (Temp8 = 0; Temp8 < 16; Temp8++)
{
- AcpiOsPrintf ("%2.2X,", Target[Temp8]);
+ AcpiOsPrintf ("%2.2X", Target[Temp8]);
+ if ((Temp8 + 1) < 16)
+ {
+ AcpiOsPrintf (",");
+ }
}
AcpiOsPrintf ("\n");
break;
@@ -754,7 +866,9 @@ AcpiDmDumpTable (
/* Checksum, display and validate */
AcpiOsPrintf ("%2.2X", *Target);
- Temp8 = AcpiTbGenerateChecksum (Table);
+ Temp8 = AcpiDmGenerateChecksum (Table,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum);
if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
{
AcpiOsPrintf (
@@ -807,6 +921,58 @@ AcpiDmDumpTable (
AcpiOsPrintf ("%4.4X <%s>\n", ACPI_GET16 (Target), AcpiDmDmarSubnames[Temp16]);
break;
+ case ACPI_DMT_EINJACT:
+
+ /* EINJ Action types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_EINJ_ACTION_RESERVED)
+ {
+ Temp8 = ACPI_EINJ_ACTION_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjActions[Temp8]);
+ break;
+
+ case ACPI_DMT_EINJINST:
+
+ /* EINJ Instruction types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_EINJ_INSTRUCTION_RESERVED)
+ {
+ Temp8 = ACPI_EINJ_INSTRUCTION_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmEinjInstructions[Temp8]);
+ break;
+
+ case ACPI_DMT_ERSTACT:
+
+ /* ERST Action types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_ERST_ACTION_RESERVED)
+ {
+ Temp8 = ACPI_ERST_ACTION_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstActions[Temp8]);
+ break;
+
+ case ACPI_DMT_ERSTINST:
+
+ /* ERST Instruction types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_ERST_INSTRUCTION_RESERVED)
+ {
+ Temp8 = ACPI_ERST_INSTRUCTION_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmErstInstructions[Temp8]);
+ break;
+
case ACPI_DMT_HEST:
/* HEST subtable types */
@@ -842,7 +1008,6 @@ AcpiDmDumpTable (
AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]);
break;
-
case ACPI_DMT_MADT:
/* MADT subtable types */
OpenPOWER on IntegriCloud