aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/sni
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/sni
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/sni')
-rw-r--r--arch/mips/sni/sniprom.c51
1 files changed, 16 insertions, 35 deletions
diff --git a/arch/mips/sni/sniprom.c b/arch/mips/sni/sniprom.c
index 6a44bbf0b732..643366eb854a 100644
--- a/arch/mips/sni/sniprom.c
+++ b/arch/mips/sni/sniprom.c
@@ -9,6 +9,8 @@
9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de) 9 * Copyright (C) 2005-2006 Thomas Bogendoerfer (tsbogend@alpha.franken.de)
10 */ 10 */
11 11
12#define DEBUG
13
12#include <linux/kernel.h> 14#include <linux/kernel.h>
13#include <linux/init.h> 15#include <linux/init.h>
14#include <linux/string.h> 16#include <linux/string.h>
@@ -32,14 +34,13 @@
32#define PROM_ENTRY(x) (PROM_VEC + (x)) 34#define PROM_ENTRY(x) (PROM_VEC + (x))
33 35
34 36
35#define DEBUG
36#ifdef DEBUG
37#define DBG_PRINTF(x...) prom_printf(x)
38#else
39#define DBG_PRINTF(x...)
40#endif
41
42static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR); 37static int *(*__prom_putchar)(int) = (int *(*)(int))PROM_ENTRY(PROM_PUTCHAR);
38
39void prom_putchar(char c)
40{
41 __prom_putchar(c);
42}
43
43static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV); 44static char *(*__prom_getenv)(char *) = (char *(*)(char *))PROM_ENTRY(PROM_GETENV);
44static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF); 45static void (*__prom_get_memconf)(void *) = (void (*)(void *))PROM_ENTRY(PROM_GET_MEMCONF);
45 46
@@ -48,26 +49,6 @@ char *prom_getenv (char *s)
48 return __prom_getenv(s); 49 return __prom_getenv(s);
49} 50}
50 51
51void prom_printf(char *fmt, ...)
52{
53 va_list args;
54 char ppbuf[1024];
55 char *bptr;
56
57 va_start(args, fmt);
58 vsprintf(ppbuf, fmt, args);
59
60 bptr = ppbuf;
61
62 while (*bptr != 0) {
63 if (*bptr == '\n')
64 __prom_putchar('\r');
65
66 __prom_putchar(*bptr++);
67 }
68 va_end(args);
69}
70
71void __init prom_free_prom_memory(void) 52void __init prom_free_prom_memory(void)
72{ 53{
73} 54}
@@ -94,15 +75,15 @@ static void sni_idprom_dump(void)
94{ 75{
95 int i; 76 int i;
96 77
97 prom_printf("SNI IDProm dump:\n"); 78 pr_debug("SNI IDProm dump:\n");
98 for (i = 0; i < 256; i++) { 79 for (i = 0; i < 256; i++) {
99 if (i%16 == 0) 80 if (i%16 == 0)
100 prom_printf("%04x ", i); 81 pr_debug("%04x ", i);
101 82
102 prom_printf("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i)); 83 printk("%02x ", *(unsigned char *) (SNI_IDPROM_BASE + i));
103 84
104 if (i % 16 == 15) 85 if (i % 16 == 15)
105 prom_printf("\n"); 86 printk("\n");
106 } 87 }
107} 88}
108#endif 89#endif
@@ -121,12 +102,12 @@ static void sni_mem_init(void )
121 /* MemSIZE from prom in 16MByte chunks */ 102 /* MemSIZE from prom in 16MByte chunks */
122 memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16; 103 memsize = *((unsigned char *) SNI_IDPROM_MEMSIZE) * 16;
123 104
124 DBG_PRINTF("IDProm memsize: %lu MByte\n", memsize); 105 pr_debug("IDProm memsize: %lu MByte\n", memsize);
125 106
126 /* get memory bank layout from prom */ 107 /* get memory bank layout from prom */
127 __prom_get_memconf(&memconf); 108 __prom_get_memconf(&memconf);
128 109
129 DBG_PRINTF("prom_get_mem_conf memory configuration:\n"); 110 pr_debug("prom_get_mem_conf memory configuration:\n");
130 for (i = 0;i < 8 && memconf[i].size; i++) { 111 for (i = 0;i < 8 && memconf[i].size; i++) {
131 if (sni_brd_type == SNI_BRD_PCI_TOWER || 112 if (sni_brd_type == SNI_BRD_PCI_TOWER ||
132 sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) { 113 sni_brd_type == SNI_BRD_PCI_TOWER_CPLUS) {
@@ -135,7 +116,7 @@ static void sni_mem_init(void )
135 memconf[i].base -= 0x20000000; 116 memconf[i].base -= 0x20000000;
136 } 117 }
137 } 118 }
138 DBG_PRINTF("Bank%d: %08x @ %08x\n", i, 119 pr_debug("Bank%d: %08x @ %08x\n", i,
139 memconf[i].size, memconf[i].base); 120 memconf[i].size, memconf[i].base);
140 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM); 121 add_memory_region(memconf[i].base, memconf[i].size, BOOT_MEM_RAM);
141 } 122 }
@@ -248,7 +229,7 @@ void __init prom_init(void)
248 systype = "RM300-Exx"; 229 systype = "RM300-Exx";
249 break; 230 break;
250 } 231 }
251 DBG_PRINTF("Found SNI brdtype %02x name %s\n", sni_brd_type,systype); 232 pr_debug("Found SNI brdtype %02x name %s\n", sni_brd_type,systype);
252 233
253#ifdef DEBUG 234#ifdef DEBUG
254 sni_idprom_dump(); 235 sni_idprom_dump();