aboutsummaryrefslogtreecommitdiff
path: root/source/common/dmtbdump.c
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-11-17 18:06:08 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-11-17 18:06:08 +0000
commita56e3c255d5c5dfa4dd3a2fda4705a1607a6b7f3 (patch)
tree830d95042126506cd52440fe9710bb4e6811cfde /source/common/dmtbdump.c
parent7600ac2283596bd000a29b9347e95346d3b740d7 (diff)
downloadsrc-a56e3c255d5c5dfa4dd3a2fda4705a1607a6b7f3.tar.gz
src-a56e3c255d5c5dfa4dd3a2fda4705a1607a6b7f3.zip
Import ACPICA 20161117.vendor/acpica/20161117
Notes
Notes: svn path=/vendor-sys/acpica/dist/; revision=308770 svn path=/vendor-sys/acpica/20161117/; revision=308771; tag=vendor/acpica/20161117
Diffstat (limited to 'source/common/dmtbdump.c')
-rw-r--r--source/common/dmtbdump.c184
1 files changed, 115 insertions, 69 deletions
diff --git a/source/common/dmtbdump.c b/source/common/dmtbdump.c
index 4ef670d0ce9c..789256c12d3b 100644
--- a/source/common/dmtbdump.c
+++ b/source/common/dmtbdump.c
@@ -52,31 +52,12 @@
ACPI_MODULE_NAME ("dmtbdump")
-/* Table of revision-dependent FADT sizes */
+/* Local prototypes */
-static const UINT32 FadtRevisionLength [ACPI_FADT_MAX_VERSION + 1] =
-{
- 0, /* 0 - illegal */
- ACPI_FADT_V1_SIZE, /* 1 - ACPI 1.0 */
- 0, /* 2 - illegal */
- ACPI_FADT_V3_SIZE, /* 3 - ACPI 2.0 */
- ACPI_FADT_V4_SIZE, /* 4 - ACPI 3.0 and ACPI 4.0 */
- ACPI_FADT_V5_SIZE, /* 5 - ACPI 5.0 */
- ACPI_FADT_V6_SIZE /* 6 - ACPI 6.0 */
-};
-
-/* Table of revision-dependent FADT info tables */
-
-ACPI_DMTABLE_INFO *FadtRevisionInfo [ACPI_FADT_MAX_VERSION + 1] =
-{
- NULL, /* 0 - illegal */
- AcpiDmTableInfoFadt1, /* 1 - ACPI 1.0 */
- NULL, /* 2 - illegal */
- AcpiDmTableInfoFadt3, /* 3 - ACPI 2.0 */
- AcpiDmTableInfoFadt4, /* 4 - ACPI 3.0 and ACPI 4.0 */
- AcpiDmTableInfoFadt5, /* 5 - ACPI 5.0 */
- AcpiDmTableInfoFadt6 /* 6 - ACPI 6.0 */
-};
+static void
+AcpiDmValidateFadtLength (
+ UINT32 Revision,
+ UINT32 Length);
/*******************************************************************************
@@ -366,11 +347,6 @@ AcpiDmDumpXsdt (
*
* DESCRIPTION: Format the contents of a FADT
*
- * Check the FADT revision against the expected table length for
- * that revision. Issue a warning if the length is not what was
- * expected. This seems to be such a common BIOS bug that the
- * FADT revision has been rendered virtually meaningless.
- *
* NOTE: We cannot depend on the FADT version to indicate the actual
* contents of the FADT because of BIOS bugs. The table length
* is the only reliable indicator.
@@ -382,72 +358,142 @@ AcpiDmDumpFadt (
ACPI_TABLE_HEADER *Table)
{
ACPI_STATUS Status;
- UINT8 FadtRevision;
- UINT32 ExpectedLength;
- UINT32 i;
-
- FadtRevision = Table->Revision;
- /* FADT revision/length validation */
+ /* Always dump the minimum FADT revision 1 fields (ACPI 1.0) */
- if ((FadtRevision == 0) ||
- (FadtRevision == 2))
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ AcpiDmTableInfoFadt1);
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf (
- "// ACPI Warning: Invalid or unsupported FADT revision: %u\n",
- FadtRevision);
return;
}
- if (FadtRevision > ACPI_FADT_MAX_VERSION)
- {
- AcpiOsPrintf ("// ACPI Warning: Revision %u is not fully supported, "
- "disassembling known fields (up to revision %u)\n\n",
- FadtRevision, ACPI_FADT_MAX_VERSION);
- }
- else
+ /* Check for FADT revision 2 fields (ACPI 1.0B MS extensions) */
+
+ if ((Table->Length > ACPI_FADT_V1_SIZE) &&
+ (Table->Length <= ACPI_FADT_V2_SIZE))
{
- ExpectedLength = FadtRevisionLength[FadtRevision];
- if (Table->Length != ExpectedLength)
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ AcpiDmTableInfoFadt2);
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf (
- "// ACPI Warning: Input FADT revision %X does not match "
- "expected length: found 0x%X expected 0x%X\n",
- FadtRevision, Table->Length, ExpectedLength);
+ return;
}
}
- /*
- * Dump the input table on a per-version basis, but is actually
- * based upon the length of the table. Table length must
- * be larger than the required length of the previous version.
- */
- for (i = 1; i <= ACPI_FADT_MAX_VERSION; i++)
+ /* Check for FADT revision 3/4 fields and up (ACPI 2.0+ extended data) */
+
+ else if (Table->Length > ACPI_FADT_V2_SIZE)
{
- if (!FadtRevisionLength[i]) /* Skip any empty slots */
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ AcpiDmTableInfoFadt3);
+ if (ACPI_FAILURE (Status))
{
- continue;
+ return;
}
- /* Dump the fields specific to FADT revision[i] */
+ /* Check for FADT revision 5 fields and up (ACPI 5.0+) */
- Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
- FadtRevisionInfo[i]);
- if (ACPI_FAILURE (Status))
+ if (Table->Length > ACPI_FADT_V3_SIZE)
{
- return;
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ AcpiDmTableInfoFadt5);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
}
- if (Table->Length <= FadtRevisionLength[i])
+ /* Check for FADT revision 6 fields and up (ACPI 6.0+) */
+
+ if (Table->Length > ACPI_FADT_V3_SIZE)
{
- break; /* End of table */
+ Status = AcpiDmDumpTable (Table->Length, 0, Table, 0,
+ AcpiDmTableInfoFadt6);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
}
}
- /* Build a local FADT to test some FADT values */
+ /* Validate various fields in the FADT, including length */
AcpiTbCreateLocalFadt (Table, Table->Length);
+
+ /* Validate FADT length against the revision */
+
+ AcpiDmValidateFadtLength (Table->Revision, Table->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmValidateFadtLength
+ *
+ * PARAMETERS: Revision - FADT revision (Header->Revision)
+ * Length - FADT length (Header->Length
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check the FADT revision against the expected table length for
+ * that revision. Issue a warning if the length is not what was
+ * expected. This seems to be such a common BIOS bug that the
+ * FADT revision has been rendered virtually meaningless.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmValidateFadtLength (
+ UINT32 Revision,
+ UINT32 Length)
+{
+ UINT32 ExpectedLength;
+
+
+ switch (Revision)
+ {
+ case 0:
+
+ AcpiOsPrintf ("// ACPI Warning: Invalid FADT revision: 0\n");
+ return;
+
+ case 1:
+
+ ExpectedLength = ACPI_FADT_V1_SIZE;
+ break;
+
+ case 2:
+
+ ExpectedLength = ACPI_FADT_V2_SIZE;
+ break;
+
+ case 3:
+ case 4:
+
+ ExpectedLength = ACPI_FADT_V3_SIZE;
+ break;
+
+ case 5:
+
+ ExpectedLength = ACPI_FADT_V5_SIZE;
+ break;
+
+ default:
+
+ return;
+ }
+
+ if (Length == ExpectedLength)
+ {
+ return;
+ }
+
+ AcpiOsPrintf (
+ "\n// ACPI Warning: FADT revision %X does not match length: "
+ "found %X expected %X\n",
+ Revision, Length, ExpectedLength);
}