Skip to content

Commit 0ea1293

Browse files
Jeremy Kerrnpitre
authored andcommitted
arm: return both physical and virtual addresses from addruart
Rather than checking the MMU status in every instance of addruart, do it once in kernel/debug.S, and change the existing addruart macros to return both physical and virtual addresses. The main debug code can then select the appropriate address to use. This will also allow us to retreive the address of a uart for the MMU state that we're not current in. Updated with fixes for OMAP from Jason Wang <[email protected]> and Tony Lindgren <[email protected]>, and fix for versatile express from Lorenzo Pieralisi <[email protected]>. Signed-off-by: Jeremy Kerr <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Signed-off-by: Jason Wang <[email protected]> Signed-off-by: Tony Lindgren <[email protected]> Tested-by: Kevin Hilman <[email protected]>
1 parent 1ea6461 commit 0ea1293

File tree

56 files changed

+440
-454
lines changed

Some content is hidden

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

56 files changed

+440
-454
lines changed

arch/arm/kernel/debug.S

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#if defined(CONFIG_DEBUG_ICEDCC)
2323
@@ debug using ARM EmbeddedICE DCC channel
2424

25-
.macro addruart, rx, tmp
25+
.macro addruart, rp, rv
2626
.endm
2727

2828
#if defined(CONFIG_CPU_V6)
@@ -121,6 +121,22 @@ wait: mrc p14, 0, pc, c0, c1, 0
121121
#include <mach/debug-macro.S>
122122
#endif /* CONFIG_DEBUG_ICEDCC */
123123

124+
#ifdef CONFIG_MMU
125+
.macro addruart_current, rx, tmp1, tmp2
126+
addruart \tmp1, \tmp2
127+
mrc p15, 0, \rx, c1, c0
128+
tst \rx, #1
129+
moveq \rx, \tmp1
130+
movne \rx, \tmp2
131+
.endm
132+
133+
#else /* !CONFIG_MMU */
134+
.macro addruart_current, rx, tmp1, tmp2
135+
addruart \rx, \tmp1
136+
.endm
137+
138+
#endif /* CONFIG_MMU */
139+
124140
/*
125141
* Useful debugging routines
126142
*/
@@ -155,7 +171,7 @@ ENDPROC(printhex2)
155171
.ltorg
156172

157173
ENTRY(printascii)
158-
addruart r3, r1
174+
addruart_current r3, r1, r2
159175
b 2f
160176
1: waituart r2, r3
161177
senduart r1, r3
@@ -171,7 +187,7 @@ ENTRY(printascii)
171187
ENDPROC(printascii)
172188

173189
ENTRY(printch)
174-
addruart r3, r1
190+
addruart_current r3, r1, r2
175191
mov r1, r0
176192
mov r0, #0
177193
b 1b

arch/arm/mach-aaec2000/include/mach/debug-macro.S

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
*/
1111

1212
#include "hardware.h"
13-
.macro addruart, rx, tmp
14-
mrc p15, 0, \rx, c1, c0
15-
tst \rx, #1 @ MMU enabled?
16-
moveq \rx, #0x80000000 @ physical
17-
movne \rx, #io_p2v(0x80000000) @ virtual
18-
orr \rx, \rx, #0x00000800
13+
.macro addruart, rp, rv
14+
mov \rp, 0x00000800
15+
orr \rv, \rp, #io_p2v(0x80000000) @ virtual
16+
orr \rp, \rp, #0x80000000 @ physical
1917
.endm
2018

2119
.macro senduart,rd,rx

arch/arm/mach-at91/include/mach/debug-macro.S

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
#include <mach/hardware.h>
1515
#include <mach/at91_dbgu.h>
1616

17-
.macro addruart, rx, tmp
18-
mrc p15, 0, \rx, c1, c0
19-
tst \rx, #1 @ MMU enabled?
20-
ldreq \rx, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
21-
ldrne \rx, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
17+
.macro addruart, rp, rv
18+
ldr \rp, =(AT91_BASE_SYS + AT91_DBGU) @ System peripherals (phys address)
19+
ldr \rv, =(AT91_VA_BASE_SYS + AT91_DBGU) @ System peripherals (virt address)
2220
.endm
2321

2422
.macro senduart,rd,rx

arch/arm/mach-clps711x/include/mach/debug-macro.S

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,14 @@
1414
#include <mach/hardware.h>
1515
#include <asm/hardware/clps7111.h>
1616

