diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2007-03-01 06:56:43 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2007-03-04 14:02:37 -0500 |
commit | 36a885306fdf7bb557c773309c993bfb2d0d693c (patch) | |
tree | 643b246c90653c9451ff7fecff74a79c3de8042c /arch/mips/lasat/prom.c | |
parent | ca471c86043f4a8b01cba02ba2d3431fddcaf606 (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.c | 47 |
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 | ||
26 | static void null_prom_printf(const char * fmt, ...) | ||
27 | { | ||
28 | } | ||
29 | |||
30 | static void null_prom_display(const char *string, int pos, int clear) | 26 | static 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 */ |
43 | static void (* prom_putc)(char c) = null_prom_putc; | 39 | static void (* __prom_putc)(char c) = null_prom_putc; |
44 | void (* prom_printf)(const char * fmt, ...) = null_prom_printf; | 40 | |
41 | void prom_putchar(char c) | ||
42 | { | ||
43 | __prom_putc(c); | ||
44 | } | ||
45 | |||
45 | void (* prom_display)(const char *string, int pos, int clear) = | 46 | void (* prom_display)(const char *string, int pos, int clear) = |
46 | null_prom_display; | 47 | null_prom_display; |
47 | void (* prom_monitor)(void) = null_prom_monitor; | 48 | void (* prom_monitor)(void) = null_prom_monitor; |
48 | 49 | ||
49 | unsigned int lasat_ndelay_divider; | 50 | unsigned int lasat_ndelay_divider; |
50 | 51 | ||
51 | #define PROM_PRINTFBUF_SIZE 256 | ||
52 | static char prom_printfbuf[PROM_PRINTFBUF_SIZE]; | ||
53 | |||
54 | static 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 | |||
76 | static void setup_prom_vectors(void) | 52 | static 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 | ||
89 | static struct at93c_defs at93c_defs[N_MACHTYPES] = { | 64 | static 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 | } |