WIP FPC-III support
[linux/fpc-iii.git] / arch / m68k / sun3 / prom / printf.c
blobb6724cc6679579bdc5337b772317c0bdf803f9d5
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * printf.c: Internal prom library printf facility.
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
8 /* This routine is internal to the prom library, no one else should know
9 * about or use it! It's simple and smelly anyway....
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_KGDB
42 if (kgdb_initialized) {
43 pr_info("kgdb_initialized = %d\n", kgdb_initialized);
44 putpacket(bptr, 1);
45 } else
46 #else
47 while((ch = *(bptr++)) != 0) {
48 if(ch == '\n')
49 prom_putchar('\r');
51 prom_putchar(ch);
53 #endif
54 va_end(args);
55 return;