summaryrefslogtreecommitdiffstats
path: root/drivers/of/fdt.c
diff options
context:
space:
mode:
authorRob Herring <robh@kernel.org>2022-01-12 17:14:09 +0100
committerRob Herring <robh@kernel.org>2022-01-12 17:14:09 +0100
commite623611b4d3f722b57ceeaf4368ac787837408e7 (patch)
treedfcea1c4db3f59b8d084f4ddc24dda6e6180e460 /drivers/of/fdt.c
parentdt-bindings: net: mdio: Drop resets/reset-names child properties (diff)
parentefi: apply memblock cap after memblock_add() (diff)
downloadlinux-e623611b4d3f722b57ceeaf4368ac787837408e7.tar.xz
linux-e623611b4d3f722b57ceeaf4368ac787837408e7.zip
Merge branch 'dt/linus' into dt/next
Pick a fix which didn't make it into v5.16.
Diffstat (limited to 'drivers/of/fdt.c')
-rw-r--r--drivers/of/fdt.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index cf7608f0537b..ca2cfb3012a4 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -967,18 +967,22 @@ static void __init early_init_dt_check_for_elfcorehdr(unsigned long node)
elfcorehdr_addr, elfcorehdr_size);
}
-static phys_addr_t cap_mem_addr;
-static phys_addr_t cap_mem_size;
+static unsigned long chosen_node_offset = -FDT_ERR_NOTFOUND;
/**
* early_init_dt_check_for_usable_mem_range - Decode usable memory range
* location from flat tree
- * @node: reference to node containing usable memory range location ('chosen')
*/
-static void __init early_init_dt_check_for_usable_mem_range(unsigned long node)
+void __init early_init_dt_check_for_usable_mem_range(void)
{
const __be32 *prop;
int len;
+ phys_addr_t cap_mem_addr;
+ phys_addr_t cap_mem_size;
+ unsigned long node = chosen_node_offset;
+
+ if ((long)node < 0)
+ return;
pr_debug("Looking for usable-memory-range property... ");
@@ -991,6 +995,8 @@ static void __init early_init_dt_check_for_usable_mem_range(unsigned long node)
pr_debug("cap_mem_start=%pa cap_mem_size=%pa\n", &cap_mem_addr,
&cap_mem_size);
+
+ memblock_cap_memory_range(cap_mem_addr, cap_mem_size);
}
#ifdef CONFIG_SERIAL_EARLYCON
@@ -1143,9 +1149,10 @@ int __init early_init_dt_scan_chosen(char *cmdline)
if (node < 0)
return -ENOENT;
+ chosen_node_offset = node;
+
early_init_dt_check_for_initrd(node);
early_init_dt_check_for_elfcorehdr(node);
- early_init_dt_check_for_usable_mem_range(node);
/* Retrieve command line */
p = of_get_flat_dt_prop(node, "bootargs", &l);
@@ -1280,7 +1287,7 @@ void __init early_init_dt_scan_nodes(void)
early_init_dt_scan_memory();
/* Handle linux,usable-memory-range property */
- memblock_cap_memory_range(cap_mem_addr, cap_mem_size);
+ early_init_dt_check_for_usable_mem_range();
}
bool __init early_init_dt_scan(void *params)