lib: utils/fdt: introduce fdt_node_is_enabled()
PATCH v2 1/3 lib: utils/fdt: introduce fdt_node_is_enabled()
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.
--- include/sbi_utils/fdt/fdt_helper.h | 2 ++ lib/utils/fdt/fdt_helper.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+)
(quoted diff) +0 -0
b/include/sbi_utils/fdt/fdt_helper.h
index 2279f96..a9c0a8a 100644
include/sbi_utils/fdt/fdt_helper.h +2 -0
@@ -48,6 +48,8 @@ int fdt_parse_phandle_with_args(void *fdt, int nodeoff,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);
lib/utils/fdt/fdt_helper.c +18 -0
@@ -216,6 +216,24 @@ int fdt_get_node_addr_size(void *fdt, int node, int index,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;
Signature · 1 line
2.35.1
PATCH v2 1/3 lib: utils/fdt: introduce fdt_node_is_enabled()
? 2022-05-09???? 15:55 +0200?Jan Reme????
Quoted 5 lines
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 <[email protected]>
Look good to me
Quoted 51 lines
---
?include/sbi_utils/fdt/fdt_helper.h |? 2 ++ ?lib/utils/fdt/fdt_helper.c???????? | 18 ++++++++++++++++++ ?2 files changed, 20 insertions(+)include/sbi_utils/fdt/fdt_helper.h +2
-0@@ -48,6 +48,8 @@ int fdt_parse_phandle_with_args(void *fdt, int nodeoff, ?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);lib/utils/fdt/fdt_helper.c +18
-0@@ -216,6 +216,24 @@ int fdt_get_node_addr_size(void *fdt, int node, int index, ???? 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;Signature · 1 line
2.35.1
PATCH v2 1/3 lib: utils/fdt: introduce fdt_node_is_enabled()
In reply to Jan RemešQuoted 6 lines · Jan Reme?
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 <[email protected]>
Looks good to me.
Regards,
Anup
Quoted 55 lines
--- include/sbi_utils/fdt/fdt_helper.h | 2 ++ lib/utils/fdt/fdt_helper.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+)include/sbi_utils/fdt/fdt_helper.h +2
-0@@ -48,6 +48,8 @@ int fdt_parse_phandle_with_args(void *fdt, int nodeoff,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);lib/utils/fdt/fdt_helper.c +18
-1@@ -216,6 +216,24 @@ int fdt_get_node_addr_size(void *fdt, int node, int index,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; --2.35.1
--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi