FreeBSD kernel kern code
subr_bus.c File Reference
#include <sys/cdefs.h>
#include "opt_bus.h"
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/filio.h>
#include <sys/lock.h>
#include <sys/kernel.h>
#include <sys/kobj.h>
#include <sys/limits.h>
#include <sys/malloc.h>
#include <sys/module.h>
#include <sys/mutex.h>
#include <sys/poll.h>
#include <sys/proc.h>
#include <sys/condvar.h>
#include <sys/queue.h>
#include <machine/bus.h>
#include <sys/rman.h>
#include <sys/selinfo.h>
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/bus.h>
#include <sys/interrupt.h>
#include <net/vnet.h>
#include <machine/stdarg.h>
#include <vm/uma.h>
Include dependency graph for subr_bus.c:

Go to the source code of this file.

Data Structures

struct  driverlink
 
struct  device
 Implementation of device. More...
 
struct  dev_event_info
 
struct  dev_softc
 

Macros

#define DC_HAS_CHILDREN   1
 
#define DF_ENABLED   0x01 /* device should be probed/attached */
 
#define DF_FIXEDCLASS   0x02 /* devclass specified at create time */
 
#define DF_WILDCARD   0x04 /* unit was originally wildcard */
 
#define DF_DESCMALLOCED   0x08 /* description was malloced */
 
#define DF_QUIET   0x10 /* don't print verbose attach message */
 
#define DF_DONENOMATCH   0x20 /* don't execute DEVICE_NOMATCH again */
 
#define DF_EXTERNALSOFTC   0x40 /* softc not allocated by us */
 
#define DF_REBID   0x80 /* Can rebid after attach */
 
#define PDEBUG(a)   /* nop */
 
#define DEVICENAME(d)   /* nop */
 
#define DRIVERNAME(d)   /* nop */
 
#define DEVCLANAME(d)   /* nop */
 
#define print_device_short(d, i)   /* nop */
 
#define print_device(d, i)   /* nop */
 
#define print_device_tree_short(d, i)   /* nop */
 
#define print_device_tree(d, i)   /* nop */
 
#define print_driver_short(d, i)   /* nop */
 
#define print_driver(d, i)   /* nop */
 
#define print_driver_list(d, i)   /* nop */
 
#define print_devclass_short(d, i)   /* nop */
 
#define print_devclass(d, i)   /* nop */
 
#define print_devclass_list_short()   /* nop */
 
#define print_devclass_list()   /* nop */
 
#define DEVCTL_DEFAULT_QUEUE_LEN   1000
 

Typedefs

typedef struct driverlinkdriverlink_t
 

Enumerations

enum  { DEVCLASS_SYSCTL_PARENT }
 
enum  {
  DEVICE_SYSCTL_DESC, DEVICE_SYSCTL_DRIVER, DEVICE_SYSCTL_LOCATION, DEVICE_SYSCTL_PNPINFO,
  DEVICE_SYSCTL_PARENT
}
 

Functions

 __FBSDID ("$BSDSUniX$")
 
 SYSCTL_NODE (_hw, OID_AUTO, bus, CTLFLAG_RW, NULL, NULL)
 
 SYSCTL_NODE (, OID_AUTO, dev, CTLFLAG_RW, NULL, NULL)
 
typedef TAILQ_HEAD (devclass_list, devclass)
 
static MALLOC_DEFINE (M_BUS,"bus","Bus data structures")
 
static MALLOC_DEFINE (M_BUS_SC,"bus-sc","Bus data structures, softc")
 
static int devclass_sysctl_handler (SYSCTL_HANDLER_ARGS)
 
static void devclass_sysctl_init (devclass_t dc)
 
static int device_sysctl_handler (SYSCTL_HANDLER_ARGS)
 
static void device_sysctl_init (device_t dev)
 
static void device_sysctl_update (device_t dev)
 
static void device_sysctl_fini (device_t dev)
 
