File: /usr/src/linux/arch/mips64/sgi-ip27/ip27-console.c
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2001 Ralf Baechle
7 */
8 #include <linux/init.h>
9 #include <linux/console.h>
10 #include <linux/kdev_t.h>
11 #include <linux/major.h>
12 #include <asm/sn/addrs.h>
13 #include <asm/sn/sn0/hub.h>
14 #include <asm/sn/klconfig.h>
15 #include <asm/sn/ioc3.h>
16 #include <asm/sn/sn_private.h>
17
18 void prom_putchar(char c)
19 {
20 struct ioc3 *ioc3;
21 struct ioc3_uartregs *uart;
22
23 ioc3 = (struct ioc3 *)KL_CONFIG_CH_CONS_INFO(master_nasid)->memory_base;
24 uart = &ioc3->sregs.uarta;
25
26 while ((uart->iu_lsr & 0x20) == 0);
27 uart->iu_thr = c;
28 }
29
30 char __init prom_getchar(void)
31 {
32 return 0;
33 }
34
35 static void
36 ip27prom_console_write(struct console *con, const char *s, unsigned n)
37 {
38 prom_printf("%s", s);
39 }
40
41 static kdev_t
42 ip27prom_console_dev(struct console *c)
43 {
44 return MKDEV(TTY_MAJOR, 64 + c->index);
45 }
46
47 static struct console ip27_prom_console = {
48 name: "prom",
49 write: ip27prom_console_write,
50 device: ip27prom_console_dev,
51 flags: CON_PRINTBUFFER,
52 index: -1,
53 };
54
55 __init void ip27_setup_console(void)
56 {
57 register_console(&ip27_prom_console);
58 }
59