Linux 3.16-rc2
[linux/fpc-iii.git] / arch / ia64 / include / asm / iosapic.h
blob94c89a2d97fe2f59421a101c64c587d7bde0c588
1 #ifndef __ASM_IA64_IOSAPIC_H
2 #define __ASM_IA64_IOSAPIC_H
4 #define IOSAPIC_REG_SELECT 0x0
5 #define IOSAPIC_WINDOW 0x10
6 #define IOSAPIC_EOI 0x40
8 #define IOSAPIC_VERSION 0x1
11 * Redirection table entry
13 #define IOSAPIC_RTE_LOW(i) (0x10+i*2)
14 #define IOSAPIC_RTE_HIGH(i) (0x11+i*2)
16 #define IOSAPIC_DEST_SHIFT 16
19 * Delivery mode
21 #define IOSAPIC_DELIVERY_SHIFT 8
22 #define IOSAPIC_FIXED 0x0
23 #define IOSAPIC_LOWEST_PRIORITY 0x1
24 #define IOSAPIC_PMI 0x2
25 #define IOSAPIC_NMI 0x4
26 #define IOSAPIC_INIT 0x5
27 #define IOSAPIC_EXTINT 0x7
30 * Interrupt polarity
32 #define IOSAPIC_POLARITY_SHIFT 13
33 #define IOSAPIC_POL_HIGH 0
34 #define IOSAPIC_POL_LOW 1
37 * Trigger mode
39 #define IOSAPIC_TRIGGER_SHIFT 15
40 #define IOSAPIC_EDGE 0
41 #define IOSAPIC_LEVEL 1
44 * Mask bit
47 #define IOSAPIC_MASK_SHIFT 16
48 #define IOSAPIC_MASK (1<<IOSAPIC_MASK_SHIFT)
50 #define IOSAPIC_VECTOR_MASK 0xffffff00
52 #ifndef __ASSEMBLY__
54 #ifdef CONFIG_IOSAPIC
56 #define NR_IOSAPICS 256
58 #ifdef CONFIG_PARAVIRT_GUEST
59 #include <asm/paravirt.h>
60 #else
61 #define iosapic_pcat_compat_init ia64_native_iosapic_pcat_compat_init
62 #define __iosapic_read __ia64_native_iosapic_read
63 #define __iosapic_write __ia64_native_iosapic_write
64 #define iosapic_get_irq_chip ia64_native_iosapic_get_irq_chip
65 #endif
67 extern void __init ia64_native_iosapic_pcat_compat_init(void);
68 extern struct irq_chip *ia64_native_iosapic_get_irq_chip(unsigned long trigger);
70 static inline unsigned int
71 __ia64_native_iosapic_read(char __iomem *iosapic, unsigned int reg)
73 writel(reg, iosapic + IOSAPIC_REG_SELECT);
74 return readl(iosapic + IOSAPIC_WINDOW);
77 static inline void
78 __ia64_native_iosapic_write(char __iomem *iosapic, unsigned int reg, u32 val)
80 writel(reg, iosapic + IOSAPIC_REG_SELECT);
81 writel(val, iosapic + IOSAPIC_WINDOW);
84 static inline void iosapic_eoi(char __iomem *iosapic, u32 vector)
86 writel(vector, iosapic + IOSAPIC_EOI);
89 extern void __init iosapic_system_init (int pcat_compat);
90 extern int iosapic_init (unsigned long address, unsigned int gsi_base);
91 extern int iosapic_remove (unsigned int gsi_base);
92 extern int gsi_to_irq (unsigned int gsi);
93 extern int iosapic_register_intr (unsigned int gsi, unsigned long polarity,
94 unsigned long trigger);
95 extern void iosapic_unregister_intr (unsigned int irq);
96 extern void iosapic_override_isa_irq (unsigned int isa_irq, unsigned int gsi,
97 unsigned long polarity,
98 unsigned long trigger);
99 extern int __init iosapic_register_platform_intr (u32 int_type,
100 unsigned int gsi,
101 int pmi_vector,
102 u16 eid, u16 id,
103 unsigned long polarity,
104 unsigned long trigger);
106 #ifdef CONFIG_NUMA
107 extern void map_iosapic_to_node (unsigned int, int);
108 #endif
109 #else
110 #define iosapic_system_init(pcat_compat) do { } while (0)
111 #define iosapic_init(address,gsi_base) (-EINVAL)
112 #define iosapic_remove(gsi_base) (-ENODEV)
113 #define iosapic_register_intr(gsi,polarity,trigger) (gsi)
114 #define iosapic_unregister_intr(irq) do { } while (0)
115 #define iosapic_override_isa_irq(isa_irq,gsi,polarity,trigger) do { } while (0)
116 #define iosapic_register_platform_intr(type,gsi,pmi,eid,id, \
117 polarity,trigger) (gsi)
118 #endif
120 # endif /* !__ASSEMBLY__ */
121 #endif /* __ASM_IA64_IOSAPIC_H */