static int sysctl_devctl_disable (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_PROC (_hw_bus, OID_AUTO, devctl_disable, CTLTYPE_INT|CTLFLAG_RW, NULL, 0, sysctl_devctl_disable,"I","devctl disable -- deprecated")
 
static int sysctl_devctl_queue (SYSCTL_HANDLER_ARGS)
 
 TUNABLE_INT ("hw.bus.devctl_queue",&devctl_queue_length)
 
 SYSCTL_PROC (_hw_bus, OID_AUTO, devctl_queue, CTLTYPE_INT|CTLFLAG_RW, NULL, 0, sysctl_devctl_queue,"I","devctl queue length")
 
 TAILQ_HEAD (devq, dev_event_info)
 
static void devinit (void)
 
static int devopen (struct cdev *dev, int oflags, int devtype, struct thread *td)
 
static int devclose (struct cdev *dev, int fflag, int devtype, struct thread *td)
 
static int devread (struct cdev *dev, struct uio *uio, int ioflag)
 
static int devioctl (struct cdev *dev, u_long cmd, caddr_t data, int fflag, struct thread *td)
 
static int devpoll (struct cdev *dev, int events, struct thread *td)
 
boolean_t devctl_process_running (void)
 Return whether the userland process is running. More...
 
void devctl_queue_data_f (char *data, int flags)
 Queue data to be read from the devctl device. More...
 
void devctl_queue_data (char *data)
 
void devctl_notify_f (const char *system, const char *subsystem, const char *type, const char *data, int flags)
 Send a 'notification' to userland, using standard ways. More...
 
void devctl_notify (const char *system, const char *subsystem, const char *type, const char *data)
 
static void devaddq (const char *type, const char *what, device_t dev)
 
static void devadded (device_t dev)
 
static void devremoved (device_t dev)
 
static void devnomatch (device_t dev)
 
static TAILQ_HEAD (device)
 
 DEFINE_CLASS (null, null_methods, 0)
 
static void driver_register_pass (struct driverlink *new)
 Register the pass level of a new driver attachment. More...
 
void bus_set_pass (int pass)
 Raise the current bus pass. More...
 
static devclass_t devclass_find_internal (const char *classname, const char *parentname, int create)
 Find or create a device class. More...
 
devclass_t devclass_create (const char *classname)
 Create a device class. More...
 
devclass_t devclass_find (const char *classname)
 Find a device class. More...
 
static void devclass_driver_added (devclass_t dc, driver_t *driver)
 Register that a device driver has been added to a devclass. More...
 
int devclass_add_driver (devclass_t dc, driver_t *driver, int pass, devclass_t *dcp)
 Add a device driver to a device class. More...
 
static int devclass_driver_deleted (devclass_t busclass, devclass_t dc, driver_t *driver)
 Register that a device driver has been deleted from a devclass. More...
 
int devclass_delete_driver (devclass_t busclass, driver_t *driver)
 Delete a device driver from a device class. More...
 
static int devclass_quiesce_driver (devclass_t busclass, driver_t *driver)
 Quiesces a set of device drivers from a device class. More...
 
static driverlink_t devclass_find_driver_internal (devclass_t dc, const char *classname)
 
const char * devclass_get_name (devclass_t dc)
 Return the name of the devclass. More...
 
device_t devclass_get_device (devclass_t dc, int unit)
 Find a device given a unit number. More...
 
void * devclass_get_softc (devclass_t dc, int unit)
 Find the softc field of a device given a unit number. More...
 
int devclass_get_devices (devclass_t dc, device_t **devlistp, int *devcountp)
 Get a list of devices in the devclass. More...
 
int devclass_get_drivers (devclass_t dc, driver_t ***listp, int *countp)
 Get a list of drivers in the devclass. More...
 
int devclass_get_count (devclass_t dc)
 Get the number of devices in a devclass. More...
 
int devclass_get_maxunit (devclass_t dc)
 Get the maximum unit number used in a devclass. More...
 
int devclass_find_free_unit (devclass_t dc, int unit)
 Find a free unit number in a devclass. More...
 
void devclass_set_parent (devclass_t dc, devclass_t pdc)
 Set the parent of a devclass. More...
 
devclass_t devclass_get_parent (devclass_t dc)
 Get the parent of a devclass. More...
 
struct sysctl_ctx_list * devclass_get_sysctl_ctx (devclass_t dc)
 
struct sysctl_oid * devclass_get_sysctl_tree (devclass_t dc)
 
static int devclass_alloc_unit (devclass_t dc, device_t dev, int *unitp)
 Allocate a unit number. More...
 
static int devclass_add_device (devclass_t dc, device_t dev)
 Add a device to a devclass. More...
 
static int devclass_delete_device (devclass_t dc, device_t dev)
 Delete a device from a devclass. More...
 
static device_t make_device (device_t parent, const char *name, int unit)
 Make a new device and add it as a child of parent. More...
 
static int device_print_child (device_t dev, device_t child)
 Print a description of a device. More...
 
device_t device_add_child (device_t dev, const char *name, int unit)
 Create a new device. More...
 
device_t device_add_child_ordered (device_t dev, u_int order, const char *name, int unit)
 Create a new device. More...
 
int device_delete_child (device_t dev, device_t child)
 Delete a device. More...
 
int device_delete_children (device_t dev)
 Delete all children devices of the given device, if any. More...
 
device_t device_find_child (device_t dev, const char *classname, int unit)
 Find a device given a unit number. More...
 
static driverlink_t first_matching_driver (devclass_t dc, device_t dev)
 
static driverlink_t next_matching_driver (devclass_t dc, device_t dev, driverlink_t last)
 
int device_probe_child (device_t dev, device_t child)
 
device_t device_get_parent (device_t dev)
 Return the parent of a device. More...
 
int device_get_children (device_t dev, device_t **devlistp, int *devcountp)
 Get a list of children of a device. More...
 
driver_t * device_get_driver (device_t dev)
 Return the current driver for the device or NULL if there is no driver currently attached. More...
 
devclass_t device_get_devclass (device_t dev)
 Return the current devclass for the device or NULL if there is none. More...
 
const char * device_get_name (device_t dev)
 Return the name of the device's devclass or NULL if there is none. More...
 
const char * device_get_nameunit (device_t dev)
 Return a string containing the device's devclass name followed by an ascii representation of the device's unit number (e.g. "foo2"). More...
 
int device_get_unit (device_t dev)
 Return the device's unit number. More...
 
const char * device_get_desc (device_t dev)
 Return the device's description string. More...
 
uint32_t device_get_flags (device_t dev)
 Return the device's flags. More...
 
struct sysctl_ctx_list * device_get_sysctl_ctx (device_t dev)
 
struct sysctl_oid * device_get_sysctl_tree (device_t dev)
 
int device_print_prettyname (device_t dev)
 Print the name of the device followed by a colon and a space. More...
 
int device_printf (device_t dev, const char *fmt,...)
 Print the name of the device followed by a colon, a space and the result of calling vprintf() with the value of fmt and the following arguments. More...
 
static void device_set_desc_internal (device_t dev, const char *desc, int copy)
 
void device_set_desc (device_t dev, const char *desc)
 Set the device's description. More...
 
void device_set_desc_copy (device_t dev, const char *desc)
 Set the device's description. More...
 
void device_set_flags (device_t dev, uint32_t flags)
 Set the device's flags. More...
 
void * device_get_softc (device_t dev)
 Return the device's softc field. More...
 
void device_set_softc (device_t dev, void *softc)
 Set the device's softc field. More...
 
void device_free_softc (void *softc)
 Free claimed softc. More...
 
void device_claim_softc (device_t dev)
 Claim softc. More...
 
void * device_get_ivars (device_t dev)
 Get the device's ivars field. More...
 
void device_set_ivars (device_t dev, void *ivars)
 Set the device's ivars field. More...
 
device_state_t device_get_state (device_t dev)
 Return the device's state. More...
 
void device_enable (device_t dev)
 Set the DF_ENABLED flag for the device. More...
 
void device_disable (device_t dev)
 Clear the DF_ENABLED flag for the device. More...
 
void device_busy (device_t dev)
 Increment the busy counter for the device. More...
 
void device_unbusy (device_t dev)
 Decrement the busy counter for the device. More...
 
void device_quiet (device_t dev)
 Set the DF_QUIET flag for the device. More...
 
void device_verbose (device_t dev)
 Clear the DF_QUIET flag for the device. More...
 
int device_is_quiet (device_t dev)
 Return non-zero if the DF_QUIET flag is set on the device. More...
 
int device_is_enabled (device_t dev)
 Return non-zero if the DF_ENABLED flag is set on the device. More...
 
int device_is_alive (device_t dev)
 Return non-zero if the device was successfully probed. More...
 
int device_is_attached (device_t dev)
 Return non-zero if the device currently has a driver attached to it. More...
 
int device_set_devclass (device_t dev, const char *classname)
 Set the devclass of a device. More...
 
int device_set_driver (device_t dev, driver_t *driver)
 Set the driver of a device. More...
 
int device_probe (device_t dev)
 Probe a device, and return this status. More...
 
int device_probe_and_attach (device_t dev)
 Probe a device and attach a driver if possible. More...
 
int device_attach (device_t dev)
 Attach a device driver to a device. More...
 
int device_detach (device_t dev)
 Detach a driver from a device. More...
 
int device_quiesce (device_t dev)
 Tells a driver to quiesce itself. More...
 
int device_shutdown (device_t dev)
 Notify a device of system shutdown. More...
 
int device_set_unit (device_t dev, int unit)
 Set the unit number of a device. More...
 
void resource_list_init (struct resource_list *rl)
 Initialise a resource list. More...
 
void resource_list_free (struct resource_list *rl)
 Reclaim memory used by a resource list. More...
 
int resource_list_add_next (struct resource_list *rl, int type, u_long start, u_long end, u_long count)
 Add a resource entry. More...
 
struct resource_list_entry * resource_list_add (struct resource_list *rl, int type, int rid, u_long start, u_long end, u_long count)
 Add or modify a resource entry. More...
 
int resource_list_busy (struct resource_list *rl, int type, int rid)
 Determine if a resource entry is busy. More...
 
int resource_list_reserved (struct resource_list *rl, int type, int rid)
 Determine if a resource entry is reserved. More...
 
struct resource_list_entry * resource_list_find (struct resource_list *rl, int type, int rid)
 Find a resource entry by type and rid. More...
 
void resource_list_delete (struct resource_list *rl, int type, int rid)
 Delete a resource entry. More...
 
struct resource * resource_list_reserve (struct resource_list *rl, device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags)
 Allocate a reserved resource. More...
 
struct resource * resource_list_alloc (struct resource_list *rl, device_t bus, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags)
 Helper function for implementing BUS_ALLOC_RESOURCE() More...
 
int resource_list_release (struct resource_list *rl, device_t bus, device_t child, int type, int rid, struct resource *res)
 Helper function for implementing BUS_RELEASE_RESOURCE() More...
 
int resource_list_unreserve (struct resource_list *rl, device_t bus, device_t child, int type, int rid)
 Fully release a reserved resource. More...
 
int resource_list_print_type (struct resource_list *rl, const char *name, int type, const char *format)
 Print a description of resources in a resource list. More...
 
void resource_list_purge (struct resource_list *rl)
 Releases all the resources in a list. More...
 
device_t bus_generic_add_child (device_t dev, u_int order, const char *name, int unit)
 
int bus_generic_probe (device_t dev)
 Helper function for implementing DEVICE_PROBE() More...
 
int bus_generic_attach (device_t dev)
 Helper function for implementing DEVICE_ATTACH() More...
 
int bus_generic_detach (device_t dev)
 Helper function for implementing DEVICE_DETACH() More...
 
int bus_generic_shutdown (device_t dev)
 Helper function for implementing DEVICE_SHUTDOWN() More...
 
int bus_generic_suspend (device_t dev)
 Helper function for implementing DEVICE_SUSPEND() More...
 
int bus_generic_resume (device_t dev)
 Helper function for implementing DEVICE_RESUME() More...
 
int bus_print_child_header (device_t dev, device_t child)
 Helper function for implementing BUS_PRINT_CHILD(). More...
 
int bus_print_child_footer (device_t dev, device_t child)
 Helper function for implementing BUS_PRINT_CHILD(). More...
 
int bus_generic_print_child (device_t dev, device_t child)
 Helper function for implementing BUS_PRINT_CHILD(). More...
 
int bus_generic_read_ivar (device_t dev, device_t child, int index, uintptr_t *result)
 Stub function for implementing BUS_READ_IVAR(). More...
 
int bus_generic_write_ivar (device_t dev, device_t child, int index, uintptr_t value)
 Stub function for implementing BUS_WRITE_IVAR(). More...
 
struct resource_list * bus_generic_get_resource_list (device_t dev, device_t child)
 Stub function for implementing BUS_GET_RESOURCE_LIST(). More...
 
void bus_generic_driver_added (device_t dev, driver_t *driver)
 Helper function for implementing BUS_DRIVER_ADDED(). More...
 
void bus_generic_new_pass (device_t dev)
 Helper function for implementing BUS_NEW_PASS(). More...
 
int bus_generic_setup_intr (device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
 Helper function for implementing BUS_SETUP_INTR(). More...
 
int bus_generic_teardown_intr (device_t dev, device_t child, struct resource *irq, void *cookie)
 Helper function for implementing BUS_TEARDOWN_INTR(). More...
 
int bus_generic_adjust_resource (device_t dev, device_t child, int type, struct resource *r, u_long start, u_long end)
 Helper function for implementing BUS_ADJUST_RESOURCE(). More...
 
struct resource * bus_generic_alloc_resource (device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags)
 Helper function for implementing BUS_ALLOC_RESOURCE(). More...
 
int bus_generic_release_resource (device_t dev, device_t child, int type, int rid, struct resource *r)
 Helper function for implementing BUS_RELEASE_RESOURCE(). More...
 
int bus_generic_activate_resource (device_t dev, device_t child, int type, int rid, struct resource *r)
 Helper function for implementing BUS_ACTIVATE_RESOURCE(). More...
 
int bus_generic_deactivate_resource (device_t dev, device_t child, int type, int rid, struct resource *r)
 Helper function for implementing BUS_DEACTIVATE_RESOURCE(). More...
 
int bus_generic_bind_intr (device_t dev, device_t child, struct resource *irq, int cpu)
 Helper function for implementing BUS_BIND_INTR(). More...
 
int bus_generic_config_intr (device_t dev, int irq, enum intr_trigger trig, enum intr_polarity pol)
 Helper function for implementing BUS_CONFIG_INTR(). More...
 
int bus_generic_describe_intr (device_t dev, device_t child, struct resource *irq, void *cookie, const char *descr)
 Helper function for implementing BUS_DESCRIBE_INTR(). More...
 
bus_dma_tag_t bus_generic_get_dma_tag (device_t dev, device_t child)
 Helper function for implementing BUS_GET_DMA_TAG(). More...
 
int bus_generic_rl_get_resource (device_t dev, device_t child, int type, int rid, u_long *startp, u_long *countp)
 Helper function for implementing BUS_GET_RESOURCE(). More...
 
int bus_generic_rl_set_resource (device_t dev, device_t child, int type, int rid, u_long start, u_long count)
 Helper function for implementing BUS_SET_RESOURCE(). More...
 
void bus_generic_rl_delete_resource (device_t dev, device_t child, int type, int rid)
 Helper function for implementing BUS_DELETE_RESOURCE(). More...
 
int bus_generic_rl_release_resource (device_t dev, device_t child, int type, int rid, struct resource *r)
 Helper function for implementing BUS_RELEASE_RESOURCE(). More...
 
struct resource * bus_generic_rl_alloc_resource (device_t dev, device_t child, int type, int *rid, u_long start, u_long end, u_long count, u_int flags)
 Helper function for implementing BUS_ALLOC_RESOURCE(). More...
 
int bus_generic_child_present (device_t dev, device_t child)
 Helper function for implementing BUS_CHILD_PRESENT(). More...
 
int bus_alloc_resources (device_t dev, struct resource_spec *rs, struct resource **res)
 
void bus_release_resources (device_t dev, const struct resource_spec *rs, struct resource **res)
 
struct resource * bus_alloc_resource (device_t dev, int type, int *rid, u_long start, u_long end, u_long count, u_int flags)
 Wrapper function for BUS_ALLOC_RESOURCE(). More...
 
int bus_adjust_resource (device_t dev, int type, struct resource *r, u_long start, u_long end)
 Wrapper function for BUS_ADJUST_RESOURCE(). More...
 
int bus_activate_resource (device_t dev, int type, int rid, struct resource *r)
 Wrapper function for BUS_ACTIVATE_RESOURCE(). More...
 
int bus_deactivate_resource (device_t dev, int type, int rid, struct resource *r)
 Wrapper function for BUS_DEACTIVATE_RESOURCE(). More...
 
int bus_release_resource (device_t dev, int type, int rid, struct resource *r)
 Wrapper function for BUS_RELEASE_RESOURCE(). More...
 
int bus_setup_intr (device_t dev, struct resource *r, int flags, driver_filter_t filter, driver_intr_t handler, void *arg, void **cookiep)
 Wrapper function for BUS_SETUP_INTR(). More...
 
int bus_teardown_intr (device_t dev, struct resource *r, void *cookie)
 Wrapper function for BUS_TEARDOWN_INTR(). More...
 
int bus_bind_intr (device_t dev, struct resource *r, int cpu)
 Wrapper function for BUS_BIND_INTR(). More...
 
int bus_describe_intr (device_t dev, struct resource *irq, void *cookie, const char *fmt,...)
 Wrapper function for BUS_DESCRIBE_INTR(). More...
 
int bus_set_resource (device_t dev, int type, int rid, u_long start, u_long count)
 Wrapper function for BUS_SET_RESOURCE(). More...
 
int bus_get_resource (device_t dev, int type, int rid, u_long *startp, u_long *countp)
 Wrapper function for BUS_GET_RESOURCE(). More...
 
u_long bus_get_resource_start (device_t dev, int type, int rid)
 Wrapper function for BUS_GET_RESOURCE(). More...
 
u_long bus_get_resource_count (device_t dev, int type, int rid)
 Wrapper function for BUS_GET_RESOURCE(). More...
 
void bus_delete_resource (device_t dev, int type, int rid)
 Wrapper function for BUS_DELETE_RESOURCE(). More...
 
int bus_child_present (device_t child)
 Wrapper function for BUS_CHILD_PRESENT(). More...
 
int bus_child_pnpinfo_str (device_t child, char *buf, size_t buflen)
 Wrapper function for BUS_CHILD_PNPINFO_STR(). More...
 
int bus_child_location_str (device_t child, char *buf, size_t buflen)
 Wrapper function for BUS_CHILD_LOCATION_STR(). More...
 
bus_dma_tag_t bus_get_dma_tag (device_t dev)
 Wrapper function for BUS_GET_DMA_TAG(). More...
 
static int root_resume (device_t dev)
 
static int root_print_child (device_t dev, device_t child)
 
static int root_setup_intr (device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
 
static int root_child_present (device_t dev, device_t child)
 
static int root_bus_module_handler (module_t mod, int what, void *arg)
 
 DECLARE_MODULE (rootbus, root_bus_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST)
 
void root_bus_configure (void)
 Automatically configure devices. More...
 
int driver_module_handler (module_t mod, int what, void *arg)
 Module handler for registering device drivers. More...
 
void bus_enumerate_hinted_children (device_t bus)
 Enumerate all hinted devices for this bus. More...
 
static int sysctl_bus (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_NODE (_hw_bus, OID_AUTO, info, CTLFLAG_RW, sysctl_bus,"bus-related data")
 
static int sysctl_devices (SYSCTL_HANDLER_ARGS)
 
 SYSCTL_NODE (_hw_bus, OID_AUTO, devices, CTLFLAG_RD, sysctl_devices,"system device tree")
 
int bus_data_generation_check (int generation)
 
void bus_data_generation_update (void)
 
int bus_free_resource (device_t dev, int type, struct resource *r)
 

Variables

static int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN
 
static d_open_t devopen
 
static d_close_t devclose
 
static d_read_t devread
 
static d_ioctl_t devioctl
 
static d_poll_t devpoll
 
static struct cdevsw dev_cdevsw
 
static struct dev_softc devsoftc
 
static struct cdev * devctl_dev
 
static driver_list_t passes = TAILQ_HEAD_INITIALIZER(passes)
 
int bus_current_pass = BUS_PASS_ROOT
 
static devclass_list_t devclasses = TAILQ_HEAD_INITIALIZER(devclasses)
 
static kobj_method_t root_methods []
 
static driver_t root_driver
 
device_t root_bus
 
devclass_t root_devclass
 
static moduledata_t root_bus_mod
 

Macro Definition Documentation

#define DC_HAS_CHILDREN   1
#define DEVCTL_DEFAULT_QUEUE_LEN   1000

Definition at line 361 of file subr_bus.c.

Referenced by sysctl_devctl_disable().

#define DF_DESCMALLOCED   0x08 /* description was malloced */
#define DF_DONENOMATCH   0x20 /* don't execute DEVICE_NOMATCH again */
#define DF_ENABLED   0x01 /* device should be probed/attached */
#define DF_EXTERNALSOFTC   0x40 /* softc not allocated by us */
#define DF_FIXEDCLASS   0x02 /* devclass specified at create time */
#define DF_QUIET   0x10 /* don't print verbose attach message */
#define DF_REBID   0x80 /* Can rebid after attach */
#define DF_WILDCARD   0x04 /* unit was originally wildcard */
#define DRIVERNAME (   d)    /* nop */

Definition at line 180 of file subr_bus.c.

Referenced by devclass_add_driver(), device_probe_child(), and driver_module_handler().

#define print_devclass (   d,
 
)    /* nop */

Definition at line 191 of file subr_bus.c.

#define print_devclass_list ( )    /* nop */

Definition at line 193 of file subr_bus.c.

#define print_devclass_list_short ( )    /* nop */

Definition at line 192 of file subr_bus.c.

#define print_devclass_short (   d,
 
)    /* nop */

Definition at line 190 of file subr_bus.c.

#define print_device (   d,
 
)    /* nop */

Definition at line 184 of file subr_bus.c.

#define print_device_short (   d,
 
)    /* nop */

