From 8ba912f3e41d66311922c03941c3b587e0257472 Mon Sep 17 00:00:00 2001 From: Bob Moore Date: Fri, 22 Feb 2013 11:46:32 +0100 Subject: [PATCH] ACPI 5.0: Implement hardware-reduced option If HW-reduced flag is set in the FADT, do not attempt to access or initialize any ACPI hardware, including SCI and global lock. No FACS will be present. Signed-off-by: Bob Moore Also adjust acpi_fadt_parse_sleep_info(). Signed-off-by: Jan Beulich Acked-by: Keir Fraser --- xen/arch/x86/acpi/boot.c | 5 +++++ xen/drivers/acpi/tables/tbfadt.c | 22 ++++++++++++++++++++-- xen/include/acpi/acglobal.h | 7 +++++++ 3 files changed, 32 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/acpi/boot.c b/xen/arch/x86/acpi/boot.c index 24bc2ad13b..b2dc35eade 100644 --- a/xen/arch/x86/acpi/boot.c +++ b/xen/arch/x86/acpi/boot.c @@ -328,6 +328,9 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt) struct acpi_table_facs *facs = NULL; uint64_t facs_pa; + if (fadt->flags & ACPI_FADT_HW_REDUCED) + goto bad; + acpi_fadt_copy_address(pm1a_cnt, pm1a_control, pm1_control); acpi_fadt_copy_address(pm1b_cnt, pm1b_control, pm1_control); acpi_fadt_copy_address(pm1a_evt, pm1a_event, pm1_event); @@ -351,6 +354,8 @@ acpi_fadt_parse_sleep_info(struct acpi_table_fadt *fadt) fadt->facs, facs_pa); facs_pa = (uint64_t)fadt->facs; } + if (!facs_pa) + goto bad; facs = (struct acpi_table_facs *) __acpi_map_table(facs_pa, sizeof(struct acpi_table_facs)); diff --git a/xen/drivers/acpi/tables/tbfadt.c b/xen/drivers/acpi/tables/tbfadt.c index e3644f4927..2ab4588f0b 100644 --- a/xen/drivers/acpi/tables/tbfadt.c +++ b/xen/drivers/acpi/tables/tbfadt.c @@ -197,8 +197,13 @@ void __init acpi_tb_parse_fadt(acpi_native_uint table_index, u8 flags) acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xdsdt, flags, ACPI_SIG_DSDT, ACPI_TABLE_INDEX_DSDT); - acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT.Xfacs, - flags, ACPI_SIG_FACS, ACPI_TABLE_INDEX_FACS); + /* If Hardware Reduced flag is set, there is no FACS */ + + if (!acpi_gbl_reduced_hardware) { + acpi_tb_install_table((acpi_physical_address) acpi_gbl_FADT. + Xfacs, flags, ACPI_SIG_FACS, + ACPI_TABLE_INDEX_FACS); + } } /******************************************************************************* @@ -242,6 +247,13 @@ void __init acpi_tb_create_local_fadt(struct acpi_table_header *table, u32 lengt ACPI_MEMCPY(&acpi_gbl_FADT, table, ACPI_MIN(length, sizeof(struct acpi_table_fadt))); + /* Take a copy of the Hardware Reduced flag */ + + acpi_gbl_reduced_hardware = FALSE; + if (acpi_gbl_FADT.flags & ACPI_FADT_HW_REDUCED) { + acpi_gbl_reduced_hardware = TRUE; + } + /* * 1) Convert the local copy of the FADT to the common internal format * 2) Validate some of the important values within the FADT @@ -401,6 +413,12 @@ static void __init acpi_tb_validate_fadt(void) u8 length; acpi_native_uint i; + /* If Hardware Reduced flag is set, we are all done */ + + if (acpi_gbl_reduced_hardware) { + return; + } + /* Examine all of the 64-bit extended address fields (X fields) */ for (i = 0; i < ACPI_FADT_INFO_ENTRIES; i++) { diff --git a/xen/include/acpi/acglobal.h b/xen/include/acpi/acglobal.h index 87dcfcc99d..c2a96097b9 100644 --- a/xen/include/acpi/acglobal.h +++ b/xen/include/acpi/acglobal.h @@ -78,6 +78,13 @@ ACPI_EXTERN struct acpi_table_fadt acpi_gbl_FADT; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1a_enable; ACPI_EXTERN struct acpi_generic_address acpi_gbl_xpm1b_enable; +/* + * ACPI 5.0 introduces the concept of a "reduced hardware platform", meaning + * that the ACPI hardware is no longer required. A flag in the FADT indicates + * a reduced HW machine, and that flag is duplicated here for convenience. + */ +ACPI_EXTERN u8 acpi_gbl_reduced_hardware; + /***************************************************************************** * * Miscellaneous globals -- 2.30.2