Lines Matching +full:pre +full:- +full:dcp
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
171 static MALLOC_DEFINE(M_BUS_SC, "bus-sc", "Bus data structures, softc");
181 #define DRIVERNAME(d) ((d)? d->name : "no driver")
182 #define DEVCLANAME(d) ((d)? d->name : "no devclass")
244 value = dc->parent ? dc->parent->name : ""; in devclass_sysctl_handler()
255 if (dc->sysctl_tree != NULL) in devclass_sysctl_init()
257 sysctl_ctx_init(&dc->sysctl_ctx); in devclass_sysctl_init()
258 dc->sysctl_tree = SYSCTL_ADD_NODE(&dc->sysctl_ctx, in devclass_sysctl_init()
259 SYSCTL_STATIC_CHILDREN(_dev), OID_AUTO, dc->name, in devclass_sysctl_init()
261 SYSCTL_ADD_PROC(&dc->sysctl_ctx, SYSCTL_CHILDREN(dc->sysctl_tree), in devclass_sysctl_init()
295 sbuf_cat(&sb, dev->desc ? dev->desc : ""); in device_sysctl_handler()
298 sbuf_cat(&sb, dev->driver ? dev->driver->name : ""); in device_sysctl_handler()
307 sbuf_cat(&sb, dev->parent ? dev->parent->nameunit : ""); in device_sysctl_handler()
345 devclass_t dc = dev->devclass; in device_sysctl_init()
348 if (dev->sysctl_tree != NULL) in device_sysctl_init()
351 sysctl_ctx_init(&dev->sysctl_ctx); in device_sysctl_init()
352 dev->sysctl_tree = SYSCTL_ADD_NODE_WITH_LABEL(&dev->sysctl_ctx, in device_sysctl_init()
353 SYSCTL_CHILDREN(dc->sysctl_tree), OID_AUTO, in device_sysctl_init()
354 dev->nameunit + strlen(dc->name), in device_sysctl_init()
356 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
360 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
365 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
370 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
375 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
380 SYSCTL_ADD_PROC(&dev->sysctl_ctx, SYSCTL_CHILDREN(dev->sysctl_tree), in device_sysctl_init()
386 SYSCTL_ADD_INT(&dev->sysctl_ctx, in device_sysctl_init()
387 SYSCTL_CHILDREN(dev->sysctl_tree), OID_AUTO, "%domain", in device_sysctl_init()
394 devclass_t dc = dev->devclass; in device_sysctl_update()
396 if (dev->sysctl_tree == NULL) in device_sysctl_update()
398 sysctl_rename_oid(dev->sysctl_tree, dev->nameunit + strlen(dc->name)); in device_sysctl_update()
404 if (dev->sysctl_tree == NULL) in device_sysctl_fini()
406 sysctl_ctx_free(&dev->sysctl_ctx); in device_sysctl_fini()
407 dev->sysctl_tree = NULL; in device_sysctl_fini()
479 if (dl->pass < new->pass) in driver_register_pass()
481 if (dl->pass == new->pass) in driver_register_pass()
520 if (dl->pass <= bus_current_pass) in bus_set_pass()
527 if (dl->pass > pass) in bus_set_pass()
534 bus_current_pass = dl->pass; in bus_set_pass()
559 * otherwise if @p create is non-zero create and return a new device
562 * If @p parentname is non-NULL, the parent of the devclass is set to
567 * @param create non-zero to create a devclass
580 if (!strcmp(dc->name, classname)) in devclass_find_internal()
588 dc->parent = NULL; in devclass_find_internal()
589 dc->name = (char*) (dc + 1); in devclass_find_internal()
590 strcpy(dc->name, classname); in devclass_find_internal()
591 TAILQ_INIT(&dc->drivers); in devclass_find_internal()
605 if (parentname && dc && !dc->parent && in devclass_find_internal()
607 dc->parent = devclass_find_internal(parentname, NULL, TRUE); in devclass_find_internal()
608 dc->parent->flags |= DC_HAS_CHILDREN; in devclass_find_internal()
652 * level to save storing children-lists in the devclass structure. If
668 for (i = 0; i < dc->maxunit; i++) in devclass_driver_added()
669 if (dc->devices[i] && device_is_attached(dc->devices[i])) in devclass_driver_added()
670 BUS_DRIVER_ADDED(dc->devices[i], driver); in devclass_driver_added()
680 if (!(dc->flags & DC_HAS_CHILDREN)) in devclass_driver_added()
684 if (dc->parent == parent) in devclass_driver_added()
692 BUS_PROBE_NOMATCH(dev->parent, dev); in device_handle_nomatch()
694 dev->flags |= DF_DONENOMATCH; in device_handle_nomatch()
703 * to re-probe any unmatched children.
709 devclass_add_driver(devclass_t dc, driver_t *driver, int pass, devclass_t *dcp) in devclass_add_driver() argument
727 * double-free in devclass_delete_driver. in devclass_add_driver()
738 if (driver->baseclasses) in devclass_add_driver()
739 parentname = driver->baseclasses[0]->name; in devclass_add_driver()
742 child_dc = devclass_find_internal(driver->name, parentname, TRUE); in devclass_add_driver()
743 if (dcp != NULL) in devclass_add_driver()
744 *dcp = child_dc; in devclass_add_driver()
746 dl->driver = driver; in devclass_add_driver()
747 TAILQ_INSERT_TAIL(&dc->drivers, dl, link); in devclass_add_driver()
748 driver->refs++; /* XXX: kobj_mtx */ in devclass_add_driver()
749 dl->pass = pass; in devclass_add_driver()
753 dl->flags |= DL_DEFERRED_PROBE; in devclass_add_driver()
772 * level to save storing children-lists in the devclass structure. If
800 for (i = 0; i < dc->maxunit; i++) { in devclass_driver_deleted()
801 if (dc->devices[i]) { in devclass_driver_deleted()
802 dev = dc->devices[i]; in devclass_driver_deleted()
803 if (dev->driver == driver && dev->parent && in devclass_driver_deleted()
804 dev->parent->devclass == busclass) { in devclass_driver_deleted()
808 dev->flags &= ~DF_DONENOMATCH; in devclass_driver_deleted()
809 dev->flags |= DF_NEEDNOMATCH; in devclass_driver_deleted()
825 if (!(busclass->flags & DC_HAS_CHILDREN)) in devclass_driver_deleted()
829 if (busclass->parent == parent) { in devclass_driver_deleted()
855 devclass_t dc = devclass_find(driver->name); in devclass_delete_driver()
859 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass))); in devclass_delete_driver()
867 TAILQ_FOREACH(dl, &busclass->drivers, link) { in devclass_delete_driver()
868 if (dl->driver == driver) in devclass_delete_driver()
873 PDEBUG(("%s not found in %s list", driver->name, in devclass_delete_driver()
874 busclass->name)); in devclass_delete_driver()
882 TAILQ_REMOVE(&busclass->drivers, dl, link); in devclass_delete_driver()
886 driver->refs--; in devclass_delete_driver()
887 if (driver->refs == 0) in devclass_delete_driver()
910 devclass_t dc = devclass_find(driver->name); in devclass_quiesce_driver()
916 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass))); in devclass_quiesce_driver()
924 TAILQ_FOREACH(dl, &busclass->drivers, link) { in devclass_quiesce_driver()
925 if (dl->driver == driver) in devclass_quiesce_driver()
930 PDEBUG(("%s not found in %s list", driver->name, in devclass_quiesce_driver()
931 busclass->name)); in devclass_quiesce_driver()
945 for (i = 0; i < dc->maxunit; i++) { in devclass_quiesce_driver()
946 if (dc->devices[i]) { in devclass_quiesce_driver()
947 dev = dc->devices[i]; in devclass_quiesce_driver()
948 if (dev->driver == driver && dev->parent && in devclass_quiesce_driver()
949 dev->parent->devclass == busclass) { in devclass_quiesce_driver()
969 TAILQ_FOREACH(dl, &dc->drivers, link) { in devclass_find_driver_internal()
970 if (!strcmp(dl->driver->name, classname)) in devclass_find_driver_internal()
984 return (dc->name); in devclass_get_name()
999 if (dc == NULL || unit < 0 || unit >= dc->maxunit) in devclass_get_device()
1001 return (dc->devices[unit]); in devclass_get_device()
1054 for (i = 0; i < dc->maxunit; i++) { in devclass_get_devices()
1055 if (dc->devices[i]) { in devclass_get_devices()
1056 list[count] = dc->devices[i]; in devclass_get_devices()
1091 TAILQ_FOREACH(dl, &dc->drivers, link) in devclass_get_drivers()
1098 TAILQ_FOREACH(dl, &dc->drivers, link) { in devclass_get_drivers()
1099 list[count] = dl->driver; in devclass_get_drivers()
1119 for (i = 0; i < dc->maxunit; i++) in devclass_get_count()
1120 if (dc->devices[i]) in devclass_get_count()
1128 * Note that this is one greater than the highest currently-allocated unit. If
1129 * @p dc is NULL, @c -1 is returned to indicate that not even the devclass has
1138 return (-1); in devclass_get_maxunit()
1139 return (dc->maxunit); in devclass_get_maxunit()
1157 while (unit < dc->maxunit && dc->devices[unit] != NULL) in devclass_find_free_unit()
1174 dc->parent = pdc; in devclass_set_parent()
1185 return (dc->parent); in devclass_get_parent()
1191 return (&dc->sysctl_ctx); in devclass_get_sysctl_ctx()
1197 return (dc->sysctl_tree); in devclass_get_sysctl_tree()
1226 BUS_HINT_DEVICE_UNIT(device_get_parent(dev), dev, dc->name, in devclass_alloc_unit()
1235 if (unit < dc->maxunit && dc->devices[unit] != NULL) { in devclass_alloc_unit()
1238 dc->name, dc->name, *unitp); in devclass_alloc_unit()
1246 if (unit < dc->maxunit && dc->devices[unit] != NULL) in devclass_alloc_unit()
1250 if (resource_string_value(dc->name, unit, "at", &s) == in devclass_alloc_unit()
1271 if (unit >= dc->maxunit) { in devclass_alloc_unit()
1275 dc->devices = reallocf(dc->devices, in devclass_alloc_unit()
1276 newsize * sizeof(*dc->devices), M_BUS, M_WAITOK); in devclass_alloc_unit()
1277 memset(dc->devices + dc->maxunit, 0, in devclass_alloc_unit()
1278 sizeof(device_t) * (newsize - dc->maxunit)); in devclass_alloc_unit()
1279 dc->maxunit = newsize; in devclass_alloc_unit()
1311 buflen = snprintf(NULL, 0, "%s%d$", dc->name, INT_MAX); in devclass_add_device()
1314 dev->nameunit = malloc(buflen, M_BUS, M_WAITOK|M_ZERO); in devclass_add_device()
1316 if ((error = devclass_alloc_unit(dc, dev, &dev->unit)) != 0) { in devclass_add_device()
1317 free(dev->nameunit, M_BUS); in devclass_add_device()
1318 dev->nameunit = NULL; in devclass_add_device()
1321 dc->devices[dev->unit] = dev; in devclass_add_device()
1322 dev->devclass = dc; in devclass_add_device()
1323 snprintf(dev->nameunit, buflen, "%s%d", dc->name, dev->unit); in devclass_add_device()
1348 if (dev->devclass != dc || dc->devices[dev->unit] != dev) in devclass_delete_device()
1350 dc->devices[dev->unit] = NULL; in devclass_delete_device()
1351 if (dev->flags & DF_WILDCARD) in devclass_delete_device()
1352 dev->unit = DEVICE_UNIT_ANY; in devclass_delete_device()
1353 dev->devclass = NULL; in devclass_delete_device()
1354 free(dev->nameunit, M_BUS); in devclass_delete_device()
1355 dev->nameunit = NULL; in devclass_delete_device()
1392 dev->parent = parent; in make_device()
1393 TAILQ_INIT(&dev->children); in make_device()
1395 dev->driver = NULL; in make_device()
1396 dev->devclass = NULL; in make_device()
1397 dev->unit = unit; in make_device()
1398 dev->nameunit = NULL; in make_device()
1399 dev->desc = NULL; in make_device()
1400 dev->busy = 0; in make_device()
1401 dev->devflags = 0; in make_device()
1402 dev->flags = DF_ENABLED; in make_device()
1403 dev->order = 0; in make_device()
1405 dev->flags |= DF_WILDCARD; in make_device()
1407 dev->flags |= DF_FIXEDCLASS; in make_device()
1414 dev->flags |= DF_QUIET | DF_QUIET_CHILDREN; in make_device()
1415 dev->ivars = NULL; in make_device()
1416 dev->softc = NULL; in make_device()
1417 LIST_INIT(&dev->props); in make_device()
1419 dev->state = DS_NOTPRESENT; in make_device()
1476 * children of @p dev - devices created using
1500 child->order = order; in device_add_child_ordered()
1502 TAILQ_FOREACH(place, &dev->children, link) { in device_add_child_ordered()
1503 if (place->order > order) in device_add_child_ordered()
1518 TAILQ_INSERT_TAIL(&dev->children, child, link); in device_add_child_ordered()
1536 * @retval non-zero a unit error code describing the error
1554 while ((grandchild = TAILQ_FIRST(&child->children)) != NULL) { in device_delete_child()
1561 if (child->devclass) in device_delete_child()
1562 devclass_delete_device(child->devclass, child); in device_delete_child()
1563 if (child->parent) in device_delete_child()
1565 TAILQ_REMOVE(&dev->children, child, link); in device_delete_child()
1584 * @retval non-zero a device would not detach
1596 while ((child = TAILQ_FIRST(&dev->children)) != NULL) { in device_delete_children()
1633 if (child && child->parent == dev) in device_find_child()
1638 if (child && child->parent == dev) in device_find_child()
1651 if (dev->devclass) in first_matching_driver()
1652 return (devclass_find_driver_internal(dc, dev->devclass->name)); in first_matching_driver()
1653 return (TAILQ_FIRST(&dc->drivers)); in first_matching_driver()
1662 if (dev->devclass) { in next_matching_driver()
1665 if (!strcmp(dev->devclass->name, dl->driver->name)) in next_matching_driver()
1683 int hasclass = (child->devclass != NULL); in device_probe_child()
1687 dc = dev->devclass; in device_probe_child()
1694 if (child->state == DS_ALIVE) in device_probe_child()
1697 for (; dc; dc = dc->parent) { in device_probe_child()
1702 if (dl->pass > bus_current_pass) in device_probe_child()
1705 PDEBUG(("Trying %s", DRIVERNAME(dl->driver))); in device_probe_child()
1706 result = device_set_driver(child, dl->driver); in device_probe_child()
1713 dl->driver->name) != 0) { in device_probe_child()
1721 dl->driver->name, in device_probe_child()
1729 resource_int_value(dl->driver->name, child->unit, in device_probe_child()
1730 "flags", &child->devflags); in device_probe_child()
1745 child->devflags = 0; in device_probe_child()
1761 !(child->flags & DF_FIXEDCLASS)) { in device_probe_child()
1794 result = device_set_driver(child, best->driver); in device_probe_child()
1797 if (!child->devclass) { in device_probe_child()
1798 result = device_set_devclass(child, best->driver->name); in device_probe_child()
1804 resource_int_value(best->driver->name, child->unit, in device_probe_child()
1805 "flags", &child->devflags); in device_probe_child()
1820 child->state = DS_ALIVE; in device_probe_child()
1831 return (dev->parent); in device_get_parent()
1858 TAILQ_FOREACH(child, &dev->children, link) { in device_get_children()
1876 TAILQ_FOREACH(child, &dev->children, link) { in device_get_children()
1898 return (!TAILQ_EMPTY(&dev->children)); in device_has_children()
1908 return (dev->driver); in device_get_driver()
1918 return (dev->devclass); in device_get_devclass()
1928 if (dev != NULL && dev->devclass) in device_get_name()
1929 return (devclass_get_name(dev->devclass)); in device_get_name()
1941 return (dev->nameunit); in device_get_nameunit()
1950 return (dev->unit); in device_get_unit()
1959 return (dev->desc); in device_get_desc()
1968 return (dev->devflags); in device_get_flags()
1974 return (&dev->sysctl_ctx); in device_get_sysctl_ctx()
1980 return (dev->sysctl_tree); in device_get_sysctl_tree()
2083 if (dev->desc && (dev->flags & DF_DESCMALLOCED)) { in device_set_desc_internal()
2084 free(dev->desc, M_BUS); in device_set_desc_internal()
2085 dev->flags &= ~DF_DESCMALLOCED; in device_set_desc_internal()
2086 dev->desc = NULL; in device_set_desc_internal()
2090 dev->flags |= DF_DESCMALLOCED; in device_set_desc_internal()
2091 dev->desc = __DECONST(char *, desc); in device_set_desc_internal()
2112 * A printf-like version of device_set_desc().
2147 dev->devflags = flags; in device_set_flags()
2159 return (dev->softc); in device_get_softc()
2171 if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) in device_set_softc()
2172 free(dev->softc, M_BUS_SC); in device_set_softc()
2173 dev->softc = softc; in device_set_softc()
2174 if (dev->softc) in device_set_softc()
2175 dev->flags |= DF_EXTERNALSOFTC; in device_set_softc()
2177 dev->flags &= ~DF_EXTERNALSOFTC; in device_set_softc()
2203 if (dev->softc) in device_claim_softc()
2204 dev->flags |= DF_EXTERNALSOFTC; in device_claim_softc()
2206 dev->flags &= ~DF_EXTERNALSOFTC; in device_claim_softc()
2212 * The ivars field is used by the parent device to store per-device
2220 return (dev->ivars); in device_get_ivars()
2230 dev->ivars = ivars; in device_set_ivars()
2239 return (dev->state); in device_get_state()
2248 dev->flags |= DF_ENABLED; in device_enable()
2257 dev->flags &= ~DF_ENABLED; in device_disable()
2269 * goes 0->1. in device_busy()
2271 if (refcount_acquire(&dev->busy) == 0 && dev->parent != NULL) in device_busy()
2272 device_busy(dev->parent); in device_busy()
2285 if (refcount_release(&dev->busy) && dev->parent != NULL) in device_unbusy()
2286 device_unbusy(dev->parent); in device_unbusy()
2295 dev->flags |= DF_QUIET; in device_quiet()
2304 dev->flags |= DF_QUIET_CHILDREN; in device_quiet_children()
2313 dev->flags &= ~DF_QUIET; in device_verbose()
2329 return (-1); in device_get_property()
2333 return (-1); in device_get_property()
2336 return (-1); in device_get_property()
2349 * @brief Return non-zero if the DF_QUIET_CHIDLREN flag is set on the device
2354 return ((dev->flags & DF_QUIET_CHILDREN) != 0); in device_has_quiet_children()
2358 * @brief Return non-zero if the DF_QUIET flag is set on the device
2363 return ((dev->flags & DF_QUIET) != 0); in device_is_quiet()
2367 * @brief Return non-zero if the DF_ENABLED flag is set on the device
2372 return ((dev->flags & DF_ENABLED) != 0); in device_is_enabled()
2376 * @brief Return non-zero if the device was successfully probed
2381 return (dev->state >= DS_ALIVE); in device_is_alive()
2385 * @brief Return non-zero if the device currently has a driver
2391 return (dev->state >= DS_ATTACHED); in device_is_attached()
2395 * @brief Return non-zero if the device is currently suspended.
2400 return ((dev->flags & DF_SUSPENDED) != 0); in device_is_suspended()
2414 if (dev->devclass) in device_set_devclass()
2415 devclass_delete_device(dev->devclass, dev); in device_set_devclass()
2419 if (dev->devclass) { in device_set_devclass()
2449 dev->flags |= DF_FIXEDCLASS; in device_set_devclass_fixed()
2460 return ((dev->flags & DF_FIXEDCLASS) != 0); in device_is_devclass_fixed()
2476 if (dev->state >= DS_ATTACHED) in device_set_driver()
2479 if (dev->driver == driver) in device_set_driver()
2482 if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) { in device_set_driver()
2483 free(dev->softc, M_BUS_SC); in device_set_driver()
2484 dev->softc = NULL; in device_set_driver()
2488 dev->driver = driver; in device_set_driver()
2491 if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) { in device_set_driver()
2496 dev->softc = malloc_domainset(driver->size, M_BUS_SC, in device_set_driver()
2531 * @retval non-zero some other unix error code
2532 * @retval -1 Device already attached
2541 if (dev->state >= DS_ALIVE) in device_probe()
2542 return (-1); in device_probe()
2544 if (!(dev->flags & DF_ENABLED)) { in device_probe()
2549 return (-1); in device_probe()
2551 if ((error = device_probe_child(dev->parent, dev)) != 0) { in device_probe()
2553 !(dev->flags & DF_DONENOMATCH)) { in device_probe()
2574 if (error == -1) in device_probe_and_attach()
2588 * and queues a notification event for user-based device management
2599 * @retval non-zero some other unix error code
2608 if (resource_disabled(dev->driver->name, dev->unit)) { in device_attach()
2615 dev->state = DS_NOTPRESENT; in device_attach()
2627 device_print_child(dev->parent, dev); in device_attach()
2629 dev->state = DS_ATTACHING; in device_attach()
2632 dev->driver->name, dev->unit, error); in device_attach()
2633 BUS_CHILD_DETACHED(dev->parent, dev); in device_attach()
2650 if (!(dev->flags & DF_FIXEDCLASS)) in device_attach()
2651 devclass_delete_device(dev->devclass, dev); in device_attach()
2654 KASSERT(dev->busy == 0, ("attach failed but busy")); in device_attach()
2655 dev->state = DS_NOTPRESENT; in device_attach()
2661 dev->flags |= DF_ATTACHED_ONCE; in device_attach()
2666 attachentropy = (uint16_t)(get_cyclecount() - attachtime); in device_attach()
2669 dev->state = DS_ATTACHED; in device_attach()
2670 dev->flags &= ~DF_DONENOMATCH; in device_attach()
2681 * notification event for user-based device management services and
2684 * @param dev the device to un-initialise
2689 * @retval non-zero some other unix error code
2699 if (dev->busy > 0) in device_detach()
2701 if (dev->state == DS_ATTACHING) { in device_detach()
2705 if (dev->state != DS_ATTACHED) in device_detach()
2719 if (dev->parent) in device_detach()
2720 BUS_CHILD_DETACHED(dev->parent, dev); in device_detach()
2722 if (!(dev->flags & DF_FIXEDCLASS)) in device_detach()
2723 devclass_delete_device(dev->devclass, dev); in device_detach()
2726 dev->state = DS_NOTPRESENT; in device_detach()
2744 * @retval non-zero some other unix error code
2750 if (dev->busy > 0) in device_quiesce()
2752 if (dev->state != DS_ATTACHED) in device_quiesce()
2769 if (dev->state < DS_ATTACHED) in device_shutdown()
2778 * device (e.g. to wire a device to a pre-configured unit number).
2786 if (unit == dev->unit) in device_set_unit()
2789 if (unit < dc->maxunit && dc->devices[unit]) in device_set_unit()
2794 dev->unit = unit; in device_set_unit()
2821 args->size = sz; in resource_init_map_request_impl()
2822 args->memattr = VM_MEMATTR_DEVICE; in resource_init_map_request_impl()
2849 MPASS(out->size == sizeof(struct resource_map_request)); in resource_validate_map_request()
2852 bcopy(in, out, imin(in->size, out->size)); in resource_validate_map_request()
2853 start = rman_get_start(r) + out->offset; in resource_validate_map_request()
2854 if (out->length == 0) in resource_validate_map_request()
2857 length = out->length; in resource_validate_map_request()
2858 end = start + length - 1; in resource_validate_map_request()
2893 if (rle->res) in resource_list_free()
2911 * @param count XXX end-start+1
2939 * @param count XXX end-start+1
2952 rle->type = type; in resource_list_add()
2953 rle->rid = rid; in resource_list_add()
2954 rle->res = NULL; in resource_list_add()
2955 rle->flags = 0; in resource_list_add()
2958 if (rle->res) in resource_list_add()
2961 rle->start = start; in resource_list_add()
2962 rle->end = end; in resource_list_add()
2963 rle->count = count; in resource_list_add()
2977 * @returns Non-zero if the entry is busy, zero otherwise.
2985 if (rle == NULL || rle->res == NULL) in resource_list_busy()
2987 if ((rle->flags & (RLE_RESERVED | RLE_ALLOCATED)) == RLE_RESERVED) { in resource_list_busy()
2988 KASSERT(!(rman_get_flags(rle->res) & RF_ACTIVE), in resource_list_busy()
3006 * @returns Non-zero if the entry is reserved, zero otherwise.
3014 if (rle != NULL && rle->flags & RLE_RESERVED) in resource_list_reserved()
3035 if (rle->type == type && rle->rid == rid) in resource_list_find()
3054 if (rle->res != NULL) in resource_list_delete()
3084 * @param start hint at the start of the resource range - pass
3086 * @param end hint at the end of the resource range - pass
3088 * @param count hint at the size of range required - pass @c 1
3091 * allocation - see @c RF_XXX flags in
3116 rle->flags |= RLE_RESERVED; in resource_list_reserve()
3141 * @param start hint at the start of the resource range - pass
3143 * @param end hint at the end of the resource range - pass
3145 * @param count hint at the size of range required - pass @c 1
3148 * allocation - see @c RF_XXX flags in
3172 if (rle->res) { in resource_list_alloc()
3173 if (rle->flags & RLE_RESERVED) { in resource_list_alloc()
3174 if (rle->flags & RLE_ALLOCATED) in resource_list_alloc()
3178 rle->res) != 0) in resource_list_alloc()
3180 rle->flags |= RLE_ALLOCATED; in resource_list_alloc()
3181 return (rle->res); in resource_list_alloc()
3190 start = rle->start; in resource_list_alloc()
3191 count = ulmax(count, rle->count); in resource_list_alloc()
3192 end = ulmax(rle->end, start + count - 1); in resource_list_alloc()
3195 rle->res = BUS_ALLOC_RESOURCE(device_get_parent(bus), child, in resource_list_alloc()
3201 if (rle->res) { in resource_list_alloc()
3202 rle->start = rman_get_start(rle->res); in resource_list_alloc()
3203 rle->end = rman_get_end(rle->res); in resource_list_alloc()
3204 rle->count = count; in resource_list_alloc()
3207 return (rle->res); in resource_list_alloc()
3222 * @retval non-zero a standard unix error code indicating what
3242 if (!rle->res) in resource_list_release()
3244 if (rle->flags & RLE_RESERVED) { in resource_list_release()
3245 if (rle->flags & RLE_ALLOCATED) { in resource_list_release()
3251 rle->flags &= ~RLE_ALLOCATED; in resource_list_release()
3261 rle->res = NULL; in resource_list_release()
3289 if (rle->type != type) in resource_list_release_active()
3291 if (rle->res == NULL) in resource_list_release_active()
3293 if ((rle->flags & (RLE_RESERVED | RLE_ALLOCATED)) == in resource_list_release_active()
3297 error = resource_list_release(rl, bus, child, rle->res); in resource_list_release_active()
3318 * @retval non-zero a standard unix error code indicating what
3336 if (!(rle->flags & RLE_RESERVED)) in resource_list_unreserve()
3338 if (rle->flags & RLE_ALLOCATED) in resource_list_unreserve()
3340 rle->flags &= ~RLE_RESERVED; in resource_list_unreserve()
3341 return (resource_list_release(rl, bus, child, rle->res)); in resource_list_unreserve()
3370 if (rle->type == type) { in resource_list_print_type()
3376 retval += printf(format, rle->start); in resource_list_print_type()
3377 if (rle->count > 1) { in resource_list_print_type()
3378 retval += printf("-"); in resource_list_print_type()
3379 retval += printf(format, rle->start + in resource_list_print_type()
3380 rle->count - 1); in resource_list_print_type()
3400 if (rle->res) in resource_list_purge()
3401 bus_release_resource(rman_get_device(rle->res), in resource_list_purge()
3402 rle->type, rle->rid, rle->res); in resource_list_purge()
3441 devclass_t dc = dev->devclass; in bus_identify_children()
3444 TAILQ_FOREACH(dl, &dc->drivers, link) { in bus_identify_children()
3448 * never be true. For early-pass drivers they will in bus_identify_children()
3452 * on early-pass buses during BUS_NEW_PASS(). in bus_identify_children()
3454 if (dl->pass > bus_current_pass) in bus_identify_children()
3456 DEVICE_IDENTIFY(dl->driver, dev); in bus_identify_children()
3489 TAILQ_FOREACH(child, &dev->children, link) { in bus_attach_children()
3518 * @retval non-zero a device would not detach
3538 * NB: Children that were successfully detached are not re-attached if
3544 * @retval non-zero a device would not detach
3556 TAILQ_FOREACH_REVERSE(child, &dev->children, device_list, link) { in bus_detach_children()
3580 TAILQ_FOREACH_REVERSE(child, &dev->children, device_list, link) { in bus_generic_shutdown()
3600 child->flags |= DF_SUSPENDED; in bus_generic_suspend_child()
3618 child->flags &= ~DF_SUSPENDED; in bus_generic_resume_child()
3645 TAILQ_FOREACH_REVERSE(child, &dev->children, device_list, link) { in bus_generic_suspend()
3650 TAILQ_FOREACH_FROM(child, &dev->children, link) in bus_generic_suspend()
3670 TAILQ_FOREACH(child, &dev->children, link) { in bus_generic_resume()
3681 * re-attaching or resuming the children after the bus itself was
3682 * reset, and after restoring bus-unique state of children.
3694 TAILQ_FOREACH(child, &dev->children,link) { in bus_helper_reset_post()
3711 TAILQ_FOREACH_FROM(child, &dev->children,link) { in bus_helper_reset_prepare_rollback()
3725 * reset, and then save bus-unique state of children that must
3737 if (dev->state != DS_ATTACHED) in bus_helper_reset_prepare()
3740 TAILQ_FOREACH_REVERSE(child, &dev->children, device_list, link) { in bus_helper_reset_prepare()
3768 * @p child, including its name, unit and description (if any - see
3818 return (printf(" numa-domain %d", domain)); in bus_print_child_domain()
3869 * until a non-default implementation is found.
3879 return (-1); in bus_generic_get_property()
3895 TAILQ_FOREACH(child, &dev->children, link) { in bus_generic_driver_added()
3896 if (child->state == DS_NOTPRESENT) in bus_generic_driver_added()
3918 dc = dev->devclass; in bus_generic_new_pass()
3919 TAILQ_FOREACH(dl, &dc->drivers, link) { in bus_generic_new_pass()
3920 if (dl->pass == bus_current_pass) in bus_generic_new_pass()
3921 DEVICE_IDENTIFY(dl->driver, dev); in bus_generic_new_pass()
3923 TAILQ_FOREACH(child, &dev->children, link) { in bus_generic_new_pass()
3924 if (child->state >= DS_ATTACHED) in bus_generic_new_pass()
3926 else if (child->state == DS_NOTPRESENT) in bus_generic_new_pass()
3943 if (dev->parent) in bus_generic_setup_intr()
3944 return (BUS_SETUP_INTR(dev->parent, child, irq, flags, in bus_generic_setup_intr()
3960 if (dev->parent) in bus_generic_teardown_intr()
3961 return (BUS_TEARDOWN_INTR(dev->parent, child, irq, cookie)); in bus_generic_teardown_intr()
3975 if (dev->parent) in bus_generic_suspend_intr()
3976 return (BUS_SUSPEND_INTR(dev->parent, child, irq)); in bus_generic_suspend_intr()
3990 if (dev->parent) in bus_generic_resume_intr()
3991 return (BUS_RESUME_INTR(dev->parent, child, irq)); in bus_generic_resume_intr()
4006 if (dev->parent) in bus_generic_adjust_resource()
4007 return (BUS_ADJUST_RESOURCE(dev->parent, child, r, start, end)); in bus_generic_adjust_resource()
4022 if (dev->parent) in bus_generic_translate_resource()
4023 return (BUS_TRANSLATE_RESOURCE(dev->parent, type, start, in bus_generic_translate_resource()
4040 if (dev->parent) in bus_generic_alloc_resource()
4041 return (BUS_ALLOC_RESOURCE(dev->parent, child, type, rid, in bus_generic_alloc_resource()
4056 if (dev->parent) in bus_generic_release_resource()
4057 return (BUS_RELEASE_RESOURCE(dev->parent, child, r)); in bus_generic_release_resource()
4071 if (dev->parent) in bus_generic_activate_resource()
4072 return (BUS_ACTIVATE_RESOURCE(dev->parent, child, r)); in bus_generic_activate_resource()
4087 if (dev->parent) in bus_generic_deactivate_resource()
4088 return (BUS_DEACTIVATE_RESOURCE(dev->parent, child, r)); in bus_generic_deactivate_resource()
4103 if (dev->parent) in bus_generic_map_resource()
4104 return (BUS_MAP_RESOURCE(dev->parent, child, r, args, map)); in bus_generic_map_resource()
4119 if (dev->parent) in bus_generic_unmap_resource()
4120 return (BUS_UNMAP_RESOURCE(dev->parent, child, r, map)); in bus_generic_unmap_resource()
4135 if (dev->parent) in bus_generic_bind_intr()
4136 return (BUS_BIND_INTR(dev->parent, child, irq, cpu)); in bus_generic_bind_intr()
4151 if (dev->parent) in bus_generic_config_intr()
4152 return (BUS_CONFIG_INTR(dev->parent, irq, trig, pol)); in bus_generic_config_intr()
4167 if (dev->parent) in bus_generic_describe_intr()
4168 return (BUS_DESCRIBE_INTR(dev->parent, child, irq, cookie, in bus_generic_describe_intr()
4184 if (dev->parent != NULL) in bus_generic_get_cpus()
4185 return (BUS_GET_CPUS(dev->parent, child, op, setsize, cpuset)); in bus_generic_get_cpus()
4199 if (dev->parent != NULL) in bus_generic_get_dma_tag()
4200 return (BUS_GET_DMA_TAG(dev->parent, child)); in bus_generic_get_dma_tag()
4214 if (dev->parent != NULL) in bus_generic_get_bus_tag()
4215 return (BUS_GET_BUS_TAG(dev->parent, child)); in bus_generic_get_bus_tag()
4243 *startp = rle->start; in bus_generic_rl_get_resource()
4245 *countp = rle->count; in bus_generic_rl_get_resource()
4268 resource_list_add(rl, type, rid, start, (start + count - 1), count); in bus_generic_rl_set_resource()
4543 if (dev->parent) in bus_generic_get_domain()
4544 return (BUS_GET_DOMAIN(dev->parent, dev, domain)); in bus_generic_get_domain()
4608 * resource-management functions. All these really do is hide the
4610 * less-wordy code. In the future, it might make sense for this code
4620 for (i = 0; rs[i].type != -1; i++) in bus_alloc_resources()
4622 for (i = 0; rs[i].type != -1; i++) { in bus_alloc_resources()
4639 for (i = 0; rs[i].type != -1; i++) in bus_release_resources()
4659 if (dev->parent == NULL)
4661 res = BUS_ALLOC_RESOURCE(dev->parent, dev, type, rid, start, end,
4676 if (dev->parent == NULL) in bus_adjust_resource()
4678 return (BUS_ADJUST_RESOURCE(dev->parent, dev, r, start, end)); in bus_adjust_resource()
4698 if (dev->parent == NULL) in bus_translate_resource()
4700 return (BUS_TRANSLATE_RESOURCE(dev->parent, type, start, newstart)); in bus_translate_resource()
4712 if (dev->parent == NULL) in bus_activate_resource()
4714 return (BUS_ACTIVATE_RESOURCE(dev->parent, dev, r)); in bus_activate_resource()
4732 if (dev->parent == NULL) in bus_deactivate_resource()
4734 return (BUS_DEACTIVATE_RESOURCE(dev->parent, dev, r)); in bus_deactivate_resource()
4753 if (dev->parent == NULL) in bus_map_resource()
4755 return (BUS_MAP_RESOURCE(dev->parent, dev, r, args, map)); in bus_map_resource()
4774 if (dev->parent == NULL) in bus_unmap_resource()
4776 return (BUS_UNMAP_RESOURCE(dev->parent, dev, r, map)); in bus_unmap_resource()
4797 if (dev->parent == NULL) in bus_release_resource()
4799 rv = BUS_RELEASE_RESOURCE(dev->parent, dev, r); in bus_release_resource()
4821 if (dev->parent == NULL) in bus_setup_intr()
4823 error = BUS_SETUP_INTR(dev->parent, dev, r, flags, filter, handler, in bus_setup_intr()
4828 device_printf(dev, "[GIANT-LOCKED]\n"); in bus_setup_intr()
4841 if (dev->parent == NULL) in bus_teardown_intr()
4843 return (BUS_TEARDOWN_INTR(dev->parent, dev, r, cookie)); in bus_teardown_intr()
4855 if (dev->parent == NULL) in bus_suspend_intr()
4857 return (BUS_SUSPEND_INTR(dev->parent, dev, r)); in bus_suspend_intr()
4869 if (dev->parent == NULL) in bus_resume_intr()
4871 return (BUS_RESUME_INTR(dev->parent, dev, r)); in bus_resume_intr()
4883 if (dev->parent == NULL) in bus_bind_intr()
4885 return (BUS_BIND_INTR(dev->parent, dev, r, cpu)); in bus_bind_intr()
4902 if (dev->parent == NULL) in bus_describe_intr()
4907 return (BUS_DESCRIBE_INTR(dev->parent, dev, irq, cookie, descr)); in bus_describe_intr()
5160 * this call long before it gets here. We return -1 so that drivers that
5161 * really care can check vs -1 or some ERRNO returned higher in the food
5167 return (-1); in root_child_present()
5220 root_bus->desc = "System root bus"; in root_bus_module_handler()
5222 root_bus->driver = &root_driver; in root_bus_module_handler()
5223 root_bus->state = DS_ATTACHED; in root_bus_module_handler()
5277 bus_devclass = devclass_find_internal(dmd->dmd_busname, NULL, TRUE); in driver_module_handler()
5282 if (dmd->dmd_chainevh) in driver_module_handler()
5283 error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); in driver_module_handler()
5285 pass = dmd->dmd_pass; in driver_module_handler()
5286 driver = dmd->dmd_driver; in driver_module_handler()
5288 DRIVERNAME(driver), dmd->dmd_busname, pass)); in driver_module_handler()
5290 dmd->dmd_devclass); in driver_module_handler()
5295 DRIVERNAME(dmd->dmd_driver), in driver_module_handler()
5296 dmd->dmd_busname)); in driver_module_handler()
5298 dmd->dmd_driver); in driver_module_handler()
5300 if (!error && dmd->dmd_chainevh) in driver_module_handler()
5301 error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); in driver_module_handler()
5305 DRIVERNAME(dmd->dmd_driver), in driver_module_handler()
5306 dmd->dmd_busname)); in driver_module_handler()
5308 dmd->dmd_driver); in driver_module_handler()
5310 if (!error && dmd->dmd_chainevh) in driver_module_handler()
5311 error = dmd->dmd_chainevh(mod,what,dmd->dmd_chainarg); in driver_module_handler()
5368 dev->unit, dev->desc, in print_device_short()
5369 (dev->parent? "":"no "), in print_device_short()
5370 (TAILQ_EMPTY(&dev->children)? "no ":""), in print_device_short()
5371 (dev->flags&DF_ENABLED? "enabled,":"disabled,"), in print_device_short()
5372 (dev->flags&DF_FIXEDCLASS? "fixed,":""), in print_device_short()
5373 (dev->flags&DF_WILDCARD? "wildcard,":""), in print_device_short()
5374 (dev->flags&DF_DESCMALLOCED? "descmalloced,":""), in print_device_short()
5375 (dev->flags&DF_SUSPENDED? "suspended,":""), in print_device_short()
5376 (dev->ivars? "":"no "), in print_device_short()
5377 (dev->softc? "":"no "), in print_device_short()
5378 dev->busy)); in print_device_short()
5390 print_device_short(dev->parent, indent+1); in print_device()
5392 print_driver_short(dev->driver, indent+1); in print_device()
5394 print_devclass_short(dev->devclass, indent+1); in print_device()
5408 TAILQ_FOREACH(child, &dev->children, link) { in print_device_tree_short()
5424 TAILQ_FOREACH(child, &dev->children, link) { in print_device_tree()
5436 driver->name, driver->size)); in print_driver_short()
5454 print_driver(driver->driver, indent); in print_driver_list()
5464 indentprintf(("devclass %s: max units = %d\n", dc->name, dc->maxunit)); in print_devclass_short()
5477 print_driver_list(dc->drivers, indent+1); in print_devclass()
5480 for (i = 0; i < dc->maxunit; i++) in print_devclass()
5481 if (dc->devices[i]) in print_devclass()
5482 print_device(dc->devices[i], indent+1); in print_devclass()
5510 * User-space access to the device tree.
5535 "bus-related data");
5560 if (index-- == 0) in sysctl_devices()
5570 udev->dv_handle = (uintptr_t)dev; in sysctl_devices()
5571 udev->dv_parent = (uintptr_t)dev->parent; in sysctl_devices()
5572 udev->dv_devflags = dev->devflags; in sysctl_devices()
5573 udev->dv_flags = dev->flags; in sysctl_devices()
5574 udev->dv_state = dev->state; in sysctl_devices()
5575 sbuf_new(&sb, udev->dv_fields, sizeof(udev->dv_fields), SBUF_FIXEDLEN); in sysctl_devices()
5576 if (dev->nameunit != NULL) in sysctl_devices()
5577 sbuf_cat(&sb, dev->nameunit); in sysctl_devices()
5579 if (dev->desc != NULL) in sysctl_devices()
5580 sbuf_cat(&sb, dev->desc); in sysctl_devices()
5582 if (dev->driver != NULL) in sysctl_devices()
5583 sbuf_cat(&sb, dev->driver->name); in sysctl_devices()
5631 if (dev->nameunit != NULL && strcmp(dev->nameunit, name) == 0) in device_lookup_by_name()
5650 if (memchr(req->dr_name, '\0', sizeof(req->dr_name)) == NULL) in find_device()
5657 dev = device_lookup_by_name(req->dr_name); in find_device()
5665 EVENTHANDLER_DIRECT_INVOKE(dev_lookup, req->dr_name, &dev); in find_device()
5677 for (dc = bus->devclass; dc != NULL; dc = dc->parent) { in driver_exists()
5689 if (dev->flags & DF_NEEDNOMATCH && in device_gen_nomatch()
5690 dev->state == DS_NOTPRESENT) { in device_gen_nomatch()
5693 dev->flags &= ~DF_NEEDNOMATCH; in device_gen_nomatch()
5694 TAILQ_FOREACH(child, &dev->children, link) { in device_gen_nomatch()
5713 TAILQ_FOREACH(dl, &dc->drivers, link) { in device_do_deferred_actions()
5714 if (dl->flags & DL_DEFERRED_PROBE) { in device_do_deferred_actions()
5715 devclass_driver_added(dc, dl->driver); in device_do_deferred_actions()
5716 dl->flags &= ~DL_DEFERRED_PROBE; in device_do_deferred_actions()
5722 * We also defer no-match events during a freeze. Walk the tree and in device_do_deferred_actions()
5723 * generate all the pent-up events that are still relevant. in device_do_deferred_actions()
5809 if (!(req->dr_flags & DEVF_FORCE_DETACH)) { in devctl2_ioctl()
5828 if (dev->devclass != NULL) { in devctl2_ioctl()
5833 if (resource_disabled(dev->devclass->name, dev->unit)) in devctl2_ioctl()
5834 resource_unset_value(dev->devclass->name, in devctl2_ioctl()
5835 dev->unit, "disabled"); in devctl2_ioctl()
5838 if (!(dev->flags & DF_FIXEDCLASS)) in devctl2_ioctl()
5839 devclass_delete_device(dev->devclass, dev); in devctl2_ioctl()
5849 if (!(req->dr_flags & DEVF_FORCE_DETACH)) { in devctl2_ioctl()
5859 old = dev->flags; in devctl2_ioctl()
5860 dev->flags |= DF_FIXEDCLASS; in devctl2_ioctl()
5863 dev->flags &= ~DF_FIXEDCLASS; in devctl2_ioctl()
5893 error = copyinstr(req->dr_data, driver, sizeof(driver), NULL); in devctl2_ioctl()
5900 if (dev->devclass != NULL && in devctl2_ioctl()
5901 strcmp(driver, dev->devclass->name) == 0) in devctl2_ioctl()
5909 if (dev->parent == NULL) { in devctl2_ioctl()
5913 if (!driver_exists(dev->parent, driver)) { in devctl2_ioctl()
5925 if (req->dr_flags & DEVF_SET_DRIVER_DETACH) in devctl2_ioctl()
5933 /* Clear any previously-fixed device class and unit. */ in devctl2_ioctl()
5934 if (dev->flags & DF_FIXEDCLASS) in devctl2_ioctl()
5935 devclass_delete_device(dev->devclass, dev); in devctl2_ioctl()
5936 dev->flags |= DF_WILDCARD; in devctl2_ioctl()
5937 dev->unit = DEVICE_UNIT_ANY; in devctl2_ioctl()
5943 dev->flags |= DF_FIXEDCLASS; in devctl2_ioctl()
5948 if (!(dev->flags & DF_FIXEDCLASS)) { in devctl2_ioctl()
5953 if (req->dr_flags & DEVF_CLEAR_DRIVER_DETACH) in devctl2_ioctl()
5961 dev->flags &= ~DF_FIXEDCLASS; in devctl2_ioctl()
5962 dev->flags |= DF_WILDCARD; in devctl2_ioctl()
5963 devclass_delete_device(dev->devclass, dev); in devctl2_ioctl()
5981 if (!(req->dr_flags & DEVF_FORCE_DELETE)) { in devctl2_ioctl()
6006 if ((req->dr_flags & ~(DEVF_RESET_DETACH)) != 0) { in devctl2_ioctl()
6015 req->dr_flags); in devctl2_ioctl()
6022 error = copyinstr(req->dr_buffer.buffer, locator, in devctl2_ioctl()
6031 if (req->dr_buffer.length < len) { in devctl2_ioctl()
6035 req->dr_buffer.buffer, len); in devctl2_ioctl()
6037 req->dr_buffer.length = len; in devctl2_ioctl()
6081 device_location_cache_t *dcp; in dev_wired_cache_init() local
6083 dcp = malloc(sizeof(*dcp), M_BUS, M_WAITOK | M_ZERO); in dev_wired_cache_init()
6084 TAILQ_INIT(&dcp->dlc_list); in dev_wired_cache_init()
6086 return (dcp); in dev_wired_cache_init()
6090 dev_wired_cache_fini(device_location_cache_t *dcp) in dev_wired_cache_fini() argument
6094 TAILQ_FOREACH_SAFE(dln, &dcp->dlc_list, dln_link, tdln) { in dev_wired_cache_fini()
6097 free(dcp, M_BUS); in dev_wired_cache_fini()
6101 dev_wired_cache_lookup(device_location_cache_t *dcp, const char *locator) in dev_wired_cache_lookup() argument
6105 TAILQ_FOREACH(dln, &dcp->dlc_list, dln_link) { in dev_wired_cache_lookup()
6106 if (strcmp(locator, dln->dln_locator) == 0) in dev_wired_cache_lookup()
6114 dev_wired_cache_add(device_location_cache_t *dcp, const char *locator, const char *path) in dev_wired_cache_add() argument
6122 dln->dln_locator = (char *)(dln + 1); in dev_wired_cache_add()
6123 memcpy(__DECONST(char *, dln->dln_locator), locator, loclen); in dev_wired_cache_add()
6124 dln->dln_path = dln->dln_locator + loclen; in dev_wired_cache_add()
6125 memcpy(__DECONST(char *, dln->dln_path), path, pathlen); in dev_wired_cache_add()
6126 TAILQ_INSERT_HEAD(&dcp->dlc_list, dln, dln_link); in dev_wired_cache_add()
6132 dev_wired_cache_match(device_location_cache_t *dcp, device_t dev, in dev_wired_cache_match() argument
6144 len = cp - at; in dev_wired_cache_match()
6145 if (len > sizeof(locator) - 1) /* Skip too long locator */ in dev_wired_cache_match()
6153 res = dev_wired_cache_lookup(dcp, locator); in dev_wired_cache_match()
6160 res = dev_wired_cache_add(dcp, locator, in dev_wired_cache_match()
6166 if (error != 0 || res == NULL || res->dln_path == NULL) in dev_wired_cache_match()
6169 return (strcmp(res->dln_path, cp) == 0); in dev_wired_cache_match()
6179 LIST_FOREACH(e, &dev->props, link) { in device_prop_find()
6180 if (strcmp(name, e->name) == 0) in device_prop_find()
6205 e1->name = name; in device_set_prop()
6206 e1->val = val; in device_set_prop()
6207 e1->dtr = dtr; in device_set_prop()
6208 e1->dtr_ctx = dtr_ctx; in device_set_prop()
6209 LIST_INSERT_HEAD(&dev->props, e1, link); in device_set_prop()
6214 if (e->dtr != NULL) in device_set_prop()
6215 e->dtr(dev, name, e->val, e->dtr_ctx); in device_set_prop()
6216 e->val = val; in device_set_prop()
6217 e->dtr = dtr; in device_set_prop()
6218 e->dtr_ctx = dtr_ctx; in device_set_prop()
6219 LIST_INSERT_HEAD(&dev->props, e, link); in device_set_prop()
6233 *valp = e->val; in device_get_prop()
6248 if (e->dtr != NULL) in device_clear_prop()
6249 e->dtr(dev, e->name, e->val, e->dtr_ctx); in device_clear_prop()
6261 while ((e = LIST_FIRST(&dev->props)) != NULL) { in device_destroy_props()
6262 LIST_REMOVE_HEAD(&dev->props, link); in device_destroy_props()
6263 if (e->dtr != NULL) in device_destroy_props()
6264 e->dtr(dev, e->name, e->val, e->dtr_ctx); in device_destroy_props()
6344 db_printf(" driver: %s\n", DRIVERNAME(dev->driver)); in DB_SHOW_COMMAND()
6345 db_printf(" class: %s\n", DEVCLANAME(dev->devclass)); in DB_SHOW_COMMAND()
6347 db_printf(" parent: %p\n", dev->parent); in DB_SHOW_COMMAND()
6348 db_printf(" softc: %p\n", dev->softc); in DB_SHOW_COMMAND()
6349 db_printf(" ivars: %p\n", dev->ivars); in DB_SHOW_COMMAND()