patch-2.1.101 linux/drivers/sgi/char/sgiserial.c
Next file: linux/fs/Makefile
Previous file: linux/drivers/sgi/char/newport.h
Back to the patch index
Back to the overall index
- Lines: 137
- Date:
Fri May 8 00:23:41 1998
- Orig file:
v2.1.100/linux/drivers/sgi/char/sgiserial.c
- Orig date:
Thu May 7 22:51:51 1998
diff -u --recursive --new-file v2.1.100/linux/drivers/sgi/char/sgiserial.c linux/drivers/sgi/char/sgiserial.c
@@ -17,6 +17,7 @@
#include <linux/mm.h>
#include <linux/kernel.h>
#include <linux/delay.h>
+#include <linux/console.h>
#include <asm/io.h>
#include <asm/irq.h>
@@ -52,6 +53,19 @@
static int zs_cons_chanin = 0;
struct sgi_serial *zs_consinfo = 0;
+static struct console sgi_console_driver = {
+ "debug",
+ NULL, /* write */
+ NULL, /* read */
+ NULL, /* device */
+ NULL, /* wait_key */
+ NULL, /* unblank */
+ NULL, /* setup */
+ CON_PRINTBUFFER,
+ -1,
+ 0,
+ NULL
+};
static unsigned char kgdb_regs[16] = {
0, 0, 0, /* write 0, 1, 2 */
(Rx8 | RxENABLE), /* write 3 */
@@ -960,14 +974,14 @@
/*
* zs_console_print is registered for printk.
*/
-static void zs_console_print(const char *p)
+
+static void zs_console_print(struct console *co, const char *str, unsigned int count)
{
- char c;
- while((c=*(p++)) != 0) {
- if(c == '\n')
+ while(count--) {
+ if(*str == '\n')
rs_put_char('\r');
- rs_put_char(c);
+ rs_put_char(*str++);
}
/* Comment this if you want to have a strict interrupt-driven output */
@@ -1712,7 +1726,7 @@
}
-extern void register_console(void (*proc)(const char *));
+
static inline void
rs_cons_check(struct sgi_serial *ss, int channel)
@@ -1723,6 +1737,7 @@
i = o = io = 0;
+
/* Is this one of the serial console lines? */
if((zs_cons_chanout != channel) &&
(zs_cons_chanin != channel))
@@ -1730,16 +1745,20 @@
zs_conschan = ss->zs_channel;
zs_consinfo = ss;
+
/* Register the console output putchar, if necessary */
if((zs_cons_chanout == channel)) {
o = 1;
/* double whee.. */
+
if(!consout_registered) {
- register_console(zs_console_print);
+ sgi_console_driver.write = zs_console_print;
+ register_console(&sgi_console_driver);
consout_registered = 1;
}
}
+
/* If this is console input, we handle the break received
* status interrupt on this line to mean prom_halt().
*/
@@ -1756,6 +1775,7 @@
panic("Console baud rate weirdness");
}
+
/* Set flag variable for this port so that it cannot be
* opened for other uses by accident.
*/
@@ -1766,9 +1786,11 @@
printk("zs%d: console I/O\n", ((channel>>1)&1));
msg_printed = 1;
}
+
} else {
printk("zs%d: console %s\n", ((channel>>1)&1),
(i==1 ? "input" : (o==1 ? "output" : "WEIRD")));
+
}
}
@@ -1780,6 +1802,7 @@
int chip, channel, i, flags;
struct sgi_serial *info;
+
/* Setup base handler, and timer table. */
init_bh(SERIAL_BH, do_serial_bh);
timer_table[RS_TIMER].fn = rs_timer;
@@ -1966,6 +1989,7 @@
{
int channel;
+
if(chip)
panic("rs_cons_hook called with chip not zero");
if(line != 1 && line != 2)
@@ -1981,10 +2005,11 @@
zs_soft[channel].change_needed = 0;
zs_soft[channel].clk_divisor = 16;
zs_soft[channel].zs_baud = get_zsbaud(&zs_soft[channel]);
- if(out)
+ if(out)
zs_cons_chanout = ((chip * 2) + channel);
- else
+ else
zs_cons_chanin = ((chip * 2) + channel);
+
rs_cons_check(&zs_soft[channel], channel);
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov