Merge with the latest i386 syscons.
This commit is contained in:
parent
888aeaaa72
commit
9604f809cd
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.8 1998/09/07 07:29:30 dfr Exp $
|
||||
# $Id: files.alpha,v 1.9 1998/09/16 08:22:09 dfr Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -138,4 +138,6 @@ isa/sio.c optional sio device-driver
|
||||
isa/kbdio.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
isa/kbdio.c optional sc device-driver
|
||||
isa/videoio.c optional sc device-driver
|
||||
isa/syscons.c optional sc device-driver
|
||||
isa/scvidctl.c optional sc device-driver
|
||||
|
@ -25,8 +25,8 @@
|
||||
* (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$
|
||||
* from: i386/include console.h,v 1.38
|
||||
* $Id: console.h,v 1.39 1998/08/06 09:15:52 dfr Exp $
|
||||
* from: i386/include console.h,v 1.39
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONSOLE_H_
|
||||
@ -52,6 +52,7 @@
|
||||
#define KDGETLED _IOR('K', 65, int)
|
||||
#define KDSETLED _IO('K', 66 /*, int */)
|
||||
#define KDSETRAD _IO('K', 67 /*, int */)
|
||||
#define KDRASTER _IOW('K', 100, scr_size_t)
|
||||
|
||||
#define GETFKEY _IOWR('k', 0, fkeyarg_t)
|
||||
#define SETFKEY _IOWR('k', 1, fkeyarg_t)
|
||||
@ -85,6 +86,11 @@
|
||||
#define GIO_FONT8x16 _IOR('c', 69, fnt16_t)
|
||||
#define CONS_GETINFO _IOWR('c', 73, vid_info_t)
|
||||
#define CONS_GETVERS _IOR('c', 74, int)
|
||||
#define CONS_CURRENTADP _IOR('c', 100, int)
|
||||
#define CONS_ADPINFO _IOWR('c', 101, video_adapter_t)
|
||||
#define CONS_MODEINFO _IOWR('c', 102, video_info_t)
|
||||
#define CONS_FINDMODE _IOWR('c', 103, video_info_t)
|
||||
#define CONS_SETWINORG _IO('c', 104 /* u_int */)
|
||||
|
||||
/* CONS_SAVERMODE */
|
||||
#define CONS_LKM_SAVER 0
|
||||
@ -170,6 +176,7 @@ struct mouse_info {
|
||||
#define KD_TEXT0 0 /* ditto */
|
||||
#define KD_TEXT1 2 /* set text mode !restore fonts */
|
||||
#define KD_GRAPHICS 1 /* set graphics mode */
|
||||
#define KD_PIXEL 3 /* set pixel mode */
|
||||
|
||||
#define K_RAW 0 /* keyboard returns scancodes */
|
||||
#define K_XLATE 1 /* keyboard returns ascii */
|
||||
@ -264,6 +271,55 @@ struct ssaver {
|
||||
long time;
|
||||
};
|
||||
|
||||
/* adapter infromation block */
|
||||
struct video_adapter {
|
||||
int va_index;
|
||||
int va_type;
|
||||
int va_flags;
|
||||
#define V_ADP_COLOR (1<<0)
|
||||
#define V_ADP_MODECHANGE (1<<1)
|
||||
#define V_ADP_STATESAVE (1<<2)
|
||||
#define V_ADP_STATELOAD (1<<3)
|
||||
#define V_ADP_FONT (1<<4)
|
||||
#define V_ADP_PALETTE (1<<5)
|
||||
#define V_ADP_BORDER (1<<6)
|
||||
#define V_ADP_VESA (1<<7)
|
||||
int va_crtc_addr;
|
||||
u_int va_window; /* virtual address */
|
||||
size_t va_window_size;
|
||||
size_t va_window_gran;
|
||||
u_int va_buffer; /* virtual address */
|
||||
size_t va_buffer_size;
|
||||
int va_initial_mode;
|
||||
int va_initial_bios_mode;
|
||||
int va_mode;
|
||||
};
|
||||
|
||||
#define V_ADP_PRIMARY 0
|
||||
#define V_ADP_SECONDARY 1
|
||||
|
||||
/* video mode information block */
|
||||
struct video_info {
|
||||
int vi_mode;
|
||||
int vi_flags;
|
||||
#define V_INFO_COLOR (1<<0)
|
||||
#define V_INFO_GRAPHICS (1<<1)
|
||||
#define V_INFO_LENEAR (1<<2)
|
||||
#define V_INFO_VESA (1<<3)
|
||||
int vi_width;
|
||||
int vi_height;
|
||||
int vi_cwidth;
|
||||
int vi_cheight;
|
||||
int vi_depth;
|
||||
int vi_planes;
|
||||
u_int vi_window; /* physical address */
|
||||
size_t vi_window_size;
|
||||
size_t vi_window_gran;
|
||||
u_int vi_buffer; /* physical address */
|
||||
size_t vi_buffer_size;
|
||||
/* XXX pixel format, memory model,... */
|
||||
};
|
||||
|
||||
typedef struct accentmap accentmap_t;
|
||||
typedef struct fkeytab fkeytab_t;
|
||||
typedef struct fkeyarg fkeyarg_t;
|
||||
@ -274,6 +330,9 @@ typedef struct {char fnt8x8[8*256];} fnt8_t;
|
||||
typedef struct {char fnt8x14[14*256];} fnt14_t;
|
||||
typedef struct {char fnt8x16[16*256];} fnt16_t;
|
||||
typedef struct ssaver ssaver_t;
|
||||
typedef struct video_adapter video_adapter_t;
|
||||
typedef struct video_info video_info_t;
|
||||
typedef struct {int scr_size[3];} scr_size_t;
|
||||
|
||||
/* defines for "special" keys (spcl bit set in keymap) */
|
||||
#define NOP 0x00 /* nothing (dead key) */
|
||||
@ -379,8 +438,6 @@ typedef struct ssaver ssaver_t;
|
||||
#define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */
|
||||
#define M_MCA_MODE 0xff /* monochrome adapter mode */
|
||||
|
||||
#define M_VESA_BASE 0x100 /* VESA mode number base */
|
||||
|
||||
#define SW_PC98_80x25 _IO('S', M_PC98_80x25)
|
||||
#define SW_PC98_80x30 _IO('S', M_PC98_80x30)
|
||||
#define SW_B40x25 _IO('S', M_B40x25)
|
||||
@ -422,4 +479,68 @@ typedef struct ssaver ssaver_t;
|
||||
#define SW_VGA_CG640 _IO('S', M_VGA_CG640)
|
||||
#define SW_VGA_MODEX _IO('S', M_VGA_MODEX)
|
||||
|
||||
#define M_VESA_BASE 0x100 /* VESA mode number base */
|
||||
|
||||
#define M_VESA_CG640x400 0x100 /* 640x400, 256 color */
|
||||
#define M_VESA_CG640x480 0x101 /* 640x480, 256 color */
|
||||
#define M_VESA_800x600 0x102 /* 800x600, 16 color */
|
||||
#define M_VESA_CG800x600 0x103 /* 800x600, 256 color */
|
||||
#define M_VESA_1024x768 0x104 /* 1024x768, 16 color */
|
||||
#define M_VESA_CG1024x768 0x105 /* 1024x768, 256 color */
|
||||
#define M_VESA_1280x1024 0x106 /* 1280x1024, 16 color */
|
||||
#define M_VESA_CG1280x1024 0x107 /* 1280x1024, 256 color */
|
||||
#define M_VESA_C80x60 0x108 /* 8x8 font */
|
||||
#define M_VESA_C132x25 0x109 /* 8x16 font */
|
||||
#define M_VESA_C132x43 0x10a /* 8x14 font */
|
||||
#define M_VESA_C132x50 0x10b /* 8x8 font */
|
||||
#define M_VESA_C132x60 0x10c /* 8x8 font */
|
||||
#define M_VESA_32K_320 0x10d /* 320x200, 5:5:5 */
|
||||
#define M_VESA_64K_320 0x10e /* 320x200, 5:6:5 */
|
||||
#define M_VESA_FULL_320 0x10f /* 320x200, 8:8:8 */
|
||||
#define M_VESA_32K_640 0x110 /* 640x480, 5:5:5 */
|
||||
#define M_VESA_64K_640 0x111 /* 640x480, 5:6:5 */
|
||||
#define M_VESA_FULL_640 0x112 /* 640x480, 8:8:8 */
|
||||
#define M_VESA_32K_800 0x113 /* 800x600, 5:5:5 */
|
||||
#define M_VESA_64K_800 0x114 /* 800x600, 5:6:5 */
|
||||
#define M_VESA_FULL_800 0x115 /* 800x600, 8:8:8 */
|
||||
#define M_VESA_32K_1024 0x116 /* 1024x768, 5:5:5 */
|
||||
#define M_VESA_64K_1024 0x117 /* 1024x768, 5:6:5 */
|
||||
#define M_VESA_FULL_1024 0x118 /* 1024x768, 8:8:8 */
|
||||
#define M_VESA_32K_1280 0x119 /* 1280x1024, 5:5:5 */
|
||||
#define M_VESA_64K_1280 0x11a /* 1280x1024, 5:6:5 */
|
||||
#define M_VESA_FULL_1280 0x11b /* 1280x1024, 8:8:8 */
|
||||
#define M_VESA_MODE_MAX 0x1ff
|
||||
#define M_VESA_USER 0x1ff
|
||||
|
||||
#define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE)
|
||||
#define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE)
|
||||
#define SW_VESA_800x600 _IO('V', M_VESA_800x600 - M_VESA_BASE)
|
||||
#define SW_VESA_CG800x600 _IO('V', M_VESA_CG800x600 - M_VESA_BASE)
|
||||
#define SW_VESA_1024x768 _IO('V', M_VESA_1024x768 - M_VESA_BASE)
|
||||
#define SW_VESA_CG1024x768 _IO('V', M_VESA_CG1024x768 - M_VESA_BASE)
|
||||
#define SW_VESA_1280x1024 _IO('V', M_VESA_1280x1024 - M_VESA_BASE)
|
||||
#define SW_VESA_CG1280x1024 _IO('V', M_VESA_CG1280x1024 - M_VESA_BASE)
|
||||
#define SW_VESA_C80x60 _IO('V', M_VESA_C80x60 - M_VESA_BASE)
|
||||
#define SW_VESA_C132x25 _IO('V', M_VESA_C132x25 - M_VESA_BASE)
|
||||
#define SW_VESA_C132x43 _IO('V', M_VESA_C132x43 - M_VESA_BASE)
|
||||
#define SW_VESA_C132x50 _IO('V', M_VESA_C132x50 - M_VESA_BASE)
|
||||
#define SW_VESA_C132x60 _IO('V', M_VESA_C132x60 - M_VESA_BASE)
|
||||
#define SW_VESA_32K_320 _IO('V', M_VESA_32K_320 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_320 _IO('V', M_VESA_64K_320 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_320 _IO('V', M_VESA_FULL_320 - M_VESA_BASE)
|
||||
#define SW_VESA_32K_640 _IO('V', M_VESA_32K_640 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_640 _IO('V', M_VESA_64K_640 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_640 _IO('V', M_VESA_FULL_640 - M_VESA_BASE)
|
||||
#define SW_VESA_32K_800 _IO('V', M_VESA_32K_800 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_800 _IO('V', M_VESA_64K_800 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_800 _IO('V', M_VESA_FULL_800 - M_VESA_BASE)
|
||||
#define SW_VESA_32K_1024 _IO('V', M_VESA_32K_1024 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_1024 _IO('V', M_VESA_64K_1024 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_1024 _IO('V', M_VESA_FULL_1024 - M_VESA_BASE)
|
||||
#define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_USER _IO('V', M_VESA_USER - M_VESA_BASE)
|
||||
|
||||
#endif /* !_MACHINE_CONSOLE_H_ */
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* $Id: bios.h,v 1.3 1998/08/06 09:15:54 dfr Exp $
|
||||
* from: i386/include/pc bios.h,v 1.2
|
||||
*/
|
||||
|
||||
@ -71,9 +71,13 @@ struct bios32_args {
|
||||
};
|
||||
extern void bios32(caddr_t func_addr, struct bios32_args *args);
|
||||
|
||||
#if 0
|
||||
#define BIOS_PADDRTOVADDR(x) (((x) - ISA_HOLE_START) + atdevbase)
|
||||
#define BIOS_VADDRTOPADDR(x) (((x) - atdevbase) + ISA_HOLE_START)
|
||||
|
||||
#else
|
||||
#define BIOS_PADDRTOVADDR(x) (x)
|
||||
#define BIOS_VADDRTOPADDR(x) (x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* System Management BIOS / Desktop Management Interface tables
|
||||
|
128
sys/alpha/include/pc/vesa.h
Normal file
128
sys/alpha/include/pc/vesa.h
Normal file
@ -0,0 +1,128 @@
|
||||
/*-
|
||||
* 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.
|
||||
* 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 REGENTS 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 REGENTS 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$
|
||||
* from: i386/include/pc vesa.h,v 1.1
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_PC_VESA_H
|
||||
#define _MACHINE_PC_VESA_H
|
||||
|
||||
struct vesa_info
|
||||
{
|
||||
/* mandatory fields */
|
||||
u_int8_t v_sig[4] __attribute__ ((packed)); /* VESA */
|
||||
u_int16_t v_version __attribute__ ((packed)); /* ver in BCD */
|
||||
u_int32_t v_oemstr __attribute__ ((packed)); /* OEM string */
|
||||
u_int32_t v_flags __attribute__ ((packed)); /* flags */
|
||||
#define V_DAC8 (1<<0)
|
||||
#define V_NONVGA (1<<1)
|
||||
#define V_SNOW (1<<2)
|
||||
u_int32_t v_modetable __attribute__ ((packed)); /* modes */
|
||||
u_int16_t v_memsize __attribute__ ((packed)); /* in 64K */
|
||||
/* 2.0 */
|
||||
u_int16_t v_revision __attribute__ ((packed)); /* software rev */
|
||||
u_int32_t v_venderstr __attribute__ ((packed)); /* vender */
|
||||
u_int32_t v_prodstr __attribute__ ((packed)); /* product name */
|
||||
u_int32_t v_revstr __attribute__ ((packed)); /* product rev */
|
||||
};
|
||||
|
||||
struct vesa_mode
|
||||
{
|
||||
/* mandatory fields */
|
||||
u_int16_t v_modeattr;
|
||||
#define V_MODESUPP (1<<0) /* VESA mode attributes */
|
||||
#define V_MODEOPTINFO (1<<1)
|
||||
#define V_MODEBIOSOUT (1<<2)
|
||||
#define V_MODECOLOR (1<<3)
|
||||
#define V_MODEGRAPHICS (1<<4)
|
||||
#define V_MODENONVGA (1<<5)
|
||||
#define V_MODENONBANK (1<<6)
|
||||
#define V_MODELFB (1<<7)
|
||||
#define V_MODEVESA (1<<16) /* Private attributes */
|
||||
u_int8_t v_waattr;
|
||||
u_int8_t v_wbattr;
|
||||
#define V_WATTREXIST (1<<0)
|
||||
#define V_WATTRREAD (1<<1)
|
||||
#define V_WATTRWRITE (1<<2)
|
||||
u_int16_t v_wgran;
|
||||
u_int16_t v_wsize;
|
||||
u_int16_t v_waseg;
|
||||
u_int16_t v_wbseg;
|
||||
u_int32_t v_posfunc;
|
||||
u_int16_t v_bpscanline;
|
||||
/* fields optional for 1.0/1.1 implementations */
|
||||
u_int16_t v_width;
|
||||
u_int16_t v_height;
|
||||
u_int8_t v_cwidth;
|
||||
u_int8_t v_cheight;
|
||||
u_int8_t v_planes;
|
||||
u_int8_t v_bpp;
|
||||
u_int8_t v_banks;
|
||||
u_int8_t v_memmodel;
|
||||
#define V_MMTEXT 0
|
||||
#define V_MMCGA 1
|
||||
#define V_MMHGC 2
|
||||
#define V_MMEGA 3
|
||||
#define V_MMPACKED 4
|
||||
#define V_MMSEQU256 5
|
||||
#define V_MMDIRCOLOR 6
|
||||
#define V_MMYUV 7
|
||||
u_int8_t v_banksize;
|
||||
u_int8_t v_ipages;
|
||||
u_int8_t v_reserved0;
|
||||
/* fields for 1.2+ implementations */
|
||||
u_int8_t v_redmasksize;
|
||||
u_int8_t v_redfieldpos;
|
||||
u_int8_t v_greenmasksize;
|
||||
u_int8_t v_greenfieldpos;
|
||||
u_int8_t v_bluemasksize;
|
||||
u_int8_t v_bluefieldpos;
|
||||
u_int8_t v_resmasksize;
|
||||
u_int8_t v_resfieldpos;
|
||||
u_int8_t v_dircolormode;
|
||||
/* 2.0 implementations */
|
||||
u_int32_t v_lfb;
|
||||
u_int32_t v_offscreen;
|
||||
u_int8_t v_offscreensize;
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#define VESA_MODE(x) ((x) >= M_VESA_BASE)
|
||||
|
||||
int vesa_load_ioctl(void);
|
||||
int vesa_unload_ioctl(void);
|
||||
|
||||
#ifndef VESA_MODULE
|
||||
int vesa_load(void);
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_MACHINE_PC_VESA_H */
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.8 1998/09/07 07:29:30 dfr Exp $
|
||||
# $Id: files.alpha,v 1.9 1998/09/16 08:22:09 dfr Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -138,4 +138,6 @@ isa/sio.c optional sio device-driver
|
||||
isa/kbdio.c optional psm device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
isa/kbdio.c optional sc device-driver
|
||||
isa/videoio.c optional sc device-driver
|
||||
isa/syscons.c optional sc device-driver
|
||||
isa/scvidctl.c optional sc device-driver
|
||||
|
489
sys/isa/scvidctl.c
Normal file
489
sys/isa/scvidctl.c
Normal file
@ -0,0 +1,489 @@
|
||||
/*-
|
||||
* 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.
|
||||
* 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 REGENTS 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 REGENTS 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$
|
||||
* from: i386/isa scvidctl.c,v 1.1
|
||||
*/
|
||||
|
||||
#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>
|
||||
|
||||
#ifdef __i386__
|
||||
#include <machine/apm_bios.h>
|
||||
#endif
|
||||
#include <machine/console.h>
|
||||
|
||||
#include <isa/videoio.h>
|
||||
#include <isa/syscons.h>
|
||||
|
||||
/* video ioctl */
|
||||
|
||||
extern scr_stat *cur_console;
|
||||
extern u_int32_t Crtat;
|
||||
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(): Crtat:%x, %dx%d, xoff:%d, yoff:%d\n",
|
||||
Crtat, info.vi_width, info.vi_height,
|
||||
(info.vi_width/8 - xsize)/2,
|
||||
(info.vi_height/fontsize - ysize)/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* 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);
|
||||
|
||||
/* FIXME */
|
||||
if (scp == cur_console)
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
|
||||
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);
|
||||
|
||||
/* 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 (*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);
|
||||
/* FIXME */
|
||||
if (scp->status & PIXEL_MODE)
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
}
|
||||
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 & PIXEL_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);
|
||||
/* FIXME */
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
}
|
||||
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 */
|
1855
sys/isa/syscons.c
1855
sys/isa/syscons.c
File diff suppressed because it is too large
Load Diff
@ -1,18 +1,18 @@
|
||||
/*-
|
||||
* Copyright (c) 1995-1997 Søren Schmidt
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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
|
||||
* 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
|
||||
@ -25,8 +25,8 @@
|
||||
* (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$
|
||||
* from: i386/isa syscons.h,v 1.39
|
||||
* $Id: syscons.h,v 1.40 1998/08/06 09:15:53 dfr Exp $
|
||||
* from: i386/isa syscons.h,v 1.40
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
@ -77,6 +77,9 @@
|
||||
#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
|
||||
@ -86,6 +89,7 @@
|
||||
#define XT_KEYBD 0x00010
|
||||
#define KBD_NORESET 0x00020
|
||||
#define QUIET_BELL 0x00040
|
||||
#define VESA800X600 0x00080
|
||||
|
||||
/* attribute flags */
|
||||
#define NORMAL_ATTR 0x00
|
||||
@ -96,9 +100,6 @@
|
||||
#define FOREGROUND_CHANGED 0x10
|
||||
#define BACKGROUND_CHANGED 0x20
|
||||
|
||||
/* video hardware memory addresses */
|
||||
#define VIDEOMEM 0x000A0000
|
||||
|
||||
/* misc defines */
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
@ -116,20 +117,6 @@
|
||||
#define FONT_14 4
|
||||
#define FONT_16 8
|
||||
|
||||
/* defines related to hardware 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 */
|
||||
|
||||
/* special characters */
|
||||
#define cntlc 0x03
|
||||
#define cntld 0x04
|
||||
@ -153,6 +140,7 @@ typedef struct term_stat {
|
||||
} 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 */
|
||||
@ -162,6 +150,8 @@ typedef struct scr_stat {
|
||||
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 */
|
||||
@ -200,7 +190,8 @@ typedef struct scr_stat {
|
||||
struct apmhook r_hook; /* reconfiguration support */
|
||||
#endif
|
||||
#ifdef SC_SPLASH_SCREEN
|
||||
u_char splash_save_mode; /* saved mode for splash screen */
|
||||
int splash_save_mode; /* saved mode for splash screen */
|
||||
int splash_save_status; /* saved status for splash screen */
|
||||
#endif
|
||||
} scr_stat;
|
||||
|
||||
@ -209,18 +200,59 @@ typedef struct default_attr {
|
||||
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 */
|
||||
void set_border(u_char color);
|
||||
void set_mode(scr_stat *scp);
|
||||
void copy_font(int operation, int font_type, char* font_image);
|
||||
void load_palette(char *palette);
|
||||
|
||||
/* syscons.c */
|
||||
extern int (*sc_user_ioctl)(dev_t dev, int 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);
|
||||
#define save_palette(scp, pal) (*biosvidsw.save_palette)((scp)->adp, pal)
|
||||
#define load_palette(scp, pal) (*biosvidsw.load_palette)((scp)->adp, pal)
|
||||
#define set_border(scp, col) (*biosvidsw.set_border)((scp)->adp, col)
|
||||
#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);
|
||||
|
||||
/* 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
|
||||
void splash(int);
|
||||
int splash_load(void);
|
||||
int splash_unload(void);
|
||||
/* splash.c */
|
||||
void scsplash(int);
|
||||
int scsplash_load(scr_stat *scp);
|
||||
int scsplash_unload(scr_stat *scp);
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_ISA_SYSCONS_H_ */
|
||||
|
1628
sys/isa/videoio.c
Normal file
1628
sys/isa/videoio.c
Normal file
File diff suppressed because it is too large
Load Diff
108
sys/isa/videoio.h
Normal file
108
sys/isa/videoio.h
Normal file
@ -0,0 +1,108 @@
|
||||
/*-
|
||||
* 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.
|
||||
* 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 REGENTS 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 REGENTS 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$
|
||||
* from: i386/isa/videoio.h,v 1.1
|
||||
*/
|
||||
|
||||
#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_ */
|
Loading…
Reference in New Issue
Block a user