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

Cache object: 8438ea5c76c31438ad7d216c96f312e0


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