diff options
author | Finn Thain <fthain@telegraphics.com.au> | 2011-10-23 10:11:12 -0400 |
---|---|---|
committer | Geert Uytterhoeven <geert@linux-m68k.org> | 2011-12-10 13:52:45 -0500 |
commit | 93edd023a7de1ea4fe6e5de631982b96156eef03 (patch) | |
tree | 9ded40176536ef7ab552adef368592dc648d4c8d /arch/m68k | |
parent | f9994894953d6bd9d5ed2719a34d027a4e0c2131 (diff) |
m68k/mac: early console
Revive the old mac_serial_print() routine as mac_early_print(). mac_serial_print() did not function because it did not use the right offsets for its stack arguments. Fix this and make compilation conditional on CONFIG_EARLY_PRINTK instead of the obscure MAC_SERIAL_DEBUG macro.
Give mac_early_print() a new string length parameter to fit the early console API.
Send output to the framebuffer as well as serial ports.
Change the line rate to 38400 baud to match the default for the real (pmac_zilog) serial console.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k')
-rw-r--r-- | arch/m68k/Kconfig.debug | 2 | ||||
-rw-r--r-- | arch/m68k/kernel/head.S | 117 | ||||
-rw-r--r-- | arch/m68k/mac/config.c | 29 |
3 files changed, 89 insertions, 59 deletions
diff --git a/arch/m68k/Kconfig.debug b/arch/m68k/Kconfig.debug index 8702dc65f7f2..a0c8863bd08b 100644 --- a/arch/m68k/Kconfig.debug +++ b/arch/m68k/Kconfig.debug | |||
@@ -4,7 +4,7 @@ source "lib/Kconfig.debug" | |||
4 | 4 | ||
5 | config EARLY_PRINTK | 5 | config EARLY_PRINTK |
6 | bool "Early printk" if EMBEDDED | 6 | bool "Early printk" if EMBEDDED |
7 | depends on MVME16x | 7 | depends on MVME16x || MAC |
8 | default y | 8 | default y |
9 | help | 9 | help |
10 | Write kernel log output directly to a serial port. | 10 | Write kernel log output directly to a serial port. |
diff --git a/arch/m68k/kernel/head.S b/arch/m68k/kernel/head.S index 27622b3273c1..d197e7ff62c5 100644 --- a/arch/m68k/kernel/head.S +++ b/arch/m68k/kernel/head.S | |||
@@ -250,9 +250,8 @@ | |||
250 | * USE_MFP: Use the ST-MFP port (Modem1) for serial debug. | 250 | * USE_MFP: Use the ST-MFP port (Modem1) for serial debug. |
251 | * | 251 | * |
252 | * Macintosh constants: | 252 | * Macintosh constants: |
253 | * MAC_SERIAL_DEBUG: Turns on serial debug output for the Macintosh. | 253 | * MAC_USE_SCC_A: Use SCC port A (modem) for serial debug and early console. |
254 | * MAC_USE_SCC_A: Use the SCC port A (modem) for serial debug. | 254 | * MAC_USE_SCC_B: Use SCC port B (printer) for serial debug and early console. |
255 | * MAC_USE_SCC_B: Use the SCC port B (printer) for serial debug (default). | ||
256 | */ | 255 | */ |
257 | 256 | ||
258 | #include <linux/linkage.h> | 257 | #include <linux/linkage.h> |
@@ -268,33 +267,25 @@ | |||
268 | 267 | ||
269 | #include <asm/machw.h> | 268 | #include <asm/machw.h> |
270 | 269 | ||
271 | /* | ||
272 | * Macintosh console support | ||
273 | */ | ||
274 | |||
275 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE | 270 | #ifdef CONFIG_FRAMEBUFFER_CONSOLE |
276 | #define CONSOLE | 271 | #define CONSOLE |
277 | #define CONSOLE_PENGUIN | 272 | #define CONSOLE_PENGUIN |
278 | #endif | 273 | #endif |
279 | 274 | ||
280 | /* | 275 | #ifdef CONFIG_EARLY_PRINTK |
281 | * Macintosh serial debug support; outputs boot info to the printer | 276 | #define SERIAL_DEBUG |
282 | * and/or modem serial ports | 277 | #else |
283 | */ | 278 | #undef SERIAL_DEBUG |
284 | #undef MAC_SERIAL_DEBUG | 279 | #endif |
285 | 280 | ||
286 | /* | 281 | #else /* !CONFIG_MAC */ |
287 | * Macintosh serial debug port selection; define one or both; | ||
288 | * requires MAC_SERIAL_DEBUG to be defined | ||
289 | */ | ||
290 | #define MAC_USE_SCC_A /* Macintosh modem serial port */ | ||
291 | #define MAC_USE_SCC_B /* Macintosh printer serial port */ | ||
292 | 282 | ||
293 | #endif /* CONFIG_MAC */ | 283 | #define SERIAL_DEBUG |
284 | |||
285 | #endif /* !CONFIG_MAC */ | ||
294 | 286 | ||
295 | #undef MMU_PRINT | 287 | #undef MMU_PRINT |
296 | #undef MMU_NOCACHE_KERNEL | 288 | #undef MMU_NOCACHE_KERNEL |
297 | #define SERIAL_DEBUG | ||
298 | #undef DEBUG | 289 | #undef DEBUG |
299 | 290 | ||
300 | /* | 291 | /* |
@@ -655,11 +646,11 @@ ENTRY(__start) | |||
655 | lea %pc@(L(mac_rowbytes)),%a1 | 646 | lea %pc@(L(mac_rowbytes)),%a1 |
656 | movel %a0@,%a1@ | 647 | movel %a0@,%a1@ |
657 | 648 | ||
658 | #ifdef MAC_SERIAL_DEBUG | 649 | #ifdef SERIAL_DEBUG |
659 | get_bi_record BI_MAC_SCCBASE | 650 | get_bi_record BI_MAC_SCCBASE |
660 | lea %pc@(L(mac_sccbase)),%a1 | 651 | lea %pc@(L(mac_sccbase)),%a1 |
661 | movel %a0@,%a1@ | 652 | movel %a0@,%a1@ |
662 | #endif /* MAC_SERIAL_DEBUG */ | 653 | #endif |
663 | 654 | ||
664 | #if 0 | 655 | #if 0 |
665 | /* | 656 | /* |
@@ -1427,7 +1418,7 @@ L(mmu_fixup_done): | |||
1427 | subl %d0,L(console_font) | 1418 | subl %d0,L(console_font) |
1428 | subl %d0,L(console_font_data) | 1419 | subl %d0,L(console_font_data) |
1429 | #endif | 1420 | #endif |
1430 | #ifdef MAC_SERIAL_DEBUG | 1421 | #ifdef SERIAL_DEBUG |
1431 | orl #0x50000000,L(mac_sccbase) | 1422 | orl #0x50000000,L(mac_sccbase) |
1432 | #endif | 1423 | #endif |
1433 | 1: | 1424 | 1: |
@@ -1917,7 +1908,7 @@ mmu_030_print: | |||
1917 | jbne 30b | 1908 | jbne 30b |
1918 | 1909 | ||
1919 | mmu_print_done: | 1910 | mmu_print_done: |
1920 | puts "\n\n" | 1911 | puts "\n" |
1921 | 1912 | ||
1922 | func_return mmu_print | 1913 | func_return mmu_print |
1923 | 1914 | ||
@@ -2768,7 +2759,7 @@ L(scc_initable_mac): | |||
2768 | .byte 9,0 /* no interrupts */ | 2759 | .byte 9,0 /* no interrupts */ |
2769 | .byte 10,0 /* NRZ */ | 2760 | .byte 10,0 /* NRZ */ |
2770 | .byte 11,0x50 /* use baud rate generator */ | 2761 | .byte 11,0x50 /* use baud rate generator */ |
2771 | .byte 12,10,13,0 /* 9600 baud */ | 2762 | .byte 12,1,13,0 /* 38400 baud */ |
2772 | .byte 14,1 /* Baud rate generator enable */ | 2763 | .byte 14,1 /* Baud rate generator enable */ |
2773 | .byte 3,0xc1 /* enable receiver */ | 2764 | .byte 3,0xc1 /* enable receiver */ |
2774 | .byte 5,0xea /* enable transmitter */ | 2765 | .byte 5,0xea /* enable transmitter */ |
@@ -2906,10 +2897,12 @@ func_start serial_init,%d0/%d1/%a0/%a1 | |||
2906 | #endif | 2897 | #endif |
2907 | #ifdef CONFIG_MAC | 2898 | #ifdef CONFIG_MAC |
2908 | is_not_mac(L(serial_init_not_mac)) | 2899 | is_not_mac(L(serial_init_not_mac)) |
2909 | #ifdef MAC_SERIAL_DEBUG | 2900 | |
2910 | #if !defined(MAC_USE_SCC_A) && !defined(MAC_USE_SCC_B) | 2901 | #ifdef SERIAL_DEBUG |
2911 | #define MAC_USE_SCC_B | 2902 | /* You may define either or both of these. */ |
2912 | #endif | 2903 | #define MAC_USE_SCC_A /* Modem port */ |
2904 | #define MAC_USE_SCC_B /* Printer port */ | ||
2905 | |||
2913 | #define mac_scc_cha_b_ctrl_offset 0x0 | 2906 | #define mac_scc_cha_b_ctrl_offset 0x0 |
2914 | #define mac_scc_cha_a_ctrl_offset 0x2 | 2907 | #define mac_scc_cha_a_ctrl_offset 0x2 |
2915 | #define mac_scc_cha_b_data_offset 0x4 | 2908 | #define mac_scc_cha_b_data_offset 0x4 |
@@ -2940,7 +2933,7 @@ func_start serial_init,%d0/%d1/%a0/%a1 | |||
2940 | jra 7b | 2933 | jra 7b |
2941 | 8: | 2934 | 8: |
2942 | #endif /* MAC_USE_SCC_B */ | 2935 | #endif /* MAC_USE_SCC_B */ |
2943 | #endif /* MAC_SERIAL_DEBUG */ | 2936 | #endif /* SERIAL_DEBUG */ |
2944 | 2937 | ||
2945 | jra L(serial_init_done) | 2938 | jra L(serial_init_done) |
2946 | L(serial_init_not_mac): | 2939 | L(serial_init_not_mac): |
@@ -3011,7 +3004,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1 | |||
3011 | #ifdef CONFIG_MAC | 3004 | #ifdef CONFIG_MAC |
3012 | is_not_mac(5f) | 3005 | is_not_mac(5f) |
3013 | 3006 | ||
3014 | #ifdef MAC_SERIAL_DEBUG | 3007 | #ifdef SERIAL_DEBUG |
3015 | 3008 | ||
3016 | #ifdef MAC_USE_SCC_A | 3009 | #ifdef MAC_USE_SCC_A |
3017 | movel %pc@(L(mac_sccbase)),%a1 | 3010 | movel %pc@(L(mac_sccbase)),%a1 |
@@ -3029,7 +3022,7 @@ func_start serial_putc,%d0/%d1/%a0/%a1 | |||
3029 | moveb %d0,%a1@(mac_scc_cha_b_data_offset) | 3022 | moveb %d0,%a1@(mac_scc_cha_b_data_offset) |
3030 | #endif /* MAC_USE_SCC_B */ | 3023 | #endif /* MAC_USE_SCC_B */ |
3031 | 3024 | ||
3032 | #endif /* MAC_SERIAL_DEBUG */ | 3025 | #endif /* SERIAL_DEBUG */ |
3033 | 3026 | ||
3034 | jra L(serial_putc_done) | 3027 | jra L(serial_putc_done) |
3035 | 5: | 3028 | 5: |
@@ -3248,33 +3241,39 @@ func_return putn | |||
3248 | 3241 | ||
3249 | #ifdef CONFIG_MAC | 3242 | #ifdef CONFIG_MAC |
3250 | /* | 3243 | /* |
3251 | * mac_serial_print | 3244 | * mac_early_print |
3252 | * | 3245 | * |
3253 | * This routine takes its parameters on the stack. It then | 3246 | * This routine takes its parameters on the stack. It then |
3254 | * turns around and calls the internal routine. This routine | 3247 | * turns around and calls the internal routines. This routine |
3255 | * is used until the Linux console driver initializes itself. | 3248 | * is used by the boot console. |
3256 | * | 3249 | * |
3257 | * The calling parameters are: | 3250 | * The calling parameters are: |
3258 | * void mac_serial_print(const char *str); | 3251 | * void mac_early_print(const char *str, unsigned length); |
3259 | * | 3252 | * |
3260 | * This routine does NOT understand variable arguments only | 3253 | * This routine does NOT understand variable arguments only |
3261 | * simple strings! | 3254 | * simple strings! |
3262 | */ | 3255 | */ |
3263 | ENTRY(mac_serial_print) | 3256 | ENTRY(mac_early_print) |
3264 | moveml %d0/%a0,%sp@- | 3257 | moveml %d0/%d1/%a0,%sp@- |
3265 | #if 1 | 3258 | movew %sr,%sp@- |
3266 | move %sr,%sp@- | ||
3267 | ori #0x0700,%sr | 3259 | ori #0x0700,%sr |
3268 | #endif | 3260 | movel %sp@(18),%a0 /* fetch parameter */ |
3269 | movel %sp@(10),%a0 /* fetch parameter */ | 3261 | movel %sp@(22),%d1 /* fetch parameter */ |
3270 | jra 2f | 3262 | jra 2f |
3271 | 1: serial_putc %d0 | 3263 | 1: |
3272 | 2: moveb %a0@+,%d0 | 3264 | #ifdef CONSOLE |
3273 | jne 1b | 3265 | console_putc %d0 |
3274 | #if 1 | ||
3275 | move %sp@+,%sr | ||
3276 | #endif | 3266 | #endif |
3277 | moveml %sp@+,%d0/%a0 | 3267 | #ifdef SERIAL_DEBUG |
3268 | serial_putc %d0 | ||
3269 | #endif | ||
3270 | subq #1,%d1 | ||
3271 | 2: jeq 3f | ||
3272 | moveb %a0@+,%d0 | ||
3273 | jne 1b | ||
3274 | 3: | ||
3275 | movew %sp@+,%sr | ||
3276 | moveml %sp@+,%d0/%d1/%a0 | ||
3278 | rts | 3277 | rts |
3279 | #endif /* CONFIG_MAC */ | 3278 | #endif /* CONFIG_MAC */ |
3280 | 3279 | ||
@@ -3409,10 +3408,10 @@ func_start console_put_stats,%a0/%d7 | |||
3409 | * a0 = pointer to boot_info | 3408 | * a0 = pointer to boot_info |
3410 | * d7 = value of boot_info fields | 3409 | * d7 = value of boot_info fields |
3411 | */ | 3410 | */ |
3412 | puts "\nMacLinux\n\n" | 3411 | puts "\nMacLinux\n" |
3413 | 3412 | ||
3414 | #ifdef SERIAL_DEBUG | 3413 | #ifdef SERIAL_DEBUG |
3415 | puts " vidaddr:" | 3414 | puts "\n vidaddr:" |
3416 | putn %pc@(L(mac_videobase)) /* video addr. */ | 3415 | putn %pc@(L(mac_videobase)) /* video addr. */ |
3417 | 3416 | ||
3418 | puts "\n _stext:" | 3417 | puts "\n _stext:" |
@@ -3423,19 +3422,21 @@ func_start console_put_stats,%a0/%d7 | |||
3423 | lea %pc@(_end),%a0 | 3422 | lea %pc@(_end),%a0 |
3424 | putn %a0 | 3423 | putn %a0 |
3425 | 3424 | ||
3426 | puts "\ncpuid:" | 3425 | puts "\n cpuid:" |
3427 | putn %pc@(L(cputype)) | 3426 | putn %pc@(L(cputype)) |
3428 | putc '\n' | ||
3429 | 3427 | ||
3430 | #ifdef MAC_SERIAL_DEBUG | 3428 | # ifdef CONFIG_MAC |
3429 | puts "\n sccbase:" | ||
3431 | putn %pc@(L(mac_sccbase)) | 3430 | putn %pc@(L(mac_sccbase)) |
3431 | # endif | ||
3432 | # ifdef MMU_PRINT | ||
3432 | putc '\n' | 3433 | putc '\n' |
3433 | #endif | ||
3434 | # if defined(MMU_PRINT) | ||
3435 | jbsr mmu_print_machine_cpu_types | 3434 | jbsr mmu_print_machine_cpu_types |
3436 | # endif /* MMU_PRINT */ | 3435 | # endif |
3437 | #endif /* SERIAL_DEBUG */ | 3436 | #endif /* SERIAL_DEBUG */ |
3438 | 3437 | ||
3438 | putc '\n' | ||
3439 | |||
3439 | func_return console_put_stats | 3440 | func_return console_put_stats |
3440 | 3441 | ||
3441 | #ifdef CONSOLE_PENGUIN | 3442 | #ifdef CONSOLE_PENGUIN |
@@ -3896,11 +3897,11 @@ L(mac_dimensions): | |||
3896 | .long 0 | 3897 | .long 0 |
3897 | L(mac_rowbytes): | 3898 | L(mac_rowbytes): |
3898 | .long 0 | 3899 | .long 0 |
3899 | #ifdef MAC_SERIAL_DEBUG | 3900 | #ifdef SERIAL_DEBUG |
3900 | L(mac_sccbase): | 3901 | L(mac_sccbase): |
3901 | .long 0 | 3902 | .long 0 |
3902 | #endif /* MAC_SERIAL_DEBUG */ | ||
3903 | #endif | 3903 | #endif |
3904 | #endif /* CONFIG_MAC */ | ||
3904 | 3905 | ||
3905 | #if defined (CONFIG_APOLLO) | 3906 | #if defined (CONFIG_APOLLO) |
3906 | LSRB0 = 0x10412 | 3907 | LSRB0 = 0x10412 |
diff --git a/arch/m68k/mac/config.c b/arch/m68k/mac/config.c index c247de02bc7e..55db101dd36d 100644 --- a/arch/m68k/mac/config.c +++ b/arch/m68k/mac/config.c | |||
@@ -71,6 +71,31 @@ static void mac_get_model(char *str); | |||
71 | static void mac_identify(void); | 71 | static void mac_identify(void); |
72 | static void mac_report_hardware(void); | 72 | static void mac_report_hardware(void); |
73 | 73 | ||
74 | #ifdef CONFIG_EARLY_PRINTK | ||
75 | asmlinkage void __init mac_early_print(const char *s, unsigned n); | ||
76 | |||
77 | static void __init mac_early_cons_write(struct console *con, | ||
78 | const char *s, unsigned n) | ||
79 | { | ||
80 | mac_early_print(s, n); | ||
81 | } | ||
82 | |||
83 | static struct console __initdata mac_early_cons = { | ||
84 | .name = "early", | ||
85 | .write = mac_early_cons_write, | ||
86 | .flags = CON_PRINTBUFFER | CON_BOOT, | ||
87 | .index = -1 | ||
88 | }; | ||
89 | |||
90 | int __init mac_unregister_early_cons(void) | ||
91 | { | ||
92 | /* mac_early_print can't be used after init sections are discarded */ | ||
93 | return unregister_console(&mac_early_cons); | ||
94 | } | ||
95 | |||
96 | late_initcall(mac_unregister_early_cons); | ||
97 | #endif | ||
98 | |||
74 | static void __init mac_sched_init(irq_handler_t vector) | 99 | static void __init mac_sched_init(irq_handler_t vector) |
75 | { | 100 | { |
76 | via_init_clock(vector); | 101 | via_init_clock(vector); |
@@ -164,6 +189,10 @@ void __init config_mac(void) | |||
164 | mach_beep = mac_mksound; | 189 | mach_beep = mac_mksound; |
165 | #endif | 190 | #endif |
166 | 191 | ||
192 | #ifdef CONFIG_EARLY_PRINTK | ||
193 | register_console(&mac_early_cons); | ||
194 | #endif | ||
195 | |||
167 | /* | 196 | /* |
168 | * Determine hardware present | 197 | * Determine hardware present |
169 | */ | 198 | */ |