Index: ofw_bus_if.m =================================================================== --- ofw_bus_if.m (revision 261352) +++ ofw_bus_if.m (working copy) @@ -46,6 +46,7 @@ char *obd_model; char *obd_name; char *obd_type; + char *obd_status; }; }; Index: ofw_bus_subr.c =================================================================== --- ofw_bus_subr.c (revision 261352) +++ ofw_bus_subr.c (working copy) @@ -55,6 +55,7 @@ OF_getprop_alloc(node, "compatible", 1, (void **)&obd->obd_compat); OF_getprop_alloc(node, "device_type", 1, (void **)&obd->obd_type); OF_getprop_alloc(node, "model", 1, (void **)&obd->obd_model); + OF_getprop_alloc(node, "status", 1, (void **)&obd->obd_status); obd->obd_node = node; return (0); } @@ -73,6 +74,8 @@ free(obd->obd_name, M_OFWPROP); if (obd->obd_type != NULL) free(obd->obd_type, M_OFWPROP); + if (obd->obd_status != NULL) + free(obd->obd_status, M_OFWPROP); } int @@ -147,7 +150,31 @@ return (obd->obd_type); } +const char * +ofw_bus_get_status(device_t dev) +{ + const struct ofw_bus_devinfo *obd; + + obd = OFW_BUS_GET_DEVINFO(bus, dev); + if (obd == NULL) + return (NULL); + + return (obd->obd_status); +} + int +ofw_bus_status_okay(device_t dev) +{ + const char *status; + + status = ofw_bus_get_status(dev); + if (status == NULL || strcmp(status, "okay") == 0) + return (1); + + return (0); +} + +int ofw_bus_is_compatible(device_t dev, const char *onecompat) { phandle_t node; Index: ofw_bus_subr.h =================================================================== --- ofw_bus_subr.h (revision 261352) +++ ofw_bus_subr.h (working copy) @@ -72,6 +72,10 @@ int ofw_bus_search_intrmap(void *, int, void *, int, void *, int, void *, void *, void *, int, phandle_t *); +/* Helper to get device status property */ +const char *ofw_bus_get_status(device_t dev); +int ofw_bus_status_okay(device_t dev); + /* Helper to get node's interrupt parent */ void ofw_bus_find_iparent(phandle_t);