Lines Matching defs:unit

68         device_t        *devices;       /* array of devices indexed by unit */
97 int unit; /**< current unit number */
98 char* nameunit; /**< name+unit e.g. foodev0 */
696 * @brief Find a device given a unit number
699 * @param unit the unit number to search for
701 * @returns the device with the given unit number or @c
705 devclass_get_device(devclass_t dc, int unit)
707 if (dc == NULL || unit < 0 || unit >= dc->maxunit)
709 return (dc->devices[unit]);
713 * @brief Find the softc field of a device given a unit number
716 * @param unit the unit number to search for
719 * unit number or @c NULL if there is no such
723 devclass_get_softc(devclass_t dc, int unit)
727 dev = devclass_get_device(dc, unit);
834 * @brief Get the maximum unit number used in a devclass
837 * unit. If a null devclass_t is passed in, -1 is returned to indicate
851 * @brief Find a free unit number in a devclass
853 * This function searches for the first unused unit number greater
854 * that or equal to @p unit.
857 * @param unit the first unit number to check
860 devclass_find_free_unit(devclass_t dc, int unit)
863 return (unit);
864 while (unit < dc->maxunit && dc->devices[unit] != NULL)
865 unit++;
866 return (unit);
897 * @brief Allocate a unit number
899 * On entry, @p *unitp is the desired unit number (or @c -1 if any
900 * will do). The allocated unit number is returned in @p *unitp.
903 * @param unitp points at the location for the allocated unit
907 * @retval EEXIST the requested unit number is already allocated
913 int unit = *unitp;
915 PDEBUG(("unit %d in devclass %s", unit, DEVCLANAME(dc)));
918 if (unit == -1)
919 BUS_HINT_DEVICE_UNIT(device_get_parent(dev), dev, dc->name, &unit);
921 /* If we were given a wired unit number, check for existing device */
923 if (unit != -1) {
924 if (unit >= 0 && unit < dc->maxunit && dc->devices[unit] != NULL) {
931 unit = 0;
932 for (unit = 0;; unit++) {
934 if (unit < dc->maxunit && dc->devices[unit] != NULL)
940 PDEBUG(("mid: unit %d in devclass %s", unit, DEVCLANAME(dc)));
942 * We've selected a unit beyond the length of the table, so let's
946 if (unit >= dc->maxunit) {
951 newsize = roundup((unit + 1), MINALLOCSIZE / sizeof(device_t));
967 PDEBUG(("now: unit %d in devclass %s", unit, DEVCLANAME(dc)));
969 *unitp = unit;
1249 * followed by an ascii representation of the device's unit number
1262 * A unit number is allocated for the device (using the device's
1263 * preferred unit number if any) and the device is registered in the
1264 * devclass. This allows the device to be looked up by its unit
1271 * @retval EEXIST the requested unit number is already allocated
1288 if ((error = devclass_alloc_unit(dc, dev, &dev->unit)) != 0) {
1293 dc->devices[dev->unit] = dev;
1295 if (snprintf_s(dev->nameunit, buflen, buflen - 1, "%s%d", dc->name, dev->unit) < 0) {
1309 * The device is removed from the devclass's device list and its unit
1325 if (dev->devclass != dc || dc->devices[dev->unit] != dev)
1327 dc->devices[dev->unit] = NULL;
1329 dev->unit = -1;
1344 * @parem unit the unit number of the new device of @c -1 to
1345 * leave the unit number unspecified
1350 make_device(device_t parent, const char *name, int unit)
1355 PDEBUG(("%s at %s as unit %d", name, DEVICENAME(parent), unit));
1377 dev->unit = unit;
1384 if (unit == -1)
1402 PDEBUG(("%s at %s as unit %d success", name, DEVICENAME(parent), unit));
1434 * @param unit unit number for new device or @c -1 if not
1440 device_add_child(device_t dev, const char *name, int unit)
1442 return (device_add_child_ordered(dev, 0, name, unit));
1474 * @param unit unit number for new device or @c -1 if not
1480 device_add_child_ordered(device_t dev, u_int order, const char *name, int unit)
1485 PDEBUG(("%s at %s with order %u as unit %d",
1486 name, DEVICENAME(dev), order, unit));
1487 KASSERT(name != NULL || unit == -1,
1488 ("child device with wildcard name and specific unit number"));
1490 child = make_device(dev, name, unit);
1515 PDEBUG(("%s at %s with order %u as unit %d success",
1516 name, DEVICENAME(dev), order, unit));
1531 * @retval non-zero a unit error code describing the error
1649 //if (resource_disabled(dev->driver->name, dev->unit)) {
1663 dev->driver->name, dev->unit, error);
1682 dev->driver->name, dev->unit);
1801 bus_generic_add_child(device_t dev, u_int order, const char *name, int unit)
1804 return (device_add_child_ordered(dev, order, name, unit));
2005 * @p child, including its name, unit and description (if any - see
2029 * name and unit of the @p dev.
2224 * @brief Return the device's unit number.
2229 return (dev->unit);
2476 // resource_int_value(dl->driver->name, child->unit,
2577 // resource_int_value(best->driver->name, child->unit,
2893 dev->unit, dev->desc,