diff options
author | David Gibson <david@gibson.dropbear.id.au> | 2007-05-07 22:59:31 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-05-08 00:47:33 -0400 |
commit | d9b55a03611ff2e2e54fb4e1ad2648d5eb870fa3 (patch) | |
tree | 5704be539afcd6f29b1f5751476c8b4f53673bff /arch | |
parent | f6dfc80554b27da11dbb36ebae166b23ec3aa9ca (diff) |
[POWERPC] Early serial debug support for PPC44x
This adds support for early serial debugging via the built in
port on IBM/AMCC PowerPC 44x CPUs. It uses a bolted TLB entry in
address space 1 for the UART's mapping, allowing robust debugging both
before and after the initialization of the MMU.
Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/powerpc/Kconfig.debug | 22 | ||||
-rw-r--r-- | arch/powerpc/kernel/head_44x.S | 34 | ||||
-rw-r--r-- | arch/powerpc/kernel/of_platform.c | 1 | ||||
-rw-r--r-- | arch/powerpc/kernel/udbg.c | 3 | ||||
-rw-r--r-- | arch/powerpc/kernel/udbg_16550.c | 23 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/44x.h | 2 | ||||
-rw-r--r-- | arch/powerpc/platforms/44x/misc_44x.S | 31 |
7 files changed, 90 insertions, 26 deletions
diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug index 86aa3745af7f..f70e795c262e 100644 --- a/arch/powerpc/Kconfig.debug +++ b/arch/powerpc/Kconfig.debug | |||
@@ -139,10 +139,6 @@ config BOOTX_TEXT | |||
139 | Say Y here to see progress messages from the boot firmware in text | 139 | Say Y here to see progress messages from the boot firmware in text |
140 | mode. Requires either BootX or Open Firmware. | 140 | mode. Requires either BootX or Open Firmware. |
141 | 141 | ||
142 | config SERIAL_TEXT_DEBUG | ||
143 | bool "Support for early boot texts over serial port" | ||
144 | depends on 4xx | ||
145 | |||
146 | config PPC_EARLY_DEBUG | 142 | config PPC_EARLY_DEBUG |
147 | bool "Early debugging (dangerous)" | 143 | bool "Early debugging (dangerous)" |
148 | 144 | ||
@@ -207,6 +203,24 @@ config PPC_EARLY_DEBUG_BEAT | |||
207 | help | 203 | help |
208 | Select this to enable early debugging for Celleb with Beat. | 204 | Select this to enable early debugging for Celleb with Beat. |
209 | 205 | ||
206 | config PPC_EARLY_DEBUG_44x | ||
207 | bool "Early serial debugging for IBM/AMCC 44x CPUs" | ||
208 | depends on 44x | ||
209 | select PPC_UDBG_16550 | ||
210 | help | ||
211 | Select this to enable early debugging for IBM 44x chips via the | ||
212 | inbuilt serial port. | ||
213 | |||
210 | endchoice | 214 | endchoice |
211 | 215 | ||
216 | config PPC_EARLY_DEBUG_44x_PHYSLOW | ||
217 | hex "Low 32 bits of early debug UART physical address" | ||
218 | depends PPC_EARLY_DEBUG_44x | ||
219 | default "0x40000200" | ||
220 | |||
221 | config PPC_EARLY_DEBUG_44x_PHYSHIGH | ||
222 | hex "EPRN of early debug UART physical address" | ||
223 | depends PPC_EARLY_DEBUG_44x | ||
224 | default "0x1" | ||
225 | |||
212 | endmenu | 226 | endmenu |
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index a51026f0a9d7..88695963f587 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -172,36 +172,28 @@ skpinv: addi r4,r4,1 /* Increment */ | |||
172 | isync | 172 | isync |
173 | 173 | ||
174 | 4: | 174 | 4: |
175 | #ifdef CONFIG_SERIAL_TEXT_DEBUG | 175 | #ifdef CONFIG_PPC_EARLY_DEBUG_44x |
176 | /* | 176 | /* Add UART mapping for early debug. */ |
177 | * Add temporary UART mapping for early debug. | 177 | |
178 | * We can map UART registers wherever we want as long as they don't | ||
179 | * interfere with other system mappings (e.g. with pinned entries). | ||
180 | * For an example of how we handle this - see ocotea.h. --ebs | ||
181 | */ | ||
182 | /* pageid fields */ | 178 | /* pageid fields */ |
183 | lis r3,UART0_IO_BASE@h | 179 | lis r3,PPC44x_EARLY_DEBUG_VIRTADDR@h |
184 | ori r3,r3,PPC44x_TLB_VALID | PPC44x_TLB_4K | 180 | ori r3,r3,PPC44x_TLB_VALID|PPC44x_TLB_TS|PPC44x_TLB_64K |
185 | 181 | ||
186 | /* xlat fields */ | 182 | /* xlat fields */ |
187 | lis r4,UART0_PHYS_IO_BASE@h /* RPN depends on SoC */ | 183 | lis r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSLOW@h |
188 | #ifndef CONFIG_440EP | 184 | ori r4,r4,CONFIG_PPC_EARLY_DEBUG_44x_PHYSHIGH |
189 | ori r4,r4,0x0001 /* ERPN is 1 for second 4GB page */ | ||
190 | #endif | ||
191 | 185 | ||
192 | /* attrib fields */ | 186 | /* attrib fields */ |
193 | li r5,0 | 187 | li r5,(PPC44x_TLB_SW|PPC44x_TLB_SR|PPC44x_TLB_I|PPC44x_TLB_G) |
194 | ori r5,r5,(PPC44x_TLB_SW | PPC44x_TLB_SR | PPC44x_TLB_I | PPC44x_TLB_G) | 188 | li r0,62 /* TLB slot 0 */ |
195 | 189 | ||
196 | li r0,0 /* TLB slot 0 */ | 190 | tlbwe r3,r0,PPC44x_TLB_PAGEID |
197 | 191 | tlbwe r4,r0,PPC44x_TLB_XLAT | |
198 | tlbwe r3,r0,PPC44x_TLB_PAGEID /* Load the pageid fields */ | 192 | tlbwe r5,r0,PPC44x_TLB_ATTRIB |
199 | tlbwe r4,r0,PPC44x_TLB_XLAT /* Load the translation fields */ | ||
200 | tlbwe r5,r0,PPC44x_TLB_ATTRIB /* Load the attrib/access fields */ | ||
201 | 193 | ||
202 | /* Force context change */ | 194 | /* Force context change */ |
203 | isync | 195 | isync |
204 | #endif /* CONFIG_SERIAL_TEXT_DEBUG */ | 196 | #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ |
205 | 197 | ||
206 | /* Establish the interrupt vector offsets */ | 198 | /* Establish the interrupt vector offsets */ |
207 | SET_IVOR(0, CriticalInput); | 199 | SET_IVOR(0, CriticalInput); |
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c index 908ed7926db4..84c34d979a88 100644 --- a/arch/powerpc/kernel/of_platform.c +++ b/arch/powerpc/kernel/of_platform.c | |||
@@ -29,7 +29,6 @@ | |||
29 | #include <asm/ppc-pci.h> | 29 | #include <asm/ppc-pci.h> |
30 | #include <asm/atomic.h> | 30 | #include <asm/atomic.h> |
31 | 31 | ||
32 | |||
33 | /* | 32 | /* |
34 | * The list of OF IDs below is used for matching bus types in the | 33 | * The list of OF IDs below is used for matching bus types in the |
35 | * system whose devices are to be exposed as of_platform_devices. | 34 | * system whose devices are to be exposed as of_platform_devices. |
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c index 7e0971868fc2..7ef97ea8b3ef 100644 --- a/arch/powerpc/kernel/udbg.c +++ b/arch/powerpc/kernel/udbg.c | |||
@@ -51,6 +51,9 @@ void __init udbg_early_init(void) | |||
51 | udbg_init_pas_realmode(); | 51 | udbg_init_pas_realmode(); |
52 | #elif defined(CONFIG_BOOTX_TEXT) | 52 | #elif defined(CONFIG_BOOTX_TEXT) |
53 | udbg_init_btext(); | 53 | udbg_init_btext(); |
54 | #elif defined(CONFIG_PPC_EARLY_DEBUG_44x) | ||
55 | /* PPC44x debug */ | ||
56 | udbg_init_44x_as1(); | ||
54 | #endif | 57 | #endif |
55 | } | 58 | } |
56 | 59 | ||
diff --git a/arch/powerpc/kernel/udbg_16550.c b/arch/powerpc/kernel/udbg_16550.c index a963f657222b..7afab5bcd61a 100644 --- a/arch/powerpc/kernel/udbg_16550.c +++ b/arch/powerpc/kernel/udbg_16550.c | |||
@@ -191,3 +191,26 @@ void udbg_init_pas_realmode(void) | |||
191 | udbg_getc_poll = NULL; | 191 | udbg_getc_poll = NULL; |
192 | } | 192 | } |
193 | #endif /* CONFIG_PPC_MAPLE */ | 193 | #endif /* CONFIG_PPC_MAPLE */ |
194 | |||
195 | #ifdef CONFIG_PPC_EARLY_DEBUG_44x | ||
196 | #include <platforms/44x/44x.h> | ||
197 | |||
198 | static void udbg_44x_as1_putc(char c) | ||
199 | { | ||
200 | if (udbg_comport) { | ||
201 | while ((as1_readb(&udbg_comport->lsr) & LSR_THRE) == 0) | ||
202 | /* wait for idle */; | ||
203 | as1_writeb(c, &udbg_comport->thr); eieio(); | ||
204 | if (c == '\n') | ||
205 | udbg_44x_as1_putc('\r'); | ||
206 | } | ||
207 | } | ||
208 | |||
209 | void __init udbg_init_44x_as1(void) | ||
210 | { | ||
211 | udbg_comport = | ||
212 | (volatile struct NS16550 __iomem *)PPC44x_EARLY_DEBUG_VIRTADDR; | ||
213 | |||
214 | udbg_putc = udbg_44x_as1_putc; | ||
215 | } | ||
216 | #endif /* CONFIG_PPC_EARLY_DEBUG_44x */ | ||
diff --git a/arch/powerpc/platforms/44x/44x.h b/arch/powerpc/platforms/44x/44x.h index 45f24b166f4d..42eabf87fea3 100644 --- a/arch/powerpc/platforms/44x/44x.h +++ b/arch/powerpc/platforms/44x/44x.h | |||
@@ -1,6 +1,8 @@ | |||
1 | #ifndef __POWERPC_PLATFORMS_44X_44X_H | 1 | #ifndef __POWERPC_PLATFORMS_44X_44X_H |
2 | #define __POWERPC_PLATFORMS_44X_44X_H | 2 | #define __POWERPC_PLATFORMS_44X_44X_H |
3 | 3 | ||
4 | extern u8 as1_readb(volatile u8 __iomem *addr); | ||
5 | extern void as1_writeb(u8 data, volatile u8 __iomem *addr); | ||
4 | extern void ppc44x_reset_system(char *cmd); | 6 | extern void ppc44x_reset_system(char *cmd); |
5 | 7 | ||
6 | #endif /* __POWERPC_PLATFORMS_44X_44X_H */ | 8 | #endif /* __POWERPC_PLATFORMS_44X_44X_H */ |
diff --git a/arch/powerpc/platforms/44x/misc_44x.S b/arch/powerpc/platforms/44x/misc_44x.S index 52bde71485bd..3bce71d5d756 100644 --- a/arch/powerpc/platforms/44x/misc_44x.S +++ b/arch/powerpc/platforms/44x/misc_44x.S | |||
@@ -15,6 +15,37 @@ | |||
15 | .text | 15 | .text |
16 | 16 | ||
17 | /* | 17 | /* |
18 | * Do an IO access in AS1 | ||
19 | */ | ||
20 | _GLOBAL(as1_readb) | ||
21 | mfmsr r7 | ||
22 | ori r0,r7,MSR_DS | ||
23 | sync | ||
24 | mtmsr r0 | ||
25 | sync | ||
26 | isync | ||
27 | lbz r3,0(r3) | ||
28 | sync | ||
29 | mtmsr r7 | ||
30 | sync | ||
31 | isync | ||
32 | blr | ||
33 | |||
34 | _GLOBAL(as1_writeb) | ||
35 | mfmsr r7 | ||
36 | ori r0,r7,MSR_DS | ||
37 | sync | ||
38 | mtmsr r0 | ||
39 | sync | ||
40 | isync | ||
41 | stb r3,0(r4) | ||
42 | sync | ||
43 | mtmsr r7 | ||
44 | sync | ||
45 | isync | ||
46 | blr | ||
47 | |||
48 | /* | ||
18 | * void ppc44x_reset_system(char *cmd) | 49 | * void ppc44x_reset_system(char *cmd) |
19 | * | 50 | * |
20 | * At present, this routine just applies a system reset. | 51 | * At present, this routine just applies a system reset. |