diff options
author | Wojciech Macek <wma@FreeBSD.org> | 2017-01-25 10:28:21 +0000 |
---|---|---|
committer | Wojciech Macek <wma@FreeBSD.org> | 2017-01-25 10:28:21 +0000 |
commit | e5e94d2de9871eb12339ec12a8edf8869a14a71e (patch) | |
tree | fa0349cada7357dbb62966a92a361d0e70e48310 /sys/dev/ofw/ofw_bus_subr.c | |
parent | c0f1c1f8ff057adb10bdbb14e0320f307fed3ee8 (diff) |
Notes
Diffstat (limited to 'sys/dev/ofw/ofw_bus_subr.c')
-rw-r--r-- | sys/dev/ofw/ofw_bus_subr.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sys/dev/ofw/ofw_bus_subr.c b/sys/dev/ofw/ofw_bus_subr.c index 1c80106ceb616..84adfa14d1787 100644 --- a/sys/dev/ofw/ofw_bus_subr.c +++ b/sys/dev/ofw/ofw_bus_subr.c @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include "ofw_bus_if.h" #define OFW_COMPAT_LEN 255 +#define OFW_STATUS_LEN 16 int ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *obd, phandle_t node) @@ -179,6 +180,24 @@ ofw_bus_status_okay(device_t dev) return (0); } +int +ofw_bus_node_status_okay(phandle_t node) +{ + char status[OFW_STATUS_LEN]; + int len; + + len = OF_getproplen(node, "status"); + if (len <= 0) + return (1); + + OF_getprop(node, "status", status, OFW_STATUS_LEN); + if ((len == 5 && (bcmp(status, "okay", len) == 0)) || + (len == 3 && (bcmp(status, "ok", len)))) + return (1); + + return (0); +} + static int ofw_bus_node_is_compatible_int(const char *compat, int len, const char *onecompat) |