import of upstream 2.4.34.4 from kernel.org
[linux-2.4.git] / arch / mips / gt64120 / ev64120 / promcon.c
1 /*
2  * Wrap-around code for a console using the
3  * SGI PROM io-routines.
4  *
5  * Copyright (c) 1999 Ulf Carlsson
6  *
7  * Derived from DECstation promcon.c
8  * Copyright (c) 1998 Harald Koerfgen
9  */
10 #include <linux/tty.h>
11 #include <linux/major.h>
12 #include <linux/ptrace.h>
13 #include <linux/init.h>
14 #include <linux/console.h>
15 #include <linux/fs.h>
16
17 static void prom_console_write(struct console *co, const char *s,
18                                unsigned count)
19 {
20         extern int CONSOLE_CHANNEL;     // The default serial port
21         unsigned i;
22
23         for (i = 0; i < count; i++) {
24                 if (*s == 10)
25                         serial_putc(CONSOLE_CHANNEL, 13);
26                 serial_putc(CONSOLE_CHANNEL, *s++);
27         }
28 }
29
30 int prom_getchar(void)
31 {
32         return 0;
33 }
34
35 static kdev_t prom_console_device(struct console *c)
36 {
37         return MKDEV(TTY_MAJOR, 64 + c->index);
38 }
39
40 static struct console sercons = {
41     .name       = "ttyS",
42     .write      = prom_console_write,
43     .device     = prom_console_device,
44     .flags      = CON_PRINTBUFFER,
45     .index      = -1,
46 };
47
48 /*
49  *    Register console.
50  */
51
52 void gal_serial_console_init(void)
53 {
54         //  serial_init();
55         //serial_set(115200);
56
57         register_console(&sercons);
58 }