Lines Matching defs:driver

85 	kobj_class_t	driver;
138 driver_t *driver; /**< current driver */
142 char* desc; /**< driver specific description */
149 void *softc; /**< current driver's variables */
167 #define DRIVERNAME(d) ((d)? d->name : "no driver")
188 static void print_driver_short(driver_t *driver, int indent);
189 static void print_driver(driver_t *driver, int indent);
276 sbuf_cat(&sb, dev->driver ? dev->driver->name : "");
315 OID_AUTO, "%driver",
318 "device driver name");
710 * free it unless there's an error. The dequeue part of the driver should
877 * @brief Register the pass level of a new driver attachment
879 * Register a new driver attachment's pass level. If no driver
883 * @param new the new driver attachment
897 * driver link into the list.
915 * new pass level that has at least one driver.
931 * Bail once we hit a driver with a pass level that is
946 * If there isn't a driver registered for the requested pass,
1012 * suitable driver.
1052 * @brief Register that a device driver has been added to a devclass
1054 * Register that a device driver has been added to a devclass. This
1066 * @param driver the driver that was just added
1069 devclass_driver_added(devclass_t dc, driver_t *driver)
1079 BUS_DRIVER_ADDED(dc->devices[i], driver);
1094 devclass_driver_added(dc, driver);
1099 * @brief Add a device driver to a device class
1101 * Add a device driver to a devclass. This is normally called
1107 * @param driver the driver to register
1110 devclass_add_driver(devclass_t dc, driver_t *driver, int pass, devclass_t *dcp)
1115 PDEBUG(("%s", DRIVERNAME(driver)));
1126 * Compile the driver's methods. Also increase the reference count
1131 kobj_class_compile((kobj_class_t) driver);
1134 * If the driver has any base classes, make the
1135 * devclass inherit from the devclass of the driver's
1138 * of a device using this driver.
1140 if (driver->baseclasses)
1141 parentname = driver->baseclasses[0]->name;
1144 *dcp = devclass_find_internal(driver->name, parentname, TRUE);
1146 dl->driver = driver;
1148 driver->refs++; /* XXX: kobj_mtx */
1155 devclass_driver_added(dc, driver);
1162 * @brief Register that a device driver has been deleted from a devclass
1164 * Register that a device driver has been removed from a devclass.
1167 * well as busclass. Each layer will attempt to detach the driver
1177 * @param dc the devclass of the driver being deleted
1178 * @param driver the driver being deleted
1181 devclass_driver_deleted(devclass_t busclass, devclass_t dc, driver_t *driver)
1189 * devices in the devclass of the driver and detach any which are
1190 * using the driver and which have a parent in the devclass which
1193 * Note that since a driver can be in multiple devclasses, we
1203 if (dev->driver == driver && dev->parent &&
1232 error = devclass_driver_deleted(busclass, dc, driver);
1241 * @brief Delete a device driver from a device class
1243 * Delete a device driver from a devclass. This is normally called
1246 * If the driver is currently attached to any devices,
1248 * device. If one of the detach calls fails, the driver will not be
1252 * @param driver the driver to unregister
1255 devclass_delete_driver(devclass_t busclass, driver_t *driver)
1257 devclass_t dc = devclass_find(driver->name);
1261 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
1270 if (dl->driver == driver)
1275 PDEBUG(("%s not found in %s list", driver->name,
1280 error = devclass_driver_deleted(busclass, dc, driver);
1288 driver->refs--;
1289 if (driver->refs == 0)
1290 kobj_class_free((kobj_class_t) driver);
1299 * Quiesce a device driver from a devclass. This is normally called
1302 * If the driver is currently attached to any devices,
1307 * @param driver the driver to unregister
1310 devclass_quiesce_driver(devclass_t busclass, driver_t *driver)
1312 devclass_t dc = devclass_find(driver->name);
1318 PDEBUG(("%s from devclass %s", driver->name, DEVCLANAME(busclass)));
1327 if (dl->driver == driver)
1332 PDEBUG(("%s not found in %s list", driver->name,
1339 * the devclass of the driver and quiesce any which are using
1340 * the driver and which have a parent in the devclass which we
1343 * Note that since a driver can be in multiple devclasses, we
1350 if (dev->driver == driver && dev->parent &&
1372 if (!strcmp(dl->driver->name, classname))
1501 list[count] = dl->driver;
1798 dev->driver = NULL;
1931 * the device currently has a driver attached to it, the device is
2062 if (!strcmp(dev->devclass->name, dl->driver->name))
2098 /* If this driver's pass is too high, then ignore it. */
2102 PDEBUG(("Trying %s", DRIVERNAME(dl->driver)));
2103 result = device_set_driver(child, dl->driver);
2110 dl->driver->name) != 0) {
2115 printf("driver bug: Unable to set "
2118 dl->driver->name,
2126 resource_int_value(dl->driver->name, child->unit,
2137 * If the driver returns SUCCESS, there can be
2147 * Reset DF_QUIET in case this driver doesn't
2148 * end up as the best driver.
2154 * only match on devices whose driver was explicitly
2163 * The driver returned an error so it
2173 * best matching driver. Initialise the value
2191 * If we found a driver, change state and initialise the devclass.
2197 * rescan, and it is a different driver, then we have
2198 * to detach the old driver and reattach this new one.
2212 if (child->state > DS_ALIVE && best->driver != child->driver)
2216 /* Set the winning driver, devclass, and flags. */
2218 result = device_set_devclass(child, best->driver->name);
2222 result = device_set_driver(child, best->driver);
2225 resource_int_value(best->driver->name, child->unit,
2307 * @brief Return the current driver for the device or @c NULL if there
2308 * is no driver currently attached
2313 return (dev->driver);
2504 * The softc is allocated and zeroed when a driver is attached, based
2505 * on the size field of the driver.
2517 * automatically when the driver is attached.
2535 * automatically when the driver is detached.
2546 * This function can be used to let the driver free the automatically
2548 * useful when the driver is refcounting the softc and the softc
2709 * @brief Return non-zero if the device currently has a driver
2788 * @brief Set the driver of a device
2791 * @retval EBUSY the device already has a driver attached
2795 device_set_driver(device_t dev, driver_t *driver)
2803 if (dev->driver == driver)
2812 dev->driver = driver;
2813 if (driver) {
2814 kobj_init((kobj_t) dev, (kobj_class_t) driver);
2815 if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) {
2820 dev->softc = malloc_domainset(driver->size, M_BUS_SC,
2825 dev->driver = NULL;
2841 * system. Its purpose is to select a suitable driver for a device and
2842 * then call that driver to initialise the hardware appropriately. The
2843 * driver is selected by calling the DEVICE_PROBE() method of a set of
2844 * candidate drivers and then choosing the driver which returned the
2845 * best value. This driver is then attached to the device using
2859 * @retval ENXIO no driver was found
2894 * @brief Probe a device and attach a driver if possible
2918 * @brief Attach a device driver to a device
2920 * This function is a wrapper around the DEVICE_ATTACH() driver
2932 * @retval ENXIO no driver was found
2943 if (resource_disabled(dev->driver->name, dev->unit)) {
2957 dev->driver->name, dev->unit, error);
2984 * @brief Detach a driver from a device
2986 * This function is a wrapper around the DEVICE_DETACH() driver
2995 * @retval ENXIO no driver was found
3043 * @brief Tells a driver to quiesce itself.
3045 * This function is a wrapper around the DEVICE_QUIESCE() driver
3051 * @retval ENXIO no driver was found
3070 * This function calls the DEVICE_SHUTDOWN() driver method if the
3071 * device currently has an attached driver.
3323 * by a driver (e.g. PCI BARs). This function is usually called when
3388 * Typically, a bus driver would store a list of child resources
3530 * to be used to cleanup resources leaked by a driver after detach or
3681 * calls the DEVICE_IDENTIFY() method of each driver in the device's
3692 * If this driver's pass is too high, then ignore it.
3702 DEVICE_IDENTIFY(dl->driver, dev);
4082 * This implementation of BUS_DRIVER_ADDED() simply calls the driver's
4087 bus_generic_driver_added(device_t dev, driver_t *driver)
4091 DEVICE_IDENTIFY(driver, dev);
4106 * device is not already attached, it attempts to attach a driver to
4119 DEVICE_IDENTIFY(dl->driver, dev);
5175 root_bus->driver = &root_driver;
5218 * devclass_add_driver() for the driver described by the
5226 kobj_class_t driver;
5239 driver = dmd->dmd_driver;
5240 PDEBUG(("Loading module: driver %s on bus %s (pass %d)",
5241 DRIVERNAME(driver), dmd->dmd_busname, pass));
5242 error = devclass_add_driver(bus_devclass, driver, pass,
5247 PDEBUG(("Unloading module: driver %s from bus %s",
5257 PDEBUG(("Quiesce module: driver %s from bus %s",
5346 print_driver_short(dev->driver, indent+1);
5384 print_driver_short(driver_t *driver, int indent)
5386 if (!driver)
5389 indentprintf(("driver %s: softc size = %zd\n",
5390 driver->name, driver->size));
5394 print_driver(driver_t *driver, int indent)
5396 if (!driver)
5399 print_driver_short(driver, indent);
5405 driverlink_t driver;
5407 TAILQ_FOREACH(driver, &drivers, link) {
5408 print_driver(driver->driver, indent);
5538 if (dev->driver != NULL)
5539 sbuf_cat(&sb, dev->driver->name);
5629 driver_exists(device_t bus, const char *driver)
5634 if (devclass_find_driver_internal(dc, driver) != NULL)
5665 * deferred during the freeze and call the driver added routines. They
5666 * have already been added to the lists in the background, so the driver
5673 devclass_driver_added(dc, dl->driver);
5766 if (resource_disabled(dev->driver->name, dev->unit))
5767 resource_unset_value(dev->driver->name,
5821 char driver[128];
5823 error = copyinstr(req->dr_data, driver, sizeof(driver), NULL);
5826 if (driver[0] == '\0') {
5831 strcmp(driver, dev->devclass->name) == 0)
5837 * least one matching driver.
5843 if (!driver_exists(dev->parent, driver)) {
5847 dc = devclass_create(driver);
6020 db_printf(" driver: %s\n", DRIVERNAME(dev->driver));