mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-22 23:21:31 +00:00
fdt: Fixup only valid memory banks
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@nvidia.com> Acked-by: Stephen Warren <swarren@nvidia.com>
This commit is contained in:
parent
4280342adb
commit
6d29cc7dcf
1 changed files with 7 additions and 1 deletions
|
@ -418,7 +418,7 @@ static int fdt_pack_reg(const void *fdt, void *buf, u64 *address, u64 *size,
|
||||||
int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
|
int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
|
||||||
{
|
{
|
||||||
int err, nodeoffset;
|
int err, nodeoffset;
|
||||||
int len;
|
int len, i;
|
||||||
u8 tmp[MEMORY_BANKS_MAX * 16]; /* Up to 64-bit address + 64-bit size */
|
u8 tmp[MEMORY_BANKS_MAX * 16]; /* Up to 64-bit address + 64-bit size */
|
||||||
|
|
||||||
if (banks > MEMORY_BANKS_MAX) {
|
if (banks > MEMORY_BANKS_MAX) {
|
||||||
|
@ -450,6 +450,12 @@ int fdt_fixup_memory_banks(void *blob, u64 start[], u64 size[], int banks)
|
||||||
if (!banks)
|
if (!banks)
|
||||||
return 0;
|
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);
|
len = fdt_pack_reg(blob, tmp, start, size, banks);
|
||||||
|
|
||||||
err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
|
err = fdt_setprop(blob, nodeoffset, "reg", tmp, len);
|
||||||
|
|
Loading…
Add table
Reference in a new issue