Lines Matching refs:driver

50 	kobj_class_t    driver;
95 driver_t *driver; /**< current driver */
99 char* desc; /**< driver specific description */
106 void *softc; /**< current driver's variables */
116 #define DRIVERNAME(d) ((d)? d->name : "no driver")
129 static void print_driver_short(driver_t *driver, int indent);
130 static void print_driver(driver_t *driver, int indent);
187 * @brief Register the pass level of a new driver attachment
189 * Register a new driver attachment's pass level. If no driver
193 * @param new the new driver attachment
207 * driver link into the list.
225 * new pass level that has at least one driver.
241 * Bail once we hit a driver with a pass level that is
256 * If there isn't a driver registered for the requested pass,
325 * suitable driver.
369 * @brief Register that a device driver has been added to a devclass
371 * Register that a device driver has been added to a devclass. This
383 * @param driver the driver that was just added
386 devclass_driver_added(devclass_t dc, driver_t *driver)
396 BUS_DRIVER_ADDED(dc->devices[i], driver);
411 devclass_driver_added(dc, driver);
416 * @brief Add a device driver to a device class
418 * Add a device driver to a devclass. This is normally called
424 * @param driver the driver to register
427 devclass_add_driver(devclass_t dc, driver_t *driver, int pass, devclass_t *dcp)
432 PDEBUG(("%s +", DRIVERNAME(driver)));
443 * Compile the driver's methods. Also increase the reference count
448 kobj_class_compile((kobj_class_t) driver);
451 * If the driver has any base classes, make the
452 * devclass inherit from the devclass of the driver's
455 * of a device using this driver.
457 if (driver->baseclasses)
458 parentname = driver->baseclasses[0]->name;
461 *dcp = devclass_find_internal(driver->name, parentname, TRUE);
463 dl->driver = driver;
465 driver->refs++; /* XXX: kobj_mtx */
469 devclass_driver_added(dc, driver);
471 PDEBUG(("%s -", DRIVERNAME(driver)));
476 * @brief Register that a device driver has been deleted from a devclass
478 * Register that a device driver has been removed from a devclass.
481 * well as busclass. Each layer will attempt to detach the driver
491 * @param dc the devclass of the driver being deleted
492 * @param driver the driver being deleted
495 devclass_driver_deleted(devclass_t busclass, devclass_t dc, driver_t *driver)
503 * devices in the devclass of the driver and detach any which are
504 * using the driver and which have a parent in the devclass which
507 * Note that since a driver can be in multiple devclasses, we
514 if (dev->driver == driver && dev->parent &&
538 error = devclass_driver_deleted(busclass, dc, driver);
547 * @brief Delete a device driver from a device class
549 * Delete a device driver from a devclass. This is normally called
552 * If the driver is currently attached to any devices,
554 * device. If one of the detach calls fails, the driver will not be
558 * @param driver the driver to unregister
561 devclass_delete_driver(devclass_t busclass, driver_t *driver)
563 devclass_t dc = devclass_find(driver->name);
567 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
576 if (dl->driver == driver)
581 PDEBUG(("%s not found in %s list", driver->name,
586 error = devclass_driver_deleted(busclass, dc, driver);
594 driver->refs--;
595 if (driver->refs == 0)
596 kobj_class_free((kobj_class_t) driver);
605 * Quiesce a device driver from a devclass. This is normally called
608 * If the driver is currently attached to any devices,
613 * @param driver the driver to unregister
616 devclass_quiesce_driver(devclass_t busclass, driver_t *driver)
618 devclass_t dc = devclass_find(driver->name);
624 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
633 if (dl->driver == driver)
638 PDEBUG(("%s not found in %s list", driver->name,
645 * the devclass of the driver and quiesce any which are using
646 * the driver and which have a parent in the devclass which we
649 * Note that since a driver can be in multiple devclasses, we
656 if (dev->driver == driver && dev->parent &&
678 if (!strcmp(dl->driver->name, classname))
807 list[count] = dl->driver;
1038 * The softc is allocated and zeroed when a driver is attached, based
1039 * on the size field of the driver.
1051 * automatically when the driver is attached.
1069 * automatically when the driver is detached.
1080 * This function can be used to let the driver free the automatically
1082 * useful when the driver is refcounting the softc and the softc
1227 * @brief Return non-zero if the device currently has a driver
1375 dev->driver = NULL;
1524 * the device currently has a driver attached to it, the device is
1598 * @brief Probe a device and attach a driver if possible
1624 * @brief Attach a device driver to a device
1626 * This function is a wrapper around the DEVICE_ATTACH() driver
1638 * @retval ENXIO no driver was found
1649 //if (resource_disabled(dev->driver->name, dev->unit)) {
1663 dev->driver->name, dev->unit, error);
1682 dev->driver->name, dev->unit);
1701 * system. Its purpose is to select a suitable driver for a device and
1702 * then call that driver to initialise the hardware appropriately. The
1703 * driver is selected by calling the DEVICE_PROBE() method of a set of
1704 * candidate drivers and then choosing the driver which returned the
1705 * best value. This driver is then attached to the device using
1719 * @retval ENXIO no driver was found
1756 * @brief Tells a driver to quiesce itself.
1758 * This function is a wrapper around the DEVICE_QUIESCE() driver
1764 * @retval ENXIO no driver was found
1784 * This function calls the DEVICE_SHUTDOWN() driver method if the
1785 * device currently has an attached driver.
1812 * calls the DEVICE_IDENTIFY() method of each driver in the device's
1824 * If this driver's pass is too high, then ignore it.
1834 DEVICE_IDENTIFY(dl->driver, dev);
2081 * This implementation of BUS_DRIVER_ADDED() simply calls the driver's
2086 bus_generic_driver_added(device_t dev, driver_t *driver)
2091 DEVICE_IDENTIFY(driver, dev);
2108 * device is not already attached, it attempts to attach a driver to
2121 DEVICE_IDENTIFY(dl->driver, dev);
2252 if (!strcmp(dev->devclass->name, dl->driver->name))
2292 * @brief Detach a driver from a device
2294 * This function is a wrapper around the DEVICE_DETACH() driver
2303 * @retval ENXIO no driver was found
2377 * @brief Set the driver of a device
2380 * @retval EBUSY the device already has a driver attached
2384 device_set_driver(device_t dev, driver_t *driver)
2389 if (dev->driver == driver)
2398 dev->driver = driver;
2399 if (driver) {
2400 kobj_init((kobj_t) dev, (kobj_class_t) driver);
2401 if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) {
2402 dev->softc = bsd_malloc(driver->size, M_BUS_SC,
2407 dev->driver = NULL;
2448 /* If this driver's pass is too high, then ignore it. */
2452 PDEBUG(("Trying %s", DRIVERNAME(dl->driver)));
2453 result = device_set_driver(child, dl->driver);
2460 dl->driver->name) != 0) {
2465 printf("driver bug: Unable to set "
2468 dl->driver->name,
2476 // resource_int_value(dl->driver->name, child->unit,
2487 * If the driver returns SUCCESS, there can be
2497 * Reset DF_QUIET in case this driver doesn't
2498 * end up as the best driver.
2505 * only match on devices whose driver was explicitly
2514 * The driver returned an error so it
2524 * best matching driver. Initialise the value
2542 * If we found a driver, change state and initialise the devclass.
2549 * rescan, and it is a different driver, then we have
2550 * to detach the old driver and reattach this new one.
2564 if (child->state > DS_ALIVE && best->driver != child->driver)
2568 /* Set the winning driver, devclass, and flags. */
2570 result = device_set_devclass(child, best->driver->name);
2574 result = device_set_driver(child, best->driver);
2577 // resource_int_value(best->driver->name, child->unit,
2733 // root driver
2777 root_bus->driver = &root_driver;
2816 * devclass_add_driver() for the driver described by the
2824 kobj_class_t driver;
2844 driver = dmd->dmd_driver;
2845 PDEBUG(("Loading module: driver %s on bus %s (pass %d)",
2846 DRIVERNAME(driver), dmd->dmd_busname, pass));
2847 error = devclass_add_driver(bus_devclass, driver, pass,
2852 PDEBUG(("Unloading module: driver %s from bus %s",
2862 PDEBUG(("Quiesce module: driver %s from bus %s",
2917 print_driver_short(dev->driver, indent+1);
2955 print_driver_short(driver_t *driver, int indent)
2957 if (!driver)
2960 indentprintf(("driver %s: softc size = %zd\n",
2961 driver->name, driver->size));
2965 print_driver(driver_t *driver, int indent)
2967 if (!driver)
2970 print_driver_short(driver, indent);
2976 driverlink_t driver = NULL;
2978 TAILQ_FOREACH(driver, &drivers, link) {
2979 print_driver(driver->driver, indent);