17-
.macro addruart, rx, tmp
18-
mrc p15, 0, \rx, c1, c0
19-
tst \rx, #1 @ MMU enabled?
20-
moveq \rx, #CLPS7111_PHYS_BASE
21-
movne \rx, #CLPS7111_VIRT_BASE
17+
.macro addruart, rp, rv
2218
#ifndef CONFIG_DEBUG_CLPS711X_UART2
23-
add \rx, \rx, #0x0000 @ UART1
19+
mov \rp, #0x0000 @ UART1
2420
#else
25-
add \rx, \rx, #0x1000 @ UART2
21+
mov \rp, #0x1000 @ UART2
2622
#endif
23+
orr \rv, \rp, #CLPS7111_VIRT_BASE
24+
orr \rp, \rp, #CLPS7111_PHYS_BASE
2725
.endm
2826

2927
.macro senduart,rd,rx

arch/arm/mach-cns3xxx/include/mach/debug-macro.S

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@
1010
* published by the Free Software Foundation.
1111
*/
1212

13-
.macro addruart,rx
14-
mrc p15, 0, \rx, c1, c0
15-
tst \rx, #1 @ MMU enabled?
16-
moveq \rx, #0x10000000
17-
movne \rx, #0xf0000000 @ virtual base
18-
orr \rx, \rx, #0x00009000
13+
.macro addruart,rp,rv
14+
mov \rp, #0x00009000
15+
orr \rv, \rp, #0xf0000000 @ virtual base
16+
orr \rp, \rp, #0x10000000
1917
.endm
2018

2119
#include <asm/hardware/debug-pl01x.S>

arch/arm/mach-davinci/include/mach/debug-macro.S

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,35 +29,39 @@ davinci_uart_phys: .word 0
2929
davinci_uart_virt: .word 0
3030
.popsection
3131

32-
.macro addruart, rx, tmp
32+
.macro addruart, rp, rv
3333

