diff options
Diffstat (limited to 'arch/sparc/prom/console_64.c')
-rw-r--r-- | arch/sparc/prom/console_64.c | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c index 0da88d10beff..ed39e75828bd 100644 --- a/arch/sparc/prom/console_64.c +++ b/arch/sparc/prom/console_64.c | |||
@@ -15,35 +15,34 @@ | |||
15 | 15 | ||
16 | extern int prom_stdin, prom_stdout; | 16 | extern int prom_stdin, prom_stdout; |
17 | 17 | ||
18 | /* Non blocking put character to console device, returns -1 if | 18 | static int __prom_console_write_buf(const char *buf, int len) |
19 | * unsuccessful. | ||
20 | */ | ||
21 | static int prom_nbputchar(const char *buf) | ||
22 | { | 19 | { |
23 | unsigned long args[7]; | 20 | unsigned long args[7]; |
21 | int ret; | ||
24 | 22 | ||
25 | args[0] = (unsigned long) "write"; | 23 | args[0] = (unsigned long) "write"; |
26 | args[1] = 3; | 24 | args[1] = 3; |
27 | args[2] = 1; | 25 | args[2] = 1; |
28 | args[3] = (unsigned int) prom_stdout; | 26 | args[3] = (unsigned int) prom_stdout; |
29 | args[4] = (unsigned long) buf; | 27 | args[4] = (unsigned long) buf; |
30 | args[5] = 1; | 28 | args[5] = (unsigned int) len; |
31 | args[6] = (unsigned long) -1; | 29 | args[6] = (unsigned long) -1; |
32 | 30 | ||
33 | p1275_cmd_direct(args); | 31 | p1275_cmd_direct(args); |
34 | 32 | ||
35 | if (args[6] == 1) | 33 | ret = (int) args[6]; |
36 | return 0; | 34 | if (ret < 0) |
37 | else | ||
38 | return -1; | 35 | return -1; |
36 | return ret; | ||
39 | } | 37 | } |
40 | 38 | ||
41 | /* Blocking version of put character routine above. */ | 39 | void prom_console_write_buf(const char *buf, int len) |
42 | void prom_putchar(const char *buf) | ||
43 | { | 40 | { |
44 | while (1) { | 41 | while (len) { |
45 | int err = prom_nbputchar(buf); | 42 | int n = __prom_console_write_buf(buf, len); |
46 | if (!err) | 43 | if (n < 0) |
47 | break; | 44 | continue; |
45 | len -= n; | ||
46 | buf += len; | ||
48 | } | 47 | } |
49 | } | 48 | } |