[PATCH 2/2] lib: fwts_dump_data: make the dumping data the same format as acpidump

Alex Hung alex.hung at canonical.com
Mon Jun 8 17:59:51 UTC 2020


On 2020-06-08 1:30 a.m., Ivan Hu wrote:
> The dumping ACPI tables are not exact the same as the tables dumping from
> acpidump, that make acpica tools iasl cannot be used by the acpidump.log
> from fwts --dump.
> 
> iasl -d dsdt.dat  will get the checksum error,
> Input file dsdt.dat, Length 0x3D5E8 (251368) bytes
> Firmware Warning (ACPI): Incorrect checksum in table [DSDT] - 0xFC, should be 0x38 (20180105/tbprint-239)
> ACPI: DSDT 0x0000000000000000 03D5E8 (v02 ALASKA A M I    01072009 INTL 20160527)
> Pass 1 parse of [DSDT]
> 
> Currenltly, data dumping from acpidump
>   FFD0: 30 0A 08 A0 19 5B 12 5C 2F 04 5F 53 42 5F 50 43  0....[.\/._SB_PC
>   FFE0: 49 30 52 50 30 39 50 4F 46 46 00 A4 01 A1 48 10  I0RP09POFF....H.
>   FFF0: A0 22 93 5F 54 5F 30 0A 0A A0 19 5B 12 5C 2F 04  ."._T_0....[.\/.
>  10000: 5F 53 42 5F 50 43 49 30 52 50 31 31 50 4F 46 46  _SB_PCI0RP11POFF
>  10010: 00 A4 01 A1 42 0E A0 22 93 5F 54 5F 30 0A 0C A0  ....B.."._T_0...
>  10020: 19 5B 12 5C 2F 04 5F 53 42 5F 50 43 49 30 52 50  .[.\/._SB_PCI0RP
> 
> and from fwts --dump
>   ffd0: 30 0a 08 a0 19 5b 12 5c 2f 04 5f 53 42 5f 50 43  0....[.\/._SB_PC
>   ffe0: 49 30 52 50 30 39 50 4f 46 46 00 a4 01 a1 48 10  I0RP09POFF....H.
>   fff0: a0 22 93 5f 54 5f 30 0a 0a a0 19 5b 12 5c 2f 04  ."._T_0....[.\/.
>   10000: 5f 53 42 5f 50 43 49 30 52 50 31 31 50 4f 46 46  _SB_PCI0RP11POFF
>   10010: 00 a4 01 a1 42 0e a0 22 93 5f 54 5f 30 0a 0c a0  ....B.."._T_0...
>   10020: 19 5b 12 5c 2f 04 5f 53 42 5f 50 43 49 30 52 50  .[.\/._SB_PCI0RP
> 
> fix the fwts acpidump.log to be the same as dumping data from acpidump, so
> that iasl can be used.
> 
> Signed-off-by: Ivan Hu <ivan.hu at canonical.com>
> ---
>  src/lib/src/fwts_dump_data.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/lib/src/fwts_dump_data.c b/src/lib/src/fwts_dump_data.c
> index c9576fda..a1fa1c9f 100644
> --- a/src/lib/src/fwts_dump_data.c
> +++ b/src/lib/src/fwts_dump_data.c
> @@ -39,7 +39,12 @@ void fwts_dump_raw_data(
>  	int n = 0;
>  	int nbytes_max = nbytes > 16 ? 16 : nbytes;
>  
> -	n = snprintf(buffer, len, "  %4.4x: ", addr);
> +	if (addr >= 0x100000)
> +		n = snprintf(buffer, len, "%6.6x: ", addr);
> +	else if (addr >= 0x10000)
> +		n = snprintf(buffer, len, " %5.5x: ", addr);
> +	else
> +		n = snprintf(buffer, len, "  %4.4x: ", addr);

acpidump uses upper cases for hex numbers. How about doing the same for
easy comparison?


>  
>  	/* Hex dump */
>          for (i = 0; i < nbytes_max; i++)
> 


-- 
Cheers,
Alex Hung



More information about the fwts-devel mailing list