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

Vitor Soares
2024-11-25T13:07:34Z

On Mon, 2024-11-25 at 11:48 +0100, Francesco Dolcini wrote:
> +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@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@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.

My mistake, I will send a V3 addressing it.

Best regards,
Vitor Soares