Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[PATCH] xtensa: fix irq and misc fixes

Update the architecture specific interrupt handling code for Xtensa to support
the new API. Use generic BUG macros in bug.h, and some minor fixes.

Signed-off-by: Chris Zankel <chris@zankel.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

authored by

Chris Zankel and committed by
Linus Torvalds
fd43fe19 5fcf7bb7

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