writeback: split writeback_inodes_wb
[linux-2.6/next.git] / include / linux / sh_intc.h
blob0d6cd38e673ddb2486711517047a3c7fd544ad14
1 #ifndef __SH_INTC_H
2 #define __SH_INTC_H
4 #include <linux/ioport.h>
6 typedef unsigned char intc_enum;
8 struct intc_vect {
9 intc_enum enum_id;
10 unsigned short vect;
13 #define INTC_VECT(enum_id, vect) { enum_id, vect }
14 #define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
16 struct intc_group {
17 intc_enum enum_id;
18 intc_enum enum_ids[32];
21 #define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
23 struct intc_mask_reg {
24 unsigned long set_reg, clr_reg, reg_width;
25 intc_enum enum_ids[32];
26 #ifdef CONFIG_INTC_BALANCING
27 unsigned long dist_reg;
28 #endif
29 #ifdef CONFIG_SMP
30 unsigned long smp;
31 #endif
34 struct intc_prio_reg {
35 unsigned long set_reg, clr_reg, reg_width, field_width;
36 intc_enum enum_ids[16];
37 #ifdef CONFIG_SMP
38 unsigned long smp;
39 #endif
42 struct intc_sense_reg {
43 unsigned long reg, reg_width, field_width;
44 intc_enum enum_ids[16];
47 #ifdef CONFIG_INTC_BALANCING
48 #define INTC_SMP_BALANCING(reg) .dist_reg = (reg)
49 #else
50 #define INTC_SMP_BALANCING(reg)
51 #endif
53 #ifdef CONFIG_SMP
54 #define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
55 #else
56 #define INTC_SMP(stride, nr)
57 #endif
59 struct intc_hw_desc {
60 struct intc_vect *vectors;
61 unsigned int nr_vectors;
62 struct intc_group *groups;
63 unsigned int nr_groups;
64 struct intc_mask_reg *mask_regs;
65 unsigned int nr_mask_regs;
66 struct intc_prio_reg *prio_regs;
67 unsigned int nr_prio_regs;
68 struct intc_sense_reg *sense_regs;
69 unsigned int nr_sense_regs;
70 struct intc_mask_reg *ack_regs;
71 unsigned int nr_ack_regs;
74 #define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
75 #define INTC_HW_DESC(vectors, groups, mask_regs, \
76 prio_regs, sense_regs, ack_regs) \
77 { \
78 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
79 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
80 _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \
83 struct intc_desc {
84 char *name;
85 struct resource *resource;
86 unsigned int num_resources;
87 intc_enum force_enable;
88 intc_enum force_disable;
89 struct intc_hw_desc hw;
92 #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
93 mask_regs, prio_regs, sense_regs) \
94 struct intc_desc symbol __initdata = { \
95 .name = chipname, \
96 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
97 prio_regs, sense_regs, NULL), \
100 #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
101 mask_regs, prio_regs, sense_regs, ack_regs) \
102 struct intc_desc symbol __initdata = { \
103 .name = chipname, \
104 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
105 prio_regs, sense_regs, ack_regs), \
108 int __init register_intc_controller(struct intc_desc *desc);
109 int intc_set_priority(unsigned int irq, unsigned int prio);
111 #ifdef CONFIG_INTC_USERIMASK
112 int register_intc_userimask(unsigned long addr);
113 #else
114 static inline int register_intc_userimask(unsigned long addr)
116 return 0;
118 #endif
120 int reserve_irq_vector(unsigned int irq);
121 void reserve_irq_legacy(void);
123 #endif /* __SH_INTC_H */