Remove unused files.

They served well.  Now that their descendant is firmly in place
and taking over, they can now rest in peace...
This commit is contained in:
Kazutaka YOKOTA 1999-01-19 10:32:20 +00:00
parent 3146a70d74
commit 8bbbb12f07
8 changed files with 0 additions and 8709 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,206 +0,0 @@
/*-
* Copyright (c) 1996 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer.
* 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.
* 3. The name of the author may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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.
*
* $Id: kbdio.h,v 1.8 1998/09/25 11:55:46 yokota Exp $
*/
#ifndef _I386_ISA_KBDIO_H_
#define _I386_ISA_KBDIO_H_
/* constants */
/* I/O ports */
#ifdef PC98
#define KBD_STATUS_PORT 2 /* status port, read */
#define KBD_COMMAND_PORT 2 /* controller command port, write */
#define KBD_DATA_PORT 0 /* data port, read/write
* also used as keyboard command
* and mouse command port
*/
#else
#define KBD_STATUS_PORT 4 /* status port, read */
#define KBD_COMMAND_PORT 4 /* controller command port, write */
#define KBD_DATA_PORT 0 /* data port, read/write
* also used as keyboard command
* and mouse command port
*/
#endif /* PC98 */
/* controller commands (sent to KBD_COMMAND_PORT) */
#define KBDC_SET_COMMAND_BYTE 0x0060
#define KBDC_GET_COMMAND_BYTE 0x0020
#define KBDC_WRITE_TO_AUX 0x00d4
#define KBDC_DISABLE_AUX_PORT 0x00a7
#define KBDC_ENABLE_AUX_PORT 0x00a8
#define KBDC_TEST_AUX_PORT 0x00a9
#define KBDC_DIAGNOSE 0x00aa
#define KBDC_TEST_KBD_PORT 0x00ab
#define KBDC_DISABLE_KBD_PORT 0x00ad
#define KBDC_ENABLE_KBD_PORT 0x00ae
/* controller command byte (set by KBDC_SET_COMMAND_BYTE) */
#define KBD_TRANSLATION 0x0040
#define KBD_RESERVED_BITS 0x0004
#define KBD_OVERRIDE_KBD_LOCK 0x0008
#define KBD_ENABLE_KBD_PORT 0x0000
#define KBD_DISABLE_KBD_PORT 0x0010
#define KBD_ENABLE_AUX_PORT 0x0000
#define KBD_DISABLE_AUX_PORT 0x0020
#define KBD_ENABLE_AUX_INT 0x0002
#define KBD_DISABLE_AUX_INT 0x0000
#define KBD_ENABLE_KBD_INT 0x0001
#define KBD_DISABLE_KBD_INT 0x0000
#define KBD_KBD_CONTROL_BITS (KBD_DISABLE_KBD_PORT | KBD_ENABLE_KBD_INT)
#define KBD_AUX_CONTROL_BITS (KBD_DISABLE_AUX_PORT | KBD_ENABLE_AUX_INT)
/* keyboard device commands (sent to KBD_DATA_PORT) */
#define KBDC_RESET_KBD 0x00ff
#define KBDC_ENABLE_KBD 0x00f4
#define KBDC_DISABLE_KBD 0x00f5
#define KBDC_SET_DEFAULTS 0x00f6
#define KBDC_SEND_DEV_ID 0x00f2
#define KBDC_SET_LEDS 0x00ed
#define KBDC_ECHO 0x00ee
#define KBDC_SET_SCANCODE_SET 0x00f0
#define KBDC_SET_TYPEMATIC 0x00f3
/* aux device commands (sent to KBD_DATA_PORT) */
#define PSMC_RESET_DEV 0x00ff
#define PSMC_ENABLE_DEV 0x00f4
#define PSMC_DISABLE_DEV 0x00f5
#define PSMC_SET_DEFAULTS 0x00f6
#define PSMC_SEND_DEV_ID 0x00f2
#define PSMC_SEND_DEV_STATUS 0x00e9
#define PSMC_SEND_DEV_DATA 0x00eb
#define PSMC_SET_SCALING11 0x00e6
#define PSMC_SET_SCALING21 0x00e7
#define PSMC_SET_RESOLUTION 0x00e8
#define PSMC_SET_STREAM_MODE 0x00ea
#define PSMC_SET_REMOTE_MODE 0x00f0
#define PSMC_SET_SAMPLING_RATE 0x00f3
/* PSMC_SET_RESOLUTION argument */
#define PSMD_RES_LOW 0 /* typically 25ppi */
#define PSMD_RES_MEDIUM_LOW 1 /* typically 50ppi */
#define PSMD_RES_MEDIUM_HIGH 2 /* typically 100ppi (default) */
#define PSMD_RES_HIGH 3 /* typically 200ppi */
#define PSMD_MAX_RESOLUTION PSMD_RES_HIGH
/* PSMC_SET_SAMPLING_RATE */
#define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */
/* status bits (KBD_STATUS_PORT) */
#ifdef PC98
#define KBDS_BUFFER_FULL 0x0002
#define KBDS_ANY_BUFFER_FULL 0x0002
#define KBDS_KBD_BUFFER_FULL 0x0002
#define KBDS_AUX_BUFFER_FULL 0x0002
#else
#define KBDS_BUFFER_FULL 0x0021
#define KBDS_ANY_BUFFER_FULL 0x0001
#define KBDS_KBD_BUFFER_FULL 0x0001
#define KBDS_AUX_BUFFER_FULL 0x0021
#endif
#define KBDS_INPUT_BUFFER_FULL 0x0002
/* return code */
#define KBD_ACK 0x00fa
#define KBD_RESEND 0x00fe
#define KBD_RESET_DONE 0x00aa
#define KBD_RESET_FAIL 0x00fc
#define KBD_DIAG_DONE 0x0055
#define KBD_DIAG_FAIL 0x00fd
#define KBD_ECHO 0x00ee
#define PSM_ACK 0x00fa
#define PSM_RESEND 0x00fe
#define PSM_RESET_DONE 0x00aa
#define PSM_RESET_FAIL 0x00fc
/* aux device ID */
#define PSM_MOUSE_ID 0
#define PSM_BALLPOINT_ID 2
#define PSM_INTELLI_ID 3
#ifdef KERNEL
#ifndef TRUE
#define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
/* types/structures */
typedef caddr_t KBDC;
/* function prototypes */
KBDC kbdc_open __P((int port));
int kbdc_lock __P((KBDC kbdc, int lock));
int kbdc_data_ready __P((KBDC kbdc));
int write_controller_command __P((KBDC kbdc,int c));
int write_controller_data __P((KBDC kbdc,int c));
int write_kbd_command __P((KBDC kbdc,int c));
int write_aux_command __P((KBDC kbdc,int c));
int send_kbd_command __P((KBDC kbdc,int c));
int send_aux_command __P((KBDC kbdc,int c));
int send_kbd_command_and_data __P((KBDC kbdc,int c,int d));
int send_aux_command_and_data __P((KBDC kbdc,int c,int d));
int read_controller_data __P((KBDC kbdc));
int read_kbd_data __P((KBDC kbdc));
int read_kbd_data_no_wait __P((KBDC kbdc));
int read_aux_data __P((KBDC kbdc));
int read_aux_data_no_wait __P((KBDC kbdc));
void empty_kbd_buffer __P((KBDC kbdc, int t));
void empty_aux_buffer __P((KBDC kbdc, int t));
void empty_both_buffers __P((KBDC kbdc, int t));
int reset_kbd __P((KBDC kbdc));
int reset_aux_dev __P((KBDC kbdc));
int test_controller __P((KBDC kbdc));
int test_kbd_port __P((KBDC kbdc));
int test_aux_port __P((KBDC kbdc));
int kbdc_get_device_mask __P((KBDC kbdc));
void kbdc_set_device_mask __P((KBDC kbdc, int mask));
int get_controller_command_byte __P((KBDC kbdc));
int set_controller_command_byte __P((KBDC kbdc, int command, int flag));
#endif /* KERNEL */
#endif /* !_I386_ISA_KBDIO_H_ */

