vidconsole.c (38466) | vidconsole.c (39441) |
---|---|
1/* 2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org) 3 * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * From Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp 28 * | 1/* 2 * Copyright (c) 1998 Michael Smith (msmith@freebsd.org) 3 * Copyright (c) 1997 Kazutaka YOKOTA (yokota@zodiac.mech.utsunomiya-u.ac.jp) 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: --- 12 unchanged lines hidden (view full) --- 21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * SUCH DAMAGE. 26 * 27 * From Id: probe_keyboard.c,v 1.13 1997/06/09 05:10:55 bde Exp 28 * |
29 * $Id$ | 29 * $Id: vidconsole.c,v 1.1.1.1 1998/08/21 03:17:41 msmith Exp $ |
30 */ 31 32#include <stand.h> | 30 */ 31 32#include <stand.h> |
33#include <bootstrap.h> 34#include <btxv86.h> 35#include "libi386.h" |
|
33 | 36 |
37#if KEYBOARD_PROBE |
|
34#include <machine/cpufunc.h> 35 | 38#include <machine/cpufunc.h> 39 |
36#include "bootstrap.h" 37 38/* in vidconsole.S */ 39extern void vidputc(int c); 40extern int kbdgetc(void); 41extern int kbdiskey(void); 42 | |
43static int probe_keyboard(void); | 40static int probe_keyboard(void); |
41#endif |
|
44static void vidc_probe(struct console *cp); 45static int vidc_init(int arg); | 42static void vidc_probe(struct console *cp); 43static int vidc_init(int arg); |
46static int vidc_in(void); | 44static void vidc_putchar(int c); 45static int vidc_getchar(void); 46static int vidc_ischar(void); |
47 48struct console vidconsole = { 49 "vidconsole", 50 "internal video/keyboard", 51 0, 52 vidc_probe, 53 vidc_init, | 47 48struct console vidconsole = { 49 "vidconsole", 50 "internal video/keyboard", 51 0, 52 vidc_probe, 53 vidc_init, |
54 vidputc, 55 vidc_in, 56 kbdiskey | 54 vidc_putchar, 55 vidc_getchar, 56 vidc_ischar |
57}; 58 59static void 60vidc_probe(struct console *cp) 61{ 62 63 /* look for a keyboard */ | 57}; 58 59static void 60vidc_probe(struct console *cp) 61{ 62 63 /* look for a keyboard */ |
64#if 0 65 if (probe_keyboard()) { 66#else 67 if (1) { | 64#if KEYBOARD_PROBE 65 if (probe_keyboard()) |
68#endif | 66#endif |
67 { 68 |
|
69 cp->c_flags |= C_PRESENTIN; 70 } 71 72 /* XXX for now, always assume we can do BIOS screen output */ 73 cp->c_flags |= C_PRESENTOUT; 74} 75 76static int 77vidc_init(int arg) 78{ 79 return(0); /* XXX reinit? */ 80} 81 | 69 cp->c_flags |= C_PRESENTIN; 70 } 71 72 /* XXX for now, always assume we can do BIOS screen output */ 73 cp->c_flags |= C_PRESENTOUT; 74} 75 76static int 77vidc_init(int arg) 78{ 79 return(0); /* XXX reinit? */ 80} 81 |
82static void 83vidc_putchar(int c) 84{ 85 v86.ctl = 0; 86 v86.addr = 0x10; 87 v86.eax = 0xe00 | c; 88 v86.ebx = 0x7; 89 v86int(); 90} 91 |
|
82static int | 92static int |
83vidc_in(void) | 93vidc_getchar(void) |
84{ | 94{ |
85 if (kbdiskey()) { 86 return(kbdgetc()); | 95 if (vidc_ischar()) { 96 v86.ctl = 0; 97 v86.addr = 0x16; 98 v86.eax = 0x0; 99 v86int(); 100 return(v86.eax); |
87 } else { 88 return(-1); 89 } 90} 91 | 101 } else { 102 return(-1); 103 } 104} 105 |
106static int 107vidc_ischar(void) 108{ 109 v86.ctl = 0; 110 v86.addr = 0x16; 111 v86.eax = 0x100; 112 v86int(); 113 return(v86.eax); 114} 115 116#if KEYBOARD_PROBE 117 |
|
92#define PROBE_MAXRETRY 5 93#define PROBE_MAXWAIT 400 94#define IO_DUMMY 0x84 95#define IO_KBD 0x060 /* 8042 Keyboard */ 96 97/* selected defines from kbdio.h */ 98#define KBD_STATUS_PORT 4 /* status port, read */ 99#define KBD_DATA_PORT 0 /* data port, read/write --- 92 unchanged lines hidden (view full) --- 192 if (i == KBD_ECHO) { 193 /* got the right answer */ 194 return (0); 195 } 196 } 197 198 return (1); 199} | 118#define PROBE_MAXRETRY 5 119#define PROBE_MAXWAIT 400 120#define IO_DUMMY 0x84 121#define IO_KBD 0x060 /* 8042 Keyboard */ 122 123/* selected defines from kbdio.h */ 124#define KBD_STATUS_PORT 4 /* status port, read */ 125#define KBD_DATA_PORT 0 /* data port, read/write --- 92 unchanged lines hidden (view full) --- 218 if (i == KBD_ECHO) { 219 /* got the right answer */ 220 return (0); 221 } 222 } 223 224 return (1); 225} |
226#endif /* KEYBOARD_PROBE */ |
|