FACS contains information that is only required in non HW reduced mode for ACPI. So we make it optional for arm64 which is a HW reduced platform.
The patch series will be proposed upstream when next spec errata is published.
Signed-off-by: Graeme Gregory graeme.gregory@linaro.org --- ...e-the-return-values-and-the-log-info-in-t.patch | 69 ++++++++++++++++++ ...e-hardware-reduced-mode-check-function-in.patch | 64 +++++++++++++++++ ...sing-FACS-table-can-be-ignored-under-some.patch | 82 ++++++++++++++++++++++ .../recipes-overlayed/fwts/fwts_git.bb | 7 +- 4 files changed, 221 insertions(+), 1 deletion(-) create mode 100644 meta-linaro-integration/recipes-overlayed/fwts/files/0001-ACPI-improve-the-return-values-and-the-log-info-in-t.patch create mode 100644 meta-linaro-integration/recipes-overlayed/fwts/files/0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch create mode 100644 meta-linaro-integration/recipes-overlayed/fwts/files/0003-ACPI-a-missing-FACS-table-can-be-ignored-under-some.patch
diff --git a/meta-linaro-integration/recipes-overlayed/fwts/files/0001-ACPI-improve-the-return-values-and-the-log-info-in-t.patch b/meta-linaro-integration/recipes-overlayed/fwts/files/0001-ACPI-improve-the-return-values-and-the-log-info-in-t.patch new file mode 100644 index 0000000..7662a29 --- /dev/null +++ b/meta-linaro-integration/recipes-overlayed/fwts/files/0001-ACPI-improve-the-return-values-and-the-log-info-in-t.patch @@ -0,0 +1,69 @@ +From e5a46ebd6dfeda4dbcec135d6482dfca7832999b Mon Sep 17 00:00:00 2001 +From: Fu Wei fu.wei@linaro.org +Date: Tue, 25 Nov 2014 16:53:51 +0800 +Subject: [PATCH 1/3] ACPI: improve the return values and the log info in the + fwts_acpi_handle_fadt_tables function. + +If the 32-bit or/and 64-bit point is/are null, reture FWTS_NULL_POINTER instead of FWTS_ERROR. +Add the error log message for loading FACS/DSDT fail. + +It is a prerequisite for ignoring a missing FACS table in hardware-reduced mode. +--- + src/lib/src/fwts_acpi_tables.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c +index 56498e0..96a117e 100644 +--- a/src/lib/src/fwts_acpi_tables.c ++++ b/src/lib/src/fwts_acpi_tables.c +@@ -311,19 +311,19 @@ static int fwts_acpi_handle_fadt_tables( + } + /* Is it sane? */ + if (addr == 0) { +- fwts_log_error(fw, "Failed to load %s: Cannot determine " ++ fwts_log_warning(fw, "Failed to load %s: Cannot determine " + "address of %s from FADT, fields %s and %s are zero.", + name, name, name_addr32, name_addr64); +- return FWTS_ERROR; ++ return FWTS_NULL_POINTER; + } + } else if ((addr32 != NULL) && (fadt->header.length >= 44)) { + addr = (off_t)*addr32; + /* Is it sane? */ + if (addr == 0) { +- fwts_log_error(fw, "Failed to load %s: Cannot determine " ++ fwts_log_warning(fw, "Failed to load %s: Cannot determine " + "address of %s from FADT, field %s is zero.", + name, name, name_addr32); +- return FWTS_ERROR; ++ return FWTS_NULL_POINTER; + } + } else if (fadt->header.length < 44) { + fwts_log_error(fw, "Failed to load %s: FADT is too small and " +@@ -333,7 +333,7 @@ static int fwts_acpi_handle_fadt_tables( + } else { + /* This should not happen, addr64 or addr32 are NULL */ + fwts_log_error(fw, "Failed to load %s: fwts error with FADT.", name); +- return FWTS_ERROR; ++ return FWTS_NULL_POINTER; + } + + /* Sane address found, load and add the table */ +@@ -375,12 +375,14 @@ static int fwts_acpi_handle_fadt( + "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", + &fadt->firmware_control, &fadt->x_firmware_ctrl, + provenance) != FWTS_OK) { ++ fwts_log_error(fw, "Failed to load FACS!"); + return FWTS_ERROR; + } + /* Determine DSDT addr and load it */ + if (fwts_acpi_handle_fadt_tables(fw, fadt, + "DSDT", "DSTD", "X_DSDT", + &fadt->dsdt, &fadt->x_dsdt, provenance) != FWTS_OK) { ++ fwts_log_error(fw, "Failed to load DSDT!"); + return FWTS_ERROR; + } + return FWTS_OK; +-- +2.1.1 + diff --git a/meta-linaro-integration/recipes-overlayed/fwts/files/0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch b/meta-linaro-integration/recipes-overlayed/fwts/files/0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch new file mode 100644 index 0000000..e1eace9 --- /dev/null +++ b/meta-linaro-integration/recipes-overlayed/fwts/files/0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch @@ -0,0 +1,64 @@ +From ff40052c103ed67677b9c4a17cdcee62ca8f6aed Mon Sep 17 00:00:00 2001 +From: Fu Wei fu.wei@linaro.org +Date: Tue, 25 Nov 2014 17:12:24 +0800 +Subject: [PATCH 2/3] ACPI: add the hardware reduced mode check function in + src/lib/src/fwts_acpi_tables.c. + +It is a prerequisite for ignoring a missing FACS table in hardware-reduced mode. +--- + src/lib/include/fwts_acpi.h | 1 + + src/lib/include/fwts_acpi_tables.h | 2 ++ + src/lib/src/fwts_acpi_tables.c | 14 ++++++++++++++ + 3 files changed, 17 insertions(+) + +diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h +index 24ebc84..73a3461 100644 +--- a/src/lib/include/fwts_acpi.h ++++ b/src/lib/include/fwts_acpi.h +@@ -46,6 +46,7 @@ extern const char *fwts_acpi_fadt_preferred_pm_profile[]; + + #define FWTS_ACPI_FADT_PREFERRED_PM_PROFILE(x) \ + ((x) > 8) ? "Reserved" : fwts_acpi_fadt_preferred_pm_profile[x] ++#define FWTS_ACPI_FADT_FLAGS_HW_REDUCED_ACPI (1<<20) + + /* 5.2.3.1 Generic Address Structure */ + typedef struct { +diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h +index 6977e87..798dfc5 100644 +--- a/src/lib/include/fwts_acpi_tables.h ++++ b/src/lib/include/fwts_acpi_tables.h +@@ -45,4 +45,6 @@ int fwts_acpi_find_table_by_addr(fwts_framework *fw, const uint64_t addr, fwts_a + int fwts_acpi_get_table(fwts_framework *fw, const int index, fwts_acpi_table_info **info); + uint8_t fwts_acpi_checksum(const uint8_t *data, const int length); + ++fwts_bool fwts_acpi_is_reduced_hardware(const fwts_acpi_table_fadt *fadt); ++ + #endif +diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c +index 96a117e..7f73a10 100644 +--- a/src/lib/src/fwts_acpi_tables.c ++++ b/src/lib/src/fwts_acpi_tables.c +@@ -275,6 +275,20 @@ int fwts_acpi_free_tables(void) + } + + /* ++ * fwts_acpi_is_reduced_hardware() ++ * Check the ACPI tables for HW_REDUCED_ACPI bit in flag field. ++ */ ++fwts_bool fwts_acpi_is_reduced_hardware(const fwts_acpi_table_fadt *fadt) ++{ ++ if ((fadt->header.revision >= 5) && ++ (fadt->header.length >= 116)&& ++ (fadt->flags && FWTS_ACPI_FADT_FLAGS_HW_REDUCED_ACPI)) { ++ return FWTS_TRUE; ++ } ++ return FWTS_FALSE; ++} ++ ++/* + * fwts_acpi_handle_fadt_tables() + * depending on whether 32 or 64 bit address is usable, get the table + * address and load it. This handles the DSDT and FACS as pointed to +-- +2.1.1 + diff --git a/meta-linaro-integration/recipes-overlayed/fwts/files/0003-ACPI-a-missing-FACS-table-can-be-ignored-under-some.patch b/meta-linaro-integration/recipes-overlayed/fwts/files/0003-ACPI-a-missing-FACS-table-can-be-ignored-under-some.patch new file mode 100644 index 0000000..9acddb2 --- /dev/null +++ b/meta-linaro-integration/recipes-overlayed/fwts/files/0003-ACPI-a-missing-FACS-table-can-be-ignored-under-some.patch @@ -0,0 +1,82 @@ +From 778310b83da2358a4e25444fcf9101e16f0a8b5b Mon Sep 17 00:00:00 2001 +From: Fu Wei fu.wei@linaro.org +Date: Tue, 25 Nov 2014 17:24:20 +0800 +Subject: [PATCH 3/3] ACPI: a missing FACS table can be ignored under some + circumstances + +Both of the FADT fields FIRMWARE_CTRL and X_FIRMWARE_CTRL are +allowed to be null, if and only if ACPI is operating in hardware- +reduced mode. If the ACPI tables are from before ACPI 5.0, or if +ACPI is not operating in hardware-reduced mode, at least one of the +FIRMWARE_CTRL or X_FIRMWARE_CTRL fields _must_ be non-null. + +This patch corrects the logic to ensure that a missing FACS is only +allowed under the proper circumstances. +--- + src/acpi/acpitables/acpitables.c | 5 +++-- + src/lib/src/fwts_acpi_tables.c | 24 +++++++++++++++++------- + 2 files changed, 20 insertions(+), 9 deletions(-) + +diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c +index 255261c..3d261cb 100644 +--- a/src/acpi/acpitables/acpitables.c ++++ b/src/acpi/acpitables/acpitables.c +@@ -75,10 +75,11 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl + + if (fadt->firmware_control == 0) { + if (table->length >= 140) { +- if (fadt->x_firmware_ctrl == 0) { ++ if ((fadt->x_firmware_ctrl == 0) && !(fwts_acpi_is_reduced_hardware(fadt))) { + fwts_failed(fw, LOG_LEVEL_CRITICAL, "FADTFACSZero", "FADT 32 bit FIRMWARE_CONTROL and 64 bit X_FIRMWARE_CONTROL (FACS address) are null."); + fwts_advice(fw, "The 32 bit FIRMWARE_CTRL or 64 bit X_FIRMWARE_CTRL should point to a valid " +- "Firmware ACPI Control Structure (FACS). This is a firmware bug and needs to be fixed."); ++ "Firmware ACPI Control Structure (FACS) when ACPI hardware reduced mode is not set. " ++ "This is a firmware bug and needs to be fixed."); + } + } else { + fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32BitFACSNull", "FADT 32 bit FIRMWARE_CONTROL is null."); +diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c +index 7f73a10..a8285f1 100644 +--- a/src/lib/src/fwts_acpi_tables.c ++++ b/src/lib/src/fwts_acpi_tables.c +@@ -373,6 +373,7 @@ static int fwts_acpi_handle_fadt( + const fwts_acpi_table_provenance provenance) + { + static uint64_t facs_last_phys_addr; /* default to zero */ ++ int result = FWTS_ERROR; + + /* + * The FADT handling may occur twice if it appears +@@ -384,13 +385,22 @@ static int fwts_acpi_handle_fadt( + + facs_last_phys_addr = phys_addr; + +- /* Determine FACS addr and load it */ +- if (fwts_acpi_handle_fadt_tables(fw, fadt, +- "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", +- &fadt->firmware_control, &fadt->x_firmware_ctrl, +- provenance) != FWTS_OK) { +- fwts_log_error(fw, "Failed to load FACS!"); +- return FWTS_ERROR; ++ /* Determine FACS addr and load it. ++ * Will ignore the missing FACS in the hardware-reduced mode. ++ */ ++ result = fwts_acpi_handle_fadt_tables(fw, fadt, ++ "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", ++ &fadt->firmware_control, &fadt->x_firmware_ctrl, ++ provenance); ++ if ( result != FWTS_OK) { ++ if ((result == FWTS_NULL_POINTER) && ++ fwts_acpi_is_reduced_hardware(fadt)) { ++ fwts_log_info(fw, "Ignore the missing FACS. " ++ "It is optional in hardware-reduced mode"); ++ } else { ++ fwts_log_error(fw, "Failed to load FACS!"); ++ return FWTS_ERROR; ++ } + } + /* Determine DSDT addr and load it */ + if (fwts_acpi_handle_fadt_tables(fw, fadt, +-- +2.1.1 + diff --git a/meta-linaro-integration/recipes-overlayed/fwts/fwts_git.bb b/meta-linaro-integration/recipes-overlayed/fwts/fwts_git.bb index 8b0e61b..ab31b7f 100644 --- a/meta-linaro-integration/recipes-overlayed/fwts/fwts_git.bb +++ b/meta-linaro-integration/recipes-overlayed/fwts/fwts_git.bb @@ -6,9 +6,14 @@ LICENSE = "GPLv2+" LIC_FILES_CHKSUM = "file://src/main.c;beginline=1;endline=16;md5=deb8af5388e838d133eaa036f4d1496f"
PV = "14.09.00" +PR = "r1"
SRCREV = "cf14f3b4bab716dea95de772ad52786c1cbe862a" -SRC_URI = "git://kernel.ubuntu.com/hwe/fwts.git" +SRC_URI = "git://kernel.ubuntu.com/hwe/fwts.git \ + file://0001-ACPI-improve-the-return-values-and-the-log-info-in-t.patch \ + file://0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch \ + file://0003-ACPI-a-missing-FACS-table-can-be-ignored-under-some.patch \ + "
S = "${WORKDIR}/git"