diff mbox series

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

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

Commit Message

Ivan Hu June 16, 2020, 11:20 a.m. UTC
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@canonical.com>
---
 src/lib/src/fwts_dump_data.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Alex Hung June 16, 2020, 10:03 p.m. UTC | #1
On 2020-06-16 5:20 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@canonical.com>
> ---
>  src/lib/src/fwts_dump_data.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_dump_data.c b/src/lib/src/fwts_dump_data.c
> index c9576fda..430ca9ef 100644
> --- a/src/lib/src/fwts_dump_data.c
> +++ b/src/lib/src/fwts_dump_data.c
> @@ -39,11 +39,16 @@ 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);
>  
>  	/* Hex dump */
>          for (i = 0; i < nbytes_max; i++)
> -                n += snprintf(buffer + n, len - n, "%2.2x ", data[i]);
> +                n += snprintf(buffer + n, len - n, "%2.2X ", data[i]);
>  
>  	/* Padding */
>          for (; i < 16; i++)
> 

Acked-by: Alex Hung <alex.hung@canonical.com>
Colin Ian King June 22, 2020, 2:12 p.m. UTC | #2
On 16/06/2020 12:20, 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@canonical.com>
> ---
>  src/lib/src/fwts_dump_data.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/src/lib/src/fwts_dump_data.c b/src/lib/src/fwts_dump_data.c
> index c9576fda..430ca9ef 100644
> --- a/src/lib/src/fwts_dump_data.c
> +++ b/src/lib/src/fwts_dump_data.c
> @@ -39,11 +39,16 @@ 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);
>  
>  	/* Hex dump */
>          for (i = 0; i < nbytes_max; i++)
> -                n += snprintf(buffer + n, len - n, "%2.2x ", data[i]);
> +                n += snprintf(buffer + n, len - n, "%2.2X ", data[i]);
>  
>  	/* Padding */
>          for (; i < 16; i++)
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
diff mbox series

Patch

diff --git a/src/lib/src/fwts_dump_data.c b/src/lib/src/fwts_dump_data.c
index c9576fda..430ca9ef 100644
--- a/src/lib/src/fwts_dump_data.c
+++ b/src/lib/src/fwts_dump_data.c
@@ -39,11 +39,16 @@  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);
 
 	/* Hex dump */
         for (i = 0; i < nbytes_max; i++)
-                n += snprintf(buffer + n, len - n, "%2.2x ", data[i]);
+                n += snprintf(buffer + n, len - n, "%2.2X ", data[i]);
 
 	/* Padding */
         for (; i < 16; i++)