aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/prom/console_64.c
diff options
context:
space:
mode:
authorSam Ravnborg <sam@ravnborg.org>2008-11-30 01:16:52 -0500
committerDavid S. Miller <davem@davemloft.net>2008-12-04 12:17:17 -0500
commit5de18cde3b748aafc6d187d7655ba42f2260501d (patch)
treefa4805081e6663b10be678c924a0adc3c7a95107 /arch/sparc/prom/console_64.c
parent708d4f09647106d549c646dc459c7ccf2c237cc8 (diff)
sparc,sparc64: unify prom/
- all files with identical names copied and renamed to *_64.c - the remaning files copied as is - added sparc64 specific files to sparc/prom/Makefile - teach sparc64 Makefile to look into sparc/prom/ - delete unused Makefile from sparc64/prom/ linking order was not kept for sparc64 with this change. It was not possible to keep linking order for both sparc and sparc64 and as sparc64 see more testing than sparc it was natural to break linking order on sparc64. Should it have any effect it would be detected sooner this way. printf_32.c and printf_64.c are obvious candidates to be merged but they are not 100% equal so that was left for later Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'arch/sparc/prom/console_64.c')
-rw-r--r--arch/sparc/prom/console_64.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/arch/sparc/prom/console_64.c b/arch/sparc/prom/console_64.c
new file mode 100644
index 000000000000..e1c3fc87484d
--- /dev/null
+++ b/arch/sparc/prom/console_64.c
@@ -0,0 +1,74 @@
1/* console.c: Routines that deal with sending and receiving IO
2 * to/from the current console device using the PROM.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@davemloft.net)
5 * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
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>
13#include <asm/system.h>
14#include <linux/string.h>
15
16extern int prom_stdin, prom_stdout;
17
18/* Non blocking get character from console input device, returns -1
19 * if no input was taken. This can be used for polling.
20 */
21inline int
22prom_nbgetchar(void)
23{
24 char inc;
25
26 if (p1275_cmd("read", P1275_ARG(1,P1275_ARG_OUT_BUF)|
27 P1275_INOUT(3,1),
28 prom_stdin, &inc, P1275_SIZE(1)) == 1)
29 return inc;
30 else
31 return -1;
32}
33
34/* Non blocking put character to console device, returns -1 if
35 * unsuccessful.
36 */
37inline int
38prom_nbputchar(char c)
39{
40 char outc;
41
42 outc = c;
43 if (p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)|
44 P1275_INOUT(3,1),
45 prom_stdout, &outc, P1275_SIZE(1)) == 1)
46 return 0;
47 else
48 return -1;
49}
50
51/* Blocking version of get character routine above. */
52char
53prom_getchar(void)
54{
55 int character;
56 while((character = prom_nbgetchar()) == -1) ;
57 return (char) character;
58}
59
60/* Blocking version of put character routine above. */
61void
62prom_putchar(char c)
63{
64 prom_nbputchar(c);
65 return;
66}
67
68void
69prom_puts(const char *s, int len)
70{
71 p1275_cmd("write", P1275_ARG(1,P1275_ARG_IN_BUF)|
72 P1275_INOUT(3,1),
73 prom_stdout, s, P1275_SIZE(len));
74}