Definition at line 183 of file subr_bus.c.

#define print_device_tree (   d,
 
)    /* nop */

Definition at line 186 of file subr_bus.c.

#define print_device_tree_short (   d,
 
)    /* nop */

Definition at line 185 of file subr_bus.c.

#define print_driver (   d,
 
)    /* nop */

Definition at line 188 of file subr_bus.c.

#define print_driver_list (   d,
 
)    /* nop */

Definition at line 189 of file subr_bus.c.

#define print_driver_short (   d,
 
)    /* nop */

Definition at line 187 of file subr_bus.c.

Typedef Documentation

typedef struct driverlink* driverlink_t

Definition at line 68 of file subr_bus.c.

Enumeration Type Documentation

anonymous enum
Enumerator
DEVCLASS_SYSCTL_PARENT 

Definition at line 200 of file subr_bus.c.

anonymous enum
Enumerator
DEVICE_SYSCTL_DESC 
DEVICE_SYSCTL_DRIVER 
DEVICE_SYSCTL_LOCATION 
DEVICE_SYSCTL_PNPINFO 
DEVICE_SYSCTL_PARENT 

Definition at line 236 of file subr_bus.c.

Function Documentation

__FBSDID ( "$BSDSUniX$"  )
int bus_activate_resource ( device_t  dev,
int  type,
int  rid,
struct resource *  r 
)

Wrapper function for BUS_ACTIVATE_RESOURCE().

This function simply calls the BUS_ACTIVATE_RESOURCE() method of the parent of dev.

Definition at line 4116 of file subr_bus.c.

Referenced by resource_list_alloc().

Here is the caller graph for this function:

int bus_adjust_resource ( device_t  dev,
int  type,
struct resource *  r,
u_long  start,
u_long  end 
)

Wrapper function for BUS_ADJUST_RESOURCE().

This function simply calls the BUS_ADJUST_RESOURCE() method of the parent of dev.

Definition at line 4101 of file subr_bus.c.

struct resource* bus_alloc_resource ( device_t  dev,
int  type,
int *  rid,
u_long  start,
u_long  end,
u_long  count,
u_int  flags 
)

Wrapper function for BUS_ALLOC_RESOURCE().

This function simply calls the BUS_ALLOC_RESOURCE() method of the parent of dev.

Definition at line 4085 of file subr_bus.c.

int bus_alloc_resources ( device_t  dev,
struct resource_spec *  rs,
struct resource **  res 
)

Definition at line 4046 of file subr_bus.c.

References bus_release_resources(), and type.

Here is the call graph for this function:

int bus_bind_intr ( device_t  dev,
struct resource *  r,
int  cpu 
)

Wrapper function for BUS_BIND_INTR().

This function simply calls the BUS_BIND_INTR() method of the parent of dev.

Definition at line 4195 of file subr_bus.c.

int bus_child_location_str ( device_t  child,
char *  buf,
size_t  buflen 
)

Wrapper function for BUS_CHILD_LOCATION_STR().

This function simply calls the BUS_CHILD_LOCATION_STR() method of the parent of dev.

Definition at line 4340 of file subr_bus.c.

References device_get_parent(), and parent.

Referenced by devaddq(), device_sysctl_handler(), and sysctl_devices().

Here is the call graph for this function:

Here is the caller graph for this function:

int bus_child_pnpinfo_str ( device_t  child,
char *  buf,
size_t  buflen 
)

Wrapper function for BUS_CHILD_PNPINFO_STR().

This function simply calls the BUS_CHILD_PNPINFO_STR() method of the parent of dev.

Definition at line 4321 of file subr_bus.c.

References device_get_parent(), and parent.

Referenced by devaddq(), device_sysctl_handler(), and sysctl_devices().

Here is the call graph for this function:

Here is the caller graph for this function:

int bus_child_present ( device_t  child)

Wrapper function for BUS_CHILD_PRESENT().

This function simply calls the BUS_CHILD_PRESENT() method of the parent of dev.

Definition at line 4309 of file subr_bus.c.

References device_get_parent().

Here is the call graph for this function:

int bus_data_generation_check ( int  generation)

Definition at line 4819 of file subr_bus.c.

Referenced by sysctl_devices(), and sysctl_rman().

Here is the caller graph for this function:

int bus_deactivate_resource ( device_t  dev,
int  type,
int  rid,
struct resource *  r 
)

Wrapper function for BUS_DEACTIVATE_RESOURCE().

This function simply calls the BUS_DEACTIVATE_RESOURCE() method of the parent of dev.

Definition at line 4130 of file subr_bus.c.

Referenced by resource_list_release().

Here is the caller graph for this function:

void bus_delete_resource ( device_t  dev,
int  type,
int  rid 
)

Wrapper function for BUS_DELETE_RESOURCE().

This function simply calls the BUS_DELETE_RESOURCE() method of the parent of dev.

Definition at line 4297 of file subr_bus.c.

References device_get_parent().

Here is the call graph for this function:

int bus_describe_intr ( device_t  dev,
struct resource *  irq,
void *  cookie,
const char *  fmt,
  ... 
)

Wrapper function for BUS_DESCRIBE_INTR().

This function first formats the requested description into a temporary buffer and then calls the BUS_DESCRIBE_INTR() method of the parent of dev.

Definition at line 4210 of file subr_bus.c.

References vsnprintf().

Here is the call graph for this function:

void bus_enumerate_hinted_children ( device_t  bus)

Enumerate all hinted devices for this bus.

Walks through the hints for this bus and calls the bus_hinted_child routine for each one it fines. It searches first for the specific bus that's being probed for hinted children (eg isa0), and then for generic children (eg isa).

Parameters
devbus device to enumerate

Definition at line 4561 of file subr_bus.c.

References device_get_name(), device_get_nameunit(), and resource_find_match().

Here is the call graph for this function:

int bus_free_resource ( device_t  dev,
int  type,
struct resource *  r 
)

Definition at line 4835 of file subr_bus.c.

References bus_release_resource(), and rman_get_rid().

Here is the call graph for this function:

int bus_generic_activate_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)

Helper function for implementing BUS_ACTIVATE_RESOURCE().

This simple implementation of BUS_ACTIVATE_RESOURCE() simply calls the BUS_ACTIVATE_RESOURCE() method of the parent of dev.

Definition at line 3805 of file subr_bus.c.

device_t bus_generic_add_child ( device_t  dev,
u_int  order,
const char *  name,
int  unit 
)

Definition at line 3425 of file subr_bus.c.

References device_add_child_ordered().

Here is the call graph for this function:

int bus_generic_adjust_resource ( device_t  dev,
device_t  child,
int  type,
struct resource *  r,
u_long  start,
u_long  end 
)

Helper function for implementing BUS_ADJUST_RESOURCE().

This simple implementation of BUS_ADJUST_RESOURCE() simply calls the BUS_ADJUST_RESOURCE() method of the parent of dev.

Definition at line 3754 of file subr_bus.c.

struct resource* bus_generic_alloc_resource ( device_t  dev,
device_t  child,
int  type,
int *  rid,
u_long  start,
u_long  end,
u_long  count,
u_int  flags 
)

Helper function for implementing BUS_ALLOC_RESOURCE().

This simple implementation of BUS_ALLOC_RESOURCE() simply calls the BUS_ALLOC_RESOURCE() method of the parent of dev.

Definition at line 3771 of file subr_bus.c.

int bus_generic_attach ( device_t  dev)

Helper function for implementing DEVICE_ATTACH()

This function can be used to help implement the DEVICE_ATTACH() for a bus. It calls device_probe_and_attach() for each of the device's children.

Definition at line 3471 of file subr_bus.c.

References device_probe_and_attach().

Here is the call graph for this function:

int bus_generic_bind_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
int  cpu 
)

Helper function for implementing BUS_BIND_INTR().

This simple implementation of BUS_BIND_INTR() simply calls the BUS_BIND_INTR() method of the parent of dev.

Definition at line 3839 of file subr_bus.c.

int bus_generic_child_present ( device_t  dev,
device_t  child 
)

Helper function for implementing BUS_CHILD_PRESENT().

This simple implementation of BUS_CHILD_PRESENT() simply calls the BUS_CHILD_PRESENT() method of the parent of dev.

Definition at line 4032 of file subr_bus.c.

References device_get_parent().

Here is the call graph for this function:

int bus_generic_config_intr ( device_t  dev,
int  irq,
enum intr_trigger  trig,
enum intr_polarity  pol 
)

Helper function for implementing BUS_CONFIG_INTR().

This simple implementation of BUS_CONFIG_INTR() simply calls the BUS_CONFIG_INTR() method of the parent of dev.

Definition at line 3856 of file subr_bus.c.

int bus_generic_deactivate_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)

Helper function for implementing BUS_DEACTIVATE_RESOURCE().

This simple implementation of BUS_DEACTIVATE_RESOURCE() simply calls the BUS_DEACTIVATE_RESOURCE() method of the parent of dev.

Definition at line 3822 of file subr_bus.c.

int bus_generic_describe_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
void *  cookie,
const char *  descr 
)

Helper function for implementing BUS_DESCRIBE_INTR().

This simple implementation of BUS_DESCRIBE_INTR() simply calls the BUS_DESCRIBE_INTR() method of the parent of dev.

Definition at line 3873 of file subr_bus.c.

int bus_generic_detach ( device_t  dev)

Helper function for implementing DEVICE_DETACH()

This function can be used to help implement the DEVICE_DETACH() for a bus. It calls device_detach() for each of the device's children.

Definition at line 3490 of file subr_bus.c.

References device_detach().

Here is the call graph for this function:

void bus_generic_driver_added ( device_t  dev,
driver_t *  driver 
)

Helper function for implementing BUS_DRIVER_ADDED().

This implementation of BUS_DRIVER_ADDED() simply calls the driver's DEVICE_IDENTIFY() method to allow it to add new children to the bus and then calls device_probe_and_attach() for each unattached child.

Definition at line 3671 of file subr_bus.c.

References device_probe_and_attach(), and DF_REBID.

Here is the call graph for this function:

bus_dma_tag_t bus_generic_get_dma_tag ( device_t  dev,
device_t  child 
)

Helper function for implementing BUS_GET_DMA_TAG().

This simple implementation of BUS_GET_DMA_TAG() simply calls the BUS_GET_DMA_TAG() method of the parent of dev.

Definition at line 3891 of file subr_bus.c.

struct resource_list* bus_generic_get_resource_list ( device_t  dev,
device_t  child 
)

Stub function for implementing BUS_GET_RESOURCE_LIST().

Returns
NULL

Definition at line 3658 of file subr_bus.c.

void bus_generic_new_pass ( device_t  dev)

Helper function for implementing BUS_NEW_PASS().

This implementing of BUS_NEW_PASS() first calls the identify routines for any drivers that probe at the current pass. Then it walks the list of devices for this bus. If a device is already attached, then it calls BUS_NEW_PASS() on that device. If the device is not already attached, it attempts to attach a driver to it.

Definition at line 3694 of file subr_bus.c.

References device_probe_and_attach(), and driverlink::driver.

Here is the call graph for this function:

int bus_generic_print_child ( device_t  dev,
device_t  child 
)

Helper function for implementing BUS_PRINT_CHILD().

This function simply calls bus_print_child_header() followed by bus_print_child_footer().

Returns
the number of characters printed

Definition at line 3618 of file subr_bus.c.

References bus_print_child_footer(), and bus_print_child_header().

Here is the call graph for this function:

int bus_generic_probe ( device_t  dev)

Helper function for implementing DEVICE_PROBE()

This function can be used to help implement the DEVICE_PROBE() for a bus (i.e. a device which has other devices attached to it). It calls the DEVICE_IDENTIFY() method of each driver in the device's devclass.

Definition at line 3440 of file subr_bus.c.

References driverlink::driver.

int bus_generic_read_ivar ( device_t  dev,
device_t  child,
int  index,
uintptr_t *  result 
)

Stub function for implementing BUS_READ_IVAR().

Returns
ENOENT

Definition at line 3634 of file subr_bus.c.

int bus_generic_release_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)

Helper function for implementing BUS_RELEASE_RESOURCE().

This simple implementation of BUS_RELEASE_RESOURCE() simply calls the BUS_RELEASE_RESOURCE() method of the parent of dev.

Definition at line 3788 of file subr_bus.c.

int bus_generic_resume ( device_t  dev)

Helper function for implementing DEVICE_RESUME()

This function can be used to help implement the DEVICE_RESUME() for a bus. It calls DEVICE_RESUME() on each of the device's children.

Definition at line 3560 of file subr_bus.c.

Referenced by root_resume().

Here is the caller graph for this function:

struct resource* bus_generic_rl_alloc_resource ( device_t  dev,
device_t  child,
int  type,
int *  rid,
u_long  start,
u_long  end,
u_long  count,
u_int  flags 
)

Helper function for implementing BUS_ALLOC_RESOURCE().

This implementation of BUS_ALLOC_RESOURCE() uses the resource_list_alloc() function to do most of the work. It calls BUS_GET_RESOURCE_LIST() to find a suitable resource list.

Definition at line 4008 of file subr_bus.c.

References device_get_parent(), and resource_list_alloc().

Here is the call graph for this function:

void bus_generic_rl_delete_resource ( device_t  dev,
device_t  child,
int  type,
int  rid 
)

Helper function for implementing BUS_DELETE_RESOURCE().

This implementation of BUS_DELETE_RESOURCE() uses the resource_list_delete() function to do most of the work. It calls BUS_GET_RESOURCE_LIST() to find a suitable resource list to edit.

Definition at line 3963 of file subr_bus.c.

References resource_list_delete().

Here is the call graph for this function:

int bus_generic_rl_get_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
u_long *  startp,
u_long *  countp 
)

Helper function for implementing BUS_GET_RESOURCE().

This implementation of BUS_GET_RESOURCE() uses the resource_list_find() function to do most of the work. It calls BUS_GET_RESOURCE_LIST() to find a suitable resource list to search.

Definition at line 3909 of file subr_bus.c.

References resource_list_find().

Here is the call graph for this function:

int bus_generic_rl_release_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
struct resource *  r 
)

Helper function for implementing BUS_RELEASE_RESOURCE().

This implementation of BUS_RELEASE_RESOURCE() uses the resource_list_release() function to do most of the work. It calls BUS_GET_RESOURCE_LIST() to find a suitable resource list.

Definition at line 3984 of file subr_bus.c.

References device_get_parent(), and resource_list_release().

Here is the call graph for this function:

int bus_generic_rl_set_resource ( device_t  dev,
device_t  child,
int  type,
int  rid,
u_long  start,
u_long  count 
)

Helper function for implementing BUS_SET_RESOURCE().

This implementation of BUS_SET_RESOURCE() uses the resource_list_add() function to do most of the work. It calls BUS_GET_RESOURCE_LIST() to find a suitable resource list to edit.

Definition at line 3940 of file subr_bus.c.

References resource_list_add().

Here is the call graph for this function:

int bus_generic_setup_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
int  flags,
driver_filter_t *  filter,
driver_intr_t *  intr,
void *  arg,
void **  cookiep 
)

Helper function for implementing BUS_SETUP_INTR().

This simple implementation of BUS_SETUP_INTR() simply calls the BUS_SETUP_INTR() method of the parent of dev.

Definition at line 3720 of file subr_bus.c.

int bus_generic_shutdown ( device_t  dev)

Helper function for implementing DEVICE_SHUTDOWN()

This function can be used to help implement the DEVICE_SHUTDOWN() for a bus. It calls device_shutdown() for each of the device's children.

Definition at line 3514 of file subr_bus.c.

References device_shutdown().

Here is the call graph for this function:

int bus_generic_suspend ( device_t  dev)

Helper function for implementing DEVICE_SUSPEND()

This function can be used to help implement the DEVICE_SUSPEND() for a bus. It calls DEVICE_SUSPEND() for each of the device's children. If any call to DEVICE_SUSPEND() fails, the suspend operation is aborted and any devices which were suspended are resumed immediately by calling their DEVICE_RESUME() methods.

Definition at line 3535 of file subr_bus.c.

int bus_generic_teardown_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
void *  cookie 
)

Helper function for implementing BUS_TEARDOWN_INTR().

This simple implementation of BUS_TEARDOWN_INTR() simply calls the BUS_TEARDOWN_INTR() method of the parent of dev.

Definition at line 3738 of file subr_bus.c.

int bus_generic_write_ivar ( device_t  dev,
device_t  child,
int  index,
uintptr_t  value 
)

Stub function for implementing BUS_WRITE_IVAR().

Returns
ENOENT

Definition at line 3646 of file subr_bus.c.

bus_dma_tag_t bus_get_dma_tag ( device_t  dev)

Wrapper function for BUS_GET_DMA_TAG().

This function simply calls the BUS_GET_DMA_TAG() method of the parent of dev.

Definition at line 4359 of file subr_bus.c.

References device_get_parent(), and parent.

Here is the call graph for this function:

int bus_get_resource ( device_t  dev,
int  type,
int  rid,
u_long *  startp,
u_long *  countp 
)

Wrapper function for BUS_GET_RESOURCE().

This function simply calls the BUS_GET_RESOURCE() method of the parent of dev.

Definition at line 4245 of file subr_bus.c.

References device_get_parent().

Here is the call graph for this function:

u_long bus_get_resource_count ( device_t  dev,
int  type,
int  rid 
)

Wrapper function for BUS_GET_RESOURCE().

This function simply calls the BUS_GET_RESOURCE() method of the parent of dev and returns the count value.

Definition at line 4278 of file subr_bus.c.

References count, device_get_parent(), and start.

Here is the call graph for this function:

u_long bus_get_resource_start ( device_t  dev,
int  type,
int  rid 
)

Wrapper function for BUS_GET_RESOURCE().

This function simply calls the BUS_GET_RESOURCE() method of the parent of dev and returns the start value.

Definition at line 4259 of file subr_bus.c.

References count, device_get_parent(), and start.

Here is the call graph for this function:

int bus_print_child_footer ( device_t  dev,
device_t  child 
)

Helper function for implementing BUS_PRINT_CHILD().

This function prints the last part of the ascii representation of child, which consists of the string " on " followed by the name and unit of the dev.

Returns
the number of characters printed

Definition at line 3604 of file subr_bus.c.

References device_get_nameunit(), and printf().

Referenced by bus_generic_print_child().

Here is the call graph for this function:

Here is the caller graph for this function:

int bus_print_child_header ( device_t  dev,
device_t  child 
)

Helper function for implementing BUS_PRINT_CHILD().

This function prints the first part of the ascii representation of child, including its name, unit and description (if any - see device_set_desc()).

Returns
the number of characters printed

Definition at line 3581 of file subr_bus.c.

References device_get_desc(), device_get_nameunit(), device_printf(), and printf().

Referenced by bus_generic_print_child(), and root_print_child().

Here is the call graph for this function:

Here is the caller graph for this function:

int bus_release_resource ( device_t  dev,
int  type,
int  rid,
struct resource *  r 
)

Wrapper function for BUS_RELEASE_RESOURCE().

This function simply calls the BUS_RELEASE_RESOURCE() method of the parent of dev.

Definition at line 4144 of file subr_bus.c.

Referenced by bus_free_resource(), bus_release_resources(), and resource_list_purge().

Here is the caller graph for this function:

void bus_release_resources ( device_t  dev,
const struct resource_spec *  rs,
struct resource **  res 
)

Definition at line 4065 of file subr_bus.c.

References bus_release_resource(), and type.

Referenced by bus_alloc_resources().

Here is the call graph for this function:

Here is the caller graph for this function:

void bus_set_pass ( int  pass)

Raise the current bus pass.

Raise the current bus pass level to pass. Call the BUS_NEW_PASS() method on the root bus to kick off a new device tree scan for each new pass level that has at least one driver.

Definition at line 852 of file subr_bus.c.

References panic(), and root_bus.

Referenced by root_bus_configure().

Here is the call graph for this function:

Here is the caller graph for this function:

int bus_set_resource ( device_t  dev,
int  type,
int  rid,
u_long  start,
u_long  count 
)

Wrapper function for BUS_SET_RESOURCE().

This function simply calls the BUS_SET_RESOURCE() method of the parent of dev.

Definition at line 4231 of file subr_bus.c.

References device_get_parent().

Here is the call graph for this function:

int bus_setup_intr ( device_t  dev,
struct resource *  r,
int  flags,
driver_filter_t  filter,
driver_intr_t  handler,
void *  arg,
void **  cookiep 
)

Wrapper function for BUS_SETUP_INTR().

This function simply calls the BUS_SETUP_INTR() method of the parent of dev.

Definition at line 4158 of file subr_bus.c.

References device_printf().

Here is the call graph for this function:

int bus_teardown_intr ( device_t  dev,
struct resource *  r,
void *  cookie 
)

Wrapper function for BUS_TEARDOWN_INTR().

This function simply calls the BUS_TEARDOWN_INTR() method of the parent of dev.

Definition at line 4181 of file subr_bus.c.

DECLARE_MODULE ( rootbus  ,
root_bus_mod  ,
SI_SUB_DRIVERS  ,
SI_ORDER_FIRST   
)
DEFINE_CLASS ( null  ,
null_methods  ,
 
)
static void devadded ( device_t  dev)
static

Definition at line 711 of file subr_bus.c.

References devaddq(), and device_get_nameunit().

Referenced by device_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

static void devaddq ( const char *  type,
const char *  what,
device_t  dev 
)
static

Definition at line 657 of file subr_bus.c.

References bus_child_location_str(), bus_child_pnpinfo_str(), devctl_queue_data(), device_get_nameunit(), device_get_parent(), free(), malloc(), and snprintf().

Referenced by devadded(), devnomatch(), and devremoved().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devclass_add_device ( devclass_t  dc,
device_t  dev 
)
static

Add a device to a devclass.

