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/dev/syscons/scvesactl.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  * Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
    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 as
   10  *    the first lines of this file unmodified.
   11  * 2. Redistributions in binary form must reproduce the above copyright
   12  *    notice, this list of conditions and the following disclaimer in the
   13  *    documentation and/or other materials provided with the distribution.
   14  *
   15  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
   16  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   17  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
   18  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
   19  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
   20  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
   21  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
   22  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
   23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
   24  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   25  *
   26  * $FreeBSD: releng/5.0/sys/dev/syscons/scvesactl.c 83366 2001-09-12 08:38:13Z julian $
   27  */
   28 
   29 #include "opt_vga.h"
   30 
   31 #ifndef VGA_NO_MODE_CHANGE
   32 
   33 #include <sys/param.h>
   34 #include <sys/systm.h>
   35 #include <sys/conf.h>
   36 #include <sys/tty.h>
   37 #include <sys/kernel.h>
   38 #include <sys/fbio.h>
   39 #include <sys/consio.h>
   40 
   41 #include <machine/pc/vesa.h>
   42 
   43 #include <dev/fb/fbreg.h>
   44 #include <dev/syscons/syscons.h>
   45 
   46 static d_ioctl_t *prev_user_ioctl;
   47 
   48 static int
   49 vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td)
   50 {
   51         scr_stat *scp;
   52         struct tty *tp;
   53         int mode;
   54 
   55         tp = dev->si_tty;
   56         if (!tp)
   57                 return ENXIO;
   58         scp = SC_STAT(tp->t_dev);
   59 
   60         switch (cmd) {
   61 
   62         /* generic text modes */
   63         case SW_TEXT_132x25: case SW_TEXT_132x30:
   64         case SW_TEXT_132x43: case SW_TEXT_132x50:
   65         case SW_TEXT_132x60:
   66                 if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
   67                         return ENODEV;
   68                 return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
   69 
   70         /* text modes */
   71         case SW_VESA_C80x60:
   72         case SW_VESA_C132x25:
   73         case SW_VESA_C132x43:
   74         case SW_VESA_C132x50:
   75         case SW_VESA_C132x60:
   76                 if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
   77                         return ENODEV;
   78                 mode = (cmd & 0xff) + M_VESA_BASE;
   79                 return sc_set_text_mode(scp, tp, mode, 0, 0, 0);
   80 
   81         /* graphics modes */
   82         case SW_VESA_32K_320:   case SW_VESA_64K_320: 
   83         case SW_VESA_FULL_320:
   84 
   85         case SW_VESA_CG640x400:
   86 
   87         case SW_VESA_CG640x480:
   88         case SW_VESA_32K_640:   case SW_VESA_64K_640:
   89         case SW_VESA_FULL_640:
   90 
   91         case SW_VESA_800x600:   case SW_VESA_CG800x600:
   92         case SW_VESA_32K_800:   case SW_VESA_64K_800:
   93         case SW_VESA_FULL_800:
   94 
   95         case SW_VESA_1024x768:  case SW_VESA_CG1024x768:
   96         case SW_VESA_32K_1024:  case SW_VESA_64K_1024:
   97         case SW_VESA_FULL_1024:
   98 
   99         case SW_VESA_1280x1024: case SW_VESA_CG1280x1024:
  100         case SW_VESA_32K_1280:  case SW_VESA_64K_1280:
  101         case SW_VESA_FULL_1280:
  102                 if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
  103                         return ENODEV;
  104                 mode = (cmd & 0xff) + M_VESA_BASE;
  105                 return sc_set_graphics_mode(scp, tp, mode);
  106         }
  107 
  108         if (prev_user_ioctl)
  109                 return (*prev_user_ioctl)(dev, cmd, data, flag, td);
  110         else
  111                 return ENOIOCTL;
  112 }
  113 
  114 int
  115 vesa_load_ioctl(void)
  116 {
  117         if (prev_user_ioctl)
  118                 return EBUSY;
  119         prev_user_ioctl = sc_user_ioctl;
  120         sc_user_ioctl = vesa_ioctl;
  121         return 0;
  122 }
  123 
  124 int
  125 vesa_unload_ioctl(void)
  126 {
  127         if (sc_user_ioctl != vesa_ioctl)
  128                 return EBUSY;
  129         sc_user_ioctl = prev_user_ioctl;
  130         prev_user_ioctl = NULL;
  131         return 0;
  132 }
  133 
  134 #endif  /* SC_NO_MODE_CHANGE */

Cache object: 78e017ba2a8e064baed446cf387b89f2


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