aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/xtensa/kernel/irq.c107
-rw-r--r--arch/xtensa/kernel/time.c8
-rw-r--r--arch/xtensa/kernel/vmlinux.lds.S1
-rw-r--r--include/asm-xtensa/bug.h25
-rw-r--r--include/asm-xtensa/byteorder.h4
-rw-r--r--include/asm-xtensa/irq_regs.h1
-rw-r--r--include/asm-xtensa/unistd.h3
-rw-r--r--include/asm-xtensa/xtensa/config-linux_be/tie.h2
8 files changed, 65 insertions, 86 deletions
diff --git a/arch/xtensa/kernel/irq.c b/arch/xtensa/kernel/irq.c
index 1cf744ee0959..c9ea73b7031b 100644
--- a/arch/xtensa/kernel/irq.c
+++ b/arch/xtensa/kernel/irq.c
@@ -4,7 +4,7 @@
4 * Xtensa built-in interrupt controller and some generic functions copied 4 * Xtensa built-in interrupt controller and some generic functions copied
5 * from i386. 5 * from i386.
6 * 6 *
7 * Copyright (C) 2002 - 2005 Tensilica, Inc. 7 * Copyright (C) 2002 - 2006 Tensilica, Inc.
8 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar 8 * Copyright (C) 1992, 1998 Linus Torvalds, Ingo Molnar
9 * 9 *
10 * 10 *
@@ -22,11 +22,6 @@
22#include <asm/uaccess.h> 22#include <asm/uaccess.h>
23#include <asm/platform.h> 23#include <asm/platform.h>
24 24
25static void enable_xtensa_irq(unsigned int irq);
26static void disable_xtensa_irq(unsigned int irq);
27static void mask_and_ack_xtensa(unsigned int irq);
28static void end_xtensa_irq(unsigned int irq);
29
30static unsigned int cached_irq_mask; 25static unsigned int cached_irq_mask;
31 26
32atomic_t irq_err_count; 27atomic_t irq_err_count;
@@ -46,8 +41,16 @@ void ack_bad_irq(unsigned int irq)
46 * handlers). 41 * handlers).
47 */ 42 */
48 43
49unsigned int do_IRQ(int irq, struct pt_regs *regs) 44asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
50{ 45{
46 struct pt_regs *old_regs = set_irq_regs(regs);
47 struct irq_desc *desc = irq_desc + irq;
48
49 if (irq >= NR_IRQS) {
50 printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
51 __FUNCTION__, irq);
52 }
53
51 irq_enter(); 54 irq_enter();
52 55
53#ifdef CONFIG_DEBUG_STACKOVERFLOW 56#ifdef CONFIG_DEBUG_STACKOVERFLOW
@@ -63,12 +66,10 @@ unsigned int do_IRQ(int irq, struct pt_regs *regs)
63 sp - sizeof(struct thread_info)); 66 sp - sizeof(struct thread_info));
64 } 67 }
65#endif 68#endif
66 69 desc->handle_irq(irq, desc);
67 __do_IRQ(irq, regs);
68 70
69 irq_exit(); 71 irq_exit();
70 72 set_irq_regs(old_regs);
71 return 1;
72} 73}
73 74
74/* 75/*
@@ -118,72 +119,68 @@ skip:
118 } 119 }
119 return 0; 120 return 0;
120} 121}
121/* shutdown is same as "disable" */
122#define shutdown_xtensa_irq disable_xtensa_irq
123 122
124static unsigned int startup_xtensa_irq(unsigned int irq) 123static void xtensa_irq_mask(unsigned int irq)
125{
126 enable_xtensa_irq(irq);
127 return 0; /* never anything pending */
128}
129
130static struct hw_interrupt_type xtensa_irq_type = {
131 "Xtensa-IRQ",
132 startup_xtensa_irq,
133 shutdown_xtensa_irq,
134 enable_xtensa_irq,
135 disable_xtensa_irq,
136 mask_and_ack_xtensa,
137 end_xtensa_irq
138};
139
140static inline void mask_irq(unsigned int irq)
141{ 124{
142 cached_irq_mask &= ~(1 << irq); 125 cached_irq_mask &= ~(1 << irq);
143 set_sr (cached_irq_mask, INTENABLE); 126 set_sr (cached_irq_mask, INTENABLE);
144} 127}
145 128
146static inline void unmask_irq(unsigned int irq) 129static void xtensa_irq_unmask(unsigned int irq)
147{ 130{
148 cached_irq_mask |= 1 << irq; 131 cached_irq_mask |= 1 << irq;
149 set_sr (cached_irq_mask, INTENABLE); 132 set_sr (cached_irq_mask, INTENABLE);
150} 133}
151 134
152static void disable_xtensa_irq(unsigned int irq) 135static void xtensa_irq_ack(unsigned int irq)
153{ 136{
154 unsigned long flags; 137 set_sr(1 << irq, INTCLEAR);
155 local_save_flags(flags);
156 mask_irq(irq);
157 local_irq_restore(flags);
158} 138}
159 139
160static void enable_xtensa_irq(unsigned int irq) 140static int xtensa_irq_retrigger(unsigned int irq)
161{ 141{
162 unsigned long flags; 142 set_sr (1 << irq, INTSET);
163 local_save_flags(flags); 143 return 1;
164 unmask_irq(irq);
165 local_irq_restore(flags);
166}
167
168static void mask_and_ack_xtensa(unsigned int irq)
169{
170 disable_xtensa_irq(irq);
171} 144}
172 145
173static void end_xtensa_irq(unsigned int irq)
174{
175 enable_xtensa_irq(irq);
176}
177 146
147static struct irq_chip xtensa_irq_chip = {
148 .name = "xtensa",
149 .mask = xtensa_irq_mask,
150 .unmask = xtensa_irq_unmask,
151 .ack = xtensa_irq_ack,
152 .retrigger = xtensa_irq_retrigger,
153};
178 154
179void __init init_IRQ(void) 155void __init init_IRQ(void)
180{ 156{
181 int i; 157 int index;
182 158
183 for (i=0; i < XTENSA_NR_IRQS; i++) 159 for (index = 0; index < XTENSA_NR_IRQS; index++) {
184 irq_desc[i].chip = &xtensa_irq_type; 160 int mask = 1 << index;
185 161
186 cached_irq_mask = 0; 162 if (mask & XCHAL_INTTYPE_MASK_SOFTWARE)
163 set_irq_chip_and_handler(index, &xtensa_irq_chip,
164 handle_simple_irq);
187 165
188 platform_init_irq(); 166 else if (mask & XCHAL_INTTYPE_MASK_EXTERN_EDGE)
167 set_irq_chip_and_handler(index, &xtensa_irq_chip,
168 handle_edge_irq);
169
170 else if (mask & XCHAL_INTTYPE_MASK_EXTERN_LEVEL)
171 set_irq_chip_and_handler(index, &xtensa_irq_chip,
172 handle_level_irq);
173
174 else if (mask & XCHAL_INTTYPE_MASK_TIMER)
175 set_irq_chip_and_handler(index, &xtensa_irq_chip,
176 handle_edge_irq);
177
178 else /* XCHAL_INTTYPE_MASK_WRITE_ERROR */
179 /* XCHAL_INTTYPE_MASK_NMI */
180
181 set_irq_chip_and_handler(index, &xtensa_irq_chip,
182 handle_level_irq);
183 }
184
185 cached_irq_mask = 0;
189} 186}
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 37347e369987..a350431363a0 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -47,7 +47,7 @@ unsigned long long sched_clock(void)
47 return (unsigned long long)jiffies * (1000000000 / HZ); 47 return (unsigned long long)jiffies * (1000000000 / HZ);
48} 48}
49 49
50static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs); 50static irqreturn_t timer_interrupt(int irq, void *dev_id);
51static struct irqaction timer_irqaction = { 51static struct irqaction timer_irqaction = {
52 .handler = timer_interrupt, 52 .handler = timer_interrupt,
53 .flags = IRQF_DISABLED, 53 .flags = IRQF_DISABLED,
@@ -150,7 +150,7 @@ EXPORT_SYMBOL(do_gettimeofday);
150 * The timer interrupt is called HZ times per second. 150 * The timer interrupt is called HZ times per second.
151 */ 151 */
152 152
153irqreturn_t timer_interrupt (int irq, void *dev_id, struct pt_regs *regs) 153irqreturn_t timer_interrupt (int irq, void *dev_id)
154{ 154{
155 155
156 unsigned long next; 156 unsigned long next;
@@ -160,9 +160,9 @@ irqreturn_t timer_interrupt (int irq, void *dev_id, struct pt_regs *regs)
160again: 160again:
161 while ((signed long)(get_ccount() - next) > 0) { 161 while ((signed long)(get_ccount() - next) > 0) {
162 162
163 profile_tick(CPU_PROFILING, regs); 163 profile_tick(CPU_PROFILING);
164#ifndef CONFIG_SMP 164#ifndef CONFIG_SMP
165 update_process_times(user_mode(regs)); 165 update_process_times(user_mode(get_irq_regs()));
166#endif 166#endif
167 167
168 write_seqlock(&xtime_lock); 168 write_seqlock(&xtime_lock);
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index cfe75f528725..e01131fec69e 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -17,6 +17,7 @@
17#include <asm-generic/vmlinux.lds.h> 17#include <asm-generic/vmlinux.lds.h>
18 18
19#define _NOCLANGUAGE 19#define _NOCLANGUAGE
20#undef __ASSEMBLER__
20#include <xtensa/config/core.h> 21#include <xtensa/config/core.h>
21#include <xtensa/config/system.h> 22#include <xtensa/config/system.h>
22OUTPUT_ARCH(xtensa) 23OUTPUT_ARCH(xtensa)
diff --git a/include/asm-xtensa/bug.h b/include/asm-xtensa/bug.h
index 56703659b204..3e52d72712f1 100644
--- a/include/asm-xtensa/bug.h
+++ b/include/asm-xtensa/bug.h
@@ -13,29 +13,6 @@
13#ifndef _XTENSA_BUG_H 13#ifndef _XTENSA_BUG_H
14#define _XTENSA_BUG_H 14#define _XTENSA_BUG_H
15 15
16#include <linux/stringify.h> 16#include <asm-generic/bug.h>
17
18#define ILL __asm__ __volatile__ (".byte 0,0,0\n")
19
20#ifdef CONFIG_KALLSYMS
21# define BUG() do { \
22 printk("kernel BUG at %s:%d!\n", __FILE__, __LINE__); \
23 ILL; \
24} while (0)
25#else
26# define BUG() do { \
27 printk("kernel BUG!\n"); \
28 ILL; \
29} while (0)
30#endif
31
32#define BUG_ON(condition) do { if (unlikely((condition)!=0)) BUG(); } while(0)
33#define PAGE_BUG(page) do { BUG(); } while (0)
34#define WARN_ON(condition) do { \
35 if (unlikely((condition)!=0)) { \
36 printk ("Warning in %s at %s:%d\n", __FUNCTION__, __FILE__, __LINE__); \
37 dump_stack(); \
38 } \
39} while (0)
40 17
41#endif /* _XTENSA_BUG_H */ 18#endif /* _XTENSA_BUG_H */
diff --git a/include/asm-xtensa/byteorder.h b/include/asm-xtensa/byteorder.h
index 0b1552569aae..0ba72ddbf889 100644
--- a/include/asm-xtensa/byteorder.h
+++ b/include/asm-xtensa/byteorder.h
@@ -14,7 +14,7 @@
14#include <asm/processor.h> 14#include <asm/processor.h>
15#include <asm/types.h> 15#include <asm/types.h>
16 16
17static __inline__ __const__ __u32 ___arch__swab32(__u32 x) 17static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
18{ 18{
19 __u32 res; 19 __u32 res;
20 /* instruction sequence from Xtensa ISA release 2/2000 */ 20 /* instruction sequence from Xtensa ISA release 2/2000 */
@@ -29,7 +29,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
29 return res; 29 return res;
30} 30}
31 31
32static __inline__ __const__ __u16 ___arch__swab16(__u16 x) 32static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x)
33{ 33{
34 /* Given that 'short' values are signed (i.e., can be negative), 34 /* Given that 'short' values are signed (i.e., can be negative),
35 * we cannot assume that the upper 16-bits of the register are 35 * we cannot assume that the upper 16-bits of the register are
diff --git a/include/asm-xtensa/irq_regs.h b/include/asm-xtensa/irq_regs.h
new file mode 100644
index 000000000000..3dd9c0b70270
--- /dev/null
+++ b/include/asm-xtensa/irq_regs.h
@@ -0,0 +1 @@
#include <asm-generic/irq_regs.h>
diff --git a/include/asm-xtensa/unistd.h b/include/asm-xtensa/unistd.h
index 2e1a1b997e7d..15b0932523d5 100644
--- a/include/asm-xtensa/unistd.h
+++ b/include/asm-xtensa/unistd.h
@@ -218,6 +218,8 @@
218 218
219#define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/ 219#define SYSXTENSA_COUNT 5 /* count of syscall0 functions*/
220 220
221#ifdef __KERNEL__
222
221/* 223/*
222 * "Conditional" syscalls 224 * "Conditional" syscalls
223 * 225 *
@@ -230,6 +232,7 @@
230#define __ARCH_WANT_SYS_UTIME 232#define __ARCH_WANT_SYS_UTIME
231#define __ARCH_WANT_SYS_LLSEEK 233#define __ARCH_WANT_SYS_LLSEEK
232#define __ARCH_WANT_SYS_RT_SIGACTION 234#define __ARCH_WANT_SYS_RT_SIGACTION
235
233#endif /* __KERNEL__ */ 236#endif /* __KERNEL__ */
234 237
235#endif /* _XTENSA_UNISTD_H */ 238#endif /* _XTENSA_UNISTD_H */
diff --git a/include/asm-xtensa/xtensa/config-linux_be/tie.h b/include/asm-xtensa/xtensa/config-linux_be/tie.h
index 3c2e514602f4..07c6d1ca4589 100644
--- a/include/asm-xtensa/xtensa/config-linux_be/tie.h
+++ b/include/asm-xtensa/xtensa/config-linux_be/tie.h
@@ -115,7 +115,7 @@
115/* ... */ 115/* ... */
116 116
117 117
118#ifdef _ASMLANGUAGE 118#ifdef __ASSEMBLER__
119/* 119/*
120 * Assembly-language specific definitions (assembly macros, etc.). 120 * Assembly-language specific definitions (assembly macros, etc.).
121 */ 121 */