aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/mips-boards/sim
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/sim
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/sim')
-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
4 files changed, 14 insertions, 44 deletions
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