aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-07 14:00:31 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-07 14:00:31 -0500
commite17587b5b90da78f56c7a948e54dbac3dc791f31 (patch)
tree60228100507c7c6509188d9f3ee7bd43947c718d /include
parent29ac0052ea454871273a1fc7ef09a97f3c214ee6 (diff)
parent5998a3cf327c90d0a7116eca72c0d2df2be8ecfd (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6: [AVR32] Fix wrong pt_regs in critical exception handler [AVR32] Fix copy_to_user_page() breakage [AVR32] Follow the rules when dealing with the OCD system [AVR32] Clean up OCD register usage [AVR32] Implement irqflags trace and lockdep support [AVR32] Implement stacktrace support [AVR32] Kconfig: Use def_bool instead of bool + default [AVR32] Fix invalid status register bit definitions in asm/ptrace.h [AVR32] Add TIF_RESTORE_SIGMASK to the work masks
Diffstat (limited to 'include')
-rw-r--r--include/asm-avr32/cacheflush.h19
-rw-r--r--include/asm-avr32/ocd.h592
-rw-r--r--include/asm-avr32/processor.h3
-rw-r--r--include/asm-avr32/ptrace.h6
-rw-r--r--include/asm-avr32/sysreg.h2
-rw-r--r--include/asm-avr32/system.h4
-rw-r--r--include/asm-avr32/thread_info.h25
7 files changed, 563 insertions, 88 deletions
diff --git a/include/asm-avr32/cacheflush.h b/include/asm-avr32/cacheflush.h
index dfaaa88cd412..670674749b20 100644
--- a/include/asm-avr32/cacheflush.h
+++ b/include/asm-avr32/cacheflush.h
@@ -116,15 +116,16 @@ extern void flush_icache_page(struct vm_area_struct *vma, struct page *page);
116 * flush with all configurations. 116 * flush with all configurations.
117 */ 117 */
118extern void flush_icache_range(unsigned long start, unsigned long end); 118extern void flush_icache_range(unsigned long start, unsigned long end);
119extern void flush_icache_user_range(struct vm_area_struct *vma,
120 struct page *page,
121 unsigned long addr, int len);
122 119
123#define copy_to_user_page(vma, page, vaddr, dst, src, len) do { \ 120extern void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
124 memcpy(dst, src, len); \ 121 unsigned long vaddr, void *dst, const void *src,
125 flush_icache_user_range(vma, page, vaddr, len); \ 122 unsigned long len);
126} while(0) 123
127#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 124static inline void copy_from_user_page(struct vm_area_struct *vma,
128 memcpy(dst, src, len) 125 struct page *page, unsigned long vaddr, void *dst,
126 const void *src, unsigned long len)
127{
128 memcpy(dst, src, len);
129}
129 130
130#endif /* __ASM_AVR32_CACHEFLUSH_H */ 131#endif /* __ASM_AVR32_CACHEFLUSH_H */
diff --git a/include/asm-avr32/ocd.h b/include/asm-avr32/ocd.h
index 46f73180a127..996405e0393f 100644
--- a/include/asm-avr32/ocd.h
+++ b/include/asm-avr32/ocd.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * AVR32 OCD Registers 2 * AVR32 OCD Interface and register definitions
3 * 3 *
4 * Copyright (C) 2004-2006 Atmel Corporation 4 * Copyright (C) 2004-2007 Atmel Corporation
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify 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 7 * it under the terms of the GNU General Public License version 2 as
@@ -10,69 +10,529 @@
10#ifndef __ASM_AVR32_OCD_H 10#ifndef __ASM_AVR32_OCD_H
11#define __ASM_AVR32_OCD_H 11#define __ASM_AVR32_OCD_H
12 12
13/* Debug Registers */ 13/* OCD Register offsets. Abbreviations used below:
14#define DBGREG_DID 0 14 *
15#define DBGREG_DC 8 15 * BP Breakpoint
16#define DBGREG_DS 16 16 * Comm Communication
17#define DBGREG_RWCS 28 17 * DT Data Trace
18#define DBGREG_RWA 36 18 * PC Program Counter
19#define DBGREG_RWD 40 19 * PID Process ID
20#define DBGREG_WT 44 20 * R/W Read/Write
21#define DBGREG_DTC 52 21 * WP Watchpoint
22#define DBGREG_DTSA0 56 22 */
23#define DBGREG_DTSA1 60 23#define OCD_DID 0x0000 /* Device ID */
24#define DBGREG_DTEA0 72 24#define OCD_DC 0x0008 /* Development Control */
25#define DBGREG_DTEA1 76 25#define OCD_DS 0x0010 /* Development Status */
26#define DBGREG_BWC0A 88 26#define OCD_RWCS 0x001c /* R/W Access Control */
27#define DBGREG_BWC0B 92 27#define OCD_RWA 0x0024 /* R/W Access Address */
28#define DBGREG_BWC1A 96 28#define OCD_RWD 0x0028 /* R/W Access Data */
29#define DBGREG_BWC1B 100 29#define OCD_WT 0x002c /* Watchpoint Trigger */
30#define DBGREG_BWC2A 104 30#define OCD_DTC 0x0034 /* Data Trace Control */
31#define DBGREG_BWC2B 108 31#define OCD_DTSA0 0x0038 /* DT Start Addr Channel 0 */
32#define DBGREG_BWC3A 112 32#define OCD_DTSA1 0x003c /* DT Start Addr Channel 1 */
33#define DBGREG_BWC3B 116 33#define OCD_DTEA0 0x0048 /* DT End Addr Channel 0 */
34#define DBGREG_BWA0A 120 34#define OCD_DTEA1 0x004c /* DT End Addr Channel 1 */
35#define DBGREG_BWA0B 124 35#define OCD_BWC0A 0x0058 /* PC BP/WP Control 0A */
36#define DBGREG_BWA1A 128 36#define OCD_BWC0B 0x005c /* PC BP/WP Control 0B */
37#define DBGREG_BWA1B 132 37#define OCD_BWC1A 0x0060 /* PC BP/WP Control 1A */
38#define DBGREG_BWA2A 136 38#define OCD_BWC1B 0x0064 /* PC BP/WP Control 1B */
39#define DBGREG_BWA2B 140 39#define OCD_BWC2A 0x0068 /* PC BP/WP Control 2A */
40#define DBGREG_BWA3A 144 40#define OCD_BWC2B 0x006c /* PC BP/WP Control 2B */
41#define DBGREG_BWA3B 148 41#define OCD_BWC3A 0x0070 /* Data BP/WP Control 3A */
42#define DBGREG_BWD3A 153 42#define OCD_BWC3B 0x0074 /* Data BP/WP Control 3B */
43#define DBGREG_BWD3B 156 43#define OCD_BWA0A 0x0078 /* PC BP/WP Address 0A */
44 44#define OCD_BWA0B 0x007c /* PC BP/WP Address 0B */
45#define DBGREG_PID 284 45#define OCD_BWA1A 0x0080 /* PC BP/WP Address 1A */
46 46#define OCD_BWA1B 0x0084 /* PC BP/WP Address 1B */
47#define SABAH_OCD 0x01 47#define OCD_BWA2A 0x0088 /* PC BP/WP Address 2A */
48#define SABAH_ICACHE 0x02 48#define OCD_BWA2B 0x008c /* PC BP/WP Address 2B */
49#define SABAH_MEM_CACHED 0x04 49#define OCD_BWA3A 0x0090 /* Data BP/WP Address 3A */
50#define SABAH_MEM_UNCACHED 0x05 50#define OCD_BWA3B 0x0094 /* Data BP/WP Address 3B */
51 51#define OCD_NXCFG 0x0100 /* Nexus Configuration */
52/* Fields in the Development Control register */ 52#define OCD_DINST 0x0104 /* Debug Instruction */
53#define DC_SS_BIT 8 53#define OCD_DPC 0x0108 /* Debug Program Counter */
54 54#define OCD_CPUCM 0x010c /* CPU Control Mask */
55#define DC_SS (1 << DC_SS_BIT) 55#define OCD_DCCPU 0x0110 /* Debug Comm CPU */
56#define DC_DBE (1 << 13) 56#define OCD_DCEMU 0x0114 /* Debug Comm Emulator */
57#define DC_RID (1 << 27) 57#define OCD_DCSR 0x0118 /* Debug Comm Status */
58#define DC_ORP (1 << 28) 58#define OCD_PID 0x011c /* Ownership Trace PID */
59#define DC_MM (1 << 29) 59#define OCD_EPC0 0x0120 /* Event Pair Control 0 */
60#define DC_RES (1 << 30) 60#define OCD_EPC1 0x0124 /* Event Pair Control 1 */
61 61#define OCD_EPC2 0x0128 /* Event Pair Control 2 */
62/* Fields in the Development Status register */ 62#define OCD_EPC3 0x012c /* Event Pair Control 3 */
63#define DS_SSS (1 << 0) 63#define OCD_AXC 0x0130 /* AUX port Control */
64#define DS_SWB (1 << 1) 64
65#define DS_HWB (1 << 2) 65/* Bits in DID */
66#define DS_BP_SHIFT 8 66#define OCD_DID_MID_START 1
67#define DS_BP_MASK (0xff << DS_BP_SHIFT) 67#define OCD_DID_MID_SIZE 11
68 68#define OCD_DID_PN_START 12
69#define __mfdr(addr) \ 69#define OCD_DID_PN_SIZE 16
70({ \ 70#define OCD_DID_RN_START 28
71 register unsigned long value; \ 71#define OCD_DID_RN_SIZE 4
72 asm volatile("mfdr %0, %1" : "=r"(value) : "i"(addr)); \ 72
73 value; \ 73/* Bits in DC */
74}) 74#define OCD_DC_TM_START 0
75#define __mtdr(addr, value) \ 75#define OCD_DC_TM_SIZE 2
76 asm volatile("mtdr %0, %1" : : "i"(addr), "r"(value)) 76#define OCD_DC_EIC_START 3
77#define OCD_DC_EIC_SIZE 2
78#define OCD_DC_OVC_START 5
79#define OCD_DC_OVC_SIZE 3
80#define OCD_DC_SS_BIT 8
81#define OCD_DC_DBR_BIT 12
82#define OCD_DC_DBE_BIT 13
83#define OCD_DC_EOS_START 20
84#define OCD_DC_EOS_SIZE 2
85#define OCD_DC_SQA_BIT 22
86#define OCD_DC_IRP_BIT 23
87#define OCD_DC_IFM_BIT 24
88#define OCD_DC_TOZ_BIT 25
89#define OCD_DC_TSR_BIT 26
90#define OCD_DC_RID_BIT 27
91#define OCD_DC_ORP_BIT 28
92#define OCD_DC_MM_BIT 29
93#define OCD_DC_RES_BIT 30
94#define OCD_DC_ABORT_BIT 31
95
96/* Bits in DS */
97#define OCD_DS_SSS_BIT 0
98#define OCD_DS_SWB_BIT 1
99#define OCD_DS_HWB_BIT 2
100#define OCD_DS_HWE_BIT 3
101#define OCD_DS_STP_BIT 4
102#define OCD_DS_DBS_BIT 5
103#define OCD_DS_BP_START 8
104#define OCD_DS_BP_SIZE 8
105#define OCD_DS_INC_BIT 24
106#define OCD_DS_BOZ_BIT 25
107#define OCD_DS_DBA_BIT 26
108#define OCD_DS_EXB_BIT 27
109#define OCD_DS_NTBF_BIT 28
110
111/* Bits in RWCS */
112#define OCD_RWCS_DV_BIT 0
113#define OCD_RWCS_ERR_BIT 1
114#define OCD_RWCS_CNT_START 2
115#define OCD_RWCS_CNT_SIZE 14
116#define OCD_RWCS_CRC_BIT 19
117#define OCD_RWCS_NTBC_START 20
118#define OCD_RWCS_NTBC_SIZE 2
119#define OCD_RWCS_NTE_BIT 22
120#define OCD_RWCS_NTAP_BIT 23
121#define OCD_RWCS_WRAPPED_BIT 24
122#define OCD_RWCS_CCTRL_START 25
123#define OCD_RWCS_CCTRL_SIZE 2
124#define OCD_RWCS_SZ_START 27
125#define OCD_RWCS_SZ_SIZE 3
126#define OCD_RWCS_RW_BIT 30
127#define OCD_RWCS_AC_BIT 31
128
129/* Bits in RWA */
130#define OCD_RWA_RWA_START 0
131#define OCD_RWA_RWA_SIZE 32
132
133/* Bits in RWD */
134#define OCD_RWD_RWD_START 0
135#define OCD_RWD_RWD_SIZE 32
136
137/* Bits in WT */
138#define OCD_WT_DTE_START 20
139#define OCD_WT_DTE_SIZE 3
140#define OCD_WT_DTS_START 23
141#define OCD_WT_DTS_SIZE 3
142#define OCD_WT_PTE_START 26
143#define OCD_WT_PTE_SIZE 3
144#define OCD_WT_PTS_START 29
145#define OCD_WT_PTS_SIZE 3
146
147/* Bits in DTC */
148#define OCD_DTC_T0WP_BIT 0
149#define OCD_DTC_T1WP_BIT 1
150#define OCD_DTC_ASID0EN_BIT 2
151#define OCD_DTC_ASID0_START 3
152#define OCD_DTC_ASID0_SIZE 8
153#define OCD_DTC_ASID1EN_BIT 11
154#define OCD_DTC_ASID1_START 12
155#define OCD_DTC_ASID1_SIZE 8
156#define OCD_DTC_RWT1_START 28
157#define OCD_DTC_RWT1_SIZE 2
158#define OCD_DTC_RWT0_START 30
159#define OCD_DTC_RWT0_SIZE 2
160
161/* Bits in DTSA0 */
162#define OCD_DTSA0_DTSA_START 0
163#define OCD_DTSA0_DTSA_SIZE 32
164
165/* Bits in DTSA1 */
166#define OCD_DTSA1_DTSA_START 0
167#define OCD_DTSA1_DTSA_SIZE 32
168
169/* Bits in DTEA0 */
170#define OCD_DTEA0_DTEA_START 0
171#define OCD_DTEA0_DTEA_SIZE 32
172
173/* Bits in DTEA1 */
174#define OCD_DTEA1_DTEA_START 0
175#define OCD_DTEA1_DTEA_SIZE 32
176
177/* Bits in BWC0A */
178#define OCD_BWC0A_ASIDEN_BIT 0
179#define OCD_BWC0A_ASID_START 1
180#define OCD_BWC0A_ASID_SIZE 8
181#define OCD_BWC0A_EOC_BIT 14
182#define OCD_BWC0A_AME_BIT 25
183#define OCD_BWC0A_BWE_START 30
184#define OCD_BWC0A_BWE_SIZE 2
185
186/* Bits in BWC0B */
187#define OCD_BWC0B_ASIDEN_BIT 0
188#define OCD_BWC0B_ASID_START 1
189#define OCD_BWC0B_ASID_SIZE 8
190#define OCD_BWC0B_EOC_BIT 14
191#define OCD_BWC0B_AME_BIT 25
192#define OCD_BWC0B_BWE_START 30
193#define OCD_BWC0B_BWE_SIZE 2
194
195/* Bits in BWC1A */
196#define OCD_BWC1A_ASIDEN_BIT 0
197#define OCD_BWC1A_ASID_START 1
198#define OCD_BWC1A_ASID_SIZE 8
199#define OCD_BWC1A_EOC_BIT 14
200#define OCD_BWC1A_AME_BIT 25
201#define OCD_BWC1A_BWE_START 30
202#define OCD_BWC1A_BWE_SIZE 2
203
204/* Bits in BWC1B */
205#define OCD_BWC1B_ASIDEN_BIT 0
206#define OCD_BWC1B_ASID_START 1
207#define OCD_BWC1B_ASID_SIZE 8
208#define OCD_BWC1B_EOC_BIT 14
209#define OCD_BWC1B_AME_BIT 25
210#define OCD_BWC1B_BWE_START 30
211#define OCD_BWC1B_BWE_SIZE 2
212
213/* Bits in BWC2A */
214#define OCD_BWC2A_ASIDEN_BIT 0
215#define OCD_BWC2A_ASID_START 1
216#define OCD_BWC2A_ASID_SIZE 8
217#define OCD_BWC2A_EOC_BIT 14
218#define OCD_BWC2A_AMB_START 20
219#define OCD_BWC2A_AMB_SIZE 5
220#define OCD_BWC2A_AME_BIT 25
221#define OCD_BWC2A_BWE_START 30
222#define OCD_BWC2A_BWE_SIZE 2
223
224/* Bits in BWC2B */
225#define OCD_BWC2B_ASIDEN_BIT 0
226#define OCD_BWC2B_ASID_START 1
227#define OCD_BWC2B_ASID_SIZE 8
228#define OCD_BWC2B_EOC_BIT 14
229#define OCD_BWC2B_AME_BIT 25
230#define OCD_BWC2B_BWE_START 30
231#define OCD_BWC2B_BWE_SIZE 2
232
233/* Bits in BWC3A */
234#define OCD_BWC3A_ASIDEN_BIT 0
235#define OCD_BWC3A_ASID_START 1
236#define OCD_BWC3A_ASID_SIZE 8
237#define OCD_BWC3A_SIZE_START 9
238#define OCD_BWC3A_SIZE_SIZE 3
239#define OCD_BWC3A_EOC_BIT 14
240#define OCD_BWC3A_BWO_START 16
241#define OCD_BWC3A_BWO_SIZE 2
242#define OCD_BWC3A_BME_START 20
243#define OCD_BWC3A_BME_SIZE 4
244#define OCD_BWC3A_BRW_START 28
245#define OCD_BWC3A_BRW_SIZE 2
246#define OCD_BWC3A_BWE_START 30
247#define OCD_BWC3A_BWE_SIZE 2
248
249/* Bits in BWC3B */
250#define OCD_BWC3B_ASIDEN_BIT 0
251#define OCD_BWC3B_ASID_START 1
252#define OCD_BWC3B_ASID_SIZE 8
253#define OCD_BWC3B_SIZE_START 9
254#define OCD_BWC3B_SIZE_SIZE 3
255#define OCD_BWC3B_EOC_BIT 14
256#define OCD_BWC3B_BWO_START 16
257#define OCD_BWC3B_BWO_SIZE 2
258#define OCD_BWC3B_BME_START 20
259#define OCD_BWC3B_BME_SIZE 4
260#define OCD_BWC3B_BRW_START 28
261#define OCD_BWC3B_BRW_SIZE 2
262#define OCD_BWC3B_BWE_START 30
263#define OCD_BWC3B_BWE_SIZE 2
264
265/* Bits in BWA0A */
266#define OCD_BWA0A_BWA_START 0
267#define OCD_BWA0A_BWA_SIZE 32
268
269/* Bits in BWA0B */
270#define OCD_BWA0B_BWA_START 0
271#define OCD_BWA0B_BWA_SIZE 32
272
273/* Bits in BWA1A */
274#define OCD_BWA1A_BWA_START 0
275#define OCD_BWA1A_BWA_SIZE 32
276
277/* Bits in BWA1B */
278#define OCD_BWA1B_BWA_START 0
279#define OCD_BWA1B_BWA_SIZE 32
280
281/* Bits in BWA2A */
282#define OCD_BWA2A_BWA_START 0
283#define OCD_BWA2A_BWA_SIZE 32
284
285/* Bits in BWA2B */
286#define OCD_BWA2B_BWA_START 0
287#define OCD_BWA2B_BWA_SIZE 32
288
289/* Bits in BWA3A */
290#define OCD_BWA3A_BWA_START 0
291#define OCD_BWA3A_BWA_SIZE 32
292
293/* Bits in BWA3B */
294#define OCD_BWA3B_BWA_START 0
295#define OCD_BWA3B_BWA_SIZE 32
296
297/* Bits in NXCFG */
298#define OCD_NXCFG_NXARCH_START 0
299#define OCD_NXCFG_NXARCH_SIZE 4
300#define OCD_NXCFG_NXOCD_START 4
301#define OCD_NXCFG_NXOCD_SIZE 4
302#define OCD_NXCFG_NXPCB_START 8
303#define OCD_NXCFG_NXPCB_SIZE 4
304#define OCD_NXCFG_NXDB_START 12
305#define OCD_NXCFG_NXDB_SIZE 4
306#define OCD_NXCFG_MXMSEO_BIT 16
307#define OCD_NXCFG_NXMDO_START 17
308#define OCD_NXCFG_NXMDO_SIZE 4
309#define OCD_NXCFG_NXPT_BIT 21
310#define OCD_NXCFG_NXOT_BIT 22
311#define OCD_NXCFG_NXDWT_BIT 23
312#define OCD_NXCFG_NXDRT_BIT 24
313#define OCD_NXCFG_NXDTC_START 25
314#define OCD_NXCFG_NXDTC_SIZE 3
315#define OCD_NXCFG_NXDMA_BIT 28
316
317/* Bits in DINST */
318#define OCD_DINST_DINST_START 0
319#define OCD_DINST_DINST_SIZE 32
320
321/* Bits in CPUCM */
322#define OCD_CPUCM_BEM_BIT 1
323#define OCD_CPUCM_FEM_BIT 2
324#define OCD_CPUCM_REM_BIT 3
325#define OCD_CPUCM_IBEM_BIT 4
326#define OCD_CPUCM_IEEM_BIT 5
327
328/* Bits in DCCPU */
329#define OCD_DCCPU_DATA_START 0
330#define OCD_DCCPU_DATA_SIZE 32
331
332/* Bits in DCEMU */
333#define OCD_DCEMU_DATA_START 0
334#define OCD_DCEMU_DATA_SIZE 32
335
336/* Bits in DCSR */
337#define OCD_DCSR_CPUD_BIT 0
338#define OCD_DCSR_EMUD_BIT 1
339
340/* Bits in PID */
341#define OCD_PID_PROCESS_START 0
342#define OCD_PID_PROCESS_SIZE 32
343
344/* Bits in EPC0 */
345#define OCD_EPC0_RNG_START 0
346#define OCD_EPC0_RNG_SIZE 2
347#define OCD_EPC0_CE_BIT 4
348#define OCD_EPC0_ECNT_START 16
349#define OCD_EPC0_ECNT_SIZE 16
350
351/* Bits in EPC1 */
352#define OCD_EPC1_RNG_START 0
353#define OCD_EPC1_RNG_SIZE 2
354#define OCD_EPC1_ATB_BIT 5
355#define OCD_EPC1_AM_BIT 6
356
357/* Bits in EPC2 */
358#define OCD_EPC2_RNG_START 0
359#define OCD_EPC2_RNG_SIZE 2
360#define OCD_EPC2_DB_START 2
361#define OCD_EPC2_DB_SIZE 2
362
363/* Bits in EPC3 */
364#define OCD_EPC3_RNG_START 0
365#define OCD_EPC3_RNG_SIZE 2
366#define OCD_EPC3_DWE_BIT 2
367
368/* Bits in AXC */
369#define OCD_AXC_DIV_START 0
370#define OCD_AXC_DIV_SIZE 4
371#define OCD_AXC_AXE_BIT 8
372#define OCD_AXC_AXS_BIT 9
373#define OCD_AXC_DDR_BIT 10
374#define OCD_AXC_LS_BIT 11
375#define OCD_AXC_REX_BIT 12
376#define OCD_AXC_REXTEN_BIT 13
377
378/* Constants for DC:EIC */
379#define OCD_EIC_PROGRAM_AND_DATA_TRACE 0
380#define OCD_EIC_BREAKPOINT 1
381#define OCD_EIC_NOP 2
382
383/* Constants for DC:OVC */
384#define OCD_OVC_OVERRUN 0
385#define OCD_OVC_DELAY_CPU_BTM 1
386#define OCD_OVC_DELAY_CPU_DTM 2
387#define OCD_OVC_DELAY_CPU_BTM_DTM 3
388
389/* Constants for DC:EOS */
390#define OCD_EOS_NOP 0
391#define OCD_EOS_DEBUG_MODE 1
392#define OCD_EOS_BREAKPOINT_WATCHPOINT 2
393#define OCD_EOS_THQ 3
394
395/* Constants for RWCS:NTBC */
396#define OCD_NTBC_OVERWRITE 0
397#define OCD_NTBC_DISABLE 1
398#define OCD_NTBC_BREAKPOINT 2
399
400/* Constants for RWCS:CCTRL */
401#define OCD_CCTRL_AUTO 0
402#define OCD_CCTRL_CACHED 1
403#define OCD_CCTRL_UNCACHED 2
404
405/* Constants for RWCS:SZ */
406#define OCD_SZ_BYTE 0
407#define OCD_SZ_HALFWORD 1
408#define OCD_SZ_WORD 2
409
410/* Constants for WT:PTS */
411#define OCD_PTS_DISABLED 0
412#define OCD_PTS_PROGRAM_0B 1
413#define OCD_PTS_PROGRAM_1A 2
414#define OCD_PTS_PROGRAM_1B 3
415#define OCD_PTS_PROGRAM_2A 4
416#define OCD_PTS_PROGRAM_2B 5
417#define OCD_PTS_DATA_3A 6
418#define OCD_PTS_DATA_3B 7
419
420/* Constants for DTC:RWT1 */
421#define OCD_RWT1_NO_TRACE 0
422#define OCD_RWT1_DATA_READ 1
423#define OCD_RWT1_DATA_WRITE 2
424#define OCD_RWT1_DATA_READ_WRITE 3
425
426/* Constants for DTC:RWT0 */
427#define OCD_RWT0_NO_TRACE 0
428#define OCD_RWT0_DATA_READ 1
429#define OCD_RWT0_DATA_WRITE 2
430#define OCD_RWT0_DATA_READ_WRITE 3
431
432/* Constants for BWC0A:BWE */
433#define OCD_BWE_DISABLED 0
434#define OCD_BWE_BREAKPOINT_ENABLED 1
435#define OCD_BWE_WATCHPOINT_ENABLED 3
436
437/* Constants for BWC0B:BWE */
438#define OCD_BWE_DISABLED 0
439#define OCD_BWE_BREAKPOINT_ENABLED 1
440#define OCD_BWE_WATCHPOINT_ENABLED 3
441
442/* Constants for BWC1A:BWE */
443#define OCD_BWE_DISABLED 0
444#define OCD_BWE_BREAKPOINT_ENABLED 1
445#define OCD_BWE_WATCHPOINT_ENABLED 3
446
447/* Constants for BWC1B:BWE */
448#define OCD_BWE_DISABLED 0
449#define OCD_BWE_BREAKPOINT_ENABLED 1
450#define OCD_BWE_WATCHPOINT_ENABLED 3
451
452/* Constants for BWC2A:BWE */
453#define OCD_BWE_DISABLED 0
454#define OCD_BWE_BREAKPOINT_ENABLED 1
455#define OCD_BWE_WATCHPOINT_ENABLED 3
456
457/* Constants for BWC2B:BWE */
458#define OCD_BWE_DISABLED 0
459#define OCD_BWE_BREAKPOINT_ENABLED 1
460#define OCD_BWE_WATCHPOINT_ENABLED 3
461
462/* Constants for BWC3A:SIZE */
463#define OCD_SIZE_BYTE_ACCESS 4
464#define OCD_SIZE_HALFWORD_ACCESS 5
465#define OCD_SIZE_WORD_ACCESS 6
466#define OCD_SIZE_DOUBLE_WORD_ACCESS 7
467
468/* Constants for BWC3A:BRW */
469#define OCD_BRW_READ_BREAK 0
470#define OCD_BRW_WRITE_BREAK 1
471#define OCD_BRW_ANY_ACCES_BREAK 2
472
473/* Constants for BWC3A:BWE */
474#define OCD_BWE_DISABLED 0
475#define OCD_BWE_BREAKPOINT_ENABLED 1
476#define OCD_BWE_WATCHPOINT_ENABLED 3
477
478/* Constants for BWC3B:SIZE */
479#define OCD_SIZE_BYTE_ACCESS 4
480#define OCD_SIZE_HALFWORD_ACCESS 5
481#define OCD_SIZE_WORD_ACCESS 6
482#define OCD_SIZE_DOUBLE_WORD_ACCESS 7
483
484/* Constants for BWC3B:BRW */
485#define OCD_BRW_READ_BREAK 0
486#define OCD_BRW_WRITE_BREAK 1
487#define OCD_BRW_ANY_ACCES_BREAK 2
488
489/* Constants for BWC3B:BWE */
490#define OCD_BWE_DISABLED 0
491#define OCD_BWE_BREAKPOINT_ENABLED 1
492#define OCD_BWE_WATCHPOINT_ENABLED 3
493
494/* Constants for EPC0:RNG */
495#define OCD_RNG_DISABLED 0
496#define OCD_RNG_EXCLUSIVE 1
497#define OCD_RNG_INCLUSIVE 2
498
499/* Constants for EPC1:RNG */
500#define OCD_RNG_DISABLED 0
501#define OCD_RNG_EXCLUSIVE 1
502#define OCD_RNG_INCLUSIVE 2
503
504/* Constants for EPC2:RNG */
505#define OCD_RNG_DISABLED 0
506#define OCD_RNG_EXCLUSIVE 1
507#define OCD_RNG_INCLUSIVE 2
508
509/* Constants for EPC2:DB */
510#define OCD_DB_DISABLED 0
511#define OCD_DB_CHAINED_B 1
512#define OCD_DB_CHAINED_A 2
513#define OCD_DB_AHAINED_A_AND_B 3
514
515/* Constants for EPC3:RNG */
516#define OCD_RNG_DISABLED 0
517#define OCD_RNG_EXCLUSIVE 1
518#define OCD_RNG_INCLUSIVE 2
519
520#ifndef __ASSEMBLER__
521
522/* Register access macros */
523static inline unsigned long __ocd_read(unsigned int reg)
524{
525 return __builtin_mfdr(reg);
526}
527
528static inline void __ocd_write(unsigned int reg, unsigned long value)
529{
530 __builtin_mtdr(reg, value);
531}
532
533#define ocd_read(reg) __ocd_read(OCD_##reg)
534#define ocd_write(reg, value) __ocd_write(OCD_##reg, value)
535
536#endif /* !__ASSEMBLER__ */
77 537
78#endif /* __ASM_AVR32_OCD_H */ 538#endif /* __ASM_AVR32_OCD_H */
diff --git a/include/asm-avr32/processor.h b/include/asm-avr32/processor.h
index 6a64833756a6..a52576b25afe 100644
--- a/include/asm-avr32/processor.h
+++ b/include/asm-avr32/processor.h
@@ -139,6 +139,9 @@ extern void show_regs_log_lvl(struct pt_regs *regs, const char *log_lvl);
139extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp, 139extern void show_stack_log_lvl(struct task_struct *tsk, unsigned long sp,
140 struct pt_regs *regs, const char *log_lvl); 140 struct pt_regs *regs, const char *log_lvl);
141 141
142#define task_pt_regs(p) \
143 ((struct pt_regs *)(THREAD_SIZE + task_stack_page(p)) - 1)
144
142#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc) 145#define KSTK_EIP(tsk) ((tsk)->thread.cpu_context.pc)
143#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp) 146#define KSTK_ESP(tsk) ((tsk)->thread.cpu_context.ksp)
144 147
diff --git a/include/asm-avr32/ptrace.h b/include/asm-avr32/ptrace.h
index 60f0f19a81f1..8c5dba5e33df 100644
--- a/include/asm-avr32/ptrace.h
+++ b/include/asm-avr32/ptrace.h
@@ -14,8 +14,7 @@
14/* 14/*
15 * Status Register bits 15 * Status Register bits
16 */ 16 */
17#define SR_H 0x40000000 17#define SR_H 0x20000000
18#define SR_R 0x20000000
19#define SR_J 0x10000000 18#define SR_J 0x10000000
20#define SR_DM 0x08000000 19#define SR_DM 0x08000000
21#define SR_D 0x04000000 20#define SR_D 0x04000000
@@ -35,8 +34,7 @@
35#define SR_I0M 0x00020000 34#define SR_I0M 0x00020000
36#define SR_GM 0x00010000 35#define SR_GM 0x00010000
37 36
38#define SR_H_BIT 30 37#define SR_H_BIT 29
39#define SR_R_BIT 29
40#define SR_J_BIT 28 38#define SR_J_BIT 28
41#define SR_DM_BIT 27 39#define SR_DM_BIT 27
42#define SR_D_BIT 26 40#define SR_D_BIT 26
diff --git a/include/asm-avr32/sysreg.h b/include/asm-avr32/sysreg.h
index dd21182b60e0..d4e0950170ca 100644
--- a/include/asm-avr32/sysreg.h
+++ b/include/asm-avr32/sysreg.h
@@ -93,6 +93,8 @@
93#define SYSREG_I3M_SIZE 1 93#define SYSREG_I3M_SIZE 1
94#define SYSREG_EM_OFFSET 21 94#define SYSREG_EM_OFFSET 21
95#define SYSREG_EM_SIZE 1 95#define SYSREG_EM_SIZE 1
96#define SYSREG_MODE_OFFSET 22
97#define SYSREG_MODE_SIZE 3
96#define SYSREG_M0_OFFSET 22 98#define SYSREG_M0_OFFSET 22
97#define SYSREG_M0_SIZE 1 99#define SYSREG_M0_SIZE 1
98#define SYSREG_M1_OFFSET 23 100#define SYSREG_M1_OFFSET 23
diff --git a/include/asm-avr32/system.h b/include/asm-avr32/system.h
index dc2d527cef41..c600cc15cbcb 100644
--- a/include/asm-avr32/system.h
+++ b/include/asm-avr32/system.h
@@ -35,8 +35,8 @@
35#include <asm/ocd.h> 35#include <asm/ocd.h>
36#define finish_arch_switch(prev) \ 36#define finish_arch_switch(prev) \
37 do { \ 37 do { \
38 __mtdr(DBGREG_PID, prev->pid); \ 38 ocd_write(PID, prev->pid); \
39 __mtdr(DBGREG_PID, current->pid); \ 39 ocd_write(PID, current->pid); \
40 } while(0) 40 } while(0)
41#endif 41#endif
42 42
diff --git a/include/asm-avr32/thread_info.h b/include/asm-avr32/thread_info.h
index 17dacf3f36d3..184b574289b4 100644
--- a/include/asm-avr32/thread_info.h
+++ b/include/asm-avr32/thread_info.h
@@ -25,6 +25,11 @@ struct thread_info {
25 unsigned long flags; /* low level flags */ 25 unsigned long flags; /* low level flags */
26 __u32 cpu; 26 __u32 cpu;
27 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ 27 __s32 preempt_count; /* 0 => preemptable, <0 => BUG */
28 __u32 rar_saved; /* return address... */
29 __u32 rsr_saved; /* ...and status register
30 saved by debug handler
31 when setting up
32 trampoline */
28 struct restart_block restart_block; 33 struct restart_block restart_block;
29 __u8 supervisor_stack[0]; 34 __u8 supervisor_stack[0];
30}; 35};
@@ -78,8 +83,8 @@ static inline struct thread_info *current_thread_info(void)
78#define TIF_NEED_RESCHED 2 /* rescheduling necessary */ 83#define TIF_NEED_RESCHED 2 /* rescheduling necessary */
79#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling 84#define TIF_POLLING_NRFLAG 3 /* true if poll_idle() is polling
80 TIF_NEED_RESCHED */ 85 TIF_NEED_RESCHED */
81#define TIF_BREAKPOINT 4 /* true if we should break after return */ 86#define TIF_BREAKPOINT 4 /* enter monitor mode on return */
82#define TIF_SINGLE_STEP 5 /* single step after next break */ 87#define TIF_SINGLE_STEP 5 /* single step in progress */
83#define TIF_MEMDIE 6 88#define TIF_MEMDIE 6
84#define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */ 89#define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */
85#define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */ 90#define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */
@@ -89,18 +94,24 @@ static inline struct thread_info *current_thread_info(void)
89#define _TIF_SIGPENDING (1 << TIF_SIGPENDING) 94#define _TIF_SIGPENDING (1 << TIF_SIGPENDING)
90#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) 95#define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED)
91#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG) 96#define _TIF_POLLING_NRFLAG (1 << TIF_POLLING_NRFLAG)
92#define _TIF_BREAKPOINT (1 << TIF_BREAKPOINT)
93#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) 97#define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP)
94#define _TIF_MEMDIE (1 << TIF_MEMDIE) 98#define _TIF_MEMDIE (1 << TIF_MEMDIE)
95#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) 99#define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK)
96#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) 100#define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP)
97 101
98/* XXX: These two masks must never span more than 16 bits! */ 102/* Note: The masks below must never span more than 16 bits! */
103
99/* work to do on interrupt/exception return */ 104/* work to do on interrupt/exception return */
100#define _TIF_WORK_MASK 0x0000013e 105#define _TIF_WORK_MASK \
106 ((1 << TIF_SIGPENDING) \
107 | (1 << TIF_NEED_RESCHED) \
108 | (1 << TIF_POLLING_NRFLAG) \
109 | (1 << TIF_BREAKPOINT) \
110 | (1 << TIF_RESTORE_SIGMASK))
111
101/* work to do on any return to userspace */ 112/* work to do on any return to userspace */
102#define _TIF_ALLWORK_MASK 0x0000013f 113#define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE))
103/* work to do on return from debug mode */ 114/* work to do on return from debug mode */
104#define _TIF_DBGWORK_MASK 0x0000017e 115#define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT))
105 116
106#endif /* __ASM_AVR32_THREAD_INFO_H */ 117#endif /* __ASM_AVR32_THREAD_INFO_H */