A unit number is allocated for the device (using the device's preferred unit number if any) and the device is registered in the devclass. This allows the device to be looked up by its unit number, e.g. by decoding a dev_t minor number.

Parameters
dcthe devclass to add to
devthe device to add
Return values
0success
EEXISTthe requested unit number is already allocated
ENOMEMmemory allocation failure

Definition at line 1624 of file subr_bus.c.

References DEVCLANAME, devclass_alloc_unit(), DEVICENAME, free(), malloc(), PDEBUG, and snprintf().

Referenced by device_set_devclass(), device_set_unit(), and make_device().

Here is the call graph for this function:

Here is the caller graph for this function:

int devclass_add_driver ( devclass_t  dc,
driver_t *  driver,
int  pass,
devclass_t *  dcp 
)

Add a device driver to a device class.

Add a device driver to a devclass. This is normally called automatically by DRIVER_MODULE(). The BUS_DRIVER_ADDED() method of all devices in the devclass will be called to allow them to attempt to re-probe any unmatched children.

Parameters
dcthe devclass to edit
driverthe driver to register

Definition at line 1044 of file subr_bus.c.

References bus_data_generation_update(), devclass_driver_added(), devclass_find_internal(), driverlink::driver, driver_register_pass(), DRIVERNAME, kobj_class_compile(), malloc(), and PDEBUG.

Referenced by driver_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devclass_alloc_unit ( devclass_t  dc,
device_t  dev,
int *  unitp 
)
static

Allocate a unit number.

On entry, *unitp is the desired unit number (or -1 if any will do). The allocated unit number is returned in *unitp.

Parameters
dcthe devclass to allocate from
unitppoints at the location for the allocated unit number
Return values
0success
EEXISTthe requested unit number is already allocated
ENOMEMmemory allocation failure

Definition at line 1539 of file subr_bus.c.

References bootverbose, DEVCLANAME, device_get_parent(), free(), malloc(), PDEBUG, printf(), and resource_string_value().

Referenced by devclass_add_device().

Here is the call graph for this function:

Here is the caller graph for this function:

devclass_t devclass_create ( const char *  classname)

Create a device class.

If a device class with the name classname exists, return it, otherwise create and return a new device class.

Parameters
classnamethe devclass name to find or create

Definition at line 966 of file subr_bus.c.

References devclass_find_internal().

Here is the call graph for this function:

static int devclass_delete_device ( devclass_t  dc,
device_t  dev 
)
static

Delete a device from a devclass.

The device is removed from the devclass's device list and its unit number is freed.

Parameters
dcthe devclass to delete from
devthe device to delete
Return values
0success

Definition at line 1662 of file subr_bus.c.

References DEVCLANAME, DEVICENAME, DF_WILDCARD, free(), panic(), and PDEBUG.

Referenced by device_attach(), device_delete_child(), device_detach(), device_set_devclass(), and device_set_unit().

Here is the call graph for this function:

Here is the caller graph for this function:

int devclass_delete_driver ( devclass_t  busclass,
driver_t *  driver 
)

Delete a device driver from a device class.

Delete a device driver from a devclass. This is normally called automatically by DRIVER_MODULE().

If the driver is currently attached to any devices, devclass_delete_driver() will first attempt to detach from each device. If one of the detach calls fails, the driver will not be deleted.

Parameters
dcthe devclass to edit
driverthe driver to unregister

Definition at line 1177 of file subr_bus.c.

References bus_data_generation_update(), DEVCLANAME, devclass_driver_deleted(), devclass_find(), driverlink::driver, free(), kobj_class_free(), and PDEBUG.

Referenced by driver_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

static void devclass_driver_added ( devclass_t  dc,
driver_t *  driver 
)
static

Register that a device driver has been added to a devclass.

Register that a device driver has been added to a devclass. This is called by devclass_add_driver to accomplish the recursive notification of all the children classes of dc, as well as dc. Each layer will have BUS_DRIVER_ADDED() called for all instances of the devclass.

We do a full search here of the devclass list at each iteration level to save storing children-lists in the devclass structure. If we ever move beyond a few dozen devices doing this, we may need to reevaluate...

Parameters
dcthe devclass to edit
driverthe driver that was just added

Definition at line 1003 of file subr_bus.c.

References DC_HAS_CHILDREN, device_is_attached(), and parent.

Referenced by devclass_add_driver().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devclass_driver_deleted ( devclass_t  busclass,
devclass_t  dc,
driver_t *  driver 
)
static

Register that a device driver has been deleted from a devclass.

Register that a device driver has been removed from a devclass. This is called by devclass_delete_driver to accomplish the recursive notification of all the children classes of busclass, as well as busclass. Each layer will attempt to detach the driver from any devices that are children of the bus's devclass. The function will return an error if a device fails to detach.

We do a full search here of the devclass list at each iteration level to save storing children-lists in the devclass structure. If we ever move beyond a few dozen devices doing this, we may need to reevaluate...

Parameters
busclassthe devclass of the parent bus
dcthe devclass of the driver being deleted
driverthe driver being deleted

Definition at line 1111 of file subr_bus.c.

References DC_HAS_CHILDREN, device_detach(), devnomatch(), DF_DONENOMATCH, and parent.

Referenced by devclass_delete_driver().

Here is the call graph for this function:

Here is the caller graph for this function:

devclass_t devclass_find ( const char *  classname)

Find a device class.

If a device class with the name classname exists, return it, otherwise return NULL.

Parameters
classnamethe devclass name to find

Definition at line 980 of file subr_bus.c.

References devclass_find_internal().

Referenced by devclass_delete_driver(), devclass_quiesce_driver(), and device_find_child().

Here is the call graph for this function:

Here is the caller graph for this function:

static driverlink_t devclass_find_driver_internal ( devclass_t  dc,
const char *  classname 
)
static

Definition at line 1287 of file subr_bus.c.

References DEVCLANAME, driverlink::driver, and PDEBUG.

Referenced by first_matching_driver().

Here is the caller graph for this function:

int devclass_find_free_unit ( devclass_t  dc,
int  unit 
)

Find a free unit number in a devclass.

This function searches for the first unused unit number greater that or equal to unit.

Parameters
dcthe devclass to examine
unitthe first unit number to check

Definition at line 1476 of file subr_bus.c.

static devclass_t devclass_find_internal ( const char *  classname,
const char *  parentname,
int  create 
)
static

Find or create a device class.

If a device class with the name classname exists, return it, otherwise if create is non-zero create and return a new device class.

If parentname is non-NULL, the parent of the devclass is set to the devclass of that name.

Parameters
classnamethe devclass name to find or create
parentnamethe parent devclass name or NULL
createnon-zero to create a devclass

Definition at line 911 of file subr_bus.c.

References bus_data_generation_update(), DC_HAS_CHILDREN, malloc(), and PDEBUG.

Referenced by devclass_add_driver(), devclass_create(), devclass_find(), device_set_devclass(), driver_module_handler(), make_device(), and root_bus_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

int devclass_get_count ( devclass_t  dc)

Get the number of devices in a devclass.

Parameters
dcthe devclass to examine

Definition at line 1438 of file subr_bus.c.

References count.

Referenced by cpufreq_attach(), cpufreq_detach(), and devclass_get_devices().

Here is the caller graph for this function:

device_t devclass_get_device ( devclass_t  dc,
int  unit 
)

Find a device given a unit number.

Parameters
dcthe devclass to search
unitthe unit number to search for
Returns
the device with the given unit number or NULL if there is no such device

Definition at line 1321 of file subr_bus.c.

Referenced by devclass_get_softc(), and device_find_child().

Here is the caller graph for this function:

int devclass_get_devices ( devclass_t  dc,
device_t **  devlistp,
int *  devcountp 
)

Get a list of devices in the devclass.

An array containing a list of all the devices in the given devclass is allocated and returned in *devlistp. The number of devices in the array is returned in *devcountp. The caller should free the array using free(p, M_TEMP), even if *devcountp is 0.

Parameters
dcthe devclass to examine
devlistppoints at location for array pointer return value
devcountppoints at location for array size return value
Return values
0success
ENOMEMthe array allocation failed

Definition at line 1367 of file subr_bus.c.

References count, devclass_get_count(), and malloc().

Referenced by cpufreq_curr_sysctl().

Here is the call graph for this function:

Here is the caller graph for this function:

int devclass_get_drivers ( devclass_t  dc,
driver_t ***  listp,
int *  countp 
)

Get a list of drivers in the devclass.

An array containing a list of pointers to all the drivers in the given devclass is allocated and returned in *listp. The number of drivers in the array is returned in *countp. The caller should free the array using free(p, M_TEMP).

Parameters
dcthe devclass to examine
listpgives location for array pointer return value
countpgives location for number of array elements return value
Return values
0success
ENOMEMthe array allocation failed

Definition at line 1408 of file subr_bus.c.

References count, driverlink::driver, and malloc().

Here is the call graph for this function:

int devclass_get_maxunit ( devclass_t  dc)

Get the maximum unit number used in a devclass.

Note that this is one greater than the highest currently-allocated unit. If a null devclass_t is passed in, -1 is returned to indicate that not even the devclass has been allocated yet.

Parameters
dcthe devclass to examine

Definition at line 1459 of file subr_bus.c.

Referenced by device_find_child().

Here is the caller graph for this function:

const char* devclass_get_name ( devclass_t  dc)

Return the name of the devclass.

Definition at line 1306 of file subr_bus.c.

Referenced by device_get_name().

Here is the caller graph for this function:

devclass_t devclass_get_parent ( devclass_t  dc)

Get the parent of a devclass.

Parameters
dcthe devclass to examine

Definition at line 1506 of file subr_bus.c.

void* devclass_get_softc ( devclass_t  dc,
int  unit 
)

Find the softc field of a device given a unit number.

Parameters
dcthe devclass to search
unitthe unit number to search for
Returns
the softc field of the device with the given unit number or NULL if there is no such device

Definition at line 1339 of file subr_bus.c.

References devclass_get_device(), and device_get_softc().

Here is the call graph for this function:

struct sysctl_ctx_list* devclass_get_sysctl_ctx ( devclass_t  dc)

Definition at line 1512 of file subr_bus.c.

struct sysctl_oid* devclass_get_sysctl_tree ( devclass_t  dc)

Definition at line 1518 of file subr_bus.c.

static int devclass_quiesce_driver ( devclass_t  busclass,
driver_t *  driver 
)
static

Quiesces a set of device drivers from a device class.

Quiesce a device driver from a devclass. This is normally called automatically by DRIVER_MODULE().

If the driver is currently attached to any devices, devclass_quiesece_driver() will first attempt to quiesce each device.

Parameters
dcthe devclass to edit
driverthe driver to unregister

Definition at line 1232 of file subr_bus.c.

References DEVCLANAME, devclass_find(), device_quiesce(), driverlink::driver, and PDEBUG.

Referenced by driver_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

void devclass_set_parent ( devclass_t  dc,
devclass_t  pdc 
)

Set the parent of a devclass.

The parent class is normally initialised automatically by DRIVER_MODULE().

Parameters
dcthe devclass to edit
pdcthe new parent devclass

Definition at line 1495 of file subr_bus.c.

static int devclass_sysctl_handler ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 205 of file subr_bus.c.

References DEVCLASS_SYSCTL_PARENT, and value.

Referenced by devclass_sysctl_init().

Here is the caller graph for this function:

static void devclass_sysctl_init ( devclass_t  dc)
static

Definition at line 221 of file subr_bus.c.

References devclass_sysctl_handler(), DEVCLASS_SYSCTL_PARENT, and sysctl_ctx_init().

Referenced by device_sysctl_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devclose ( struct cdev *  dev,
int  fflag,
int  devtype,
struct thread *  td 
)
static
void devctl_notify ( const char *  system,
const char *  subsystem,
const char *  type,
const char *  data 
)

Definition at line 635 of file subr_bus.c.

References devctl_notify_f().

Referenced by root_resume().

Here is the call graph for this function:

Here is the caller graph for this function:

void devctl_notify_f ( const char *  system,
const char *  subsystem,
const char *  type,
const char *  data,
int  flags 
)

Send a 'notification' to userland, using standard ways.

Definition at line 603 of file subr_bus.c.

References devctl_queue_data_f(), malloc(), and snprintf().

Referenced by devctl_notify(), and notify().

Here is the call graph for this function:

Here is the caller graph for this function:

boolean_t devctl_process_running ( void  )

Return whether the userland process is running.

Definition at line 530 of file subr_bus.c.

References devsoftc, and dev_softc::inuse.

void devctl_queue_data ( char *  data)

Definition at line 593 of file subr_bus.c.

References devctl_queue_data_f().

Referenced by devaddq().

Here is the call graph for this function:

Here is the caller graph for this function:

void devctl_queue_data_f ( char *  data,
int  flags 
)

Queue data to be read from the devctl device.

Generic interface to queue data to the devctl device. It is assumed that data is properly formatted. It is further assumed that data is allocated using the M_BUS malloc type.

Definition at line 543 of file subr_bus.c.

References dev_softc::async_proc, dev_softc::cv, dev_event_info::dei_data, dev_softc::devq, devsoftc, free(), kern_psignal(), malloc(), dev_softc::mtx, dev_softc::queued, dev_softc::sel, and selwakeup().

Referenced by devctl_notify_f(), and devctl_queue_data().

Here is the call graph for this function:

Here is the caller graph for this function:

device_t device_add_child ( device_t  dev,
const char *  name,
int  unit 
)

Create a new device.

This creates a new device and adds it as a child of an existing parent device. The new device will be added after the last existing child with order zero.

Parameters
devthe device which will be the parent of the new child device
namedevclass name for new device or NULL if not specified
unitunit number for new device or -1 if not specified
Returns
the new device

Definition at line 1782 of file subr_bus.c.

References device_add_child_ordered().

Here is the call graph for this function:

device_t device_add_child_ordered ( device_t  dev,
u_int  order,
const char *  name,
int  unit 
)

Create a new device.

This creates a new device and adds it as a child of an existing parent device. The new device will be added after the last existing child with the same order.

Parameters
devthe device which will be the parent of the new child device
ordera value which is used to partially sort the children of dev - devices created using lower values of order appear first in dev's list of children
namedevclass name for new device or NULL if not specified
unitunit number for new device or -1 if not specified
Returns
the new device

Definition at line 1808 of file subr_bus.c.

References bus_data_generation_update(), DEVICENAME, make_device(), and PDEBUG.

Referenced by bus_generic_add_child(), and device_add_child().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_attach ( device_t  dev)

Attach a device driver to a device.

This function is a wrapper around the DEVICE_ATTACH() driver method. In addition to calling DEVICE_ATTACH(), it initialises the device's sysctl tree, optionally prints a description of the device and queues a notification event for user-based device management services.

Normally this function is only called internally from device_probe_and_attach().

Parameters
devthe device to initialise
Return values
0success
ENXIOno driver was found
ENOMEMmemory allocation failure
non-zerosome other unix error code

Definition at line 2761 of file subr_bus.c.

References bootverbose, devadded(), devclass_delete_device(), device_disable(), device_is_quiet(), device_print_child(), device_printf(), device_set_driver(), device_sysctl_fini(), device_sysctl_init(), device_sysctl_update(), DF_DONENOMATCH, DF_FIXEDCLASS, printf(), and resource_disabled().

Referenced by device_probe_and_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_busy ( device_t  dev)

Increment the busy counter for the device.

Definition at line 2502 of file subr_bus.c.

References panic().

Here is the call graph for this function:

void device_claim_softc ( device_t  dev)

Claim softc.

This function can be used to let the driver free the automatically allocated softc using "device_free_softc()". This function is useful when the driver is refcounting the softc and the softc cannot be freed when the "device_detach" method is called.

Definition at line 2437 of file subr_bus.c.

References DF_EXTERNALSOFTC.

int device_delete_child ( device_t  dev,
device_t  child 
)

Delete a device.

This function deletes a device along with all of its children. If the device currently has a driver attached to it, the device is detached first using device_detach().

Parameters
devthe parent device
childthe device to delete
Return values
0success
non-zeroa unit error code describing the error

Definition at line 1860 of file subr_bus.c.

References bus_data_generation_update(), devclass_delete_device(), device_detach(), DEVICENAME, kobj_delete(), and PDEBUG.

Referenced by cpufreq_unregister(), and device_delete_children().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_delete_children ( device_t  dev)

Delete all children devices of the given device, if any.

This function deletes all children devices of the given device, if any, using the device_delete_child() function for each device it finds. If a child device cannot be deleted, this function will return an error code.

Parameters
devthe parent device
Return values
0success
non-zeroa device would not detach

Definition at line 1902 of file subr_bus.c.

References device_delete_child(), DEVICENAME, and PDEBUG.

Here is the call graph for this function:

int device_detach ( device_t  dev)

Detach a driver from a device.

This function is a wrapper around the DEVICE_DETACH() driver method. If the call to DEVICE_DETACH() succeeds, it calls BUS_CHILD_DETACHED() for the parent of dev, queues a notification event for user-based device management services and cleans up the device's sysctl tree.

Parameters
devthe device to un-initialise
Return values
0success
ENXIOno driver was found
ENOMEMmemory allocation failure
non-zerosome other unix error code

Definition at line 2814 of file subr_bus.c.

References devclass_delete_device(), device_is_quiet(), device_printf(), device_set_driver(), device_sysctl_fini(), DEVICENAME, devremoved(), DF_FIXEDCLASS, and PDEBUG.

Referenced by bus_generic_detach(), devclass_driver_deleted(), device_delete_child(), and device_probe_child().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_disable ( device_t  dev)

Clear the DF_ENABLED flag for the device.

Definition at line 2493 of file subr_bus.c.

References DF_ENABLED.

Referenced by device_attach().

Here is the caller graph for this function:

void device_enable ( device_t  dev)

Set the DF_ENABLED flag for the device.

Definition at line 2484 of file subr_bus.c.

References DF_ENABLED.

device_t device_find_child ( device_t  dev,
const char *  classname,
int  unit 
)

Find a device given a unit number.

This is similar to devclass_get_devices() but only searches for devices which have dev as a parent.

Parameters
devthe parent device to search
unitthe unit number to search for. If the unit is -1, return the first child of dev which has name classname (that is, the one with the lowest unit.)
Returns
the device with the given unit number or NULL if there is no such device

Definition at line 1936 of file subr_bus.c.

References devclass_find(), devclass_get_device(), and devclass_get_maxunit().

Referenced by cpufreq_register(), and cpufreq_unregister().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_free_softc ( void *  softc)

Free claimed softc.

Most drivers do not need to use this since the softc is freed automatically when the driver is detached.

Definition at line 2423 of file subr_bus.c.

References free().

Here is the call graph for this function:

int device_get_children ( device_t  dev,
device_t **  devlistp,
int *  devcountp 
)

Get a list of children of a device.

An array containing a list of all the children of the given device is allocated and returned in *devlistp. The number of devices in the array is returned in *devcountp. The caller should free the array using free(p, M_TEMP).

Parameters
devthe device to examine
devlistppoints at location for array pointer return value
devcountppoints at location for array size return value
Return values
0success
ENOMEMthe array allocation failed

Definition at line 2177 of file subr_bus.c.

References count, and malloc().

Referenced by cf_get_method(), cf_levels_method(), and cpufreq_unregister().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* device_get_desc ( device_t  dev)

Return the device's description string.

Definition at line 2265 of file subr_bus.c.

Referenced by bus_print_child_header().

Here is the caller graph for this function:

devclass_t device_get_devclass ( device_t  dev)

Return the current devclass for the device or NULL if there is none.

Definition at line 2224 of file subr_bus.c.

Referenced by device_set_unit().

Here is the caller graph for this function:

driver_t* device_get_driver ( device_t  dev)

Return the current driver for the device or NULL if there is no driver currently attached.

Definition at line 2214 of file subr_bus.c.

uint32_t device_get_flags ( device_t  dev)

Return the device's flags.

Definition at line 2274 of file subr_bus.c.

void* device_get_ivars ( device_t  dev)

Get the device's ivars field.

The ivars field is used by the parent device to store per-device state (e.g. the physical location of the device or a list of resources).

Definition at line 2453 of file subr_bus.c.

const char* device_get_name ( device_t  dev)

Return the name of the device's devclass or NULL if there is none.

Definition at line 2234 of file subr_bus.c.

References devclass_get_name().

Referenced by bus_enumerate_hinted_children(), clock_register(), device_print_prettyname(), device_probe(), device_probe_child(), and sysctl_rman().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* device_get_nameunit ( device_t  dev)

Return a string containing the device's devclass name followed by an ascii representation of the device's unit number (e.g. "foo2").

Definition at line 2247 of file subr_bus.c.

Referenced by bus_enumerate_hinted_children(), bus_print_child_footer(), bus_print_child_header(), cf_levels_method(), cf_set_method(), cpufreq_attach(), cpufreq_detach(), cpufreq_dup_set(), devadded(), devaddq(), device_unbusy(), devremoved(), resource_list_alloc(), and rman_reserve_resource_bound().

Here is the caller graph for this function:

void* device_get_softc ( device_t  dev)

Return the device's softc field.

The softc is allocated and zeroed when a driver is attached, based on the size field of the driver.

Definition at line 2393 of file subr_bus.c.

Referenced by cf_get_method(), cf_levels_method(), cf_set_method(), cpufreq_attach(), cpufreq_detach(), cpufreq_register(), and devclass_get_softc().

Here is the caller graph for this function:

device_state_t device_get_state ( device_t  dev)

Return the device's state.

Definition at line 2475 of file subr_bus.c.

struct sysctl_ctx_list* device_get_sysctl_ctx ( device_t  dev)

Definition at line 2280 of file subr_bus.c.

Referenced by cpufreq_register().

Here is the caller graph for this function:

struct sysctl_oid* device_get_sysctl_tree ( device_t  dev)

Definition at line 2286 of file subr_bus.c.

Referenced by cpufreq_attach(), and cpufreq_register().

Here is the caller graph for this function:

int device_get_unit ( device_t  dev)

Return the device's unit number.

Definition at line 2256 of file subr_bus.c.

Referenced by cpufreq_settings_changed(), device_print_prettyname(), and sysctl_rman().

Here is the caller graph for this function:

int device_is_alive ( device_t  dev)

Return non-zero if the device was successfully probed.

Definition at line 2572 of file subr_bus.c.

Referenced by device_print_child().

Here is the caller graph for this function:

int device_is_attached ( device_t  dev)

Return non-zero if the device currently has a driver attached to it.

Definition at line 2582 of file subr_bus.c.

Referenced by cf_get_method(), cf_levels_method(), cf_set_method(), cpufreq_unregister(), and devclass_driver_added().

Here is the caller graph for this function:

int device_is_enabled ( device_t  dev)

Return non-zero if the DF_ENABLED flag is set on the device.

Definition at line 2563 of file subr_bus.c.

References DF_ENABLED.

int device_is_quiet ( device_t  dev)

Return non-zero if the DF_QUIET flag is set on the device.

Definition at line 2554 of file subr_bus.c.

References DF_QUIET.

Referenced by device_attach(), and device_detach().

Here is the caller graph for this function:

static int device_print_child ( device_t  dev,
device_t  child 
)
static

Print a description of a device.

Definition at line 1753 of file subr_bus.c.

References device_is_alive(), and device_printf().

Referenced by device_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_print_prettyname ( device_t  dev)

Print the name of the device followed by a colon and a space.

Returns
the number of characters printed

Definition at line 2297 of file subr_bus.c.

References device_get_name(), device_get_unit(), name, and printf().

Referenced by device_printf(), and device_probe().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_printf ( device_t  dev,
const char *  fmt,
  ... 
)

Print the name of the device followed by a colon, a space and the result of calling vprintf() with the value of fmt and the following arguments.

Returns
the number of characters printed

Definition at line 2314 of file subr_bus.c.

References device_print_prettyname(), and vprintf().

Referenced by bus_print_child_header(), bus_setup_intr(), cf_set_method(), clock_register(), cpufreq_unregister(), device_attach(), device_detach(), device_print_child(), and resource_list_alloc().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_probe ( device_t  dev)

Probe a device, and return this status.

This function is the core of the device autoconfiguration system. Its purpose is to select a suitable driver for a device and then call that driver to initialise the hardware appropriately. The driver is selected by calling the DEVICE_PROBE() method of a set of candidate drivers and then choosing the driver which returned the best value. This driver is then attached to the device using device_attach().

The set of suitable drivers is taken from the list of drivers in the parent device's devclass. If the device was originally created with a specific class name (see device_add_child()), only drivers with that name are probed, otherwise all drivers in the devclass are probed. If no drivers return successful probe values in the parent devclass, the search continues in the parent of that devclass (see devclass_get_parent()) if any.

Parameters
devthe device to initialise
Return values
0success
ENXIOno driver was found
ENOMEMmemory allocation failure
non-zerosome other unix error code
-1Device already attached

Definition at line 2689 of file subr_bus.c.

References bootverbose, device_get_name(), device_print_prettyname(), device_probe_child(), devnomatch(), DF_DONENOMATCH, DF_ENABLED, DF_REBID, and printf().

Referenced by device_probe_and_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_probe_and_attach ( device_t  dev)

Probe a device and attach a driver if possible.

calls device_probe() and attaches if that was successful.

Definition at line 2723 of file subr_bus.c.

References device_attach(), and device_probe().

Referenced by bus_generic_attach(), bus_generic_driver_added(), bus_generic_new_pass(), and cpufreq_register().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_probe_child ( device_t  dev,
device_t  child 
)

Definition at line 1990 of file subr_bus.c.

References bus_data_generation_update(), device_detach(), device_get_name(), device_set_devclass(), device_set_driver(), DF_REBID, DF_WILDCARD, driverlink::driver, DRIVERNAME, first_matching_driver(), next_matching_driver(), panic(), PDEBUG, printf(), resource_int_value(), and result.

Referenced by device_probe().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_quiesce ( device_t  dev)

Tells a driver to quiesce itself.

This function is a wrapper around the DEVICE_QUIESCE() driver method. If the call to DEVICE_QUIESCE() succeeds.

Parameters
devthe device to quiesce
Return values
0success
ENXIOno driver was found
ENOMEMmemory allocation failure
non-zerosome other unix error code

Definition at line 2858 of file subr_bus.c.

References DEVICENAME, and PDEBUG.

Referenced by devclass_quiesce_driver().

Here is the caller graph for this function:

void device_quiet ( device_t  dev)

Set the DF_QUIET flag for the device.

Definition at line 2536 of file subr_bus.c.

References DF_QUIET.

Referenced by cpufreq_register().

Here is the caller graph for this function:

void device_set_desc ( device_t  dev,
const char *  desc 
)

Set the device's description.

The value of desc should be a string constant that will not change (at least until the description is changed in a subsequent call to device_set_desc() or device_set_desc_copy()).

Definition at line 2360 of file subr_bus.c.

References device_set_desc_internal().

Referenced by device_set_driver().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_set_desc_copy ( device_t  dev,
const char *  desc 
)

Set the device's description.

The string pointed to by desc is copied. Use this function if the device description is generated, (e.g. with sprintf()).

Definition at line 2372 of file subr_bus.c.

References device_set_desc_internal().

Here is the call graph for this function:

static void device_set_desc_internal ( device_t  dev,
const char *  desc,
int  copy 
)
static

Definition at line 2330 of file subr_bus.c.

References bus_data_generation_update(), DF_DESCMALLOCED, free(), and malloc().

Referenced by device_set_desc(), and device_set_desc_copy().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_set_devclass ( device_t  dev,
const char *  classname 
)

Set the devclass of a device.

See also
devclass_add_device().

Definition at line 2592 of file subr_bus.c.

References bus_data_generation_update(), devclass_add_device(), devclass_delete_device(), devclass_find_internal(), and printf().

Referenced by device_probe_child().

Here is the call graph for this function:

Here is the caller graph for this function:

int device_set_driver ( device_t  dev,
driver_t *  driver 
)

Set the driver of a device.

Return values
0success
EBUSYthe device already has a driver attached
ENOMEMa memory allocation failure occurred

Definition at line 2626 of file subr_bus.c.

References bus_data_generation_update(), device_set_desc(), DF_EXTERNALSOFTC, driverlink::driver, free(), kobj_delete(), kobj_init(), and malloc().

Referenced by device_attach(), device_detach(), and device_probe_child().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_set_flags ( device_t  dev,
uint32_t  flags 
)

Set the device's flags.

Definition at line 2381 of file subr_bus.c.

void device_set_ivars ( device_t  dev,
void *  ivars 
)

Set the device's ivars field.

Definition at line 2464 of file subr_bus.c.

void device_set_softc ( device_t  dev,
void *  softc 
)

Set the device's softc field.

Most drivers do not need to use this since the softc is allocated automatically when the driver is attached.

Definition at line 2405 of file subr_bus.c.

References DF_EXTERNALSOFTC, and free().

Here is the call graph for this function:

int device_set_unit ( device_t  dev,
int  unit 
)

Set the unit number of a device.

This function can be used to override the unit number used for a device (e.g. to wire a device to a pre-configured unit number).

Definition at line 2893 of file subr_bus.c.

References bus_data_generation_update(), devclass_add_device(), devclass_delete_device(), and device_get_devclass().

Here is the call graph for this function:

int device_shutdown ( device_t  dev)

Notify a device of system shutdown.

This function calls the DEVICE_SHUTDOWN() driver method if the device currently has an attached driver.

Returns
the value returned by DEVICE_SHUTDOWN()

Definition at line 2879 of file subr_bus.c.

Referenced by bus_generic_shutdown(), and root_bus_module_handler().

Here is the caller graph for this function:

static void device_sysctl_fini ( device_t  dev)
static

Definition at line 326 of file subr_bus.c.

References sysctl_ctx_free().

Referenced by device_attach(), and device_detach().

Here is the call graph for this function:

Here is the caller graph for this function:

static int device_sysctl_handler ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 245 of file subr_bus.c.

References buf, bus_child_location_str(), bus_child_pnpinfo_str(), DEVICE_SYSCTL_DESC, DEVICE_SYSCTL_DRIVER, DEVICE_SYSCTL_LOCATION, DEVICE_SYSCTL_PARENT, DEVICE_SYSCTL_PNPINFO, free(), malloc(), and value.

Referenced by device_sysctl_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static void device_sysctl_init ( device_t  dev)
static

Definition at line 281 of file subr_bus.c.

References devclass_sysctl_init(), DEVICE_SYSCTL_DESC, DEVICE_SYSCTL_DRIVER, device_sysctl_handler(), DEVICE_SYSCTL_LOCATION, DEVICE_SYSCTL_PARENT, DEVICE_SYSCTL_PNPINFO, and sysctl_ctx_init().

Referenced by device_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

static void device_sysctl_update ( device_t  dev)
static

Definition at line 316 of file subr_bus.c.

References sysctl_rename_oid().

Referenced by device_attach().

Here is the call graph for this function:

Here is the caller graph for this function:

void device_unbusy ( device_t  dev)

Decrement the busy counter for the device.

Definition at line 2517 of file subr_bus.c.

References device_get_nameunit(), and panic().

Here is the call graph for this function:

void device_verbose ( device_t  dev)

Clear the DF_QUIET flag for the device.

Definition at line 2545 of file subr_bus.c.

References DF_QUIET.

static void devinit ( void  )
static

Definition at line 408 of file subr_bus.c.

References dev_softc::cv, cv_init(), dev_softc::devq, devsoftc, make_dev_credf(), dev_softc::mtx, and mtx_init().

Referenced by root_bus_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devioctl ( struct cdev *  dev,
u_long  cmd,
caddr_t  data,
int  fflag,
struct thread *  td 
)
static

Definition at line 480 of file subr_bus.c.

References dev_softc::async_proc, devsoftc, and dev_softc::nonblock.

static void devnomatch ( device_t  dev)
static

Definition at line 734 of file subr_bus.c.

References devaddq().

Referenced by devclass_driver_deleted(), and device_probe().

Here is the call graph for this function:

Here is the caller graph for this function:

static int devopen ( struct cdev *  dev,
int  oflags,
int  devtype,
struct thread *  td 
)
static

Definition at line 418 of file subr_bus.c.

References dev_softc::async_proc, devsoftc, dev_softc::inuse, and dev_softc::nonblock.

static int devpoll ( struct cdev *  dev,
int  events,
struct thread *  td 
)
static

Definition at line 510 of file subr_bus.c.

References dev_softc::devq, devsoftc, dev_softc::mtx, dev_softc::sel, and selrecord().

Here is the call graph for this function:

static int devread ( struct cdev *  dev,
struct uio *  uio,
int  ioflag 
)
static

Definition at line 449 of file subr_bus.c.

References dev_softc::cv, dev_event_info::dei_data, dev_softc::devq, devsoftc, free(), dev_softc::mtx, dev_softc::nonblock, dev_softc::queued, and uiomove().

Here is the call graph for this function:

static void devremoved ( device_t  dev)
static

Definition at line 721 of file subr_bus.c.

References devaddq(), and device_get_nameunit().

Referenced by device_detach().

Here is the call graph for this function:

Here is the caller graph for this function:

int driver_module_handler ( module_t  mod,
int  what,
void *  arg 
)

Module handler for registering device drivers.

This module handler is used to automatically register device drivers when modules are loaded. If what is MOD_LOAD, it calls devclass_add_driver() for the driver described by the driver_module_data structure pointed to by arg

Definition at line 4498 of file subr_bus.c.

References devclass_add_driver(), devclass_delete_driver(), devclass_find_internal(), devclass_quiesce_driver(), driverlink::driver, DRIVERNAME, and PDEBUG.

Here is the call graph for this function:

static void driver_register_pass ( struct driverlink new)
static

Register the pass level of a new driver attachment.

Register a new driver attachment's pass level. If no driver attachment with the same pass level has been added, then new will be added to the global passes list.

Parameters
newthe new driver attachment

Definition at line 820 of file subr_bus.c.

Referenced by devclass_add_driver().

Here is the caller graph for this function:

static driverlink_t first_matching_driver ( devclass_t  dc,
device_t  dev 
)
static

Definition at line 1963 of file subr_bus.c.

References devclass_find_driver_internal().

Referenced by device_probe_child().

Here is the call graph for this function:

Here is the caller graph for this function:

static device_t make_device ( device_t  parent,
const char *  name,
int  unit 
)
static

Make a new device and add it as a child of parent.

Parameters
parentthe parent of the new device
namethe devclass name of the new device or NULL to leave the devclass unspecified unit the unit number of the new device of -1 to leave the unit number unspecified
Returns
the new device

Definition at line 1694 of file subr_bus.c.

References bus_data_generation_update(), devclass_add_device(), devclass_find_internal(), DEVICENAME, DF_ENABLED, DF_FIXEDCLASS, DF_WILDCARD, kobj_delete(), kobj_init(), malloc(), parent, PDEBUG, and printf().

Referenced by device_add_child_ordered(), and root_bus_module_handler().

Here is the call graph for this function:

Here is the caller graph for this function:

static MALLOC_DEFINE ( M_BUS  ,
"bus"  ,
"Bus data structures"   
)
static
static MALLOC_DEFINE ( M_BUS_SC  ,
"bus-sc"  ,
"Bus data  structures,
softc"   
)
static
static driverlink_t next_matching_driver ( devclass_t  dc,
device_t  dev,
driverlink_t  last 
)
static

Definition at line 1974 of file subr_bus.c.

References driverlink::driver.

Referenced by device_probe_child().

Here is the caller graph for this function:

struct resource_list_entry* resource_list_add ( struct resource_list *  rl,
int  type,
int  rid,
u_long  start,
u_long  end,
u_long  count 
)

Add or modify a resource entry.

If an existing entry exists with the same type and rid, it will be modified using the given values of start, end and count. If no entry exists, a new one will be created using the given values. The resource list entry that matches is then returned.

Parameters
rlthe resource list to edit
typethe resource entry type (e.g. SYS_RES_MEMORY)
ridthe resource identifier
startthe start address of the resource
endthe end address of the resource
countXXX end-start+1

Definition at line 2992 of file subr_bus.c.

References count, malloc(), panic(), resource_list_find(), start, and type.

Referenced by bus_generic_rl_set_resource(), and resource_list_add_next().

Here is the call graph for this function:

Here is the caller graph for this function:

int resource_list_add_next ( struct resource_list *  rl,
int  type,
u_long  start,
u_long  end,
u_long  count 
)

Add a resource entry.

This function adds a resource entry using the given type, start, end and count values. A rid value is chosen by searching sequentially for the first unused rid starting at zero.

Parameters
rlthe resource list to edit
typethe resource entry type (e.g. SYS_RES_MEMORY)
startthe start address of the resource
endthe end address of the resource
countXXX end-start+1

Definition at line 2964 of file subr_bus.c.

References resource_list_add(), and resource_list_find().

Here is the call graph for this function:

struct resource* resource_list_alloc ( struct resource_list *  rl,
device_t  bus,
device_t  child,
int  type,
int *  rid,
u_long  start,
u_long  end,
u_long  count,
u_int  flags 
)

Helper function for implementing BUS_ALLOC_RESOURCE()

Implement BUS_ALLOC_RESOURCE() by looking up a resource from the list and passing the allocation up to the parent of bus. This assumes that the first entry of device_get_ivars(child) is a struct resource_list. This also handles 'passthrough' allocations where a child is a remote descendant of bus by passing the allocation up to the parent of bus.

Typically, a bus driver would store a list of child resources somewhere in the child device's ivars (see device_get_ivars()) and its implementation of BUS_ALLOC_RESOURCE() would find that list and then call resource_list_alloc() to perform the allocation.

Parameters
rlthe resource list to allocate from
busthe parent device of child
childthe device which is requesting an allocation
typethe type of resource to allocate
rida pointer to the resource identifier
starthint at the start of the resource range - pass 0UL for any start address
endhint at the end of the resource range - pass ~0UL for any end address
counthint at the size of range required - pass 1 for any size
flagsany extra flags to control the resource allocation - see RF_XXX flags in <sys/rman.h> for details
Returns
the resource which was allocated or NULL if no resource could be allocated

Definition at line 3207 of file subr_bus.c.

References bus, bus_activate_resource(), count, device_get_nameunit(), device_get_parent(), device_printf(), resource_list_find(), rman_get_end(), rman_get_start(), start, and type.

Referenced by bus_generic_rl_alloc_resource(), and resource_list_reserve().

Here is the call graph for this function:

Here is the caller graph for this function:

int resource_list_busy ( struct resource_list *  rl,
int  type,
int  rid 
)

Determine if a resource entry is busy.

Returns true if a resource entry is busy meaning that it has an associated resource that is not an unallocated "reserved" resource.

Parameters
rlthe resource list to search
typethe resource entry type (e.g. SYS_RES_MEMORY)
ridthe resource identifier
Returns
Non-zero if the entry is busy, zero otherwise.

Definition at line 3032 of file subr_bus.c.

References resource_list_find(), and rman_get_flags().

Here is the call graph for this function:

void resource_list_delete ( struct resource_list *  rl,
int  type,
int  rid 
)

Delete a resource entry.

Parameters
rlthe resource list to edit
typethe resource entry type (e.g. SYS_RES_MEMORY)
ridthe resource identifier

Definition at line 3101 of file subr_bus.c.

References free(), panic(), and resource_list_find().

Referenced by bus_generic_rl_delete_resource().

Here is the call graph for this function:

Here is the caller graph for this function:

struct resource_list_entry* resource_list_find ( struct resource_list *  rl,
int  type,
int  rid 
)

Find a resource entry by type and rid.

Parameters
rlthe resource list to search
typethe resource entry type (e.g. SYS_RES_MEMORY)
ridthe resource identifier
Returns
the resource entry pointer or NULL if there is no such entry.

Definition at line 3082 of file subr_bus.c.

Referenced by bus_generic_rl_get_resource(), resource_list_add(), resource_list_add_next(), resource_list_alloc(), resource_list_busy(), resource_list_delete(), resource_list_release(), resource_list_reserve(), resource_list_reserved(), and resource_list_unreserve().

Here is the caller graph for this function:

void resource_list_free ( struct resource_list *  rl)

Reclaim memory used by a resource list.

This function frees the memory for all resource entries on the list (if any).

Parameters
rlthe resource list to free

Definition at line 2938 of file subr_bus.c.

References free(), and panic().

Here is the call graph for this function:

void resource_list_init ( struct resource_list *  rl)

Initialise a resource list.

Parameters
rlthe resource list to initialise

Definition at line 2924 of file subr_bus.c.

int resource_list_print_type ( struct resource_list *  rl,
const char *  name,
int  type,
const char *  format 
)

Print a description of resources in a resource list.

Print all resources of a specified type, for use in BUS_PRINT_CHILD(). The name is printed if at least one resource of the given type is available. The format is used to print resource start and end.

Parameters
rlthe resource list to print
namethe name of type, e.g. "memory"
typetype type of resource entry to print
formatprintf(9) format string to print resource start and end values
Returns
the number of characters printed

Definition at line 3376 of file subr_bus.c.

References printf().

Here is the call graph for this function:

void resource_list_purge ( struct resource_list *  rl)

Releases all the resources in a list.

Parameters
rlThe resource list to purge.
Returns
nothing

Definition at line 3411 of file subr_bus.c.

References bus_release_resource(), free(), and rman_get_device().

Here is the call graph for this function:

int resource_list_release ( struct resource_list *  rl,
device_t  bus,
device_t  child,
int  type,
int  rid,
struct resource *  res 
)

Helper function for implementing BUS_RELEASE_RESOURCE()

Implement BUS_RELEASE_RESOURCE() using a resource list. Normally used with resource_list_alloc().

Parameters
rlthe resource list which was allocated from
busthe parent device of child
childthe device which is requesting a release
typethe type of resource to release
ridthe resource identifier
resthe resource to release
Return values
0success
non-zeroa standard unix error code indicating what error condition prevented the operation

Definition at line 3280 of file subr_bus.c.

References bus, bus_deactivate_resource(), device_get_parent(), panic(), resource_list_find(), and rman_get_flags().

Referenced by bus_generic_rl_release_resource(), and resource_list_unreserve().

Here is the call graph for this function:

Here is the caller graph for this function:

struct resource* resource_list_reserve ( struct resource_list *  rl,
device_t  bus,
device_t  child,
int  type,
int *  rid,
u_long  start,
u_long  end,
u_long  count,
u_int  flags 
)

Allocate a reserved resource.

This can be used by busses to force the allocation of resources that are always active in the system even if they are not allocated by a driver (e.g. PCI BARs). This function is usually called when adding a new child to the bus. The resource is allocated from the parent bus when it is reserved. The resource list entry is marked with RLE_RESERVED to note that it is a reserved resource.

Subsequent attempts to allocate the resource with resource_list_alloc() will succeed the first time and will set RLE_ALLOCATED to note that it has been allocated. When a reserved resource that has been allocated is released with resource_list_release() the resource RLE_ALLOCATED is cleared, but the actual resource remains allocated. The resource can be released to the parent bus by calling resource_list_unreserve().

Parameters
rlthe resource list to allocate from
busthe parent device of child
childthe device for which the resource is being reserved
typethe type of resource to allocate
rida pointer to the resource identifier
starthint at the start of the resource range - pass 0UL for any start address
endhint at the end of the resource range - pass ~0UL for any end address
counthint at the size of range required - pass 1 for any size
flagsany extra flags to control the resource allocation - see RF_XXX flags in <sys/rman.h> for details
Returns
the resource which was allocated or NULL if no resource could be allocated

Definition at line 3150 of file subr_bus.c.

References bus, device_get_parent(), panic(), resource_list_alloc(), and resource_list_find().

Here is the call graph for this function:

int resource_list_reserved ( struct resource_list *  rl,
int  type,
int  rid 
)

Determine if a resource entry is reserved.

Returns true if a resource entry is reserved meaning that it has an associated "reserved" resource. The resource can either be allocated or unallocated.

Parameters
rlthe resource list to search
typethe resource entry type (e.g. SYS_RES_MEMORY)
ridthe resource identifier
Returns
Non-zero if the entry is reserved, zero otherwise.

Definition at line 3061 of file subr_bus.c.

References resource_list_find().

Here is the call graph for this function:

int resource_list_unreserve ( struct resource_list *  rl,
device_t  bus,
device_t  child,
int  type,
int  rid 
)

Fully release a reserved resource.

Fully releases a resouce reserved via resource_list_reserve().

Parameters
rlthe resource list which was allocated from
busthe parent device of child
childthe device whose reserved resource is being released
typethe type of resource to release
ridthe resource identifier
resthe resource to release
Return values
0success
non-zeroa standard unix error code indicating what error condition prevented the operation

Definition at line 3338 of file subr_bus.c.

References bus, device_get_parent(), panic(), resource_list_find(), and resource_list_release().

Here is the call graph for this function:

void root_bus_configure ( void  )

Automatically configure devices.

This function begins the autoconfiguration process by calling device_probe_and_attach() for each child of the root0 device.

Definition at line 4480 of file subr_bus.c.

References bus_set_pass(), and PDEBUG.

Here is the call graph for this function:

static int root_bus_module_handler ( module_t  mod,
int  what,
void *  arg 
)
static

Definition at line 4441 of file subr_bus.c.

References devclass_find_internal(), device_shutdown(), devinit(), kobj_class_compile(), kobj_init(), make_device(), and root_driver.

Here is the call graph for this function:

static int root_child_present ( device_t  dev,
device_t  child 
)
static

Definition at line 4410 of file subr_bus.c.

static int root_print_child ( device_t  dev,
device_t  child 
)
static

Definition at line 4382 of file subr_bus.c.

References bus_print_child_header(), and printf().

Here is the call graph for this function:

static int root_resume ( device_t  dev)
static

Definition at line 4371 of file subr_bus.c.

References bus_generic_resume(), and devctl_notify().

Here is the call graph for this function:

static int root_setup_intr ( device_t  dev,
device_t  child,
struct resource *  irq,
int  flags,
driver_filter_t *  filter,
driver_intr_t *  intr,
void *  arg,
void **  cookiep 
)
static

Definition at line 4393 of file subr_bus.c.

References panic().

Here is the call graph for this function:

static int sysctl_bus ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 4753 of file subr_bus.c.

static int sysctl_devctl_disable ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 740 of file subr_bus.c.

References dev_event_info::dei_data, DEVCTL_DEFAULT_QUEUE_LEN, dev_softc::devq, devsoftc, free(), dev_softc::mtx, dev_softc::queued, and sysctl_handle_int().

Here is the call graph for this function:

static int sysctl_devctl_queue ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 767 of file subr_bus.c.

References dev_event_info::dei_data, devctl_queue_length, dev_softc::devq, devsoftc, free(), dev_softc::mtx, dev_softc::queued, and sysctl_handle_int().

Here is the call graph for this function:

static int sysctl_devices ( SYSCTL_HANDLER_ARGS  )
static

Definition at line 4766 of file subr_bus.c.

References bus_child_location_str(), bus_child_pnpinfo_str(), bus_data_generation_check(), and name.

Here is the call graph for this function:

SYSCTL_NODE ( _hw  ,
OID_AUTO  ,
bus  ,
CTLFLAG_RW  ,
NULL  ,
NULL   
)
SYSCTL_NODE ( OID_AUTO  ,
dev  ,
CTLFLAG_RW  ,
NULL  ,
NULL   
)
SYSCTL_NODE ( _hw_bus  ,
OID_AUTO  ,
info  ,
CTLFLAG_RW  ,
sysctl_bus  ,
"bus-related data"   
)
SYSCTL_NODE ( _hw_bus  ,
OID_AUTO  ,
devices  ,
CTLFLAG_RD  ,
sysctl_devices  ,
"system device tree"   
)
SYSCTL_PROC ( _hw_bus  ,
OID_AUTO  ,
devctl_disable  ,
CTLTYPE_INT|  CTLFLAG_RW,
NULL  ,
,
sysctl_devctl_disable  ,
"I"  ,
"devctl disable -- deprecated"   
)
SYSCTL_PROC ( _hw_bus  ,
OID_AUTO  ,
devctl_queue  ,
CTLTYPE_INT|  CTLFLAG_RW,
NULL  ,
,
sysctl_devctl_queue  ,
"I"  ,
"devctl queue length"   
)
typedef TAILQ_HEAD ( devclass_list  ,
devclass   
)

Definition at line 79 of file subr_bus.c.

References name, and parent.

TAILQ_HEAD ( devq  ,
dev_event_info   
)
static TAILQ_HEAD ( device  )
static

Definition at line 793 of file subr_bus.c.

TUNABLE_INT ( "hw.bus.devctl_queue"  ,
devctl_queue_length 
)

Variable Documentation

int bus_current_pass = BUS_PASS_ROOT

Definition at line 807 of file subr_bus.c.

struct cdevsw dev_cdevsw
static
Initial value:
= {
.d_version = D_VERSION,
.d_flags = D_NEEDGIANT,
.d_open = devopen,
.d_close = devclose,
.d_read = devread,
.d_ioctl = devioctl,
.d_poll = devpoll,
.d_name = "devctl",
}
static d_read_t devread
Definition: subr_bus.c:370
static d_open_t devopen
Definition: subr_bus.c:368
static d_close_t devclose
Definition: subr_bus.c:369
static d_ioctl_t devioctl
Definition: subr_bus.c:371
static d_poll_t devpoll
Definition: subr_bus.c:372

Definition at line 374 of file subr_bus.c.

devclass_list_t devclasses = TAILQ_HEAD_INITIALIZER(devclasses)
static

Definition at line 893 of file subr_bus.c.

d_close_t devclose
static

Definition at line 369 of file subr_bus.c.

struct cdev* devctl_dev
static

Definition at line 405 of file subr_bus.c.

int devctl_queue_length = DEVCTL_DEFAULT_QUEUE_LEN
static

Definition at line 363 of file subr_bus.c.

Referenced by sysctl_devctl_queue().

d_ioctl_t devioctl
static

Definition at line 371 of file subr_bus.c.

d_open_t devopen
static

Definition at line 368 of file subr_bus.c.

d_poll_t devpoll
static

Definition at line 372 of file subr_bus.c.

d_read_t devread
static

Definition at line 370 of file subr_bus.c.

driver_list_t passes = TAILQ_HEAD_INITIALIZER(passes)
static

Definition at line 806 of file subr_bus.c.

device_t root_bus

Definition at line 4437 of file subr_bus.c.

Referenced by bus_set_pass().

moduledata_t root_bus_mod
static
Initial value:
= {
"rootbus",
NULL
}
static int root_bus_module_handler(module_t mod, int what, void *arg)
Definition: subr_bus.c:4441

Definition at line 4466 of file subr_bus.c.

devclass_t root_devclass

Definition at line 4438 of file subr_bus.c.

driver_t root_driver
static
Initial value:
= {
"root",
1,
}
static kobj_method_t root_methods[]
Definition: subr_bus.c:4415

Definition at line 4431 of file subr_bus.c.

Referenced by root_bus_module_handler().

kobj_method_t root_methods[]
static
Initial value:
= {
KOBJMETHOD(device_suspend, bus_generic_suspend),
KOBJMETHOD(device_resume, root_resume),
KOBJMETHOD(bus_print_child, root_print_child),
KOBJMETHOD(bus_read_ivar, bus_generic_read_ivar),
KOBJMETHOD(bus_write_ivar, bus_generic_write_ivar),
KOBJMETHOD_END
}
int bus_generic_write_ivar(device_t dev, device_t child, int index, uintptr_t value)
Stub function for implementing BUS_WRITE_IVAR().
Definition: subr_bus.c:3646
int bus_setup_intr(device_t dev, struct resource *r, int flags, driver_filter_t filter, driver_intr_t handler, void *arg, void **cookiep)
Wrapper function for BUS_SETUP_INTR().
Definition: subr_bus.c:4158
static int root_print_child(device_t dev, device_t child)
Definition: subr_bus.c:4382
static int root_setup_intr(device_t dev, device_t child, struct resource *irq, int flags, driver_filter_t *filter, driver_intr_t *intr, void *arg, void **cookiep)
Definition: subr_bus.c:4393
int bus_generic_suspend(device_t dev)
Helper function for implementing DEVICE_SUSPEND()
Definition: subr_bus.c:3535
int bus_child_present(device_t child)
Wrapper function for BUS_CHILD_PRESENT().
Definition: subr_bus.c:4309
static int root_resume(device_t dev)
Definition: subr_bus.c:4371
int bus_generic_read_ivar(device_t dev, device_t child, int index, uintptr_t *result)
Stub function for implementing BUS_READ_IVAR().
Definition: subr_bus.c:3634
int device_shutdown(device_t dev)
Notify a device of system shutdown.
Definition: subr_bus.c:2879
int bus_generic_shutdown(device_t dev)
Helper function for implementing DEVICE_SHUTDOWN()
Definition: subr_bus.c:3514
static int root_child_present(device_t dev, device_t child)
Definition: subr_bus.c:4410

Definition at line 4415 of file subr_bus.c.