2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file COPYING in the main directory of this archive
6 * Changed by HuTao Apr18, 2003
8 * Copyright was missing when I got the code so took from MIPS arch ...MaTed---
9 * Copyright (C) 1994 by Waldorf GMBH, written by Ralf Baechle
10 * Copyright (C) 1995, 96, 97, 98, 99, 2000, 2001 by Ralf Baechle
12 * Adapted for BlackFin (ADI) by Ted Ma <mated@sympatico.ca>
13 * Copyright (c) 2002 Arcturus Networks Inc. (www.arcturusnetworks.com)
14 * Copyright (c) 2002 Lineo, Inc. <mattw@lineo.com>
20 /* SYS_IRQS and NR_IRQS are defined in <mach-bf5xx/irq.h>*/
23 #include <asm/processor.h>
25 static __inline__ int irq_canonicalize(int irq)
31 * Interrupt configuring macros.
33 #define local_irq_disable() \
36 __asm__ __volatile__( \
38 : "=d" (__tmp_dummy) \
42 #if ANOMALY_05000244 && defined(CONFIG_BFIN_ICACHE)
43 # define NOP_PAD_ANOMALY_05000244 "nop; nop;"
45 # define NOP_PAD_ANOMALY_05000244
49 /* Forward decl needed due to cdef inter dependencies */
50 static inline uint32_t __pure bfin_dspid(void);
51 # define blackfin_core_id() (bfin_dspid() & 0xff)
52 # define bfin_irq_flags cpu_pda[blackfin_core_id()].imask
54 extern unsigned long bfin_irq_flags;
57 #define local_irq_enable() \
58 __asm__ __volatile__( \
61 : "d" (bfin_irq_flags) \
64 #define idle_with_irq_disabled() \
65 __asm__ __volatile__( \
66 NOP_PAD_ANOMALY_05000244 \
71 : "d" (bfin_irq_flags) \
74 #ifdef CONFIG_DEBUG_HWERR
75 # define __save_and_cli(x) \
76 __asm__ __volatile__( \
83 # define __save_and_cli(x) \
84 __asm__ __volatile__( \
90 #define local_save_flags(x) \
91 __asm__ __volatile__( \
97 #ifdef CONFIG_DEBUG_HWERR
98 #define irqs_enabled_from_flags(x) (((x) & ~0x3f) != 0)
100 #define irqs_enabled_from_flags(x) ((x) != 0x1f)
103 #define local_irq_restore(x) \
105 if (irqs_enabled_from_flags(x)) \
106 local_irq_enable(); \
109 /* For spinlocks etc */
110 #define local_irq_save(x) __save_and_cli(x)
112 #define irqs_disabled() \
114 unsigned long flags; \
115 local_save_flags(flags); \
116 !irqs_enabled_from_flags(flags); \
119 #endif /* _BFIN_IRQ_H_ */