aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/lasat/prom.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2007-03-01 06:56:43 -0500
committerRalf Baechle <ralf@linux-mips.org>2007-03-04 14:02:37 -0500
commit36a885306fdf7bb557c773309c993bfb2d0d693c (patch)
tree643b246c90653c9451ff7fecff74a79c3de8042c /arch/mips/lasat/prom.c
parentca471c86043f4a8b01cba02ba2d3431fddcaf606 (diff)
[MIPS] Fix and cleanup the mess that a dozen prom_printf variants are.
early_printk is a so much saner thing. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/lasat/prom.c')
-rw-r--r--arch/mips/lasat/prom.c47
1 files changed, 11 insertions, 36 deletions
diff --git a/arch/mips/lasat/prom.c b/arch/mips/lasat/prom.c
index d47692f73a26..812c6ac366be 100644
--- a/arch/mips/lasat/prom.c
+++ b/arch/mips/lasat/prom.c
@@ -23,10 +23,6 @@
23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1) 23#define PROM_PUTC_ADDR PROM_JUMP_TABLE_ENTRY(1)
24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2) 24#define PROM_MONITOR_ADDR PROM_JUMP_TABLE_ENTRY(2)
25 25
26static void null_prom_printf(const char * fmt, ...)
27{
28}
29
30static void null_prom_display(const char *string, int pos, int clear) 26static void null_prom_display(const char *string, int pos, int clear)
31{ 27{
32} 28}
@@ -40,50 +36,29 @@ static void null_prom_putc(char c)
40} 36}
41 37
42/* these are functions provided by the bootloader */ 38/* these are functions provided by the bootloader */
43static void (* prom_putc)(char c) = null_prom_putc; 39static void (* __prom_putc)(char c) = null_prom_putc;
44void (* prom_printf)(const char * fmt, ...) = null_prom_printf; 40
41void prom_putchar(char c)
42{
43 __prom_putc(c);
44}
45
45void (* prom_display)(const char *string, int pos, int clear) = 46void (* prom_display)(const char *string, int pos, int clear) =
46 null_prom_display; 47 null_prom_display;
47void (* prom_monitor)(void) = null_prom_monitor; 48void (* prom_monitor)(void) = null_prom_monitor;
48 49
49unsigned int lasat_ndelay_divider; 50unsigned int lasat_ndelay_divider;
50 51
51#define PROM_PRINTFBUF_SIZE 256
52static char prom_printfbuf[PROM_PRINTFBUF_SIZE];
53
54static void real_prom_printf(const char * fmt, ...)
55{
56 va_list ap;
57 int len;
58 char *c = prom_printfbuf;
59 int i;
60
61 va_start(ap, fmt);
62 len = vsnprintf(prom_printfbuf, PROM_PRINTFBUF_SIZE, fmt, ap);
63 va_end(ap);
64
65 /* output overflowed the buffer */
66 if (len < 0 || len > PROM_PRINTFBUF_SIZE)
67 len = PROM_PRINTFBUF_SIZE;
68
69 for (i=0; i < len; i++) {
70 if (*c == '\n')
71 prom_putc('\r');
72 prom_putc(*c++);
73 }
74}
75
76static void setup_prom_vectors(void) 52static void setup_prom_vectors(void)
77{ 53{
78 u32 version = *(u32 *)(RESET_VECTOR + 0x90); 54 u32 version = *(u32 *)(RESET_VECTOR + 0x90);
79 55
80 if (version >= 307) { 56 if (version >= 307) {
81 prom_display = (void *)PROM_DISPLAY_ADDR; 57 prom_display = (void *)PROM_DISPLAY_ADDR;
82 prom_putc = (void *)PROM_PUTC_ADDR; 58 __prom_putc = (void *)PROM_PUTC_ADDR;
83 prom_printf = real_prom_printf;
84 prom_monitor = (void *)PROM_MONITOR_ADDR; 59 prom_monitor = (void *)PROM_MONITOR_ADDR;
85 } 60 }
86 prom_printf("prom vectors set up\n"); 61 printk("prom vectors set up\n");
87} 62}
88 63
89static struct at93c_defs at93c_defs[N_MACHTYPES] = { 64static struct at93c_defs at93c_defs[N_MACHTYPES] = {
@@ -101,11 +76,11 @@ void __init prom_init(void)
101 setup_prom_vectors(); 76 setup_prom_vectors();
102 77
103 if (current_cpu_data.cputype == CPU_R5000) { 78 if (current_cpu_data.cputype == CPU_R5000) {
104 prom_printf("LASAT 200 board\n"); 79 printk("LASAT 200 board\n");
105 mips_machtype = MACH_LASAT_200; 80 mips_machtype = MACH_LASAT_200;
106 lasat_ndelay_divider = LASAT_200_DIVIDER; 81 lasat_ndelay_divider = LASAT_200_DIVIDER;
107 } else { 82 } else {
108 prom_printf("LASAT 100 board\n"); 83 printk("LASAT 100 board\n");
109 mips_machtype = MACH_LASAT_100; 84 mips_machtype = MACH_LASAT_100;
110 lasat_ndelay_divider = LASAT_100_DIVIDER; 85 lasat_ndelay_divider = LASAT_100_DIVIDER;
111 } 86 }