Skip to content

Commit 36a8853

Browse files
committed
[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>
1 parent ca471c8 commit 36a8853

42 files changed

Lines changed: 254 additions & 427 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎arch/mips/Kconfig‎

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ config MACH_DECSTATION
176176
bool "DECstations"
177177
select BOOT_ELF32
178178
select DMA_NONCOHERENT
179-
select EARLY_PRINTK
179+
select SYS_HAS_EARLY_PRINTK
180180
select IRQ_CPU
181181
select SYS_HAS_CPU_R3000
182182
select SYS_HAS_CPU_R4X00
@@ -242,6 +242,7 @@ config MACH_JAZZ
242242
config LASAT
243243
bool "LASAT Networks platforms"
244244
select DMA_NONCOHERENT
245+
select SYS_HAS_EARLY_PRINTK
245246
select HW_HAS_PCI
246247
select MIPS_GT64120
247248
select MIPS_NILE4
@@ -256,6 +257,7 @@ config MIPS_ATLAS
256257
bool "MIPS Atlas board"
257258
select BOOT_ELF32
258259
select DMA_NONCOHERENT
260+
select SYS_HAS_EARLY_PRINTK
259261
select IRQ_CPU
260262
select HW_HAS_PCI
261263
select MIPS_BOARDS_GEN
@@ -301,6 +303,7 @@ config MIPS_MALTA
301303
select SYS_HAS_CPU_MIPS64_R1
302304
select SYS_HAS_CPU_NEVADA
303305
select SYS_HAS_CPU_RM7000
306+
select SYS_HAS_EARLY_PRINTK
304307
select SYS_SUPPORTS_32BIT_KERNEL
305308
select SYS_SUPPORTS_64BIT_KERNEL
306309
select SYS_SUPPORTS_BIG_ENDIAN
@@ -316,6 +319,7 @@ config MIPS_SEAD
316319
depends on EXPERIMENTAL
317320
select IRQ_CPU
318321
select DMA_NONCOHERENT
322+
select SYS_HAS_EARLY_PRINTK
319323
select MIPS_BOARDS_GEN
320324
select SYS_HAS_CPU_MIPS32_R1
321325
select SYS_HAS_CPU_MIPS32_R2
@@ -353,9 +357,11 @@ config WR_PPMC
353357
config MIPS_SIM
354358
bool 'MIPS simulator (MIPSsim)'
355359
select DMA_NONCOHERENT
360+
select SYS_HAS_EARLY_PRINTK
356361
select IRQ_CPU
357362
select SYS_HAS_CPU_MIPS32_R1
358363
select SYS_HAS_CPU_MIPS32_R2
364+
select SYS_HAS_EARLY_PRINTK
359365
select SYS_SUPPORTS_32BIT_KERNEL
360366
select SYS_SUPPORTS_BIG_ENDIAN
361367
select SYS_SUPPORTS_LITTLE_ENDIAN
@@ -376,6 +382,7 @@ config MOMENCO_JAGUAR_ATX
376382
select RM7000_CPU_SCACHE
377383
select SWAP_IO_SPACE
378384
select SYS_HAS_CPU_RM9000
385+
select SYS_HAS_EARLY_PRINTK
379386
select SYS_SUPPORTS_32BIT_KERNEL
380387
select SYS_SUPPORTS_64BIT_KERNEL
381388
select SYS_SUPPORTS_BIG_ENDIAN
@@ -513,6 +520,7 @@ config PMC_YOSEMITE
513520
select IRQ_CPU_RM9K
514521
select SWAP_IO_SPACE
515522
select SYS_HAS_CPU_RM9000
523+
select SYS_HAS_EARLY_PRINTK
516524
select SYS_SUPPORTS_32BIT_KERNEL
517525
select SYS_SUPPORTS_64BIT_KERNEL
518526
select SYS_SUPPORTS_BIG_ENDIAN
@@ -573,6 +581,7 @@ config SGI_IP22
573581
select SWAP_IO_SPACE
574582
select SYS_HAS_CPU_R4X00
575583
select SYS_HAS_CPU_R5000
584+
select SYS_HAS_EARLY_PRINTK
576585
select SYS_SUPPORTS_32BIT_KERNEL
577586
select SYS_SUPPORTS_64BIT_KERNEL
578587
select SYS_SUPPORTS_BIG_ENDIAN
@@ -587,7 +596,7 @@ config SGI_IP27
587596
select ARC64
588597
select BOOT_ELF64
589598
select DMA_IP27
590-
select EARLY_PRINTK
599+
select SYS_HAS_EARLY_PRINTK
591600
select HW_HAS_PCI
592601
select NR_CPUS_DEFAULT_64
593602
select PCI_DOMAINS
@@ -749,6 +758,7 @@ config SNI_RM
749758
select SYS_HAS_CPU_R5000
750759
select SYS_HAS_CPU_R10000
751760
select R5000_CPU_SCACHE
761+
select SYS_HAS_EARLY_PRINTK
752762
select SYS_SUPPORTS_32BIT_KERNEL
753763
select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
754764
select SYS_SUPPORTS_BIG_ENDIAN
@@ -897,6 +907,20 @@ config DMA_NEED_PCI_MAP_STATE
897907
bool
898908

899909
config EARLY_PRINTK
910+
bool "Early printk" if EMBEDDED && DEBUG_KERNEL
911+
depends on SYS_HAS_EARLY_PRINTK
912+
default y
913+
help
914+
This option enables special console drivers which allow the kernel
915+
to print messages very early in the bootup process.
916+
917+
This is useful for kernel debugging when your machine crashes very
918+
early before the console code is initialized. For normal operation
919+
it is not recommended because it looks on some machines ugly and
920+
oesn't cooperate with an X server. You should normally N here,
921+
unless you want to debug such a crash.
922+
923+
config SYS_HAS_EARLY_PRINTK
900924
bool
901925

902926
config GENERIC_ISA_DMA
@@ -1033,6 +1057,7 @@ config SOC_PNX8550
10331057
select DMA_NONCOHERENT
10341058
select HW_HAS_PCI
10351059
select SYS_HAS_CPU_MIPS32_R1
1060+
select SYS_HAS_EARLY_PRINTK
10361061
select SYS_SUPPORTS_32BIT_KERNEL
10371062
select GENERIC_HARDIRQS_NO__DO_IRQ
10381063
select SYS_SUPPORTS_KGDB
@@ -1093,7 +1118,7 @@ config HAVE_STD_PC_SERIAL_PORT
10931118

10941119
config ARC_CONSOLE
10951120
bool "ARC console support"
1096-
depends on SGI_IP22 || SNI_RM
1121+
depends on SGI_IP22 || (SNI_RM && CPU_LITTLE_ENDIAN)
10971122

10981123
config ARC_MEMORY
10991124
bool

‎arch/mips/arc/console.c‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,3 @@ void prom_putchar(char c)
2929
ArcWrite(1, &it, 1, &cnt);
3030
bc_enable();
3131
}
32-
33-
char prom_getchar(void)
34-
{
35-
ULONG cnt;
36-
CHAR c;
37-
38-
bc_disable();
39-
ArcRead(0, &c, 1, &cnt);
40-
bc_enable();
41-
42-
return c;
43-
}
44-
45-
void prom_printf(char *fmt, ...)
46-
{
47-
va_list args;
48-
char ppbuf[1024];
49-
char *bptr;
50-
51-
va_start(args, fmt);
52-
vsprintf(ppbuf, fmt, args);
53-
54-
bptr = ppbuf;
55-
56-
while (*bptr != 0) {
57-
if (*bptr == '\n')
58-
prom_putchar('\r');
59-
60-
prom_putchar(*bptr++);
61-
}
62-
va_end(args);
63-
}

