aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sparc/prom/printf.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/sparc/prom/printf.c
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'arch/sparc/prom/printf.c')
-rw-r--r--arch/sparc/prom/printf.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/arch/sparc/prom/printf.c b/arch/sparc/prom/printf.c
new file mode 100644
index 000000000000..dc8b598bedbb
--- /dev/null
+++ b/arch/sparc/prom/printf.c
@@ -0,0 +1,46 @@
1/*
2 * printf.c: Internal prom library printf facility.
3 *
4 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
5 * Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
6 *
7 * We used to warn all over the code: DO NOT USE prom_printf(),
8 * and yet people do. Anton's banking code was outputing banks
9 * with prom_printf for most of the 2.4 lifetime. Since an effective
10 * stick is not available, we deployed a carrot: an early printk
11 * through PROM by means of -p boot option. This ought to fix it.
12 * USE printk; if you need, deploy -p.
13 */
14
15#include <linux/kernel.h>
16
17#include <asm/openprom.h>
18#include <asm/oplib.h>
19
20static char ppbuf[1024];
21
22void
23prom_write(const char *buf, unsigned int n)
24{
25 char ch;
26
27 while (n != 0) {
28 --n;
29 if ((ch = *buf++) == '\n')
30 prom_putchar('\r');
31 prom_putchar(ch);
32 }
33}
34
35void
36prom_printf(char *fmt, ...)
37{
38 va_list args;
39 int i;
40
41 va_start(args, fmt);
42 i = vscnprintf(ppbuf, sizeof(ppbuf), fmt, args);
43 va_end(args);
44
45 prom_write(ppbuf, i);
46}