aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mips-boards
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/mips-boards
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/mips-boards')
-rw-r--r--arch/mips/mips-boards/generic/Makefile4
-rw-r--r--arch/mips/mips-boards/generic/console.c (renamed from arch/mips/mips-boards/generic/printf.c)12
-rw-r--r--arch/mips/mips-boards/generic/init.c9
-rw-r--r--arch/mips/mips-boards/generic/memory.c11
-rw-r--r--arch/mips/mips-boards/sim/Makefile6
-rw-r--r--arch/mips/mips-boards/sim/sim_console.c (renamed from arch/mips/mips-boards/sim/sim_printf.c)44
-rw-r--r--arch/mips/mips-boards/sim/sim_mem.c2
-rw-r--r--arch/mips/mips-boards/sim/sim_setup.c6
8 files changed, 29 insertions, 65 deletions
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile
index 0a30f5dc9b72..aade36d78787 100644
--- a/arch/mips/mips-boards/generic/Makefile
+++ b/arch/mips/mips-boards/generic/Makefile
@@ -18,7 +18,9 @@
18# Makefile for the MIPS boards generic routines under Linux. 18# Makefile for the MIPS boards generic routines under Linux.
19# 19#
20 20
21obj-y := reset.o display.o init.o memory.o printf.o \ 21obj-y := reset.o display.o init.o memory.o \
22 cmdline.o time.o 22 cmdline.o time.o
23
24obj-$(CONFIG_EARLY_PRINTK) += console.o
23obj-$(CONFIG_PCI) += pci.o 25obj-$(CONFIG_PCI) += pci.o
24obj-$(CONFIG_KGDB) += gdb_hook.o 26obj-$(CONFIG_KGDB) += gdb_hook.o
diff --git a/arch/mips/mips-boards/generic/printf.c b/arch/mips/mips-boards/generic/console.c
index 1a711bd79b51..4d8ab99e4155 100644
--- a/arch/mips/mips-boards/generic/printf.c
+++ b/arch/mips/mips-boards/generic/console.c
@@ -17,10 +17,9 @@
17 * 17 *
18 * Putting things on the screen/serial line using YAMONs facilities. 18 * Putting things on the screen/serial line using YAMONs facilities.
19 */ 19 */
20#include <linux/console.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <linux/spinlock.h>
24#include <asm/io.h> 23#include <asm/io.h>
25 24
26#ifdef CONFIG_MIPS_ATLAS 25#ifdef CONFIG_MIPS_ATLAS
@@ -67,12 +66,3 @@ int prom_putchar(char c)
67 66
68 return 1; 67 return 1;
69} 68}
70
71char prom_getchar(void)
72{
73 while (!(serial_in(UART_LSR) & UART_LSR_DR))
74 ;
75
76 return serial_in(UART_RX);
77}
78
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index 58a0fe883591..b11337600129 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -167,7 +167,7 @@ static void __init console_config(void)
167 flow = 'r'; 167 flow = 'r';
168 sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow); 168 sprintf (console_string, " console=ttyS0,%d%c%c%c", baud, parity, bits, flow);
169 strcat (prom_getcmdline(), console_string); 169 strcat (prom_getcmdline(), console_string);
170 prom_printf("Config serial console:%s\n", console_string); 170 pr_info("Config serial console:%s\n", console_string);
171 } 171 }
172} 172}
173#endif 173#endif
@@ -210,8 +210,9 @@ void __init kgdb_config (void)
210 generic_getDebugChar = rs_getDebugChar; 210 generic_getDebugChar = rs_getDebugChar;
211 } 211 }
212 212
213 prom_printf("KGDB: Using serial line /dev/ttyS%d at %d for session, " 213 pr_info("KGDB: Using serial line /dev/ttyS%d at %d for "
214 "please connect your debugger\n", line ? 1 : 0, speed); 214 "session, please connect your debugger\n",
215 line ? 1 : 0, speed);
215 216
216 { 217 {
217 char *s; 218 char *s;
@@ -382,7 +383,7 @@ void __init prom_init(void)
382 board_nmi_handler_setup = mips_nmi_setup; 383 board_nmi_handler_setup = mips_nmi_setup;
383 board_ejtag_handler_setup = mips_ejtag_setup; 384 board_ejtag_handler_setup = mips_ejtag_setup;
384 385
385 prom_printf("\nLINUX started...\n"); 386 pr_info("\nLINUX started...\n");
386 prom_init_cmdline(); 387 prom_init_cmdline();
387 prom_meminit(); 388 prom_meminit();
388#ifdef CONFIG_SERIAL_8250_CONSOLE 389#ifdef CONFIG_SERIAL_8250_CONSOLE
diff --git a/arch/mips/mips-boards/generic/memory.c b/arch/mips/mips-boards/generic/memory.c
index ebf0e16c5a0d..ae39953da2c4 100644
--- a/arch/mips/mips-boards/generic/memory.c
+++ b/arch/mips/mips-boards/generic/memory.c
@@ -59,11 +59,12 @@ struct prom_pmemblock * __init prom_getmdesc(void)
59 /* otherwise look in the environment */ 59 /* otherwise look in the environment */
60 memsize_str = prom_getenv("memsize"); 60 memsize_str = prom_getenv("memsize");
61 if (!memsize_str) { 61 if (!memsize_str) {
62 prom_printf("memsize not set in boot prom, set to default (32Mb)\n"); 62 printk(KERN_WARNING
63 "memsize not set in boot prom, set to default (32Mb)\n");
63 physical_memsize = 0x02000000; 64 physical_memsize = 0x02000000;
64 } else { 65 } else {
65#ifdef DEBUG 66#ifdef DEBUG
66 prom_printf("prom_memsize = %s\n", memsize_str); 67 pr_debug("prom_memsize = %s\n", memsize_str);
67#endif 68#endif
68 physical_memsize = simple_strtol(memsize_str, NULL, 0); 69 physical_memsize = simple_strtol(memsize_str, NULL, 0);
69 } 70 }
@@ -141,12 +142,12 @@ void __init prom_meminit(void)
141 struct prom_pmemblock *p; 142 struct prom_pmemblock *p;
142 143
143#ifdef DEBUG 144#ifdef DEBUG
144 prom_printf("YAMON MEMORY DESCRIPTOR dump:\n"); 145 pr_debug("YAMON MEMORY DESCRIPTOR dump:\n");
145 p = prom_getmdesc(); 146 p = prom_getmdesc();
146 while (p->size) { 147 while (p->size) {
147 int i = 0; 148 int i = 0;
148 prom_printf("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n", 149 pr_debug("[%d,%p]: base<%08lx> size<%08lx> type<%s>\n",
149 i, p, p->base, p->size, mtypes[p->type]); 150 i, p, p->base, p->size, mtypes[p->type]);
150 p++; 151 p++;
151 i++; 152 i++;
152 } 153 }
diff --git a/arch/mips/mips-boards/sim/Makefile b/arch/mips/mips-boards/sim/Makefile
index a12e32aafde0..6aeebc9122f2 100644
--- a/arch/mips/mips-boards/sim/Makefile
+++ b/arch/mips/mips-boards/sim/Makefile
@@ -1,5 +1,7 @@
1# 1#
2# Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved. 2# Copyright (C) 2005 MIPS Technologies, Inc. All rights reserved.
3# Copyright (C) 2007 MIPS Technologies, Inc.
4# written by Ralf Baechle (ralf@linux-mips.org)
3# 5#
4# This program is free software; you can distribute it and/or modify it 6# This program is free software; you can distribute it and/or modify it
5# under the terms of the GNU General Public License (Version 2) as 7# under the terms of the GNU General Public License (Version 2) as
@@ -15,5 +17,7 @@
15# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 17# 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
16# 18#
17 19
18obj-y := sim_setup.o sim_mem.o sim_time.o sim_printf.o sim_int.o sim_cmdline.o 20obj-y := sim_setup.o sim_mem.o sim_time.o sim_int.o sim_cmdline.o
21
22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
19obj-$(CONFIG_SMP) += sim_smp.o 23obj-$(CONFIG_SMP) += sim_smp.o
diff --git a/arch/mips/mips-boards/sim/sim_printf.c b/arch/mips/mips-boards/sim/sim_console.c
index 3ee5a0b501a6..de595a9ccb27 100644
--- a/arch/mips/mips-boards/sim/sim_printf.c
+++ b/arch/mips/mips-boards/sim/sim_console.c
@@ -1,7 +1,4 @@
1/* 1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * This program is free software; you can distribute it and/or modify it 2 * This program is free software; you can distribute it and/or modify it
6 * under the terms of the GNU General Public License (Version 2) as 3 * under the terms of the GNU General Public License (Version 2) as
7 * published by the Free Software Foundation. 4 * published by the Free Software Foundation.
@@ -15,14 +12,14 @@
15 * with this program; if not, write to the Free Software Foundation, Inc., 12 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 13 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
17 * 14 *
18 * Putting things on the screen/serial line using YAMONs facilities. 15 * Carsten Langgaard, carstenl@mips.com
16 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
17 * Copyright (C) 2007 MIPS Technologies, Inc.
18 * written by Ralf Baechle
19 */ 19 */
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/kernel.h>
22#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
23#include <linux/spinlock.h>
24#include <asm/io.h> 22#include <asm/io.h>
25#include <asm/system.h>
26 23
27static inline unsigned int serial_in(int offset) 24static inline unsigned int serial_in(int offset)
28{ 25{
@@ -34,41 +31,10 @@ static inline void serial_out(int offset, int value)
34 outb(value, 0x3f8 + offset); 31 outb(value, 0x3f8 + offset);
35} 32}
36 33
37int putPromChar(char c) 34void __init prom_putchar(char c)
38{ 35{
39 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0) 36 while ((serial_in(UART_LSR) & UART_LSR_THRE) == 0)
40 ; 37 ;
41 38
42 serial_out(UART_TX, c); 39 serial_out(UART_TX, c);
43
44 return 1;
45}
46
47char getPromChar(void)
48{
49 while (!(serial_in(UART_LSR) & 1))
50 ;
51
52 return serial_in(UART_RX);
53}
54
55void prom_printf(char *fmt, ...)
56{
57 va_list args;
58 int l;
59 char *p, *buf_end;
60 char buf[1024];
61
62 va_start(args, fmt);
63 l = vsprintf(buf, fmt, args); /* hopefully i < sizeof(buf) */
64 va_end(args);
65
66 buf_end = buf + l;
67
68 for (p = buf; p < buf_end; p++) {
69 /* Crude cr/nl handling is better than none */
70 if (*p == '\n')
71 putPromChar('\r');
72 putPromChar(*p);
73 }
74} 40}
diff --git a/arch/mips/mips-boards/sim/sim_mem.c b/arch/mips/mips-boards/sim/sim_mem.c
index 46bc16f8b15d..e408ef0bcd6e 100644
--- a/arch/mips/mips-boards/sim/sim_mem.c
+++ b/arch/mips/mips-boards/sim/sim_mem.c
@@ -46,7 +46,7 @@ struct prom_pmemblock * __init prom_getmdesc(void)
46 unsigned int memsize; 46 unsigned int memsize;
47 47
48 memsize = 0x02000000; 48 memsize = 0x02000000;
49 prom_printf("Setting default memory size 0x%08x\n", memsize); 49 pr_info("Setting default memory size 0x%08x\n", memsize);
50 50
51 memset(mdesc, 0, sizeof(mdesc)); 51 memset(mdesc, 0, sizeof(mdesc));
52 52
diff --git a/arch/mips/mips-boards/sim/sim_setup.c b/arch/mips/mips-boards/sim/sim_setup.c
index ea2066c3a1f7..b705f09e57c3 100644
--- a/arch/mips/mips-boards/sim/sim_setup.c
+++ b/arch/mips/mips-boards/sim/sim_setup.c
@@ -55,7 +55,7 @@ void __init plat_mem_setup(void)
55 serial_init(); 55 serial_init();
56 56
57 board_time_init = sim_time_init; 57 board_time_init = sim_time_init;
58 prom_printf("Linux started...\n"); 58 pr_info("Linux started...\n");
59 59
60#ifdef CONFIG_MIPS_MT_SMP 60#ifdef CONFIG_MIPS_MT_SMP
61 sanitize_tlb_entries(); 61 sanitize_tlb_entries();
@@ -66,7 +66,7 @@ void prom_init(void)
66{ 66{
67 set_io_port_base(0xbfd00000); 67 set_io_port_base(0xbfd00000);
68 68
69 prom_printf("\nLINUX started...\n"); 69 pr_info("\nLINUX started...\n");
70 prom_init_cmdline(); 70 prom_init_cmdline();
71 prom_meminit(); 71 prom_meminit();
72} 72}
@@ -91,7 +91,7 @@ static void __init serial_init(void)
91 s.timeout = 4; 91 s.timeout = 4;
92 92
93 if (early_serial_setup(&s) != 0) { 93 if (early_serial_setup(&s) != 0) {
94 prom_printf(KERN_ERR "Serial setup failed!\n"); 94 printk(KERN_ERR "Serial setup failed!\n");
95 } 95 }
96 96
97#endif 97#endif