Commit cafe8464 authored by Pete Zaitcev's avatar Pete Zaitcev Committed by David S. Miller

SPARC: Fix prom_printf and prom console behavior.

parent 15c5cc6e
......@@ -130,7 +130,7 @@ void kernel_enter_debugger(void)
static void
prom_console_write(struct console *con, const char *s, unsigned n)
{
prom_printf("%s", s);
prom_write(s, n);
}
static struct console prom_debug_console = {
......
/* $Id: printf.c,v 1.7 2000/02/08 20:24:23 davem Exp $
/*
* printf.c: Internal prom library printf facility.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
*/
/* This routine is internal to the prom library, no one else should know
* about or use it! It's simple and smelly anyway....
* Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
*
* We used to warn all over the code: DO NOT USE prom_printf(),
* and yet people do. Anton's banking code was outputing banks
* with prom_printf for most of the 2.4 lifetime. Since an effective
* stick is not available, we deployed a carrot: an early printk
* through PROM by means of -p boot option. This ought to fix it.
* USE printk; if you need, deploy -p.
*/
#include <linux/kernel.h>
......@@ -15,24 +19,28 @@
static char ppbuf[1024];
void
prom_write(const char *buf, unsigned int n)
{
char ch;
while (n != 0) {
--n;
if ((ch = *buf++) == '\n')
prom_putchar('\r');
prom_putchar(ch);
}
}
void
prom_printf(char *fmt, ...)
{
va_list args;
char ch, *bptr;
int i;
va_start(args, fmt);
i = vsprintf(ppbuf, fmt, args);
bptr = ppbuf;
while((ch = *(bptr++)) != 0) {
if(ch == '\n')
prom_putchar('\r');
prom_putchar(ch);
}
i = vsnprintf(ppbuf, sizeof(ppbuf), fmt, args);
va_end(args);
return;
prom_write(ppbuf, i);
}
......@@ -73,7 +73,7 @@ asmlinkage void sys_sync(void); /* it's really int */
static void
prom_console_write(struct console *con, const char *s, unsigned n)
{
prom_printf("%s", s);
prom_write(s, n);
}
static struct console prom_console = {
......
/* $Id: printf.c,v 1.3 1997/03/18 18:00:00 jj Exp $
/*
* printf.c: Internal prom library printf facility.
*
* Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
* Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
*/
/* This routine is internal to the prom library, no one else should know
* about or use it! It's simple and smelly anyway....
* Copyright (c) 2002 Pete Zaitcev (zaitcev@yahoo.com)
*
* We used to warn all over the code: DO NOT USE prom_printf(),
* and yet people do. Anton's banking code was outputing banks
* with prom_printf for most of the 2.4 lifetime. Since an effective
* stick is not available, we deployed a carrot: an early printk
* through PROM by means of -p boot option. This ought to fix it.
* USE printk; if you need, deploy -p.
*/
#include <linux/kernel.h>
......@@ -16,31 +20,28 @@
static char ppbuf[1024];
extern void prom_puts (char *, int);
void
prom_write(const char *buf, unsigned int n)
{
char ch;
while (n != 0) {
--n;
if ((ch = *buf++) == '\n')
prom_putchar('\r');
prom_putchar(ch);
}
}
void
prom_printf(char *fmt, ...)
{
va_list args;
char ch, *bptr, *last;
int i;
va_start(args, fmt);
i = vsprintf(ppbuf, fmt, args);
bptr = ppbuf;
last = ppbuf;
while((ch = *(bptr++)) != 0) {
if(ch == '\n') {
if (last < bptr - 1)
prom_puts (last, bptr - 1 - last);
prom_putchar('\r');
last = bptr - 1;
}
}
if (last < bptr - 1)
prom_puts (last, bptr - 1 - last);
i = vsnprintf(ppbuf, sizeof(ppbuf), fmt, args);
va_end(args);
return;
prom_write(ppbuf, i);
}
......@@ -153,8 +153,9 @@ extern char prom_getchar(void);
/* Blocking put character to console. */
extern void prom_putchar(char character);
/* Prom's internal printf routine, don't use in kernel/boot code. */
void prom_printf(char *fmt, ...);
/* Prom's internal routines, don't use in kernel/boot code. */
extern void prom_printf(char *fmt, ...);
extern void prom_write(const char *buf, unsigned int len);
/* Query for input device type */
......
......@@ -153,8 +153,9 @@ extern char prom_getchar(void);
/* Blocking put character to console. */
extern void prom_putchar(char character);
/* Prom's internal printf routine, don't use in kernel/boot code. */
void prom_printf(char *fmt, ...);
/* Prom's internal routines, don't use in kernel/boot code. */
extern void prom_printf(char *fmt, ...);
extern void prom_write(const char *buf, unsigned int len);
/* Query for input device type */
......
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