mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-11 14:10:34 +00:00
Update the alpha port to use the new syscons.
Submitted by: Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp> (partly)
This commit is contained in:
parent
458a924b1d
commit
8a99777019
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=43105
@ -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.13 1998/12/29 03:59:49 gpalmer Exp $
|
||||
# $Id: GENERIC,v 1.14 1999/01/18 20:26:50 gallatin Exp $
|
||||
|
||||
machine "alpha"
|
||||
cpu "EV4"
|
||||
@ -78,8 +78,17 @@ device cd0
|
||||
# real time clock
|
||||
device mcclock0 at isa0 port 0x70
|
||||
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
device atkbd0 at atkbdc? irq 1
|
||||
device psm0 at atkbdc? 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 isa0 port "IO_KBD" irq 1
|
||||
device sc0 at isa?
|
||||
|
||||
device sio0 at isa0 port "IO_COM1" irq 4
|
||||
device sio1 at isa0 port "IO_COM2" irq 3 flags 0x50
|
||||
|
@ -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.13 1998/12/29 03:59:49 gpalmer Exp $
|
||||
# $Id: GENERIC,v 1.14 1999/01/18 20:26:50 gallatin Exp $
|
||||
|
||||
machine "alpha"
|
||||
cpu "EV4"
|
||||
@ -78,8 +78,17 @@ device cd0
|
||||
# real time clock
|
||||
device mcclock0 at isa0 port 0x70
|
||||
|
||||
controller atkbdc0 at isa? port IO_KBD
|
||||
device atkbd0 at atkbdc? irq 1
|
||||
device psm0 at atkbdc? 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 isa0 port "IO_KBD" irq 1
|
||||
device sc0 at isa?
|
||||
|
||||
device sio0 at isa0 port "IO_COM1" irq 4
|
||||
device sio1 at isa0 port "IO_COM2" irq 3 flags 0x50
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.14 1998/12/04 10:52:47 dfr Exp $
|
||||
# $Id: files.alpha,v 1.15 1999/01/18 20:26:50 gallatin Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -138,9 +138,18 @@ libkern/alpha/htons.S standard
|
||||
libkern/alpha/ntohl.S standard
|
||||
libkern/alpha/ntohs.S standard
|
||||
isa/sio.c optional sio device-driver
|
||||
isa/kbdio.c optional psm device-driver
|
||||
dev/fb/fb.c optional fb device-driver
|
||||
dev/fb/fb.c optional vga device-driver
|
||||
isa/vga_isa.c optional vga device-driver
|
||||
dev/fb/splash.c optional splash
|
||||
dev/kbd/atkbd.c optional atkbd device-driver
|
||||
isa/atkbd_isa.c optional atkbd device-driver
|
||||
dev/kbd/atkbdc.c optional atkbdc device-driver
|
||||
isa/atkbdc_isa.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
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
isa/kbdio.c optional sc device-driver
|
||||
isa/videoio.c optional sc device-driver
|
||||
isa/syscons.c optional sc device-driver
|
||||
isa/scvidctl.c optional sc device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.alpha,v 1.7 1998/09/16 08:22:09 dfr Exp $
|
||||
# $Id: options.alpha,v 1.8 1999/01/18 20:26:50 gallatin Exp $
|
||||
|
||||
EV5 opt_global.h
|
||||
EV4 opt_global.h
|
||||
@ -28,13 +28,24 @@ SC_HISTORY_SIZE opt_syscons.h
|
||||
SC_DISABLE_REBOOT opt_syscons.h
|
||||
SC_MOUSE_CHAR opt_syscons.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
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
PSM_RESETAFTERSUSPEND opt_psm.h
|
||||
PSM_DEBUG opt_psm.h
|
||||
|
||||
KBD_RESETDELAY opt_kbdio.h
|
||||
KBD_MAXRETRY opt_kbdio.h
|
||||
KBD_MAXWAIT opt_kbdio.h
|
||||
KBDIO_DEBUG opt_kbdio.h
|
||||
# Fb options
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
# Kbd options
|
||||
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
|
||||
|
||||
BREAK_TO_DEBUGGER opt_comconsole.h
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.h 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.h,v 1.17 1997/07/01 00:54:37 bde Exp $
|
||||
* $Id: cons.h,v 1.1 1998/06/10 10:54:42 dfr Exp $
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONS_H_
|
||||
@ -54,18 +54,6 @@ typedef void cn_putc_t __P((dev_t, int));
|
||||
* XXX public functions in drivers should be declared in headers produced
|
||||
* by `config', not here.
|
||||
*/
|
||||
cn_probe_t pccnprobe;
|
||||
cn_init_t pccninit;
|
||||
cn_getc_t pccngetc;
|
||||
cn_checkc_t pccncheckc;
|
||||
cn_putc_t pccnputc;
|
||||
|
||||
cn_probe_t sccnprobe;
|
||||
cn_init_t sccninit;
|
||||
cn_getc_t sccngetc;
|
||||
cn_checkc_t sccncheckc;
|
||||
cn_putc_t sccnputc;
|
||||
|
||||
cn_probe_t siocnprobe;
|
||||
cn_init_t siocninit;
|
||||
cn_getc_t siocngetc;
|
||||
|
@ -25,8 +25,8 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: console.h,v 1.40 1998/09/17 09:38:36 dfr Exp $
|
||||
* from: i386/include console.h,v 1.39
|
||||
* $Id: console.h,v 1.41 1999/01/01 14:38:29 des Exp $
|
||||
* from: i386/include console.h,v 1.43
|
||||
*/
|
||||
|
||||
#ifndef _MACHINE_CONSOLE_H_
|
||||
@ -53,6 +53,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)
|
||||
@ -62,6 +63,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)
|
||||
@ -87,11 +90,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
|
||||
@ -190,9 +196,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
|
||||
@ -205,7 +213,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;
|
||||
@ -213,10 +221,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 */
|
||||
@ -275,6 +290,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)
|
||||
@ -284,7 +302,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;
|
||||
@ -293,6 +318,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
|
||||
@ -320,6 +369,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;
|
||||
@ -331,7 +389,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) */
|
||||
@ -389,6 +449,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 */
|
||||
@ -438,6 +505,17 @@ typedef struct {int scr_size[3];} scr_size_t;
|
||||
#define M_HGC_P1 0xe1 /* hercules graphics - page 1 @ B8000 */
|
||||
#define M_MCA_MODE 0xff /* monochrome adapter mode */
|
||||
|
||||
#define M_TEXT_80x25 200 /* generic text modes */
|
||||
#define M_TEXT_80x30 201
|
||||
#define M_TEXT_80x43 202
|
||||
#define M_TEXT_80x50 203
|
||||
#define M_TEXT_80x60 204
|
||||
#define M_TEXT_132x25 205
|
||||
#define M_TEXT_132x30 206
|
||||
#define M_TEXT_132x43 207
|
||||
#define M_TEXT_132x50 208
|
||||
#define M_TEXT_132x60 209
|
||||
|
||||
#define SW_PC98_80x25 _IO('S', M_PC98_80x25)
|
||||
#define SW_PC98_80x30 _IO('S', M_PC98_80x30)
|
||||
#define SW_B40x25 _IO('S', M_B40x25)
|
||||
@ -479,6 +557,17 @@ typedef struct {int scr_size[3];} scr_size_t;
|
||||
#define SW_VGA_CG640 _IO('S', M_VGA_CG640)
|
||||
#define SW_VGA_MODEX _IO('S', M_VGA_MODEX)
|
||||
|
||||
#define SW_TEXT_80x25 _IO('S', M_TEXT_80x25)
|
||||
#define SW_TEXT_80x30 _IO('S', M_TEXT_80x30)
|
||||
#define SW_TEXT_80x43 _IO('S', M_TEXT_80x43)
|
||||
#define SW_TEXT_80x50 _IO('S', M_TEXT_80x50)
|
||||
#define SW_TEXT_80x60 _IO('S', M_TEXT_80x60)
|
||||
#define SW_TEXT_132x25 _IO('S', M_TEXT_132x25)
|
||||
#define SW_TEXT_132x30 _IO('S', M_TEXT_132x30)
|
||||
#define SW_TEXT_132x43 _IO('S', M_TEXT_132x43)
|
||||
#define SW_TEXT_132x50 _IO('S', M_TEXT_132x50)
|
||||
#define SW_TEXT_132x60 _IO('S', M_TEXT_132x60)
|
||||
|
||||
#define M_VESA_BASE 0x100 /* VESA mode number base */
|
||||
|
||||
#define M_VESA_CG640x400 0x100 /* 640x400, 256 color */
|
||||
@ -510,7 +599,6 @@ typedef struct {int scr_size[3];} scr_size_t;
|
||||
#define M_VESA_64K_1280 0x11a /* 1280x1024, 5:6:5 */
|
||||
#define M_VESA_FULL_1280 0x11b /* 1280x1024, 8:8:8 */
|
||||
#define M_VESA_MODE_MAX 0x1ff
|
||||
#define M_VESA_USER 0x1ff
|
||||
|
||||
#define SW_VESA_CG640x400 _IO('V', M_VESA_CG640x400 - M_VESA_BASE)
|
||||
#define SW_VESA_CG640x480 _IO('V', M_VESA_CG640x480 - M_VESA_BASE)
|
||||
@ -540,7 +628,6 @@ typedef struct {int scr_size[3];} scr_size_t;
|
||||
#define SW_VESA_32K_1280 _IO('V', M_VESA_32K_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_64K_1280 _IO('V', M_VESA_64K_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_FULL_1280 _IO('V', M_VESA_FULL_1280 - M_VESA_BASE)
|
||||
#define SW_VESA_USER _IO('V', M_VESA_USER - M_VESA_BASE)
|
||||
|
||||
#endif /* !_MACHINE_CONSOLE_H_ */
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: isa.c,v 1.7 1998/11/18 23:53:11 dfr Exp $
|
||||
* $Id: isa.c,v 1.8 1998/11/28 09:55:16 dfr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -246,6 +246,16 @@ isa_probe(device_t dev)
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
/*
|
||||
* and isa?
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "isa");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "isa")) {
|
||||
isa_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
isa_irq_rman.rm_start = 0;
|
||||
isa_irq_rman.rm_end = 15;
|
||||
isa_irq_rman.rm_type = RMAN_ARRAY;
|
||||
@ -471,9 +481,16 @@ isa_alloc_resource(device_t bus, device_t child, int type, int *rid,
|
||||
struct resource *rv, **rvp;
|
||||
struct isa_device *id;
|
||||
|
||||
if (child)
|
||||
id = DEVTOISA(child);
|
||||
else
|
||||
if (child) {
|
||||
/*
|
||||
* If this is our child, then use the isa_device to find
|
||||
* defaults and to record results.
|
||||
*/
|
||||
if (device_get_devclass(device_get_parent(child)) == isa_devclass)
|
||||
id = DEVTOISA(child);
|
||||
else
|
||||
id = NULL;
|
||||
} else
|
||||
id = NULL;
|
||||
isdefault = (start == 0UL && end == ~0UL && *rid == 0);
|
||||
if (*rid > 1)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# This file tells config what files go into building a kernel,
|
||||
# files marked standard are always included.
|
||||
#
|
||||
# $Id: files.alpha,v 1.14 1998/12/04 10:52:47 dfr Exp $
|
||||
# $Id: files.alpha,v 1.15 1999/01/18 20:26:50 gallatin Exp $
|
||||
#
|
||||
# The long compile-with and dependency lines are required because of
|
||||
# limitations in config: backslash-newline doesn't work in strings, and
|
||||
@ -138,9 +138,18 @@ libkern/alpha/htons.S standard
|
||||
libkern/alpha/ntohl.S standard
|
||||
libkern/alpha/ntohs.S standard
|
||||
isa/sio.c optional sio device-driver
|
||||
isa/kbdio.c optional psm device-driver
|
||||
dev/fb/fb.c optional fb device-driver
|
||||
dev/fb/fb.c optional vga device-driver
|
||||
isa/vga_isa.c optional vga device-driver
|
||||
dev/fb/splash.c optional splash
|
||||
dev/kbd/atkbd.c optional atkbd device-driver
|
||||
isa/atkbd_isa.c optional atkbd device-driver
|
||||
dev/kbd/atkbdc.c optional atkbdc device-driver
|
||||
isa/atkbdc_isa.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
|
||||
isa/syscons_isa.c optional sc device-driver
|
||||
isa/psm.c optional psm device-driver
|
||||
isa/kbdio.c optional sc device-driver
|
||||
isa/videoio.c optional sc device-driver
|
||||
isa/syscons.c optional sc device-driver
|
||||
isa/scvidctl.c optional sc device-driver
|
||||
|
@ -1,4 +1,4 @@
|
||||
# $Id: options.alpha,v 1.7 1998/09/16 08:22:09 dfr Exp $
|
||||
# $Id: options.alpha,v 1.8 1999/01/18 20:26:50 gallatin Exp $
|
||||
|
||||
EV5 opt_global.h
|
||||
EV4 opt_global.h
|
||||
@ -28,13 +28,24 @@ SC_HISTORY_SIZE opt_syscons.h
|
||||
SC_DISABLE_REBOOT opt_syscons.h
|
||||
SC_MOUSE_CHAR opt_syscons.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
|
||||
|
||||
PSM_HOOKAPM opt_psm.h
|
||||
PSM_RESETAFTERSUSPEND opt_psm.h
|
||||
PSM_DEBUG opt_psm.h
|
||||
|
||||
KBD_RESETDELAY opt_kbdio.h
|
||||
KBD_MAXRETRY opt_kbdio.h
|
||||
KBD_MAXWAIT opt_kbdio.h
|
||||
KBDIO_DEBUG opt_kbdio.h
|
||||
# Fb options
|
||||
FB_INSTALL_CDEV opt_fb.h
|
||||
|
||||
# Kbd options
|
||||
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
|
||||
|
||||
BREAK_TO_DEBUGGER opt_comconsole.h
|
||||
|
119
sys/dev/atkbdc/atkbd_atkbdc.c
Normal file
119
sys/dev/atkbdc/atkbd_atkbdc.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBD > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/kbd/atkbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
devclass_t atkbd_devclass;
|
||||
|
||||
static int atkbdprobe(device_t dev);
|
||||
static int atkbdattach(device_t dev);
|
||||
|
||||
static device_method_t atkbd_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdprobe),
|
||||
DEVMETHOD(device_attach, atkbdattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbd_driver = {
|
||||
ATKBD_DRIVER_NAME,
|
||||
atkbd_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
sizeof(atkbd_softc_t),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdprobe(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
device_set_desc(dev, "AT Keyboard");
|
||||
|
||||
/* obtain parameters */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
|
||||
|
||||
/* probe the device */
|
||||
return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdattach(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long irq;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int zero = 0;
|
||||
int error;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
error = atkbd_attach_unit(device_get_unit(dev), sc);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/* declare our interrupt handler */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res,
|
||||
(driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd,
|
||||
&ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBD > 0 */
|
119
sys/dev/atkbdc/atkbd_isa.c
Normal file
119
sys/dev/atkbdc/atkbd_isa.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBD > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/kbd/atkbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
devclass_t atkbd_devclass;
|
||||
|
||||
static int atkbdprobe(device_t dev);
|
||||
static int atkbdattach(device_t dev);
|
||||
|
||||
static device_method_t atkbd_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdprobe),
|
||||
DEVMETHOD(device_attach, atkbdattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbd_driver = {
|
||||
ATKBD_DRIVER_NAME,
|
||||
atkbd_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
sizeof(atkbd_softc_t),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdprobe(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
device_set_desc(dev, "AT Keyboard");
|
||||
|
||||
/* obtain parameters */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
|
||||
|
||||
/* probe the device */
|
||||
return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdattach(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long irq;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int zero = 0;
|
||||
int error;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
error = atkbd_attach_unit(device_get_unit(dev), sc);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/* declare our interrupt handler */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res,
|
||||
(driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd,
|
||||
&ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBD > 0 */
|
242
sys/dev/atkbdc/atkbdc_isa.c
Normal file
242
sys/dev/atkbdc/atkbdc_isa.c
Normal file
@ -0,0 +1,242 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbdc.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBDC > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
|
||||
|
||||
/* children */
|
||||
typedef struct atkbdc_device {
|
||||
int flags; /* configuration flags */
|
||||
int port; /* port number (same as the controller's) */
|
||||
int irq; /* ISA IRQ mask */
|
||||
} atkbdc_device_t;
|
||||
|
||||
/* kbdc */
|
||||
devclass_t atkbdc_devclass;
|
||||
|
||||
static int atkbdc_probe(device_t dev);
|
||||
static int atkbdc_attach(device_t dev);
|
||||
static void atkbdc_print_child(device_t bus, device_t dev);
|
||||
static int atkbdc_read_ivar(device_t bus, device_t dev, int index,
|
||||
u_long *val);
|
||||
static int atkbdc_write_ivar(device_t bus, device_t dev, int index,
|
||||
u_long val);
|
||||
|
||||
static device_method_t atkbdc_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdc_probe),
|
||||
DEVMETHOD(device_attach, atkbdc_attach),
|
||||
|
||||
DEVMETHOD(bus_print_child, atkbdc_print_child),
|
||||
DEVMETHOD(bus_read_ivar, atkbdc_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, atkbdc_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbdc_driver = {
|
||||
ATKBDC_DRIVER_NAME,
|
||||
atkbdc_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
sizeof(atkbdc_softc_t *),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdc_probe(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int unit;
|
||||
int error;
|
||||
|
||||
unit = device_get_unit(dev);
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if (sc == NULL) {
|
||||
/*
|
||||
* We have to maintain two copies of the kbdc_softc struct,
|
||||
* as the low-level console needs to have access to the
|
||||
* keyboard controller before kbdc is probed and attached.
|
||||
* kbdc_soft[] contains the default entry for that purpose.
|
||||
* See atkbdc.c. XXX
|
||||
*/
|
||||
sc = atkbdc_get_softc(unit);
|
||||
if (sc == NULL)
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
device_set_desc(dev, "keyboard controller (i8042)");
|
||||
|
||||
error = atkbdc_probe_unit(sc, unit, isa_get_port(dev));
|
||||
if (error == 0)
|
||||
*(atkbdc_softc_t **)device_get_softc(dev) = sc;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
{
|
||||
atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
atkbdc_device_t *kdev;
|
||||
device_t child;
|
||||
int t;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
kdev->port = sc->port;
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
else
|
||||
kdev->irq = -1;
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
kdev->flags = t;
|
||||
else
|
||||
kdev->flags = 0;
|
||||
|
||||
child = device_add_child(dev, name, unit, kdev);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_attach(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int i;
|
||||
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if ((sc == NULL) || (sc->port <= 0))
|
||||
return ENXIO;
|
||||
|
||||
/*
|
||||
* Add all devices configured to be attached to atkbdc0.
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc0");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc0")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
/*
|
||||
* and atkbdc?
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
bus_generic_attach(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_print_child(device_t bus, device_t dev)
|
||||
{
|
||||
atkbdc_device_t *kbdcdev;
|
||||
|
||||
kbdcdev = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
|
||||
if (kbdcdev->flags != 0)
|
||||
printf(" flags 0x%x", kbdcdev->flags);
|
||||
|
||||
printf(" on %s%d", device_get_name(bus), device_get_unit(bus));
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
*val = (u_long)ivar->port;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
*val = (u_long)ivar->irq;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
*val = (u_long)ivar->flags;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
ivar->port = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
ivar->irq = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
ivar->flags = (int)val;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBDC > 0 */
|
242
sys/dev/atkbdc/atkbdc_subr.c
Normal file
242
sys/dev/atkbdc/atkbdc_subr.c
Normal file
@ -0,0 +1,242 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbdc.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBDC > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
|
||||
|
||||
/* children */
|
||||
typedef struct atkbdc_device {
|
||||
int flags; /* configuration flags */
|
||||
int port; /* port number (same as the controller's) */
|
||||
int irq; /* ISA IRQ mask */
|
||||
} atkbdc_device_t;
|
||||
|
||||
/* kbdc */
|
||||
devclass_t atkbdc_devclass;
|
||||
|
||||
static int atkbdc_probe(device_t dev);
|
||||
static int atkbdc_attach(device_t dev);
|
||||
static void atkbdc_print_child(device_t bus, device_t dev);
|
||||
static int atkbdc_read_ivar(device_t bus, device_t dev, int index,
|
||||
u_long *val);
|
||||
static int atkbdc_write_ivar(device_t bus, device_t dev, int index,
|
||||
u_long val);
|
||||
|
||||
static device_method_t atkbdc_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdc_probe),
|
||||
DEVMETHOD(device_attach, atkbdc_attach),
|
||||
|
||||
DEVMETHOD(bus_print_child, atkbdc_print_child),
|
||||
DEVMETHOD(bus_read_ivar, atkbdc_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, atkbdc_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbdc_driver = {
|
||||
ATKBDC_DRIVER_NAME,
|
||||
atkbdc_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
sizeof(atkbdc_softc_t *),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdc_probe(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int unit;
|
||||
int error;
|
||||
|
||||
unit = device_get_unit(dev);
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if (sc == NULL) {
|
||||
/*
|
||||
* We have to maintain two copies of the kbdc_softc struct,
|
||||
* as the low-level console needs to have access to the
|
||||
* keyboard controller before kbdc is probed and attached.
|
||||
* kbdc_soft[] contains the default entry for that purpose.
|
||||
* See atkbdc.c. XXX
|
||||
*/
|
||||
sc = atkbdc_get_softc(unit);
|
||||
if (sc == NULL)
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
device_set_desc(dev, "keyboard controller (i8042)");
|
||||
|
||||
error = atkbdc_probe_unit(sc, unit, isa_get_port(dev));
|
||||
if (error == 0)
|
||||
*(atkbdc_softc_t **)device_get_softc(dev) = sc;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
{
|
||||
atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
atkbdc_device_t *kdev;
|
||||
device_t child;
|
||||
int t;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
kdev->port = sc->port;
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
else
|
||||
kdev->irq = -1;
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
kdev->flags = t;
|
||||
else
|
||||
kdev->flags = 0;
|
||||
|
||||
child = device_add_child(dev, name, unit, kdev);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_attach(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int i;
|
||||
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if ((sc == NULL) || (sc->port <= 0))
|
||||
return ENXIO;
|
||||
|
||||
/*
|
||||
* Add all devices configured to be attached to atkbdc0.
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc0");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc0")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
/*
|
||||
* and atkbdc?
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
bus_generic_attach(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_print_child(device_t bus, device_t dev)
|
||||
{
|
||||
atkbdc_device_t *kbdcdev;
|
||||
|
||||
kbdcdev = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
|
||||
if (kbdcdev->flags != 0)
|
||||
printf(" flags 0x%x", kbdcdev->flags);
|
||||
|
||||
printf(" on %s%d", device_get_name(bus), device_get_unit(bus));
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
*val = (u_long)ivar->port;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
*val = (u_long)ivar->irq;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
*val = (u_long)ivar->flags;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
ivar->port = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
ivar->irq = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
ivar->flags = (int)val;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBDC > 0 */
|
@ -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.1 1998/11/08 18:43:03 dfr Exp $
|
||||
* $Id: psm.c,v 1.2 1998/11/15 18:25:17 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
#include <isa/kbdio.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
/*
|
||||
* Driver specific options: the following options may be set by
|
||||
@ -740,6 +740,8 @@ psmprobe(device_t dev)
|
||||
{
|
||||
int unit = device_get_unit(dev);
|
||||
struct psm_softc *sc = device_get_softc(dev);
|
||||
u_long port;
|
||||
u_long flags;
|
||||
int stat[3];
|
||||
int command_byte;
|
||||
int mask;
|
||||
@ -748,13 +750,18 @@ psmprobe(device_t dev)
|
||||
#if 0
|
||||
kbdc_debug(TRUE);
|
||||
#endif
|
||||
sc->addr = isa_get_port(dev);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
|
||||
|
||||
sc->addr = port;
|
||||
sc->kbdc = kbdc_open(sc->addr);
|
||||
sc->config = isa_get_flags(dev) & PSM_CONFIG_FLAGS;
|
||||
sc->config = flags & PSM_CONFIG_FLAGS;
|
||||
sc->flags = 0;
|
||||
if (bootverbose)
|
||||
++verbose;
|
||||
|
||||
device_set_desc(dev, "PS/2 Mouse");
|
||||
|
||||
if (!kbdc_lock(sc->kbdc, TRUE)) {
|
||||
printf("psm%d: unable to lock the controller.\n", unit);
|
||||
if (bootverbose)
|
||||
@ -984,6 +991,7 @@ psmattach(device_t dev)
|
||||
struct psm_softc *sc = device_get_softc(dev);
|
||||
void *ih;
|
||||
struct resource *res;
|
||||
u_long irq;
|
||||
int zero = 0;
|
||||
|
||||
if (sc == NULL) /* shouldn't happen */
|
||||
@ -1027,7 +1035,8 @@ psmattach(device_t dev)
|
||||
if (bootverbose)
|
||||
--verbose;
|
||||
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1,
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc,
|
||||
&ih);
|
||||
@ -2216,7 +2225,7 @@ psmresume(void *dummy)
|
||||
}
|
||||
#endif /* PSM_HOOKAPM */
|
||||
|
||||
CDEV_DRIVER_MODULE(psm, isa, psm_driver, psm_devclass,
|
||||
CDEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, psm_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NPSM > 0 */
|
||||
|
119
sys/isa/atkbd_isa.c
Normal file
119
sys/isa/atkbd_isa.c
Normal file
@ -0,0 +1,119 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbd.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBD > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/rman.h>
|
||||
|
||||
#include <machine/resource.h>
|
||||
|
||||
#include <dev/kbd/kbdreg.h>
|
||||
#include <dev/kbd/atkbdreg.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
devclass_t atkbd_devclass;
|
||||
|
||||
static int atkbdprobe(device_t dev);
|
||||
static int atkbdattach(device_t dev);
|
||||
|
||||
static device_method_t atkbd_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdprobe),
|
||||
DEVMETHOD(device_attach, atkbdattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbd_driver = {
|
||||
ATKBD_DRIVER_NAME,
|
||||
atkbd_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
sizeof(atkbd_softc_t),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdprobe(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long port;
|
||||
u_long irq;
|
||||
u_long flags;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
device_set_desc(dev, "AT Keyboard");
|
||||
|
||||
/* obtain parameters */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
|
||||
|
||||
/* probe the device */
|
||||
return atkbd_probe_unit(device_get_unit(dev), sc, port, irq, flags);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdattach(device_t dev)
|
||||
{
|
||||
atkbd_softc_t *sc;
|
||||
u_long irq;
|
||||
struct resource *res;
|
||||
void *ih;
|
||||
int zero = 0;
|
||||
int error;
|
||||
|
||||
sc = (atkbd_softc_t *)device_get_softc(dev);
|
||||
|
||||
error = atkbd_attach_unit(device_get_unit(dev), sc);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
/* declare our interrupt handler */
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res,
|
||||
(driver_intr_t *) kbdsw[sc->kbd->kb_index]->intr, sc->kbd,
|
||||
&ih);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbd, atkbdc, atkbd_driver, atkbd_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBD > 0 */
|
242
sys/isa/atkbdc_isa.c
Normal file
242
sys/isa/atkbdc_isa.c
Normal file
@ -0,0 +1,242 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: $
|
||||
*/
|
||||
|
||||
#include "atkbdc.h"
|
||||
#include "opt_kbd.h"
|
||||
|
||||
#if NATKBDC > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/bus.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
MALLOC_DEFINE(M_ATKBDDEV, "atkbddev", "AT Keyboard device");
|
||||
|
||||
/* children */
|
||||
typedef struct atkbdc_device {
|
||||
int flags; /* configuration flags */
|
||||
int port; /* port number (same as the controller's) */
|
||||
int irq; /* ISA IRQ mask */
|
||||
} atkbdc_device_t;
|
||||
|
||||
/* kbdc */
|
||||
devclass_t atkbdc_devclass;
|
||||
|
||||
static int atkbdc_probe(device_t dev);
|
||||
static int atkbdc_attach(device_t dev);
|
||||
static void atkbdc_print_child(device_t bus, device_t dev);
|
||||
static int atkbdc_read_ivar(device_t bus, device_t dev, int index,
|
||||
u_long *val);
|
||||
static int atkbdc_write_ivar(device_t bus, device_t dev, int index,
|
||||
u_long val);
|
||||
|
||||
static device_method_t atkbdc_methods[] = {
|
||||
DEVMETHOD(device_probe, atkbdc_probe),
|
||||
DEVMETHOD(device_attach, atkbdc_attach),
|
||||
|
||||
DEVMETHOD(bus_print_child, atkbdc_print_child),
|
||||
DEVMETHOD(bus_read_ivar, atkbdc_read_ivar),
|
||||
DEVMETHOD(bus_write_ivar, atkbdc_write_ivar),
|
||||
DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
|
||||
DEVMETHOD(bus_release_resource, bus_generic_release_resource),
|
||||
DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
|
||||
DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
|
||||
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
|
||||
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t atkbdc_driver = {
|
||||
ATKBDC_DRIVER_NAME,
|
||||
atkbdc_methods,
|
||||
DRIVER_TYPE_MISC,
|
||||
sizeof(atkbdc_softc_t *),
|
||||
};
|
||||
|
||||
static int
|
||||
atkbdc_probe(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int unit;
|
||||
int error;
|
||||
|
||||
unit = device_get_unit(dev);
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if (sc == NULL) {
|
||||
/*
|
||||
* We have to maintain two copies of the kbdc_softc struct,
|
||||
* as the low-level console needs to have access to the
|
||||
* keyboard controller before kbdc is probed and attached.
|
||||
* kbdc_soft[] contains the default entry for that purpose.
|
||||
* See atkbdc.c. XXX
|
||||
*/
|
||||
sc = atkbdc_get_softc(unit);
|
||||
if (sc == NULL)
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
device_set_desc(dev, "keyboard controller (i8042)");
|
||||
|
||||
error = atkbdc_probe_unit(sc, unit, isa_get_port(dev));
|
||||
if (error == 0)
|
||||
*(atkbdc_softc_t **)device_get_softc(dev) = sc;
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_add_device(device_t dev, const char *name, int unit)
|
||||
{
|
||||
atkbdc_softc_t *sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
atkbdc_device_t *kdev;
|
||||
device_t child;
|
||||
int t;
|
||||
|
||||
kdev = malloc(sizeof(struct atkbdc_device), M_ATKBDDEV, M_NOWAIT);
|
||||
if (!kdev)
|
||||
return;
|
||||
bzero(kdev, sizeof *kdev);
|
||||
|
||||
kdev->port = sc->port;
|
||||
|
||||
if (resource_int_value(name, unit, "irq", &t) == 0)
|
||||
kdev->irq = t;
|
||||
else
|
||||
kdev->irq = -1;
|
||||
|
||||
if (resource_int_value(name, unit, "flags", &t) == 0)
|
||||
kdev->flags = t;
|
||||
else
|
||||
kdev->flags = 0;
|
||||
|
||||
child = device_add_child(dev, name, unit, kdev);
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_attach(device_t dev)
|
||||
{
|
||||
atkbdc_softc_t *sc;
|
||||
int i;
|
||||
|
||||
sc = *(atkbdc_softc_t **)device_get_softc(dev);
|
||||
if ((sc == NULL) || (sc->port <= 0))
|
||||
return ENXIO;
|
||||
|
||||
/*
|
||||
* Add all devices configured to be attached to atkbdc0.
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc0");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc0")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
/*
|
||||
* and atkbdc?
|
||||
*/
|
||||
for (i = resource_query_string(-1, "at", "atkbdc");
|
||||
i != -1;
|
||||
i = resource_query_string(i, "at", "atkbdc")) {
|
||||
atkbdc_add_device(dev, resource_query_name(i),
|
||||
resource_query_unit(i));
|
||||
}
|
||||
|
||||
bus_generic_attach(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
atkbdc_print_child(device_t bus, device_t dev)
|
||||
{
|
||||
atkbdc_device_t *kbdcdev;
|
||||
|
||||
kbdcdev = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
|
||||
if (kbdcdev->flags != 0)
|
||||
printf(" flags 0x%x", kbdcdev->flags);
|
||||
|
||||
printf(" on %s%d", device_get_name(bus), device_get_unit(bus));
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_read_ivar(device_t bus, device_t dev, int index, u_long *val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
*val = (u_long)ivar->port;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
*val = (u_long)ivar->irq;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
*val = (u_long)ivar->flags;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
atkbdc_write_ivar(device_t bus, device_t dev, int index, u_long val)
|
||||
{
|
||||
atkbdc_device_t *ivar;
|
||||
|
||||
ivar = (atkbdc_device_t *)device_get_ivars(dev);
|
||||
switch (index) {
|
||||
case KBDC_IVAR_PORT:
|
||||
ivar->port = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_IRQ:
|
||||
ivar->irq = (int)val;
|
||||
break;
|
||||
case KBDC_IVAR_FLAGS:
|
||||
ivar->flags = (int)val;
|
||||
break;
|
||||
default:
|
||||
return ENOENT;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
DRIVER_MODULE(atkbdc, isa, atkbdc_driver, atkbdc_devclass, 0, 0);
|
||||
|
||||
#endif /* NATKBDC > 0 */
|
1039
sys/isa/kbdio.c
1039
sys/isa/kbdio.c
File diff suppressed because it is too large
Load Diff
207
sys/isa/kbdio.h
207
sys/isa/kbdio.h
@ -1,207 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1996 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kbdio.h,v 1.9 1999/01/06 05:49:30 yokota Exp $
|
||||
* from: i386/isa kbdio.h,v 1.7
|
||||
*/
|
||||
|
||||
#ifndef _ISA_KBDIO_H_
|
||||
#define _ISA_KBDIO_H_
|
||||
|
||||
/* constants */
|
||||
|
||||
/* I/O ports */
|
||||
#ifdef PC98
|
||||
#define KBD_STATUS_PORT 2 /* status port, read */
|
||||
#define KBD_COMMAND_PORT 2 /* controller command port, write */
|
||||
#define KBD_DATA_PORT 0 /* data port, read/write
|
||||
* also used as keyboard command
|
||||
* and mouse command port
|
||||
*/
|
||||
#else
|
||||
#define KBD_STATUS_PORT 4 /* status port, read */
|
||||
#define KBD_COMMAND_PORT 4 /* controller command port, write */
|
||||
#define KBD_DATA_PORT 0 /* data port, read/write
|
||||
* also used as keyboard command
|
||||
* and mouse command port
|
||||
*/
|
||||
#endif /* PC98 */
|
||||
|
||||
/* controller commands (sent to KBD_COMMAND_PORT) */
|
||||
#define KBDC_SET_COMMAND_BYTE 0x0060
|
||||
#define KBDC_GET_COMMAND_BYTE 0x0020
|
||||
#define KBDC_WRITE_TO_AUX 0x00d4
|
||||
#define KBDC_DISABLE_AUX_PORT 0x00a7
|
||||
#define KBDC_ENABLE_AUX_PORT 0x00a8
|
||||
#define KBDC_TEST_AUX_PORT 0x00a9
|
||||
#define KBDC_DIAGNOSE 0x00aa
|
||||
#define KBDC_TEST_KBD_PORT 0x00ab
|
||||
#define KBDC_DISABLE_KBD_PORT 0x00ad
|
||||
#define KBDC_ENABLE_KBD_PORT 0x00ae
|
||||
|
||||
/* controller command byte (set by KBDC_SET_COMMAND_BYTE) */
|
||||
#define KBD_TRANSLATION 0x0040
|
||||
#define KBD_RESERVED_BITS 0x0004
|
||||
#define KBD_OVERRIDE_KBD_LOCK 0x0008
|
||||
#define KBD_ENABLE_KBD_PORT 0x0000
|
||||
#define KBD_DISABLE_KBD_PORT 0x0010
|
||||
#define KBD_ENABLE_AUX_PORT 0x0000
|
||||
#define KBD_DISABLE_AUX_PORT 0x0020
|
||||
#define KBD_ENABLE_AUX_INT 0x0002
|
||||
#define KBD_DISABLE_AUX_INT 0x0000
|
||||
#define KBD_ENABLE_KBD_INT 0x0001
|
||||
#define KBD_DISABLE_KBD_INT 0x0000
|
||||
#define KBD_KBD_CONTROL_BITS (KBD_DISABLE_KBD_PORT | KBD_ENABLE_KBD_INT)
|
||||
#define KBD_AUX_CONTROL_BITS (KBD_DISABLE_AUX_PORT | KBD_ENABLE_AUX_INT)
|
||||
|
||||
/* keyboard device commands (sent to KBD_DATA_PORT) */
|
||||
#define KBDC_RESET_KBD 0x00ff
|
||||
#define KBDC_ENABLE_KBD 0x00f4
|
||||
#define KBDC_DISABLE_KBD 0x00f5
|
||||
#define KBDC_SET_DEFAULTS 0x00f6
|
||||
#define KBDC_SEND_DEV_ID 0x00f2
|
||||
#define KBDC_SET_LEDS 0x00ed
|
||||
#define KBDC_ECHO 0x00ee
|
||||
#define KBDC_SET_SCANCODE_SET 0x00f0
|
||||
#define KBDC_SET_TYPEMATIC 0x00f3
|
||||
|
||||
/* aux device commands (sent to KBD_DATA_PORT) */
|
||||
#define PSMC_RESET_DEV 0x00ff
|
||||
#define PSMC_ENABLE_DEV 0x00f4
|
||||
#define PSMC_DISABLE_DEV 0x00f5
|
||||
#define PSMC_SET_DEFAULTS 0x00f6
|
||||
#define PSMC_SEND_DEV_ID 0x00f2
|
||||
#define PSMC_SEND_DEV_STATUS 0x00e9
|
||||
#define PSMC_SEND_DEV_DATA 0x00eb
|
||||
#define PSMC_SET_SCALING11 0x00e6
|
||||
#define PSMC_SET_SCALING21 0x00e7
|
||||
#define PSMC_SET_RESOLUTION 0x00e8
|
||||
#define PSMC_SET_STREAM_MODE 0x00ea
|
||||
#define PSMC_SET_REMOTE_MODE 0x00f0
|
||||
#define PSMC_SET_SAMPLING_RATE 0x00f3
|
||||
|
||||
/* PSMC_SET_RESOLUTION argument */
|
||||
#define PSMD_RES_LOW 0 /* typically 25ppi */
|
||||
#define PSMD_RES_MEDIUM_LOW 1 /* typically 50ppi */
|
||||
#define PSMD_RES_MEDIUM_HIGH 2 /* typically 100ppi (default) */
|
||||
#define PSMD_RES_HIGH 3 /* typically 200ppi */
|
||||
#define PSMD_MAX_RESOLUTION PSMD_RES_HIGH
|
||||
|
||||
/* PSMC_SET_SAMPLING_RATE */
|
||||
#define PSMD_MAX_RATE 255 /* FIXME: not sure if it's possible */
|
||||
|
||||
/* status bits (KBD_STATUS_PORT) */
|
||||
#ifdef PC98
|
||||
#define KBDS_BUFFER_FULL 0x0002
|
||||
#define KBDS_ANY_BUFFER_FULL 0x0002
|
||||
#define KBDS_KBD_BUFFER_FULL 0x0002
|
||||
#define KBDS_AUX_BUFFER_FULL 0x0002
|
||||
#else
|
||||
#define KBDS_BUFFER_FULL 0x0021
|
||||
#define KBDS_ANY_BUFFER_FULL 0x0001
|
||||
#define KBDS_KBD_BUFFER_FULL 0x0001
|
||||
#define KBDS_AUX_BUFFER_FULL 0x0021
|
||||
#endif
|
||||
#define KBDS_INPUT_BUFFER_FULL 0x0002
|
||||
|
||||
/* return code */
|
||||
#define KBD_ACK 0x00fa
|
||||
#define KBD_RESEND 0x00fe
|
||||
#define KBD_RESET_DONE 0x00aa
|
||||
#define KBD_RESET_FAIL 0x00fc
|
||||
#define KBD_DIAG_DONE 0x0055
|
||||
#define KBD_DIAG_FAIL 0x00fd
|
||||
#define KBD_ECHO 0x00ee
|
||||
|
||||
#define PSM_ACK 0x00fa
|
||||
#define PSM_RESEND 0x00fe
|
||||
#define PSM_RESET_DONE 0x00aa
|
||||
#define PSM_RESET_FAIL 0x00fc
|
||||
|
||||
/* aux device ID */
|
||||
#define PSM_MOUSE_ID 0
|
||||
#define PSM_BALLPOINT_ID 2
|
||||
#define PSM_INTELLI_ID 3
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
/* types/structures */
|
||||
|
||||
typedef caddr_t KBDC;
|
||||
|
||||
/* function prototypes */
|
||||
|
||||
KBDC kbdc_open __P((int port));
|
||||
|
||||
int kbdc_lock __P((KBDC kbdc, int lock));
|
||||
|
||||
int kbdc_data_ready __P((KBDC kbdc));
|
||||
|
||||
int write_controller_command __P((KBDC kbdc,int c));
|
||||
int write_controller_data __P((KBDC kbdc,int c));
|
||||
|
||||
int write_kbd_command __P((KBDC kbdc,int c));
|
||||
int write_aux_command __P((KBDC kbdc,int c));
|
||||
int send_kbd_command __P((KBDC kbdc,int c));
|
||||
int send_aux_command __P((KBDC kbdc,int c));
|
||||
int send_kbd_command_and_data __P((KBDC kbdc,int c,int d));
|
||||
int send_aux_command_and_data __P((KBDC kbdc,int c,int d));
|
||||
|
||||
int read_controller_data __P((KBDC kbdc));
|
||||
int read_kbd_data __P((KBDC kbdc));
|
||||
int read_kbd_data_no_wait __P((KBDC kbdc));
|
||||
int read_aux_data __P((KBDC kbdc));
|
||||
int read_aux_data_no_wait __P((KBDC kbdc));
|
||||
|
||||
void empty_kbd_buffer __P((KBDC kbdc, int t));
|
||||
void empty_aux_buffer __P((KBDC kbdc, int t));
|
||||
void empty_both_buffers __P((KBDC kbdc, int t));
|
||||
|
||||
int reset_kbd __P((KBDC kbdc));
|
||||
int reset_aux_dev __P((KBDC kbdc));
|
||||
|
||||
int test_controller __P((KBDC kbdc));
|
||||
int test_kbd_port __P((KBDC kbdc));
|
||||
int test_aux_port __P((KBDC kbdc));
|
||||
|
||||
int kbdc_get_device_mask __P((KBDC kbdc));
|
||||
void kbdc_set_device_mask __P((KBDC kbdc, int mask));
|
||||
|
||||
int get_controller_command_byte __P((KBDC kbdc));
|
||||
int set_controller_command_byte __P((KBDC kbdc, int command, int flag));
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_ISA_KBDIO_H_ */
|
1333
sys/isa/kbdtables.h
1333
sys/isa/kbdtables.h
File diff suppressed because it is too large
Load Diff
@ -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.1 1998/11/08 18:43:03 dfr Exp $
|
||||
* $Id: psm.c,v 1.2 1998/11/15 18:25:17 dfr Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
#include <isa/kbdio.h>
|
||||
#include <dev/kbd/atkbdcreg.h>
|
||||
|
||||
/*
|
||||
* Driver specific options: the following options may be set by
|
||||
@ -740,6 +740,8 @@ psmprobe(device_t dev)
|
||||
{
|
||||
int unit = device_get_unit(dev);
|
||||
struct psm_softc *sc = device_get_softc(dev);
|
||||
u_long port;
|
||||
u_long flags;
|
||||
int stat[3];
|
||||
int command_byte;
|
||||
int mask;
|
||||
@ -748,13 +750,18 @@ psmprobe(device_t dev)
|
||||
#if 0
|
||||
kbdc_debug(TRUE);
|
||||
#endif
|
||||
sc->addr = isa_get_port(dev);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_PORT, &port);
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_FLAGS, &flags);
|
||||
|
||||
sc->addr = port;
|
||||
sc->kbdc = kbdc_open(sc->addr);
|
||||
sc->config = isa_get_flags(dev) & PSM_CONFIG_FLAGS;
|
||||
sc->config = flags & PSM_CONFIG_FLAGS;
|
||||
sc->flags = 0;
|
||||
if (bootverbose)
|
||||
++verbose;
|
||||
|
||||
device_set_desc(dev, "PS/2 Mouse");
|
||||
|
||||
if (!kbdc_lock(sc->kbdc, TRUE)) {
|
||||
printf("psm%d: unable to lock the controller.\n", unit);
|
||||
if (bootverbose)
|
||||
@ -984,6 +991,7 @@ psmattach(device_t dev)
|
||||
struct psm_softc *sc = device_get_softc(dev);
|
||||
void *ih;
|
||||
struct resource *res;
|
||||
u_long irq;
|
||||
int zero = 0;
|
||||
|
||||
if (sc == NULL) /* shouldn't happen */
|
||||
@ -1027,7 +1035,8 @@ psmattach(device_t dev)
|
||||
if (bootverbose)
|
||||
--verbose;
|
||||
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, 0ul, ~0ul, 1,
|
||||
BUS_READ_IVAR(device_get_parent(dev), dev, KBDC_IVAR_IRQ, &irq);
|
||||
res = bus_alloc_resource(dev, SYS_RES_IRQ, &zero, irq, irq, 1,
|
||||
RF_SHAREABLE | RF_ACTIVE);
|
||||
BUS_SETUP_INTR(device_get_parent(dev), dev, res, psmintr, sc,
|
||||
&ih);
|
||||
@ -2216,7 +2225,7 @@ psmresume(void *dummy)
|
||||
}
|
||||
#endif /* PSM_HOOKAPM */
|
||||
|
||||
CDEV_DRIVER_MODULE(psm, isa, psm_driver, psm_devclass,
|
||||
CDEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, psm_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NPSM > 0 */
|
||||
|
@ -1,489 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* from: i386/isa scvidctl.c,v 1.1
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
#include "opt_syscons.h"
|
||||
|
||||
#if NSC > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/tty.h>
|
||||
#include <sys/kernel.h>
|
||||
|
||||
#ifdef __i386__
|
||||
#include <machine/apm_bios.h>
|
||||
#endif
|
||||
#include <machine/console.h>
|
||||
|
||||
#include <isa/videoio.h>
|
||||
#include <isa/syscons.h>
|
||||
|
||||
/* video ioctl */
|
||||
|
||||
extern scr_stat *cur_console;
|
||||
extern u_int32_t Crtat;
|
||||
extern int fonts_loaded;
|
||||
extern int sc_history_size;
|
||||
extern u_char palette[];
|
||||
|
||||
int
|
||||
sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode, int xsize, int ysize,
|
||||
int fontsize)
|
||||
{
|
||||
video_adapter_t *adp;
|
||||
video_info_t info;
|
||||
int error;
|
||||
int s;
|
||||
int i;
|
||||
|
||||
if ((*biosvidsw.get_info)(scp->adp, mode, &info))
|
||||
return ENODEV;
|
||||
adp = get_adapter(scp);
|
||||
|
||||
/* adjust argument values */
|
||||
if (fontsize <= 0)
|
||||
fontsize = info.vi_cheight;
|
||||
if (fontsize < 14) {
|
||||
fontsize = 8;
|
||||
if (!(fonts_loaded & FONT_8))
|
||||
return EINVAL;
|
||||
} else if (fontsize >= 16) {
|
||||
fontsize = 16;
|
||||
if (!(fonts_loaded & FONT_16))
|
||||
return EINVAL;
|
||||
} else {
|
||||
fontsize = 14;
|
||||
if (!(fonts_loaded & FONT_14))
|
||||
return EINVAL;
|
||||
}
|
||||
if ((xsize <= 0) || (xsize > info.vi_width))
|
||||
xsize = info.vi_width;
|
||||
if ((ysize <= 0) || (ysize > info.vi_height))
|
||||
ysize = info.vi_height;
|
||||
|
||||
/* stop screen saver, etc */
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* set up scp */
|
||||
if (scp->history != NULL)
|
||||
i = imax(scp->history_size / scp->xsize
|
||||
- imax(sc_history_size, scp->ysize), 0);
|
||||
else
|
||||
i = 0;
|
||||
/*
|
||||
* This is a kludge to fend off scrn_update() while we
|
||||
* muck around with scp. XXX
|
||||
*/
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
scp->status &= ~(GRAPHICS_MODE | PIXEL_MODE);
|
||||
scp->mode = mode;
|
||||
scp->font_size = fontsize;
|
||||
scp->xsize = xsize;
|
||||
scp->ysize = ysize;
|
||||
scp->xpixel = scp->xsize*8;
|
||||
scp->ypixel = scp->ysize*fontsize;
|
||||
|
||||
/* allocate buffers */
|
||||
sc_alloc_scr_buffer(scp, TRUE, TRUE);
|
||||
if (ISMOUSEAVAIL(adp->va_flags))
|
||||
sc_alloc_cut_buffer(scp, FALSE);
|
||||
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
|
||||
splx(s);
|
||||
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
||||
if (tp == NULL)
|
||||
return 0;
|
||||
if (tp->t_winsize.ws_col != scp->xsize
|
||||
|| tp->t_winsize.ws_row != scp->ysize) {
|
||||
tp->t_winsize.ws_col = scp->xsize;
|
||||
tp->t_winsize.ws_row = scp->ysize;
|
||||
pgsignal(tp->t_pgrp, SIGWINCH, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode)
|
||||
{
|
||||
video_adapter_t *adp;
|
||||
video_info_t info;
|
||||
int error;
|
||||
int s;
|
||||
|
||||
if ((*biosvidsw.get_info)(scp->adp, mode, &info))
|
||||
return ENODEV;
|
||||
adp = get_adapter(scp);
|
||||
|
||||
/* stop screen saver, etc */
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* set up scp */
|
||||
scp->status |= (UNKNOWN_MODE | GRAPHICS_MODE);
|
||||
scp->status &= ~PIXEL_MODE;
|
||||
scp->mode = mode;
|
||||
scp->xpixel = info.vi_width;
|
||||
scp->ypixel = info.vi_height;
|
||||
scp->xsize = info.vi_width/8;
|
||||
scp->ysize = info.vi_height/info.vi_cheight;
|
||||
scp->font_size = FONT_NONE;
|
||||
/* move the mouse cursor at the center of the screen */
|
||||
sc_move_mouse(scp, scp->xpixel / 2, scp->ypixel / 2);
|
||||
splx(s);
|
||||
|
||||
if (scp == cur_console)
|
||||
set_mode(scp);
|
||||
/* clear_graphics();*/
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
||||
if (tp == NULL)
|
||||
return 0;
|
||||
if (tp->t_winsize.ws_xpixel != scp->xpixel
|
||||
|| tp->t_winsize.ws_ypixel != scp->ypixel) {
|
||||
tp->t_winsize.ws_xpixel = scp->xpixel;
|
||||
tp->t_winsize.ws_ypixel = scp->ypixel;
|
||||
pgsignal(tp->t_pgrp, SIGWINCH, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sc_set_pixel_mode(scr_stat *scp, struct tty *tp, int xsize, int ysize,
|
||||
int fontsize)
|
||||
{
|
||||
video_adapter_t *adp;
|
||||
video_info_t info;
|
||||
int error;
|
||||
int s;
|
||||
int i;
|
||||
|
||||
if ((*biosvidsw.get_info)(scp->adp, scp->mode, &info))
|
||||
return ENODEV; /* this shouldn't happen */
|
||||
adp = get_adapter(scp);
|
||||
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
if (scp->scr_buf != NULL) {
|
||||
printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
|
||||
scp->mode, xsize, ysize, fontsize);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* adjust argument values */
|
||||
if ((fontsize <= 0) || (fontsize == FONT_NONE))
|
||||
fontsize = info.vi_cheight;
|
||||
if (fontsize < 14) {
|
||||
fontsize = 8;
|
||||
if (!(fonts_loaded & FONT_8))
|
||||
return EINVAL;
|
||||
} else if (fontsize >= 16) {
|
||||
fontsize = 16;
|
||||
if (!(fonts_loaded & FONT_16))
|
||||
return EINVAL;
|
||||
} else {
|
||||
fontsize = 14;
|
||||
if (!(fonts_loaded & FONT_14))
|
||||
return EINVAL;
|
||||
}
|
||||
if (xsize <= 0)
|
||||
xsize = info.vi_width/8;
|
||||
if (ysize <= 0)
|
||||
ysize = info.vi_height/fontsize;
|
||||
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
if (scp->scr_buf != NULL) {
|
||||
printf("set_pixel_mode(): mode:%x, col:%d, row:%d, font:%d\n",
|
||||
scp->mode, xsize, ysize, fontsize);
|
||||
printf("set_pixel_mode(): Crtat:%x, %dx%d, xoff:%d, yoff:%d\n",
|
||||
Crtat, info.vi_width, info.vi_height,
|
||||
(info.vi_width/8 - xsize)/2,
|
||||
(info.vi_height/fontsize - ysize)/2);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* stop screen saver, etc */
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
|
||||
/* set up scp */
|
||||
if (scp->history != NULL)
|
||||
i = imax(scp->history_size / scp->xsize
|
||||
- imax(sc_history_size, scp->ysize), 0);
|
||||
else
|
||||
i = 0;
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
|
||||
scp->status &= ~(GRAPHICS_MODE | MOUSE_ENABLED);
|
||||
scp->xsize = xsize;
|
||||
scp->ysize = ysize;
|
||||
scp->font_size = fontsize;
|
||||
scp->xoff = (scp->xpixel/8 - xsize)/2;
|
||||
scp->yoff = (scp->ypixel/fontsize - ysize)/2;
|
||||
|
||||
/* allocate buffers */
|
||||
sc_alloc_scr_buffer(scp, TRUE, TRUE);
|
||||
if (ISMOUSEAVAIL(adp->va_flags))
|
||||
sc_alloc_cut_buffer(scp, FALSE);
|
||||
sc_alloc_history_buffer(scp, sc_history_size, i, FALSE);
|
||||
splx(s);
|
||||
|
||||
/* FIXME */
|
||||
if (scp == cur_console)
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
|
||||
#ifdef SC_VIDEO_DEBUG
|
||||
printf("set_pixel_mode(): status:%x\n", scp->status);
|
||||
#endif
|
||||
|
||||
if (tp == NULL)
|
||||
return 0;
|
||||
if (tp->t_winsize.ws_col != scp->xsize
|
||||
|| tp->t_winsize.ws_row != scp->ysize) {
|
||||
tp->t_winsize.ws_col = scp->xsize;
|
||||
tp->t_winsize.ws_row = scp->ysize;
|
||||
pgsignal(tp->t_pgrp, SIGWINCH, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag, struct proc *p)
|
||||
{
|
||||
scr_stat *scp;
|
||||
video_adapter_t *adp;
|
||||
int error;
|
||||
int s;
|
||||
|
||||
scp = sc_get_scr_stat(tp->t_dev);
|
||||
|
||||
switch (cmd) {
|
||||
|
||||
case CONS_CURRENT: /* get current adapter type */
|
||||
adp = get_adapter(scp);
|
||||
*(int *)data = adp->va_type;
|
||||
return 0;
|
||||
|
||||
case CONS_CURRENTADP: /* get current adapter index */
|
||||
*(int *)data = scp->adp;
|
||||
return 0;
|
||||
|
||||
case CONS_ADPINFO: /* adapter information */
|
||||
adp = (*biosvidsw.adapter)(((video_adapter_t *)data)->va_index);
|
||||
if (adp == NULL)
|
||||
return ENODEV;
|
||||
bcopy(adp, data, sizeof(*adp));
|
||||
return 0;
|
||||
|
||||
case CONS_GET: /* get current video mode */
|
||||
*(int *)data = scp->mode;
|
||||
return 0;
|
||||
|
||||
case CONS_MODEINFO: /* get mode information */
|
||||
return ((*biosvidsw.get_info)(scp->adp,
|
||||
((video_info_t *)data)->vi_mode, (video_info_t *)data)
|
||||
? ENODEV : 0);
|
||||
|
||||
case CONS_FINDMODE: /* find a matching video mode */
|
||||
return ((*biosvidsw.query_mode)(scp->adp, (video_info_t *)data)
|
||||
? ENODEV : 0);
|
||||
|
||||
case CONS_SETWINORG:
|
||||
return ((*biosvidsw.set_win_org)(scp->adp, *(u_int *)data)
|
||||
? ENODEV : 0);
|
||||
|
||||
/* VGA TEXT MODES */
|
||||
case SW_VGA_C40x25:
|
||||
case SW_VGA_C80x25: case SW_VGA_M80x25:
|
||||
case SW_VGA_C80x30: case SW_VGA_M80x30:
|
||||
case SW_VGA_C80x50: case SW_VGA_M80x50:
|
||||
case SW_VGA_C80x60: case SW_VGA_M80x60:
|
||||
case SW_B40x25: case SW_C40x25:
|
||||
case SW_B80x25: case SW_C80x25:
|
||||
case SW_ENH_B40x25: case SW_ENH_C40x25:
|
||||
case SW_ENH_B80x25: case SW_ENH_C80x25:
|
||||
case SW_ENH_B80x43: case SW_ENH_C80x43:
|
||||
case SW_EGAMONO80x25:
|
||||
adp = get_adapter(scp);
|
||||
if (!(adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
return sc_set_text_mode(scp, tp, cmd & 0xff, 0, 0, 0);
|
||||
|
||||
/* GRAPHICS MODES */
|
||||
case SW_BG320: case SW_BG640:
|
||||
case SW_CG320: case SW_CG320_D: case SW_CG640_E:
|
||||
case SW_CG640x350: case SW_ENH_CG640:
|
||||
case SW_BG640x480: case SW_CG640x480: case SW_VGA_CG320:
|
||||
case SW_VGA_MODEX:
|
||||
adp = get_adapter(scp);
|
||||
if (!(adp->va_flags & V_ADP_MODECHANGE))
|
||||
return ENODEV;
|
||||
return sc_set_graphics_mode(scp, tp, cmd & 0xff);
|
||||
|
||||
case KDSETMODE: /* set current mode of this (virtual) console */
|
||||
switch (*data) {
|
||||
case KD_TEXT: /* switch to TEXT (known) mode */
|
||||
/*
|
||||
* If scp->mode is of graphics modes, we don't know which
|
||||
* text mode to switch back to...
|
||||
*/
|
||||
if (scp->status & GRAPHICS_MODE)
|
||||
return EINVAL;
|
||||
/* restore fonts & palette ! */
|
||||
#if 0
|
||||
adp = get_adapter(scp);
|
||||
if (ISFONTAVAIL(adp->va_flags)
|
||||
&& !(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
|
||||
/*
|
||||
* FONT KLUDGE
|
||||
* Don't load fonts for now... XXX
|
||||
*/
|
||||
if (fonts_loaded & FONT_8)
|
||||
copy_font(scp, LOAD, 8, font_8);
|
||||
if (fonts_loaded & FONT_14)
|
||||
copy_font(scp, LOAD, 14, font_14);
|
||||
if (fonts_loaded & FONT_16)
|
||||
copy_font(scp, LOAD, 16, font_16);
|
||||
}
|
||||
#endif
|
||||
load_palette(scp, palette);
|
||||
|
||||
/* move hardware cursor out of the way */
|
||||
(*biosvidsw.set_hw_cursor)(scp->adp, -1, -1);
|
||||
|
||||
/* FALL THROUGH */
|
||||
|
||||
case KD_TEXT1: /* switch to TEXT (known) mode */
|
||||
/*
|
||||
* If scp->mode is of graphics modes, we don't know which
|
||||
* text/pixel mode to switch back to...
|
||||
*/
|
||||
if (scp->status & GRAPHICS_MODE)
|
||||
return EINVAL;
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
splx(s);
|
||||
/* no restore fonts & palette */
|
||||
if (scp == cur_console) {
|
||||
set_mode(scp);
|
||||
/* FIXME */
|
||||
if (scp->status & PIXEL_MODE)
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
}
|
||||
sc_clear_screen(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
return 0;
|
||||
|
||||
case KD_PIXEL: /* pixel (raster) display */
|
||||
if (!(scp->status & (GRAPHICS_MODE | PIXEL_MODE)))
|
||||
return EINVAL;
|
||||
if (!(scp->status & PIXEL_MODE))
|
||||
return sc_set_pixel_mode(scp, tp, scp->xsize, scp->ysize,
|
||||
scp->font_size);
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
scp->status |= (UNKNOWN_MODE | PIXEL_MODE);
|
||||
splx(s);
|
||||
if (scp == cur_console) {
|
||||
set_mode(scp);
|
||||
load_palette(scp, palette);
|
||||
/* FIXME */
|
||||
memset_io(Crtat, 0, scp->xpixel*scp->ypixel/8);
|
||||
}
|
||||
sc_clear_screen(scp);
|
||||
scp->status &= ~UNKNOWN_MODE;
|
||||
return 0;
|
||||
|
||||
case KD_GRAPHICS: /* switch to GRAPHICS (unknown) mode */
|
||||
s = spltty();
|
||||
if ((error = sc_clean_up(scp))) {
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
scp->status |= UNKNOWN_MODE;
|
||||
splx(s);
|
||||
return 0;
|
||||
|
||||
default:
|
||||
return EINVAL;
|
||||
}
|
||||
/* NOT REACHED */
|
||||
|
||||
case KDRASTER: /* set pixel (raster) display mode */
|
||||
if (ISUNKNOWNSC(scp) || ISTEXTSC(scp))
|
||||
return ENODEV;
|
||||
return sc_set_pixel_mode(scp, tp, ((int *)data)[0], ((int *)data)[1],
|
||||
((int *)data)[2]);
|
||||
|
||||
case KDGETMODE: /* get current mode of this (virtual) console */
|
||||
/*
|
||||
* From the user program's point of view, KD_PIXEL is the same
|
||||
* as KD_TEXT...
|
||||
*/
|
||||
*data = ISGRAPHSC(scp) ? KD_GRAPHICS : KD_TEXT;
|
||||
return 0;
|
||||
|
||||
case KDSBORDER: /* set border color of this (virtual) console */
|
||||
scp->border = *data;
|
||||
if (scp == cur_console)
|
||||
set_border(cur_console, scp->border);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ENOIOCTL;
|
||||
}
|
||||
|
||||
#endif /* NSC > 0 */
|
4671
sys/isa/syscons.c
4671
sys/isa/syscons.c
File diff suppressed because it is too large
Load Diff
@ -1,258 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1995-1998 Søren Schmidt
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer,
|
||||
* without modification, immediately at the beginning of the file.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.40 1998/08/06 09:15:53 dfr Exp $
|
||||
* from: i386/isa syscons.h,v 1.40
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_SYSCONS_H_
|
||||
#define _I386_ISA_SYSCONS_H_
|
||||
|
||||
/* vm things */
|
||||
#define ISMAPPED(pa, width) \
|
||||
(((pa) <= (u_long)0x1000 - (width)) \
|
||||
|| ((pa) >= 0xa0000 && (pa) <= 0x100000 - (width)))
|
||||
|
||||
#if 0
|
||||
#define pa_to_va(pa) (KERNBASE + (pa)) /* works if ISMAPPED(pa...) */
|
||||
#endif
|
||||
|
||||
#ifdef __i386__
|
||||
#define WRITEB(pa, b) *(u_int8_t*)(KERNBASE + (pa)) = b
|
||||
#define READB(pa) *(u_int8_t*)(KERNBASE + (pa))
|
||||
#else
|
||||
#define WRITEB(pa, b) writeb(pa, b)
|
||||
#define READB(pa) readb(pa)
|
||||
#endif
|
||||
|
||||
/* printable chars */
|
||||
#define PRINTABLE(ch) ((ch) > 0x1b || ((ch) > 0x0d && (ch) < 0x1b) \
|
||||
|| (ch) < 0x07)
|
||||
|
||||
/* macros for "intelligent" screen update */
|
||||
#define mark_for_update(scp, x) {\
|
||||
if ((x) < scp->start) scp->start = (x);\
|
||||
else if ((x) > scp->end) scp->end = (x);\
|
||||
}
|
||||
#define mark_all(scp) {\
|
||||
scp->start = 0;\
|
||||
scp->end = scp->xsize * scp->ysize - 1;\
|
||||
}
|
||||
|
||||
/* status flags */
|
||||
#define LOCK_KEY_MASK 0x0000F
|
||||
#define LED_MASK 0x00007
|
||||
#define UNKNOWN_MODE 0x00010
|
||||
#define KBD_RAW_MODE 0x00020
|
||||
#define KBD_CODE_MODE 0x00040
|
||||
#define SWITCH_WAIT_REL 0x00080
|
||||
#define SWITCH_WAIT_ACQ 0x00100
|
||||
#define BUFFER_SAVED 0x00200
|
||||
#define CURSOR_ENABLED 0x00400
|
||||
#define MOUSE_ENABLED 0x00800
|
||||
#define MOUSE_MOVED 0x01000
|
||||
#define MOUSE_CUTTING 0x02000
|
||||
#define MOUSE_VISIBLE 0x04000
|
||||
#define GRAPHICS_MODE 0x08000
|
||||
#define PIXEL_MODE 0x10000
|
||||
#define SAVER_RUNNING 0x20000
|
||||
|
||||
/* configuration flags */
|
||||
#define VISUAL_BELL 0x00001
|
||||
#define BLINK_CURSOR 0x00002
|
||||
#define CHAR_CURSOR 0x00004
|
||||
#define DETECT_KBD 0x00008
|
||||
#define XT_KEYBD 0x00010
|
||||
#define KBD_NORESET 0x00020
|
||||
#define QUIET_BELL 0x00040
|
||||
#define VESA800X600 0x00080
|
||||
|
||||
/* attribute flags */
|
||||
#define NORMAL_ATTR 0x00
|
||||
#define BLINK_ATTR 0x01
|
||||
#define BOLD_ATTR 0x02
|
||||
#define UNDERLINE_ATTR 0x04
|
||||
#define REVERSE_ATTR 0x08
|
||||
#define FOREGROUND_CHANGED 0x10
|
||||
#define BACKGROUND_CHANGED 0x20
|
||||
|
||||
/* misc defines */
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define MAX_ESC_PAR 5
|
||||
#define LOAD 1
|
||||
#define SAVE 0
|
||||
#define COL 80
|
||||
#define ROW 25
|
||||
#define BELL_DURATION 5
|
||||
#define BELL_PITCH 800
|
||||
#define CONSOLE_BUFSIZE 1024
|
||||
#define PCBURST 128
|
||||
#define FONT_NONE 1
|
||||
#define FONT_8 2
|
||||
#define FONT_14 4
|
||||
#define FONT_16 8
|
||||
|
||||
/* special characters */
|
||||
#define cntlc 0x03
|
||||
#define cntld 0x04
|
||||
#define bs 0x08
|
||||
#define lf 0x0a
|
||||
#define cr 0x0d
|
||||
#define del 0x7f
|
||||
|
||||
#define DEAD_CHAR 0x07 /* char used for cursor */
|
||||
|
||||
typedef struct term_stat {
|
||||
int esc; /* processing escape sequence */
|
||||
int num_param; /* # of parameters to ESC */
|
||||
int last_param; /* last parameter # */
|
||||
int param[MAX_ESC_PAR]; /* contains ESC parameters */
|
||||
int cur_attr; /* current hardware attr word */
|
||||
int attr_mask; /* current logical attr mask */
|
||||
int cur_color; /* current hardware color */
|
||||
int std_color; /* normal hardware color */
|
||||
int rev_color; /* reverse hardware color */
|
||||
} term_stat;
|
||||
|
||||
typedef struct scr_stat {
|
||||
int adp; /* video adapter index */
|
||||
u_short *scr_buf; /* buffer when off screen */
|
||||
int xpos; /* current X position */
|
||||
int ypos; /* current Y position */
|
||||
int saved_xpos; /* saved X position */
|
||||
int saved_ypos; /* saved Y position */
|
||||
int xsize; /* X text size */
|
||||
int ysize; /* Y text size */
|
||||
int xpixel; /* X graphics size */
|
||||
int ypixel; /* Y graphics size */
|
||||
int xoff; /* X offset in pixel mode */
|
||||
int yoff; /* Y offset in pixel mode */
|
||||
int font_size; /* fontsize in Y direction */
|
||||
int start; /* modified area start */
|
||||
int end; /* modified area end */
|
||||
term_stat term; /* terminal emulation stuff */
|
||||
int status; /* status (bitfield) */
|
||||
u_short *cursor_pos; /* cursor buffer position */
|
||||
u_short *cursor_oldpos; /* cursor old buffer position */
|
||||
u_short cursor_saveunder; /* saved chars under cursor */
|
||||
char cursor_start; /* cursor start line # */
|
||||
char cursor_end; /* cursor end line # */
|
||||
u_short *mouse_pos; /* mouse buffer position */
|
||||
u_short *mouse_oldpos; /* mouse old buffer position */
|
||||
short mouse_xpos; /* mouse x coordinate */
|
||||
short mouse_ypos; /* mouse y coordinate */
|
||||
short mouse_buttons; /* mouse buttons */
|
||||
u_char mouse_cursor[128]; /* mouse cursor bitmap store */
|
||||
u_short *mouse_cut_start; /* mouse cut start pos */
|
||||
u_short *mouse_cut_end; /* mouse cut end pos */
|
||||
struct proc *mouse_proc; /* proc* of controlling proc */
|
||||
pid_t mouse_pid; /* pid of controlling proc */
|
||||
int mouse_signal; /* signal # to report with */
|
||||
u_short bell_duration;
|
||||
u_short bell_pitch;
|
||||
u_char border; /* border color */
|
||||
int initial_mode; /* initial mode */
|
||||
int mode; /* mode */
|
||||
pid_t pid; /* pid of controlling proc */
|
||||
struct proc *proc; /* proc* of controlling proc */
|
||||
struct vt_mode smode; /* switch mode */
|
||||
u_short *history; /* circular history buffer */
|
||||
u_short *history_head; /* current head position */
|
||||
u_short *history_pos; /* position shown on screen */
|
||||
u_short *history_save; /* save area index */
|
||||
int history_size; /* size of history buffer */
|
||||
#ifdef __i386__
|
||||
struct apmhook r_hook; /* reconfiguration support */
|
||||
#endif
|
||||
#ifdef SC_SPLASH_SCREEN
|
||||
int splash_save_mode; /* saved mode for splash screen */
|
||||
int splash_save_status; /* saved status for splash screen */
|
||||
#endif
|
||||
} scr_stat;
|
||||
|
||||
typedef struct default_attr {
|
||||
int std_color; /* normal hardware color */
|
||||
int rev_color; /* reverse hardware color */
|
||||
} default_attr;
|
||||
|
||||
|
||||
#define ISTEXTSC(scp) (!((scp)->status \
|
||||
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE)))
|
||||
#define ISGRAPHSC(scp) (((scp)->status \
|
||||
& (UNKNOWN_MODE | GRAPHICS_MODE)))
|
||||
#define ISPIXELSC(scp) (((scp)->status \
|
||||
& (UNKNOWN_MODE | GRAPHICS_MODE | PIXEL_MODE))\
|
||||
== PIXEL_MODE)
|
||||
#define ISUNKNOWNSC(scp) ((scp)->status & UNKNOWN_MODE)
|
||||
|
||||
#define ISFONTAVAIL(af) ((af) & V_ADP_FONT)
|
||||
#define ISMOUSEAVAIL(af) ((af) & V_ADP_FONT)
|
||||
#define ISPALAVAIL(af) ((af) & V_ADP_PALETTE)
|
||||
|
||||
/* misc prototypes used by different syscons related LKM's */
|
||||
|
||||
/* syscons.c */
|
||||
extern int (*sc_user_ioctl)(dev_t dev, int cmd, caddr_t data, int flag,
|
||||
struct proc *p);
|
||||
|
||||
int set_mode(scr_stat *scp);
|
||||
scr_stat *sc_get_scr_stat(dev_t dev);
|
||||
|
||||
void copy_font(scr_stat *scp, int operation, int font_size, u_char *font_image);
|
||||
#define save_palette(scp, pal) (*biosvidsw.save_palette)((scp)->adp, pal)
|
||||
#define load_palette(scp, pal) (*biosvidsw.load_palette)((scp)->adp, pal)
|
||||
#define set_border(scp, col) (*biosvidsw.set_border)((scp)->adp, col)
|
||||
#define get_adapter(scp) (*biosvidsw.adapter)((scp)->adp)
|
||||
|
||||
int add_scrn_saver(void (*this)(int));
|
||||
int remove_scrn_saver(void (*this)(int));
|
||||
|
||||
void sc_clear_screen(scr_stat *scp);
|
||||
void sc_move_mouse(scr_stat *scp, int x, int y);
|
||||
int sc_clean_up(scr_stat *scp);
|
||||
void sc_alloc_scr_buffer(scr_stat *scp, int wait, int clear);
|
||||
void sc_alloc_cut_buffer(scr_stat *scp, int wait);
|
||||
void sc_alloc_history_buffer(scr_stat *scp, int lines, int extra, int wait);
|
||||
|
||||
/* scvidctl.c */
|
||||
int sc_set_text_mode(scr_stat *scp, struct tty *tp, int mode,
|
||||
int xsize, int ysize, int fontsize);
|
||||
int sc_set_graphics_mode(scr_stat *scp, struct tty *tp, int mode);
|
||||
int sc_set_pixel_mode(scr_stat *scp, struct tty *tp,
|
||||
int xsize, int ysize, int fontsize);
|
||||
int sc_vid_ioctl(struct tty *tp, u_long cmd, caddr_t data, int flag,
|
||||
struct proc *p);
|
||||
|
||||
#ifdef SC_SPLASH_SCREEN
|
||||
/* splash.c */
|
||||
void scsplash(int);
|
||||
int scsplash_load(scr_stat *scp);
|
||||
int scsplash_unload(scr_stat *scp);
|
||||
#endif
|
||||
|
||||
#endif /* !_I386_ISA_SYSCONS_H_ */
|
80
sys/isa/syscons_isa.c
Normal file
80
sys/isa/syscons_isa.c
Normal file
@ -0,0 +1,80 @@
|
||||
/*-
|
||||
* Copyright (c) 1999 Kazutaka YOKOTA <yokota@zodiac.mech.utsunomiya-u.ac.jp>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer as
|
||||
* the first lines of this file unmodified.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id:$
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
#include "opt_syscons.h"
|
||||
|
||||
#if NSC > 0
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/module.h>
|
||||
#include <sys/bus.h>
|
||||
|
||||
#include <machine/console.h>
|
||||
|
||||
#include <dev/syscons/syscons.h>
|
||||
|
||||
#include <isa/isareg.h>
|
||||
#include <isa/isavar.h>
|
||||
|
||||
devclass_t sc_devclass;
|
||||
|
||||
static int scprobe(device_t dev);
|
||||
static int scattach(device_t dev);
|
||||
|
||||
static device_method_t sc_methods[] = {
|
||||
DEVMETHOD(device_probe, scprobe),
|
||||
DEVMETHOD(device_attach, scattach),
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static driver_t sc_driver = {
|
||||
"sc",
|
||||
sc_methods,
|
||||
DRIVER_TYPE_TTY,
|
||||
1, /* XXX */
|
||||
};
|
||||
|
||||
static int
|
||||
scprobe(device_t dev)
|
||||
{
|
||||
device_set_desc(dev, "System console");
|
||||
return sc_probe_unit(device_get_unit(dev), isa_get_flags(dev));
|
||||
}
|
||||
|
||||
static int
|
||||
scattach(device_t dev)
|
||||
{
|
||||
return sc_attach_unit(device_get_unit(dev), isa_get_flags(dev));
|
||||
}
|
||||
|
||||
DRIVER_MODULE(sc, isa, sc_driver, sc_devclass, 0, 0);
|
||||
|
||||
#endif /* NSC > 0 */
|
@ -1,111 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1993 The Regents of the University of California.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: Header: timerreg.h,v 1.2 93/02/28 15:08:58 mccanne Exp
|
||||
* $Id$
|
||||
* from: i386/isa timerreg.h,v 1.5
|
||||
*/
|
||||
|
||||
/*
|
||||
*
|
||||
* Register definitions for the Intel 8253 Programmable Interval Timer.
|
||||
*
|
||||
* This chip has three independent 16-bit down counters that can be
|
||||
* read on the fly. There are three mode registers and three countdown
|
||||
* registers. The countdown registers are addressed directly, via the
|
||||
* first three I/O ports. The three mode registers are accessed via
|
||||
* the fourth I/O port, with two bits in the mode byte indicating the
|
||||
* register. (Why are hardware interfaces always so braindead?).
|
||||
*
|
||||
* To write a value into the countdown register, the mode register
|
||||
* is first programmed with a command indicating the which byte of
|
||||
* the two byte register is to be modified. The three possibilities
|
||||
* are load msb (TMR_MR_MSB), load lsb (TMR_MR_LSB), or load lsb then
|
||||
* msb (TMR_MR_BOTH).
|
||||
*
|
||||
* To read the current value ("on the fly") from the countdown register,
|
||||
* you write a "latch" command into the mode register, then read the stable
|
||||
* value from the corresponding I/O port. For example, you write
|
||||
* TMR_MR_LATCH into the corresponding mode register. Presumably,
|
||||
* after doing this, a write operation to the I/O port would result
|
||||
* in undefined behavior (but hopefully not fry the chip).
|
||||
* Reading in this manner has no side effects.
|
||||
*
|
||||
* [IBM-PC]
|
||||
* The outputs of the three timers are connected as follows:
|
||||
*
|
||||
* timer 0 -> irq 0
|
||||
* timer 1 -> dma chan 0 (for dram refresh)
|
||||
* timer 2 -> speaker (via keyboard controller)
|
||||
*
|
||||
* Timer 0 is used to call hardclock.
|
||||
* Timer 2 is used to generate console beeps.
|
||||
*
|
||||
* [PC-9801]
|
||||
* The outputs of the three timers are connected as follows:
|
||||
*
|
||||
* timer 0 -> irq 0
|
||||
* timer 1 -> speaker (via keyboard controller)
|
||||
* timer 2 -> RS232C
|
||||
*
|
||||
* Timer 0 is used to call hardclock.
|
||||
* Timer 1 is used to generate console beeps.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Macros for specifying values to be written into a mode register.
|
||||
*/
|
||||
#define TIMER_CNTR0 (IO_TIMER1 + 0) /* timer 0 counter port */
|
||||
#ifdef PC98
|
||||
#define TIMER_CNTR1 0x3fdb /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 4) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 6) /* timer mode port */
|
||||
#else
|
||||
#define TIMER_CNTR1 (IO_TIMER1 + 1) /* timer 1 counter port */
|
||||
#define TIMER_CNTR2 (IO_TIMER1 + 2) /* timer 2 counter port */
|
||||
#define TIMER_MODE (IO_TIMER1 + 3) /* timer mode port */
|
||||
#endif
|
||||
#define TIMER_SEL0 0x00 /* select counter 0 */
|
||||
#define TIMER_SEL1 0x40 /* select counter 1 */
|
||||
#define TIMER_SEL2 0x80 /* select counter 2 */
|
||||
#define TIMER_INTTC 0x00 /* mode 0, intr on terminal cnt */
|
||||
#define TIMER_ONESHOT 0x02 /* mode 1, one shot */
|
||||
#define TIMER_RATEGEN 0x04 /* mode 2, rate generator */
|
||||
#define TIMER_SQWAVE 0x06 /* mode 3, square wave */
|
||||
#define TIMER_SWSTROBE 0x08 /* mode 4, s/w triggered strobe */
|
||||
#define TIMER_HWSTROBE 0x0a /* mode 5, h/w triggered strobe */
|
||||
#define TIMER_LATCH 0x00 /* latch counter for reading */
|
||||
#define TIMER_LSB 0x10 /* r/w counter LSB */
|
||||
#define TIMER_MSB 0x20 /* r/w counter MSB */
|
||||
#define TIMER_16BIT 0x30 /* r/w counter 16 bits, LSB first */
|
||||
#define TIMER_BCD 0x01 /* count in BCD */
|
||||
|
2239
sys/isa/vga_isa.c
Normal file
2239
sys/isa/vga_isa.c
Normal file
File diff suppressed because it is too large
Load Diff
1628
sys/isa/videoio.c
1628
sys/isa/videoio.c
File diff suppressed because it is too large
Load Diff
@ -1,108 +0,0 @@
|
||||
/*-
|
||||
* Copyright (c) 1998 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp)
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id$
|
||||
* from: i386/isa/videoio.h,v 1.1
|
||||
*/
|
||||
|
||||
#ifndef _I386_ISA_VIDEOIO_H_
|
||||
#define _I386_ISA_VIDEOIO_H_
|
||||
|
||||
#ifdef KERNEL
|
||||
|
||||
#define V_MAX_ADAPTERS 2
|
||||
|
||||
#define V_MODE_MAP_SIZE (M_VGA_CG320 + 1)
|
||||
#define V_MODE_PARAM_SIZE 64
|
||||
|
||||
/* physical addresses */
|
||||
#define MONO_BUF BIOS_PADDRTOVADDR(0xb0000)
|
||||
#define CGA_BUF BIOS_PADDRTOVADDR(0xb8000)
|
||||
#define GRAPHICS_BUF BIOS_PADDRTOVADDR(0xa0000)
|
||||
#define VIDEOMEM 0x000A0000
|
||||
|
||||
/* I/O port addresses */
|
||||
#define MONO_BASE 0x3B4 /* crt controller base mono */
|
||||
#define COLOR_BASE 0x3D4 /* crt controller base color */
|
||||
#define MISC 0x3C2 /* misc output register */
|
||||
#define ATC IO_VGA+0x00 /* attribute controller */
|
||||
#define TSIDX IO_VGA+0x04 /* timing sequencer idx */
|
||||
#define TSREG IO_VGA+0x05 /* timing sequencer data */
|
||||
#define PIXMASK IO_VGA+0x06 /* pixel write mask */
|
||||
#define PALRADR IO_VGA+0x07 /* palette read address */
|
||||
#define PALWADR IO_VGA+0x08 /* palette write address */
|
||||
#define PALDATA IO_VGA+0x09 /* palette data register */
|
||||
#define GDCIDX IO_VGA+0x0E /* graph data controller idx */
|
||||
#define GDCREG IO_VGA+0x0F /* graph data controller data */
|
||||
|
||||
/* video function table */
|
||||
typedef int vi_init_t(void);
|
||||
typedef video_adapter_t *vi_adapter_t(int ad);
|
||||
typedef int vi_get_info_t(int ad, int mode, video_info_t *info);
|
||||
typedef int vi_query_mode_t(int ad, video_info_t *info);
|
||||
typedef int vi_set_mode_t(int ad, int mode);
|
||||
typedef int vi_save_font_t(int ad, int page, int size, u_char *data,
|
||||
int c, int count);
|
||||
typedef int vi_load_font_t(int ad, int page, int size, u_char *data,
|
||||
int c, int count);
|
||||
typedef int vi_show_font_t(int ad, int page);
|
||||
typedef int vi_save_palette_t(int ad, u_char *palette);
|
||||
typedef int vi_load_palette_t(int ad, u_char *palette);
|
||||
typedef int vi_set_border_t(int ad, int border);
|
||||
typedef int vi_save_state_t(int ad, void *p, size_t size);
|
||||
typedef int vi_load_state_t(int ad, void *p);
|
||||
typedef int vi_set_win_org_t(int ad, off_t offset);
|
||||
typedef int vi_read_hw_cursor_t(int ad, int *col, int *row);
|
||||
typedef int vi_set_hw_cursor_t(int ad, int col, int row);
|
||||
typedef int vi_diag_t(int level);
|
||||
|
||||
struct vidsw {
|
||||
vi_init_t *init; /* all */
|
||||
vi_adapter_t *adapter; /* all */
|
||||
vi_get_info_t *get_info; /* all */
|
||||
vi_query_mode_t *query_mode; /* all */
|
||||
vi_set_mode_t *set_mode; /* EGA/VGA */
|
||||
vi_save_font_t *save_font; /* EGA/VGA */
|
||||
vi_load_font_t *load_font; /* EGA/VGA */
|
||||
vi_show_font_t *show_font; /* EGA/VGA */
|
||||
vi_save_palette_t *save_palette; /* VGA */
|
||||
vi_load_palette_t *load_palette; /* VGA */
|
||||
vi_set_border_t *set_border; /* CGA/EGA/VGA */
|
||||
vi_save_state_t *save_state; /* VGA */
|
||||
vi_load_state_t *load_state; /* EGA/VGA */
|
||||
vi_set_win_org_t *set_win_org; /* all */
|
||||
vi_read_hw_cursor_t *read_hw_cursor; /* all */
|
||||
vi_set_hw_cursor_t *set_hw_cursor; /* all */
|
||||
vi_diag_t *diag; /* all */
|
||||
};
|
||||
|
||||
extern struct vidsw biosvidsw;
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
#endif /* !_I386_ISA_VIDEOIO_H_ */
|
Loading…
Reference in New Issue
Block a user