1998-09-15 18:16:39 +00:00
|
|
|
/*-
|
1998-09-25 11:55:46 +00:00
|
|
|
* Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
1998-09-15 18:16:39 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
* This code is derived from software contributed to The DragonFly Project
|
|
|
|
* by Sascha Wildner <saw@online.de>
|
|
|
|
*
|
1998-09-15 18:16:39 +00:00
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
1998-09-25 11:55:46 +00:00
|
|
|
* notice, this list of conditions and the following disclaimer as
|
|
|
|
* the first lines of this file unmodified.
|
1998-09-15 18:16:39 +00:00
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
1998-09-25 11:55:46 +00:00
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
1998-09-15 18:16:39 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2003-08-24 18:17:24 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
#include "opt_vga.h"
|
1998-09-15 18:16:39 +00:00
|
|
|
|
2000-01-29 15:08:56 +00:00
|
|
|
#ifndef VGA_NO_MODE_CHANGE
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
1998-09-26 03:38:40 +00:00
|
|
|
#include <sys/conf.h>
|
1998-09-15 18:16:39 +00:00
|
|
|
#include <sys/tty.h>
|
|
|
|
#include <sys/kernel.h>
|
2000-10-09 07:29:41 +00:00
|
|
|
#include <sys/fbio.h>
|
|
|
|
#include <sys/consio.h>
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
#include <machine/pc/vesa.h>
|
|
|
|
|
1999-01-11 03:18:56 +00:00
|
|
|
#include <dev/fb/fbreg.h>
|
|
|
|
#include <dev/syscons/syscons.h>
|
1998-09-15 18:16:39 +00:00
|
|
|
|
1998-09-26 03:34:10 +00:00
|
|
|
static d_ioctl_t *prev_user_ioctl;
|
1998-09-15 18:16:39 +00:00
|
|
|
|
1998-09-26 03:34:10 +00:00
|
|
|
static int
|
2004-06-16 09:47:26 +00:00
|
|
|
vesa_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td)
|
1998-09-15 18:16:39 +00:00
|
|
|
{
|
|
|
|
scr_stat *scp;
|
|
|
|
struct tty *tp;
|
|
|
|
int mode;
|
|
|
|
|
1999-09-25 16:21:39 +00:00
|
|
|
tp = dev->si_tty;
|
1998-09-15 18:16:39 +00:00
|
|
|
if (!tp)
|
|
|
|
return ENXIO;
|
1999-09-19 08:58:53 +00:00
|
|
|
scp = SC_STAT(tp->t_dev);
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
|
1998-09-23 09:59:00 +00:00
|
|
|
/* generic text modes */
|
|
|
|
case SW_TEXT_132x25: case SW_TEXT_132x30:
|
|
|
|
case SW_TEXT_132x43: case SW_TEXT_132x50:
|
|
|
|
case SW_TEXT_132x60:
|
The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize
some of complicated functions.
- Many static variables are moved to the softc structure.
- Added a new key function, PREV. When this key is pressed, the vty
immediately before the current vty will become foreground. Analogue
to PREV, which is usually assigned to the PrntScrn key.
PR: kern/10113
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
- Modified the kernel console input function sccngetc() so that it
handles function keys properly.
- Reorganized the screen update routine.
- VT switching code is reorganized. It now should be slightly more
robust than before.
- Added the DEVICE_RESUME function so that syscons no longer hooks the
APM resume event directly.
- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
SC_NO_HISTORY and SC_NO_SYSMOUSE.
Various parts of syscons can be omitted so that the kernel size is
reduced.
SC_PIXEL_MODE
Made the VESA 800x600 mode an option, rather than a standard part of
syscons.
SC_DISABLE_DDBKEY
Disables the `debug' key combination.
SC_ALT_MOUSE_IMAGE
Inverse the character cell at the mouse cursor position in the text
console, rather than drawing an arrow on the screen.
Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)
SC_DFLT_FONT
makeoptions "SC_DFLT_FONT=_font_name_"
Include the named font as the default font of syscons. 16-line,
14-line and 8-line font data will be compiled in. This option replaces
the existing STD8X16FONT option, which loads 16-line font data only.
- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.
- The video driver provides a set of ioctl commands to manipulate the
frame buffer.
- New kernel configuration option: VGA_WIDTH90
Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These
modes are mot always supported by the video card.
PR: i386/7510
Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.
- The header file machine/console.h is reorganized; its contents is now
split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
(another new file). machine/console.h is still maintained for
compatibility reasons.
- Kernel console selection/installation routines are fixed and
slightly rebumped so that it should now be possible to switch between
the interanl kernel console (sc or vt) and a remote kernel console
(sio) again, as it was in 2.x, 3.0 and 3.1.
- Screen savers and splash screen decoders
Because of the header file reorganization described above, screen
savers and splash screen decoders are slightly modified. After this
update, /sys/modules/syscons/saver.h is no longer necessary and is
removed.
1999-06-22 14:14:06 +00:00
|
|
|
if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
|
1998-09-23 09:59:00 +00:00
|
|
|
return ENODEV;
|
2005-08-30 18:58:17 +00:00
|
|
|
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0, 0);
|
1998-09-23 09:59:00 +00:00
|
|
|
|
1998-09-15 18:16:39 +00:00
|
|
|
/* text modes */
|
|
|
|
case SW_VESA_C80x60:
|
|
|
|
case SW_VESA_C132x25:
|
|
|
|
case SW_VESA_C132x43:
|
|
|
|
case SW_VESA_C132x50:
|
|
|
|
case SW_VESA_C132x60:
|
The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize
some of complicated functions.
- Many static variables are moved to the softc structure.
- Added a new key function, PREV. When this key is pressed, the vty
immediately before the current vty will become foreground. Analogue
to PREV, which is usually assigned to the PrntScrn key.
PR: kern/10113
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
- Modified the kernel console input function sccngetc() so that it
handles function keys properly.
- Reorganized the screen update routine.
- VT switching code is reorganized. It now should be slightly more
robust than before.
- Added the DEVICE_RESUME function so that syscons no longer hooks the
APM resume event directly.
- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
SC_NO_HISTORY and SC_NO_SYSMOUSE.
Various parts of syscons can be omitted so that the kernel size is
reduced.
SC_PIXEL_MODE
Made the VESA 800x600 mode an option, rather than a standard part of
syscons.
SC_DISABLE_DDBKEY
Disables the `debug' key combination.
SC_ALT_MOUSE_IMAGE
Inverse the character cell at the mouse cursor position in the text
console, rather than drawing an arrow on the screen.
Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)
SC_DFLT_FONT
makeoptions "SC_DFLT_FONT=_font_name_"
Include the named font as the default font of syscons. 16-line,
14-line and 8-line font data will be compiled in. This option replaces
the existing STD8X16FONT option, which loads 16-line font data only.
- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.
- The video driver provides a set of ioctl commands to manipulate the
frame buffer.
- New kernel configuration option: VGA_WIDTH90
Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These
modes are mot always supported by the video card.
PR: i386/7510
Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.
- The header file machine/console.h is reorganized; its contents is now
split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
(another new file). machine/console.h is still maintained for
compatibility reasons.
- Kernel console selection/installation routines are fixed and
slightly rebumped so that it should now be possible to switch between
the interanl kernel console (sc or vt) and a remote kernel console
(sio) again, as it was in 2.x, 3.0 and 3.1.
- Screen savers and splash screen decoders
Because of the header file reorganization described above, screen
savers and splash screen decoders are slightly modified. After this
update, /sys/modules/syscons/saver.h is no longer necessary and is
removed.
1999-06-22 14:14:06 +00:00
|
|
|
if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
|
1998-09-15 18:16:39 +00:00
|
|
|
return ENODEV;
|
|
|
|
mode = (cmd & 0xff) + M_VESA_BASE;
|
2005-08-30 18:58:17 +00:00
|
|
|
return sc_set_text_mode(scp, tp, mode, 0, 0, 0, 0);
|
1998-09-15 18:16:39 +00:00
|
|
|
|
|
|
|
/* graphics modes */
|
|
|
|
case SW_VESA_32K_320: case SW_VESA_64K_320:
|
|
|
|
case SW_VESA_FULL_320:
|
|
|
|
|
|
|
|
case SW_VESA_CG640x400:
|
|
|
|
|
|
|
|
case SW_VESA_CG640x480:
|
|
|
|
case SW_VESA_32K_640: case SW_VESA_64K_640:
|
|
|
|
case SW_VESA_FULL_640:
|
|
|
|
|
|
|
|
case SW_VESA_800x600: case SW_VESA_CG800x600:
|
|
|
|
case SW_VESA_32K_800: case SW_VESA_64K_800:
|
|
|
|
case SW_VESA_FULL_800:
|
|
|
|
|
|
|
|
case SW_VESA_1024x768: case SW_VESA_CG1024x768:
|
|
|
|
case SW_VESA_32K_1024: case SW_VESA_64K_1024:
|
|
|
|
case SW_VESA_FULL_1024:
|
|
|
|
|
|
|
|
case SW_VESA_1280x1024: case SW_VESA_CG1280x1024:
|
|
|
|
case SW_VESA_32K_1280: case SW_VESA_64K_1280:
|
|
|
|
case SW_VESA_FULL_1280:
|
The second phase of syscons reorganization.
- Split syscons source code into manageable chunks and reorganize
some of complicated functions.
- Many static variables are moved to the softc structure.
- Added a new key function, PREV. When this key is pressed, the vty
immediately before the current vty will become foreground. Analogue
to PREV, which is usually assigned to the PrntScrn key.
PR: kern/10113
Submitted by: Christian Weisgerber <naddy@mips.rhein-neckar.de>
- Modified the kernel console input function sccngetc() so that it
handles function keys properly.
- Reorganized the screen update routine.
- VT switching code is reorganized. It now should be slightly more
robust than before.
- Added the DEVICE_RESUME function so that syscons no longer hooks the
APM resume event directly.
- New kernel configuration options: SC_NO_CUTPASTE, SC_NO_FONT_LOADING,
SC_NO_HISTORY and SC_NO_SYSMOUSE.
Various parts of syscons can be omitted so that the kernel size is
reduced.
SC_PIXEL_MODE
Made the VESA 800x600 mode an option, rather than a standard part of
syscons.
SC_DISABLE_DDBKEY
Disables the `debug' key combination.
SC_ALT_MOUSE_IMAGE
Inverse the character cell at the mouse cursor position in the text
console, rather than drawing an arrow on the screen.
Submitted by: Nick Hibma (n_hibma@FreeBSD.ORG)
SC_DFLT_FONT
makeoptions "SC_DFLT_FONT=_font_name_"
Include the named font as the default font of syscons. 16-line,
14-line and 8-line font data will be compiled in. This option replaces
the existing STD8X16FONT option, which loads 16-line font data only.
- The VGA driver is split into /sys/dev/fb/vga.c and /sys/isa/vga_isa.c.
- The video driver provides a set of ioctl commands to manipulate the
frame buffer.
- New kernel configuration option: VGA_WIDTH90
Enables 90 column modes: 90x25, 90x30, 90x43, 90x50, 90x60. These
modes are mot always supported by the video card.
PR: i386/7510
Submitted by: kbyanc@freedomnet.com and alexv@sui.gda.itesm.mx.
- The header file machine/console.h is reorganized; its contents is now
split into sys/fbio.h, sys/kbio.h (a new file) and sys/consio.h
(another new file). machine/console.h is still maintained for
compatibility reasons.
- Kernel console selection/installation routines are fixed and
slightly rebumped so that it should now be possible to switch between
the interanl kernel console (sc or vt) and a remote kernel console
(sio) again, as it was in 2.x, 3.0 and 3.1.
- Screen savers and splash screen decoders
Because of the header file reorganization described above, screen
savers and splash screen decoders are slightly modified. After this
update, /sys/modules/syscons/saver.h is no longer necessary and is
removed.
1999-06-22 14:14:06 +00:00
|
|
|
if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
|
1998-09-15 18:16:39 +00:00
|
|
|
return ENODEV;
|
|
|
|
mode = (cmd & 0xff) + M_VESA_BASE;
|
|
|
|
return sc_set_graphics_mode(scp, tp, mode);
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
default:
|
|
|
|
if (IOCGROUP(cmd) == 'V') {
|
|
|
|
if (!(scp->sc->adp->va_flags & V_ADP_MODECHANGE))
|
|
|
|
return ENODEV;
|
|
|
|
|
|
|
|
mode = (cmd & 0xff) + M_VESA_BASE;
|
|
|
|
|
2005-06-10 05:20:33 +00:00
|
|
|
/* Only set graphics mode in non-pcvt case */
|
|
|
|
if (((cmd & IOC_DIRMASK) == IOC_VOID) &&
|
|
|
|
(mode > M_VESA_FULL_1280) &&
|
Add VESA mode support for syscons, which enables the support of 15, 16,
24, and 32 bit modes. To use that, syscons(4) must be built with
the compile time option 'options SC_PIXEL_MODE', and VESA support (a.k.a.
vesa.ko) must be either loaded, or be compiled into the kernel.
Do not return EINVAL when the mouse state is changed to what it already is,
which seems to cause problems when you have two mice attached, and
applications are not likely obtain useful information through the EINVAL
caused by showing the mouse pointer twice.
Teach vidcontrol(8) about mode names like MODE_<NUMBER>, where <NUMBER> is
the video mode number from the vidcontrol -i mode output. Also, revert the
video mode if something fails.
Obtained from: DragonFlyBSD
Discussed at: current@ with patch attached [1]
PR: kern/71142 [2]
Submitted by: Xuefeng DENG <dsnofe at msn com> [1],
Cyrille Lefevre <cyrille dot lefevre at laposte dot net> [2]
2005-05-29 08:43:44 +00:00
|
|
|
(mode < M_VESA_MODE_MAX))
|
|
|
|
return sc_set_graphics_mode(scp, tp, mode);
|
|
|
|
}
|
1998-09-15 18:16:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (prev_user_ioctl)
|
2001-09-12 08:38:13 +00:00
|
|
|
return (*prev_user_ioctl)(dev, cmd, data, flag, td);
|
1998-09-15 18:16:39 +00:00
|
|
|
else
|
|
|
|
return ENOIOCTL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
vesa_load_ioctl(void)
|
|
|
|
{
|
|
|
|
if (prev_user_ioctl)
|
|
|
|
return EBUSY;
|
|
|
|
prev_user_ioctl = sc_user_ioctl;
|
|
|
|
sc_user_ioctl = vesa_ioctl;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
vesa_unload_ioctl(void)
|
|
|
|
{
|
|
|
|
if (sc_user_ioctl != vesa_ioctl)
|
|
|
|
return EBUSY;
|
|
|
|
sc_user_ioctl = prev_user_ioctl;
|
|
|
|
prev_user_ioctl = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2000-01-29 15:08:56 +00:00
|
|
|
#endif /* SC_NO_MODE_CHANGE */
|