| Sam Ravnborg | 1d05995 | 2011-02-25 23:01:19 -0800 | [diff] [blame] | 1 | #include <linux/platform_device.h> | 
 | 2 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 3 | #include <asm/btfixup.h> | 
 | 4 |  | 
| Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 5 | struct irq_bucket { | 
 | 6 |         struct irq_bucket *next; | 
 | 7 |         unsigned int real_irq; | 
 | 8 |         unsigned int irq; | 
 | 9 |         unsigned int pil; | 
 | 10 | }; | 
 | 11 |  | 
 | 12 | #define SUN4D_MAX_BOARD 10 | 
 | 13 | #define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5) | 
 | 14 |  | 
 | 15 | /* Map between the irq identifier used in hw to the | 
 | 16 |  * irq_bucket. The map is sufficient large to hold | 
 | 17 |  * the sun4d hw identifiers. | 
 | 18 |  */ | 
 | 19 | extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ]; | 
 | 20 |  | 
 | 21 |  | 
| Sam Ravnborg | 0399bb5 | 2011-02-25 23:02:11 -0800 | [diff] [blame] | 22 | /* sun4m specific type definitions */ | 
 | 23 |  | 
 | 24 | /* This maps direct to CPU specific interrupt registers */ | 
 | 25 | struct sun4m_irq_percpu { | 
 | 26 | 	u32	pending; | 
 | 27 | 	u32	clear; | 
 | 28 | 	u32	set; | 
 | 29 | }; | 
 | 30 |  | 
 | 31 | /* This maps direct to global interrupt registers */ | 
 | 32 | struct sun4m_irq_global { | 
 | 33 | 	u32	pending; | 
 | 34 | 	u32	mask; | 
 | 35 | 	u32	mask_clear; | 
 | 36 | 	u32	mask_set; | 
 | 37 | 	u32	interrupt_target; | 
 | 38 | }; | 
 | 39 |  | 
 | 40 | extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; | 
 | 41 | extern struct sun4m_irq_global __iomem *sun4m_irq_global; | 
 | 42 |  | 
| Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 43 | /* | 
 | 44 |  * Platform specific irq configuration | 
 | 45 |  * The individual platforms assign their platform | 
 | 46 |  * specifics in their init functions. | 
 | 47 |  */ | 
 | 48 | struct sparc_irq_config { | 
 | 49 | 	void (*init_timers)(irq_handler_t); | 
| Sam Ravnborg | 1d05995 | 2011-02-25 23:01:19 -0800 | [diff] [blame] | 50 | 	unsigned int (*build_device_irq)(struct platform_device *op, | 
 | 51 | 	                                 unsigned int real_irq); | 
| Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 52 | }; | 
 | 53 | extern struct sparc_irq_config sparc_irq_config; | 
 | 54 |  | 
| Sam Ravnborg | 6baa9b2 | 2011-04-18 11:25:44 +0000 | [diff] [blame] | 55 | unsigned int irq_alloc(unsigned int real_irq, unsigned int pil); | 
 | 56 | void irq_link(unsigned int irq); | 
 | 57 | void irq_unlink(unsigned int irq); | 
 | 58 | void handler_irq(unsigned int pil, struct pt_regs *regs); | 
| Sam Ravnborg | bbdc266 | 2011-02-25 23:00:19 -0800 | [diff] [blame] | 59 |  | 
| Al Viro | 0f51681 | 2007-07-21 19:19:38 -0700 | [diff] [blame] | 60 | /* Dave Redman (djhr@tadpole.co.uk) | 
 | 61 |  * changed these to function pointers.. it saves cycles and will allow | 
 | 62 |  * the irq dependencies to be split into different files at a later date | 
 | 63 |  * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size. | 
 | 64 |  * Jakub Jelinek (jj@sunsite.mff.cuni.cz) | 
 | 65 |  * Changed these to btfixup entities... It saves cycles :) | 
 | 66 |  */ | 
 | 67 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 68 | BTFIXUPDEF_CALL(void, clear_clock_irq, void) | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 69 | BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int) | 
 | 70 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 71 | static inline void clear_clock_irq(void) | 
 | 72 | { | 
 | 73 | 	BTFIXUP_CALL(clear_clock_irq)(); | 
 | 74 | } | 
 | 75 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 76 | static inline void load_profile_irq(int cpu, int limit) | 
 | 77 | { | 
 | 78 | 	BTFIXUP_CALL(load_profile_irq)(cpu, limit); | 
 | 79 | } | 
 | 80 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 81 | #ifdef CONFIG_SMP | 
 | 82 | BTFIXUPDEF_CALL(void, set_cpu_int, int, int) | 
 | 83 | BTFIXUPDEF_CALL(void, clear_cpu_int, int, int) | 
 | 84 | BTFIXUPDEF_CALL(void, set_irq_udt, int) | 
 | 85 |  | 
 | 86 | #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level) | 
 | 87 | #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level) | 
 | 88 | #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu) | 
| Daniel Hellstrom | 55dd23e | 2011-05-02 00:08:54 +0000 | [diff] [blame] | 89 |  | 
 | 90 | /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ | 
 | 91 | #define SUN4D_IPI_IRQ 14 | 
 | 92 |  | 
 | 93 | extern void sun4d_ipi_interrupt(void); | 
 | 94 |  | 
| Al Viro | 32231a6 | 2007-07-21 19:18:57 -0700 | [diff] [blame] | 95 | #endif |