Linux-2.6.12-rc2
[linux-2.6/kvm.git] / arch / m68k / sun3 / prom / printf.c
blobe6ee1006344ef7733c1de0050d2f1309948f1ad2
1 /* $Id: printf.c,v 1.5 1996/04/04 16:31:07 tridge Exp $
2 * printf.c: Internal prom library printf facility.
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 */
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 */
11 #include <linux/config.h>
12 #include <linux/kernel.h>
14 #include <asm/openprom.h>
15 #include <asm/oplib.h>
17 #ifdef CONFIG_KGDB
18 extern int kgdb_initialized;
19 #endif
21 static char ppbuf[1024];
23 void
24 prom_printf(char *fmt, ...)
26 va_list args;
27 char ch, *bptr;
28 int i;
30 va_start(args, fmt);
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
39 bptr = ppbuf;
41 #ifdef CONFIG_AP1000
42 ap_write(1,bptr,strlen(bptr));
43 #else
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');
55 prom_putchar(ch);
57 #endif
58 #endif
59 va_end(args);
60 return;