diff options
Diffstat (limited to 'meta-linaro-integration/recipes-overlayed/fwts/files')
3 files changed, 225 insertions, 0 deletions
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..4138358 --- /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,73 @@ | |||
1 | From e5a46ebd6dfeda4dbcec135d6482dfca7832999b Mon Sep 17 00:00:00 2001 | ||
2 | From: Fu Wei <fu.wei@linaro.org> | ||
3 | Date: Tue, 25 Nov 2014 16:53:51 +0800 | ||
4 | Subject: [PATCH 1/3] ACPI: improve the return values and the log info in the | ||
5 | fwts_acpi_handle_fadt_tables function. | ||
6 | |||
7 | If the 32-bit or/and 64-bit point is/are null, reture FWTS_NULL_POINTER instead of FWTS_ERROR. | ||
8 | Add the error log message for loading FACS/DSDT fail. | ||
9 | |||
10 | It is a prerequisite for ignoring a missing FACS table in hardware-reduced mode. | ||
11 | |||
12 | Upstream-status: Accepted [14.12.00] | ||
13 | Signed-off-by: Fu Wei <fu.wei@linaro.org> | ||
14 | |||
15 | --- | ||
16 | src/lib/src/fwts_acpi_tables.c | 12 +++++++----- | ||
17 | 1 file changed, 7 insertions(+), 5 deletions(-) | ||
18 | |||
19 | diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c | ||
20 | index 56498e0..96a117e 100644 | ||
21 | --- a/src/lib/src/fwts_acpi_tables.c | ||
22 | +++ b/src/lib/src/fwts_acpi_tables.c | ||
23 | @@ -311,19 +311,19 @@ static int fwts_acpi_handle_fadt_tables( | ||
24 | } | ||
25 | /* Is it sane? */ | ||
26 | if (addr == 0) { | ||
27 | - fwts_log_error(fw, "Failed to load %s: Cannot determine " | ||
28 | + fwts_log_warning(fw, "Failed to load %s: Cannot determine " | ||
29 | "address of %s from FADT, fields %s and %s are zero.", | ||
30 | name, name, name_addr32, name_addr64); | ||
31 | - return FWTS_ERROR; | ||
32 | + return FWTS_NULL_POINTER; | ||
33 | } | ||
34 | } else if ((addr32 != NULL) && (fadt->header.length >= 44)) { | ||
35 | addr = (off_t)*addr32; | ||
36 | /* Is it sane? */ | ||
37 | if (addr == 0) { | ||
38 | - fwts_log_error(fw, "Failed to load %s: Cannot determine " | ||
39 | + fwts_log_warning(fw, "Failed to load %s: Cannot determine " | ||
40 | "address of %s from FADT, field %s is zero.", | ||
41 | name, name, name_addr32); | ||
42 | - return FWTS_ERROR; | ||
43 | + return FWTS_NULL_POINTER; | ||
44 | } | ||
45 | } else if (fadt->header.length < 44) { | ||
46 | fwts_log_error(fw, "Failed to load %s: FADT is too small and " | ||
47 | @@ -333,7 +333,7 @@ static int fwts_acpi_handle_fadt_tables( | ||
48 | } else { | ||
49 | /* This should not happen, addr64 or addr32 are NULL */ | ||
50 | fwts_log_error(fw, "Failed to load %s: fwts error with FADT.", name); | ||
51 | - return FWTS_ERROR; | ||
52 | + return FWTS_NULL_POINTER; | ||
53 | } | ||
54 | |||
55 | /* Sane address found, load and add the table */ | ||
56 | @@ -375,12 +375,14 @@ static int fwts_acpi_handle_fadt( | ||
57 | "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", | ||
58 | &fadt->firmware_control, &fadt->x_firmware_ctrl, | ||
59 | provenance) != FWTS_OK) { | ||
60 | + fwts_log_error(fw, "Failed to load FACS!"); | ||
61 | return FWTS_ERROR; | ||
62 | } | ||
63 | /* Determine DSDT addr and load it */ | ||
64 | if (fwts_acpi_handle_fadt_tables(fw, fadt, | ||
65 | "DSDT", "DSTD", "X_DSDT", | ||
66 | &fadt->dsdt, &fadt->x_dsdt, provenance) != FWTS_OK) { | ||
67 | + fwts_log_error(fw, "Failed to load DSDT!"); | ||
68 | return FWTS_ERROR; | ||
69 | } | ||
70 | return FWTS_OK; | ||
71 | -- | ||
72 | 2.1.1 | ||
73 | |||
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..0e0805b --- /dev/null +++ b/meta-linaro-integration/recipes-overlayed/fwts/files/0002-ACPI-add-the-hardware-reduced-mode-check-function-in.patch | |||
@@ -0,0 +1,67 @@ | |||
1 | From ff40052c103ed67677b9c4a17cdcee62ca8f6aed Mon Sep 17 00:00:00 2001 | ||
2 | From: Fu Wei <fu.wei@linaro.org> | ||
3 | Date: Tue, 25 Nov 2014 17:12:24 +0800 | ||
4 | Subject: [PATCH 2/3] ACPI: add the hardware reduced mode check function in | ||
5 | src/lib/src/fwts_acpi_tables.c. | ||
6 | |||
7 | It is a prerequisite for ignoring a missing FACS table in hardware-reduced mode. | ||
8 | |||
9 | Upstream-status: Accepted [14.12.00] | ||
10 | Signed-off-by: Fu Wei <fu.wei@linaro.org> | ||
11 | --- | ||
12 | src/lib/include/fwts_acpi.h | 1 + | ||
13 | src/lib/include/fwts_acpi_tables.h | 2 ++ | ||
14 | src/lib/src/fwts_acpi_tables.c | 14 ++++++++++++++ | ||
15 | 3 files changed, 17 insertions(+) | ||
16 | |||
17 | diff --git a/src/lib/include/fwts_acpi.h b/src/lib/include/fwts_acpi.h | ||
18 | index 24ebc84..73a3461 100644 | ||
19 | --- a/src/lib/include/fwts_acpi.h | ||
20 | +++ b/src/lib/include/fwts_acpi.h | ||
21 | @@ -46,6 +46,7 @@ extern const char *fwts_acpi_fadt_preferred_pm_profile[]; | ||
22 | |||
23 | #define FWTS_ACPI_FADT_PREFERRED_PM_PROFILE(x) \ | ||
24 | ((x) > 8) ? "Reserved" : fwts_acpi_fadt_preferred_pm_profile[x] | ||
25 | +#define FWTS_ACPI_FADT_FLAGS_HW_REDUCED_ACPI (1<<20) | ||
26 | |||
27 | /* 5.2.3.1 Generic Address Structure */ | ||
28 | typedef struct { | ||
29 | diff --git a/src/lib/include/fwts_acpi_tables.h b/src/lib/include/fwts_acpi_tables.h | ||
30 | index 6977e87..798dfc5 100644 | ||
31 | --- a/src/lib/include/fwts_acpi_tables.h | ||
32 | +++ b/src/lib/include/fwts_acpi_tables.h | ||
33 | @@ -45,4 +45,6 @@ int fwts_acpi_find_table_by_addr(fwts_framework *fw, const uint64_t addr, fwts_a | ||
34 | int fwts_acpi_get_table(fwts_framework *fw, const int index, fwts_acpi_table_info **info); | ||
35 | uint8_t fwts_acpi_checksum(const uint8_t *data, const int length); | ||
36 | |||
37 | +fwts_bool fwts_acpi_is_reduced_hardware(const fwts_acpi_table_fadt *fadt); | ||
38 | + | ||
39 | #endif | ||
40 | diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c | ||
41 | index 96a117e..7f73a10 100644 | ||
42 | --- a/src/lib/src/fwts_acpi_tables.c | ||
43 | +++ b/src/lib/src/fwts_acpi_tables.c | ||
44 | @@ -275,6 +275,20 @@ int fwts_acpi_free_tables(void) | ||
45 | } | ||
46 | |||
47 | /* | ||
48 | + * fwts_acpi_is_reduced_hardware() | ||
49 | + * Check the ACPI tables for HW_REDUCED_ACPI bit in flag field. | ||
50 | + */ | ||
51 | +fwts_bool fwts_acpi_is_reduced_hardware(const fwts_acpi_table_fadt *fadt) | ||
52 | +{ | ||
53 | + if ((fadt->header.revision >= 5) && | ||
54 | + (fadt->header.length >= 116)&& | ||
55 | + (fadt->flags && FWTS_ACPI_FADT_FLAGS_HW_REDUCED_ACPI)) { | ||
56 | + return FWTS_TRUE; | ||
57 | + } | ||
58 | + return FWTS_FALSE; | ||
59 | +} | ||
60 | + | ||
61 | +/* | ||
62 | * fwts_acpi_handle_fadt_tables() | ||
63 | * depending on whether 32 or 64 bit address is usable, get the table | ||
64 | * address and load it. This handles the DSDT and FACS as pointed to | ||
65 | -- | ||
66 | 2.1.1 | ||
67 | |||
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..2a54533 --- /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,85 @@ | |||
1 | From 778310b83da2358a4e25444fcf9101e16f0a8b5b Mon Sep 17 00:00:00 2001 | ||
2 | From: Fu Wei <fu.wei@linaro.org> | ||
3 | Date: Tue, 25 Nov 2014 17:24:20 +0800 | ||
4 | Subject: [PATCH 3/3] ACPI: a missing FACS table can be ignored under some | ||
5 | circumstances | ||
6 | |||
7 | Both of the FADT fields FIRMWARE_CTRL and X_FIRMWARE_CTRL are | ||
8 | allowed to be null, if and only if ACPI is operating in hardware- | ||
9 | reduced mode. If the ACPI tables are from before ACPI 5.0, or if | ||
10 | ACPI is not operating in hardware-reduced mode, at least one of the | ||
11 | FIRMWARE_CTRL or X_FIRMWARE_CTRL fields _must_ be non-null. | ||
12 | |||
13 | This patch corrects the logic to ensure that a missing FACS is only | ||
14 | allowed under the proper circumstances. | ||
15 | |||
16 | Upstream-status: Accepted [14.12.00] | ||
17 | Signed-off-by: Fu Wei <fu.wei@linaro.org> | ||
18 | --- | ||
19 | src/acpi/acpitables/acpitables.c | 5 +++-- | ||
20 | src/lib/src/fwts_acpi_tables.c | 24 +++++++++++++++++------- | ||
21 | 2 files changed, 20 insertions(+), 9 deletions(-) | ||
22 | |||
23 | diff --git a/src/acpi/acpitables/acpitables.c b/src/acpi/acpitables/acpitables.c | ||
24 | index 255261c..3d261cb 100644 | ||
25 | --- a/src/acpi/acpitables/acpitables.c | ||
26 | +++ b/src/acpi/acpitables/acpitables.c | ||
27 | @@ -75,10 +75,11 @@ static void acpi_table_check_fadt(fwts_framework *fw, fwts_acpi_table_info *tabl | ||
28 | |||
29 | if (fadt->firmware_control == 0) { | ||
30 | if (table->length >= 140) { | ||
31 | - if (fadt->x_firmware_ctrl == 0) { | ||
32 | + if ((fadt->x_firmware_ctrl == 0) && !(fwts_acpi_is_reduced_hardware(fadt))) { | ||
33 | fwts_failed(fw, LOG_LEVEL_CRITICAL, "FADTFACSZero", "FADT 32 bit FIRMWARE_CONTROL and 64 bit X_FIRMWARE_CONTROL (FACS address) are null."); | ||
34 | fwts_advice(fw, "The 32 bit FIRMWARE_CTRL or 64 bit X_FIRMWARE_CTRL should point to a valid " | ||
35 | - "Firmware ACPI Control Structure (FACS). This is a firmware bug and needs to be fixed."); | ||
36 | + "Firmware ACPI Control Structure (FACS) when ACPI hardware reduced mode is not set. " | ||
37 | + "This is a firmware bug and needs to be fixed."); | ||
38 | } | ||
39 | } else { | ||
40 | fwts_failed(fw, LOG_LEVEL_MEDIUM, "FADT32BitFACSNull", "FADT 32 bit FIRMWARE_CONTROL is null."); | ||
41 | diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c | ||
42 | index 7f73a10..a8285f1 100644 | ||
43 | --- a/src/lib/src/fwts_acpi_tables.c | ||
44 | +++ b/src/lib/src/fwts_acpi_tables.c | ||
45 | @@ -373,6 +373,7 @@ static int fwts_acpi_handle_fadt( | ||
46 | const fwts_acpi_table_provenance provenance) | ||
47 | { | ||
48 | static uint64_t facs_last_phys_addr; /* default to zero */ | ||
49 | + int result = FWTS_ERROR; | ||
50 | |||
51 | /* | ||
52 | * The FADT handling may occur twice if it appears | ||
53 | @@ -384,13 +385,22 @@ static int fwts_acpi_handle_fadt( | ||
54 | |||
55 | facs_last_phys_addr = phys_addr; | ||
56 | |||
57 | - /* Determine FACS addr and load it */ | ||
58 | - if (fwts_acpi_handle_fadt_tables(fw, fadt, | ||
59 | - "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", | ||
60 | - &fadt->firmware_control, &fadt->x_firmware_ctrl, | ||
61 | - provenance) != FWTS_OK) { | ||
62 | - fwts_log_error(fw, "Failed to load FACS!"); | ||
63 | - return FWTS_ERROR; | ||
64 | + /* Determine FACS addr and load it. | ||
65 | + * Will ignore the missing FACS in the hardware-reduced mode. | ||
66 | + */ | ||
67 | + result = fwts_acpi_handle_fadt_tables(fw, fadt, | ||
68 | + "FACS", "FIRMWARE_CTRL", "X_FIRMWARE_CTRL", | ||
69 | + &fadt->firmware_control, &fadt->x_firmware_ctrl, | ||
70 | + provenance); | ||
71 | + if ( result != FWTS_OK) { | ||
72 | + if ((result == FWTS_NULL_POINTER) && | ||
73 | + fwts_acpi_is_reduced_hardware(fadt)) { | ||
74 | + fwts_log_info(fw, "Ignore the missing FACS. " | ||
75 | + "It is optional in hardware-reduced mode"); | ||
76 | + } else { | ||
77 | + fwts_log_error(fw, "Failed to load FACS!"); | ||
78 | + return FWTS_ERROR; | ||
79 | + } | ||
80 | } | ||
81 | /* Determine DSDT addr and load it */ | ||
82 | if (fwts_acpi_handle_fadt_tables(fw, fadt, | ||
83 | -- | ||
84 | 2.1.1 | ||
85 | |||