diff options
Diffstat (limited to 'board/toradex/common/tdx-cfg-block.c')
-rw-r--r-- | board/toradex/common/tdx-cfg-block.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/board/toradex/common/tdx-cfg-block.c b/board/toradex/common/tdx-cfg-block.c index e792e05f3e..8067ebc1a0 100644 --- a/board/toradex/common/tdx-cfg-block.c +++ b/board/toradex/common/tdx-cfg-block.c @@ -145,11 +145,17 @@ const struct toradex_som toradex_modules[] = { [76] = { "Verdin AM62 Quad 2GB WB IT", TARGET_IS_ENABLED(VERDIN_AM62_A53) }, }; -const char * const toradex_carrier_boards[] = { - [0] = "UNKNOWN CARRIER BOARD", - [155] = "Dahlia", - [156] = "Verdin Development Board", - [173] = "Yavia", +struct pid4list { + int pid4; + char * const name; +}; + +const struct pid4list toradex_carrier_boards[] = { + /* the code assumes unknown at index 0 */ + {0, "UNKNOWN CARRIER BOARD"}, + {DAHLIA, "Dahlia"}, + {VERDIN_DEVELOPMENT_BOARD, "Verdin Development Board"}, + {YAVIA, "Yavia"}, }; const char * const toradex_display_adapters[] = { @@ -163,6 +169,19 @@ const u32 toradex_ouis[] = { [1] = 0x8c06cbUL, }; +const char * const get_toradex_carrier_boards(int pid4) +{ + int i, index = 0; + + for (i = 1; i < ARRAY_SIZE(toradex_carrier_boards); i++) { + if (pid4 == toradex_carrier_boards[i].pid4) { + index = i; + break; + } + } + return toradex_carrier_boards[index].name; +} + static u32 get_serial_from_mac(struct toradex_eth_addr *eth_addr) { int i; @@ -642,10 +661,11 @@ static int get_cfgblock_carrier_interactive(void) int ret = 0; printf("Supported carrier boards:\n"); - printf("CARRIER BOARD NAME\t\t [ID]\n"); + printf("%30s\t[ID]\n", "CARRIER BOARD NAME"); for (int i = 0; i < ARRAY_SIZE(toradex_carrier_boards); i++) - if (toradex_carrier_boards[i]) - printf("%s \t\t [%d]\n", toradex_carrier_boards[i], i); + printf("%30s\t[%d]\n", + toradex_carrier_boards[i].name, + toradex_carrier_boards[i].pid4); sprintf(message, "Choose your carrier board (provide ID): "); len = cli_readline(message); |