RT-AC66 3.0.0.4.374.130 core
[tomato.git] / release / src-rt-6.x / linux / linux-2.6 / arch / m68k / sun3 / prom / printf.c
blobe7bfde377b5e848c4e50e2fbfa3e6b028f42a6be
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/kernel.h>
13 #include <asm/openprom.h>
14 #include <asm/oplib.h>
16 #ifdef CONFIG_KGDB
17 extern int kgdb_initialized;
18 #endif
20 static char ppbuf[1024];
22 void
23 prom_printf(char *fmt, ...)
25 va_list args;
26 char ch, *bptr;
27 int i;
29 va_start(args, fmt);
31 #ifdef CONFIG_KGDB
32 ppbuf[0] = 'O';
33 i = vsprintf(ppbuf + 1, fmt, args) + 1;
34 #else
35 i = vsprintf(ppbuf, fmt, args);
36 #endif
38 bptr = ppbuf;
40 #ifdef CONFIG_AP1000
41 ap_write(1,bptr,strlen(bptr));
42 #else
44 #ifdef CONFIG_KGDB
45 if (kgdb_initialized) {
46 printk("kgdb_initialized = %d\n", kgdb_initialized);
47 putpacket(bptr, 1);
48 } else
49 #else
50 while((ch = *(bptr++)) != 0) {
51 if(ch == '\n')
52 prom_putchar('\r');
54 prom_putchar(ch);
56 #endif
57 #endif
58 va_end(args);
59 return;