Skip to contentSkip to conversation

toradex: configblock: fix module revision in config block

PATCH New denys.drozdov at toradex.com 3 participants 3 messages Apr 7, 2021 – Apr 20, 2021 x86 trust domain extensions (TDX)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toradex: configblock: fix module revision in config block

From: Denys Drozdov <[email protected]>

U-boot might display wrong module revision information for modules with an assembly version 'K'. "cfgblock create" does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

---
 board/toradex/common/tdx-cfg-block.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/toradex/common/tdx-cfg-block.c +3 -1
index adab0a0802..9be58d538b 100644
@@ -555,6 +555,8 @@ static int get_cfgblock_interactive(void)
 static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
 				u32 *serial)
 {
+	char revision[3] = {barcode[6], barcode[7], '\0'};
+
 	if (strlen(barcode) < 16) {
 		printf("Argument too short, barcode is 16 chars long\n");
 		return -1;
@@ -563,7 +565,7 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
 	/* Get hardware information from the first 8 digits */
 	tag->ver_major = barcode[4] - '0';
 	tag->ver_minor = barcode[5] - '0';
-	tag->ver_assembly = barcode[7] - '0';
+	tag->ver_assembly = simple_strtoul(revision, NULL, 10);
 
 	barcode[4] = '\0';
 	tag->prodid = simple_strtoul(barcode, NULL, 10);
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 toradex: configblock: fix module revision in config block

Quoted 11 lines · On Wed, Apr 7, 2021 at 3:31 PM <[email protected]> wrote:

From: Denys Drozdov <[email protected]>

U-boot might display wrong module revision information for modules with an assembly version 'K'. "cfgblock create" does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Quoted 29 lines
---
 board/toradex/common/tdx-cfg-block.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
board/toradex/common/tdx-cfg-block.c +3 -2
index adab0a0802..9be58d538b 100644
@@ -555,6 +555,8 @@ static int get_cfgblock_interactive(void)
 static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
                                u32 *serial)
 {
+       char revision[3] = {barcode[6], barcode[7], '\0'};
+
        if (strlen(barcode) < 16) {
                printf("Argument too short, barcode is 16 chars long\n");
                return -1;
@@ -563,7 +565,7 @@ static int get_cfgblock_barcode(char *barcode, struct toradex_hw *tag,
        /* Get hardware information from the first 8 digits */
        tag->ver_major = barcode[4] - '0';
        tag->ver_minor = barcode[5] - '0';
-       tag->ver_assembly = barcode[7] - '0';
+       tag->ver_assembly = simple_strtoul(revision, NULL, 10);
 
        barcode[4] = '\0';
        tag->prodid = simple_strtoul(barcode, NULL, 10);
--

2.17.1

Signature · 5 lines
Best regards
Oleksandr Suvorov

Toradex AG
Ebenaustrasse 10 | 6048 Horw | Switzerland | T: +41 41 500 48 00
#2 lore raw

PATCH 1/1 toradex: configblock: fix module revision in config block

In reply to denys.drozdov at toradex.com
Quoted 11 lines · denys.drozdov at toradex.com

From: Denys Drozdov <[email protected]>

U-boot might display wrong module revision information for modules with an assembly version 'K'. "cfgblock create" does not takes into account all revision digits from PID8.

This fix takes into account all digits of PID8
to store module revision.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210420/5bb49de7/attachment.sig>