[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fwts-devel
Subject:    [PATCH 2/2][V2] lib: fwts_dump_data: make the dumping data the same format as acpidump
From:       Ivan Hu <ivan.hu () canonical ! com>
Date:       2020-06-16 11:20:17
Message-ID: 20200616112017.7928-3-ivan.hu () canonical ! com
[Download RAW message or body]

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++)
-- 
2.17.1


-- 
fwts-devel mailing list
fwts-devel@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/fwts-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic