diff options
| author | Michael Ellerman <michael@ellerman.id.au> | 2006-06-23 04:20:16 -0400 |
|---|---|---|
| committer | Paul Mackerras <paulus@samba.org> | 2006-06-27 21:59:48 -0400 |
| commit | cc46bb98c0d52695f26c239de701050660f5c79f (patch) | |
| tree | 1b40e9db66de5c41c0b2fdf1db022f645a46a697 | |
| parent | 458148c00b97864a27ecf528a1d45a8e5ebd9bbc (diff) | |
[POWERPC] Add udbg support for RTAS console
Add udbg hooks for the RTAS console, based on the RTAS put-term-char
and get-term-char calls. Along with my previous patches, this should
enable debugging as soon as early_init_dt_scan_rtas() is called.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Paul Mackerras <paulus@samba.org>
| -rw-r--r-- | arch/powerpc/Kconfig | 4 | ||||
| -rw-r--r-- | arch/powerpc/Kconfig.debug | 9 | ||||
| -rw-r--r-- | arch/powerpc/kernel/rtas.c | 72 | ||||
| -rw-r--r-- | arch/powerpc/kernel/udbg.c | 7 | ||||
| -rw-r--r-- | include/asm-powerpc/udbg.h | 3 |
5 files changed, 90 insertions, 5 deletions
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index c5e01c4b637d..deea4c8e1f4e 100644 --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig | |||
| @@ -420,6 +420,10 @@ config PPC_IBM_CELL_BLADE | |||
| 420 | select MMIO_NVRAM | 420 | select MMIO_NVRAM |
| 421 | select PPC_UDBG_16550 | 421 | select PPC_UDBG_16550 |
| 422 | 422 | ||
| 423 | config UDBG_RTAS_CONSOLE | ||
| 424 | bool | ||
| 425 | default n | ||
| 426 | |||
| 423 | config XICS | 427 | config XICS |
| 424 | depends on PPC_PSERIES | 428 | depends on PPC_PSERIES |
| 425 | bool | 429 | bool |
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index c69006ae8246..e29ef77d3b00 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
| @@ -134,12 +134,19 @@ config PPC_EARLY_DEBUG_G5 | |||
| 134 | help | 134 | help |
| 135 | Select this to enable early debugging for Apple G5 machines. | 135 | Select this to enable early debugging for Apple G5 machines. |
| 136 | 136 | ||
| 137 | config PPC_EARLY_DEBUG_RTAS | 137 | config PPC_EARLY_DEBUG_RTAS_PANEL |
| 138 | bool "RTAS Panel" | 138 | bool "RTAS Panel" |
| 139 | depends on PPC_RTAS | 139 | depends on PPC_RTAS |
| 140 | help | 140 | help |
| 141 | Select this to enable early debugging via the RTAS panel. | 141 | Select this to enable early debugging via the RTAS panel. |
| 142 | 142 | ||
| 143 | config PPC_EARLY_DEBUG_RTAS_CONSOLE | ||
| 144 | bool "RTAS Console" | ||
| 145 | depends on PPC_RTAS | ||
| 146 | select UDBG_RTAS_CONSOLE | ||
| 147 | help | ||
| 148 | Select this to enable early debugging via the RTAS console. | ||
| 149 | |||
| 143 | config PPC_EARLY_DEBUG_MAPLE | 150 | config PPC_EARLY_DEBUG_MAPLE |
| 144 | bool "Maple real mode" | 151 | bool "Maple real mode" |
| 145 | depends on PPC_MAPLE | 152 | depends on PPC_MAPLE |
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c index 061d8afd246e..4a4cb5598402 100644 --- a/arch/powerpc/kernel/rtas.c +++ b/arch/powerpc/kernel/rtas.c | |||
| @@ -109,11 +109,71 @@ static void call_rtas_display_status_delay(char c) | |||
| 109 | } | 109 | } |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | void __init udbg_init_rtas(void) | 112 | void __init udbg_init_rtas_panel(void) |
| 113 | { | 113 | { |
| 114 | udbg_putc = call_rtas_display_status_delay; | 114 | udbg_putc = call_rtas_display_status_delay; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | #ifdef CONFIG_UDBG_RTAS_CONSOLE | ||
| 118 | |||
| 119 | /* If you think you're dying before early_init_dt_scan_rtas() does its | ||
| 120 | * work, you can hard code the token values for your firmware here and | ||
| 121 | * hardcode rtas.base/entry etc. | ||
| 122 | */ | ||
| 123 | static unsigned int rtas_putchar_token = RTAS_UNKNOWN_SERVICE; | ||
| 124 | static unsigned int rtas_getchar_token = RTAS_UNKNOWN_SERVICE; | ||
| 125 | |||
| 126 | static void udbg_rtascon_putc(char c) | ||
| 127 | { | ||
| 128 | int tries; | ||
| 129 | |||
| 130 | if (!rtas.base) | ||
| 131 | return; | ||
| 132 | |||
| 133 | /* Add CRs before LFs */ | ||
| 134 | if (c == '\n') | ||
| 135 | udbg_rtascon_putc('\r'); | ||
| 136 | |||
| 137 | /* if there is more than one character to be displayed, wait a bit */ | ||
| 138 | for (tries = 0; tries < 16; tries++) { | ||
| 139 | if (rtas_call(rtas_putchar_token, 1, 1, NULL, c) == 0) | ||
| 140 | break; | ||
| 141 | udelay(1000); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | static int udbg_rtascon_getc_poll(void) | ||
| 146 | { | ||
| 147 | int c; | ||
| 148 | |||
| 149 | if (!rtas.base) | ||
| 150 | return -1; | ||
| 151 | |||
| 152 | if (rtas_call(rtas_getchar_token, 0, 2, &c)) | ||
| 153 | return -1; | ||
| 154 | |||
| 155 | return c; | ||
| 156 | } | ||
| 157 | |||
| 158 | static int udbg_rtascon_getc(void) | ||
| 159 | { | ||
| 160 | int c; | ||
| 161 | |||
| 162 | while ((c = udbg_rtascon_getc_poll()) == -1) | ||
| 163 | ; | ||
| 164 | |||
| 165 | return c; | ||
| 166 | } | ||
| 167 | |||
| 168 | |||
| 169 | void __init udbg_init_rtas_console(void) | ||
| 170 | { | ||
| 171 | udbg_putc = udbg_rtascon_putc; | ||
| 172 | udbg_getc = udbg_rtascon_getc; | ||
| 173 | udbg_getc_poll = udbg_rtascon_getc_poll; | ||
| 174 | } | ||
| 175 | #endif /* CONFIG_UDBG_RTAS_CONSOLE */ | ||
| 176 | |||
| 117 | void rtas_progress(char *s, unsigned short hex) | 177 | void rtas_progress(char *s, unsigned short hex) |
| 118 | { | 178 | { |
| 119 | struct device_node *root; | 179 | struct device_node *root; |
| @@ -820,6 +880,16 @@ int __init early_init_dt_scan_rtas(unsigned long node, | |||
| 820 | rtas.size = *sizep; | 880 | rtas.size = *sizep; |
| 821 | } | 881 | } |
| 822 | 882 | ||
| 883 | #ifdef CONFIG_UDBG_RTAS_CONSOLE | ||
| 884 | basep = of_get_flat_dt_prop(node, "put-term-char", NULL); | ||
| 885 | if (basep) | ||
| 886 | rtas_putchar_token = *basep; | ||
| 887 | |||
| 888 | basep = of_get_flat_dt_prop(node, "get-term-char", NULL); | ||
| 889 | if (basep) | ||
| 890 | rtas_getchar_token = *basep; | ||
| 891 | #endif | ||
| 892 | |||
| 823 | /* break now */ | 893 | /* break now */ |
| 824 | return 1; | 894 | return 1; |
| 825 | } | 895 | } |
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c index 67d9fd9ae2b5..759afd5e0d8a 100644 --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c | |||
| @@ -34,9 +34,12 @@ void __init udbg_early_init(void) | |||
| 34 | #elif defined(CONFIG_PPC_EARLY_DEBUG_G5) | 34 | #elif defined(CONFIG_PPC_EARLY_DEBUG_G5) |
| 35 | /* For use on Apple G5 machines */ | 35 | /* For use on Apple G5 machines */ |
| 36 | udbg_init_pmac_realmode(); | 36 | udbg_init_pmac_realmode(); |
| 37 | #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS) | 37 | #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL) |
| 38 | /* RTAS panel debug */ | 38 | /* RTAS panel debug */ |
| 39 | udbg_init_rtas(); | 39 | udbg_init_rtas_panel(); |
| 40 | #elif defined(CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE) | ||
| 41 | /* RTAS console debug */ | ||
| 42 | udbg_init_rtas_console(); | ||
| 40 | #elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) | 43 | #elif defined(CONFIG_PPC_EARLY_DEBUG_MAPLE) |
| 41 | /* Maple real mode debug */ | 44 | /* Maple real mode debug */ |
| 42 | udbg_init_maple_realmode(); | 45 | udbg_init_maple_realmode(); |
diff --git a/include/asm-powerpc/udbg.h b/include/asm-powerpc/udbg.h index 19a1517ac43b..55e57844fa78 100644 --- a/include/asm-powerpc/udbg.h +++ b/include/asm-powerpc/udbg.h | |||
| @@ -42,7 +42,8 @@ extern void __init udbg_init_debug_lpar(void); | |||
| 42 | extern void __init udbg_init_pmac_realmode(void); | 42 | extern void __init udbg_init_pmac_realmode(void); |
| 43 | extern void __init udbg_init_maple_realmode(void); | 43 | extern void __init udbg_init_maple_realmode(void); |
| 44 | extern void __init udbg_init_iseries(void); | 44 | extern void __init udbg_init_iseries(void); |
| 45 | extern void __init udbg_init_rtas(void); | 45 | extern void __init udbg_init_rtas_panel(void); |
| 46 | extern void __init udbg_init_rtas_console(void); | ||
| 46 | 47 | ||
| 47 | #endif /* __KERNEL__ */ | 48 | #endif /* __KERNEL__ */ |
| 48 | #endif /* _ASM_POWERPC_UDBG_H */ | 49 | #endif /* _ASM_POWERPC_UDBG_H */ |
