[PATCH 10/32] cmd: fdt: Add support for integer arrays in fdt get value with index
Simon Glass
sjg at chromium.org
Thu Mar 2 00:38:28 CET 2023
On Mon, 27 Feb 2023 at 12:55, Marek Vasut
<marek.vasut+renesas at mailbox.org> wrote:
>
> Currently any integer array value is set as long up-to-40 character
> hexadecimal string into environment variable when extracted from an
> FDT using 'fdt get value path prop index', because the support for
> handling integer arrays is not implemented, and fdt_value_env_set()
> code falls back into the hash handling behavior instead.
>
> Implement this support simply by checking whether user supplied any
> index. If index is set and the property length is multiple of four,
> then this is an integer array, and the code would extract value at
> specified index.
>
> There is a subtle change where default index is set to -1 instead of 0.
> This is OK, since the only place which checks for index to be less or
> equal zero is the string array handling code in fdt_value_env_set() and
> that code would work perfectly well with index -1 too.
>
> Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
> ---
> Cc: Heinrich Schuchardt <heinrich.schuchardt at canonical.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Tom Rini <trini at konsulko.com>
> ---
> cmd/fdt.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
Reviewed-by: Simon Glass <sjg at chromium.org>
More information about the U-Boot
mailing list