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/device.h

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) 1992, 1993
    3  *      The Regents of the University of California.  All rights reserved.
    4  *
    5  * This software was developed by the Computer Systems Engineering group
    6  * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
    7  * contributed to Berkeley.
    8  *
    9  * All advertising materials mentioning features or use of this software
   10  * must display the following acknowledgement:
   11  *      This product includes software developed by the University of
   12  *      California, Lawrence Berkeley Laboratory.
   13  *
   14  * Redistribution and use in source and binary forms, with or without
   15  * modification, are permitted provided that the following conditions
   16  * are met:
   17  * 1. Redistributions of source code must retain the above copyright
   18  *    notice, this list of conditions and the following disclaimer.
   19  * 2. Redistributions in binary form must reproduce the above copyright
   20  *    notice, this list of conditions and the following disclaimer in the
   21  *    documentation and/or other materials provided with the distribution.
   22  * 3. All advertising materials mentioning features or use of this software
   23  *    must display the following acknowledgement:
   24  *      This product includes software developed by the University of
   25  *      California, Berkeley and its contributors.
   26  * 4. Neither the name of the University nor the names of its contributors
   27  *    may be used to endorse or promote products derived from this software
   28  *    without specific prior written permission.
   29  *
   30  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
   31  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   32  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   33  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
   34  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   35  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   36  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   37  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   38  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   39  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   40  * SUCH DAMAGE.
   41  *
   42  *      @(#)device.h    8.2 (Berkeley) 2/17/94
   43  * $FreeBSD$
   44  */
   45 
   46 #ifndef _SYS_DEVICE_H_
   47 #define _SYS_DEVICE_H_
   48 
   49 #include <sys/queue.h>
   50 
   51 /*
   52  * Minimal device structures.
   53  * Note that all ``system'' device types are listed here.
   54  */
   55 enum devclass {
   56         DV_DULL,                /* generic, no special info */
   57         DV_CPU,                 /* CPU (carries resource utilization) */
   58         DV_DISK,                /* disk drive (label, etc) */
   59         DV_IFNET,               /* network interface */
   60         DV_TAPE,                /* tape device */
   61         DV_TTY                  /* serial line interface (?) */
   62 };
   63 
   64 struct device {
   65         enum    devclass dv_class;      /* this device's classification */
   66         struct  device *dv_next;        /* next in list of all */
   67         struct  cfdata *dv_cfdata;      /* config data that found us */
   68         int     dv_unit;                /* device unit number */
   69         char    dv_xname[16];           /* external name (name + unit) */
   70         struct  device *dv_parent;      /* pointer to parent device */
   71 };
   72 
   73 /* `event' counters (use zero or more per device instance, as needed) */
   74 struct evcnt {
   75         struct  evcnt *ev_next;         /* linked list */
   76         struct  device *ev_dev;         /* associated device */
   77         int     ev_count;               /* how many have occurred */
   78         char    ev_name[8];             /* what to call them (systat display) */
   79 };
   80 
   81 /*
   82  * Configuration data (i.e., data placed in ioconf.c).
   83  */
   84 struct cfdata {
   85         struct  cfdriver *cf_driver;    /* config driver */
   86         short   cf_unit;                /* unit number */
   87         short   cf_fstate;              /* finding state (below) */
   88         int     *cf_loc;                /* locators (machine dependent) */
   89         int     cf_flags;               /* flags from config */
   90         short   *cf_parents;            /* potential parents */
   91         void    (**cf_ivstubs) __P((void));
   92                                         /* config-generated vectors, if any */
   93 };
   94 #define FSTATE_NOTFOUND 0       /* has not been found */
   95 #define FSTATE_FOUND    1       /* has been found */
   96 #define FSTATE_STAR     2       /* duplicable */
   97 
   98 typedef int (*cfmatch_t) __P((struct device *, struct cfdata *, void *));
   99 
  100 /*
  101  * `configuration' driver (what the machine-independent autoconf uses).
  102  * As devices are found, they are applied against all the potential matches.
  103  * The one with the best match is taken, and a device structure (plus any
  104  * other data desired) is allocated.  Pointers to these are placed into
  105  * an array of pointers.  The array itself must be dynamic since devices
  106  * can be found long after the machine is up and running.
  107  */
  108 struct cfdriver {
  109         void    **cd_devs;              /* devices found */
  110         char    *cd_name;               /* device name */
  111         cfmatch_t cd_match;             /* returns a match level */
  112         void    (*cd_attach) __P((struct device *, struct device *, void *));
  113         enum    devclass cd_class;      /* device classification */
  114         size_t  cd_devsize;             /* size of dev data (for malloc) */
  115         void    *cd_aux;                /* additional driver, if any */
  116         int     cd_ndevs;               /* size of cd_devs array */
  117 };
  118 
  119 struct intr_config_hook {
  120         TAILQ_ENTRY(intr_config_hook) ich_links;
  121         void    (*ich_func) __P((void *arg));
  122         void    *ich_arg;
  123 };
  124 
  125 /*
  126  * Configuration printing functions, and their return codes.  The second
  127  * argument is NULL if the device was configured; otherwise it is the name
  128  * of the parent device.  The return value is ignored if the device was
  129  * configured, so most functions can return UNCONF unconditionally.
  130  */
  131 typedef int (*cfprint_t) __P((void *, char *));
  132 #define QUIET   0               /* print nothing */
  133 #define UNCONF  1               /* print " not configured\n" */
  134 #define UNSUPP  2               /* print " not supported\n" */
  135 
  136 /*
  137  * Pseudo-device attach information (function + number of pseudo-devs).
  138  */
  139 struct pdevinit {
  140         void    (*pdev_attach) __P((int));
  141         int     pdev_count;
  142 };
  143 
  144 extern struct   device *alldevs;        /* head of list of all devices */
  145 extern struct   evcnt *allevents;       /* head of list of all events */
  146 
  147 struct cfdata *config_search __P((cfmatch_t, struct device *, void *));
  148 struct cfdata *config_rootsearch __P((cfmatch_t, char *, void *));
  149 int config_found __P((struct device *, void *, cfprint_t));
  150 int config_rootfound __P((char *, void *));
  151 void config_attach __P((struct device *, struct cfdata *, void *, cfprint_t));
  152 void evcnt_attach __P((struct device *, const char *, struct evcnt *));
  153 int     config_intrhook_establish __P((struct intr_config_hook *hook));
  154 void    config_intrhook_disestablish __P((struct intr_config_hook *hook));
  155 
  156 #endif /* !_SYS_DEVICE_H_ */

Cache object: 67fbc283a187d121832f8083d7467210


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