Skip to contentSkip to conversation

cmd: acpi: Print revisions in hex format

PATCH Superseded Andy Shevchenko 4 participants 11 messages Sep 8, 2020 – Sep 21, 2020

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/acpi.c +1 -1
index 085a3a650d1a..a3419b42b556 100644
@@ -26,7 +26,7 @@ static void dump_hdr(struct acpi_table_header *hdr)
 	printf("%.*s %08lx %06x", ACPI_NAME_LEN, hdr->signature,
 	       (ulong)map_to_sysmem(hdr), hdr->length);
 	if (has_hdr) {
-		printf(" (v%02d %.6s %.8s %u %.4s %d)\n", hdr->revision,
+		printf(" (v%02d %.6s %.8s %x %.4s %x)\n", hdr->revision,
 		       hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
 		       hdr->aslc_id, hdr->aslc_revision);
 	} else {
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Hi Andy,

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 16 lines

Betreff: [PATCH v1] cmd: acpi: Print revisions in hex format

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Quoted 6 lines
Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Tested on a custom Apollolake board.

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

regards, Wolfgang

#2 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Quoted 24 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 16 lines

Betreff: [PATCH v1] cmd: acpi: Print revisions in hex format

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Quoted 6 lines
Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 3 lines

Tested on a custom Apollolake board.

Thanks!

Quoted 4 lines

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

Can you elaborate what was the problem that checksum helped?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Hi Andy,

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 28 lines

Betreff: Re: [PATCH v1] cmd: acpi: Print revisions in hex format

Quoted 24 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 22 lines

Betreff: [PATCH v1] cmd: acpi: Print revisions in hex format

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 5 lines
Quoted 3 lines

Tested on a custom Apollolake board.

Thanks!

You're welcome.

Quoted 7 lines
Quoted 5 lines

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

Can you elaborate what was the problem that checksum helped?

Sure. I saw two strange things with the ACPI checksums:

1) The DSDT length included uninitialized bytes from alignment. This is described in the following link:

https://lists.denx.de/pipermail/u-boot/2020-September/425378.html

This was the actual bug I was looking for.

2) acpi_create_spcr() is missing a memset(). The other acpi_create_xxxx() functions perform a memset on their structure, acpi_create_spcr() does not and as a result the contents of this table are party uninitialized.

I plan to send a patch for both of them.

Regards, Wolfgang

#4 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Quoted 4 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 3 lines
Quoted 1 line · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

...

Quoted 14 lines
Quoted 6 lines
Quoted 4 lines

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

Can you elaborate what was the problem that checksum helped?

Sure. I saw two strange things with the ACPI checksums:

1) The DSDT length included uninitialized bytes from alignment. This is described in the following link:

   https://lists.denx.de/pipermail/u-boot/2020-September/425378.html
Quoted 7 lines

This was the actual bug I was looking for.

2) acpi_create_spcr() is missing a memset(). The other acpi_create_xxxx() functions perform a memset on their structure, acpi_create_spcr() does not and as a result the contents of this table are party uninitialized.

I plan to send a patch for both of them.

I'm not sure I understood how checksum pointed to uninitialized data?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#5 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

In reply to Wolfgang Wallner

Hi Andy,

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 26 lines

Betreff: Re: [PATCH v1] cmd: acpi: Print revisions in hex format

Quoted 4 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 3 lines
Quoted 1 line · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

...

Quoted 16 lines
Quoted 6 lines
Quoted 4 lines

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

Can you elaborate what was the problem that checksum helped?

Sure. I saw two strange things with the ACPI checksums:

1) The DSDT length included uninitialized bytes from alignment. This is described in the following link:

   https://lists.denx.de/pipermail/u-boot/2020-September/425378.html

This was the actual bug I was looking for.

Quoted 7 lines
Quoted 5 lines

2) acpi_create_spcr() is missing a memset(). The other acpi_create_xxxx() functions perform a memset on their structure, acpi_create_spcr() does not and as a result the contents of this table are party uninitialized.

I plan to send a patch for both of them.

I'm not sure I understood how checksum pointed to uninitialized data?

After adding the checksums to "acpi list" I realized that the checksums for DSDT and SPCR where different after every reset. Looking at the code each turned out to be somehow related to uninitialized memory.

regards, Wolfgang

PS: My mail client has somehow corrupted your last mail, and I can't open it. A colleague has forwarded it to me so I could reply. This is why I reply to my own mail.

#6 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Quoted 7 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 6 lines

Betreff: Re: [PATCH v1] cmd: acpi: Print revisions in hex format

Quoted 4 lines · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

Quoted 3 lines
Quoted 1 line · Wolfgang Wallner

-----"Andy Shevchenko" <[email protected]> schrieb: -----

...

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 6 lines
Quoted 4 lines

