summaryrefslogtreecommitdiff
path: root/source/compiler/dttable.c
diff options
context:
space:
mode:
Diffstat (limited to 'source/compiler/dttable.c')
-rw-r--r--source/compiler/dttable.c70
1 files changed, 34 insertions, 36 deletions
diff --git a/source/compiler/dttable.c b/source/compiler/dttable.c
index 7b33e4d2302e3..c1011f8231354 100644
--- a/source/compiler/dttable.c
+++ b/source/compiler/dttable.c
@@ -129,9 +129,12 @@ DtCompileFadt (
DT_SUBTABLE *ParentTable;
DT_FIELD **PFieldList = (DT_FIELD **) List;
ACPI_TABLE_HEADER *Table;
- UINT8 Revision;
+ UINT8 FadtRevision;
+ UINT32 i;
+ /* Minimum table is the FADT version 1 (ACPI 1.0) */
+
Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt1,
&Subtable, TRUE);
if (ACPI_FAILURE (Status))
@@ -143,53 +146,48 @@ DtCompileFadt (
DtInsertSubtable (ParentTable, Subtable);
Table = ACPI_CAST_PTR (ACPI_TABLE_HEADER, ParentTable->Buffer);
- Revision = Table->Revision;
+ FadtRevision = Table->Revision;
+
+ /* Revision 0 and 2 are illegal */
- if (Revision == 2)
+ if ((FadtRevision == 0) ||
+ (FadtRevision == 2))
{
- Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt2,
- &Subtable, TRUE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ DtError (ASL_ERROR, 0, NULL,
+ "Invalid value for FADT revision");
- DtInsertSubtable (ParentTable, Subtable);
+ return (AE_BAD_VALUE);
}
- else if (Revision >= 2)
+
+ /* Revision out of supported range? */
+
+ if (FadtRevision > ACPI_FADT_MAX_VERSION)
{
- Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt3,
- &Subtable, TRUE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ DtError (ASL_ERROR, 0, NULL,
+ "Unknown or unsupported value for FADT revision");
- DtInsertSubtable (ParentTable, Subtable);
+ return (AE_BAD_VALUE);
+ }
- if (Revision >= 5)
- {
- Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt5,
- &Subtable, TRUE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Compile individual sub-parts of the FADT, per-revision */
- DtInsertSubtable (ParentTable, Subtable);
+ for (i = 3; i <= ACPI_FADT_MAX_VERSION; i++)
+ {
+ if (i > FadtRevision)
+ {
+ break;
}
- if (Revision >= 6)
- {
- Status = DtCompileTable (PFieldList, AcpiDmTableInfoFadt6,
- &Subtable, TRUE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Compile the fields specific to this FADT revision */
- DtInsertSubtable (ParentTable, Subtable);
+ Status = DtCompileTable (PFieldList, FadtRevisionInfo[i],
+ &Subtable, TRUE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
}
+
+ DtInsertSubtable (ParentTable, Subtable);
}
return (AE_OK);