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/kern/bus_if.m

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #-
    2 # Copyright (c) 1998-2004 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: releng/11.2/sys/kern/bus_if.m 308333 2016-11-05 10:23:02Z mmel $
   27 #
   28 
   29 #include <sys/types.h>
   30 #include <sys/systm.h>
   31 #include <sys/bus.h>
   32 
   33 /**
   34  * @defgroup BUS bus - KObj methods for drivers of devices with children
   35  * @brief A set of methods required device drivers that support
   36  * child devices.
   37  * @{
   38  */
   39 INTERFACE bus;
   40 
   41 #
   42 # Default implementations of some methods.
   43 #
   44 CODE {
   45         static struct resource *
   46         null_alloc_resource(device_t dev, device_t child,
   47             int type, int *rid, rman_res_t start, rman_res_t end,
   48             rman_res_t count, u_int flags)
   49         {
   50             return (0);
   51         }
   52 
   53         static int
   54         null_remap_intr(device_t bus, device_t dev, u_int irq)
   55         {
   56 
   57                 if (dev != NULL)
   58                         return (BUS_REMAP_INTR(dev, NULL, irq));
   59                 return (ENXIO);
   60         }
   61 
   62         static device_t
   63         null_add_child(device_t bus, int order, const char *name,
   64             int unit)
   65         {
   66 
   67                 panic("bus_add_child is not implemented");
   68         }
   69 };
   70 
   71 /**
   72  * @brief Print a description of a child device
   73  *
   74  * This is called from system code which prints out a description of a
   75  * device. It should describe the attachment that the child has with
   76  * the parent. For instance the TurboLaser bus prints which node the
   77  * device is attached to. See bus_generic_print_child() for more 
   78  * information.
   79  *
   80  * @param _dev          the device whose child is being printed
   81  * @param _child        the child device to describe
   82  *
   83  * @returns             the number of characters output.
   84  */
   85 METHOD int print_child {
   86         device_t _dev;
   87         device_t _child;
   88 } DEFAULT bus_generic_print_child;
   89 
   90 /**
   91  * @brief Print a notification about an unprobed child device.
   92  *
   93  * Called for each child device that did not succeed in probing for a
   94  * driver.
   95  *
   96  * @param _dev          the device whose child was being probed
   97  * @param _child        the child device which failed to probe
   98  */   
   99 METHOD void probe_nomatch {
  100         device_t _dev;
  101         device_t _child;
  102 };
  103 
  104 /**
  105  * @brief Read the value of a bus-specific attribute of a device
  106  *
  107  * This method, along with BUS_WRITE_IVAR() manages a bus-specific set
  108  * of instance variables of a child device.  The intention is that
  109  * each different type of bus defines a set of appropriate instance
  110  * variables (such as ports and irqs for ISA bus etc.)
  111  *
  112  * This information could be given to the child device as a struct but
  113  * that makes it hard for a bus to add or remove variables without
  114  * forcing an edit and recompile for all drivers which may not be
  115  * possible for vendor supplied binary drivers.
  116  *
  117  * This method copies the value of an instance variable to the
  118  * location specified by @p *_result.
  119  * 
  120  * @param _dev          the device whose child was being examined
  121  * @param _child        the child device whose instance variable is
  122  *                      being read
  123  * @param _index        the instance variable to read
  124  * @param _result       a location to receive the instance variable
  125  *                      value
  126  * 
  127  * @retval 0            success
  128  * @retval ENOENT       no such instance variable is supported by @p
  129  *                      _dev 
  130  */
  131 METHOD int read_ivar {
  132         device_t _dev;
  133         device_t _child;
  134         int _index;
  135         uintptr_t *_result;
  136 };
  137 
  138 /**
  139  * @brief Write the value of a bus-specific attribute of a device
  140  * 
  141  * This method sets the value of an instance variable to @p _value.
  142  * 
  143  * @param _dev          the device whose child was being updated
  144  * @param _child        the child device whose instance variable is
  145  *                      being written
  146  * @param _index        the instance variable to write
  147  * @param _value        the value to write to that instance variable
  148  * 
  149  * @retval 0            success
  150  * @retval ENOENT       no such instance variable is supported by @p
  151  *                      _dev 
  152  * @retval EINVAL       the instance variable was recognised but
  153  *                      contains a read-only value
  154  */
  155 METHOD int write_ivar {
  156         device_t _dev;
  157         device_t _child;
  158         int _indx;
  159         uintptr_t _value;
  160 };
  161 
  162 /**
  163  * @brief Notify a bus that a child was deleted
  164  *
  165  * Called at the beginning of device_delete_child() to allow the parent
  166  * to teardown any bus-specific state for the child.
  167  * 
  168  * @param _dev          the device whose child is being deleted
  169  * @param _child        the child device which is being deleted
  170  */
  171 METHOD void child_deleted {
  172         device_t _dev;
  173         device_t _child;
  174 };
  175 
  176 /**
  177  * @brief Notify a bus that a child was detached
  178  *
  179  * Called after the child's DEVICE_DETACH() method to allow the parent
  180  * to reclaim any resources allocated on behalf of the child.
  181  * 
  182  * @param _dev          the device whose child changed state
  183  * @param _child        the child device which changed state
  184  */
  185 METHOD void child_detached {
  186         device_t _dev;
  187         device_t _child;
  188 };
  189 
  190 /**
  191  * @brief Notify a bus that a new driver was added
  192  * 
  193  * Called when a new driver is added to the devclass which owns this
  194  * bus. The generic implementation of this method attempts to probe and
  195  * attach any un-matched children of the bus.
  196  * 
  197  * @param _dev          the device whose devclass had a new driver
  198  *                      added to it
  199  * @param _driver       the new driver which was added
  200  */
  201 METHOD void driver_added {
  202         device_t _dev;
  203         driver_t *_driver;
  204 } DEFAULT bus_generic_driver_added;
  205 
  206 /**
  207  * @brief Create a new child device
  208  *
  209  * For busses which use use drivers supporting DEVICE_IDENTIFY() to
  210  * enumerate their devices, this method is used to create new
  211  * device instances. The new device will be added after the last
  212  * existing child with the same order. Implementations of bus_add_child
  213  * call device_add_child_ordered to add the child and often add
  214  * a suitable ivar to the device specific to that bus.
  215  * 
  216  * @param _dev          the bus device which will be the parent of the
  217  *                      new child device
  218  * @param _order        a value which is used to partially sort the
  219  *                      children of @p _dev - devices created using
  220  *                      lower values of @p _order appear first in @p
  221  *                      _dev's list of children
  222  * @param _name         devclass name for new device or @c NULL if not
  223  *                      specified
  224  * @param _unit         unit number for new device or @c -1 if not
  225  *                      specified
  226  */
  227 METHOD device_t add_child {
  228         device_t _dev;
  229         u_int _order;
  230         const char *_name;
  231         int _unit;
  232 } DEFAULT null_add_child;
  233 
  234 /**
  235  * @brief Rescan the bus
  236  *
  237  * This method is called by a parent bridge or devctl to trigger a bus
  238  * rescan.  The rescan should delete devices no longer present and
  239  * enumerate devices that have newly arrived.
  240  *
  241  * @param _dev          the bus device
  242  */
  243 METHOD int rescan {
  244         device_t _dev;
  245 }
  246 
  247 /**
  248  * @brief Allocate a system resource
  249  *
  250  * This method is called by child devices of a bus to allocate resources.
  251  * The types are defined in <machine/resource.h>; the meaning of the
  252  * resource-ID field varies from bus to bus (but @p *rid == 0 is always
  253  * valid if the resource type is). If a resource was allocated and the
  254  * caller did not use the RF_ACTIVE to specify that it should be
  255  * activated immediately, the caller is responsible for calling
  256  * BUS_ACTIVATE_RESOURCE() when it actually uses the resource.
  257  *
  258  * @param _dev          the parent device of @p _child
  259  * @param _child        the device which is requesting an allocation
  260  * @param _type         the type of resource to allocate
  261  * @param _rid          a pointer to the resource identifier
  262  * @param _start        hint at the start of the resource range - pass
  263  *                      @c 0 for any start address
  264  * @param _end          hint at the end of the resource range - pass
  265  *                      @c ~0 for any end address
  266  * @param _count        hint at the size of range required - pass @c 1
  267  *                      for any size
  268  * @param _flags        any extra flags to control the resource
  269  *                      allocation - see @c RF_XXX flags in
  270  *                      <sys/rman.h> for details
  271  * 
  272  * @returns             the resource which was allocated or @c NULL if no
  273  *                      resource could be allocated
  274  */
  275 METHOD struct resource * alloc_resource {
  276         device_t        _dev;
  277         device_t        _child;
  278         int             _type;
  279         int            *_rid;
  280         rman_res_t      _start;
  281         rman_res_t      _end;
  282         rman_res_t      _count;
  283         u_int           _flags;
  284 } DEFAULT null_alloc_resource;
  285 
  286 /**
  287  * @brief Activate a resource
  288  *
  289  * Activate a resource previously allocated with
  290  * BUS_ALLOC_RESOURCE().  This may enable decoding of this resource in a
  291  * device for instance.  It will also establish a mapping for the resource
  292  * unless RF_UNMAPPED was set when allocating the resource.
  293  *
  294  * @param _dev          the parent device of @p _child
  295  * @param _child        the device which allocated the resource
  296  * @param _type         the type of resource
  297  * @param _rid          the resource identifier
  298  * @param _r            the resource to activate
  299  */
  300 METHOD int activate_resource {
  301         device_t        _dev;
  302         device_t        _child;
  303         int             _type;
  304         int             _rid;
  305         struct resource *_r;
  306 };
  307 
  308 
  309 /**
  310  * @brief Map a resource
  311  *
  312  * Allocate a mapping for a range of an active resource.  The mapping
  313  * is described by a struct resource_map object.  This may for instance
  314  * map a memory region into the kernel's virtual address space.
  315  *
  316  * @param _dev          the parent device of @p _child
  317  * @param _child        the device which allocated the resource
  318  * @param _type         the type of resource
  319  * @param _r            the resource to map
  320  * @param _args         optional attributes of the mapping
  321  * @param _map          the mapping
  322  */
  323 METHOD int map_resource {
  324         device_t        _dev;
  325         device_t        _child;
  326         int             _type;
  327         struct resource *_r;
  328         struct resource_map_request *_args;
  329         struct resource_map *_map;
  330 } DEFAULT bus_generic_map_resource;
  331 
  332 
  333 /**
  334  * @brief Unmap a resource
  335  *
  336  * Release a mapping previously allocated with
  337  * BUS_MAP_RESOURCE(). This may for instance unmap a memory region
  338  * from the kernel's virtual address space.
  339  *
  340  * @param _dev          the parent device of @p _child
  341  * @param _child        the device which allocated the resource
  342  * @param _type         the type of resource
  343  * @param _r            the resource
  344  * @param _map          the mapping to release
  345  */
  346 METHOD int unmap_resource {
  347         device_t        _dev;
  348         device_t        _child;
  349         int             _type;
  350         struct resource *_r;
  351         struct resource_map *_map;
  352 } DEFAULT bus_generic_unmap_resource;
  353 
  354 
  355 /**
  356  * @brief Deactivate a resource
  357  *
  358  * Deactivate a resource previously allocated with
  359  * BUS_ALLOC_RESOURCE(). 
  360  *
  361  * @param _dev          the parent device of @p _child
  362  * @param _child        the device which allocated the resource
  363  * @param _type         the type of resource
  364  * @param _rid          the resource identifier
  365  * @param _r            the resource to deactivate
  366  */
  367 METHOD int deactivate_resource {
  368         device_t        _dev;
  369         device_t        _child;
  370         int             _type;
  371         int             _rid;
  372         struct resource *_r;
  373 };
  374 
  375 /**
  376  * @brief Adjust a resource
  377  *
  378  * Adjust the start and/or end of a resource allocated by
  379  * BUS_ALLOC_RESOURCE.  At least part of the new address range must overlap
  380  * with the existing address range.  If the successful, the resource's range
  381  * will be adjusted to [start, end] on return.
  382  *
  383  * @param _dev          the parent device of @p _child
  384  * @param _child        the device which allocated the resource
  385  * @param _type         the type of resource
  386  * @param _res          the resource to adjust
  387  * @param _start        the new starting address of the resource range
  388  * @param _end          the new ending address of the resource range
  389  */
  390 METHOD int adjust_resource {
  391         device_t        _dev;
  392         device_t        _child;
  393         int             _type;
  394         struct resource *_res;
  395         rman_res_t      _start;
  396         rman_res_t      _end;
  397 };
  398 
  399 /**
  400  * @brief Release a resource
  401  *
  402  * Free a resource allocated by the BUS_ALLOC_RESOURCE.  The @p _rid
  403  * value must be the same as the one returned by BUS_ALLOC_RESOURCE()
  404  * (which is not necessarily the same as the one the client passed).
  405  *
  406  * @param _dev          the parent device of @p _child
  407  * @param _child        the device which allocated the resource
  408  * @param _type         the type of resource
  409  * @param _rid          the resource identifier
  410  * @param _r            the resource to release
  411  */
  412 METHOD int release_resource {
  413         device_t        _dev;
  414         device_t        _child;
  415         int             _type;
  416         int             _rid;
  417         struct resource *_res;
  418 };
  419 
  420 /**
  421  * @brief Install an interrupt handler
  422  *
  423  * This method is used to associate an interrupt handler function with
  424  * an irq resource. When the interrupt triggers, the function @p _intr
  425  * will be called with the value of @p _arg as its single
  426  * argument. The value returned in @p *_cookiep is used to cancel the
  427  * interrupt handler - the caller should save this value to use in a
  428  * future call to BUS_TEARDOWN_INTR().
  429  * 
  430  * @param _dev          the parent device of @p _child
  431  * @param _child        the device which allocated the resource
  432  * @param _irq          the resource representing the interrupt
  433  * @param _flags        a set of bits from enum intr_type specifying
  434  *                      the class of interrupt
  435  * @param _intr         the function to call when the interrupt
  436  *                      triggers
  437  * @param _arg          a value to use as the single argument in calls
  438  *                      to @p _intr
  439  * @param _cookiep      a pointer to a location to receive a cookie
  440  *                      value that may be used to remove the interrupt
  441  *                      handler
  442  */
  443 METHOD int setup_intr {
  444         device_t        _dev;
  445         device_t        _child;
  446         struct resource *_irq;
  447         int             _flags;
  448         driver_filter_t *_filter;
  449         driver_intr_t   *_intr;
  450         void            *_arg;
  451         void            **_cookiep;
  452 };
  453 
  454 /**
  455  * @brief Uninstall an interrupt handler
  456  *
  457  * This method is used to disassociate an interrupt handler function
  458  * with an irq resource. The value of @p _cookie must be the value
  459  * returned from a previous call to BUS_SETUP_INTR().
  460  * 
  461  * @param _dev          the parent device of @p _child
  462  * @param _child        the device which allocated the resource
  463  * @param _irq          the resource representing the interrupt
  464  * @param _cookie       the cookie value returned when the interrupt
  465  *                      was originally registered
  466  */
  467 METHOD int teardown_intr {
  468         device_t        _dev;
  469         device_t        _child;
  470         struct resource *_irq;
  471         void            *_cookie;
  472 };
  473 
  474 /**
  475  * @brief Define a resource which can be allocated with
  476  * BUS_ALLOC_RESOURCE().
  477  *
  478  * This method is used by some busses (typically ISA) to allow a
  479  * driver to describe a resource range that it would like to
  480  * allocate. The resource defined by @p _type and @p _rid is defined
  481  * to start at @p _start and to include @p _count indices in its
  482  * range.
  483  * 
  484  * @param _dev          the parent device of @p _child
  485  * @param _child        the device which owns the resource
  486  * @param _type         the type of resource
  487  * @param _rid          the resource identifier
  488  * @param _start        the start of the resource range
  489  * @param _count        the size of the resource range
  490  */
  491 METHOD int set_resource {
  492         device_t        _dev;
  493         device_t        _child;
  494         int             _type;
  495         int             _rid;
  496         rman_res_t      _start;
  497         rman_res_t      _count;
  498 };
  499 
  500 /**
  501  * @brief Describe a resource
  502  *
  503  * This method allows a driver to examine the range used for a given
  504  * resource without actually allocating it.
  505  * 
  506  * @param _dev          the parent device of @p _child
  507  * @param _child        the device which owns the resource
  508  * @param _type         the type of resource
  509  * @param _rid          the resource identifier
  510  * @param _start        the address of a location to receive the start
  511  *                      index of the resource range
  512  * @param _count        the address of a location to receive the size
  513  *                      of the resource range
  514  */
  515 METHOD int get_resource {
  516         device_t        _dev;
  517         device_t        _child;
  518         int             _type;
  519         int             _rid;
  520         rman_res_t      *_startp;
  521         rman_res_t      *_countp;
  522 };
  523 
  524 /**
  525  * @brief Delete a resource.
  526  * 
  527  * Use this to delete a resource (possibly one previously added with
  528  * BUS_SET_RESOURCE()).
  529  * 
  530  * @param _dev          the parent device of @p _child
  531  * @param _child        the device which owns the resource
  532  * @param _type         the type of resource
  533  * @param _rid          the resource identifier
  534  */
  535 METHOD void delete_resource {
  536         device_t        _dev;
  537         device_t        _child;
  538         int             _type;
  539         int             _rid;
  540 };
  541 
  542 /**
  543  * @brief Return a struct resource_list.
  544  *
  545  * Used by drivers which use bus_generic_rl_alloc_resource() etc. to
  546  * implement their resource handling. It should return the resource
  547  * list of the given child device.
  548  * 
  549  * @param _dev          the parent device of @p _child
  550  * @param _child        the device which owns the resource list
  551  */
  552 METHOD struct resource_list * get_resource_list {
  553         device_t        _dev;
  554         device_t        _child;
  555 } DEFAULT bus_generic_get_resource_list;
  556 
  557 /**
  558  * @brief Is the hardware described by @p _child still attached to the
  559  * system?
  560  *
  561  * This method should return 0 if the device is not present.  It
  562  * should return -1 if it is present.  Any errors in determining
  563  * should be returned as a normal errno value.  Client drivers are to
  564  * assume that the device is present, even if there is an error
  565  * determining if it is there.  Busses are to try to avoid returning
  566  * errors, but newcard will return an error if the device fails to
  567  * implement this method.
  568  * 
  569  * @param _dev          the parent device of @p _child
  570  * @param _child        the device which is being examined
  571  */
  572 METHOD int child_present {
  573         device_t        _dev;
  574         device_t        _child;
  575 } DEFAULT bus_generic_child_present;
  576 
  577 /**
  578  * @brief Returns the pnp info for this device.
  579  *
  580  * Return it as a string.  If the storage is insufficient for the
  581  * string, then return EOVERFLOW.
  582  *
  583  * The string must be formatted as a space-separated list of
  584  * name=value pairs.  Names may only contain alphanumeric characters,
  585  * underscores ('_') and hyphens ('-').  Values can contain any
  586  * non-whitespace characters.  Values containing whitespace can be
  587  * quoted with double quotes ('"').  Double quotes and backslashes in
  588  * quoted values can be escaped with backslashes ('\').
  589  * 
  590  * @param _dev          the parent device of @p _child
  591  * @param _child        the device which is being examined
  592  * @param _buf          the address of a buffer to receive the pnp
  593  *                      string
  594  * @param _buflen       the size of the buffer pointed to by @p _buf
  595  */
  596 METHOD int child_pnpinfo_str {
  597         device_t        _dev;
  598         device_t        _child;
  599         char            *_buf;
  600         size_t          _buflen;
  601 };
  602 
  603 /**
  604  * @brief Returns the location for this device.
  605  *
  606  * Return it as a string.  If the storage is insufficient for the
  607  * string, then return EOVERFLOW.
  608  *
  609  * The string must be formatted as a space-separated list of
  610  * name=value pairs.  Names may only contain alphanumeric characters,
  611  * underscores ('_') and hyphens ('-').  Values can contain any
  612  * non-whitespace characters.  Values containing whitespace can be
  613  * quoted with double quotes ('"').  Double quotes and backslashes in
  614  * quoted values can be escaped with backslashes ('\').
  615  *
  616  * @param _dev          the parent device of @p _child
  617  * @param _child        the device which is being examined
  618  * @param _buf          the address of a buffer to receive the location
  619  *                      string
  620  * @param _buflen       the size of the buffer pointed to by @p _buf
  621  */
  622 METHOD int child_location_str {
  623         device_t        _dev;
  624         device_t        _child;
  625         char            *_buf;
  626         size_t          _buflen;
  627 };
  628 
  629 /**
  630  * @brief Allow drivers to request that an interrupt be bound to a specific
  631  * CPU.
  632  * 
  633  * @param _dev          the parent device of @p _child
  634  * @param _child        the device which allocated the resource
  635  * @param _irq          the resource representing the interrupt
  636  * @param _cpu          the CPU to bind the interrupt to
  637  */
  638 METHOD int bind_intr {
  639         device_t        _dev;
  640         device_t        _child;
  641         struct resource *_irq;
  642         int             _cpu;
  643 } DEFAULT bus_generic_bind_intr;
  644 
  645 /**
  646  * @brief Allow (bus) drivers to specify the trigger mode and polarity
  647  * of the specified interrupt.
  648  * 
  649  * @param _dev          the bus device
  650  * @param _irq          the interrupt number to modify
  651  * @param _trig         the trigger mode required
  652  * @param _pol          the interrupt polarity required
  653  */
  654 METHOD int config_intr {
  655         device_t        _dev;
  656         int             _irq;
  657         enum intr_trigger _trig;
  658         enum intr_polarity _pol;
  659 } DEFAULT bus_generic_config_intr;
  660 
  661 /**
  662  * @brief Allow drivers to associate a description with an active
  663  * interrupt handler.
  664  *
  665  * @param _dev          the parent device of @p _child
  666  * @param _child        the device which allocated the resource
  667  * @param _irq          the resource representing the interrupt
  668  * @param _cookie       the cookie value returned when the interrupt
  669  *                      was originally registered
  670  * @param _descr        the description to associate with the interrupt
  671  */
  672 METHOD int describe_intr {
  673         device_t        _dev;
  674         device_t        _child;
  675         struct resource *_irq;
  676         void            *_cookie;
  677         const char      *_descr;
  678 } DEFAULT bus_generic_describe_intr;
  679 
  680 /**
  681  * @brief Notify a (bus) driver about a child that the hints mechanism
  682  * believes it has discovered.
  683  *
  684  * The bus is responsible for then adding the child in the right order
  685  * and discovering other things about the child.  The bus driver is
  686  * free to ignore this hint, to do special things, etc.  It is all up
  687  * to the bus driver to interpret.
  688  *
  689  * This method is only called in response to the parent bus asking for
  690  * hinted devices to be enumerated.
  691  *
  692  * @param _dev          the bus device
  693  * @param _dname        the name of the device w/o unit numbers
  694  * @param _dunit        the unit number of the device
  695  */
  696 METHOD void hinted_child {
  697         device_t        _dev;
  698         const char      *_dname;
  699         int             _dunit;
  700 };
  701 
  702 /**
  703  * @brief Returns bus_dma_tag_t for use w/ devices on the bus.
  704  *
  705  * @param _dev          the parent device of @p _child
  706  * @param _child        the device to which the tag will belong
  707  */
  708 METHOD bus_dma_tag_t get_dma_tag {
  709         device_t        _dev;
  710         device_t        _child;
  711 } DEFAULT bus_generic_get_dma_tag;
  712 
  713 /**
  714  * @brief Returns bus_space_tag_t for use w/ devices on the bus.
  715  *
  716  * @param _dev          the parent device of @p _child
  717  * @param _child        the device to which the tag will belong
  718  */
  719 METHOD bus_space_tag_t get_bus_tag {
  720         device_t        _dev;
  721         device_t        _child;
  722 } DEFAULT bus_generic_get_bus_tag;
  723 
  724 /**
  725  * @brief Allow the bus to determine the unit number of a device.
  726  *
  727  * @param _dev          the parent device of @p _child
  728  * @param _child        the device whose unit is to be wired
  729  * @param _name         the name of the device's new devclass
  730  * @param _unitp        a pointer to the device's new unit value
  731  */
  732 METHOD void hint_device_unit {
  733         device_t        _dev;
  734         device_t        _child;
  735         const char      *_name;
  736         int             *_unitp;
  737 };
  738 
  739 /**
  740  * @brief Notify a bus that the bus pass level has been changed
  741  *
  742  * @param _dev          the bus device
  743  */
  744 METHOD void new_pass {
  745         device_t        _dev;
  746 } DEFAULT bus_generic_new_pass;
  747 
  748 /**
  749  * @brief Notify a bus that specified child's IRQ should be remapped.
  750  *
  751  * @param _dev          the bus device
  752  * @param _child        the child device
  753  * @param _irq          the irq number
  754  */
  755 METHOD int remap_intr {
  756         device_t        _dev;
  757         device_t        _child;
  758         u_int           _irq;
  759 } DEFAULT null_remap_intr;
  760 
  761 /**
  762  * @brief Suspend a given child
  763  *
  764  * @param _dev          the parent device of @p _child
  765  * @param _child        the device to suspend
  766  */
  767 METHOD int suspend_child {
  768         device_t        _dev;
  769         device_t        _child;
  770 } DEFAULT bus_generic_suspend_child;
  771 
  772 /**
  773  * @brief Resume a given child
  774  *
  775  * @param _dev          the parent device of @p _child
  776  * @param _child        the device to resume
  777  */
  778 METHOD int resume_child {
  779         device_t        _dev;
  780         device_t        _child;
  781 } DEFAULT bus_generic_resume_child;
  782 
  783 /**
  784  * @brief Get the VM domain handle for the given bus and child.
  785  *
  786  * @param _dev          the bus device
  787  * @param _child        the child device
  788  * @param _domain       a pointer to the bus's domain handle identifier
  789  */
  790 METHOD int get_domain {
  791         device_t        _dev;
  792         device_t        _child;
  793         int             *_domain;
  794 } DEFAULT bus_generic_get_domain;
  795 
  796 /**
  797  * @brief Request a set of CPUs
  798  *
  799  * @param _dev          the bus device
  800  * @param _child        the child device
  801  * @param _op           type of CPUs to request
  802  * @param _setsize      the size of the set passed in _cpuset
  803  * @param _cpuset       a pointer to a cpuset to receive the requested
  804  *                      set of CPUs
  805  */
  806 METHOD int get_cpus {
  807         device_t        _dev;
  808         device_t        _child;
  809         enum cpu_sets   _op;
  810         size_t          _setsize;
  811         cpuset_t        *_cpuset;
  812 } DEFAULT bus_generic_get_cpus;

Cache object: a72e45d073653e50eb4361785424358d


[ 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.