View File

@ -1,140 +0,0 @@
/*-
* Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer as
* the first lines of this file unmodified.
* 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.
*
* 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.
*
* $Id: scvesactl.c,v 1.7 1998/12/07 21:58:22 archie Exp $
*/
#include "sc.h"
#include "opt_vesa.h"
#include "opt_vm86.h"
#if (NSC > 0 && defined(VESA) && defined(VM86)) || defined(KLD_MODULE)
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/tty.h>
#include <sys/kernel.h>
#include <machine/apm_bios.h>
#include <machine/console.h>
#include <machine/pc/vesa.h>
#include <i386/isa/videoio.h>
#include <i386/isa/syscons.h>
static d_ioctl_t *prev_user_ioctl;
static int
vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
scr_stat *scp;
struct tty *tp;
video_adapter_t *adp;
int mode;
tp = scdevtotty(dev);
if (!tp)
return ENXIO;
scp = sc_get_scr_stat(tp->t_dev);
switch (cmd) {
/* generic text modes */
case SW_TEXT_132x25: case SW_TEXT_132x30:
case SW_TEXT_132x43: case SW_TEXT_132x50:
case SW_TEXT_132x60:
adp = get_adapter(scp);
if (!(adp->va_flags & V_ADP_MODECHANGE))
return ENODEV;
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
/* text modes */
case SW_VESA_C80x60:
case SW_VESA_C132x25:
case SW_VESA_C132x43:
case SW_VESA_C132x50:
case SW_VESA_C132x60:
adp = get_adapter(scp);
if (!(adp->va_flags & V_ADP_MODECHANGE))
return ENODEV;
mode = (cmd & 0xff) + M_VESA_BASE;
return sc_set_text_mode(scp, tp, mode, 0, 0, 0);
/* 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:
adp = get_adapter(scp);
if (!(adp->va_flags & V_ADP_MODECHANGE))
return ENODEV;
mode = (cmd & 0xff) + M_VESA_BASE;
return sc_set_graphics_mode(scp, tp, mode);
}
if (prev_user_ioctl)
return (*prev_user_ioctl)(dev, cmd, data, flag, p);
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;
}
#endif /* (NSC > 0 && VESA && VM86) || KLD_MODULE */

View File

@ -1,496 +0,0 @@
/*-
* Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer as
* the first lines of this file unmodified.
* 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.
*
* 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.
*
* $Id: scvidctl.c,v 1.4 1998/09/29 02:00:56 ache Exp $
*/
#include "sc.h"
#include "opt_syscons.h"
#if NSC > 0
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/signalvar.h>
#include <sys/tty.h>
#include <sys/kernel.h>
#include <machine/apm_bios.h>
#include <machine/console.h>
#include <i386/isa/videoio.h>
#include <i386/isa/syscons.h>
/* video ioctl */
extern scr_stat *cur_console;
extern int fonts_loaded;
extern int sc_history_size;
extern u_char palette[];
int
sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
int fontsize)
{
video_adapter_t *adp;
video_info_t info;
int error;
int s;
int i;
if ((*biosvidsw.get_info)(scp->adp, mode, &info))
return ENODEV;
adp = get_adapter(scp);
/* adjust argument values */
if (fontsize <= 0)
fontsize = info.vi_cheight;
if (fontsize < 14) {
fontsize = 8;
if (!(fonts_loaded & FONT_8))
return EINVAL;
} else if (fontsize >= 16) {
fontsize = 16;
if (!(fonts_loaded & FONT_16))
return EINVAL;
} else {
fontsize = 14;
if (!(fonts_loaded & FONT_14))
return EINVAL;
}
if ((xsize <= 0) || (xsize > info.vi_width))
xsize = info.vi_width;
if ((ysize <= 0) || (ysize > info.vi_height))
ysize = info.vi_height;
/* stop screen saver, etc */
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
/* set up scp */
if (scp->history != NULL)
i = imax(scp->history_size / scp->xsize
- imax(sc_history_size, scp->ysize), 0);
else
i = 0;
/*
* This is a kludge to fend off scrn_update() while we
* muck around with scp. XXX
*/
scp->status |= UNKNOWN_MODE;
scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE);
scp->mode = mode;
scp->font_size = fontsize;
scp->xsize = xsize;
scp->ysize = ysize;
scp->xpixel = scp->xsize*8;
scp->ypixel = scp->ysize*fontsize;
/* allocate buffers */
sc_alloc_scr_buffer(scp, TRUE, TRUE);
if (ISMOUSEAVAIL(adp->va_flags))
sc_alloc_cut_buffer(scp, FALSE);
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
splx(s);
if (scp == cur_console)
set_mode(scp);
scp->status &= ~UNKNOWN_MODE;
if (tp == NULL)
return 0;
if (tp->t_winsize.ws_col != scp->xsize
|| tp->t_winsize.ws_row != scp->ysize) {
tp->t_winsize.ws_col = scp->xsize;
tp->t_winsize.ws_row = scp->ysize;
pgsignal(tp->t_pgrp, SIGWINCH, 1);
}
return 0;
}
int
sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
{
video_adapter_t *adp;
video_info_t info;
int error;
int s;
if ((*biosvidsw.get_info)(scp->adp, mode, &info))
return ENODEV;
adp = get_adapter(scp);
/* stop screen saver, etc */
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
/* set up scp */
scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE);
scp->status &= ~PIXEL_MODE;
scp->mode = mode;
scp->xpixel = info.vi_width;
scp->ypixel = info.vi_height;
scp->xsize = info.vi_width/8;
scp->ysize = info.vi_height/info.vi_cheight;
scp->font_size = FONT_NONE;
/* move the mouse cursor at the center of the screen */
sc_move_mouse(scp, scp->xpixel / 2, scp->ypixel / 2);
splx(s);
if (scp == cur_console)
set_mode(scp);
/* clear_graphics();*/
scp->status &= ~UNKNOWN_MODE;
if (tp == NULL)
return 0;
if (tp->t_winsize.ws_xpixel != scp->xpixel
|| tp->t_winsize.ws_ypixel != scp->ypixel) {
tp->t_winsize.ws_xpixel = scp->xpixel;
tp->t_winsize.ws_ypixel = scp->ypixel;
pgsignal(tp->t_pgrp, SIGWINCH, 1);
}
return 0;
}
int
sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
int fontsize)
{
video_adapter_t *adp;
video_info_t info;
int error;
int s;
int i;
if ((*biosvidsw.get_info)(scp->adp, scp->mode, &info))
return ENODEV; /* this shouldn't happen */
adp = get_adapter(scp);
#ifdef SC_VIDEO_DEBUG
if (scp->scr_buf != NULL) {
printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
scp->mode, xsize, ysize, fontsize);
}
#endif
/* adjust argument values */
if ((fontsize <= 0) || (fontsize == FONT_NONE))
fontsize = info.vi_cheight;
if (fontsize < 14) {
fontsize = 8;
if (!(fonts_loaded & FONT_8))
return EINVAL;
} else if (fontsize >= 16) {
fontsize = 16;
if (!(fonts_loaded & FONT_16))
return EINVAL;
} else {
fontsize = 14;
if (!(fonts_loaded & FONT_14))
return EINVAL;
}
if (xsize <= 0)
xsize = info.vi_width/8;
if (ysize <= 0)
ysize = info.vi_height/fontsize;
#ifdef SC_VIDEO_DEBUG
if (scp->scr_buf != NULL) {
printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
scp->mode, xsize, ysize, fontsize);
printf("set_pixel_mode(): window:%x, %dx%d, xoff:%d, yoff:%d\n",
adp->va_window, info.vi_width, info.vi_height,
(info.vi_width/8 - xsize)/2,
(info.vi_height/fontsize - ysize)/2);
}
#endif
if ((info.vi_width < xsize*8) || (info.vi_height < ysize*fontsize))
return EINVAL;
/* only 16 color, 4 plane modes are supported XXX */
if ((info.vi_depth != 4) || (info.vi_planes != 4))
return ENODEV;
/*
* set_pixel_mode() currently does not support video modes whose
* memory size is larger than 64K. Because such modes require
* bank switching to access the entire screen. XXX
*/
if (info.vi_width*info.vi_height/8 > info.vi_window_size)
return ENODEV;
/* stop screen saver, etc */
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
/* set up scp */
if (scp->history != NULL)
i = imax(scp->history_size / scp->xsize
- imax(sc_history_size, scp->ysize), 0);
else
i = 0;
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
scp->status &= ~(GRAPHICS_MODE | MOUSE_ENABLED);
scp->xsize = xsize;
scp->ysize = ysize;
scp->font_size = fontsize;
scp->xoff = (scp->xpixel/8 - xsize)/2;
scp->yoff = (scp->ypixel/fontsize - ysize)/2;
/* allocate buffers */
sc_alloc_scr_buffer(scp, TRUE, TRUE);
if (ISMOUSEAVAIL(adp->va_flags))
sc_alloc_cut_buffer(scp, FALSE);
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
splx(s);
if (scp == cur_console)
set_border(scp, scp->border);
scp->status &= ~UNKNOWN_MODE;
#ifdef SC_VIDEO_DEBUG
printf("set_pixel_mode(): status:%x\n", scp->status);
#endif
if (tp == NULL)
return 0;
if (tp->t_winsize.ws_col != scp->xsize
|| tp->t_winsize.ws_row != scp->ysize) {
tp->t_winsize.ws_col = scp->xsize;
tp->t_winsize.ws_row = scp->ysize;
pgsignal(tp->t_pgrp, SIGWINCH, 1);
}
return 0;
}
int
sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
{
scr_stat *scp;
video_adapter_t *adp;
int error;
int s;
scp = sc_get_scr_stat(tp->t_dev);
switch (cmd) {
case CONS_CURRENT: /* get current adapter type */
adp = get_adapter(scp);
*(int *)data = adp->va_type;
return 0;
case CONS_CURRENTADP: /* get current adapter index */
*(int *)data = scp->adp;
return 0;
case CONS_ADPINFO: /* adapter information */
adp = (*biosvidsw.adapter)(((video_adapter_t *)data)->va_index);
if (adp == NULL)
return ENODEV;
bcopy(adp, data, sizeof(*adp));
return 0;
case CONS_GET: /* get current video mode */
*(int *)data = scp->mode;
return 0;
case CONS_MODEINFO: /* get mode information */
return ((*biosvidsw.get_info)(scp->adp,
((video_info_t *)data)->vi_mode, (video_info_t *)data)
? ENODEV : 0);
case CONS_FINDMODE: /* find a matching video mode */
return ((*biosvidsw.query_mode)(scp->adp, (video_info_t *)data)
? ENODEV : 0);
case CONS_SETWINORG:
return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data)
? ENODEV : 0);
/* generic text modes */
case SW_TEXT_80x25: case SW_TEXT_80x30:
case SW_TEXT_80x43: case SW_TEXT_80x50:
case SW_TEXT_80x60:
/* FALL THROUGH */
/* VGA TEXT MODES */
case SW_VGA_C40x25:
case SW_VGA_C80x25: case SW_VGA_M80x25:
case SW_VGA_C80x30: case SW_VGA_M80x30:
case SW_VGA_C80x50: case SW_VGA_M80x50:
case SW_VGA_C80x60: case SW_VGA_M80x60:
case SW_B40x25: case SW_C40x25:
case SW_B80x25: case SW_C80x25:
case SW_ENH_B40x25: case SW_ENH_C40x25:
case SW_ENH_B80x25: case SW_ENH_C80x25:
case SW_ENH_B80x43: case SW_ENH_C80x43:
case SW_EGAMONO80x25:
adp = get_adapter(scp);
if (!(adp->va_flags & V_ADP_MODECHANGE))
return ENODEV;
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
/* GRAPHICS MODES */
case SW_BG320: case SW_BG640:
case SW_CG320: case SW_CG320_D: case SW_CG640_E:
case SW_CG640x350: case SW_ENH_CG640:
case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320:
case SW_VGA_MODEX:
adp = get_adapter(scp);
if (!(adp->va_flags & V_ADP_MODECHANGE))
return ENODEV;
return sc_set_graphics_mode(scp, tp, cmd & 0xff);
case KDSETMODE: /* set current mode of this (virtual) console */
switch (*(int *)data) {
case KD_TEXT: /* switch to TEXT (known) mode */
/*
* If scp->mode is of graphics modes, we don't know which
* text mode to switch back to...
*/
if (scp->status & GRAPHICS_MODE)
return EINVAL;
/* restore fonts & palette ! */
#if 0
adp = get_adapter(scp);
if (ISFONTAVAIL(adp->va_flags)
&& !(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
/*
* FONT KLUDGE
* Don't load fonts for now... XXX
*/
if (fonts_loaded & FONT_8)
copy_font(scp, LOAD, 8, font_8);
if (fonts_loaded & FONT_14)
copy_font(scp, LOAD, 14, font_14);
if (fonts_loaded & FONT_16)
copy_font(scp, LOAD, 16, font_16);
}
#endif
load_palette(scp, palette);
/* move hardware cursor out of the way */
(*biosvidsw.set_hw_cursor)(scp->adp, -1, -1);
/* FALL THROUGH */
case KD_TEXT1: /* switch to TEXT (known) mode */
/*
* If scp->mode is of graphics modes, we don't know which
* text/pixel mode to switch back to...
*/
if (scp->status & GRAPHICS_MODE)
return EINVAL;
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
scp->status |= UNKNOWN_MODE;
splx(s);
/* no restore fonts & palette */
if (scp == cur_console)
set_mode(scp);
sc_clear_screen(scp);
scp->status &= ~UNKNOWN_MODE;
return 0;
case KD_PIXEL: /* pixel (raster) display */
if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
return EINVAL;
if (scp->status & GRAPHICS_MODE)
return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize,
scp->font_size);
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
splx(s);
if (scp == cur_console) {
set_mode(scp);
load_palette(scp, palette);
}
sc_clear_screen(scp);
scp->status &= ~UNKNOWN_MODE;
return 0;
case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */
s = spltty();
if ((error = sc_clean_up(scp))) {
splx(s);
return error;
}
scp->status |= UNKNOWN_MODE;
splx(s);
return 0;
default:
return EINVAL;
}
/* NOT REACHED */
case KDRASTER: /* set pixel (raster) display mode */
if (ISUNKNOWNSC(scp) || ISTEXTSC(scp))
return ENODEV;
return sc_set_pixel_mode(scp, tp, ((int *)data)[0], ((int *)data)[1],
((int *)data)[2]);
case KDGETMODE: /* get current mode of this (virtual) console */
/*
* From the user program's point of view, KD_PIXEL is the same
* as KD_TEXT...
*/
*data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT;
return 0;
case KDSBORDER: /* set border color of this (virtual) console */
scp->border = *data;
if (scp == cur_console)
set_border(cur_console, scp->border);
return 0;
}
return ENOIOCTL;
}
#endif /* NSC > 0 */

