diff options
Diffstat (limited to 'arch/m68k/sun3/prom/printf.c')
-rw-r--r-- | arch/m68k/sun3/prom/printf.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/arch/m68k/sun3/prom/printf.c b/arch/m68k/sun3/prom/printf.c new file mode 100644 index 000000000000..e6ee1006344e --- /dev/null +++ b/arch/m68k/sun3/prom/printf.c | |||
@@ -0,0 +1,61 @@ | |||
1 | /* $Id: printf.c,v 1.5 1996/04/04 16:31:07 tridge Exp $ | ||
2 | * printf.c: Internal prom library printf facility. | ||
3 | * | ||
4 | * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) | ||
5 | */ | ||
6 | |||
7 | /* This routine is internal to the prom library, no one else should know | ||
8 | * about or use it! It's simple and smelly anyway.... | ||
9 | */ | ||
10 | |||
11 | #include <linux/config.h> | ||
12 | #include <linux/kernel.h> | ||
13 | |||
14 | #include <asm/openprom.h> | ||
15 | #include <asm/oplib.h> | ||
16 | |||
17 | #ifdef CONFIG_KGDB | ||
18 | extern int kgdb_initialized; | ||
19 | #endif | ||
20 | |||
21 | static char ppbuf[1024]; | ||
22 | |||
23 | void | ||
24 | prom_printf(char *fmt, ...) | ||
25 | { | ||
26 | va_list args; | ||
27 | char ch, *bptr; | ||
28 | int i; | ||
29 | |||
30 | va_start(args, fmt); | ||
31 | |||
32 | #ifdef CONFIG_KGDB | ||
33 | ppbuf[0] = 'O'; | ||
34 | i = vsprintf(ppbuf + 1, fmt, args) + 1; | ||
35 | #else | ||
36 | i = vsprintf(ppbuf, fmt, args); | ||
37 | #endif | ||
38 | |||
39 | bptr = ppbuf; | ||
40 | |||
41 | #ifdef CONFIG_AP1000 | ||
42 | ap_write(1,bptr,strlen(bptr)); | ||
43 | #else | ||
44 | |||
45 | #ifdef CONFIG_KGDB | ||
46 | if (kgdb_initialized) { | ||
47 | printk("kgdb_initialized = %d\n", kgdb_initialized); | ||
48 | putpacket(bptr, 1); | ||
49 | } else | ||
50 | #else | ||
51 | while((ch = *(bptr++)) != 0) { | ||
52 | if(ch == '\n') | ||
53 | prom_putchar('\r'); | ||
54 | |||
55 | prom_putchar(ch); | ||
56 | } | ||
57 | #endif | ||
58 | #endif | ||
59 | va_end(args); | ||
60 | return; | ||
61 | } | ||