[U-Boot] [PATCH] fdt: Fixup only valid memory banks
Lothar Waßmann
LW at KARO-electronics.de
Tue Jan 30 11:41:15 UTC 2018
Hi,
On Tue, 30 Jan 2018 11:34:17 +0100 Thierry Reding wrote:
> From: Thierry Reding <treding at nvidia.com>
>
> Memory banks with address 0 and size 0 are empty and should not be
> passed to the OS via device tree.
>
> Signed-off-by: Thierry Reding <treding at nvidia.com>
> ---
> common/fdt_support.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/common/fdt_support.c b/common/fdt_support.c
> index 724452d75452..8b33f6773d27 100644
> --- a/common/fdt_support.c
> +++ b/common/fdt_support.c
> @@ -457,7 +457,7 @@ int fdt_record_loadable(void *blob, u32 index, const char *name,
> int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
> {
> int err, nodeoffset;
> - int len;
> + int len, i;
> u8 tmp[MEMORY_BANKS_MAX * 16]; /* Up to 64-bit address + 64-bit size */
>
> if (banks > MEMORY_BANKS_MAX) {
> @@ -489,6 +489,12 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
> if (!banks)
> return 0;
>
> + for (i = 0; i < banks; i++)
> + if (start[i] == 0 && size[i] == 0)
> + break;
> +
> + banks = i;
> +
> len = fdt_pack_reg(blob, tmp, start, size, banks);
>
> err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
>
Does an empty bank always imply the end of the list, or
Is it a valid scenario to have intervening empty banks?
Lothar Waßmann
More information about the U-Boot
mailing list