The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/sys/bus.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*-
    2  * Copyright (c) 1997,1998,2003 Doug Rabson
    3  * All rights reserved.
    4  *
    5  * Redistribution and use in source and binary forms, with or without
    6  * modification, are permitted provided that the following conditions
    7  * are met:
    8  * 1. Redistributions of source code must retain the above copyright
    9  *    notice, this list of conditions and the following disclaimer.
   10  * 2. Redistributions in binary form must reproduce the above copyright
   11  *    notice, this list of conditions and the following disclaimer in the
   12  *    documentation and/or other materials provided with the distribution.
   13  *
   14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   24  * SUCH DAMAGE.
   25  *
   26  * $FreeBSD$
   27  */
   28 
   29 #ifndef _SYS_BUS_H_
   30 #define _SYS_BUS_H_
   31 
   32 /**
   33  * @defgroup NEWBUS newbus - a generic framework for managing devices
   34  * @{
   35  */
   36 
   37 /**
   38  * @brief Interface information structure.
   39  */
   40 struct u_businfo {
   41         int     ub_version;             /**< @brief interface version */
   42 #define BUS_USER_VERSION        1
   43         int     ub_generation;          /**< @brief generation count */
   44 };
   45 
   46 /**
   47  * @brief State of the device.
   48  */
   49 typedef enum device_state {
   50         DS_NOTPRESENT,                  /**< @brief not probed or probe failed */
   51         DS_ALIVE,                       /**< @brief probe succeeded */
   52         DS_ATTACHED,                    /**< @brief attach method called */
   53         DS_BUSY                         /**< @brief device is open */
   54 } device_state_t;
   55 
   56 /**
   57  * @brief Device information exported to userspace.
   58  */
   59 struct u_device {
   60         uintptr_t       dv_handle;
   61         uintptr_t       dv_parent;
   62 
   63         char            dv_name[32];            /**< @brief Name of device in tree. */
   64         char            dv_desc[32];            /**< @brief Driver description */
   65         char            dv_drivername[32];      /**< @brief Driver name */
   66         char            dv_pnpinfo[128];        /**< @brief Plug and play info */
   67         char            dv_location[128];       /**< @brief Where is the device? */
   68         uint32_t        dv_devflags;            /**< @brief API Flags for device */
   69         uint16_t        dv_flags;               /**< @brief flags for dev date */
   70         device_state_t  dv_state;               /**< @brief State of attachment */
   71         /* XXX more driver info? */
   72 };
   73 
   74 #ifdef _KERNEL
   75 
   76 #include <sys/queue.h>
   77 #include <sys/kobj.h>
   78 
   79 /**
   80  * devctl hooks.  Typically one should use the devctl_notify
   81  * hook to send the message.  However, devctl_queue_data is also
   82  * included in case devctl_notify isn't sufficiently general.
   83  */
   84 void devctl_notify(const char *__system, const char *__subsystem,
   85     const char *__type, const char *__data);
   86 void devctl_queue_data(char *__data);
   87 
   88 /*
   89  * Forward declarations
   90  */
   91 typedef struct device           *device_t;
   92 
   93 /**
   94  * @brief A device driver (included mainly for compatibility with
   95  * FreeBSD 4.x).
   96  */
   97 typedef struct kobj_class       driver_t;
   98 
   99 /**
  100  * @brief A device class
  101  *
  102  * The devclass object has two main functions in the system. The first
  103  * is to manage the allocation of unit numbers for device instances
  104  * and the second is to hold the list of device drivers for a
  105  * particular bus type. Each devclass has a name and there cannot be
  106  * two devclasses with the same name. This ensures that unique unit
  107  * numbers are allocated to device instances.
  108  *
  109  * Drivers that support several different bus attachments (e.g. isa,
  110  * pci, pccard) should all use the same devclass to ensure that unit
  111  * numbers do not conflict.
  112  *
  113  * Each devclass may also have a parent devclass. This is used when
  114  * searching for device drivers to allow a form of inheritance. When
  115  * matching drivers with devices, first the driver list of the parent
  116  * device's devclass is searched. If no driver is found in that list,
  117  * the search continues in the parent devclass (if any).
  118  */
  119 typedef struct devclass         *devclass_t;
  120 
  121 /**
  122  * @brief A device method (included mainly for compatibility with
  123  * FreeBSD 4.x).
  124  */
  125 #define device_method_t         kobj_method_t
  126 
  127 /**
  128  * @brief A driver interrupt service routine
  129  */
  130 typedef void driver_intr_t(void*);
  131 
  132 /**
  133  * @brief Interrupt type bits.
  134  * 
  135  * These flags are used both by newbus interrupt
  136  * registration (nexus.c) and also in struct intrec, which defines
  137  * interrupt properties.
  138  *
  139  * XXX We should probably revisit this and remove the vestiges of the
  140  * spls implicit in names like INTR_TYPE_TTY. In the meantime, don't
  141  * confuse things by renaming them (Grog, 18 July 2000).
  142  *
  143  * We define this in terms of bits because some devices may belong
  144  * to multiple classes (and therefore need to be included in
  145  * multiple interrupt masks, which is what this really serves to
  146  * indicate. Buses which do interrupt remapping will want to
  147  * change their type to reflect what sort of devices are underneath.
  148  */
  149 enum intr_type {
  150         INTR_TYPE_TTY = 1,
  151         INTR_TYPE_BIO = 2,
  152         INTR_TYPE_NET = 4,
  153         INTR_TYPE_CAM = 8,
  154         INTR_TYPE_MISC = 16,
  155         INTR_TYPE_CLK = 32,
  156         INTR_TYPE_AV = 64,
  157         INTR_FAST = 128,
  158         INTR_EXCL = 256,                /* exclusive interrupt */
  159         INTR_MPSAFE = 512,              /* this interrupt is SMP safe */
  160         INTR_ENTROPY = 1024             /* this interrupt provides entropy */
  161 };
  162 
  163 enum intr_trigger {
  164         INTR_TRIGGER_CONFORM = 0,
  165         INTR_TRIGGER_EDGE = 1,
  166         INTR_TRIGGER_LEVEL = 2
  167 };
  168 
  169 enum intr_polarity {
  170         INTR_POLARITY_CONFORM = 0,
  171         INTR_POLARITY_HIGH = 1,
  172         INTR_POLARITY_LOW = 2
  173 };
  174 
  175 typedef int (*devop_t)(void);
  176 
  177 /**
  178  * @brief This structure is deprecated.
  179  *
  180  * Use the kobj(9) macro DEFINE_CLASS to
  181  * declare classes which implement device drivers.
  182  */
  183 struct driver {
  184         KOBJ_CLASS_FIELDS;
  185 };
  186 
  187 /*
  188  * Definitions for drivers which need to keep simple lists of resources
  189  * for their child devices.
  190  */
  191 struct  resource;
  192 
  193 /**
  194  * @brief An entry for a single resource in a resource list.
  195  */
  196 struct resource_list_entry {
  197         SLIST_ENTRY(resource_list_entry) link;
  198         int     type;                   /**< @brief type argument to alloc_resource */
  199         int     rid;                    /**< @brief resource identifier */
  200         struct  resource *res;          /**< @brief the real resource when allocated */
  201         u_long  start;                  /**< @brief start of resource range */
  202         u_long  end;                    /**< @brief end of resource range */
  203         u_long  count;                  /**< @brief count within range */
  204 };
  205 SLIST_HEAD(resource_list, resource_list_entry);
  206 
  207 void    resource_list_init(struct resource_list *rl);
  208 void    resource_list_free(struct resource_list *rl);
  209 void    resource_list_add(struct resource_list *rl,
  210                           int type, int rid,
  211                           u_long start, u_long end, u_long count);
  212 int     resource_list_add_next(struct resource_list *rl,
  213                           int type,
  214                           u_long start, u_long end, u_long count);
  215 struct resource_list_entry*
  216         resource_list_find(struct resource_list *rl,
  217                            int type, int rid);
  218 void    resource_list_delete(struct resource_list *rl,
  219                              int type, int rid);
  220 struct resource *
  221         resource_list_alloc(struct resource_list *rl,
  222                             device_t bus, device_t child,
  223                             int type, int *rid,
  224                             u_long start, u_long end,
  225                             u_long count, u_int flags);
  226 int     resource_list_release(struct resource_list *rl,
  227                               device_t bus, device_t child,
  228                               int type, int rid, struct resource *res);
  229 int     resource_list_print_type(struct resource_list *rl,
  230                                  const char *name, int type,
  231                                  const char *format);
  232 
  233 /*
  234  * The root bus, to which all top-level busses are attached.
  235  */
  236 extern device_t root_bus;
  237 extern devclass_t root_devclass;
  238 void    root_bus_configure(void);
  239 
  240 /*
  241  * Useful functions for implementing busses.
  242  */
  243 
  244 int     bus_generic_activate_resource(device_t dev, device_t child, int type,
  245                                       int rid, struct resource *r);
  246 struct resource *
  247         bus_generic_alloc_resource(device_t bus, device_t child, int type,
  248                                    int *rid, u_long start, u_long end,
  249                                    u_long count, u_int flags);
  250 int     bus_generic_attach(device_t dev);
  251 int     bus_generic_child_present(device_t dev, device_t child);
  252 int     bus_generic_config_intr(device_t, int, enum intr_trigger,
  253                                 enum intr_polarity);
  254 int     bus_generic_deactivate_resource(device_t dev, device_t child, int type,
  255                                         int rid, struct resource *r);
  256 int     bus_generic_detach(device_t dev);
  257 void    bus_generic_driver_added(device_t dev, driver_t *driver);
  258 struct resource_list *
  259         bus_generic_get_resource_list (device_t, device_t);
  260 int     bus_print_child_header(device_t dev, device_t child);
  261 int     bus_print_child_footer(device_t dev, device_t child);
  262 int     bus_generic_print_child(device_t dev, device_t child);
  263 int     bus_generic_probe(device_t dev);
  264 int     bus_generic_read_ivar(device_t dev, device_t child, int which,
  265                               uintptr_t *result);
  266 int     bus_generic_release_resource(device_t bus, device_t child,
  267                                      int type, int rid, struct resource *r);
  268 int     bus_generic_resume(device_t dev);
  269 int     bus_generic_setup_intr(device_t dev, device_t child,
  270                                struct resource *irq, int flags,
  271                                driver_intr_t *intr, void *arg, void **cookiep);
  272 
  273 struct resource *
  274         bus_generic_rl_alloc_resource (device_t, device_t, int, int *,
  275                                        u_long, u_long, u_long, u_int);
  276 void    bus_generic_rl_delete_resource (device_t, device_t, int, int);
  277 int     bus_generic_rl_get_resource (device_t, device_t, int, int, u_long *,
  278                                      u_long *);
  279 int     bus_generic_rl_set_resource (device_t, device_t, int, int, u_long,
  280                                      u_long);
  281 int     bus_generic_rl_release_resource (device_t, device_t, int, int,
  282                                          struct resource *);
  283 
  284 int     bus_generic_shutdown(device_t dev);
  285 int     bus_generic_suspend(device_t dev);
  286 int     bus_generic_teardown_intr(device_t dev, device_t child,
  287                                   struct resource *irq, void *cookie);
  288 int     bus_generic_write_ivar(device_t dev, device_t child, int which,
  289                                uintptr_t value);
  290 
  291 /*
  292  * Wrapper functions for the BUS_*_RESOURCE methods to make client code
  293  * a little simpler.
  294  */
  295 struct  resource *bus_alloc_resource(device_t dev, int type, int *rid,
  296                                      u_long start, u_long end, u_long count,
  297                                      u_int flags);
  298 int     bus_activate_resource(device_t dev, int type, int rid,
  299                               struct resource *r);
  300 int     bus_deactivate_resource(device_t dev, int type, int rid,
  301                                 struct resource *r);
  302 int     bus_release_resource(device_t dev, int type, int rid,
  303                              struct resource *r);
  304 int     bus_setup_intr(device_t dev, struct resource *r, int flags,
  305                        driver_intr_t handler, void *arg, void **cookiep);
  306 int     bus_teardown_intr(device_t dev, struct resource *r, void *cookie);
  307 int     bus_set_resource(device_t dev, int type, int rid,
  308                          u_long start, u_long count);
  309 int     bus_get_resource(device_t dev, int type, int rid,
  310                          u_long *startp, u_long *countp);
  311 u_long  bus_get_resource_start(device_t dev, int type, int rid);
  312 u_long  bus_get_resource_count(device_t dev, int type, int rid);
  313 void    bus_delete_resource(device_t dev, int type, int rid);
  314 int     bus_child_present(device_t child);
  315 int     bus_child_pnpinfo_str(device_t child, char *buf, size_t buflen);
  316 int     bus_child_location_str(device_t child, char *buf, size_t buflen);
  317 
  318 static __inline struct resource *
  319 bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags)
  320 {
  321         return (bus_alloc_resource(dev, type, rid, 0ul, ~0ul, 1, flags));
  322 }
  323 
  324 /*
  325  * Access functions for device.
  326  */
  327 device_t        device_add_child(device_t dev, const char *name, int unit);
  328 device_t        device_add_child_ordered(device_t dev, int order,
  329                                          const char *name, int unit);
  330 void    device_busy(device_t dev);
  331 int     device_delete_child(device_t dev, device_t child);
  332 int     device_attach(device_t dev);
  333 int     device_detach(device_t dev);
  334 void    device_disable(device_t dev);
  335 void    device_enable(device_t dev);
  336 device_t        device_find_child(device_t dev, const char *classname,
  337                                   int unit);
  338 const char      *device_get_desc(device_t dev);
  339 devclass_t      device_get_devclass(device_t dev);
  340 driver_t        *device_get_driver(device_t dev);
  341 u_int32_t       device_get_flags(device_t dev);
  342 device_t        device_get_parent(device_t dev);
  343 int     device_get_children(device_t dev, device_t **listp, int *countp);
  344 void    *device_get_ivars(device_t dev);
  345 void    device_set_ivars(device_t dev, void *ivars);
  346 const   char *device_get_name(device_t dev);
  347 const   char *device_get_nameunit(device_t dev);
  348 void    *device_get_softc(device_t dev);
  349 device_state_t  device_get_state(device_t dev);
  350 int     device_get_unit(device_t dev);
  351 struct sysctl_ctx_list *device_get_sysctl_ctx(device_t dev);
  352 struct sysctl_oid *device_get_sysctl_tree(device_t dev);
  353 int     device_is_alive(device_t dev);  /* did probe succeed? */
  354 int     device_is_attached(device_t dev);       /* did attach succeed? */
  355 int     device_is_enabled(device_t dev);
  356 int     device_is_quiet(device_t dev);
  357 int     device_print_prettyname(device_t dev);
  358 int     device_printf(device_t dev, const char *, ...) __printflike(2, 3);
  359 int     device_probe_and_attach(device_t dev);
  360 void    device_quiet(device_t dev);
  361 void    device_set_desc(device_t dev, const char* desc);
  362 void    device_set_desc_copy(device_t dev, const char* desc);
  363 int     device_set_devclass(device_t dev, const char *classname);
  364 int     device_set_driver(device_t dev, driver_t *driver);
  365 void    device_set_flags(device_t dev, u_int32_t flags);
  366 void    device_set_softc(device_t dev, void *softc);
  367 int     device_set_unit(device_t dev, int unit);        /* XXX DONT USE XXX */
  368 int     device_shutdown(device_t dev);
  369 void    device_unbusy(device_t dev);
  370 void    device_verbose(device_t dev);
  371 
  372 /*
  373  * Access functions for devclass.
  374  */
  375 int     devclass_add_driver(devclass_t dc, kobj_class_t driver);
  376 int     devclass_delete_driver(devclass_t dc, kobj_class_t driver);
  377 devclass_t      devclass_create(const char *classname);
  378 devclass_t      devclass_find(const char *classname);
  379 kobj_class_t    devclass_find_driver(devclass_t dc, const char *classname);
  380 const char      *devclass_get_name(devclass_t dc);
  381 device_t        devclass_get_device(devclass_t dc, int unit);
  382 void    *devclass_get_softc(devclass_t dc, int unit);
  383 int     devclass_get_devices(devclass_t dc, device_t **listp, int *countp);
  384 int     devclass_get_drivers(devclass_t dc, driver_t ***listp, int *countp);
  385 int     devclass_get_count(devclass_t dc);
  386 int     devclass_get_maxunit(devclass_t dc);
  387 int     devclass_find_free_unit(devclass_t dc, int unit);
  388 void    devclass_set_parent(devclass_t dc, devclass_t pdc);
  389 devclass_t      devclass_get_parent(devclass_t dc);
  390 struct sysctl_ctx_list *devclass_get_sysctl_ctx(devclass_t dc);
  391 struct sysctl_oid *devclass_get_sysctl_tree(devclass_t dc);
  392 
  393 /*
  394  * Access functions for device resources.
  395  */
  396 
  397 int     resource_int_value(const char *name, int unit, const char *resname,
  398                            int *result);
  399 int     resource_long_value(const char *name, int unit, const char *resname,
  400                             long *result);
  401 int     resource_string_value(const char *name, int unit, const char *resname,
  402                               const char **result);
  403 int     resource_disabled(const char *name, int unit);
  404 int     resource_find_match(int *anchor, const char **name, int *unit,
  405                             const char *resname, const char *value);
  406 int     resource_find_dev(int *anchor, const char *name, int *unit,
  407                           const char *resname, const char *value);
  408 int     resource_set_int(const char *name, int unit, const char *resname,
  409                          int value);
  410 int     resource_set_long(const char *name, int unit, const char *resname,
  411                           long value);
  412 int     resource_set_string(const char *name, int unit, const char *resname,
  413                             const char *value);
  414 /*
  415  * Functions for maintaining and checking consistency of
  416  * bus information exported to userspace.
  417  */
  418 int     bus_data_generation_check(int generation);
  419 void    bus_data_generation_update(void);
  420 
  421 /**
  422  * Some convenience defines for probe routines to return.  These are just
  423  * suggested values, and there's nothing magical about them.
  424  * BUS_PROBE_SPECIFIC is for devices that cannot be reprobed, and that no
  425  * possible other driver may exist (typically legacy drivers who don't fallow
  426  * all the rules, or special needs drivers).  BUS_PROBE_VENDOR is the
  427  * suggested value that vendor supplied drivers use.  This is for source or
  428  * binary drivers that are not yet integrated into the FreeBSD tree.  Its use
  429  * in the base OS is prohibited.  BUS_PROBE_DEFAULT is the normal return value
  430  * for drivers to use.  It is intended that nearly all of the drivers in the
  431  * tree should return this value.  BUS_PROBE_LOW_PRIORITY are for drivers that
  432  * have special requirements like when there are two drivers that support
  433  * overlapping series of hardware devices.  In this case the one that supports
  434  * the older part of the line would return this value, while the one that
  435  * supports the newer ones would return BUS_PROBE_DEFAULT.  BUS_PROBE_GENERIC
  436  * is for drivers that wish to have a generic form and a specialized form,
  437  * like is done with the pci bus and the acpi pci bus.  BUS_PROBE_HOOVER is
  438  * for those busses that implement a generic device place-holder for devices on
  439  * the bus that have no more specific driver for them (aka ugen).
  440  */
  441 #define BUS_PROBE_SPECIFIC      0       /* Only I can use this device */
  442 #define BUS_PROBE_VENDOR        (-10)   /* Vendor supplied driver */
  443 #define BUS_PROBE_DEFAULT       (-20)   /* Base OS default driver */
  444 #define BUS_PROBE_LOW_PRIORITY  (-40)   /* Older, less desirable drivers */
  445 #define BUS_PROBE_GENERIC       (-100)  /* generic driver for dev */
  446 #define BUS_PROBE_HOOVER        (-500)  /* Generic dev for all devs on bus */
  447 
  448 /**
  449  * Shorthand for constructing method tables.
  450  */
  451 #define DEVMETHOD       KOBJMETHOD
  452 
  453 /*
  454  * Some common device interfaces.
  455  */
  456 #include "device_if.h"
  457 #include "bus_if.h"
  458 
  459 struct  module;
  460 
  461 int     driver_module_handler(struct module *, int, void *);
  462 
  463 /**
  464  * Module support for automatically adding drivers to busses.
  465  */
  466 struct driver_module_data {
  467         int             (*dmd_chainevh)(struct module *, int, void *);
  468         void            *dmd_chainarg;
  469         const char      *dmd_busname;
  470         kobj_class_t    dmd_driver;
  471         devclass_t      *dmd_devclass;
  472 };
  473 
  474 #define DRIVER_MODULE(name, busname, driver, devclass, evh, arg)        \
  475                                                                         \
  476 static struct driver_module_data name##_##busname##_driver_mod = {      \
  477         evh, arg,                                                       \
  478         #busname,                                                       \
  479         (kobj_class_t) &driver,                                         \
  480         &devclass                                                       \
  481 };                                                                      \
  482                                                                         \
  483 static moduledata_t name##_##busname##_mod = {                          \
  484         #busname "/" #name,                                             \
  485         driver_module_handler,                                          \
  486         &name##_##busname##_driver_mod                                  \
  487 };                                                                      \
  488 DECLARE_MODULE(name##_##busname, name##_##busname##_mod,                \
  489                SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
  490 
  491 /**
  492  * Generic ivar accessor generation macros for bus drivers
  493  */
  494 #define __BUS_ACCESSOR(varp, var, ivarp, ivar, type)                    \
  495                                                                         \
  496 static __inline type varp ## _get_ ## var(device_t dev)                 \
  497 {                                                                       \
  498         uintptr_t v;                                                    \
  499         BUS_READ_IVAR(device_get_parent(dev), dev,                      \
  500             ivarp ## _IVAR_ ## ivar, &v);                               \
  501         return ((type) v);                                              \
  502 }                                                                       \
  503                                                                         \
  504 static __inline void varp ## _set_ ## var(device_t dev, type t)         \
  505 {                                                                       \
  506         uintptr_t v = (uintptr_t) t;                                    \
  507         BUS_WRITE_IVAR(device_get_parent(dev), dev,                     \
  508             ivarp ## _IVAR_ ## ivar, v);                                \
  509 }
  510 
  511 #endif /* _KERNEL */
  512 
  513 #endif /* !_SYS_BUS_H_ */

Cache object: 76dc6cc1b139e755cb03a21d363cf010


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.