diff mbox series

[1/2] lib: fwts_acpi_tables: customized tables dumping by default

Message ID 20200608073006.4608-2-ivan.hu@canonical.com
State Superseded
Headers show
Series make the acpi logs from fwts can be used acpica debugging | expand

Commit Message

Ivan Hu June 8, 2020, 7:30 a.m. UTC
Currently, fwts acpi table acpidumping first read from /dev/mem/,
it is the same as acpidump -c off, it will missing some customized tables.
Sync up with acpidump tool which read from sysfs first.

Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
 src/lib/src/fwts_acpi_tables.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Colin Ian King June 8, 2020, 8:07 a.m. UTC | #1
On 08/06/2020 08:30, Ivan Hu wrote:
> Currently, fwts acpi table acpidumping first read from /dev/mem/,
> it is the same as acpidump -c off, it will missing some customized tables.
> Sync up with acpidump tool which read from sysfs first.
> 
> Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
> ---
>  src/lib/src/fwts_acpi_tables.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
> index 3b1d7887..2e0c828a 100644
> --- a/src/lib/src/fwts_acpi_tables.c
> +++ b/src/lib/src/fwts_acpi_tables.c
> @@ -1214,11 +1214,13 @@ int fwts_acpi_load_tables(fwts_framework *fw)
>  		ret = fwts_acpi_load_tables_from_acpidump(fw);
>  		require_fixup = true;
>  	} else if (fwts_check_root_euid(fw, true) == FWTS_OK) {
> -		ret = fwts_acpi_load_tables_from_firmware(fw);
> +		/* Load from sysfs */
> +		ret = fwts_acpi_load_tables_from_sysfs(fw);
>  
> -		/* Load from memory failed (e.g. no /dev/mem), so try sysfs */
>  		if (ret != FWTS_OK) {
> -			ret = fwts_acpi_load_tables_from_sysfs(fw);
> +			/* Load from sysfs failed, so try memory (e.g. /dev/mem)*/
> +			ret = fwts_acpi_load_tables_from_firmware(fw);
> +		} else {
>  			require_fixup = true;
>  		}
>  	} else {
> 

My concern here is that I'm not 100% sure that older kernels provide all
the ACPI tables and /dev/mem will find them all if that interface is
available.

Perhaps we should do /sysfs first and then  /dev/mem and ignore
duplicates on the /dev/mem attempt
diff mbox series

Patch

diff --git a/src/lib/src/fwts_acpi_tables.c b/src/lib/src/fwts_acpi_tables.c
index 3b1d7887..2e0c828a 100644
--- a/src/lib/src/fwts_acpi_tables.c
+++ b/src/lib/src/fwts_acpi_tables.c
@@ -1214,11 +1214,13 @@  int fwts_acpi_load_tables(fwts_framework *fw)
 		ret = fwts_acpi_load_tables_from_acpidump(fw);
 		require_fixup = true;
 	} else if (fwts_check_root_euid(fw, true) == FWTS_OK) {
-		ret = fwts_acpi_load_tables_from_firmware(fw);
+		/* Load from sysfs */
+		ret = fwts_acpi_load_tables_from_sysfs(fw);
 
-		/* Load from memory failed (e.g. no /dev/mem), so try sysfs */
 		if (ret != FWTS_OK) {
-			ret = fwts_acpi_load_tables_from_sysfs(fw);
+			/* Load from sysfs failed, so try memory (e.g. /dev/mem)*/
+			ret = fwts_acpi_load_tables_from_firmware(fw);
+		} else {
 			require_fixup = true;
 		}
 	} else {