The size of the ACPI table header is not a multiple of 8. We have to mark
struct acpi_xsdt as packed to correctly access field Entry.
Add a unit test for the offsets of field Entry in the RSDT and XSDT tables.
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
};
/* XSDT (Extended System Description Table) */
-struct acpi_xsdt {
+struct __packed acpi_xsdt {
struct acpi_table_header header;
u64 entry[MAX_ACPI_TABLES];
};
return 0;
}
DM_TEST(dm_test_acpi_find_table, 0);
+
+/* Test offsets in RSDT, XSDT */
+static int dm_test_acpi_offsets(struct unit_test_state *uts)
+{
+ ut_asserteq(36, offsetof(struct acpi_rsdt, entry));
+ ut_asserteq(36, offsetof(struct acpi_xsdt, entry));
+
+ return 0;
+}
+DM_TEST(dm_test_acpi_offsets, 0);