Related to "acpi list":
During my recent ACPI debugging I found it very useful to have the checksum printed for each table with "acpi list". Would there be interest to have that upstream? If so I would send a patch.

Can you elaborate what was the problem that checksum helped?

Sure. I saw two strange things with the ACPI checksums:

1) The DSDT length included uninitialized bytes from alignment. This is described in the following link:

   https://lists.denx.de/pipermail/u-boot/2020-September/425378.html

This was the actual bug I was looking for.

2) acpi_create_spcr() is missing a memset(). The other acpi_create_xxxx() functions perform a memset on their structure, acpi_create_spcr() does not and as a result the contents of this table are party uninitialized.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

I plan to send a patch for both of them.

I'm not sure I understood how checksum pointed to uninitialized data?

After adding the checksums to "acpi list" I realized that the checksums for DSDT and SPCR where different after every reset. Looking at the code each turned out to be somehow related to uninitialized memory.

I see. I would rather to have it as a separate (sub-)command. But I leave this to Simon.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#7 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

In reply to Andy Shevchenko
Quoted 15 lines · Andy Shevchenko

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Quoted 7 lines
Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#8 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Quoted 26 lines · Bin Meng
Quoted 15 lines · Andy Shevchenko

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Quoted 7 lines
Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 1 line

applied to u-boot-x86, thanks!

#9 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

In reply to Andy Shevchenko

Hi Andy,

Quoted 27 lines · Andy Shevchenko

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/acpi.c +0 -0
index 085a3a650d1a..a3419b42b556 100644

cmd/acpi.c static void dump_hdr(struct acpi_table_header *hdr)

Quoted 9 lines
cmd/acpi.c +1 -2
@@ -26,7 +26,7 @@ static void dump_hdr(struct acpi_table_header *hdr)
        printf("%.*s %08lx %06x", ACPI_NAME_LEN, hdr->signature,
               (ulong)map_to_sysmem(hdr), hdr->length);
        if (has_hdr) {
-               printf(" (v%02d %.6s %.8s %u %.4s %d)\n", hdr->revision,
+               printf(" (v%02d %.6s %.8s %x %.4s %x)\n", hdr->revision,
                       hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
                       hdr->aslc_id, hdr->aslc_revision);
        } else {
--

This unfortunately breaks the unit test.

/u/test/dm/acpi.c:371, dm_test_acpi_cmd_list(): console:
Expected 'RSDT 0570ebf0 000030 (v01 U-BOOT U-BOOTBL 538970401 INTL 0)', got 'RSDT 0570ebf0 000030 (v01 U-BOOT U-BOOTBL 20200921 INTL 0)'
Failures: 2

Would you please resend v2 to fix this?

Regards,
Bin

#10 lore raw

PATCH 1/1 cmd: acpi: Print revisions in hex format

Quoted 41 lines · Bin Meng
Quoted 27 lines · Andy Shevchenko

The revisions are usually dates in hex-decimal format representing YYYYmmdd. Print them in hex to see this clearly.

Before:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 538970376 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 65536 INTL 538968870)
...
After:
...
FACP 000e5420 0000f4 (v06 U-BOOT U-BOOTBL 20200908 INTL 0) DSDT 000e4780 000ba0 (v02 U-BOOT U-BOOTBL 10000 INTL 20200326)
...

Fixes 0b885bcfd9b0 ("acpi: Add an acpi command")
Cc Wolfgang Wallner <[email protected]>
---
 cmd/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
cmd/acpi.c +0 -0
index 085a3a650d1a..a3419b42b556 100644

cmd/acpi.c static void dump_hdr(struct acpi_table_header *hdr)

Quoted 9 lines
cmd/acpi.c +1 -2
@@ -26,7 +26,7 @@ static void dump_hdr(struct acpi_table_header *hdr)
        printf("%.*s %08lx %06x", ACPI_NAME_LEN, hdr->signature,
               (ulong)map_to_sysmem(hdr), hdr->length);
        if (has_hdr) {
-               printf(" (v%02d %.6s %.8s %u %.4s %d)\n", hdr->revision,
+               printf(" (v%02d %.6s %.8s %x %.4s %x)\n", hdr->revision,
                       hdr->oem_id, hdr->oem_table_id, hdr->oem_revision,
                       hdr->aslc_id, hdr->aslc_revision);
        } else {
--

This unfortunately breaks the unit test.

Quoted 6 lines

/u/test/dm/acpi.c:371, dm_test_acpi_cmd_list(): console:
Expected 'RSDT 0570ebf0 000030 (v01 U-BOOT U-BOOTBL 538970401 INTL 0)', got 'RSDT 0570ebf0 000030 (v01 U-BOOT U-BOOTBL 20200921 INTL 0)'
Failures: 2

Would you please resend v2 to fix this?

v2 has been just sent. Thanks!

Signature · 2 lines
With Best Regards,
Andy Shevchenko