3434
/* Use davinci_uart_phys/virt if already configured */
35-
10: mrc p15, 0, \rx, c1, c0
36-
tst \rx, #1 @ MMU enabled?
37-
ldreq \rx, =__virt_to_phys(davinci_uart_phys)
38-
ldrne \rx, =davinci_uart_virt
39-
ldr \rx, [\rx]
40-
cmp \rx, #0 @ is port configured?
35+
10: mrc p15, 0, \rp, c1, c0
36+
tst \rp, #1 @ MMU enabled?
37+
ldreq \rp, =__virt_to_phys(davinci_uart_phys)
38+
ldrne \rp, =davinci_uart_phys
39+
add \rv, \rp, #4 @ davinci_uart_virt
40+
ldr \rp, [\rp, #0]
41+
ldr \rv, [\rv, #0]
42+
cmp \rp, #0 @ is port configured?
43+
cmpne \rv, #0
4144
bne 99f @ already configured
4245

43-
mrc p15, 0, \rx, c1, c0
44-
tst \rx, #1 @ MMU enabled?
46+
/* Check the debug UART address set in uncompress.h */
47+
mrc p15, 0, \rp, c1, c0
48+
tst \rp, #1 @ MMU enabled?
4549

4650
/* Copy uart phys address from decompressor uart info */
47-
ldreq \tmp, =__virt_to_phys(davinci_uart_phys)
48-
ldrne \tmp, =davinci_uart_phys
49-
ldreq \rx, =DAVINCI_UART_INFO
50-
ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO)
51-
ldr \rx, [\rx, #0]
52-
str \rx, [\tmp]
51+
ldreq \rv, =__virt_to_phys(davinci_uart_phys)
52+
ldrne \rv, =davinci_uart_phys
53+
ldreq \rp, =DAVINCI_UART_INFO
54+
ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO)
55+
ldr \rp, [\rp, #0]
56+
str \rp, [\rv]
5357

5458
/* Copy uart virt address from decompressor uart info */
55-
ldreq \tmp, =__virt_to_phys(davinci_uart_virt)
56-
ldrne \tmp, =davinci_uart_virt
57-
ldreq \rx, =DAVINCI_UART_INFO
58-
ldrne \rx, =__phys_to_virt(DAVINCI_UART_INFO)
59-
ldr \rx, [\rx, #4]
60-
str \rx, [\tmp]
59+
ldreq \rv, =__virt_to_phys(davinci_uart_virt)
60+
ldrne \rv, =davinci_uart_virt
61+
ldreq \rp, =DAVINCI_UART_INFO
62+
ldrne \rp, =__phys_to_virt(DAVINCI_UART_INFO)
63+
ldr \rp, [\rp, #4]
64+
str \rp, [\rv]
6165

6266
b 10b
6367
99:

arch/arm/mach-dove/include/mach/debug-macro.S

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88

99
#include <mach/bridge-regs.h>
1010

11-
.macro addruart, rx, tmp
12-
mrc p15, 0, \rx, c1, c0
13-
tst \rx, #1 @ MMU enabled?
14-
ldreq \rx, =DOVE_SB_REGS_PHYS_BASE
15-
ldrne \rx, =DOVE_SB_REGS_VIRT_BASE
16-
orr \rx, \rx, #0x00012000
11+
.macro addruart, rp, rv
12+
ldr \rp, =DOVE_SB_REGS_PHYS_BASE
13+
ldr \rv, =DOVE_SB_REGS_VIRT_BASE
14+
orr \rp, \rp, #0x00012000
15+
orr \rv, \rv, #0x00012000
1716
.endm
1817

1918
#define UART_SHIFT 2

arch/arm/mach-ebsa110/include/mach/debug-macro.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
*
1212
**/
1313

14-
.macro addruart, rx, tmp
15-
mov \rx, #0xf0000000
16-
orr \rx, \rx, #0x00000be0
14+
.macro addruart, rp, rv
15+
mov \rp, #0xf0000000
16+
orr \rp, \rp, #0x00000be0
17+
mov \rp, \rv
1718
.endm
1819

1920
#define UART_SHIFT 2

arch/arm/mach-ep93xx/include/mach/debug-macro.S

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@
1111
*/
1212
#include <mach/ep93xx-regs.h>
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ MMU enabled?
17-
ldreq \rx, =EP93XX_APB_PHYS_BASE @ Physical base
18-
ldrne \rx, =EP93XX_APB_VIRT_BASE @ virtual base
19-
orr \rx, \rx, #0x000c0000
14+
.macro addruart, rp, rv
15+
ldr \rp, =EP93XX_APB_PHYS_BASE @ Physical base
16+
ldr \rv, =EP93XX_APB_VIRT_BASE @ virtual base
17+
orr \rp, \rp, #0x000c0000
18+
orr \rv, \rv, #0x000c0000
2019
.endm
2120

2221
#include <asm/hardware/debug-pl01x.S>

arch/arm/mach-footbridge/include/mach/debug-macro.S

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515

1616
#ifndef CONFIG_DEBUG_DC21285_PORT
1717
/* For NetWinder debugging */
18-
.macro addruart, rx, tmp
19-
mrc p15, 0, \rx, c1, c0
20-
tst \rx, #1 @ MMU enabled?
21-
moveq \rx, #0x7c000000 @ physical
22-
movne \rx, #0xff000000 @ virtual
23-
orr \rx, \rx, #0x000003f8
18+
.macro addruart, rp, rv
19+
mov \rp, #0x000003f8
20+
orr \rv, \rp, #0x7c000000 @ physical
21+
orr \rp, \rp, #0xff000000 @ virtual
2422
.endm
2523

2624
#define UART_SHIFT 0
@@ -32,14 +30,14 @@
3230
.equ dc21285_high, ARMCSR_BASE & 0xff000000
3331
.equ dc21285_low, ARMCSR_BASE & 0x00ffffff
3432

35-
.macro addruart, rx, tmp
36-
mrc p15, 0, \rx, c1, c0
37-
tst \rx, #1 @ MMU enabled?
38-
moveq \rx, #0x42000000
39-
movne \rx, #dc21285_high
33+
.macro addruart, rp, rv
4034
.if dc21285_low
41-
orrne \rx, \rx, #dc21285_low
35+
mov \rp, #dc21285_low
36+
.else
37+
mov \rp, #0
4238
.endif
39+
orr \rv, \rp, #0x42000000
40+
orr \rp, \rp, #dc21285_high
4341
.endm
4442

4543
.macro senduart,rd,rx

arch/arm/mach-gemini/include/mach/debug-macro.S

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
*/
1212
#include <mach/hardware.h>
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ MMU enabled?
17-
ldreq \rx, =GEMINI_UART_BASE @ physical
18-
ldrne \rx, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
14+
.macro addruart, rp, rv
15+
ldr \rp, =GEMINI_UART_BASE @ physical
16+
ldr \rv, =IO_ADDRESS(GEMINI_UART_BASE) @ virtual
1917
.endm
2018

2119
#define UART_SHIFT 2

arch/arm/mach-h720x/include/mach/debug-macro.S

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,10 @@
1616
.equ io_virt, IO_VIRT
1717
.equ io_phys, IO_PHYS
1818

19-
.macro addruart, rx, tmp
20-
mrc p15, 0, \rx, c1, c0
21-
tst \rx, #1 @ MMU enabled?
22-
moveq \rx, #io_phys @ physical base address
23-
movne \rx, #io_virt @ virtual address
24-
add \rx, \rx, #0x00020000 @ UART1
19+
.macro addruart, rp, rv
20+
mov \rp, #0x00020000 @ UART1
21+
add \rv, \rp, #io_virt @ virtual address
22+
add \rp, \rp, #io_phys @ physical base address
2523
.endm
2624

2725
.macro senduart,rd,rx

arch/arm/mach-integrator/include/mach/debug-macro.S

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
*
1212
*/
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ MMU enabled?
17-
moveq \rx, #0x16000000 @ physical base address
18-
movne \rx, #0xf0000000 @ virtual base
19-
addne \rx, \rx, #0x16000000 >> 4
14+
.macro addruart, rp, rv
15+
mov \rp, #0x16000000 @ physical base address
16+
mov \rv, #0xf0000000 @ virtual base
17+
add \rv, \rv, #0x16000000 >> 4
2018
.endm
2119

2220
#include <asm/hardware/debug-pl01x.S>

arch/arm/mach-iop13xx/include/mach/debug-macro.S

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,13 @@
1111
* published by the Free Software Foundation.
1212
*/
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ mmu enabled?
17-
moveq \rx, #0xff000000 @ physical
18-
orreq \rx, \rx, #0x00d80000
19-
movne \rx, #0xfe000000 @ virtual
20-
orrne \rx, \rx, #0x00e80000
21-
orr \rx, \rx, #0x00002300
22-
orr \rx, \rx, #0x00000040
14+
.macro addruart, rp, rv
15+
mov \rp, #0x00002300
16+
orr \rp, \rp, #0x00000040
17+
orr \rv, \rp, #0xfe000000 @ virtual
18+
orr \rv, \rv, #0x00e80000
19+
orr \rp, \rp, #0xff000000 @ physical
20+
orr \rp, \rp, #0x00d80000
2321
.endm
2422

2523
#define UART_SHIFT 2

arch/arm/mach-iop32x/include/mach/debug-macro.S

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
* published by the Free Software Foundation.
1212
*/
1313

14-
.macro addruart, rx, tmp
15-
mov \rx, #0xfe000000 @ physical as well as virtual
16-
orr \rx, \rx, #0x00800000 @ location of the UART
14+
.macro addruart, rp, rv
15+
mov \rp, #0xfe000000 @ physical as well as virtual
16+
orr \rp, \rp, #0x00800000 @ location of the UART
17+
mov \rv, \rp
1718
.endm
1819

1920
#define UART_SHIFT 0

arch/arm/mach-iop33x/include/mach/debug-macro.S

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@
1111
* published by the Free Software Foundation.
1212
*/
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ mmu enabled?
17-
moveq \rx, #0xff000000 @ physical
18-
movne \rx, #0xfe000000 @ virtual
19-
orr \rx, \rx, #0x00ff0000
20-
orr \rx, \rx, #0x0000f700
14+
.macro addruart, rp, rv
15+
mov \rp, #0x00ff0000
16+
orr \rp, \rp, #0x0000f700
17+
orr \rv, #0xfe000000 @ virtual
18+
orr \rp, #0xff000000 @ physical
2119
.endm
2220

2321
#define UART_SHIFT 2

arch/arm/mach-ixp2000/include/mach/debug-macro.S

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,14 @@
1111
*
1212
*/
1313

14-
.macro addruart, rx, tmp
15-
mrc p15, 0, \rx, c1, c0
16-
tst \rx, #1 @ MMU enabled?
17-
moveq \rx, #0xc0000000 @ Physical base
18-
movne \rx, #0xfe000000 @ virtual base
19-
orrne \rx, \rx, #0x00f00000
20-
orr \rx, \rx, #0x00030000
14+
.macro addruart, rp, rv
15+
mov \rp, #0x00030000
2116
#ifdef __ARMEB__
22-
orr \rx, \rx, #0x00000003
17+
orr \rp, \rp, #0x00000003
2318
#endif
19+
orr \rv, \rp, #0xfe000000 @ virtual base
20+
orr \rv, \rv, #0x00f00000
21+
orr \rp, \rp, #0xc0000000 @ Physical base
2422
.endm
2523

2624
#define UART_SHIFT 2

0 commit comments

Comments
 (0)