Skip to content

Commit 91a9fec

Browse files
author
Rob Herring
committed
ARM: move debug macros to common location
Based on suggestion by Russell King, create a common location for debug macros and select the included debug macro file using config option. Signed-off-by: Rob Herring <rob.herring@calxeda.com> Cc: Russell King <linux@arm.linux.org.uk>
1 parent 0146422 commit 91a9fec

4 files changed

Lines changed: 100 additions & 86 deletions

File tree

‎arch/arm/Kconfig.debug‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,11 @@ choice
373373

374374
endchoice
375375

376+
config DEBUG_LL_INCLUDE
377+
string
378+
default "debug/icedcc.S" if DEBUG_ICEDCC
379+
default "mach/debug-macro.S"
380+
376381
config EARLY_PRINTK
377382
bool "Early printk"
378383
depends on DEBUG_LL

‎arch/arm/include/debug/icedcc.S‎

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
/*
2+
* arch/arm/include/debug/icedcc.S
3+
*
4+
* Copyright (C) 1994-1999 Russell King
5+
*
6+
* This program is free software; you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License version 2 as
8+
* published by the Free Software Foundation.
9+
*
10+
*/
11+
12+
@@ debug using ARM EmbeddedICE DCC channel
13+
14+
.macro addruart, rp, rv, tmp
15+
.endm
16+
17+
#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
18+
19+
.macro senduart, rd, rx
20+
mcr p14, 0, \rd, c0, c5, 0
21+
.endm
22+
23+
.macro busyuart, rd, rx
24+
1001:
25+
mrc p14, 0, \rx, c0, c1, 0
26+
tst \rx, #0x20000000
27+
beq 1001b
28+
.endm
29+
30+
.macro waituart, rd, rx
31+
mov \rd, #0x2000000
32+
1001:
33+
subs \rd, \rd, #1
34+
bmi 1002f
35+
mrc p14, 0, \rx, c0, c1, 0
36+
tst \rx, #0x20000000
37+
bne 1001b
38+
1002:
39+
.endm
40+
41+
#elif defined(CONFIG_CPU_XSCALE)
42+
43+
.macro senduart, rd, rx
44+
mcr p14, 0, \rd, c8, c0, 0
45+
.endm
46+
47+
.macro busyuart, rd, rx
48+
1001:
49+
mrc p14, 0, \rx, c14, c0, 0
50+
tst \rx, #0x10000000
51+
beq 1001b
52+
.endm
53+
54+
.macro waituart, rd, rx
55+
mov \rd, #0x10000000
56+
1001:
57+
subs \rd, \rd, #1
58+
bmi 1002f
59+
mrc p14, 0, \rx, c14, c0, 0
60+
tst \rx, #0x10000000
61+
bne 1001b
62+
1002:
63+
.endm
64+
65+
#else
66+
67+
.macro senduart, rd, rx
68+
mcr p14, 0, \rd, c1, c0, 0
69+
.endm
70+
71+
.macro busyuart, rd, rx
72+
1001:
73+
mrc p14, 0, \rx, c0, c0, 0
74+
tst \rx, #2
75+
beq 1001b
76+
77+
.endm
78+
79+
.macro waituart, rd, rx
80+
mov \rd, #0x2000000
81+
1001:
82+
subs \rd, \rd, #1
83+
bmi 1002f
84+
mrc p14, 0, \rx, c0, c0, 0
85+
tst \rx, #2
86+
bne 1001b
87+
1002:
88+
.endm
89+
90+
#endif /* CONFIG_CPU_V6 */

‎arch/arm/kernel/debug.S‎

Lines changed: 3 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -20,90 +20,9 @@
2020
* references to these in a production kernel!
2121
*/
2222

23-
#if defined(CONFIG_DEBUG_ICEDCC)
24-
@@ debug using ARM EmbeddedICE DCC channel
25-
26-
.macro addruart, rp, rv, tmp
27-
.endm
28-
29-
#if defined(CONFIG_CPU_V6) || defined(CONFIG_CPU_V6K) || defined(CONFIG_CPU_V7)
30-
31-
.macro senduart, rd, rx
32-
mcr p14, 0, \rd, c0, c5, 0
33-
.endm
34-
35-
.macro busyuart, rd, rx
36-
1001:
37-
mrc p14, 0, \rx, c0, c1, 0
38-
tst \rx, #0x20000000
39-
beq 1001b
40-
.endm
41-
42-
.macro waituart, rd, rx
43-
mov \rd, #0x2000000
44-
1001:
45-
subs \rd, \rd, #1
46-
bmi 1002f
47-
mrc p14, 0, \rx, c0, c1, 0
48-
tst \rx, #0x20000000
49-
bne 1001b
50-
1002:
51-
.endm
52-
53-
#elif defined(CONFIG_CPU_XSCALE)
54-
55-
.macro senduart, rd, rx
56-
mcr p14, 0, \rd, c8, c0, 0
57-
.endm
58-
59-
.macro busyuart, rd, rx
60-
1001:
61-
mrc p14, 0, \rx, c14, c0, 0
62-
tst \rx, #0x10000000
63-
beq 1001b
64-
.endm
65-
66-
.macro waituart, rd, rx
67-
mov \rd, #0x10000000
68-
1001:
69-
subs \rd, \rd, #1
70-
bmi 1002f
71-
mrc p14, 0, \rx, c14, c0, 0
72-
tst \rx, #0x10000000
73-
bne 1001b
74-
1002:
75-
.endm
76-
77-
#else
78-
79-
.macro senduart, rd, rx
80-
mcr p14, 0, \rd, c1, c0, 0
81-
.endm
82-
83-
.macro busyuart, rd, rx
84-
1001:
85-
mrc p14, 0, \rx, c0, c0, 0
86-
tst \rx, #2
87-
beq 1001b
88-
89-
.endm
90-
91-
.macro waituart, rd, rx
92-
mov \rd, #0x2000000
93-
1001:
94-
subs \rd, \rd, #1
95-
bmi 1002f
96-
mrc p14, 0, \rx, c0, c0, 0
97-
tst \rx, #2
98-
bne 1001b
99-
1002:
100-
.endm
101-
102-
#endif /* CONFIG_CPU_V6 */
103-
104-
#elif !defined(CONFIG_DEBUG_SEMIHOSTING)
105-
#include <mach/debug-macro.S>
106-
#endif /* CONFIG_DEBUG_ICEDCC */
23+
#if !defined(CONFIG_DEBUG_SEMIHOSTING)
24+
#include CONFIG_DEBUG_LL_INCLUDE
25+
#endif
10726

10827
#ifdef CONFIG_MMU
10928
.macro addruart_current, rx, tmp1, tmp2

‎arch/arm/kernel/head.S‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#include <asm/thread_info.h>
2424
#include <asm/pgtable.h>
2525

26-
#ifdef CONFIG_DEBUG_LL
27-
#include <mach/debug-macro.S>
26+
#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_SEMIHOSTING)
27+
#include CONFIG_DEBUG_LL_INCLUDE
2828
#endif
2929

3030
/*

0 commit comments

Comments
 (0)