‎arch/mips/arc/init.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,15 @@ void __init prom_init(void)
2424
{
2525
PSYSTEM_PARAMETER_BLOCK pb = PROMBLOCK;
2626
romvec = ROMVECTOR;
27+
ULONG cnt;
28+
CHAR c;
29+
2730
prom_argc = fw_arg0;
2831
_prom_argv = (LONG *) fw_arg1;
2932
_prom_envp = (LONG *) fw_arg2;
3033

3134
if (pb->magic != 0x53435241) {
32-
prom_printf("Aieee, bad prom vector magic %08lx\n", pb->magic);
35+
printk(KERN_CRIT "Aieee, bad prom vector magic %08lx\n", pb->magic);
3336
while(1)
3437
;
3538
}
@@ -41,8 +44,8 @@ void __init prom_init(void)
4144
prom_meminit();
4245

4346
#ifdef DEBUG_PROM_INIT
44-
prom_printf("Press a key to reboot\n");
45-
prom_getchar();
47+
pr_info("Press a key to reboot\n");
48+
ArcRead(0, &c, 1, &cnt);
4649
ArcEnterInteractiveMode();
4750
#endif
4851
}

‎arch/mips/arc/memory.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ void __init prom_meminit(void)
118118
#ifdef DEBUG
119119
int i = 0;
120120

