11d05995bSSam Ravnborg #include <linux/platform_device.h> 21d05995bSSam Ravnborg 332231a66SAl Viro #include <asm/btfixup.h> 4d550bbd4SDavid Howells #include <asm/cpu_type.h> 532231a66SAl Viro 66baa9b20SSam Ravnborg struct irq_bucket { 76baa9b20SSam Ravnborg struct irq_bucket *next; 86baa9b20SSam Ravnborg unsigned int real_irq; 96baa9b20SSam Ravnborg unsigned int irq; 106baa9b20SSam Ravnborg unsigned int pil; 116baa9b20SSam Ravnborg }; 126baa9b20SSam Ravnborg 136baa9b20SSam Ravnborg #define SUN4D_MAX_BOARD 10 146baa9b20SSam Ravnborg #define SUN4D_MAX_IRQ ((SUN4D_MAX_BOARD + 2) << 5) 156baa9b20SSam Ravnborg 166baa9b20SSam Ravnborg /* Map between the irq identifier used in hw to the 176baa9b20SSam Ravnborg * irq_bucket. The map is sufficient large to hold 186baa9b20SSam Ravnborg * the sun4d hw identifiers. 196baa9b20SSam Ravnborg */ 206baa9b20SSam Ravnborg extern struct irq_bucket *irq_map[SUN4D_MAX_IRQ]; 216baa9b20SSam Ravnborg 226baa9b20SSam Ravnborg 230399bb5bSSam Ravnborg /* sun4m specific type definitions */ 240399bb5bSSam Ravnborg 250399bb5bSSam Ravnborg /* This maps direct to CPU specific interrupt registers */ 260399bb5bSSam Ravnborg struct sun4m_irq_percpu { 270399bb5bSSam Ravnborg u32 pending; 280399bb5bSSam Ravnborg u32 clear; 290399bb5bSSam Ravnborg u32 set; 300399bb5bSSam Ravnborg }; 310399bb5bSSam Ravnborg 320399bb5bSSam Ravnborg /* This maps direct to global interrupt registers */ 330399bb5bSSam Ravnborg struct sun4m_irq_global { 340399bb5bSSam Ravnborg u32 pending; 350399bb5bSSam Ravnborg u32 mask; 360399bb5bSSam Ravnborg u32 mask_clear; 370399bb5bSSam Ravnborg u32 mask_set; 380399bb5bSSam Ravnborg u32 interrupt_target; 390399bb5bSSam Ravnborg }; 400399bb5bSSam Ravnborg 410399bb5bSSam Ravnborg extern struct sun4m_irq_percpu __iomem *sun4m_irq_percpu[SUN4M_NCPUS]; 420399bb5bSSam Ravnborg extern struct sun4m_irq_global __iomem *sun4m_irq_global; 430399bb5bSSam Ravnborg 44bbdc2661SSam Ravnborg /* 45*472bc4f2SSam Ravnborg * Platform specific configuration 46bbdc2661SSam Ravnborg * The individual platforms assign their platform 47bbdc2661SSam Ravnborg * specifics in their init functions. 48bbdc2661SSam Ravnborg */ 49*472bc4f2SSam Ravnborg struct sparc_config { 50bbdc2661SSam Ravnborg void (*init_timers)(irq_handler_t); 511d05995bSSam Ravnborg unsigned int (*build_device_irq)(struct platform_device *op, 521d05995bSSam Ravnborg unsigned int real_irq); 53bbdc2661SSam Ravnborg }; 54*472bc4f2SSam Ravnborg extern struct sparc_config sparc_config; 55bbdc2661SSam Ravnborg 566baa9b20SSam Ravnborg unsigned int irq_alloc(unsigned int real_irq, unsigned int pil); 576baa9b20SSam Ravnborg void irq_link(unsigned int irq); 586baa9b20SSam Ravnborg void irq_unlink(unsigned int irq); 596baa9b20SSam Ravnborg void handler_irq(unsigned int pil, struct pt_regs *regs); 60bbdc2661SSam Ravnborg 610f516813SAl Viro /* Dave Redman (djhr@tadpole.co.uk) 620f516813SAl Viro * changed these to function pointers.. it saves cycles and will allow 630f516813SAl Viro * the irq dependencies to be split into different files at a later date 640f516813SAl Viro * sun4c_irq.c, sun4m_irq.c etc so we could reduce the kernel size. 650f516813SAl Viro * Jakub Jelinek (jj@sunsite.mff.cuni.cz) 660f516813SAl Viro * Changed these to btfixup entities... It saves cycles :) 670f516813SAl Viro */ 680f516813SAl Viro 6932231a66SAl Viro BTFIXUPDEF_CALL(void, clear_clock_irq, void) 7032231a66SAl Viro BTFIXUPDEF_CALL(void, load_profile_irq, int, unsigned int) 7132231a66SAl Viro 7232231a66SAl Viro static inline void clear_clock_irq(void) 7332231a66SAl Viro { 7432231a66SAl Viro BTFIXUP_CALL(clear_clock_irq)(); 7532231a66SAl Viro } 7632231a66SAl Viro 7732231a66SAl Viro static inline void load_profile_irq(int cpu, int limit) 7832231a66SAl Viro { 7932231a66SAl Viro BTFIXUP_CALL(load_profile_irq)(cpu, limit); 8032231a66SAl Viro } 8132231a66SAl Viro 8232231a66SAl Viro #ifdef CONFIG_SMP 8332231a66SAl Viro BTFIXUPDEF_CALL(void, set_cpu_int, int, int) 8432231a66SAl Viro BTFIXUPDEF_CALL(void, clear_cpu_int, int, int) 8532231a66SAl Viro BTFIXUPDEF_CALL(void, set_irq_udt, int) 8632231a66SAl Viro 8732231a66SAl Viro #define set_cpu_int(cpu,level) BTFIXUP_CALL(set_cpu_int)(cpu,level) 8832231a66SAl Viro #define clear_cpu_int(cpu,level) BTFIXUP_CALL(clear_cpu_int)(cpu,level) 8932231a66SAl Viro #define set_irq_udt(cpu) BTFIXUP_CALL(set_irq_udt)(cpu) 9055dd23ecSDaniel Hellstrom 9155dd23ecSDaniel Hellstrom /* All SUN4D IPIs are sent on this IRQ, may be shared with hard IRQs */ 9238f7f8f0SKjetil Oftedal #define SUN4D_IPI_IRQ 13 9355dd23ecSDaniel Hellstrom 9455dd23ecSDaniel Hellstrom extern void sun4d_ipi_interrupt(void); 9555dd23ecSDaniel Hellstrom 9632231a66SAl Viro #endif 97