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/i386ps2/conf.c

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  * Mach Operating System
    3  * Copyright (c) 1993-1989 Carnegie Mellon University
    4  * Copyright (c) 1991 IBM Corporation 
    5  * All Rights Reserved.
    6  * 
    7  * Permission to use, copy, modify and distribute this software and its
    8  * documentation is hereby granted, provided that both the copyright
    9  * notice and this permission notice appear in all copies of the
   10  * software, derivative works or modified versions, and any portions
   11  * thereof, and that both notices appear in supporting documentation,
   12  * and that the name IBM not be used in advertising or publicity 
   13  * pertaining to distribution of the software without specific, written
   14  * prior permission.
   15  * 
   16  * CARNEGIE MELLON AND IBM ALLOW FREE USE OF THIS SOFTWARE IN ITS "AS IS"
   17  * CONDITION.  CARNEGIE MELLON AND IBM DISCLAIM ANY LIABILITY OF ANY KIND FOR
   18  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
   19  * 
   20  * Carnegie Mellon requests users of this software to return to
   21  * 
   22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
   23  *  School of Computer Science
   24  *  Carnegie Mellon University
   25  *  Pittsburgh PA 15213-3890
   26  * 
   27  * any improvements or extensions that they make and grant Carnegie Mellon
   28  * the rights to redistribute these changes.
   29  */
   30 
   31 /*
   32  * COMPONENT_NAME: (CONSOLE) Console driver
   33  *
   34  * FUNCTIONS: 
   35  *
   36  * ORIGINS: 6, 27
   37  */
   38 
   39 /* 
   40  * HISTORY
   41  * $Log:        conf.c,v $
   42  * Revision 2.5  93/11/17  16:52:31  dbg
   43  *      Added MC and PIT clock devices.
   44  *      [93/09/08            dbg]
   45  * 
   46  * Revision 2.4  93/05/18  11:20:08  rvb
   47  *      Lint: <>map is now a vm_offset_t
   48  * 
   49  * Revision 2.3  93/02/05  08:20:24  danner
   50  *      Fix includes.
   51  * 
   52  * 
   53  * Revision 2.2  93/02/04  07:59:07  danner
   54  *      Integrate PS2 code from IBM.
   55  *      [93/01/18            prithvi]
   56  * 
   57  * Revision 2.5  91/01/08  17:32:42  rpd
   58  *      Support for get/set status on hd and fd.
   59  *      Also fd has 64 minor devices per unit.
   60  *      Switch wd8003 -> ns8390
   61  *      [91/01/04  12:17:15  rvb]
   62  * 
   63  * Revision 2.4  90/10/01  14:23:02  jeffreyh
   64  *      added wd8003 ethernet driver
   65  *      [90/09/27  18:23:53  jeffreyh]
   66  * 
   67  * Revision 2.3  90/05/21  13:26:53  dbg
   68  *      Add mouse, keyboard, IOPL devices.
   69  *      [90/05/17            dbg]
   70  * 
   71  * Revision 2.2  90/05/03  15:41:34  dbg
   72  *      Add 3c501 under name 'et'.
   73  *      [90/04/27            dbg]
   74  * 
   75  *      Created.
   76  *      [90/02/20            dbg]
   77  * 
   78  */
   79 
   80 /*
   81  * Device switch for i386 AT bus.
   82  */
   83 
   84 #include <mach/machine/vm_types.h>
   85 #include <device/conf.h>
   86 
   87 extern vm_offset_t block_io_mmap();
   88 
   89 extern int      timeopen(), timeclose();
   90 extern vm_offset_t timemmap();
   91 #define timename                "time"
   92 
   93 #include <hd.h>
   94 #if     NHD > 0
   95 extern int      hdopen(), hdclose(), hdread(), hdwrite();
   96 extern int      hdgetstat(), hdsetstat();
   97 #define hdname                  "hd"
   98 #endif  /* NHD > 0 */
   99 
  100 #include <fd.h>
  101 #if     NFD > 0
  102 extern int      fdopen(), fdclose(), fdread(), fdwrite();
  103 extern int      fdgetstat(), fdsetstat();
  104 #define fdname                  "fd"
  105 #endif  /* NFD > 0 */
  106 
  107 #include <wt.h>
  108 #if     NWT > 0
  109 extern int      wtopen(), wtread(), wtwrite(), wtclose();
  110 #define wtname                  "wt"
  111 #endif  /* NWT > 0 */
  112 
  113 #include <pc586.h>
  114 #if     NPC586 > 0
  115 extern int      pc586open(), pc586output(), pc586getstat(), pc586setstat(),
  116                 pc586setinput();
  117 #define pc586name               "pc"
  118 #endif  /* NPC586 > 0 */
  119 
  120 #include <ns8390.h>
  121 #if     NNS8390 > 0
  122 extern int      ns8390open(), ns8390output(), ns8390getstat(), ns8390setstat(),
  123                 ns8390setinput();
  124 #define ns8390wdname            "wd"
  125 #define ns8390elname            "el"
  126 #endif  /* NNS8390 > 0 */
  127 
  128 #include <at3c501.h>
  129 #if     NAT3C501 > 0
  130 extern int      at3c501open(), at3c501output(),
  131                 at3c501getstat(), at3c501setstat(),
  132                 at3c501setinput();
  133 #define at3c501name             "et"
  134 #endif  /* NAT3C501 > 0 */
  135 
  136 #include <un.h>
  137 #if     NUN > 0
  138 extern int      unopen(), unoutput(), ungetstat(), unsetstat(),
  139                 unsetinput();
  140 #define unname          "un"
  141 #endif  /* NUN > 0 */
  142 
  143 #include <tr.h>
  144 #if     NTR > 0
  145 extern int      tropen(), troutput(), trgetstat(), trsetstat(),
  146                 trsetinput();
  147 #define trname          "tr"
  148 #endif  /* NTR > 0 */
  149 
  150 #include <ibm_console.h>
  151 #if IBM_CONSOLE > 0
  152 extern int      cnopen(), cnclose(), cnread(), cnwrite();
  153 extern int      cngetstat(), cnsetstat(), cnportdeath();
  154 extern vm_offset_t cnmmap();
  155 #define cnname                  "cn"
  156 #else /* IBM_CONSOLE > 0 */
  157 extern int      kdopen(), kdclose(), kdread(), kdwrite();
  158 extern int      kdgetstat(), kdsetstat(), kdportdeath();
  159 extern vm_offset_t kdmmap();
  160 #define kdname                  "kd"
  161 #endif /* IBM_CONSOLE > 0 */
  162 
  163 #include <com.h>
  164 #if     NCOM > 0
  165 extern int      comopen(), comclose(), comread(), comwrite();
  166 extern int      comgetstat(), comsetstat(), comportdeath();
  167 #define comname                 "com"
  168 #endif  /* NCOM > 0 */
  169 
  170 #include <qd.h>
  171 #if     NQD > 0
  172 extern int      qdopen(), qdclose(), qdread(), qdwrite(), qdioctl();
  173 #define qdname                  "qd"
  174 #endif  /* NQD > 0 */
  175 
  176 #include <blit.h>
  177 #if NBLIT > 0
  178 extern int      blitopen(), blitclose(), blit_get_stat();
  179 extern vm_offset_t blitmmap();
  180 #define blitname                "blit"
  181 #endif
  182 
  183 extern int      kbdopen(), kbdclose(), kbdread();
  184 extern int      kbdgetstat(), kbdsetstat();
  185 #define kbdname                 "kbd"
  186 
  187 #include <mouse.h>
  188 #if NMOUSE > 0
  189 extern int      mouseinit(), mouseopen(), mouseclose();
  190 extern int      mousegetstat(), mousesetstat(), mouseread();
  191 #define mousename               "mouse"
  192 #endif
  193 
  194 extern int      ioplopen(), ioplclose();
  195 extern vm_offset_t ioplmmap();
  196 #define ioplname                "iopl"
  197 
  198 #include <mc.h>
  199 #if     NMC > 0
  200 extern int      mc_open(), mc_close(), mc_getstat();
  201 extern int      mc_setstat(), mc_devinfo();
  202 extern vm_offset_t mc_mmap();
  203 #define mc_name         "mc"
  204 #endif  /* NMC > 0 */
  205 
  206 #include <clockpit.h>
  207 #if     NCLOCKPIT > 0
  208 extern int      clockpitopen(), clockpitclose(), clockpitgetstat();
  209 extern int      clockpitsetstat(), clockpitinfo();
  210 extern vm_offset_t clockpitmmap();
  211 #define clockpitname            "clockpit"
  212 #endif  /* NCLOCKPIT > 0 */
  213 
  214 
  215 /*
  216  * List of devices - console must be at slot 0
  217  */
  218 struct dev_ops  dev_name_list[] =
  219 {
  220         /*name,         open,           close,          read,
  221           write,        getstat,        setstat,        mmap,
  222           async_in,     reset,          port_death,     subdev,
  223           dev_info */
  224 
  225 #if IBM_CONSOLE > 0
  226         { cnname,       cnopen,         cnclose,        cnread,
  227           cnwrite,      cngetstat,      cnsetstat,      cnmmap,
  228           nodev,        nulldev,        cnportdeat,     0,
  229           nodev },
  230 #else /* IBM_CONSOLE > 0 */
  231         { kdname,       kdopen,         kdclose,        kdread,
  232           kdwrite,      kdgetstat,      kdsetstat,      kdmmap,
  233           nodev,        nulldev,        kdportdeath,    0,
  234           nodev },
  235 #endif /* IBM_CONSOLE > 0 */
  236 
  237         { timename,     timeopen,       timeclose,      nulldev,
  238           nulldev,      nulldev,        nulldev,        timemmap,
  239           nodev,        nulldev,        nulldev,        0,
  240           nodev },
  241 
  242 #if     NHD > 0
  243         { hdname,       hdopen,         hdclose,        hdread,
  244           hdwrite,      hdgetstat,      hdsetstat,      nomap,
  245           nodev,        nulldev,        nulldev,        16,
  246           nodev },
  247 #endif
  248 
  249 #if     NFD > 0
  250         { fdname,       fdopen,         fdclose,        fdread,
  251           fdwrite,      fdgetstat,      fdsetstat,      nomap,
  252           nodev,        nulldev,        nulldev,        64,
  253           nodev },
  254 #endif
  255 
  256 #if     NWT > 0
  257         { wtname,       wtopen,         wtclose,        wtread,
  258           wtwrite,      nulldev,        nulldev,        nomap,
  259           nodev,        nulldev,        nulldev,        0,
  260           nodev },
  261 #endif
  262 
  263 #if     NPC586 > 0
  264         { pc586name,    pc586open,      nulldev,        nulldev,
  265           pc586output,  pc586getstat,   pc586setstat,   nomap,
  266           pc586setinput,nulldev,        nulldev,        0,
  267           nodev },
  268 #endif
  269 
  270 #if     NAT3C501 > 0
  271         { at3c501name,  at3c501open,    nulldev,        nulldev,
  272           at3c501output,at3c501getstat, at3c501setstat, nomap,
  273           at3c501setinput, nulldev,     nulldev,        0,
  274           nodev },
  275 #endif
  276 
  277 #if     NNS8390 > 0
  278         { ns8390wdname, ns8390open,     nulldev,        nulldev,
  279           ns8390output, ns8390getstat,  ns8390setstat,  nomap,
  280           ns8390setinput, nulldev,      nulldev,        0,
  281           nodev },
  282 
  283         { ns8390elname, ns8390open,     nulldev,        nulldev,
  284           ns8390output, ns8390getstat,  ns8390setstat,  nomap,
  285           ns8390setinput, nulldev,      nulldev,        0,
  286           nodev },
  287 #endif
  288 
  289 #if     NUN > 0
  290         { unname,       unopen, nulldev,        nulldev,
  291           unoutput,     ungetstat,      unsetstat,      nomap,
  292           unsetinput,   nulldev,        nulldev,        0,
  293           nodev },
  294 #endif
  295 
  296 #if     NTR > 0
  297         { trname,       tropen, nulldev,        nulldev,
  298           troutput,     trgetstat,      trsetstat,      nomap,
  299           trsetinput,   nulldev,        nulldev,        0,
  300           nodev },
  301 #endif
  302 
  303 #if     NBLIT > 0
  304         { blitname,     blitopen,       blitclose,      nodev,
  305           nodev,        blit_get_stat,  nodev,          blitmmap,
  306           nodev,        nodev,          nodev,  0,
  307           nodev },
  308 #endif
  309 
  310 #if     NMOUSE > 0
  311         { mousename,    mouseopen,      mouseclose,     mouseread,
  312           nodev,        mousegetstat,   mousesetstat,   nomap,
  313           nodev,        nulldev,        nulldev,        0,
  314           nodev },
  315 #endif
  316 
  317         { kbdname,      kbdopen,        kbdclose,       kbdread,
  318           nodev,        kbdgetstat,     kbdsetstat,     nomap,
  319           nodev,        nulldev,        nulldev,        0,
  320           nodev },
  321 
  322         { ioplname,     ioplopen,       ioplclose,      nodev,
  323           nodev,        nodev,          nodev,          ioplmmap,
  324           nodev,        nulldev,        nulldev,        0,
  325           nodev },
  326 #if     NMC > 0
  327         { mc_name,      mc_open,        mc_close,       nodev,
  328           nodev,        mc_getstat,     mc_setstat,     mc_mmap,
  329           nodev,        nulldev,        nulldev,        0,
  330           mc_devinfo },
  331 #endif
  332 
  333 #if     NCLOCKPIT > 0
  334         { clockpitname, clockpitopen,   clockpitclose,  nodev,
  335           nodev,        clockpitgetstat,clockpitsetstat,clockpitmmap,
  336           nodev,        nulldev,        nulldev,        0,
  337           clockpitinfo },
  338 #endif
  339 };
  340 int     dev_name_count = sizeof(dev_name_list)/sizeof(dev_name_list[0]);
  341 
  342 /*
  343  * Indirect list.
  344  */
  345 struct dev_indirect dev_indirect_list[] = {
  346 
  347         /* console */
  348         { "console",    &dev_name_list[0],      0 },
  349         { "clock_priv", 0,                      0 },
  350         { "clock",      0,                      0 }
  351 };
  352 int     dev_indirect_count = sizeof(dev_indirect_list)
  353                                 / sizeof(dev_indirect_list[0]);
  354 
  355 /*
  356  *      Operations vector for non-privileged clock operations
  357  *      on system clock.
  358  */
  359 struct dev_ops  clock_unpriv_ops =
  360         { "",           nodev,          nodev,          nodev,
  361           nodev,        nodev,          nodev,          nomap,
  362           nodev,        nodev,          nodev,          0,
  363           nodev };
  364 
  365 /*
  366  *      Set unprivileged clock device from clock device
  367  *      (system clock).
  368  */
  369 void set_clock_unpriv(void)
  370 {
  371         struct dev_ops  *ops;
  372         int             unit;
  373 
  374         /*
  375          *      Find the privileged clock vector
  376          */
  377         if (!dev_name_lookup("clock_priv", &ops, &unit))
  378             panic("no clock device");
  379 
  380         /*
  381          *      Copy the operations vector to the unprivileged ops
  382          *      vector.
  383          */
  384         clock_unpriv_ops = *ops;
  385         clock_unpriv_ops.d_setstat = nodev;     /* privileged op */
  386 
  387         /*
  388          *      Fill in the aliases.
  389          */
  390         dev_set_indirection("clock", &clock_unpriv_ops, 0);
  391 }

Cache object: ea921b2afe529375e9c47764ab476745


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