The first stage of console driver reorganization: activate new
keyboard and video card drivers. Because of the changes, you are required to update your kernel configuration file now! The files in sys/dev/syscons are still i386-specific (but less so than before), and won't compile for alpha and PC98 yet. syscons still directly accesses the video card registers here and there; this will be rectified in the later stages.
This commit is contained in:
parent
d284e574fb
commit
e6aea5404a
@ -11,7 +11,7 @@
|
||||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC,v 1.141 1999/01/01 08:09:57 peter Exp $
|
||||
# $Id: GENERIC,v 1.142 1999/01/09 18:12:07 wpaul Exp $
|
||||
|
||||
machine "i386"
|
||||
cpu "I386_CPU"
|
||||
@ -108,10 +108,20 @@ controller matcd0 at isa? port 0x230 bio
|
||||
|
||||
device scd0 at isa? port 0x230 bio
|
||||
|
||||
# atkbdc0 controlls both the keyboard and the PS/2 mouse
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device psm0 at isa? tty irq 12
|
||||
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
# splash screen/screen saver
|
||||
pseudo-device splash
|
||||
|
||||
# syscons is the default console driver, resembling an SCO console
|
||||
device sc0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device sc0 at isa? tty
|
||||
# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
|
||||
#device vt0 at isa? port IO_KBD conflicts tty irq 1
|
||||
#device vt0 at isa? tty
|
||||
#options XSERVER # support for X server
|
||||
#options FAT_CURSOR # start with block cursor
|
||||
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
|
||||
@ -136,8 +146,6 @@ device sio3 at isa? disable port "IO_COM4" tty irq 9
|
||||
|
||||
device lpt0 at isa? port? tty irq 7
|
||||
|
||||
device psm0 at isa? port IO_KBD conflicts tty irq 12
|
||||
|
||||
# Order is important here due to intrusive probes, do *not* alphabetize
|
||||
# this list of network interfaces until the probes have been fixed.
|
||||
# Right now it appears that the ie0 must be probed before ep0. See
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.529 1999/01/09 18:12:07 wpaul Exp $
|
||||
# $Id: LINT,v 1.531 1999/01/10 07:45:33 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -842,15 +842,35 @@ options "NTIMECOUNTER=20"
|
||||
# configure cards from USERCONFIG. See pnp(4) for more info.
|
||||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
# The video card driver.
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
# Splash screen at start up! Screen savers require this too.
|
||||
pseudo-device splash
|
||||
|
||||
# The pcvt console driver (vt220 compatible).
|
||||
device vt0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device vt0 at isa? tty
|
||||
options XSERVER # support for running an X server.
|
||||
options FAT_CURSOR # start with block cursor
|
||||
# This PCVT option is for keyboards such as those used on IBM ThinkPad laptops
|
||||
options PCVT_SCANSET=2 # IBM keyboards are non-std
|
||||
|
||||
# The syscons console driver (sco color console compatible).
|
||||
device sc0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device sc0 at isa? tty
|
||||
options MAXCONS=16 # number of virtual consoles
|
||||
options SLOW_VGA # do byte-wide i/o's to TS and GDC regs
|
||||
options "STD8X16FONT" # Compile font in
|
||||
@ -1050,7 +1070,7 @@ disk fd0 at fdc0 drive 0
|
||||
disk fd1 at fdc0 drive 1
|
||||
|
||||
#
|
||||
# Other standard PC hardware: `lpt', `mse', `psm', `sio', etc.
|
||||
# Other standard PC hardware: `lpt', `mse', `sio', etc.
|
||||
#
|
||||
# lpt: printer port
|
||||
# lpt specials:
|
||||
@ -1059,18 +1079,11 @@ disk fd1 at fdc0 drive 1
|
||||
# The irq clause may be omitted. This will force the port
|
||||
# into polling mode.
|
||||
# mse: Logitech and ATI InPort bus mouse ports
|
||||
# psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd]
|
||||
# sio: serial ports (see sio(4))
|
||||
|
||||
device lpt0 at isa? port? tty irq 7
|
||||
device lpt1 at isa? port "IO_LPT3" tty irq 5
|
||||
device mse0 at isa? port 0x23c tty irq 5
|
||||
device psm0 at isa? port IO_KBD conflicts tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.216 1998/12/31 08:17:08 luigi Exp $
|
||||
# $Id: files.i386,v 1.217 1999/01/01 08:09:58 peter Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -24,6 +24,17 @@ font8x16.o optional std8x16font \
|
||||
no-implicit-rule before-depend \
|
||||
clean "${STD8X16FONT}-8x16 font8x16.c"
|
||||
#
|
||||
dev/fb/fb.c optional fb device-driver
|
||||
dev/fb/fb.c optional vga device-driver
|
||||
dev/fb/splash.c optional splash
|
||||
dev/kbd/atkbd.c optional atkbd device-driver
|
||||
dev/kbd/atkbdc.c optional atkbdc device-driver
|
||||
dev/kbd/kbd.c optional atkbd device-driver
|
||||
dev/kbd/kbd.c optional kbd device-driver
|
||||
#dev/kbd/kbd.c optional ukbd device-driver
|
||||
dev/syscons/syscons.c optional sc device-driver
|
||||
dev/syscons/scvidctl.c optional sc device-driver
|
||||
dev/syscons/scvesactl.c optional sc device-driver
|
||||
i386/apm/apm.c optional apm device-driver
|
||||
i386/apm/apm_setup.s optional apm
|
||||
i386/eisa/dpt_eisa.c optional eisa dpt device-driver
|
||||
@ -98,6 +109,8 @@ i386/isa/aha_isa.c optional aha device-driver
|
||||
#i386/isa/aic6360.c optional aic device-driver
|
||||
i386/isa/aic_isa.c optional aic device-driver
|
||||
i386/isa/alog.c optional alog device-driver
|
||||
i386/isa/atkbd_isa.c optional atkbd device-driver
|
||||
i386/isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
i386/isa/clock.c standard
|
||||
i386/isa/cronyx.c optional cx device-driver
|
||||
@ -133,9 +146,6 @@ i386/isa/intr_machdep.c standard
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/istallion.c optional stli device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
i386/isa/kbdio.c optional psm device-driver
|
||||
i386/isa/kbdio.c optional sc device-driver
|
||||
i386/isa/kbdio.c optional vt device-driver
|
||||
i386/isa/loran.c optional loran device-driver
|
||||
i386/isa/lpt.c optional lpt device-driver
|
||||
i386/isa/labpc.c optional labpc device-driver
|
||||
@ -235,11 +245,8 @@ i386/isa/sound/cs4232.c optional css device-driver
|
||||
i386/isa/spigot.c optional spigot device-driver
|
||||
i386/isa/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
i386/isa/syscons.c optional sc device-driver
|
||||
i386/isa/scvidctl.c optional sc device-driver
|
||||
i386/isa/scvesactl.c optional sc device-driver
|
||||
i386/isa/videoio.c optional sc device-driver
|
||||
i386/isa/vesa.c optional sc device-driver
|
||||
i386/isa/vesa.c optional vga device-driver
|
||||
i386/isa/vga_isa.c optional vga device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
i386/isa/wd.c optional wdc device-driver
|
||||
i386/isa/wd.c optional wd device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.i386,v 1.101 1999/01/01 08:09:58 peter Exp $
|
||||
# $Id: options.i386,v 1.102 1999/01/10 17:41:33 nsouch Exp $
|
||||
|
||||
DISABLE_PSE
|
||||
IDE_DELAY
|
||||
@ -66,16 +66,26 @@ I486_CPU opt_global.h
|
||||
I586_CPU opt_global.h
|
||||
I686_CPU opt_global.h
|
||||
|
||||
SC_SPLASH_SCREEN opt_syscons.h
|
||||
MAXCONS opt_syscons.h
|
||||
SLOW_VGA opt_syscons.h
|
||||
# obsolete, use VGA_SLOW_IOACCESS
|
||||
#SLOW_VGA opt_syscons.h
|
||||
STD8X16FONT opt_syscons.h
|
||||
SC_HISTORY_SIZE opt_syscons.h
|
||||
SC_DISABLE_REBOOT opt_syscons.h
|
||||
SC_MOUSE_CHAR opt_syscons.h
|
||||
SC_ALT_SEQACCESS opt_syscons.h
|
||||
# obsolete, use VGA_ALT_SEQACCESS
|
||||
#SC_ALT_SEQACCESS opt_syscons.h
|
||||
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
VGA_ALT_SEQACCESS opt_vga.h
|
||||
VGA_DEBUG opt_vga.h
|
||||
VGA_NO_FONT_LOADING opt_vga.h
|
||||
VGA_NO_MODE_CHANGE opt_vga.h
|
||||
VGA_SLOW_IOACCESS opt_vga.h
|
||||
|
||||
VESA opt_vesa.h
|
||||
VESA_DEBUG opt_vesa.h
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
PSM_RESETAFTERSUSPEND opt_psm.h
|
||||
@ -83,10 +93,11 @@ PSM_DEBUG opt_psm.h
|
||||
|
||||
PCIC_RESUME_RESET opt_pcic.h
|
||||
|
||||
KBD_RESETDELAY opt_kbdio.h
|
||||
KBD_MAXRETRY opt_kbdio.h
|
||||
KBD_MAXWAIT opt_kbdio.h
|
||||
KBDIO_DEBUG opt_kbdio.h
|
||||
KBD_INSTALL_CDEV opt_kbd.h
|
||||
KBD_MAXRETRY opt_kbd.h
|
||||
KBD_MAXWAIT opt_kbd.h
|
||||
KBD_RESETDELAY opt_kbd.h
|
||||
KBDIO_DEBUG opt_kbd.h
|
||||
|
||||
ATAPI opt_atapi.h
|
||||
ATAPI_STATIC opt_atapi.h
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: blank_saver.c,v 1.13 1998/09/17 19:40:29 sos Exp $
|
||||
* $Id: blank_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -33,18 +33,18 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/fb/vgareg.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
blank_saver(int blank)
|
||||
static int
|
||||
blank_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
u_char val;
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
|
||||
@ -53,18 +53,18 @@ blank_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x25);
|
||||
outb(adp->va_crtc_addr + 4, 0x25);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x21);
|
||||
outb(adp->va_crtc_addr + 4, 0x21);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
|
||||
@ -73,24 +73,23 @@ blank_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x2d);
|
||||
outb(adp->va_crtc_addr + 4, 0x2d);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x29);
|
||||
outb(adp->va_crtc_addr + 4, 0x29);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
blank_saver_load(void)
|
||||
blank_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -101,13 +100,17 @@ blank_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(blank_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
blank_saver_unload(void)
|
||||
blank_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(blank_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(blank_saver);
|
||||
static scrn_saver_t blank_module = {
|
||||
"blank_saver", blank_init, blank_term, blank_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(blank_saver, blank_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: daemon_saver.c,v 1.11 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: daemon_saver.c,v 1.12 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -49,6 +49,7 @@
|
||||
static char *message;
|
||||
static int messagelen;
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
/* Who is the author of this ASCII pic? */
|
||||
|
||||
@ -184,8 +185,8 @@ draw_string(int xpos, int ypos, int xoff, char *s, int len)
|
||||
scr_map[s[x]]|(FG_LIGHTGREEN|BG_BLACK)<<8;
|
||||
}
|
||||
|
||||
static void
|
||||
daemon_saver(int blank)
|
||||
static int
|
||||
daemon_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int txpos = 10, typos = 10;
|
||||
static int txdir = -1, tydir = -1;
|
||||
@ -198,20 +199,19 @@ daemon_saver(int blank)
|
||||
int min, max;
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked == 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (blanked == 0) {
|
||||
window = (u_short *)adp->va_window;
|
||||
/* clear the screen and set the border color */
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
xlen = ylen = tlen = 0;
|
||||
}
|
||||
if (scrn_blanked++ < 2)
|
||||
return;
|
||||
scrn_blanked = 1;
|
||||
if (blanked++ < 2)
|
||||
return 0;
|
||||
blanked = 1;
|
||||
|
||||
clear_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
|
||||
clear_string(txpos, typos, toff, (char *)message, tlen);
|
||||
@ -322,39 +322,31 @@ daemon_saver(int blank)
|
||||
draw_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
|
||||
draw_string(txpos, typos, toff, (char *)message, tlen);
|
||||
} else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
daemon_saver_load(void)
|
||||
daemon_init(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 +
|
||||
strlen(osrelease);
|
||||
message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
|
||||
sprintf(message, "%s - %s %s", hostname, ostype, osrelease);
|
||||
|
||||
err = add_scrn_saver(daemon_saver);
|
||||
if (err != 0)
|
||||
free(message, M_DEVBUF);
|
||||
return err;
|
||||
blanked = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
daemon_saver_unload(void)
|
||||
daemon_term(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = remove_scrn_saver(daemon_saver);
|
||||
if (err == 0)
|
||||
free(message, M_DEVBUF);
|
||||
return err;
|
||||
free(message, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(daemon_saver);
|
||||
static scrn_saver_t daemon_module = {
|
||||
"daemon_saver", daemon_init, daemon_term, daemon_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(daemon_saver, daemon_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: fade_saver.c,v 1.14 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: fade_saver.c,v 1.15 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -37,18 +37,22 @@
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
fade_saver(int blank)
|
||||
static u_char palette[256*3];
|
||||
static int blanked;
|
||||
|
||||
static int
|
||||
fade_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int count = 0;
|
||||
u_char pal[256*3];
|
||||
int i;
|
||||
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
blanked = TRUE;
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
if (count <= 0)
|
||||
save_palette(adp, palette);
|
||||
if (count < 64) {
|
||||
pal[0] = pal[1] = pal[2] = 0;
|
||||
for (i = 3; i < 256*3; i++) {
|
||||
@ -57,7 +61,7 @@ fade_saver(int blank)
|
||||
else
|
||||
pal[i] = 60;
|
||||
}
|
||||
load_palette(cur_console, pal);
|
||||
load_palette(adp, pal);
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
@ -65,44 +69,44 @@ fade_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x25);
|
||||
outb(adp->va_crtc_addr + 4, 0x25);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x21);
|
||||
outb(adp->va_crtc_addr + 4, 0x21);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
load_palette(cur_console, palette);
|
||||
load_palette(adp, palette);
|
||||
count = 0;
|
||||
break;
|
||||
case KD_EGA:
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x2d);
|
||||
outb(adp->va_crtc_addr + 4, 0x2d);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x29);
|
||||
outb(adp->va_crtc_addr + 4, 0x29);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
blanked = FALSE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fade_saver_load(void)
|
||||
fade_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -117,13 +121,18 @@ fade_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(fade_saver);
|
||||
blanked = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fade_saver_unload(void)
|
||||
fade_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(fade_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(fade_saver);
|
||||
static scrn_saver_t fade_module = {
|
||||
"fade_saver", fade_init, fade_term, fade_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(fade_saver, fade_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: green_saver.c,v 1.13 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: green_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -33,18 +33,21 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/fb/vgareg.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
green_saver(int blank)
|
||||
static int
|
||||
green_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
int crtc_addr;
|
||||
u_char val;
|
||||
|
||||
crtc_addr = adp->va_crtc_addr;
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
|
||||
@ -66,7 +69,7 @@ green_saver(int blank)
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
|
||||
@ -86,15 +89,14 @@ green_saver(int blank)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
green_saver_load(void)
|
||||
green_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -109,13 +111,17 @@ green_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(green_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
green_saver_unload(void)
|
||||
green_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(green_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(green_saver);
|
||||
static scrn_saver_t green_module = {
|
||||
"green_saver", green_init, green_term, green_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(green_saver, green_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: logo_saver.c,v 1.1 1998/12/28 14:22:57 des Exp $
|
||||
* $Id: logo_saver.c,v 1.2 1999/01/01 14:40:49 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,26 +34,24 @@
|
||||
#include <sys/module.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int banksize, scrmode, scrw, scrh;
|
||||
static u_char save_pal[768];
|
||||
static int blanked;
|
||||
|
||||
#include "logo.c"
|
||||
|
||||
#define set_origin(scp, o) (*biosvidsw.set_win_org)((scp)->adp, o)
|
||||
#define set_origin(adp, o) (*vidsw[(adp)->va_index]->set_win_org)(adp, o)
|
||||
|
||||
static void
|
||||
logo_blit(int x, int y)
|
||||
logo_blit(video_adapter_t *adp, int x, int y)
|
||||
{
|
||||
int d, l, o, p;
|
||||
|
||||
for (o = 0, p = y * scrw + x; p > banksize; p -= banksize)
|
||||
o += banksize;
|
||||
set_origin(cur_console, o);
|
||||
set_origin(adp, o);
|
||||
|
||||
for (d = 0; d < sizeof logo_img; d += logo_w) {
|
||||
if (p + logo_w < banksize) {
|
||||
@ -62,12 +60,12 @@ logo_blit(int x, int y)
|
||||
} else if (p < banksize) {
|
||||
l = banksize - p;
|
||||
bcopy(logo_img + d, vid + p, l);
|
||||
set_origin(cur_console, (o += banksize));
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d + l, vid, logo_w - l);
|
||||
p += scrw - banksize;
|
||||
} else {
|
||||
p -= banksize;
|
||||
set_origin(cur_console, (o += banksize));
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += scrw;
|
||||
}
|
||||
@ -75,7 +73,7 @@ logo_blit(int x, int y)
|
||||
}
|
||||
|
||||
static void
|
||||
logo_update(void)
|
||||
logo_update(video_adapter_t *adp)
|
||||
{
|
||||
static int xpos = 0, ypos = 0;
|
||||
static int xinc = 1, yinc = 1;
|
||||
@ -89,62 +87,42 @@ logo_update(void)
|
||||
ypos += yinc;
|
||||
|
||||
/* XXX Relies on margin around logo to erase trail */
|
||||
logo_blit(xpos, ypos);
|
||||
logo_blit(adp, xpos, ypos);
|
||||
}
|
||||
|
||||
static void
|
||||
logo_saver(int blank)
|
||||
static int
|
||||
logo_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int i, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = scrmode;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, (char *)save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, (char *)logo_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, scrmode, logo_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
for (i = 0; i < scrw*scrh; i += banksize) {
|
||||
set_origin(scp, i);
|
||||
set_origin(adp, i);
|
||||
bzero(vid, banksize);
|
||||
}
|
||||
}
|
||||
logo_update();
|
||||
logo_update(adp);
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, (char *)save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
logo_saver_load(void)
|
||||
logo_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int adp;
|
||||
|
||||
adp = cur_console->adp;
|
||||
if (!(*biosvidsw.get_info)(adp, M_VESA_CG800x600, &info)) {
|
||||
if (!get_mode_info(adp, M_VESA_CG800x600, &info)) {
|
||||
scrmode = M_VESA_CG800x600;
|
||||
} else if (!(*biosvidsw.get_info)(adp, M_VGA_CG320, &info)) {
|
||||
} else if (!get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
scrmode = M_VGA_CG320;
|
||||
} else {
|
||||
log(LOG_NOTICE, "logo_saver: no suitable graphics mode\n");
|
||||
@ -154,14 +132,19 @@ logo_saver_load(void)
|
||||
banksize = info.vi_window_size;
|
||||
scrw = info.vi_width;
|
||||
scrh = info.vi_height;
|
||||
blanked = 0;
|
||||
|
||||
return add_scrn_saver(logo_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
logo_saver_unload(void)
|
||||
logo_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(logo_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(logo_saver);
|
||||
static scrn_saver_t logo_module = {
|
||||
"logo_saver", logo_init, logo_term, logo_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(logo_saver, logo_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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$
|
||||
* $Id: rain_saver.c,v 1.1 1998/12/31 13:41:40 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,7 +34,6 @@
|
||||
#include <sys/module.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/random.h>
|
||||
|
||||
#include <saver.h>
|
||||
@ -45,11 +44,11 @@ static u_char *vid;
|
||||
#define SCRH 200
|
||||
#define MAX 63
|
||||
|
||||
static u_char save_pal[768];
|
||||
static u_char rain_pal[768];
|
||||
static int blanked;
|
||||
|
||||
static void
|
||||
rain_update(void)
|
||||
rain_update(video_adapter_t *adp)
|
||||
{
|
||||
int i, t;
|
||||
|
||||
@ -57,28 +56,21 @@ rain_update(void)
|
||||
for (i = (MAX*3+2); i > 5; i -= 3)
|
||||
rain_pal[i] = rain_pal[i-3];
|
||||
rain_pal[5] = t;
|
||||
load_palette(cur_console, rain_pal);
|
||||
load_palette(adp, rain_pal);
|
||||
}
|
||||
|
||||
static void
|
||||
rain_saver(int blank)
|
||||
static int
|
||||
rain_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int i, j, k, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = M_VGA_CG320;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, rain_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, M_VGA_CG320, rain_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
for (i = 0; i < SCRW; i += 2)
|
||||
@ -89,33 +81,22 @@ rain_saver(int blank)
|
||||
}
|
||||
|
||||
/* update display */
|
||||
rain_update();
|
||||
rain_update(adp);
|
||||
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rain_saver_load(void)
|
||||
rain_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int i;
|
||||
|
||||
/* check that the console is capable of running in 320x200x256 */
|
||||
if ((*biosvidsw.get_info)(cur_console->adp, M_VGA_CG320, &info)) {
|
||||
if (get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
log(LOG_NOTICE, "rain_saver: the console does not support M_VGA_CG320\n");
|
||||
return ENODEV;
|
||||
}
|
||||
@ -124,13 +105,19 @@ rain_saver_load(void)
|
||||
for (i = 3; i < (MAX+1)*3; i += 3)
|
||||
rain_pal[i+2] = rain_pal[i-1] + 4;
|
||||
|
||||
return add_scrn_saver(rain_saver);
|
||||
blanked = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rain_saver_unload(void)
|
||||
rain_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(rain_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(rain_saver);
|
||||
static scrn_saver_t rain_module = {
|
||||
"rain_saver", rain_init, rain_term, rain_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(rain_saver, rain_module);
|
||||
|
@ -23,14 +23,21 @@
|
||||
* (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 $
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
#include "vga.h"
|
||||
#include "opt_syscons.h"
|
||||
#include "opt_vga.h"
|
||||
#include "opt_vesa.h"
|
||||
#include "opt_vm86.h"
|
||||
|
||||
#if (NSC > 0 && defined(VESA) && defined(VM86)) || defined(KLD_MODULE)
|
||||
#ifdef VGA_NO_MODE_CHANGE
|
||||
#undef VESA
|
||||
#endif
|
||||
|
||||
#if (NSC > 0 && NVGA > 0 && defined(VESA) && defined(VM86)) || defined(KLD_MODULE)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -42,8 +49,8 @@
|
||||
#include <machine/console.h>
|
||||
#include <machine/pc/vesa.h>
|
||||
|
||||
#include <i386/isa/videoio.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
#include <dev/fb/fbreg.h>
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
static d_ioctl_t *prev_user_ioctl;
|
||||
|
||||
@ -52,7 +59,6 @@ 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);
|
||||
@ -66,8 +72,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
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))
|
||||
if (!(scp->adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
|
||||
|
||||
@ -77,8 +82,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
case SW_VESA_C132x43:
|
||||
case SW_VESA_C132x50:
|
||||
case SW_VESA_C132x60:
|
||||
adp = get_adapter(scp);
|
||||
if (!(adp->va_flags & V_ADP_MODECHANGE))
|
||||
if (!(scp->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);
|
||||
@ -104,8 +108,7 @@ vesa_ioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
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))
|
||||
if (!(scp->adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
mode = (cmd & 0xff) + M_VESA_BASE;
|
||||
return sc_set_graphics_mode(scp, tp, mode);
|
||||
@ -137,4 +140,4 @@ vesa_unload_ioctl(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* (NSC > 0 && VESA && VM86) || KLD_MODULE */
|
||||
#endif /* (NSC > 0 && NVGA > 0 && VESA && VM86) || KLD_MODULE */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* (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 $
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
@ -40,11 +40,36 @@
|
||||
#include <machine/apm_bios.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
#include <i386/isa/videoio.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
#include <dev/fb/fbreg.h>
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
/* video ioctl */
|
||||
/* for compatibility with previous versions */
|
||||
typedef struct old_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;
|
||||
} old_video_adapter_t;
|
||||
|
||||
#define OLD_CONS_ADPINFO _IOWR('c', 101, old_video_adapter_t)
|
||||
|
||||
/* variables */
|
||||
extern scr_stat *cur_console;
|
||||
extern int fonts_loaded;
|
||||
extern int sc_history_size;
|
||||
@ -54,15 +79,13 @@ 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))
|
||||
if ((*vidsw[scp->ad]->get_info)(scp->adp, mode, &info))
|
||||
return ENODEV;
|
||||
adp = get_adapter(scp);
|
||||
|
||||
/* adjust argument values */
|
||||
if (fontsize <= 0)
|
||||
@ -108,12 +131,14 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
|
||||
scp->font_size = fontsize;
|
||||
scp->xsize = xsize;
|
||||
scp->ysize = ysize;
|
||||
scp->xoff = 0;
|
||||
scp->yoff = 0;
|
||||
scp->xpixel = scp->xsize*8;
|
||||
scp->ypixel = scp->ysize*fontsize;
|
||||
|
||||
/* allocate buffers */
|
||||
sc_alloc_scr_buffer(scp, TRUE, TRUE);
|
||||
if (ISMOUSEAVAIL(adp->va_flags))
|
||||
if (ISMOUSEAVAIL(scp->adp->va_flags))
|
||||
sc_alloc_cut_buffer(scp, FALSE);
|
||||
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
|
||||
splx(s);
|
||||
@ -137,14 +162,12 @@ sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
|
||||
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))
|
||||
if ((*vidsw[scp->ad]->get_info)(scp->adp, mode, &info))
|
||||
return ENODEV;
|
||||
adp = get_adapter(scp);
|
||||
|
||||
/* stop screen saver, etc */
|
||||
s = spltty();
|
||||
@ -157,6 +180,8 @@ sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
|
||||
scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE);
|
||||
scp->status &= ~PIXEL_MODE;
|
||||
scp->mode = mode;
|
||||
scp->xoff = 0;
|
||||
scp->yoff = 0;
|
||||
scp->xpixel = info.vi_width;
|
||||
scp->ypixel = info.vi_height;
|
||||
scp->xsize = info.vi_width/8;
|
||||
@ -187,15 +212,13 @@ 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))
|
||||
if ((*vidsw[scp->ad]->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) {
|
||||
@ -230,7 +253,7 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
|
||||
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,
|
||||
scp->adp->va_window, info.vi_width, info.vi_height,
|
||||
(info.vi_width/8 - xsize)/2,
|
||||
(info.vi_height/fontsize - ysize)/2);
|
||||
}
|
||||
@ -274,7 +297,7 @@ sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
|
||||
|
||||
/* allocate buffers */
|
||||
sc_alloc_scr_buffer(scp, TRUE, TRUE);
|
||||
if (ISMOUSEAVAIL(adp->va_flags))
|
||||
if (ISMOUSEAVAIL(scp->adp->va_flags))
|
||||
sc_alloc_cut_buffer(scp, FALSE);
|
||||
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
|
||||
splx(s);
|
||||
@ -304,7 +327,6 @@ 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;
|
||||
|
||||
@ -313,19 +335,66 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
switch (cmd) {
|
||||
|
||||
case CONS_CURRENT: /* get current adapter type */
|
||||
adp = get_adapter(scp);
|
||||
*(int *)data = adp->va_type;
|
||||
if (scp->adp == NULL)
|
||||
return ENODEV;
|
||||
*(int *)data = scp->adp->va_type;
|
||||
return 0;
|
||||
|
||||
case CONS_CURRENTADP: /* get current adapter index */
|
||||
*(int *)data = scp->adp;
|
||||
*(int *)data = scp->ad;
|
||||
return 0;
|
||||
|
||||
case OLD_CONS_ADPINFO: /* adapter information */
|
||||
if (scp->adp == NULL)
|
||||
return ENODEV;
|
||||
((old_video_adapter_t *)data)->va_index = scp->adp->va_index;
|
||||
((old_video_adapter_t *)data)->va_type = scp->adp->va_type;
|
||||
((old_video_adapter_t *)data)->va_flags = scp->adp->va_flags;
|
||||
((old_video_adapter_t *)data)->va_crtc_addr = scp->adp->va_crtc_addr;
|
||||
((old_video_adapter_t *)data)->va_window = scp->adp->va_window;
|
||||
((old_video_adapter_t *)data)->va_window_size
|
||||
= scp->adp->va_window_size;
|
||||
((old_video_adapter_t *)data)->va_window_gran
|
||||
= scp->adp->va_window_gran;
|
||||
((old_video_adapter_t *)data)->va_buffer = scp->adp->va_buffer;
|
||||
((old_video_adapter_t *)data)->va_buffer_size
|
||||
= scp->adp->va_buffer_size;
|
||||
((old_video_adapter_t *)data)->va_mode = scp->adp->va_mode;
|
||||
((old_video_adapter_t *)data)->va_initial_mode
|
||||
= scp->adp->va_initial_mode;
|
||||
((old_video_adapter_t *)data)->va_initial_bios_mode
|
||||
= scp->adp->va_initial_bios_mode;
|
||||
return 0;
|
||||
|
||||
case CONS_ADPINFO: /* adapter information */
|
||||
adp = (*biosvidsw.adapter)(((video_adapter_t *)data)->va_index);
|
||||
if (adp == NULL)
|
||||
if (scp->adp == NULL)
|
||||
return ENODEV;
|
||||
bcopy(adp, data, sizeof(*adp));
|
||||
((video_adapter_info_t *)data)->va_index = scp->adp->va_index;
|
||||
((video_adapter_info_t *)data)->va_type = scp->adp->va_type;
|
||||
bcopy(scp->adp->va_name, ((video_adapter_info_t *)data)->va_name,
|
||||
imin(strlen(scp->adp->va_name) + 1,
|
||||
sizeof(((video_adapter_info_t *)data)->va_name)));
|
||||
((video_adapter_info_t *)data)->va_unit = scp->adp->va_unit;
|
||||
((video_adapter_info_t *)data)->va_flags = scp->adp->va_flags;
|
||||
((video_adapter_info_t *)data)->va_io_base = scp->adp->va_io_base;
|
||||
((video_adapter_info_t *)data)->va_io_size = scp->adp->va_io_size;
|
||||
((video_adapter_info_t *)data)->va_crtc_addr = scp->adp->va_crtc_addr;
|
||||
((video_adapter_info_t *)data)->va_mem_base = scp->adp->va_mem_base;
|
||||
((video_adapter_info_t *)data)->va_mem_size = scp->adp->va_mem_size;
|
||||
((video_adapter_info_t *)data)->va_window = scp->adp->va_window;
|
||||
((video_adapter_info_t *)data)->va_window_size
|
||||
= scp->adp->va_window_size;
|
||||
((video_adapter_info_t *)data)->va_window_gran
|
||||
= scp->adp->va_window_gran;
|
||||
((video_adapter_info_t *)data)->va_buffer = scp->adp->va_buffer;
|
||||
((video_adapter_info_t *)data)->va_buffer_size
|
||||
= scp->adp->va_buffer_size;
|
||||
((video_adapter_info_t *)data)->va_mode = scp->adp->va_mode;
|
||||
((video_adapter_info_t *)data)->va_mode_flags = scp->adp->va_mode_flags;
|
||||
((video_adapter_info_t *)data)->va_initial_mode
|
||||
= scp->adp->va_initial_mode;
|
||||
((video_adapter_info_t *)data)->va_initial_bios_mode
|
||||
= scp->adp->va_initial_bios_mode;
|
||||
return 0;
|
||||
|
||||
case CONS_GET: /* get current video mode */
|
||||
@ -333,16 +402,16 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
return 0;
|
||||
|
||||
case CONS_MODEINFO: /* get mode information */
|
||||
return ((*biosvidsw.get_info)(scp->adp,
|
||||
return ((*vidsw[scp->ad]->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)
|
||||
return ((*vidsw[scp->ad]->query_mode)(scp->adp, (video_info_t *)data)
|
||||
? ENODEV : 0);
|
||||
|
||||
case CONS_SETWINORG:
|
||||
return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data)
|
||||
return ((*vidsw[scp->ad]->set_win_org)(scp->adp, *(u_int *)data)
|
||||
? ENODEV : 0);
|
||||
|
||||
/* generic text modes */
|
||||
@ -363,8 +432,13 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
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))
|
||||
|
||||
#ifdef PC98
|
||||
/* PC98 TEXT MODES */
|
||||
case SW_PC98_80x25:
|
||||
case SW_PC98_80x30:
|
||||
#endif
|
||||
if (!(scp->adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
|
||||
|
||||
@ -374,8 +448,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
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))
|
||||
if (!(scp->adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
return sc_set_graphics_mode(scp, tp, cmd & 0xff);
|
||||
|
||||
@ -390,8 +463,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
return EINVAL;
|
||||
/* restore fonts & palette ! */
|
||||
#if 0
|
||||
adp = get_adapter(scp);
|
||||
if (ISFONTAVAIL(adp->va_flags)
|
||||
if (ISFONTAVAIL(scp->adp->va_flags)
|
||||
&& !(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
|
||||
/*
|
||||
* FONT KLUDGE
|
||||
@ -405,10 +477,10 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
copy_font(scp, LOAD, 16, font_16);
|
||||
}
|
||||
#endif
|
||||
load_palette(scp, palette);
|
||||
load_palette(scp->adp, palette);
|
||||
|
||||
/* move hardware cursor out of the way */
|
||||
(*biosvidsw.set_hw_cursor)(scp->adp, -1, -1);
|
||||
(*vidsw[scp->ad]->set_hw_cursor)(scp->adp, -1, -1);
|
||||
|
||||
/* FALL THROUGH */
|
||||
|
||||
@ -424,6 +496,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
#ifndef PC98
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
splx(s);
|
||||
/* no restore fonts & palette */
|
||||
@ -431,6 +504,14 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
set_mode(scp);
|
||||
sc_clear_screen(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
#else /* PC98 */
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
/* no restore fonts & palette */
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
sc_clear_screen(scp);
|
||||
splx(s);
|
||||
#endif /* PC98 */
|
||||
return 0;
|
||||
|
||||
case KD_PIXEL: /* pixel (raster) display */
|
||||
@ -448,7 +529,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
splx(s);
|
||||
if (scp == cur_console) {
|
||||
set_mode(scp);
|
||||
load_palette(scp, palette);
|
||||
load_palette(scp->adp, palette);
|
||||
}
|
||||
sc_clear_screen(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
@ -462,6 +543,10 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
}
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
splx(s);
|
||||
#ifdef PC98
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
default:
|
||||
@ -486,7 +571,7 @@ sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
case KDSBORDER: /* set border color of this (virtual) console */
|
||||
scp->border = *data;
|
||||
if (scp == cur_console)
|
||||
set_border(cur_console, scp->border);
|
||||
set_border(scp, scp->border);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: snake_saver.c,v 1.19 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: snake_saver.c,v 1.20 1998/11/04 03:49:39 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -44,9 +44,10 @@ static char *message;
|
||||
static u_char **messagep;
|
||||
static int messagelen;
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
static void
|
||||
snake_saver(int blank)
|
||||
static int
|
||||
snake_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int dirx, diry;
|
||||
int f;
|
||||
@ -57,12 +58,11 @@ snake_saver(int blank)
|
||||
#define savs messagep
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked <= 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20],
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (blanked <= 0) {
|
||||
window = (u_short *)adp->va_window;
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK)<<8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
dirx = (scp->xpos ? 1 : -1);
|
||||
@ -72,16 +72,11 @@ snake_saver(int blank)
|
||||
savs[f] = (u_char *)window + 2 *
|
||||
(scp->xpos+scp->ypos*scp->xsize);
|
||||
*(savs[0]) = scr_map[*save];
|
||||
f = scp->ysize * scp->xsize + 5;
|
||||
outb(crtc_addr, 14);
|
||||
outb(crtc_addr+1, f >> 8);
|
||||
outb(crtc_addr, 15);
|
||||
outb(crtc_addr+1, f & 0xff);
|
||||
scrn_blanked = 1;
|
||||
blanked = 1;
|
||||
}
|
||||
if (scrn_blanked++ < 4)
|
||||
return;
|
||||
scrn_blanked = 1;
|
||||
if (blanked++ < 4)
|
||||
return 0;
|
||||
blanked = 1;
|
||||
*(savs[messagelen-1]) = scr_map[0x20];
|
||||
for (f=messagelen-1; f > 0; f--)
|
||||
savs[f] = savs[f-1];
|
||||
@ -99,43 +94,31 @@ snake_saver(int blank)
|
||||
*(savs[f]) = scr_map[save[f]];
|
||||
}
|
||||
else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
snake_saver_load(void)
|
||||
snake_init(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
messagelen = strlen(ostype) + 1 + strlen(osrelease);
|
||||
message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
|
||||
sprintf(message, "%s %s", ostype, osrelease);
|
||||
messagep = malloc(messagelen * sizeof *messagep, M_DEVBUF, M_WAITOK);
|
||||
|
||||
err = add_scrn_saver(snake_saver);
|
||||
if (err != 0) {
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
}
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
snake_saver_unload(void)
|
||||
snake_term(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = remove_scrn_saver(snake_saver);
|
||||
if (err == 0) {
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
}
|
||||
return err;
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(snake_saver);
|
||||
static scrn_saver_t snake_module = {
|
||||
"snake_saver", snake_init, snake_term, snake_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(snake_saver, snake_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: star_saver.c,v 1.16 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: star_saver.c,v 1.17 1998/11/04 03:49:39 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,13 +41,14 @@
|
||||
#define NUM_STARS 50
|
||||
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
/*
|
||||
* Alternate saver that got its inspiration from a well known utility
|
||||
* package for an inferior^H^H^H^H^H^Hfamous OS.
|
||||
*/
|
||||
static void
|
||||
star_saver(int blank)
|
||||
static int
|
||||
star_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
int cell, i;
|
||||
@ -57,15 +58,15 @@ star_saver(int blank)
|
||||
static u_short stars[NUM_STARS][2];
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked <= 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
scrn_blanked = 1;
|
||||
fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], window,
|
||||
scp->xsize * scp->ysize);
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (!blanked) {
|
||||
window = (u_short *)adp->va_window;
|
||||
/* clear the screen and set the border color */
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
blanked = TRUE;
|
||||
for(i=0; i<NUM_STARS; i++) {
|
||||
stars[i][0] =
|
||||
random() % (scp->xsize*scp->ysize);
|
||||
@ -82,24 +83,26 @@ star_saver(int blank)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = FALSE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
star_saver_load(void)
|
||||
star_init(video_adapter_t *adp)
|
||||
{
|
||||
return add_scrn_saver(star_saver);
|
||||
blanked = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
star_saver_unload(void)
|
||||
star_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(star_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(star_saver);
|
||||
static scrn_saver_t star_module = {
|
||||
"star_saver", star_init, star_term, star_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(star_saver, star_module);
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -25,11 +25,11 @@
|
||||
* (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 $
|
||||
* $Id: syscons.h,v 1.44 1998/10/01 11:39:18 yokota Exp $
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
#define _I386_ISA_SYSCONS_H_
|
||||
#ifndef _DEV_SYSCONS_SYSCONS_H_
|
||||
#define _DEV_SYSCONS_SYSCONS_H_
|
||||
|
||||
/* vm things */
|
||||
#define ISMAPPED(pa, width) \
|
||||
@ -52,11 +52,7 @@
|
||||
}
|
||||
|
||||
/* 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
|
||||
@ -73,11 +69,15 @@
|
||||
#define VISUAL_BELL 0x00001
|
||||
#define BLINK_CURSOR 0x00002
|
||||
#define CHAR_CURSOR 0x00004
|
||||
/* these options are now obsolete; use corresponding options for kbd driver */
|
||||
#if 0
|
||||
#define DETECT_KBD 0x00008
|
||||
#define XT_KEYBD 0x00010
|
||||
#define KBD_NORESET 0x00020
|
||||
#endif
|
||||
#define QUIET_BELL 0x00040
|
||||
#define VESA800X600 0x00080
|
||||
#define AUTODETECT_KBD 0x00100
|
||||
|
||||
/* attribute flags */
|
||||
#define NORMAL_ATTR 0x00
|
||||
@ -128,7 +128,8 @@ typedef struct term_stat {
|
||||
} term_stat;
|
||||
|
||||
typedef struct scr_stat {
|
||||
int adp; /* video adapter index */
|
||||
int ad; /* video adapter index */
|
||||
video_adapter_t *adp; /* video adapter structure */
|
||||
u_short *scr_buf; /* buffer when off screen */
|
||||
int xpos; /* current X position */
|
||||
int ypos; /* current Y position */
|
||||
@ -145,6 +146,7 @@ typedef struct scr_stat {
|
||||
int end; /* modified area end */
|
||||
term_stat term; /* terminal emulation stuff */
|
||||
int status; /* status (bitfield) */
|
||||
int kbd_mode; /* keyboard I/O mode */
|
||||
u_short *cursor_pos; /* cursor buffer position */
|
||||
u_short *cursor_oldpos; /* cursor old buffer position */
|
||||
u_short cursor_saveunder; /* saved chars under cursor */
|
||||
@ -164,7 +166,6 @@ typedef struct scr_stat {
|
||||
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 */
|
||||
@ -175,10 +176,8 @@ typedef struct scr_stat {
|
||||
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 {
|
||||
@ -211,13 +210,12 @@ 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));
|
||||
#define save_palette(adp, pal) \
|
||||
(*vidsw[(adp)->va_index]->save_palette)((adp), (pal))
|
||||
#define load_palette(adp, pal) \
|
||||
(*vidsw[(adp)->va_index]->load_palette)((adp), (pal))
|
||||
|
||||
void sc_touch_scrn_saver(void);
|
||||
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);
|
||||
@ -235,11 +233,4 @@ int sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
|
||||
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_ */
|
||||
#endif /* !_DEV_SYSCONS_SYSCONS_H_ */
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: warp_saver.c,v 1.2 1998/12/28 14:20:13 des Exp $
|
||||
* $Id: warp_saver.c,v 1.3 1998/12/31 13:38:59 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -40,6 +40,7 @@
|
||||
#include <saver.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int blanked;
|
||||
|
||||
#define SCRW 320
|
||||
#define SCRH 200
|
||||
@ -47,7 +48,6 @@ static u_char *vid;
|
||||
#define STARS (SPP*(1+2+4+8))
|
||||
|
||||
static int star[STARS];
|
||||
static u_char save_pal[768];
|
||||
static u_char warp_pal[768] = {
|
||||
0x00, 0x00, 0x00,
|
||||
0x66, 0x66, 0x66,
|
||||
@ -72,25 +72,18 @@ warp_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
warp_saver(int blank)
|
||||
static int
|
||||
warp_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = M_VGA_CG320;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, warp_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, M_VGA_CG320, warp_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
}
|
||||
@ -99,30 +92,19 @@ warp_saver(int blank)
|
||||
warp_update();
|
||||
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
warp_saver_load(void)
|
||||
warp_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int i;
|
||||
|
||||
/* check that the console is capable of running in 320x200x256 */
|
||||
if ((*biosvidsw.get_info)(cur_console->adp, M_VGA_CG320, &info)) {
|
||||
if (get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
log(LOG_NOTICE, "warp_saver: the console does not support M_VGA_CG320\n");
|
||||
return ENODEV;
|
||||
}
|
||||
@ -132,13 +114,19 @@ warp_saver_load(void)
|
||||
star[i] = random() % (SCRW*SCRH);
|
||||
}
|
||||
|
||||
return add_scrn_saver(warp_saver);
|
||||
blanked = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
warp_saver_unload(void)
|
||||
warp_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(warp_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(warp_saver);
|
||||
static scrn_saver_t warp_module = {
|
||||
"warp_saver", warp_init, warp_term, warp_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(warp_saver, warp_module);
|
||||
|
@ -11,7 +11,7 @@
|
||||
# device lines is present in the ./LINT configuration file. If you are
|
||||
# in doubt as to the purpose or necessity of a line, check first in LINT.
|
||||
#
|
||||
# $Id: GENERIC,v 1.141 1999/01/01 08:09:57 peter Exp $
|
||||
# $Id: GENERIC,v 1.142 1999/01/09 18:12:07 wpaul Exp $
|
||||
|
||||
machine "i386"
|
||||
cpu "I386_CPU"
|
||||
@ -108,10 +108,20 @@ controller matcd0 at isa? port 0x230 bio
|
||||
|
||||
device scd0 at isa? port 0x230 bio
|
||||
|
||||
# atkbdc0 controlls both the keyboard and the PS/2 mouse
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
device atkbd0 at isa? tty irq 1
|
||||
device psm0 at isa? tty irq 12
|
||||
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
# splash screen/screen saver
|
||||
pseudo-device splash
|
||||
|
||||
# syscons is the default console driver, resembling an SCO console
|
||||
device sc0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device sc0 at isa? tty
|
||||
# Enable this and PCVT_FREEBSD for pcvt vt220 compatible console driver
|
||||
#device vt0 at isa? port IO_KBD conflicts tty irq 1
|
||||
#device vt0 at isa? tty
|
||||
#options XSERVER # support for X server
|
||||
#options FAT_CURSOR # start with block cursor
|
||||
# If you have a ThinkPAD, uncomment this along with the rest of the PCVT lines
|
||||
@ -136,8 +146,6 @@ device sio3 at isa? disable port "IO_COM4" tty irq 9
|
||||
|
||||
device lpt0 at isa? port? tty irq 7
|
||||
|
||||
device psm0 at isa? port IO_KBD conflicts tty irq 12
|
||||
|
||||
# Order is important here due to intrusive probes, do *not* alphabetize
|
||||
# this list of network interfaces until the probes have been fixed.
|
||||
# Right now it appears that the ie0 must be probed before ep0. See
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.529 1999/01/09 18:12:07 wpaul Exp $
|
||||
# $Id: LINT,v 1.531 1999/01/10 07:45:33 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -842,15 +842,35 @@ options "NTIMECOUNTER=20"
|
||||
# configure cards from USERCONFIG. See pnp(4) for more info.
|
||||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
# The video card driver.
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
# Splash screen at start up! Screen savers require this too.
|
||||
pseudo-device splash
|
||||
|
||||
# The pcvt console driver (vt220 compatible).
|
||||
device vt0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device vt0 at isa? tty
|
||||
options XSERVER # support for running an X server.
|
||||
options FAT_CURSOR # start with block cursor
|
||||
# This PCVT option is for keyboards such as those used on IBM ThinkPad laptops
|
||||
options PCVT_SCANSET=2 # IBM keyboards are non-std
|
||||
|
||||
# The syscons console driver (sco color console compatible).
|
||||
device sc0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device sc0 at isa? tty
|
||||
options MAXCONS=16 # number of virtual consoles
|
||||
options SLOW_VGA # do byte-wide i/o's to TS and GDC regs
|
||||
options "STD8X16FONT" # Compile font in
|
||||
@ -1050,7 +1070,7 @@ disk fd0 at fdc0 drive 0
|
||||
disk fd1 at fdc0 drive 1
|
||||
|
||||
#
|
||||
# Other standard PC hardware: `lpt', `mse', `psm', `sio', etc.
|
||||
# Other standard PC hardware: `lpt', `mse', `sio', etc.
|
||||
#
|
||||
# lpt: printer port
|
||||
# lpt specials:
|
||||
@ -1059,18 +1079,11 @@ disk fd1 at fdc0 drive 1
|
||||
# The irq clause may be omitted. This will force the port
|
||||
# into polling mode.
|
||||
# mse: Logitech and ATI InPort bus mouse ports
|
||||
# psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd]
|
||||
# sio: serial ports (see sio(4))
|
||||
|
||||
device lpt0 at isa? port? tty irq 7
|
||||
device lpt1 at isa? port "IO_LPT3" tty irq 5
|
||||
device mse0 at isa? port 0x23c tty irq 5
|
||||
device psm0 at isa? port IO_KBD conflicts tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
# LINT -- config file for checking all the sources, tries to pull in
|
||||
# as much of the source tree as it can.
|
||||
#
|
||||
# $Id: LINT,v 1.529 1999/01/09 18:12:07 wpaul Exp $
|
||||
# $Id: LINT,v 1.531 1999/01/10 07:45:33 phk Exp $
|
||||
#
|
||||
# NB: You probably don't want to try running a kernel built from this
|
||||
# file. Instead, you should start from GENERIC, and add options from
|
||||
@ -842,15 +842,35 @@ options "NTIMECOUNTER=20"
|
||||
# configure cards from USERCONFIG. See pnp(4) for more info.
|
||||
controller pnp0
|
||||
|
||||
# The keyboard controller; it controlls the keyboard and the PS/2 mouse.
|
||||
controller atkbdc0 at isa? port IO_KBD tty
|
||||
|
||||
# The AT keyboard
|
||||
device atkbd0 at isa? tty irq 1
|
||||
|
||||
# PS/2 mouse
|
||||
device psm0 at isa? tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
# The video card driver.
|
||||
device vga0 at isa? port ? conflicts
|
||||
|
||||
# Splash screen at start up! Screen savers require this too.
|
||||
pseudo-device splash
|
||||
|
||||
# The pcvt console driver (vt220 compatible).
|
||||
device vt0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device vt0 at isa? tty
|
||||
options XSERVER # support for running an X server.
|
||||
options FAT_CURSOR # start with block cursor
|
||||
# This PCVT option is for keyboards such as those used on IBM ThinkPad laptops
|
||||
options PCVT_SCANSET=2 # IBM keyboards are non-std
|
||||
|
||||
# The syscons console driver (sco color console compatible).
|
||||
device sc0 at isa? port IO_KBD conflicts tty irq 1
|
||||
device sc0 at isa? tty
|
||||
options MAXCONS=16 # number of virtual consoles
|
||||
options SLOW_VGA # do byte-wide i/o's to TS and GDC regs
|
||||
options "STD8X16FONT" # Compile font in
|
||||
@ -1050,7 +1070,7 @@ disk fd0 at fdc0 drive 0
|
||||
disk fd1 at fdc0 drive 1
|
||||
|
||||
#
|
||||
# Other standard PC hardware: `lpt', `mse', `psm', `sio', etc.
|
||||
# Other standard PC hardware: `lpt', `mse', `sio', etc.
|
||||
#
|
||||
# lpt: printer port
|
||||
# lpt specials:
|
||||
@ -1059,18 +1079,11 @@ disk fd1 at fdc0 drive 1
|
||||
# The irq clause may be omitted. This will force the port
|
||||
# into polling mode.
|
||||
# mse: Logitech and ATI InPort bus mouse ports
|
||||
# psm: PS/2 mouse port [note: conflicts with sc0/vt0, thus "conflicts" keywd]
|
||||
# sio: serial ports (see sio(4))
|
||||
|
||||
device lpt0 at isa? port? tty irq 7
|
||||
device lpt1 at isa? port "IO_LPT3" tty irq 5
|
||||
device mse0 at isa? port 0x23c tty irq 5
|
||||
device psm0 at isa? port IO_KBD conflicts tty irq 12
|
||||
|
||||
# Options for psm:
|
||||
options PSM_HOOKAPM #hook the APM resume event, useful
|
||||
#for some laptops
|
||||
options PSM_RESETAFTERSUSPEND #reset the device at the resume event
|
||||
|
||||
device sio0 at isa? port "IO_COM1" tty flags 0x10 irq 4
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.i386,v 1.216 1998/12/31 08:17:08 luigi Exp $
|
||||
# $Id: files.i386,v 1.217 1999/01/01 08:09:58 peter Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -24,6 +24,17 @@ font8x16.o optional std8x16font \
|
||||
no-implicit-rule before-depend \
|
||||
clean "${STD8X16FONT}-8x16 font8x16.c"
|
||||
#
|
||||
dev/fb/fb.c optional fb device-driver
|
||||
dev/fb/fb.c optional vga device-driver
|
||||
dev/fb/splash.c optional splash
|
||||
dev/kbd/atkbd.c optional atkbd device-driver
|
||||
dev/kbd/atkbdc.c optional atkbdc device-driver
|
||||
dev/kbd/kbd.c optional atkbd device-driver
|
||||
dev/kbd/kbd.c optional kbd device-driver
|
||||
#dev/kbd/kbd.c optional ukbd device-driver
|
||||
dev/syscons/syscons.c optional sc device-driver
|
||||
dev/syscons/scvidctl.c optional sc device-driver
|
||||
dev/syscons/scvesactl.c optional sc device-driver
|
||||
i386/apm/apm.c optional apm device-driver
|
||||
i386/apm/apm_setup.s optional apm
|
||||
i386/eisa/dpt_eisa.c optional eisa dpt device-driver
|
||||
@ -98,6 +109,8 @@ i386/isa/aha_isa.c optional aha device-driver
|
||||
#i386/isa/aic6360.c optional aic device-driver
|
||||
i386/isa/aic_isa.c optional aic device-driver
|
||||
i386/isa/alog.c optional alog device-driver
|
||||
i386/isa/atkbd_isa.c optional atkbd device-driver
|
||||
i386/isa/atkbdc_isa.c optional atkbdc device-driver
|
||||
i386/isa/bt_isa.c optional bt device-driver
|
||||
i386/isa/clock.c standard
|
||||
i386/isa/cronyx.c optional cx device-driver
|
||||
@ -133,9 +146,6 @@ i386/isa/intr_machdep.c standard
|
||||
i386/isa/isa.c optional isa device-driver
|
||||
i386/isa/istallion.c optional stli device-driver
|
||||
i386/isa/joy.c optional joy device-driver
|
||||
i386/isa/kbdio.c optional psm device-driver
|
||||
i386/isa/kbdio.c optional sc device-driver
|
||||
i386/isa/kbdio.c optional vt device-driver
|
||||
i386/isa/loran.c optional loran device-driver
|
||||
i386/isa/lpt.c optional lpt device-driver
|
||||
i386/isa/labpc.c optional labpc device-driver
|
||||
@ -235,11 +245,8 @@ i386/isa/sound/cs4232.c optional css device-driver
|
||||
i386/isa/spigot.c optional spigot device-driver
|
||||
i386/isa/spkr.c optional speaker device-driver
|
||||
i386/isa/stallion.c optional stl device-driver
|
||||
i386/isa/syscons.c optional sc device-driver
|
||||
i386/isa/scvidctl.c optional sc device-driver
|
||||
i386/isa/scvesactl.c optional sc device-driver
|
||||
i386/isa/videoio.c optional sc device-driver
|
||||
i386/isa/vesa.c optional sc device-driver
|
||||
i386/isa/vesa.c optional vga device-driver
|
||||
i386/isa/vga_isa.c optional vga device-driver
|
||||
i386/isa/tw.c optional tw device-driver
|
||||
i386/isa/wd.c optional wdc device-driver
|
||||
i386/isa/wd.c optional wd device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.i386,v 1.101 1999/01/01 08:09:58 peter Exp $
|
||||
# $Id: options.i386,v 1.102 1999/01/10 17:41:33 nsouch Exp $
|
||||
|
||||
DISABLE_PSE
|
||||
IDE_DELAY
|
||||
@ -66,16 +66,26 @@ I486_CPU opt_global.h
|
||||
I586_CPU opt_global.h
|
||||
I686_CPU opt_global.h
|
||||
|
||||
SC_SPLASH_SCREEN opt_syscons.h
|
||||
MAXCONS opt_syscons.h
|
||||
SLOW_VGA opt_syscons.h
|
||||
# obsolete, use VGA_SLOW_IOACCESS
|
||||
#SLOW_VGA opt_syscons.h
|
||||
STD8X16FONT opt_syscons.h
|
||||
SC_HISTORY_SIZE opt_syscons.h
|
||||
SC_DISABLE_REBOOT opt_syscons.h
|
||||
SC_MOUSE_CHAR opt_syscons.h
|
||||
SC_ALT_SEQACCESS opt_syscons.h
|
||||
# obsolete, use VGA_ALT_SEQACCESS
|
||||
#SC_ALT_SEQACCESS opt_syscons.h
|
||||
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
VGA_ALT_SEQACCESS opt_vga.h
|
||||
VGA_DEBUG opt_vga.h
|
||||
VGA_NO_FONT_LOADING opt_vga.h
|
||||
VGA_NO_MODE_CHANGE opt_vga.h
|
||||
VGA_SLOW_IOACCESS opt_vga.h
|
||||
|
||||
VESA opt_vesa.h
|
||||
VESA_DEBUG opt_vesa.h
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
PSM_RESETAFTERSUSPEND opt_psm.h
|
||||
@ -83,10 +93,11 @@ PSM_DEBUG opt_psm.h
|
||||
|
||||
PCIC_RESUME_RESET opt_pcic.h
|
||||
|
||||
KBD_RESETDELAY opt_kbdio.h
|
||||
KBD_MAXRETRY opt_kbdio.h
|
||||
KBD_MAXWAIT opt_kbdio.h
|
||||
KBDIO_DEBUG opt_kbdio.h
|
||||
KBD_INSTALL_CDEV opt_kbd.h
|
||||
KBD_MAXRETRY opt_kbd.h
|
||||
KBD_MAXWAIT opt_kbd.h
|
||||
KBD_RESETDELAY opt_kbd.h
|
||||
KBDIO_DEBUG opt_kbd.h
|
||||
|
||||
ATAPI opt_atapi.h
|
||||
ATAPI_STATIC opt_atapi.h
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: console.h,v 1.41 1998/10/01 11:39:09 yokota Exp $
|
||||
* $Id: console.h,v 1.42 1999/01/01 14:38:28 des Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONSOLE_H_
|
||||
@ -52,6 +52,7 @@
|
||||
#define KDSETLED _IO('K', 66 /*, int */)
|
||||
#define KDSETRAD _IO('K', 67 /*, int */)
|
||||
#define KDRASTER _IOW('K', 100, scr_size_t)
|
||||
#define KDGKBINFO _IOR('K', 101, keyboard_info_t)
|
||||
|
||||
#define GETFKEY _IOWR('k', 0, fkeyarg_t)
|
||||
#define SETFKEY _IOWR('k', 1, fkeyarg_t)
|
||||
@ -61,6 +62,8 @@
|
||||
#define PIO_KEYMAP _IOW('k', 7, keymap_t)
|
||||
#define GIO_DEADKEYMAP _IOR('k', 8, accentmap_t)
|
||||
#define PIO_DEADKEYMAP _IOW('k', 9, accentmap_t)
|
||||
#define GIO_KEYMAPENT _IOWR('k', 10, keyarg_t)
|
||||
#define PIO_KEYMAPENT _IOW('k', 11, keyarg_t)
|
||||
|
||||
#define GIO_ATTR _IOR('a', 0, int)
|
||||
#define GIO_COLOR _IOR('c', 0, int)
|
||||
@ -86,11 +89,14 @@
|
||||
#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_ADPINFO _IOWR('c', 101, video_adapter_info_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 */)
|
||||
|
||||
#define CONS_SETKBD _IO('c', 110 /* int */)
|
||||
#define CONS_RELKBD _IO('c', 111)
|
||||
|
||||
/* CONS_SAVERMODE */
|
||||
#define CONS_LKM_SAVER 0
|
||||
#define CONS_USR_SAVER 1
|
||||
@ -189,9 +195,11 @@ struct mouse_info {
|
||||
#define NLKED 2 /* Num locked */
|
||||
#define SLKED 4 /* Scroll locked */
|
||||
#define ALKED 8 /* AltGr locked */
|
||||
#define LOCK_MASK (CLKED | NLKED | SLKED | ALKED)
|
||||
#define LED_CAP 1 /* Caps lock LED */
|
||||
#define LED_NUM 2 /* Num lock LED */
|
||||
#define LED_SCR 4 /* Scroll lock LED */
|
||||
#define LED_MASK (LED_CAP | LED_NUM | LED_SCR)
|
||||
|
||||
/* possible flag values */
|
||||
#define FLAG_LOCK_O 0
|
||||
@ -204,7 +212,7 @@ struct mouse_info {
|
||||
|
||||
#ifndef _KEYMAP_DECLARED
|
||||
#define _KEYMAP_DECLARED
|
||||
struct key_t {
|
||||
struct keyent_t {
|
||||
u_char map[NUM_STATES];
|
||||
u_char spcl;
|
||||
u_char flgs;
|
||||
@ -212,10 +220,17 @@ struct key_t {
|
||||
|
||||
struct keymap {
|
||||
u_short n_keys;
|
||||
struct key_t key[NUM_KEYS];
|
||||
struct keyent_t key[NUM_KEYS];
|
||||
};
|
||||
|
||||
typedef struct keymap keymap_t;
|
||||
|
||||
struct keyarg {
|
||||
u_short keynum;
|
||||
struct keyent_t key;
|
||||
};
|
||||
|
||||
typedef struct keyarg keyarg_t;
|
||||
#endif /* !_KEYMAP_DECLARED */
|
||||
|
||||
#define NUM_DEADKEYS 15 /* number of accent keys */
|
||||
@ -274,6 +289,9 @@ struct ssaver {
|
||||
struct video_adapter {
|
||||
int va_index;
|
||||
int va_type;
|
||||
char *va_name;
|
||||
int va_unit;
|
||||
int va_minor;
|
||||
int va_flags;
|
||||
#define V_ADP_COLOR (1<<0)
|
||||
#define V_ADP_MODECHANGE (1<<1)
|
||||
@ -283,7 +301,14 @@ struct video_adapter {
|
||||
#define V_ADP_PALETTE (1<<5)
|
||||
#define V_ADP_BORDER (1<<6)
|
||||
#define V_ADP_VESA (1<<7)
|
||||
#define V_ADP_PROBED (1<<16)
|
||||
#define V_ADP_INITIALIZED (1<<17)
|
||||
#define V_ADP_REGISTERED (1<<18)
|
||||
int va_io_base;
|
||||
int va_io_size;
|
||||
int va_crtc_addr;
|
||||
int va_mem_base;
|
||||
int va_mem_size;
|
||||
u_int va_window; /* virtual address */
|
||||
size_t va_window_size;
|
||||
size_t va_window_gran;
|
||||
@ -292,6 +317,30 @@ struct video_adapter {
|
||||
int va_initial_mode;
|
||||
int va_initial_bios_mode;
|
||||
int va_mode;
|
||||
int va_mode_flags; /* copy of vi_flags */
|
||||
void *va_token;
|
||||
};
|
||||
|
||||
struct video_adapter_info {
|
||||
int va_index;
|
||||
int va_type;
|
||||
char va_name[16];
|
||||
int va_unit;
|
||||
int va_flags;
|
||||
int va_io_base;
|
||||
int va_io_size;
|
||||
int va_crtc_addr;
|
||||
int va_mem_base;
|
||||
int va_mem_size;
|
||||
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;
|
||||
int va_mode_flags;
|
||||
};
|
||||
|
||||
#define V_ADP_PRIMARY 0
|
||||
@ -319,6 +368,15 @@ struct video_info {
|
||||
/* XXX pixel format, memory model,... */
|
||||
};
|
||||
|
||||
struct keyboard_info {
|
||||
int kb_index; /* kbdio index# */
|
||||
char kb_name[16]; /* driver name */
|
||||
int kb_unit; /* unit# */
|
||||
int kb_type; /* KB_84, KB_101, KB_OTHER,... */
|
||||
int kb_config; /* device configuration flags */
|
||||
int kb_flags; /* internal flags */
|
||||
};
|
||||
|
||||
typedef struct accentmap accentmap_t;
|
||||
typedef struct fkeytab fkeytab_t;
|
||||
typedef struct fkeyarg fkeyarg_t;
|
||||
@ -330,7 +388,9 @@ 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_adapter_info video_adapter_info_t;
|
||||
typedef struct video_info video_info_t;
|
||||
typedef struct keyboard_info keyboard_info_t;
|
||||
typedef struct {int scr_size[3];} scr_size_t;
|
||||
|
||||
/* defines for "special" keys (spcl bit set in keymap) */
|
||||
@ -388,6 +448,13 @@ typedef struct {int scr_size[3];} scr_size_t;
|
||||
#define MKEY 0x400 /* meta key marker (prepend ESC)*/
|
||||
#define BKEY 0x800 /* backtab (ESC [ Z) */
|
||||
|
||||
#define SPCLKEY 0x8000 /* special key */
|
||||
#define RELKEY 0x4000 /* key released */
|
||||
#define ERRKEY 0x2000 /* error */
|
||||
|
||||
#define KEYCHAR(c) ((c) & 0x00ff)
|
||||
#define KEYFLAGS(c) ((c) & ~0x00ff)
|
||||
|
||||
/* video mode definitions */
|
||||
#define M_B40x25 0 /* black & white 40 columns */
|
||||
#define M_C40x25 1 /* color 40 columns */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* (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: vesa.h,v 1.2 1998/09/25 11:55:41 yokota Exp $
|
||||
* $Id: vesa.h,v 1.3 1999/01/08 12:57:06 yokota Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_PC_VESA_H
|
||||
@ -115,10 +115,6 @@ struct vesa_mode
|
||||
int vesa_load_ioctl(void);
|
||||
int vesa_unload_ioctl(void);
|
||||
|
||||
#ifndef KLD_MODULE
|
||||
int vesa_load(void);
|
||||
#endif
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_MACHINE_PC_VESA_H */
|
||||
|
@ -114,6 +114,11 @@ static void vgapelinit(void); /* read initial VGA DAC palette */
|
||||
static int pcvt_xmode_set(int on, struct proc *p); /* initialize for X mode */
|
||||
#endif /* XSERVER && !PCVT_USL_VT_COMPAT */
|
||||
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
static void detect_kbd(void *arg);
|
||||
static kbd_callback_func_t pcevent;
|
||||
#endif
|
||||
|
||||
static cn_probe_t pccnprobe;
|
||||
static cn_init_t pccninit;
|
||||
static cn_getc_t pccngetc;
|
||||
@ -161,17 +166,19 @@ pcprobe(struct isa_device *dev)
|
||||
#endif /* PCVT_NETBSD > 9 */
|
||||
#endif /* PCVT_NETBSD > 100 */
|
||||
{
|
||||
#ifdef _I386_ISA_KBDIO_H_
|
||||
kbdc = kbdc_open(IO_KBD);
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
int i;
|
||||
|
||||
if(kbdc == NULL)
|
||||
kbd = NULL;
|
||||
kbd_configure(KB_CONF_PROBE_ONLY);
|
||||
i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dev->id_unit);
|
||||
if ((i < 0) || ((kbd = kbd_get_keyboard(i)) == NULL))
|
||||
{
|
||||
reset_keyboard = 0;
|
||||
return 1;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
reset_keyboard = 1; /* it's now safe to do kbd reset */
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
kbd_code_init();
|
||||
|
||||
@ -179,7 +186,9 @@ pcprobe(struct isa_device *dev)
|
||||
((struct isa_attach_args *)aux)->ia_iosize = 16;
|
||||
return 1;
|
||||
#else
|
||||
#if PCVT_NETBSD || PCVT_FREEBSD
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
return (-1);
|
||||
#elif PCVT_NETBSD || PCVT_FREEBSD
|
||||
return (16);
|
||||
#else
|
||||
return 1;
|
||||
@ -207,6 +216,11 @@ pcattach(struct isa_device *dev)
|
||||
|
||||
vt_coldmalloc(); /* allocate memory for screens */
|
||||
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
if (kbd == NULL)
|
||||
timeout(detect_kbd, (void *)dev->id_unit, hz*2);
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_NETBSD || PCVT_FREEBSD
|
||||
|
||||
#if PCVT_NETBSD > 9
|
||||
@ -849,6 +863,50 @@ pcvt_timeout(void *arg)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
static void
|
||||
detect_kbd(void *arg)
|
||||
{
|
||||
int unit = (int)arg;
|
||||
int i;
|
||||
|
||||
if (kbd != NULL)
|
||||
return;
|
||||
i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)unit);
|
||||
if (i >= 0)
|
||||
kbd = kbd_get_keyboard(i);
|
||||
if (kbd != NULL)
|
||||
{
|
||||
reset_keyboard = 1; /* ok to reset the keyboard */
|
||||
kbd_code_init();
|
||||
return;
|
||||
}
|
||||
reset_keyboard = 0;
|
||||
timeout(detect_kbd, (void *)unit, hz*2);
|
||||
}
|
||||
|
||||
int
|
||||
pcevent(keyboard_t *thiskbd, int event, void *arg)
|
||||
{
|
||||
int unit = (int)arg;
|
||||
|
||||
if (thiskbd != kbd)
|
||||
return EINVAL; /* shouldn't happen */
|
||||
|
||||
switch (event) {
|
||||
case KBDIO_KEYINPUT:
|
||||
pcrint(unit);
|
||||
return 0;
|
||||
case KBDIO_UNLOADING:
|
||||
kbd = NULL;
|
||||
kbd_release(thiskbd, (void *)&kbd);
|
||||
timeout(detect_kbd, (void *)unit, hz*4);
|
||||
return 0;
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
void
|
||||
pcrint(int unit)
|
||||
@ -862,7 +920,7 @@ pcrint(int unit)
|
||||
int s;
|
||||
# endif
|
||||
|
||||
# ifdef _I386_ISA_KBDIO_H_
|
||||
# ifdef _DEV_KBD_KBDREG_H_
|
||||
int c;
|
||||
# endif
|
||||
|
||||
@ -870,25 +928,6 @@ pcrint(int unit)
|
||||
u_char *cp;
|
||||
#endif /* PCVT_KBD_FIFO */
|
||||
|
||||
/*
|
||||
* in case the keyboard was not plugged in while booting, kbdc
|
||||
* was set to NULL at that time. When a keyboard IRQ occurs and
|
||||
* kbdc is NULL, the keyboard was probably reconnected to the
|
||||
* keyboard controller and we have to initialize the keyboard.
|
||||
*/
|
||||
|
||||
if(kbdc == NULL)
|
||||
{
|
||||
kbdc = kbdc_open(IO_KBD);
|
||||
if(kbdc == NULL)
|
||||
{
|
||||
reset_keyboard = 0;
|
||||
return;
|
||||
}
|
||||
reset_keyboard = 1;
|
||||
kbd_code_init();
|
||||
}
|
||||
|
||||
#if PCVT_SCREENSAVER
|
||||
pcvt_scrnsv_reset();
|
||||
#endif /* PCVT_SCREENSAVER */
|
||||
@ -900,7 +939,7 @@ pcrint(int unit)
|
||||
return;
|
||||
}
|
||||
|
||||
# ifndef _I386_ISA_KBDIO_H_
|
||||
# ifndef _DEV_KBD_KBDREG_H_
|
||||
while (inb(CONTROLLER_CTRL) & STATUS_OUTPBF) /* check 8042 buffer */
|
||||
{
|
||||
ret = 1; /* got something */
|
||||
@ -909,11 +948,11 @@ pcrint(int unit)
|
||||
|
||||
dt = inb(CONTROLLER_DATA); /* get it 8042 data */
|
||||
# else
|
||||
while ((c = read_kbd_data_no_wait(kbdc)) != -1)
|
||||
while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) != -1)
|
||||
{
|
||||
ret = 1; /* got something */
|
||||
dt = c;
|
||||
# endif /* _I386_ISA_KBDIO_H_ */
|
||||
# endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
if (pcvt_kbd_count >= PCVT_KBD_FIFO_SZ) /* fifo overflow ? */
|
||||
{
|
||||
@ -1131,23 +1170,7 @@ int
|
||||
pccnprobe(struct consdev *cp)
|
||||
{
|
||||
struct isa_device *dvp;
|
||||
|
||||
#ifdef _I386_ISA_KBDIO_H_
|
||||
kbdc = kbdc_open(IO_KBD);
|
||||
/*
|
||||
* Don't reset the keyboard via `kbdio' just yet.
|
||||
* The system clock has not been calibrated...
|
||||
*/
|
||||
reset_keyboard = 0;
|
||||
#if PCVT_SCANSET == 2
|
||||
/*
|
||||
* Turn off scancode translation early so that UserConfig
|
||||
* and DDB can read the keyboard.
|
||||
*/
|
||||
empty_both_buffers(kbdc, 10);
|
||||
set_controller_command_byte(kbdc, KBD_TRANSLATION, 0);
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
int i;
|
||||
|
||||
/*
|
||||
* Take control if we are the highest priority enabled display device.
|
||||
@ -1158,6 +1181,30 @@ pccnprobe(struct consdev *cp)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
kbd = NULL;
|
||||
kbd_configure(KB_CONF_PROBE_ONLY);
|
||||
i = kbd_allocate("*", -1, (void *)&kbd, pcevent, (void *)dvp->id_unit);
|
||||
if (i >= 0)
|
||||
kbd = kbd_get_keyboard(i);
|
||||
|
||||
/*
|
||||
* Don't reset the keyboard via `kbdio' just yet.
|
||||
* The system clock has not been calibrated...
|
||||
*/
|
||||
reset_keyboard = 0;
|
||||
|
||||
#if PCVT_SCANSET == 2
|
||||
/*
|
||||
* Turn off scancode translation early so that UserConfig
|
||||
* and DDB can read the keyboard.
|
||||
*/
|
||||
empty_both_buffers(*(KBDC *)kbd->kb_data, 10);
|
||||
set_controller_command_byte(*(KBDC *)kbd->kb_data, KBD_TRANSLATION, 0);
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
/* initialize required fields */
|
||||
|
||||
cp->cn_dev = makedev(CDEV_MAJOR, 0);
|
||||
@ -1254,7 +1301,13 @@ pccngetc(Dev_t dev)
|
||||
|
||||
s = spltty(); /* block pcrint while we poll */
|
||||
kbd_polling = 1;
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
(*kbdsw[kbd->kb_index]->enable)(kbd);
|
||||
#endif
|
||||
cp = sgetc(0);
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
(*kbdsw[kbd->kb_index]->disable)(kbd);
|
||||
#endif
|
||||
kbd_polling = 0;
|
||||
splx(s);
|
||||
c = *cp++;
|
||||
@ -1281,7 +1334,13 @@ pccncheckc(Dev_t dev)
|
||||
char *cp;
|
||||
int x = spltty();
|
||||
kbd_polling = 1;
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
(*kbdsw[kbd->kb_index]->enable)(kbd);
|
||||
#endif
|
||||
cp = sgetc(1);
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
(*kbdsw[kbd->kb_index]->disable)(kbd);
|
||||
#endif
|
||||
kbd_polling = 0;
|
||||
splx(x);
|
||||
return (cp == NULL ? -1 : *cp);
|
||||
@ -1520,7 +1579,7 @@ pcvt_xmode_set(int on, struct proc *p)
|
||||
|
||||
vsp->Crtat = vsp->Memory; /* operate in memory now */
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
|
||||
#if PCVT_SCANSET == 2
|
||||
/* put keyboard to return ancient PC scan codes */
|
||||
@ -1534,15 +1593,15 @@ pcvt_xmode_set(int on, struct proc *p)
|
||||
#endif /* PCVT_USEKBDSEC */
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SCANSET == 2
|
||||
/* put keyboard to return ancient PC scan codes */
|
||||
set_controller_command_byte(kbdc,
|
||||
set_controller_command_byte(*(KBDC *)kbd->kb_data,
|
||||
KBD_TRANSLATION, KBD_TRANSLATION);
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_NETBSD > 9
|
||||
fp->tf_eflags |= PSL_IOPL;
|
||||
@ -1579,7 +1638,7 @@ pcvt_xmode_set(int on, struct proc *p)
|
||||
pcvt_set_scrnsv_tmo(saved_scrnsv_tmo);
|
||||
#endif /* PCVT_SCREENSAVER */
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
|
||||
#if PCVT_SCANSET == 2
|
||||
kbc_8042cmd(CONTR_WRITE);
|
||||
@ -1592,13 +1651,14 @@ pcvt_xmode_set(int on, struct proc *p)
|
||||
#endif /* PCVT_USEKBDSEC */
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SCANSET == 2
|
||||
set_controller_command_byte(kbdc, KBD_TRANSLATION, 0);
|
||||
set_controller_command_byte(*(KBDC *)kbd->kb_data,
|
||||
KBD_TRANSLATION, 0);
|
||||
#endif /* PCVT_SCANSET == 2 */
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
if(adaptor_type == MDA_ADAPTOR)
|
||||
{
|
||||
|
@ -107,7 +107,9 @@
|
||||
#endif /* PCVT_FREEBSD >= 200 */
|
||||
|
||||
#include <i386/isa/pcvt/pcvt_conf.h>
|
||||
#include <i386/isa/kbdio.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#if PCVT_NETBSD > 9
|
||||
#include "device.h"
|
||||
@ -168,6 +170,14 @@
|
||||
#include <machine/clock.h>
|
||||
#include <machine/md_var.h>
|
||||
#endif
|
||||
/*
|
||||
* The following values are defined in machine/console.h, but the header
|
||||
* file is not included here due to conflicts with pcvt_ioctl.h.
|
||||
*/
|
||||
#define KDGKBTYPE _IOR('K', 64, int)
|
||||
#define KB_84 1
|
||||
#define KB_101 2
|
||||
#define KB_OTHER 3
|
||||
#else /* PCVT_FREEBSD >= 200 */
|
||||
#include "machine/pc/display.h"
|
||||
#endif /* PCVT_FREEBSD >= 200 */
|
||||
@ -260,7 +270,7 @@ in the config file"
|
||||
* Keyboard and Keyboard Controller
|
||||
*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
|
||||
#define CONTROLLER_CTRL 0x64 /* W - command, R - status */
|
||||
#define CONTROLLER_DATA 0x60 /* R/W - data */
|
||||
@ -308,7 +318,7 @@ in the config file"
|
||||
#define KEYB_C_ECHO 0xee /* diagnostic, echo 0xee */
|
||||
#define KEYB_C_LEDS 0xed /* set/reset numlock,capslock & scroll lock */
|
||||
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
/* responses from the KEYBOARD (via the 8042 controller on mainboard..) */
|
||||
|
||||
@ -1000,10 +1010,10 @@ u_char chargen_access = 0; /* synchronize access */
|
||||
u_char keyboard_type = KB_UNKNOWN; /* type of keyboard */
|
||||
u_char keyboard_is_initialized = 0; /* for ddb sanity */
|
||||
u_char kbd_polling = 0; /* keyboard is being polled */
|
||||
#ifdef _I386_ISA_KBDIO_H_
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
u_char reset_keyboard = 0; /* OK to reset keyboard */
|
||||
KBDC kbdc = NULL; /* keyboard controller */
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
keyboard_t *kbd = NULL;
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SHOWKEYS
|
||||
u_char keyboard_show = 0; /* normal display */
|
||||
@ -1141,10 +1151,10 @@ extern u_char can_do_132col;
|
||||
extern u_char vga_family;
|
||||
extern u_char keyboard_is_initialized;
|
||||
extern u_char kbd_polling;
|
||||
#ifdef _I386_ISA_KBDIO_H_
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
extern u_char reset_keyboard;
|
||||
extern KBDC kbdc;
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
extern keyboard_t *kbd;
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SHOWKEYS
|
||||
extern u_char keyboard_show;
|
||||
@ -1268,10 +1278,10 @@ void fkl_on ( struct video_state *svsp );
|
||||
struct tty *get_pccons ( Dev_t dev );
|
||||
void init_sfkl ( struct video_state *svsp );
|
||||
void init_ufkl ( struct video_state *svsp );
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
int kbd_cmd ( int val );
|
||||
int kbd_response ( void );
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
void kbd_code_init ( void );
|
||||
void kbd_code_init1 ( void );
|
||||
|
||||
|
@ -91,11 +91,9 @@ static void doreset ( void );
|
||||
static void ovlinit ( int force );
|
||||
static void settpmrate ( int rate );
|
||||
static void setlockkeys ( int snc );
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
static int kbc_8042cmd ( int val );
|
||||
#else
|
||||
static int set_keyboard_param( int command, int data );
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
static int getokeydef ( unsigned key, struct kbd_ovlkey *thisdef );
|
||||
static int getckeydef ( unsigned key, struct kbd_ovlkey *thisdef );
|
||||
static int rmkeydef ( int key );
|
||||
@ -170,7 +168,7 @@ do_vgapage(int page)
|
||||
|
||||
#define PCVT_UPDLED_LOSES_INTR 0 /* disabled for now */
|
||||
|
||||
#if PCVT_UPDLED_LOSES_INTR || defined(_I386_ISA_KBDIO_H_)
|
||||
#if PCVT_UPDLED_LOSES_INTR || defined(_DEV_KBD_KBDREG_H_)
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* check for lost keyboard interrupts
|
||||
@ -203,7 +201,7 @@ static struct callout_handle lost_intr_ch =
|
||||
static void
|
||||
check_for_lost_intr (void *arg)
|
||||
{
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
lost_intr_timeout_queued = 0;
|
||||
if (inb(CONTROLLER_CTRL) & STATUS_OUTPBF)
|
||||
{
|
||||
@ -215,19 +213,20 @@ check_for_lost_intr (void *arg)
|
||||
int opri;
|
||||
|
||||
lost_intr_timeout_queued = 0;
|
||||
if (kbdc_lock(kbdc, TRUE)) {
|
||||
if ((*kbdsw[kbd->kb_index]->lock)(kbd, TRUE)) {
|
||||
opri = spltty ();
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
if (kbdc_data_ready(kbdc))
|
||||
(*kbdsw[kbd->kb_index]->lock)(kbd, FALSE);
|
||||
if ((*kbdsw[kbd->kb_index]->check)(kbd))
|
||||
pcrint (0);
|
||||
splx (opri);
|
||||
}
|
||||
|
||||
lost_intr_ch = timeout(check_for_lost_intr, (void *)NULL, hz);
|
||||
lost_intr_timeout_queued = 1;
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
}
|
||||
|
||||
#endif /* PCVT_UPDLED_LOSES_INTR || defined(_I386_ISA_KBDIO_H_) */
|
||||
#endif /* PCVT_UPDLED_LOSES_INTR || defined(_DEV_KBD_KBDREG_H_) */
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
* update keyboard led's
|
||||
@ -242,13 +241,19 @@ update_led(void)
|
||||
int opri, new_ledstate;
|
||||
|
||||
opri = spltty();
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
new_ledstate = (vsp->scroll_lock) |
|
||||
(vsp->num_lock * 2) |
|
||||
(vsp->caps_lock * 4);
|
||||
#else
|
||||
new_ledstate = ((vsp->scroll_lock) ? LED_SCR : 0) |
|
||||
((vsp->num_lock) ? LED_NUM : 0) |
|
||||
((vsp->caps_lock) ? LED_CAP : 0);
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
if (new_ledstate != ledstate)
|
||||
{
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
int response1, response2;
|
||||
|
||||
ledstate = LEDSTATE_UPDATE_PENDING;
|
||||
@ -296,19 +301,20 @@ update_led(void)
|
||||
printf(
|
||||
"Keyboard LED command not ACKed (responses %#x %#x)\n",
|
||||
response1, response2);
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
if (kbdc == NULL) {
|
||||
if (kbd == NULL) {
|
||||
ledstate = new_ledstate;
|
||||
splx(opri);
|
||||
} else {
|
||||
ledstate = LEDSTATE_UPDATE_PENDING;
|
||||
splx(opri);
|
||||
if (set_keyboard_param(KBDC_SET_LEDS, new_ledstate) == 0)
|
||||
if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETLED,
|
||||
(caddr_t)&new_ledstate) == 0)
|
||||
ledstate = new_ledstate;
|
||||
}
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_UPDLED_LOSES_INTR
|
||||
if (lost_intr_timeout_queued)
|
||||
@ -320,7 +326,7 @@ update_led(void)
|
||||
|
||||
}
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
splx(opri);
|
||||
#endif
|
||||
|
||||
@ -333,7 +339,7 @@ update_led(void)
|
||||
static void
|
||||
settpmrate(int rate)
|
||||
{
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
tpmrate = rate & 0x7f;
|
||||
if(kbd_cmd(KEYB_C_TYPEM) != 0)
|
||||
printf("Keyboard TYPEMATIC command timeout\n");
|
||||
@ -341,12 +347,13 @@ settpmrate(int rate)
|
||||
printf("Keyboard TYPEMATIC data timeout\n");
|
||||
#else
|
||||
tpmrate = rate & 0x7f;
|
||||
if (set_keyboard_param(KBDC_SET_TYPEMATIC, tpmrate) != 0)
|
||||
if ((*kbdsw[kbd->kb_index]->ioctl)(kbd, KDSETRAD,
|
||||
(caddr_t)&tpmrate) == 0)
|
||||
printf("pcvt: failed to set keyboard TYPEMATIC.\n");
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
}
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
/*---------------------------------------------------------------------------*
|
||||
* Pass command to keyboard controller (8042)
|
||||
*---------------------------------------------------------------------------*/
|
||||
@ -408,64 +415,7 @@ kbd_response(void)
|
||||
|
||||
return ch;
|
||||
}
|
||||
#else
|
||||
static int
|
||||
set_keyboard_param(int command, int data)
|
||||
{
|
||||
int s;
|
||||
#if 0
|
||||
int c;
|
||||
#endif
|
||||
|
||||
if (kbdc == NULL)
|
||||
return 1;
|
||||
|
||||
/* prevent the timeout routine from polling the keyboard */
|
||||
if (!kbdc_lock(kbdc, TRUE))
|
||||
return 1;
|
||||
|
||||
/* disable the keyboard and mouse interrupt */
|
||||
s = spltty();
|
||||
#if 0
|
||||
c = get_controller_command_byte(kbdc);
|
||||
if ((c == -1)
|
||||
|| !set_controller_command_byte(kbdc,
|
||||
kbdc_get_device_mask(kbdc),
|
||||
KBD_DISABLE_KBD_PORT | KBD_DISABLE_KBD_INT
|
||||
| KBD_DISABLE_AUX_PORT | KBD_DISABLE_AUX_INT)) {
|
||||
/* CONTROLLER ERROR */
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
splx(s);
|
||||
return 1;
|
||||
}
|
||||
/*
|
||||
* Now that the keyboard controller is told not to generate
|
||||
* the keyboard and mouse interrupts, call `splx()' to allow
|
||||
* the other tty interrupts. The clock interrupt may also occur,
|
||||
* but the timeout routine (`scrn_timer()') will be blocked
|
||||
* by the lock flag set via `kbdc_lock()'
|
||||
*/
|
||||
splx(s);
|
||||
#endif
|
||||
|
||||
if (send_kbd_command_and_data(kbdc, command, data) != KBD_ACK)
|
||||
send_kbd_command(kbdc, KBDC_ENABLE_KBD);
|
||||
|
||||
#if 0
|
||||
/* restore the interrupts */
|
||||
if (!set_controller_command_byte(kbdc,
|
||||
kbdc_get_device_mask(kbdc),
|
||||
c & (KBD_KBD_CONTROL_BITS | KBD_AUX_CONTROL_BITS))) {
|
||||
/* CONTROLLER ERROR */
|
||||
}
|
||||
#else
|
||||
splx(s);
|
||||
#endif
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SCANSET > 1
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -474,7 +424,7 @@ set_keyboard_param(int command, int data)
|
||||
void
|
||||
kbd_emulate_pc(int do_emulation)
|
||||
{
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
int cmd, timeo = 10000;
|
||||
|
||||
cmd = COMMAND_SYSFLG|COMMAND_IRQEN; /* common base cmd */
|
||||
@ -492,9 +442,9 @@ kbd_emulate_pc(int do_emulation)
|
||||
break;
|
||||
outb(CONTROLLER_DATA, cmd);
|
||||
#else
|
||||
set_controller_command_byte(kbdc, KBD_TRANSLATION,
|
||||
set_controller_command_byte(*(KBDC *)kbd->kb_data, KBD_TRANSLATION,
|
||||
(do_emulation) ? KBD_TRANSLATION : 0);
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
}
|
||||
|
||||
#endif /* PCVT_SCANSET > 1 */
|
||||
@ -510,7 +460,7 @@ kbd_emulate_pc(int do_emulation)
|
||||
static
|
||||
void doreset(void)
|
||||
{
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
int again = 0;
|
||||
int once = 0;
|
||||
int response, opri;
|
||||
@ -671,10 +621,8 @@ void doreset(void)
|
||||
|
||||
#endif /* PCVT_KEYBDID */
|
||||
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
int c;
|
||||
int m;
|
||||
int s;
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
int type;
|
||||
|
||||
if (!reset_keyboard) /* no, we are not ready to reset */
|
||||
return;
|
||||
@ -684,29 +632,11 @@ void doreset(void)
|
||||
lost_intr_timeout_queued = 0;
|
||||
}
|
||||
|
||||
if (kbdc == NULL)
|
||||
kbdc = kbdc_open(IO_KBD);
|
||||
if (kbd == NULL)
|
||||
return; /* shouldn't happen */
|
||||
(*kbdsw[kbd->kb_index]->init)(kbd);
|
||||
|
||||
if (!kbdc_lock(kbdc, TRUE)) /* strange, somebody got there first */
|
||||
return;
|
||||
|
||||
/* remove any noise */
|
||||
empty_both_buffers(kbdc, 10);
|
||||
|
||||
s = spltty();
|
||||
|
||||
/* save the current controller command byte */
|
||||
m = kbdc_get_device_mask(kbdc) & ~KBD_KBD_CONTROL_BITS;
|
||||
c = get_controller_command_byte(kbdc);
|
||||
if (c == -1) {
|
||||
/* CONTROLLER ERROR */
|
||||
kbdc_set_device_mask(kbdc, m);
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
kbdc = NULL;
|
||||
splx(s);
|
||||
printf("pcvt: unable to get the command byte.\n");
|
||||
return;
|
||||
}
|
||||
ledstate = LEDSTATE_UPDATE_PENDING;
|
||||
|
||||
#if PCVT_USEKBDSEC /* security enabled */
|
||||
|
||||
@ -726,105 +656,33 @@ void doreset(void)
|
||||
|
||||
#endif /* PCVT_USEKBDSEC */
|
||||
|
||||
/* disable the keyboard interrupt and the aux port and interrupt */
|
||||
if (!set_controller_command_byte(kbdc,
|
||||
KBD_KBD_CONTROL_BITS | KBD_TRANSLATION | KBD_OVERRIDE_KBD_LOCK,
|
||||
KBD_ENABLE_KBD_PORT | KBD_DISABLE_KBD_INT | KBDINITCMD)) {
|
||||
/* CONTROLLER ERROR: there is very little we can do... */
|
||||
kbdc_set_device_mask(kbdc, m);
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
kbdc = NULL;
|
||||
splx(s);
|
||||
printf("pcvt: unable to set the command byte.\n");
|
||||
return;
|
||||
}
|
||||
splx(s);
|
||||
|
||||
/* reset keyboard hardware */
|
||||
ledstate = LEDSTATE_UPDATE_PENDING;
|
||||
if (!reset_kbd(kbdc)) {
|
||||
/* KEYBOARD ERROR */
|
||||
empty_both_buffers(kbdc, 10);
|
||||
test_controller(kbdc);
|
||||
test_kbd_port(kbdc);
|
||||
/*
|
||||
* We could disable the keyboard port and interrupt now...
|
||||
* but, the keyboard may still exist.
|
||||
*/
|
||||
printf("pcvt: failed to reset the keyboard.\n");
|
||||
/* try to restore the original command byte */
|
||||
set_controller_command_byte(kbdc, 0xff, c);
|
||||
kbdc_set_device_mask(kbdc, m);
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
kbdc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
#if PCVT_KEYBDID
|
||||
|
||||
keyboard_type = KB_UNKNOWN;
|
||||
if (send_kbd_command(kbdc, KBDC_SEND_DEV_ID) == KBD_ACK) {
|
||||
DELAY(10000); /* 10msec delay */
|
||||
switch (read_kbd_data(kbdc)) {
|
||||
case KEYB_R_MF2ID1:
|
||||
switch (read_kbd_data(kbdc)) {
|
||||
case KEYB_R_MF2ID2:
|
||||
case KEYB_R_MF2ID2HP:
|
||||
keyboard_type = KB_MFII;
|
||||
break;
|
||||
case -1:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case -1:
|
||||
keyboard_type = KB_AT;
|
||||
/* fall through */
|
||||
default:
|
||||
/* XXX: should we read the second byte? */
|
||||
empty_both_buffers(kbdc, 10); /* XXX */
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* The send ID command failed. This error is considered
|
||||
* benign, but may need recovery.
|
||||
*/
|
||||
empty_both_buffers(kbdc, 10);
|
||||
test_controller(kbdc);
|
||||
test_kbd_port(kbdc);
|
||||
}
|
||||
|
||||
#else /* PCVT_KEYBDID */
|
||||
set_controller_command_byte(*(KBDC *)kbd->kb_data,
|
||||
KBD_OVERRIDE_KBD_LOCK | KBD_TRANSLATION, KBDINITCMD);
|
||||
|
||||
keyboard_type = KB_MFII; /* force it .. */
|
||||
|
||||
#endif /* PCVT_KEYBDID */
|
||||
|
||||
/* enable the keyboard port and intr. */
|
||||
if (!set_controller_command_byte(kbdc,
|
||||
KBD_KBD_CONTROL_BITS,
|
||||
KBD_ENABLE_KBD_PORT | KBD_ENABLE_KBD_INT)) {
|
||||
/* CONTROLLER ERROR
|
||||
* This is serious; we are left with the disabled
|
||||
* keyboard intr.
|
||||
*/
|
||||
printf("pcvt: failed to enable the keyboard port and intr.\n");
|
||||
kbdc_set_device_mask(kbdc, m);
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
kbdc = NULL;
|
||||
return;
|
||||
#if PCVT_KEYBDID
|
||||
type = KB_101;
|
||||
(*kbdsw[kbd->kb_index]->ioctl)(kbd, KDGKBTYPE, (caddr_t)&type);
|
||||
switch (type)
|
||||
{
|
||||
case KB_84:
|
||||
keyboard_type = KB_AT;
|
||||
break;
|
||||
case KB_101:
|
||||
keyboard_type = KB_MFII;
|
||||
break;
|
||||
default:
|
||||
keyboard_type = KB_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
kbdc_set_device_mask(kbdc, m | KBD_KBD_CONTROL_BITS);
|
||||
kbdc_lock(kbdc, FALSE);
|
||||
#endif /* PCVT_KEYBDID */
|
||||
|
||||
update_led();
|
||||
|
||||
lost_intr_ch = timeout(check_for_lost_intr, (void *)NULL, hz);
|
||||
lost_intr_timeout_queued = 1;
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*
|
||||
@ -1246,15 +1104,15 @@ sgetc(int noblock)
|
||||
static char keybuf[2] = {0}; /* the second 0 is a delimiter! */
|
||||
#endif /* XSERVER */
|
||||
|
||||
#ifdef _I386_ISA_KBDIO_H_
|
||||
#ifdef _DEV_KBD_KBDREG_H_
|
||||
int c;
|
||||
#endif /* _I386_ISA_KBDIO_H_ */
|
||||
#endif /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
loop:
|
||||
|
||||
#ifdef XSERVER
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
|
||||
#if PCVT_KBD_FIFO
|
||||
|
||||
@ -1289,7 +1147,7 @@ sgetc(int noblock)
|
||||
|
||||
#endif /* !PCVT_KBD_FIFO */
|
||||
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_KBD_FIFO
|
||||
if (pcvt_kbd_count) {
|
||||
@ -1302,18 +1160,18 @@ sgetc(int noblock)
|
||||
} else
|
||||
#endif /* PCVT_KBD_FIFO */
|
||||
if (!noblock) {
|
||||
while ((c = read_kbd_data(kbdc)) == -1)
|
||||
while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, TRUE)) == -1)
|
||||
;
|
||||
dt = c;
|
||||
} else {
|
||||
if ((c = read_kbd_data_no_wait(kbdc)) == -1)
|
||||
if ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) == -1)
|
||||
return NULL;
|
||||
dt = c;
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
/*
|
||||
* If x mode is active, only care for locking keys, then
|
||||
@ -1591,7 +1449,7 @@ sgetc(int noblock)
|
||||
|
||||
#else /* !XSERVER */
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
|
||||
# if PCVT_KBD_FIFO
|
||||
|
||||
@ -1628,7 +1486,7 @@ sgetc(int noblock)
|
||||
|
||||
#endif /* !PCVT_KBD_FIFO */
|
||||
|
||||
#else /* _I386_ISA_KBDIO_H_ */
|
||||
#else /* _DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_KBD_FIFO
|
||||
if (pcvt_kbd_count) {
|
||||
@ -1641,20 +1499,20 @@ sgetc(int noblock)
|
||||
} else
|
||||
#endif /* PCVT_KBD_FIFO */
|
||||
if (!noblock) {
|
||||
while ((c = read_kbd_data(kbdc)) == -1)
|
||||
while ((c = (*kbdsw[kbd->kb_index]->read)(kbd, TRUE)) == -1)
|
||||
;
|
||||
dt = c;
|
||||
} else {
|
||||
if ((c = read_kbd_data_no_wait(kbdc)) == -1)
|
||||
if ((c = (*kbdsw[kbd->kb_index]->read)(kbd, FALSE)) == -1)
|
||||
return NULL;
|
||||
dt = c;
|
||||
}
|
||||
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#endif /* !XSERVER */
|
||||
|
||||
#ifndef _I386_ISA_KBDIO_H_
|
||||
#ifndef _DEV_KBD_KBDREG_H_
|
||||
else
|
||||
{
|
||||
if(noblock)
|
||||
@ -1662,7 +1520,7 @@ sgetc(int noblock)
|
||||
else
|
||||
goto loop;
|
||||
}
|
||||
#endif /* !_I386_ISA_KBDIO_H_ */
|
||||
#endif /* !_DEV_KBD_KBDREG_H_ */
|
||||
|
||||
#if PCVT_SHOWKEYS
|
||||
showkey (' ', dt);
|
||||
|
@ -20,7 +20,7 @@
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: psm.c,v 1.57 1998/11/20 11:46:43 yokota Exp $
|
||||
* $Id: psm.c,v 1.58 1999/01/06 05:40:01 yokota Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -86,9 +86,10 @@
|
||||
#include <machine/limits.h>
|
||||
#include <machine/mouse.h>
|
||||
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
#include <i386/isa/isa_device.h>
|
||||
#include <i386/isa/kbdio.h>
|
||||
|
||||
/*
|
||||
* Driver specific options: the following options may be set by
|
||||
@ -1003,7 +1004,7 @@ psmprobe(struct isa_device *dvp)
|
||||
psm_softc[unit] = sc;
|
||||
kbdc_set_device_mask(sc->kbdc, mask | KBD_AUX_CONTROL_BITS);
|
||||
kbdc_lock(sc->kbdc, FALSE);
|
||||
return (IO_PSMSIZE);
|
||||
return ((dvp->id_iobase < 0) ? -1 : IO_PSMSIZE);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -23,14 +23,20 @@
|
||||
* (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: vesa.c,v 1.10 1998/12/30 11:21:08 yokota Exp $
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
#include "vga.h"
|
||||
#include "opt_vga.h"
|
||||
#include "opt_vesa.h"
|
||||
#include "opt_vm86.h"
|
||||
#include "opt_fb.h"
|
||||
|
||||
#if (NSC > 0 && defined(VESA) && defined(VM86)) || defined(KLD_MODULE)
|
||||
#ifdef VGA_NO_MODE_CHANGE
|
||||
#undef VESA
|
||||
#endif
|
||||
|
||||
#if (NVGA > 0 && defined(VESA) && defined(VM86)) || defined(KLD_MODULE)
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -46,7 +52,18 @@
|
||||
#include <machine/pc/bios.h>
|
||||
#include <machine/pc/vesa.h>
|
||||
|
||||
#include <i386/isa/videoio.h>
|
||||
#include <dev/fb/fbreg.h>
|
||||
#include <dev/fb/vgareg.h>
|
||||
|
||||
#ifndef __i386__
|
||||
#include <isa/isareg.h>
|
||||
#else
|
||||
#include <i386/isa/isa.h>
|
||||
#endif
|
||||
|
||||
#ifndef VESA_DEBUG
|
||||
#define VESA_DEBUG 1
|
||||
#endif
|
||||
|
||||
/* VESA video adapter state buffer stub */
|
||||
struct adp_state {
|
||||
@ -59,11 +76,14 @@ typedef struct adp_state adp_state_t;
|
||||
/* VESA video adapter */
|
||||
static video_adapter_t *vesa_adp = NULL;
|
||||
static int vesa_state_buf_size = 0;
|
||||
#if 0
|
||||
static void *vesa_state_buf = NULL;
|
||||
#endif
|
||||
|
||||
/* VESA functions */
|
||||
static int vesa_nop(void);
|
||||
static vi_probe_t vesa_probe;
|
||||
static vi_init_t vesa_init;
|
||||
static vi_adapter_t vesa_adapter;
|
||||
static vi_get_info_t vesa_get_info;
|
||||
static vi_query_mode_t vesa_query_mode;
|
||||
static vi_set_mode_t vesa_set_mode;
|
||||
@ -78,17 +98,34 @@ static vi_load_state_t vesa_load_state;
|
||||
static vi_set_win_org_t vesa_set_origin;
|
||||
static vi_read_hw_cursor_t vesa_read_hw_cursor;
|
||||
static vi_set_hw_cursor_t vesa_set_hw_cursor;
|
||||
static vi_set_hw_cursor_shape_t vesa_set_hw_cursor_shape;
|
||||
static vi_mmap_t vesa_mmap;
|
||||
static vi_diag_t vesa_diag;
|
||||
|
||||
static struct vidsw vesavidsw = {
|
||||
vesa_init, vesa_adapter, vesa_get_info, vesa_query_mode,
|
||||
vesa_set_mode, vesa_save_font, vesa_load_font, vesa_show_font,
|
||||
vesa_save_palette,vesa_load_palette,vesa_set_border,vesa_save_state,
|
||||
vesa_load_state,vesa_set_origin,vesa_read_hw_cursor,vesa_set_hw_cursor,
|
||||
static video_switch_t vesavidsw = {
|
||||
vesa_probe,
|
||||
vesa_init,
|
||||
vesa_get_info,
|
||||
vesa_query_mode,
|
||||
vesa_set_mode,
|
||||
vesa_save_font,
|
||||
vesa_load_font,
|
||||
vesa_show_font,
|
||||
vesa_save_palette,
|
||||
vesa_load_palette,
|
||||
vesa_set_border,
|
||||
vesa_save_state,
|
||||
vesa_load_state,
|
||||
vesa_set_origin,
|
||||
vesa_read_hw_cursor,
|
||||
vesa_set_hw_cursor,
|
||||
vesa_set_hw_cursor_shape,
|
||||
(vi_blank_display_t *)vesa_nop,
|
||||
vesa_mmap,
|
||||
vesa_diag,
|
||||
};
|
||||
|
||||
static struct vidsw prevvidsw;
|
||||
static video_switch_t *prevvidsw;
|
||||
|
||||
/* VESA BIOS video modes */
|
||||
#define VESA_MAXMODES 64
|
||||
@ -111,6 +148,7 @@ static char *vesa_revstr = NULL;
|
||||
/* local macros and functions */
|
||||
#define BIOS_SADDRTOLADDR(p) ((((p) & 0xffff0000) >> 12) + ((p) & 0x0000ffff))
|
||||
|
||||
static int int10_set_mode(int mode);
|
||||
static int vesa_bios_get_mode(int mode, struct vesa_mode *vmode);
|
||||
static int vesa_bios_set_mode(int mode);
|
||||
static int vesa_bios_set_dac(int bits);
|
||||
@ -146,6 +184,18 @@ dump_buffer(u_char *buf, size_t len)
|
||||
}
|
||||
}
|
||||
|
||||
/* INT 10 BIOS calls */
|
||||
static int
|
||||
int10_set_mode(int mode)
|
||||
{
|
||||
struct vm86frame vmf;
|
||||
|
||||
bzero(&vmf, sizeof(vmf));
|
||||
vmf.vmf_eax = 0x0000 | mode;
|
||||
vm86_intcall(0x10, &vmf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* VESA BIOS calls */
|
||||
static int
|
||||
vesa_bios_get_mode(int mode, struct vesa_mode *vmode)
|
||||
@ -362,8 +412,10 @@ vesa_bios_init(void)
|
||||
if ((err != 0) || (vmf.vmf_eax != 0x4f) || bcmp("VESA", buf, 4))
|
||||
return 1;
|
||||
vesa_adp_info = (struct vesa_info *)buf;
|
||||
if (bootverbose)
|
||||
if (bootverbose) {
|
||||
printf("VESA: information block\n");
|
||||
dump_buffer(buf, 64);
|
||||
}
|
||||
if (vesa_adp_info->v_flags & V_NONVGA)
|
||||
return 1;
|
||||
|
||||
@ -446,42 +498,101 @@ vesa_clear_modes(video_info_t *info, int color)
|
||||
}
|
||||
}
|
||||
|
||||
/* exported functions */
|
||||
/* entry points */
|
||||
|
||||
static int
|
||||
vesa_init(void)
|
||||
vesa_configure(int flags)
|
||||
{
|
||||
video_adapter_t *adp;
|
||||
int adapters;
|
||||
int error;
|
||||
int i;
|
||||
|
||||
adapters = (*prevvidsw.init)();
|
||||
for (i = 0; i < adapters; ++i) {
|
||||
if ((vesa_adp = (*prevvidsw.adapter)(i)) == NULL)
|
||||
continue;
|
||||
if (vesa_adp->va_type == KD_VGA) {
|
||||
vesa_adp->va_flags |= V_ADP_VESA;
|
||||
return adapters;
|
||||
}
|
||||
}
|
||||
vesa_adp = NULL;
|
||||
return adapters;
|
||||
}
|
||||
if (vesa_init_done)
|
||||
return 0;
|
||||
if (flags & VIO_PROBE_ONLY)
|
||||
return 0; /* XXX */
|
||||
|
||||
static video_adapter_t
|
||||
*vesa_adapter(int ad)
|
||||
{
|
||||
return (*prevvidsw.adapter)(ad);
|
||||
/*
|
||||
* If the VESA module has already been loaded, abort loading
|
||||
* the module this time.
|
||||
*/
|
||||
for (i = 0; (adp = vid_get_adapter(i)) != NULL; ++i) {
|
||||
if (adp->va_flags & V_ADP_VESA)
|
||||
return ENXIO;
|
||||
if (adp->va_type == KD_VGA)
|
||||
break;
|
||||
}
|
||||
/*
|
||||
* The VGA adapter is not found. This is because either
|
||||
* 1) the VGA driver has not been initialized, or 2) the VGA card
|
||||
* is not present. If 1) is the case, we shall defer
|
||||
* initialization for now and try again later.
|
||||
*/
|
||||
if (adp == NULL) {
|
||||
vga_sub_configure = vesa_configure;
|
||||
return ENODEV;
|
||||
}
|
||||
|
||||
/* count number of registered adapters */
|
||||
for (++i; vid_get_adapter(i) != NULL; ++i)
|
||||
;
|
||||
adapters = i;
|
||||
|
||||
/* call VESA BIOS */
|
||||
vesa_adp = adp;
|
||||
if (vesa_bios_init()) {
|
||||
vesa_adp = NULL;
|
||||
return ENXIO;
|
||||
}
|
||||
vesa_adp->va_flags |= V_ADP_VESA;
|
||||
|
||||
/* remove conflicting modes if we have more than one adapter */
|
||||
if (adapters > 1) {
|
||||
vesa_clear_modes(vesa_vmode,
|
||||
(vesa_adp->va_flags & V_ADP_COLOR) ?
|
||||
V_INFO_COLOR : 0);
|
||||
}
|
||||
|
||||
if ((error = vesa_load_ioctl()) == 0) {
|
||||
prevvidsw = vidsw[vesa_adp->va_index];
|
||||
vidsw[vesa_adp->va_index] = &vesavidsw;
|
||||
vesa_init_done = TRUE;
|
||||
} else {
|
||||
vesa_adp = NULL;
|
||||
return error;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_get_info(int ad, int mode, video_info_t *info)
|
||||
vesa_nop(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_probe(int unit, video_adapter_t **adpp, void *arg, int flags)
|
||||
{
|
||||
return (*prevvidsw->probe)(unit, adpp, arg, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_init(int unit, video_adapter_t *adp, int flags)
|
||||
{
|
||||
return (*prevvidsw->init)(unit, adp, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_get_info(video_adapter_t *adp, int mode, video_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((*prevvidsw.get_info)(ad, mode, info) == 0)
|
||||
if ((*prevvidsw->get_info)(adp, mode, info) == 0)
|
||||
return 0;
|
||||
|
||||
if (ad != vesa_adp->va_index)
|
||||
if (adp != vesa_adp)
|
||||
return 1;
|
||||
|
||||
mode = vesa_map_gen_mode_num(vesa_adp->va_type,
|
||||
@ -498,13 +609,13 @@ vesa_get_info(int ad, int mode, video_info_t *info)
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_query_mode(int ad, video_info_t *info)
|
||||
vesa_query_mode(video_adapter_t *adp, video_info_t *info)
|
||||
{
|
||||
int i;
|
||||
|
||||
if ((i = (*prevvidsw.query_mode)(ad, info)) != -1)
|
||||
if ((i = (*prevvidsw->query_mode)(adp, info)) != -1)
|
||||
return i;
|
||||
if (ad != vesa_adp->va_index)
|
||||
if (adp != vesa_adp)
|
||||
return -1;
|
||||
|
||||
for (i = 0; vesa_vmode[i].vi_mode != EOT; ++i) {
|
||||
@ -536,17 +647,19 @@ vesa_query_mode(int ad, video_info_t *info)
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_set_mode(int ad, int mode)
|
||||
vesa_set_mode(video_adapter_t *adp, int mode)
|
||||
{
|
||||
video_info_t info;
|
||||
#if 0
|
||||
size_t len;
|
||||
#endif
|
||||
|
||||
if (ad != vesa_adp->va_index)
|
||||
return (*prevvidsw.set_mode)(ad, mode);
|
||||
if (adp != vesa_adp)
|
||||
return (*prevvidsw->set_mode)(adp, mode);
|
||||
|
||||
mode = vesa_map_gen_mode_num(vesa_adp->va_type,
|
||||
vesa_adp->va_flags & V_ADP_COLOR, mode);
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: set_mode(): %d(%x) -> %d(%x)\n",
|
||||
vesa_adp->va_mode, vesa_adp->va_mode, mode, mode);
|
||||
#endif
|
||||
@ -554,37 +667,40 @@ vesa_set_mode(int ad, int mode)
|
||||
* If the current mode is a VESA mode and the new mode is not,
|
||||
* restore the state of the adapter first, so that non-standard,
|
||||
* extended SVGA registers are set to the state compatible with
|
||||
* the standard VGA modes. Otherwise (*prevvidsw.set_mode)()
|
||||
* the standard VGA modes. Otherwise (*prevvidsw->set_mode)()
|
||||
* may not be able to set up the new mode correctly.
|
||||
*/
|
||||
if (VESA_MODE(vesa_adp->va_mode)) {
|
||||
if ((*prevvidsw.get_info)(ad, mode, &info) == 0) {
|
||||
if ((*prevvidsw->get_info)(adp, mode, &info) == 0) {
|
||||
int10_set_mode(vesa_adp->va_initial_bios_mode);
|
||||
#if 0
|
||||
/* assert(vesa_state_buf != NULL); */
|
||||
if ((vesa_state_buf == NULL)
|
||||
|| vesa_load_state(ad, vesa_state_buf))
|
||||
|| vesa_load_state(adp, vesa_state_buf))
|
||||
return 1;
|
||||
free(vesa_state_buf, M_DEVBUF);
|
||||
vesa_state_buf = NULL;
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: restored\n");
|
||||
#endif
|
||||
#endif /* 0 */
|
||||
}
|
||||
/*
|
||||
* once (*prevvidsw.get_info)() succeeded,
|
||||
* (*prevvidsw.set_mode)() below won't fail...
|
||||
* once (*prevvidsw->get_info)() succeeded,
|
||||
* (*prevvidsw->set_mode)() below won't fail...
|
||||
*/
|
||||
}
|
||||
|
||||
/* we may not need to handle this mode after all... */
|
||||
if ((*prevvidsw.set_mode)(ad, mode) == 0)
|
||||
if ((*prevvidsw->set_mode)(adp, mode) == 0)
|
||||
return 0;
|
||||
|
||||
/* is the new mode supported? */
|
||||
if (vesa_get_info(ad, mode, &info))
|
||||
if (vesa_get_info(adp, mode, &info))
|
||||
return 1;
|
||||
/* assert(VESA_MODE(mode)); */
|
||||
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: about to set a VESA mode...\n");
|
||||
#endif
|
||||
/*
|
||||
@ -592,27 +708,29 @@ vesa_set_mode(int ad, int mode)
|
||||
* so that the adapter state can be restored later when a non-VESA
|
||||
* mode is to be set up. See above.
|
||||
*/
|
||||
#if 0
|
||||
if (!VESA_MODE(vesa_adp->va_mode) && (vesa_state_buf == NULL)) {
|
||||
len = vesa_save_state(ad, NULL, 0);
|
||||
len = vesa_save_state(adp, NULL, 0);
|
||||
vesa_state_buf = malloc(len, M_DEVBUF, M_WAITOK);
|
||||
if (vesa_save_state(ad, vesa_state_buf, len)) {
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
if (vesa_save_state(adp, vesa_state_buf, len)) {
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: state save failed! (len=%d)\n", len);
|
||||
#endif
|
||||
free(vesa_state_buf, M_DEVBUF);
|
||||
vesa_state_buf = NULL;
|
||||
return 1;
|
||||
}
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: saved (len=%d)\n", len);
|
||||
dump_buffer(vesa_state_buf, len);
|
||||
#endif
|
||||
}
|
||||
#endif /* 0 */
|
||||
|
||||
if (vesa_bios_set_mode(mode))
|
||||
return 1;
|
||||
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
#if VESA_DEBUG > 0
|
||||
printf("VESA: mode set!\n");
|
||||
#endif
|
||||
vesa_adp->va_mode = mode;
|
||||
@ -620,7 +738,7 @@ vesa_set_mode(int ad, int mode)
|
||||
vesa_adp->va_flags |=
|
||||
(info.vi_flags & V_INFO_COLOR) ? V_ADP_COLOR : 0;
|
||||
vesa_adp->va_crtc_addr =
|
||||
(vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_BASE : MONO_BASE;
|
||||
(vesa_adp->va_flags & V_ADP_COLOR) ? COLOR_CRTC : MONO_CRTC;
|
||||
vesa_adp->va_window = BIOS_PADDRTOVADDR(info.vi_window);
|
||||
vesa_adp->va_window_size = info.vi_window_size;
|
||||
vesa_adp->va_window_gran = info.vi_window_gran;
|
||||
@ -632,58 +750,63 @@ vesa_set_mode(int ad, int mode)
|
||||
vesa_adp->va_buffer_size = info.vi_buffer_size;
|
||||
}
|
||||
|
||||
/* move hardware cursor out of the way */
|
||||
(*vidsw[adp->va_index]->set_hw_cursor)(adp, -1, -1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_save_font(int ad, int page, int fontsize, u_char *data, int ch, int count)
|
||||
vesa_save_font(video_adapter_t *adp, int page, int fontsize, u_char *data,
|
||||
int ch, int count)
|
||||
{
|
||||
return (*prevvidsw.save_font)(ad, page, fontsize, data, ch, count);
|
||||
return (*prevvidsw->save_font)(adp, page, fontsize, data, ch, count);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_load_font(int ad, int page, int fontsize, u_char *data, int ch, int count)
|
||||
vesa_load_font(video_adapter_t *adp, int page, int fontsize, u_char *data,
|
||||
int ch, int count)
|
||||
{
|
||||
return (*prevvidsw.load_font)(ad, page, fontsize, data, ch, count);
|
||||
return (*prevvidsw->load_font)(adp, page, fontsize, data, ch, count);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_show_font(int ad, int page)
|
||||
vesa_show_font(video_adapter_t *adp, int page)
|
||||
{
|
||||
return (*prevvidsw.show_font)(ad, page);
|
||||
return (*prevvidsw->show_font)(adp, page);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_save_palette(int ad, u_char *palette)
|
||||
vesa_save_palette(video_adapter_t *adp, u_char *palette)
|
||||
{
|
||||
if ((ad != vesa_adp->va_index) || !(vesa_adp_info->v_flags & V_DAC8)
|
||||
if ((adp != vesa_adp) || !(vesa_adp_info->v_flags & V_DAC8)
|
||||
|| vesa_bios_set_dac(8))
|
||||
return (*prevvidsw.save_palette)(ad, palette);
|
||||
return (*prevvidsw->save_palette)(adp, palette);
|
||||
|
||||
return vesa_bios_save_palette(0, 256, palette);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_load_palette(int ad, u_char *palette)
|
||||
vesa_load_palette(video_adapter_t *adp, u_char *palette)
|
||||
{
|
||||
if ((ad != vesa_adp->va_index) || !(vesa_adp_info->v_flags & V_DAC8)
|
||||
if ((adp != vesa_adp) || !(vesa_adp_info->v_flags & V_DAC8)
|
||||
|| vesa_bios_set_dac(8))
|
||||
return (*prevvidsw.load_palette)(ad, palette);
|
||||
return (*prevvidsw->load_palette)(adp, palette);
|
||||
|
||||
return vesa_bios_load_palette(0, 256, palette);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_set_border(int ad, int color)
|
||||
vesa_set_border(video_adapter_t *adp, int color)
|
||||
{
|
||||
return (*prevvidsw.set_border)(ad, color);
|
||||
return (*prevvidsw->set_border)(adp, color);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_save_state(int ad, void *p, size_t size)
|
||||
vesa_save_state(video_adapter_t *adp, void *p, size_t size)
|
||||
{
|
||||
if (ad != vesa_adp->va_index)
|
||||
return (*prevvidsw.save_state)(ad, p, size);
|
||||
if (adp != vesa_adp)
|
||||
return (*prevvidsw->save_state)(adp, p, size);
|
||||
|
||||
if (vesa_state_buf_size == 0)
|
||||
vesa_state_buf_size = vesa_bios_state_buf_size();
|
||||
@ -699,18 +822,17 @@ vesa_save_state(int ad, void *p, size_t size)
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_load_state(int ad, void *p)
|
||||
vesa_load_state(video_adapter_t *adp, void *p)
|
||||
{
|
||||
if ((ad != vesa_adp->va_index)
|
||||
|| (((adp_state_t *)p)->sig != V_STATE_SIG))
|
||||
return (*prevvidsw.load_state)(ad, p);
|
||||
if ((adp != vesa_adp) || (((adp_state_t *)p)->sig != V_STATE_SIG))
|
||||
return (*prevvidsw->load_state)(adp, p);
|
||||
|
||||
return vesa_bios_save_restore(STATE_LOAD, ((adp_state_t *)p)->regs,
|
||||
vesa_state_buf_size);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_set_origin(int ad, off_t offset)
|
||||
vesa_set_origin(video_adapter_t *adp, off_t offset)
|
||||
{
|
||||
struct vm86frame vmf;
|
||||
int err;
|
||||
@ -721,8 +843,8 @@ vesa_set_origin(int ad, off_t offset)
|
||||
* error checking is kept minimal and let the VESA BIOS to
|
||||
* detect error.
|
||||
*/
|
||||
if (ad != vesa_adp->va_index)
|
||||
return (*prevvidsw.set_win_org)(ad, offset);
|
||||
if (adp != vesa_adp)
|
||||
return (*prevvidsw->set_win_org)(adp, offset);
|
||||
|
||||
if (vesa_adp->va_window_gran == 0)
|
||||
return 1;
|
||||
@ -735,26 +857,45 @@ vesa_set_origin(int ad, off_t offset)
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_read_hw_cursor(int ad, int *col, int *row)
|
||||
vesa_read_hw_cursor(video_adapter_t *adp, int *col, int *row)
|
||||
{
|
||||
return (*prevvidsw.read_hw_cursor)(ad, col, row);
|
||||
return (*prevvidsw->read_hw_cursor)(adp, col, row);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_set_hw_cursor(int ad, int col, int row)
|
||||
vesa_set_hw_cursor(video_adapter_t *adp, int col, int row)
|
||||
{
|
||||
return (*prevvidsw.set_hw_cursor)(ad, col, row);
|
||||
return (*prevvidsw->set_hw_cursor)(adp, col, row);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_diag(int level)
|
||||
vesa_set_hw_cursor_shape(video_adapter_t *adp, int base, int height,
|
||||
int celsize, int blink)
|
||||
{
|
||||
return (*prevvidsw->set_hw_cursor_shape)(adp, base, height, celsize,
|
||||
blink);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_mmap(video_adapter_t *adp, vm_offset_t offset)
|
||||
{
|
||||
return (*prevvidsw->mmap)(adp, offset);
|
||||
}
|
||||
|
||||
static int
|
||||
vesa_diag(video_adapter_t *adp, int level)
|
||||
{
|
||||
#if VESA_DEBUG > 1
|
||||
struct vesa_mode vmode;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
if (adp != vesa_adp)
|
||||
return 1;
|
||||
|
||||
#ifndef KLD_MODULE
|
||||
/* call the previous handler first */
|
||||
(*prevvidsw.diag)(level);
|
||||
(*prevvidsw->diag)(adp, level);
|
||||
#endif
|
||||
|
||||
/* general adapter information */
|
||||
@ -784,6 +925,7 @@ vesa_diag(int level)
|
||||
printf("VESA: %s\n", vesa_revstr);
|
||||
}
|
||||
|
||||
#if VESA_DEBUG > 1
|
||||
/* mode information */
|
||||
for (i = 0;
|
||||
(i < (M_VESA_MODE_MAX - M_VESA_BASE + 1))
|
||||
@ -818,70 +960,31 @@ vesa_diag(int level)
|
||||
printf("size:%dk, gran:%dk\n",
|
||||
vmode.v_wsize, vmode.v_wgran);
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* module loading */
|
||||
|
||||
#ifdef KLD_MODULE
|
||||
static
|
||||
#endif
|
||||
int
|
||||
static int
|
||||
vesa_load(void)
|
||||
{
|
||||
int adapters;
|
||||
int error;
|
||||
#ifdef KLD_MODULE
|
||||
int s;
|
||||
#endif
|
||||
int i;
|
||||
|
||||
if (vesa_init_done)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* If the VESA module is statically linked to the kernel, or
|
||||
* it has already been loaded, abort loading this module this time.
|
||||
*/
|
||||
vesa_adp = NULL;
|
||||
adapters = (*biosvidsw.init)();
|
||||
for (i = 0; i < adapters; ++i) {
|
||||
if ((vesa_adp = (*biosvidsw.adapter)(i)) == NULL)
|
||||
continue;
|
||||
if (vesa_adp->va_flags & V_ADP_VESA)
|
||||
return ENXIO;
|
||||
if (vesa_adp->va_type == KD_VGA)
|
||||
break;
|
||||
}
|
||||
/* if a VGA adapter is not found, abort */
|
||||
if (i >= adapters)
|
||||
return ENXIO;
|
||||
|
||||
if (vesa_bios_init())
|
||||
return ENXIO;
|
||||
vesa_adp->va_flags |= V_ADP_VESA;
|
||||
|
||||
/* remove conflicting modes if we have more than one adapter */
|
||||
if (adapters > 1) {
|
||||
vesa_clear_modes(vesa_vmode,
|
||||
(vesa_adp->va_flags & V_ADP_COLOR) ?
|
||||
V_INFO_COLOR : 0);
|
||||
}
|
||||
|
||||
#ifdef KLD_MODULE
|
||||
/* locate a VGA adapter */
|
||||
s = spltty();
|
||||
#endif
|
||||
if ((error = vesa_load_ioctl()) == 0) {
|
||||
bcopy(&biosvidsw, &prevvidsw, sizeof(prevvidsw));
|
||||
bcopy(&vesavidsw, &biosvidsw, sizeof(vesavidsw));
|
||||
vesa_init_done = TRUE;
|
||||
}
|
||||
#ifdef KLD_MODULE
|
||||
vesa_adp = NULL;
|
||||
error = vesa_configure(0);
|
||||
splx(s);
|
||||
|
||||
#ifdef KLD_MODULE
|
||||
if (error == 0)
|
||||
vesa_diag(bootverbose);
|
||||
vesa_diag(vesa_adp, bootverbose);
|
||||
#endif
|
||||
|
||||
return error;
|
||||
@ -905,9 +1008,9 @@ vesa_unload(void)
|
||||
|
||||
s = spltty();
|
||||
if ((error = vesa_unload_ioctl()) == 0) {
|
||||
if (vesa_adp)
|
||||
if (vesa_adp != NULL)
|
||||
vesa_adp->va_flags &= ~V_ADP_VESA;
|
||||
bcopy(&prevvidsw, &biosvidsw, sizeof(biosvidsw));
|
||||
vidsw[vesa_adp->va_index] = prevvidsw;
|
||||
}
|
||||
splx(s);
|
||||
|
||||
@ -934,8 +1037,13 @@ static moduledata_t vesa_mod = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
DECLARE_MODULE(vesa, vesa_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE);
|
||||
DECLARE_MODULE(vesa, vesa_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE);
|
||||
|
||||
#else /* KLD_MODULE */
|
||||
|
||||
SYSINIT(vesa, SI_SUB_DRIVERS, SI_ORDER_MIDDLE,
|
||||
(void (*)(void *))vesa_load, NULL);
|
||||
|
||||
#endif /* KLD_MODULE */
|
||||
|
||||
#endif /* (NSC > 0 && VESA && VM86) || KLD_MODULE */
|
||||
#endif /* (NVGA > 0 && VESA && VM86) || KLD_MODULE */
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: blank_saver.c,v 1.13 1998/09/17 19:40:29 sos Exp $
|
||||
* $Id: blank_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -33,18 +33,18 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/fb/vgareg.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
blank_saver(int blank)
|
||||
static int
|
||||
blank_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
u_char val;
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
|
||||
@ -53,18 +53,18 @@ blank_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x25);
|
||||
outb(adp->va_crtc_addr + 4, 0x25);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x21);
|
||||
outb(adp->va_crtc_addr + 4, 0x21);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
|
||||
@ -73,24 +73,23 @@ blank_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x2d);
|
||||
outb(adp->va_crtc_addr + 4, 0x2d);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x29);
|
||||
outb(adp->va_crtc_addr + 4, 0x29);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
blank_saver_load(void)
|
||||
blank_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -101,13 +100,17 @@ blank_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(blank_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
blank_saver_unload(void)
|
||||
blank_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(blank_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(blank_saver);
|
||||
static scrn_saver_t blank_module = {
|
||||
"blank_saver", blank_init, blank_term, blank_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(blank_saver, blank_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: daemon_saver.c,v 1.11 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: daemon_saver.c,v 1.12 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -49,6 +49,7 @@
|
||||
static char *message;
|
||||
static int messagelen;
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
/* Who is the author of this ASCII pic? */
|
||||
|
||||
@ -184,8 +185,8 @@ draw_string(int xpos, int ypos, int xoff, char *s, int len)
|
||||
scr_map[s[x]]|(FG_LIGHTGREEN|BG_BLACK)<<8;
|
||||
}
|
||||
|
||||
static void
|
||||
daemon_saver(int blank)
|
||||
static int
|
||||
daemon_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int txpos = 10, typos = 10;
|
||||
static int txdir = -1, tydir = -1;
|
||||
@ -198,20 +199,19 @@ daemon_saver(int blank)
|
||||
int min, max;
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked == 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (blanked == 0) {
|
||||
window = (u_short *)adp->va_window;
|
||||
/* clear the screen and set the border color */
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
xlen = ylen = tlen = 0;
|
||||
}
|
||||
if (scrn_blanked++ < 2)
|
||||
return;
|
||||
scrn_blanked = 1;
|
||||
if (blanked++ < 2)
|
||||
return 0;
|
||||
blanked = 1;
|
||||
|
||||
clear_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
|
||||
clear_string(txpos, typos, toff, (char *)message, tlen);
|
||||
@ -322,39 +322,31 @@ daemon_saver(int blank)
|
||||
draw_daemon(dxpos, dypos, dxdir, xoff, yoff, xlen, ylen);
|
||||
draw_string(txpos, typos, toff, (char *)message, tlen);
|
||||
} else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
daemon_saver_load(void)
|
||||
daemon_init(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
messagelen = strlen(hostname) + 3 + strlen(ostype) + 1 +
|
||||
strlen(osrelease);
|
||||
message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
|
||||
sprintf(message, "%s - %s %s", hostname, ostype, osrelease);
|
||||
|
||||
err = add_scrn_saver(daemon_saver);
|
||||
if (err != 0)
|
||||
free(message, M_DEVBUF);
|
||||
return err;
|
||||
blanked = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
daemon_saver_unload(void)
|
||||
daemon_term(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = remove_scrn_saver(daemon_saver);
|
||||
if (err == 0)
|
||||
free(message, M_DEVBUF);
|
||||
return err;
|
||||
free(message, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(daemon_saver);
|
||||
static scrn_saver_t daemon_module = {
|
||||
"daemon_saver", daemon_init, daemon_term, daemon_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(daemon_saver, daemon_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: fade_saver.c,v 1.14 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: fade_saver.c,v 1.15 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -37,18 +37,22 @@
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
fade_saver(int blank)
|
||||
static u_char palette[256*3];
|
||||
static int blanked;
|
||||
|
||||
static int
|
||||
fade_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int count = 0;
|
||||
u_char pal[256*3];
|
||||
int i;
|
||||
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
blanked = TRUE;
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
if (count <= 0)
|
||||
save_palette(adp, palette);
|
||||
if (count < 64) {
|
||||
pal[0] = pal[1] = pal[2] = 0;
|
||||
for (i = 3; i < 256*3; i++) {
|
||||
@ -57,7 +61,7 @@ fade_saver(int blank)
|
||||
else
|
||||
pal[i] = 60;
|
||||
}
|
||||
load_palette(cur_console, pal);
|
||||
load_palette(adp, pal);
|
||||
count++;
|
||||
}
|
||||
break;
|
||||
@ -65,44 +69,44 @@ fade_saver(int blank)
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x25);
|
||||
outb(adp->va_crtc_addr + 4, 0x25);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x21);
|
||||
outb(adp->va_crtc_addr + 4, 0x21);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
load_palette(cur_console, palette);
|
||||
load_palette(adp, palette);
|
||||
count = 0;
|
||||
break;
|
||||
case KD_EGA:
|
||||
/* not yet done XXX */
|
||||
break;
|
||||
case KD_CGA:
|
||||
outb(crtc_addr + 4, 0x2d);
|
||||
outb(adp->va_crtc_addr + 4, 0x2d);
|
||||
break;
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
outb(crtc_addr + 4, 0x29);
|
||||
outb(adp->va_crtc_addr + 4, 0x29);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
blanked = FALSE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fade_saver_load(void)
|
||||
fade_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -117,13 +121,18 @@ fade_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(fade_saver);
|
||||
blanked = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
fade_saver_unload(void)
|
||||
fade_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(fade_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(fade_saver);
|
||||
static scrn_saver_t fade_module = {
|
||||
"fade_saver", fade_init, fade_term, fade_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(fade_saver, fade_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: green_saver.c,v 1.13 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: green_saver.c,v 1.14 1998/11/04 03:49:38 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -33,18 +33,21 @@
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
|
||||
#include <dev/fb/vgareg.h>
|
||||
|
||||
#include <i386/isa/isa.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static void
|
||||
green_saver(int blank)
|
||||
static int
|
||||
green_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
int crtc_addr;
|
||||
u_char val;
|
||||
|
||||
crtc_addr = adp->va_crtc_addr;
|
||||
if (blank) {
|
||||
scrn_blanked = 1;
|
||||
cur_console->status |= SAVER_RUNNING;
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val | 0x20);
|
||||
@ -66,7 +69,7 @@ green_saver(int blank)
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_VGA:
|
||||
outb(TSIDX, 0x01); val = inb(TSREG);
|
||||
outb(TSIDX, 0x01); outb(TSREG, val & 0xDF);
|
||||
@ -86,15 +89,14 @@ green_saver(int blank)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
cur_console->status &= ~SAVER_RUNNING;
|
||||
scrn_blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
green_saver_load(void)
|
||||
green_init(video_adapter_t *adp)
|
||||
{
|
||||
switch (crtc_type) {
|
||||
switch (adp->va_type) {
|
||||
case KD_MONO:
|
||||
case KD_HERCULES:
|
||||
case KD_CGA:
|
||||
@ -109,13 +111,17 @@ green_saver_load(void)
|
||||
default:
|
||||
return ENODEV;
|
||||
}
|
||||
return add_scrn_saver(green_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
green_saver_unload(void)
|
||||
green_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(green_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(green_saver);
|
||||
static scrn_saver_t green_module = {
|
||||
"green_saver", green_init, green_term, green_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(green_saver, green_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: logo_saver.c,v 1.1 1998/12/28 14:22:57 des Exp $
|
||||
* $Id: logo_saver.c,v 1.2 1999/01/01 14:40:49 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,26 +34,24 @@
|
||||
#include <sys/module.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
|
||||
#include <saver.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int banksize, scrmode, scrw, scrh;
|
||||
static u_char save_pal[768];
|
||||
static int blanked;
|
||||
|
||||
#include "logo.c"
|
||||
|
||||
#define set_origin(scp, o) (*biosvidsw.set_win_org)((scp)->adp, o)
|
||||
#define set_origin(adp, o) (*vidsw[(adp)->va_index]->set_win_org)(adp, o)
|
||||
|
||||
static void
|
||||
logo_blit(int x, int y)
|
||||
logo_blit(video_adapter_t *adp, int x, int y)
|
||||
{
|
||||
int d, l, o, p;
|
||||
|
||||
for (o = 0, p = y * scrw + x; p > banksize; p -= banksize)
|
||||
o += banksize;
|
||||
set_origin(cur_console, o);
|
||||
set_origin(adp, o);
|
||||
|
||||
for (d = 0; d < sizeof logo_img; d += logo_w) {
|
||||
if (p + logo_w < banksize) {
|
||||
@ -62,12 +60,12 @@ logo_blit(int x, int y)
|
||||
} else if (p < banksize) {
|
||||
l = banksize - p;
|
||||
bcopy(logo_img + d, vid + p, l);
|
||||
set_origin(cur_console, (o += banksize));
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d + l, vid, logo_w - l);
|
||||
p += scrw - banksize;
|
||||
} else {
|
||||
p -= banksize;
|
||||
set_origin(cur_console, (o += banksize));
|
||||
set_origin(adp, (o += banksize));
|
||||
bcopy(logo_img + d, vid + p, logo_w);
|
||||
p += scrw;
|
||||
}
|
||||
@ -75,7 +73,7 @@ logo_blit(int x, int y)
|
||||
}
|
||||
|
||||
static void
|
||||
logo_update(void)
|
||||
logo_update(video_adapter_t *adp)
|
||||
{
|
||||
static int xpos = 0, ypos = 0;
|
||||
static int xinc = 1, yinc = 1;
|
||||
@ -89,62 +87,42 @@ logo_update(void)
|
||||
ypos += yinc;
|
||||
|
||||
/* XXX Relies on margin around logo to erase trail */
|
||||
logo_blit(xpos, ypos);
|
||||
logo_blit(adp, xpos, ypos);
|
||||
}
|
||||
|
||||
static void
|
||||
logo_saver(int blank)
|
||||
static int
|
||||
logo_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int i, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = scrmode;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, (char *)save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, (char *)logo_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, scrmode, logo_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
for (i = 0; i < scrw*scrh; i += banksize) {
|
||||
set_origin(scp, i);
|
||||
set_origin(adp, i);
|
||||
bzero(vid, banksize);
|
||||
}
|
||||
}
|
||||
logo_update();
|
||||
logo_update(adp);
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, (char *)save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
logo_saver_load(void)
|
||||
logo_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int adp;
|
||||
|
||||
adp = cur_console->adp;
|
||||
if (!(*biosvidsw.get_info)(adp, M_VESA_CG800x600, &info)) {
|
||||
if (!get_mode_info(adp, M_VESA_CG800x600, &info)) {
|
||||
scrmode = M_VESA_CG800x600;
|
||||
} else if (!(*biosvidsw.get_info)(adp, M_VGA_CG320, &info)) {
|
||||
} else if (!get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
scrmode = M_VGA_CG320;
|
||||
} else {
|
||||
log(LOG_NOTICE, "logo_saver: no suitable graphics mode\n");
|
||||
@ -154,14 +132,19 @@ logo_saver_load(void)
|
||||
banksize = info.vi_window_size;
|
||||
scrw = info.vi_width;
|
||||
scrh = info.vi_height;
|
||||
blanked = 0;
|
||||
|
||||
return add_scrn_saver(logo_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
logo_saver_unload(void)
|
||||
logo_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(logo_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(logo_saver);
|
||||
static scrn_saver_t logo_module = {
|
||||
"logo_saver", logo_init, logo_term, logo_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(logo_saver, logo_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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$
|
||||
* $Id: rain_saver.c,v 1.1 1998/12/31 13:41:40 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -34,7 +34,6 @@
|
||||
#include <sys/module.h>
|
||||
#include <sys/syslog.h>
|
||||
|
||||
#include <machine/md_var.h>
|
||||
#include <machine/random.h>
|
||||
|
||||
#include <saver.h>
|
||||
@ -45,11 +44,11 @@ static u_char *vid;
|
||||
#define SCRH 200
|
||||
#define MAX 63
|
||||
|
||||
static u_char save_pal[768];
|
||||
static u_char rain_pal[768];
|
||||
static int blanked;
|
||||
|
||||
static void
|
||||
rain_update(void)
|
||||
rain_update(video_adapter_t *adp)
|
||||
{
|
||||
int i, t;
|
||||
|
||||
@ -57,28 +56,21 @@ rain_update(void)
|
||||
for (i = (MAX*3+2); i > 5; i -= 3)
|
||||
rain_pal[i] = rain_pal[i-3];
|
||||
rain_pal[5] = t;
|
||||
load_palette(cur_console, rain_pal);
|
||||
load_palette(adp, rain_pal);
|
||||
}
|
||||
|
||||
static void
|
||||
rain_saver(int blank)
|
||||
static int
|
||||
rain_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int i, j, k, pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = M_VGA_CG320;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, rain_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, M_VGA_CG320, rain_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
for (i = 0; i < SCRW; i += 2)
|
||||
@ -89,33 +81,22 @@ rain_saver(int blank)
|
||||
}
|
||||
|
||||
/* update display */
|
||||
rain_update();
|
||||
rain_update(adp);
|
||||
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rain_saver_load(void)
|
||||
rain_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int i;
|
||||
|
||||
/* check that the console is capable of running in 320x200x256 */
|
||||
if ((*biosvidsw.get_info)(cur_console->adp, M_VGA_CG320, &info)) {
|
||||
if (get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
log(LOG_NOTICE, "rain_saver: the console does not support M_VGA_CG320\n");
|
||||
return ENODEV;
|
||||
}
|
||||
@ -124,13 +105,19 @@ rain_saver_load(void)
|
||||
for (i = 3; i < (MAX+1)*3; i += 3)
|
||||
rain_pal[i+2] = rain_pal[i-1] + 4;
|
||||
|
||||
return add_scrn_saver(rain_saver);
|
||||
blanked = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
rain_saver_unload(void)
|
||||
rain_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(rain_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(rain_saver);
|
||||
static scrn_saver_t rain_module = {
|
||||
"rain_saver", rain_init, rain_term, rain_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(rain_saver, rain_module);
|
||||
|
@ -25,40 +25,24 @@
|
||||
* (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: saver.h,v 1.13 1998/11/04 03:49:38 peter Exp $
|
||||
* $Id: saver.h,v 1.14 1998/12/31 13:40:26 des Exp $
|
||||
*/
|
||||
#include <machine/apm_bios.h>
|
||||
#include <machine/console.h>
|
||||
|
||||
#include <i386/isa/videoio.h>
|
||||
#include <i386/isa/syscons.h>
|
||||
#include <dev/fb/fbreg.h>
|
||||
#include <dev/fb/splashreg.h>
|
||||
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
#define set_video_mode(adp, mode, pal, border) \
|
||||
{ \
|
||||
(*vidsw[(adp)->va_index]->set_mode)((adp), (mode)); \
|
||||
(*vidsw[(adp)->va_index]->load_palette)((adp), (pal)); \
|
||||
(*vidsw[(adp)->va_index]->set_border)((adp), (border)); \
|
||||
}
|
||||
#define get_mode_info(adp, mode, buf) \
|
||||
(*vidsw[(adp)->va_index]->get_info)((adp), (mode), (buf))
|
||||
|
||||
extern scr_stat *cur_console;
|
||||
extern u_short *Crtat;
|
||||
extern u_int crtc_addr;
|
||||
extern char crtc_type;
|
||||
extern char scr_map[];
|
||||
extern int scrn_blanked;
|
||||
extern int fonts_loaded;
|
||||
extern char font_8[], font_14[], font_16[];
|
||||
extern char palette[];
|
||||
|
||||
#define SAVER_MODULE(name) \
|
||||
static int name ## _modevent(module_t mod, int type, void *data) \
|
||||
{ \
|
||||
switch ((modeventtype_t)type) { \
|
||||
case MOD_LOAD: \
|
||||
return name ## _load(); \
|
||||
case MOD_UNLOAD: \
|
||||
return name ## _unload(); \
|
||||
default: \
|
||||
break; \
|
||||
} \
|
||||
return 0; \
|
||||
} \
|
||||
static moduledata_t name ## _mod = { \
|
||||
#name, \
|
||||
name ## _modevent, \
|
||||
NULL \
|
||||
}; \
|
||||
DECLARE_MODULE(name, name ## _mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE)
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: snake_saver.c,v 1.19 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: snake_saver.c,v 1.20 1998/11/04 03:49:39 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -44,9 +44,10 @@ static char *message;
|
||||
static u_char **messagep;
|
||||
static int messagelen;
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
static void
|
||||
snake_saver(int blank)
|
||||
static int
|
||||
snake_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
static int dirx, diry;
|
||||
int f;
|
||||
@ -57,12 +58,11 @@ snake_saver(int blank)
|
||||
#define savs messagep
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked <= 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
fillw((FG_LIGHTGREY|BG_BLACK)<<8 | scr_map[0x20],
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (blanked <= 0) {
|
||||
window = (u_short *)adp->va_window;
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK)<<8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
dirx = (scp->xpos ? 1 : -1);
|
||||
@ -72,16 +72,11 @@ snake_saver(int blank)
|
||||
savs[f] = (u_char *)window + 2 *
|
||||
(scp->xpos+scp->ypos*scp->xsize);
|
||||
*(savs[0]) = scr_map[*save];
|
||||
f = scp->ysize * scp->xsize + 5;
|
||||
outb(crtc_addr, 14);
|
||||
outb(crtc_addr+1, f >> 8);
|
||||
outb(crtc_addr, 15);
|
||||
outb(crtc_addr+1, f & 0xff);
|
||||
scrn_blanked = 1;
|
||||
blanked = 1;
|
||||
}
|
||||
if (scrn_blanked++ < 4)
|
||||
return;
|
||||
scrn_blanked = 1;
|
||||
if (blanked++ < 4)
|
||||
return 0;
|
||||
blanked = 1;
|
||||
*(savs[messagelen-1]) = scr_map[0x20];
|
||||
for (f=messagelen-1; f > 0; f--)
|
||||
savs[f] = savs[f-1];
|
||||
@ -99,43 +94,31 @@ snake_saver(int blank)
|
||||
*(savs[f]) = scr_map[save[f]];
|
||||
}
|
||||
else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
snake_saver_load(void)
|
||||
snake_init(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
messagelen = strlen(ostype) + 1 + strlen(osrelease);
|
||||
message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK);
|
||||
sprintf(message, "%s %s", ostype, osrelease);
|
||||
messagep = malloc(messagelen * sizeof *messagep, M_DEVBUF, M_WAITOK);
|
||||
|
||||
err = add_scrn_saver(snake_saver);
|
||||
if (err != 0) {
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
}
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
snake_saver_unload(void)
|
||||
snake_term(video_adapter_t *adp)
|
||||
{
|
||||
int err;
|
||||
|
||||
err = remove_scrn_saver(snake_saver);
|
||||
if (err == 0) {
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
}
|
||||
return err;
|
||||
free(message, M_DEVBUF);
|
||||
free(messagep, M_DEVBUF);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(snake_saver);
|
||||
static scrn_saver_t snake_module = {
|
||||
"snake_saver", snake_init, snake_term, snake_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(snake_saver, snake_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: star_saver.c,v 1.16 1998/09/17 19:40:30 sos Exp $
|
||||
* $Id: star_saver.c,v 1.17 1998/11/04 03:49:39 peter Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -41,13 +41,14 @@
|
||||
#define NUM_STARS 50
|
||||
|
||||
static u_short *window;
|
||||
static int blanked;
|
||||
|
||||
/*
|
||||
* Alternate saver that got its inspiration from a well known utility
|
||||
* package for an inferior^H^H^H^H^H^Hfamous OS.
|
||||
*/
|
||||
static void
|
||||
star_saver(int blank)
|
||||
static int
|
||||
star_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
int cell, i;
|
||||
@ -57,15 +58,15 @@ star_saver(int blank)
|
||||
static u_short stars[NUM_STARS][2];
|
||||
|
||||
if (blank) {
|
||||
if (!ISTEXTSC(scp))
|
||||
return;
|
||||
if (scrn_blanked <= 0) {
|
||||
scp->status |= SAVER_RUNNING;
|
||||
window = (u_short *)(*biosvidsw.adapter)(scp->adp)->va_window;
|
||||
scrn_blanked = 1;
|
||||
fillw((FG_LIGHTGREY|BG_BLACK)<<8|scr_map[0x20], window,
|
||||
scp->xsize * scp->ysize);
|
||||
if (adp->va_mode_flags & V_INFO_GRAPHICS)
|
||||
return ENODEV;
|
||||
if (!blanked) {
|
||||
window = (u_short *)adp->va_window;
|
||||
/* clear the screen and set the border color */
|
||||
fillw(((FG_LIGHTGREY|BG_BLACK) << 8) | scr_map[0x20],
|
||||
window, scp->xsize * scp->ysize);
|
||||
set_border(scp, 0);
|
||||
blanked = TRUE;
|
||||
for(i=0; i<NUM_STARS; i++) {
|
||||
stars[i][0] =
|
||||
random() % (scp->xsize*scp->ysize);
|
||||
@ -82,24 +83,26 @@ star_saver(int blank)
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (scrn_blanked > 0) {
|
||||
set_border(scp, scp->border);
|
||||
scrn_blanked = 0;
|
||||
scp->status &= ~SAVER_RUNNING;
|
||||
}
|
||||
blanked = FALSE;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
star_saver_load(void)
|
||||
star_init(video_adapter_t *adp)
|
||||
{
|
||||
return add_scrn_saver(star_saver);
|
||||
blanked = FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
star_saver_unload(void)
|
||||
star_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(star_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(star_saver);
|
||||
static scrn_saver_t star_module = {
|
||||
"star_saver", star_init, star_term, star_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(star_saver, star_module);
|
||||
|
@ -25,7 +25,7 @@
|
||||
* (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: warp_saver.c,v 1.2 1998/12/28 14:20:13 des Exp $
|
||||
* $Id: warp_saver.c,v 1.3 1998/12/31 13:38:59 des Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -40,6 +40,7 @@
|
||||
#include <saver.h>
|
||||
|
||||
static u_char *vid;
|
||||
static int blanked;
|
||||
|
||||
#define SCRW 320
|
||||
#define SCRH 200
|
||||
@ -47,7 +48,6 @@ static u_char *vid;
|
||||
#define STARS (SPP*(1+2+4+8))
|
||||
|
||||
static int star[STARS];
|
||||
static u_char save_pal[768];
|
||||
static u_char warp_pal[768] = {
|
||||
0x00, 0x00, 0x00,
|
||||
0x66, 0x66, 0x66,
|
||||
@ -72,25 +72,18 @@ warp_update(void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
warp_saver(int blank)
|
||||
static int
|
||||
warp_saver(video_adapter_t *adp, int blank)
|
||||
{
|
||||
scr_stat *scp = cur_console;
|
||||
static int saved_mode;
|
||||
int pl;
|
||||
|
||||
if (blank) {
|
||||
/* switch to graphics mode */
|
||||
if (scrn_blanked <= 0) {
|
||||
if (blanked <= 0) {
|
||||
pl = splhigh();
|
||||
saved_mode = scp->mode;
|
||||
scp->mode = M_VGA_CG320;
|
||||
scp->status |= SAVER_RUNNING|GRAPHICS_MODE;
|
||||
save_palette(scp, save_pal);
|
||||
set_mode(scp);
|
||||
load_palette(scp, warp_pal);
|
||||
scrn_blanked++;
|
||||
vid = (u_char *)Crtat;
|
||||
set_video_mode(adp, M_VGA_CG320, warp_pal, 0);
|
||||
blanked++;
|
||||
vid = (u_char *)adp->va_window;
|
||||
splx(pl);
|
||||
bzero(vid, SCRW*SCRH);
|
||||
}
|
||||
@ -99,30 +92,19 @@ warp_saver(int blank)
|
||||
warp_update();
|
||||
|
||||
} else {
|
||||
/* return to previous video mode */
|
||||
if (scrn_blanked > 0) {
|
||||
if (saved_mode) {
|
||||
pl = splhigh();
|
||||
scrn_blanked = 0;
|
||||
scp->mode = saved_mode;
|
||||
scp->status &= ~(SAVER_RUNNING|GRAPHICS_MODE);
|
||||
set_mode(scp);
|
||||
load_palette(scp, save_pal);
|
||||
saved_mode = 0;
|
||||
splx(pl);
|
||||
}
|
||||
}
|
||||
blanked = 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
warp_saver_load(void)
|
||||
warp_init(video_adapter_t *adp)
|
||||
{
|
||||
video_info_t info;
|
||||
int i;
|
||||
|
||||
/* check that the console is capable of running in 320x200x256 */
|
||||
if ((*biosvidsw.get_info)(cur_console->adp, M_VGA_CG320, &info)) {
|
||||
if (get_mode_info(adp, M_VGA_CG320, &info)) {
|
||||
log(LOG_NOTICE, "warp_saver: the console does not support M_VGA_CG320\n");
|
||||
return ENODEV;
|
||||
}
|
||||
@ -132,13 +114,19 @@ warp_saver_load(void)
|
||||
star[i] = random() % (SCRW*SCRH);
|
||||
}
|
||||
|
||||
return add_scrn_saver(warp_saver);
|
||||
blanked = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
warp_saver_unload(void)
|
||||
warp_term(video_adapter_t *adp)
|
||||
{
|
||||
return remove_scrn_saver(warp_saver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
SAVER_MODULE(warp_saver);
|
||||
static scrn_saver_t warp_module = {
|
||||
"warp_saver", warp_init, warp_term, warp_saver, NULL,
|
||||
};
|
||||
|
||||
SAVER_MODULE(warp_saver, warp_module);
|
||||
|
@ -1,18 +1,32 @@
|
||||
# $Id: Makefile,v 1.3 1998/10/16 04:30:51 peter Exp $
|
||||
# $Id: Makefile,v 1.4 1998/12/30 11:21:07 yokota Exp $
|
||||
|
||||
.PATH: ${.CURDIR}/../../i386/isa
|
||||
.PATH: ${.CURDIR}/../../dev/syscons ${.CURDIR}/../../i386/isa
|
||||
KMOD = vesa
|
||||
SRCS = vesa.c scvesactl.c sc.h opt_vesa.h opt_vm86.h
|
||||
SRCS = vesa.c scvesactl.c sc.h vga.h opt_syscons.h opt_vga.h \
|
||||
opt_vesa.h opt_vm86.h opt_fb.h
|
||||
NOMAN =
|
||||
CLEANFILES += sc.h opt_vesa.h opt_vm86.h
|
||||
CLEANFILES += sc.h vga.h opt_syscons.h opt_vga.h opt_vesa.h opt_vm86.h \
|
||||
opt_fb.h
|
||||
|
||||
sc.h:
|
||||
echo "#define NSC 1" > sc.h
|
||||
|
||||
vga.h:
|
||||
echo "#define NVGA 1" > vga.h
|
||||
|
||||
opt_syscons.h:
|
||||
touch opt_syscons.h
|
||||
|
||||
opt_vga.h:
|
||||
touch opt_vga.h
|
||||
|
||||
opt_vesa.h:
|
||||
echo "#define VESA 1" > opt_vesa.h
|
||||
|
||||
opt_vm86.h:
|
||||
echo "#define VM86 1" > opt_vm86.h
|
||||
|
||||
opt_fb.h:
|
||||
touch opt_fb.h
|
||||
|
||||
.include <bsd.kmod.mk>
|
||||
|
Loading…
Reference in New Issue
Block a user