toradex: tdx-cfg-block: rework modules pid4 handling
The module pid4 currently corresponds to the index of the toradex_module
array. If a new pid4 is introduced that does not follow the sequence of
the previous entries, it will create a gap in the array.
To address this, embed pid4 within the toradex_som structure and
implement a function to retrieve the index corresponding to pid4.
Signed-off-by: Vitor Soares <vitor.soares@toradex.com>
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>
diff --git a/board/toradex/common/tdx-cfg-block.h b/board/toradex/common/tdx-cfg-block.h
index 0d6dd1c..937e84c 100644
--- a/board/toradex/common/tdx-cfg-block.h
+++ b/board/toradex/common/tdx-cfg-block.h
@@ -21,6 +21,7 @@
} __attribute__((__packed__));
struct toradex_som {
+ int pid4;
const char *name;
int is_enabled;
};
@@ -139,6 +140,7 @@
int read_tdx_cfg_block(void);
int read_tdx_cfg_block_carrier(void);
+int get_toradex_modules_idx(int pid4);
const char * const get_toradex_carrier_boards(int pid4);
const char * const get_toradex_display_adapters(int pid4);
int try_migrate_tdx_cfg_block_carrier(void);