diff options
author | Michael Ellerman <michael@ellerman.id.au> | 2006-10-03 00:12:08 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-04 00:52:22 -0400 |
commit | 476792839467c08ddeedd8b44a7423d415b68259 (patch) | |
tree | 43f273e48667c611bb3e28e9c6a359dec0d2c068 | |
parent | 23b8acb1cf49fea74a9d431de258787384951eac (diff) |
[POWERPC] Fix xmon=off and cleanup xmon initialisation
My patch to make the early xmon logic work with earlier early param
parsing (480f6f35a149802a94ad5c1a2673ed6ec8d2c158) breaks xmon=off.
No one does this obviously as xmon rocks, but it should really work
as documented.
While fixing that it struck me that we could move the xmon param
handling into xmon.c, and also consolidate the
xmon_init()/do_early_xmon logic into xmon_setup(). This means
xmon=early drops into xmon a little earlier on 32-bit, but it
seems to work just fine.
Tested on PSERIES and CLASSIC32.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | arch/powerpc/kernel/setup-common.c | 25 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_32.c | 8 | ||||
-rw-r--r-- | arch/powerpc/kernel/setup_64.c | 12 | ||||
-rw-r--r-- | arch/powerpc/xmon/xmon.c | 33 | ||||
-rw-r--r-- | include/asm-powerpc/xmon.h | 6 |
5 files changed, 44 insertions, 40 deletions
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c index 0af3fc1bdcc9..89cfaf49d3de 100644 --- a/arch/powerpc/kernel/setup-common.c +++ b/arch/powerpc/kernel/setup-common.c | |||
@@ -442,31 +442,6 @@ void __init smp_setup_cpu_maps(void) | |||
442 | } | 442 | } |
443 | #endif /* CONFIG_SMP */ | 443 | #endif /* CONFIG_SMP */ |
444 | 444 | ||
445 | int __initdata do_early_xmon; | ||
446 | #ifdef CONFIG_XMON | ||
447 | extern int xmon_no_auto_backtrace; | ||
448 | |||
449 | static int __init early_xmon(char *p) | ||
450 | { | ||
451 | /* ensure xmon is enabled */ | ||
452 | if (p) { | ||
453 | if (strncmp(p, "on", 2) == 0) | ||
454 | xmon_init(1); | ||
455 | if (strncmp(p, "off", 3) == 0) | ||
456 | xmon_init(0); | ||
457 | if (strncmp(p, "nobt", 4) == 0) | ||
458 | xmon_no_auto_backtrace = 1; | ||
459 | if (strncmp(p, "early", 5) != 0) | ||
460 | return 0; | ||
461 | } | ||
462 | xmon_init(1); | ||
463 | do_early_xmon = 1; | ||
464 | |||
465 | return 0; | ||
466 | } | ||
467 | early_param("xmon", early_xmon); | ||
468 | #endif | ||
469 | |||
470 | static __init int add_pcspkr(void) | 445 | static __init int add_pcspkr(void) |
471 | { | 446 | { |
472 | struct device_node *np; | 447 | struct device_node *np; |
diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c index 79a17795d17b..191d0ab09222 100644 --- a/arch/powerpc/kernel/setup_32.c +++ b/arch/powerpc/kernel/setup_32.c | |||
@@ -238,12 +238,11 @@ void __init setup_arch(char **cmdline_p) | |||
238 | 238 | ||
239 | smp_setup_cpu_maps(); | 239 | smp_setup_cpu_maps(); |
240 | 240 | ||
241 | #ifdef CONFIG_XMON_DEFAULT | ||
242 | xmon_init(1); | ||
243 | #endif | ||
244 | /* Register early console */ | 241 | /* Register early console */ |
245 | register_early_udbg_console(); | 242 | register_early_udbg_console(); |
246 | 243 | ||
244 | xmon_setup(); | ||
245 | |||
247 | #if defined(CONFIG_KGDB) | 246 | #if defined(CONFIG_KGDB) |
248 | if (ppc_md.kgdb_map_scc) | 247 | if (ppc_md.kgdb_map_scc) |
249 | ppc_md.kgdb_map_scc(); | 248 | ppc_md.kgdb_map_scc(); |
@@ -280,9 +279,6 @@ void __init setup_arch(char **cmdline_p) | |||
280 | init_mm.end_data = (unsigned long) _edata; | 279 | init_mm.end_data = (unsigned long) _edata; |
281 | init_mm.brk = klimit; | 280 | init_mm.brk = klimit; |
282 | 281 | ||
283 | if (do_early_xmon) | ||
284 | debugger(NULL); | ||
285 | |||
286 | /* set up the bootmem stuff with available memory */ | 282 | /* set up the bootmem stuff with available memory */ |
287 | do_init_bootmem(); | 283 | do_init_bootmem(); |
288 | if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab); | 284 | if ( ppc_md.progress ) ppc_md.progress("setup_arch: bootmem", 0x3eab); |
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index cda2dbe70a76..4b2e32eab9dc 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c | |||
@@ -391,18 +391,14 @@ void __init setup_system(void) | |||
391 | find_legacy_serial_ports(); | 391 | find_legacy_serial_ports(); |
392 | 392 | ||
393 | /* | 393 | /* |
394 | * Initialize xmon | ||
395 | */ | ||
396 | #ifdef CONFIG_XMON_DEFAULT | ||
397 | xmon_init(1); | ||
398 | #endif | ||
399 | /* | ||
400 | * Register early console | 394 | * Register early console |
401 | */ | 395 | */ |
402 | register_early_udbg_console(); | 396 | register_early_udbg_console(); |
403 | 397 | ||
404 | if (do_early_xmon) | 398 | /* |
405 | debugger(NULL); | 399 | * Initialize xmon |
400 | */ | ||
401 | xmon_setup(); | ||
406 | 402 | ||
407 | check_smt_enabled(); | 403 | check_smt_enabled(); |
408 | smp_setup_cpu_maps(); | 404 | smp_setup_cpu_maps(); |
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c index 8adad1444a51..b54ff980ecd4 100644 --- a/arch/powerpc/xmon/xmon.c +++ b/arch/powerpc/xmon/xmon.c | |||
@@ -2,6 +2,8 @@ | |||
2 | * Routines providing a simple monitor for use on the PowerMac. | 2 | * Routines providing a simple monitor for use on the PowerMac. |
3 | * | 3 | * |
4 | * Copyright (C) 1996-2005 Paul Mackerras. | 4 | * Copyright (C) 1996-2005 Paul Mackerras. |
5 | * Copyright (C) 2001 PPC64 Team, IBM Corp | ||
6 | * Copyrignt (C) 2006 Michael Ellerman, IBM Corp | ||
5 | * | 7 | * |
6 | * This program is free software; you can redistribute it and/or | 8 | * This program is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License | 9 | * modify it under the terms of the GNU General Public License |
@@ -2597,3 +2599,34 @@ static int __init setup_xmon_sysrq(void) | |||
2597 | } | 2599 | } |
2598 | __initcall(setup_xmon_sysrq); | 2600 | __initcall(setup_xmon_sysrq); |
2599 | #endif /* CONFIG_MAGIC_SYSRQ */ | 2601 | #endif /* CONFIG_MAGIC_SYSRQ */ |
2602 | |||
2603 | int __initdata xmon_early, xmon_off; | ||
2604 | |||
2605 | static int __init early_parse_xmon(char *p) | ||
2606 | { | ||
2607 | if (!p || strncmp(p, "early", 5) == 0) { | ||
2608 | /* just "xmon" is equivalent to "xmon=early" */ | ||
2609 | xmon_init(1); | ||
2610 | xmon_early = 1; | ||
2611 | } else if (strncmp(p, "on", 2) == 0) | ||
2612 | xmon_init(1); | ||
2613 | else if (strncmp(p, "off", 3) == 0) | ||
2614 | xmon_off = 1; | ||
2615 | else if (strncmp(p, "nobt", 4) == 0) | ||
2616 | xmon_no_auto_backtrace = 1; | ||
2617 | else | ||
2618 | return 1; | ||
2619 | |||
2620 | return 0; | ||
2621 | } | ||
2622 | early_param("xmon", early_parse_xmon); | ||
2623 | |||
2624 | void __init xmon_setup(void) | ||
2625 | { | ||
2626 | #ifdef CONFIG_XMON_DEFAULT | ||
2627 | if (!xmon_off) | ||
2628 | xmon_init(1); | ||
2629 | #endif | ||
2630 | if (xmon_early) | ||
2631 | debugger(NULL); | ||
2632 | } | ||
diff --git a/include/asm-powerpc/xmon.h b/include/asm-powerpc/xmon.h index c02dd0ce13ac..f1d337ed68d5 100644 --- a/include/asm-powerpc/xmon.h +++ b/include/asm-powerpc/xmon.h | |||
@@ -12,7 +12,11 @@ | |||
12 | 12 | ||
13 | #ifdef __KERNEL__ | 13 | #ifdef __KERNEL__ |
14 | 14 | ||
15 | extern void xmon_init(int); | 15 | #ifdef CONFIG_XMON |
16 | extern void xmon_setup(void); | ||
17 | #else | ||
18 | static inline void xmon_setup(void) { }; | ||
19 | #endif | ||
16 | 20 | ||
17 | #endif /* __KERNEL __ */ | 21 | #endif /* __KERNEL __ */ |
18 | #endif /* __ASM_POWERPC_XMON_H */ | 22 | #endif /* __ASM_POWERPC_XMON_H */ |