powerpc: Improve prom_printf()

Adds the ability to print decimal numbers and adds some more
format string variants
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent dd797738
...@@ -335,6 +335,7 @@ static void __init prom_printf(const char *format, ...) ...@@ -335,6 +335,7 @@ static void __init prom_printf(const char *format, ...)
const char *p, *q, *s; const char *p, *q, *s;
va_list args; va_list args;
unsigned long v; unsigned long v;
long vs;
struct prom_t *_prom = &RELOC(prom); struct prom_t *_prom = &RELOC(prom);
va_start(args, format); va_start(args, format);
...@@ -368,12 +369,35 @@ static void __init prom_printf(const char *format, ...) ...@@ -368,12 +369,35 @@ static void __init prom_printf(const char *format, ...)
v = va_arg(args, unsigned long); v = va_arg(args, unsigned long);
prom_print_hex(v); prom_print_hex(v);
break; break;
case 'd':
++q;
vs = va_arg(args, int);
if (vs < 0) {
prom_print(RELOC("-"));
vs = -vs;
}
prom_print_dec(vs);
break;
case 'l': case 'l':
++q; ++q;
if (*q == 'u') { /* '%lu' */ if (*q == 0)
break;
else if (*q == 'x') {
++q;
v = va_arg(args, unsigned long);
prom_print_hex(v);
} else if (*q == 'u') { /* '%lu' */
++q; ++q;
v = va_arg(args, unsigned long); v = va_arg(args, unsigned long);
prom_print_dec(v); prom_print_dec(v);
} else if (*q == 'd') { /* %ld */
++q;
vs = va_arg(args, long);
if (vs < 0) {
prom_print(RELOC("-"));
vs = -vs;
}
prom_print_dec(vs);
} }
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment