[PATCH v2] toradex: tdx-cfg-block: rework modules pid4 handling

Francesco Dolcini francesco at dolcini.it
Mon Nov 25 11:48:06 CET 2024


+Fabio

since he is the one normally picking patches from board/toradex/.

On Fri, Nov 22, 2024 at 06:27:22PM +0000, Vitor Soares wrote:
> From: Vitor Soares <vitor.soares at toradex.com>
> 
> 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 at toradex.com>
> ---
> v1->v2:
>   - Fix incorrect PID4 print when creating config block in interactive mode.
> 
>  board/toradex/common/tdx-cfg-block.c | 207 ++++++++++++++-------------
>  board/toradex/common/tdx-cfg-block.h |   2 +
>  board/toradex/common/tdx-common.c    |   4 +-
>  3 files changed, 116 insertions(+), 97 deletions(-)
> 

...

> diff --git a/board/toradex/common/tdx-common.c b/board/toradex/common/tdx-common.c
> index a6b45cdab810..dd2d4b27cea7 100644
> --- a/board/toradex/common/tdx-common.c
> +++ b/board/toradex/common/tdx-common.c
> @@ -194,10 +194,12 @@ static int tdx_get_str(struct udevice *dev, int id, size_t size, char *val)
>  
>  	switch (id) {
>  	case SYSINFO_ID_BOARD_MODEL:
> +		int idx = get_toradex_modules_idx(tdx_hw_tag.prodid);
> +

this is not something you are generally allowed to do in C, not sure which C
variant U-Boot wants, but I would avoid it.

I do not personally mind it, would appreciate a comment from Fabio or some
other maintainer on this.

Assuming this is fine,

Acked-by: Francesco Dolcini <francesco.dolcini at toradex.com>

Francesco



More information about the U-Boot mailing list