]>
Commit | Line | Data |
---|---|---|
d979f179 | 1 | /* console.c: Routines that deal with sending and receiving IO |
1da177e4 LT |
2 | * to/from the current console device using the PROM. |
3 | * | |
d979f179 | 4 | * Copyright (C) 1995 David S. Miller ([email protected]) |
1da177e4 LT |
5 | * Copyright (C) 1996,1997 Jakub Jelinek ([email protected]) |
6 | */ | |
7 | ||
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> | |
1da177e4 LT |
13 | #include <linux/string.h> |
14 | ||
595a251c | 15 | static int __prom_console_write_buf(const char *buf, int len) |
1da177e4 | 16 | { |
25edd694 | 17 | unsigned long args[7]; |
595a251c | 18 | int ret; |
25edd694 DM |
19 | |
20 | args[0] = (unsigned long) "write"; | |
21 | args[1] = 3; | |
22 | args[2] = 1; | |
23 | args[3] = (unsigned int) prom_stdout; | |
e62cac1f | 24 | args[4] = (unsigned long) buf; |
595a251c | 25 | args[5] = (unsigned int) len; |
25edd694 DM |
26 | args[6] = (unsigned long) -1; |
27 | ||
28 | p1275_cmd_direct(args); | |
29 | ||
595a251c DM |
30 | ret = (int) args[6]; |
31 | if (ret < 0) | |
1da177e4 | 32 | return -1; |
595a251c | 33 | return ret; |
1da177e4 LT |
34 | } |
35 | ||
595a251c | 36 | void prom_console_write_buf(const char *buf, int len) |
1da177e4 | 37 | { |
595a251c DM |
38 | while (len) { |
39 | int n = __prom_console_write_buf(buf, len); | |
40 | if (n < 0) | |
41 | continue; | |
42 | len -= n; | |
43 | buf += len; | |
e62cac1f | 44 | } |
1da177e4 | 45 | } |