121-
prom_printf("ARCS MEMORY DESCRIPTOR dump:\n");
121+
printk("ARCS MEMORY DESCRIPTOR dump:\n");
122122
p = ArcGetMemoryDescriptor(PROM_NULL_MDESC);
123123
while(p) {
124-
prom_printf("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
125-
i, p, p->base, p->pages, mtypes(p->type));
124+
printk("[%d,%p]: base<%08lx> pages<%08lx> type<%s>\n",
125+
i, p, p->base, p->pages, mtypes(p->type));
126126
p = ArcGetMemoryDescriptor(p);
127127
i++;
128128
}

‎arch/mips/arc/tree.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ static char *iflags[] = {
9393
static void __init
9494
dump_component(pcomponent *p)
9595
{
96-
prom_printf("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
97-
p, classes[p->class], types[p->type],
98-
iflags[p->iflags], p->vers, p->rev);
99-
prom_printf("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
100-
p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
96+
printk("[%p]:class<%s>type<%s>flags<%s>ver<%d>rev<%d>",
97+
p, classes[p->class], types[p->type],
98+
iflags[p->iflags], p->vers, p->rev);
99+
printk("key<%08lx>\n\tamask<%08lx>cdsize<%d>ilen<%d>iname<%s>\n",
100+
p->key, p->amask, (int)p->cdsize, (int)p->ilen, p->iname);
101101
}
102102

103103
static void __init

‎arch/mips/cobalt/console.c‎

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,3 @@ static void putchar(int c)
1919

2020
COBALT_UART[UART_TX] = c;
2121
}
22-
23-
static void cons_write(struct console *c, const char *s, unsigned n)
24-
{
25-
while(n-- && *s)
26-
putchar(*s++);
27-
}
28-
29-
static struct console cons_info =
30-
{
31-
.name = "uart",
32-
.write = cons_write,
33-
.flags = CON_PRINTBUFFER | CON_BOOT,
34-
.index = -1,
35-
};
36-
37-
void __init cobalt_early_console(void)
38-
{
39-
register_console(&cons_info);
40-
41-
printk("Cobalt: early console registered\n");
42-
}
43-
44-
void __init disable_early_printk(void)
45-
{
46-
unregister_console(&cons_info);
47-
}

‎arch/mips/cobalt/setup.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,6 @@ void __init plat_mem_setup(void)
150150
#endif
151151

152152
if (cobalt_board_id > COBALT_BRD_ID_RAQ1) {
153-
#ifdef CONFIG_EARLY_PRINTK
154-
cobalt_early_console();
155-
#endif
156-
157153
#ifdef CONFIG_SERIAL_8250
158154
uart.line = 0;
159155
uart.type = PORT_UNKNOWN;

‎arch/mips/dec/prom/console.c‎

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,12 @@
1616

1717
#include <asm/dec/prom.h>
1818

19-
static void __init prom_console_write(struct console *con, const char *s,
20-
unsigned int c)
19+
void prom_putchar(char c)
2120
{
22-
static char sfmt[] __initdata = "%%%us";
23-
char fmt[13];
21+
char s[2];
2422

25-
snprintf(fmt, sizeof(fmt), sfmt, c);
26-
prom_printf(fmt, s);
27-
}
28-
29-
static struct console promcons __initdata = {
30-
.name = "prom",
31-
.write = prom_console_write,
32-
.flags = CON_PRINTBUFFER,
33-
.index = -1,
34-
};
35-
36-
static int promcons_output __initdata = 0;
37-
38-
void __init register_prom_console(void)
39-
{
40-
if (!promcons_output) {
41-
promcons_output = 1;
42-
register_console(&promcons);
43-
}
44-
}
23+
s[0] = c;
24+
s[1] = '\0';
4525

46-
void __init unregister_prom_console(void)
47-
{
48-
if (promcons_output) {
49-
unregister_console(&promcons);
50-
promcons_output = 0;
51-
}
26+
prom_printf( s);
5227
}
53-
54-
void disable_early_printk(void)
55-
__attribute__((alias("unregister_prom_console")));

‎arch/mips/gt64120/ev64120/promcon.c‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,6 @@ static void prom_console_write(struct console *co, const char *s,
2424
}
2525
}
2626

27-
int prom_getchar(void)
28-
{
29-
return 0;
30-
}
31-
3227
static struct console sercons = {
3328
.name = "ttyS",
3429
.write = prom_console_write,

‎arch/mips/kernel/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@ obj-$(CONFIG_64BIT) += cpu-bugs64.o
6565
obj-$(CONFIG_I8253) += i8253.o
6666

6767
obj-$(CONFIG_KEXEC) += machine_kexec.o relocate_kernel.o
68+
obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
6869

6970
CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)

0 commit comments

Comments
 (0)