diff options
author | Igor Mammedov <imammedo@redhat.com> | 2018-02-28 15:23:54 +0100 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2018-03-13 23:09:50 +0200 |
commit | dd1b2037a38024b69e952c5ac41fd63b96e552ab (patch) | |
tree | 9bcd195b4a51099eeaee84409268e2abda834625 /hw/arm/virt-acpi-build.c | |
parent | 8612f8bd9fb667c62e9a56c67ab2e3af2798dd9c (diff) |
virt_arm: acpi: reuse common build_fadt()
Extend generic build_fadt() to support rev5.1 FADT
and reuse it for 'virt' board, it would allow to
phase out usage of AcpiFadtDescriptorRev5_1 and
later ACPI_FADT_COMMON_DEF.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Tested-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/arm/virt-acpi-build.c')
-rw-r--r-- | hw/arm/virt-acpi-build.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index b644da901b..c7c6a57ec5 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -654,39 +654,30 @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) static void build_fadt_rev5(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms, unsigned dsdt_tbl_offset) { - int fadt_start = table_data->len; - AcpiFadtDescriptorRev5_1 *fadt = acpi_data_push(table_data, sizeof(*fadt)); - unsigned xdsdt_entry_offset = (char *)&fadt->x_dsdt - table_data->data; - uint16_t bootflags; + /* ACPI v5.1 */ + AcpiFadtData fadt = { + .rev = 5, + .minor_ver = 1, + .flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI, + .xdsdt_tbl_offset = &dsdt_tbl_offset, + }; switch (vms->psci_conduit) { case QEMU_PSCI_CONDUIT_DISABLED: - bootflags = 0; + fadt.arm_boot_arch = 0; break; case QEMU_PSCI_CONDUIT_HVC: - bootflags = ACPI_FADT_ARM_PSCI_COMPLIANT | ACPI_FADT_ARM_PSCI_USE_HVC; + fadt.arm_boot_arch = ACPI_FADT_ARM_PSCI_COMPLIANT | + ACPI_FADT_ARM_PSCI_USE_HVC; break; case QEMU_PSCI_CONDUIT_SMC: - bootflags = ACPI_FADT_ARM_PSCI_COMPLIANT; + fadt.arm_boot_arch = ACPI_FADT_ARM_PSCI_COMPLIANT; break; default: g_assert_not_reached(); } - /* Hardware Reduced = 1 and use PSCI 0.2+ */ - fadt->flags = cpu_to_le32(1 << ACPI_FADT_F_HW_REDUCED_ACPI); - fadt->arm_boot_flags = cpu_to_le16(bootflags); - - /* ACPI v5.1 (fadt->revision.fadt->minor_revision) */ - fadt->minor_revision = 0x1; - - /* DSDT address to be filled by Guest linker */ - bios_linker_loader_add_pointer(linker, - ACPI_BUILD_TABLE_FILE, xdsdt_entry_offset, sizeof(fadt->x_dsdt), - ACPI_BUILD_TABLE_FILE, dsdt_tbl_offset); - - build_header(linker, table_data, (void *)(table_data->data + fadt_start), - "FACP", table_data->len - fadt_start, 5, NULL, NULL); + build_fadt(table_data, linker, &fadt, NULL, NULL); } /* DSDT */ |