If an FDT node contains a "status" property and this property is not
"ok" or "okay", this node should be ignored. Introduce a function that
checks this.
Signed-off-by: Jan Remes <jan.remes@codasip.com>
Reviewed-by: Xiang W <wxjstz@126.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
int fdt_get_node_addr_size(void *fdt, int node, int index,
uint64_t *addr, uint64_t *size);
+bool fdt_node_is_enabled(void *fdt, int nodeoff);
+
int fdt_parse_hart_id(void *fdt, int cpu_offset, u32 *hartid);
int fdt_parse_max_hart_id(void *fdt, u32 *max_hartid);
return 0;
}
+bool fdt_node_is_enabled(void *fdt, int nodeoff)
+{
+ int len;
+ const void *prop;
+
+ prop = fdt_getprop(fdt, nodeoff, "status", &len);
+ if (!prop)
+ return true;
+
+ if (!strncmp(prop, "okay", strlen("okay")))
+ return true;
+
+ if (!strncmp(prop, "ok", strlen("ok")))
+ return true;
+
+ return false;
+}
+
int fdt_parse_hart_id(void *fdt, int cpu_offset, u32 *hartid)
{
int len;