Loading...
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * printf.c: Internal prom library printf facility.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
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....
10 */
11
12#include <linux/kernel.h>
13
14#include <asm/openprom.h>
15#include <asm/oplib.h>
16
17#ifdef CONFIG_KGDB
18extern int kgdb_initialized;
19#endif
20
21static char ppbuf[1024];
22
23void
24prom_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_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');
50
51 prom_putchar(ch);
52 }
53#endif
54 va_end(args);
55 return;
56}
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * printf.c: Internal prom library printf facility.
4 *
5 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
6 */
7
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....
10 */
11
12#include <linux/kernel.h>
13
14#include <asm/openprom.h>
15#include <asm/oplib.h>
16
17#ifdef CONFIG_KGDB
18extern int kgdb_initialized;
19#endif
20
21static char ppbuf[1024];
22
23void
24prom_printf(char *fmt, ...)
25{
26 va_list args;
27 char ch, *bptr;
28
29 va_start(args, fmt);
30
31#ifdef CONFIG_KGDB
32 ppbuf[0] = 'O';
33 vsprintf(ppbuf + 1, fmt, args) + 1;
34#else
35 vsprintf(ppbuf, fmt, args);
36#endif
37
38 bptr = ppbuf;
39
40#ifdef CONFIG_KGDB
41 if (kgdb_initialized) {
42 pr_info("kgdb_initialized = %d\n", kgdb_initialized);
43 putpacket(bptr, 1);
44 } else
45#else
46 while((ch = *(bptr++)) != 0) {
47 if(ch == '\n')
48 prom_putchar('\r');
49
50 prom_putchar(ch);
51 }
52#endif
53 va_end(args);
54 return;
55}