FreeBSD/Linux Kernel Cross Reference
sys/sqt/consio.c
1 /*
2 * Mach Operating System
3 * Copyright (c) 1991 Carnegie Mellon University
4 * Copyright (c) 1991 Sequent Computer Systems
5 * All Rights Reserved.
6 *
7 * Permission to use, copy, modify and distribute this software and its
8 * documentation is hereby granted, provided that both the copyright
9 * notice and this permission notice appear in all copies of the
10 * software, derivative works or modified versions, and any portions
11 * thereof, and that both notices appear in supporting documentation.
12 *
13 * CARNEGIE MELLON AND SEQUENT COMPUTER SYSTEMS ALLOW FREE USE OF
14 * THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON AND
15 * SEQUENT COMPUTER SYSTEMS DISCLAIM ANY LIABILITY OF ANY KIND FOR
16 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
17 *
18 * Carnegie Mellon requests users of this software to return to
19 *
20 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
21 * School of Computer Science
22 * Carnegie Mellon University
23 * Pittsburgh PA 15213-3890
24 *
25 * any improvements or extensions that they make and grant Carnegie Mellon
26 * the rights to redistribute these changes.
27 */
28
29 /*
30 * HISTORY
31 * $Log: consio.c,v $
32 * Revision 2.3 91/07/31 18:00:37 dbg
33 * Changed copyright.
34 * [91/07/31 dbg]
35 *
36 * Revision 2.2 91/05/08 12:55:31 dbg
37 * Adapted from Sequent SYMMETRY sources.
38 * [91/04/26 14:51:09 dbg]
39 *
40 */
41
42 #ifndef lint
43 static char rcsid[] = "$Header: consio.c,v 2.3 91/07/31 18:00:37 dbg Exp $";
44 #endif
45
46 /*
47 * consio.c
48 * Machine dependent cnputc(), putflush() implementation.
49 *
50 * Also, getchar for debug.
51 */
52
53 /*
54 * Revision 1.2 89/07/20 18:05:36 kak
55 * moved balance includes
56 *
57 * Revision 1.1 89/07/05 13:15:28 kak
58 * Initial revision
59 *
60 */
61
62 #include <sys/types.h>
63
64 #include <sqt/intctl.h>
65 #include <sqt/mutex.h>
66
67 #include <sqt/engine.h>
68
69
70 extern short upyet; /* says if init done yet */
71 extern u_char cons_scsi; /* SLIC id of console SCSI card */
72
73 #define PUTCHAR_BIN 1 /* for SCSI putchar()'s */
74
75 #ifdef DEBUG
76 /*
77 * Data for DEBUG console....
78 */
79 char gc_last; /* last input character */
80 #endif DEBUG
81
82 /*
83 * cnputc()
84 * Arrange that a character be output on the "console".
85 *
86 */
87
88 /*ARGSUSED*/
89 cnputc(c)
90 char c;
91 {
92 register int me;
93 spl_t s;
94
95 if (c == '\n')
96 cnputc('\r');
97
98 if (!upyet) {
99 if (cons_scsi == 0)
100 return; /* va_slic is not set! */
101 sq_putc(c);
102 return;
103 }
104
105 /*
106 * Output character.
107 */
108
109 s = splhi(); /* mutex SLIC usage */
110
111 sq_putc(c);
112
113 splx(s);
114 }
115
116 /*
117 * sq_putc()
118 * Local version to do SCSI output of character.
119 *
120 * Assumes caller did splhi() or otherwise blocks interrupts.
121 * Can't do this here, since this used at boot time before
122 * turned on kernel page-tables (==> splhi(), splx() use wrong
123 * virt-addr for SLIC).
124 */
125
126 sq_putc(c)
127 char c;
128 {
129 mIntr(cons_scsi, PUTCHAR_BIN, (u_char)c);
130 }
Cache object: e85364cd8b73a1a0ab21e9bdb5c90195
|