RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / sparc / prom / console_64.c
blobed39e75828bd1eb6057f192d052ab88f5b943ddd
1 /* console.c: Routines that deal with sending and receiving IO
2 * to/from the current console device using the PROM.
4 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
6 */
8 #include <linux/types.h>
9 #include <linux/kernel.h>
10 #include <linux/sched.h>
11 #include <asm/openprom.h>
12 #include <asm/oplib.h>
13 #include <asm/system.h>
14 #include <linux/string.h>
16 extern int prom_stdin, prom_stdout;
18 static int __prom_console_write_buf(const char *buf, int len)
20 unsigned long args[7];
21 int ret;
23 args[0] = (unsigned long) "write";
24 args[1] = 3;
25 args[2] = 1;
26 args[3] = (unsigned int) prom_stdout;
27 args[4] = (unsigned long) buf;
28 args[5] = (unsigned int) len;
29 args[6] = (unsigned long) -1;
31 p1275_cmd_direct(args);
33 ret = (int) args[6];
34 if (ret < 0)
35 return -1;
36 return ret;
39 void prom_console_write_buf(const char *buf, int len)
41 while (len) {
42 int n = __prom_console_write_buf(buf, len);
43 if (n < 0)
44 continue;
45 len -= n;
46 buf += len;