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_private.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) 1997, 1998 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: src/sys/sys/bus_private.h,v 1.11.2.2 2000/08/03 00:25:22 peter Exp $
   27  * $DragonFly: src/sys/sys/bus_private.h,v 1.10 2008/09/30 12:20:29 hasso Exp $
   28  */
   29 
   30 #ifndef _SYS_BUS_PRIVATE_H_
   31 #define _SYS_BUS_PRIVATE_H_
   32 
   33 #if !defined(_KERNEL) && !defined(_KERNEL_STRUCTURES)
   34 
   35 #error "This file should not be included by userland programs."
   36 
   37 #else
   38 
   39 #ifndef _SYS_BUS_H_
   40 #include <sys/bus.h>
   41 #endif
   42 
   43 /*
   44  * Used to attach drivers to devclasses.
   45  */
   46 typedef struct driverlink *driverlink_t;
   47 struct driverlink {
   48         kobj_class_t            driver;
   49         TAILQ_ENTRY(driverlink) link;   /* list of drivers in devclass */
   50 };
   51 
   52 /*
   53  * Forward declarations
   54  */
   55 typedef TAILQ_HEAD(devclass_list, devclass) devclass_list_t;
   56 typedef TAILQ_HEAD(driver_list, driverlink) driver_list_t;
   57 typedef TAILQ_HEAD(device_list, device) device_list_t;
   58 
   59 struct devclass {
   60         TAILQ_ENTRY(devclass) link;
   61         devclass_t      parent;         /* parent in devclass hierarchy */
   62         driver_list_t   drivers;        /* bus devclasses store drivers for bus */
   63         char            *name;
   64         device_t        *devices;       /* array of devices indexed by unit */
   65         int             maxunit;        /* size of devices array */
   66 };
   67 
   68 /*
   69  * Resources from config(8).
   70  */
   71 typedef enum {
   72         RES_INT, RES_STRING, RES_LONG
   73 } resource_type;
   74 
   75 struct config_resource {
   76         char            *name;
   77         resource_type   type;
   78         union {
   79                 long    longval;
   80                 int     intval;
   81                 char*   stringval;
   82         } u;
   83 };
   84 
   85 struct config_device {
   86         char                    *name;          /* e.g. "lpt", "wdc" etc */
   87         int                     unit;
   88         int                     resource_count;
   89         struct config_resource  *resources;
   90 };
   91 
   92 /*
   93  * Implementation of device.
   94  */
   95 struct device {
   96         /*
   97          * A device is a kernel object. The first field must be the
   98          * current ops table for the object.
   99          */
  100         KOBJ_FIELDS;
  101 
  102         /*
  103          * Device hierarchy.
  104          */
  105         TAILQ_ENTRY(device)     link;           /* list of devices in parent */
  106         TAILQ_ENTRY(device)     devlink;        /* global device list membership */
  107         device_t                parent;
  108         device_list_t           children;       /* list of subordinate devices */
  109 
  110         /*
  111          * Details of this device.
  112          */
  113         driver_t        *driver;
  114         devclass_t      devclass;       /* device class which we are in */
  115         int             unit;
  116         char*           nameunit;       /* name+unit e.g. foodev0 */
  117         char*           desc;           /* driver specific description */
  118         int             busy;           /* count of calls to device_busy() */
  119         device_state_t  state;
  120         uint32_t        devflags;       /* api level flags for device_get_flags() */
  121         u_short         flags;
  122 #define DF_ENABLED      0x0001          /* device should be probed/attached */
  123 #define DF_FIXEDCLASS   0x0002          /* devclass specified at create time */
  124 #define DF_WILDCARD     0x0004          /* unit was originally wildcard */
  125 #define DF_DESCMALLOCED 0x0008          /* description was malloced */
  126 #define DF_QUIET        0x0010          /* don't print verbose attach message */
  127 #define DF_DONENOMATCH  0x0020          /* don't execute DEVICE_NOMATCH again */
  128 #define DF_EXTERNALSOFTC 0x0040         /* softc not allocated by us */
  129 #define DF_ASYNCPROBE   0x0080          /* can be probed with its own thread */
  130         u_char          order;          /* order from device_add_child_ordered() */
  131         u_char          pad;
  132         void            *ivars;
  133         void            *softc;
  134 };
  135 
  136 struct device_op_desc {
  137         unsigned int    offset;         /* offset in driver ops */
  138         struct method*  method;         /* internal method implementation */
  139         devop_t         deflt;          /* default implementation */
  140         const char*     name;           /* unique name (for registration) */
  141 };
  142 
  143 #endif  /* _KERNEL || _KERNEL_STRUCTURES */
  144 #endif  /* !_SYS_BUS_PRIVATE_H_ */

Cache object: 71869cd4352c4e4af4d26c2f107d903e


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