File diff suppressed because it is too large Load Diff

View File

@ -1,245 +0,0 @@
/*-
* Copyright (c) 1995-1998 Søren Schmidt
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer,
* without modification, immediately at the beginning of the file.
* 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.
* 3. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* 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.
*
* $Id: syscons.h,v 1.43 1998/09/29 02:00:57 ache Exp $
*/
#ifndef _I386_ISA_SYSCONS_H_
#define _I386_ISA_SYSCONS_H_
/* vm things */
#define ISMAPPED(pa, width) \
(((pa) <= (u_long)0x1000 - (width)) \
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
/* printable chars */
#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \
|| (ch) < 0x07)
/* macros for "intelligent" screen update */
#define mark_for_update(scp, x) {\
if ((x) < scp->start) scp->start = (x);\
else if ((x) > scp->end) scp->end = (x);\
}
#define mark_all(scp) {\
scp->start = 0;\
scp->end = scp->xsize * scp->ysize - 1;\
}
/* status flags */
#define LOCK_KEY_MASK 0x0000F
#define LED_MASK 0x00007
#define UNKNOWN_MODE 0x00010
#define KBD_RAW_MODE 0x00020
#define KBD_CODE_MODE 0x00040
#define SWITCH_WAIT_REL 0x00080
#define SWITCH_WAIT_ACQ 0x00100
#define BUFFER_SAVED 0x00200
#define CURSOR_ENABLED 0x00400
#define MOUSE_ENABLED 0x00800
#define MOUSE_MOVED 0x01000
#define MOUSE_CUTTING 0x02000
#define MOUSE_VISIBLE 0x04000
#define GRAPHICS_MODE 0x08000
#define PIXEL_MODE 0x10000
#define SAVER_RUNNING 0x20000
/* configuration flags */
#define VISUAL_BELL 0x00001
#define BLINK_CURSOR 0x00002
#define CHAR_CURSOR 0x00004
#define DETECT_KBD 0x00008
#define XT_KEYBD 0x00010
#define KBD_NORESET 0x00020
#define QUIET_BELL 0x00040
#define VESA800X600 0x00080
/* attribute flags */
#define NORMAL_ATTR 0x00
#define BLINK_ATTR 0x01
#define BOLD_ATTR 0x02
#define UNDERLINE_ATTR 0x04
#define REVERSE_ATTR 0x08
#define FOREGROUND_CHANGED 0x10
#define BACKGROUND_CHANGED 0x20
/* misc defines */
#define FALSE 0
#define TRUE 1
#define MAX_ESC_PAR 5
#define LOAD 1
#define SAVE 0
#define COL 80
#define ROW 25
#define BELL_DURATION 5
#define BELL_PITCH 800
#define CONSOLE_BUFSIZE 1024
#define PCBURST 128
#define FONT_NONE 1
#define FONT_8 2
#define FONT_14 4
#define FONT_16 8
/* special characters */
#define cntlc 0x03
#define cntld 0x04
#define bs 0x08
#define lf 0x0a
#define cr 0x0d
#define del 0x7f
#define DEAD_CHAR 0x07 /* char used for cursor */
typedef struct term_stat {
int esc; /* processing escape sequence */
int num_param; /* # of parameters to ESC */
int last_param; /* last parameter # */
int param[MAX_ESC_PAR]; /* contains ESC parameters */
int cur_attr; /* current hardware attr word */
int attr_mask; /* current logical attr mask */
int cur_color; /* current hardware color */
int std_color; /* normal hardware color */
int rev_color; /* reverse hardware color */
} term_stat;
typedef struct scr_stat {
int adp; /* video adapter index */
u_short *scr_buf; /* buffer when off screen */
int xpos; /* current X position */
int ypos; /* current Y position */
int saved_xpos; /* saved X position */
int saved_ypos; /* saved Y position */
int xsize; /* X text size */
int ysize; /* Y text size */
int xpixel; /* X graphics size */
int ypixel; /* Y graphics size */
int xoff; /* X offset in pixel mode */
int yoff; /* Y offset in pixel mode */
int font_size; /* fontsize in Y direction */
int start; /* modified area start */
int end; /* modified area end */
term_stat term; /* terminal emulation stuff */
int status; /* status (bitfield) */
u_short *cursor_pos; /* cursor buffer position */
u_short *cursor_oldpos; /* cursor old buffer position */
u_short cursor_saveunder; /* saved chars under cursor */
char cursor_start; /* cursor start line # */
char cursor_end; /* cursor end line # */
u_short *mouse_pos; /* mouse buffer position */
u_short *mouse_oldpos; /* mouse old buffer position */
short mouse_xpos; /* mouse x coordinate */
short mouse_ypos; /* mouse y coordinate */
short mouse_buttons; /* mouse buttons */
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
u_short *mouse_cut_start; /* mouse cut start pos */
u_short *mouse_cut_end; /* mouse cut end pos */
struct proc *mouse_proc; /* proc* of controlling proc */
pid_t mouse_pid; /* pid of controlling proc */
int mouse_signal; /* signal # to report with */
u_short bell_duration;
u_short bell_pitch;
u_char border; /* border color */
int initial_mode; /* initial mode */
int mode; /* mode */
pid_t pid; /* pid of controlling proc */
struct proc *proc; /* proc* of controlling proc */
struct vt_mode smode; /* switch mode */
u_short *history; /* circular history buffer */
u_short *history_head; /* current head position */
u_short *history_pos; /* position shown on screen */
u_short *history_save; /* save area index */
int history_size; /* size of history buffer */
struct apmhook r_hook; /* reconfiguration support */
#ifdef SC_SPLASH_SCREEN
int splash_save_mode; /* saved mode for splash screen */
int splash_save_status; /* saved status for splash screen */
#endif
} scr_stat;
typedef struct default_attr {
int std_color; /* normal hardware color */
int rev_color; /* reverse hardware color */
} default_attr;
#define ISTEXTSC(scp) (!((scp)->status \
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE)))
#define ISGRAPHSC(scp) (((scp)->status \
& (UNKNOWN_MODE | GRAPHICS_MODE)))
#define ISPIXELSC(scp) (((scp)->status \
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\
== PIXEL_MODE)
#define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE)
#define ISFONTAVAIL(af) ((af) & V_ADP_FONT)
#define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT)
#define ISPALAVAIL(af) ((af) & V_ADP_PALETTE)
/* misc prototypes used by different syscons related LKM's */
/* syscons.c */
extern int (*sc_user_ioctl)(dev_t dev, u_long cmd, caddr_t data, int flag,
struct proc *p);
int set_mode(scr_stat *scp);
scr_stat *sc_get_scr_stat(dev_t dev);
void copy_font(scr_stat *scp, int operation, int font_size, u_char *font_image);
void set_border(scr_stat *scp, int color);
#define save_palette(scp, pal) (*biosvidsw.save_palette)((scp)->adp, pal)
#define load_palette(scp, pal) (*biosvidsw.load_palette)((scp)->adp, pal)
#define get_adapter(scp) (*biosvidsw.adapter)((scp)->adp)
int add_scrn_saver(void (*this)(int));
int remove_scrn_saver(void (*this)(int));
void sc_clear_screen(scr_stat *scp);
void sc_move_mouse(scr_stat *scp, int x, int y);
int sc_clean_up(scr_stat *scp);
void sc_alloc_scr_buffer(scr_stat *scp, int wait, int clear);
void sc_alloc_cut_buffer(scr_stat *scp, int wait);
void sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait);
struct tty *scdevtotty(dev_t dev);
/* scvidctl.c */
int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode,
int xsize, int ysize, int fontsize);
int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode);
int sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
int xsize, int ysize, int fontsize);
int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
struct proc *p);
#ifdef SC_SPLASH_SCREEN
/* splash.c */
void scsplash(int);
int scsplash_load(scr_stat *scp);
int scsplash_unload(scr_stat *scp);
#endif
#endif /* !_I386_ISA_SYSCONS_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,104 +0,0 @@
/*-
* Copyright (c) 1998 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
* All rights reserved.
*
* 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
* notice, this list of conditions and the following disclaimer as
* the first lines of this file unmodified.
* 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.
*
* 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.
*
* $Id: videoio.h,v 1.1 1998/09/15 18:16:38 sos Exp $
*/
#ifndef _I386_ISA_VIDEOIO_H_
#define _I386_ISA_VIDEOIO_H_
#ifdef KERNEL
#define V_MAX_ADAPTERS 2
#define V_MODE_MAP_SIZE (M_VGA_CG320 + 1)
#define V_MODE_PARAM_SIZE 64
/* physical addresses */
#define MONO_BUF BIOS_PADDRTOVADDR(0xb0000)
#define CGA_BUF BIOS_PADDRTOVADDR(0xb8000)
#define GRAPHICS_BUF BIOS_PADDRTOVADDR(0xa0000)
#define VIDEOMEM 0x000A0000
/* I/O port addresses */
#define MONO_BASE 0x3B4 /* crt controller base mono */
#define COLOR_BASE 0x3D4 /* crt controller base color */
#define MISC 0x3C2 /* misc output register */
#define ATC IO_VGA+0x00 /* attribute controller */
#define TSIDX IO_VGA+0x04 /* timing sequencer idx */
#define TSREG IO_VGA+0x05 /* timing sequencer data */
#define PIXMASK IO_VGA+0x06 /* pixel write mask */
#define PALRADR IO_VGA+0x07 /* palette read address */
#define PALWADR IO_VGA+0x08 /* palette write address */
#define PALDATA IO_VGA+0x09 /* palette data register */
#define GDCIDX IO_VGA+0x0E /* graph data controller idx */
#define GDCREG IO_VGA+0x0F /* graph data controller data */
/* video function table */
typedef int vi_init_t(void);
typedef video_adapter_t *vi_adapter_t(int ad);
typedef int vi_get_info_t(int ad, int mode, video_info_t *info);
typedef int vi_query_mode_t(int ad, video_info_t *info);
typedef int vi_set_mode_t(int ad, int mode);
typedef int vi_save_font_t(int ad, int page, int size, u_char *data,
int c, int count);
typedef int vi_load_font_t(int ad, int page, int size, u_char *data,
int c, int count);
typedef int vi_show_font_t(int ad, int page);
typedef int vi_save_palette_t(int ad, u_char *palette);
typedef int vi_load_palette_t(int ad, u_char *palette);
typedef int vi_set_border_t(int ad, int border);
typedef int vi_save_state_t(int ad, void *p, size_t size);
typedef int vi_load_state_t(int ad, void *p);
typedef int vi_set_win_org_t(int ad, off_t offset);
typedef int vi_read_hw_cursor_t(int ad, int *col, int *row);
typedef int vi_set_hw_cursor_t(int ad, int col, int row);
typedef int vi_diag_t(int level);
struct vidsw {
vi_init_t *init; /* all */
vi_adapter_t *adapter; /* all */
vi_get_info_t *get_info; /* all */
vi_query_mode_t *query_mode; /* all */
vi_set_mode_t *set_mode; /* EGA/VGA */
vi_save_font_t *save_font; /* EGA/VGA */
vi_load_font_t *load_font; /* EGA/VGA */
vi_show_font_t *show_font; /* EGA/VGA */
vi_save_palette_t *save_palette; /* VGA */
vi_load_palette_t *load_palette; /* VGA */
vi_set_border_t *set_border; /* CGA/EGA/VGA */
vi_save_state_t *save_state; /* VGA */
vi_load_state_t *load_state; /* EGA/VGA */
vi_set_win_org_t *set_win_org; /* all */
vi_read_hw_cursor_t *read_hw_cursor; /* all */
vi_set_hw_cursor_t *set_hw_cursor; /* all */
vi_diag_t *diag; /* all */
};
extern struct vidsw biosvidsw;
#endif /* KERNEL */
#endif /* !_I386_ISA_VIDEOIO_H_ */