4 #include <linux/ioport.h>
6 typedef unsigned char intc_enum;
13 #define INTC_VECT(enum_id, vect) { enum_id, vect }
14 #define INTC_IRQ(enum_id, irq) INTC_VECT(enum_id, irq2evt(irq))
18 intc_enum enum_ids[32];
21 #define INTC_GROUP(enum_id, ids...) { enum_id, { ids } }
23 struct intc_subgroup {
24 unsigned long reg, reg_width;
26 intc_enum enum_ids[32];
29 struct intc_mask_reg {
30 unsigned long set_reg, clr_reg, reg_width;
31 intc_enum enum_ids[32];
32 #ifdef CONFIG_INTC_BALANCING
33 unsigned long dist_reg;
40 struct intc_prio_reg {
41 unsigned long set_reg, clr_reg, reg_width, field_width;
42 intc_enum enum_ids[16];
48 struct intc_sense_reg {
49 unsigned long reg, reg_width, field_width;
50 intc_enum enum_ids[16];
53 #ifdef CONFIG_INTC_BALANCING
54 #define INTC_SMP_BALANCING(reg) .dist_reg = (reg)
56 #define INTC_SMP_BALANCING(reg)
60 #define INTC_SMP(stride, nr) .smp = (stride) | ((nr) << 8)
62 #define INTC_SMP(stride, nr)
66 struct intc_vect *vectors;
67 unsigned int nr_vectors;
68 struct intc_group *groups;
69 unsigned int nr_groups;
70 struct intc_mask_reg *mask_regs;
71 unsigned int nr_mask_regs;
72 struct intc_prio_reg *prio_regs;
73 unsigned int nr_prio_regs;
74 struct intc_sense_reg *sense_regs;
75 unsigned int nr_sense_regs;
76 struct intc_mask_reg *ack_regs;
77 unsigned int nr_ack_regs;
78 struct intc_subgroup *subgroups;
79 unsigned int nr_subgroups;
82 #define _INTC_ARRAY(a) a, a == NULL ? 0 : sizeof(a)/sizeof(*a)
84 #define INTC_HW_DESC(vectors, groups, mask_regs, \
85 prio_regs, sense_regs, ack_regs) \
87 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
88 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
89 _INTC_ARRAY(sense_regs), _INTC_ARRAY(ack_regs), \
94 struct resource *resource;
95 unsigned int num_resources;
96 intc_enum force_enable;
97 intc_enum force_disable;
98 struct intc_hw_desc hw;
101 #define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
102 mask_regs, prio_regs, sense_regs) \
103 struct intc_desc symbol __initdata = { \
105 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
106 prio_regs, sense_regs, NULL), \
109 #define DECLARE_INTC_DESC_ACK(symbol, chipname, vectors, groups, \
110 mask_regs, prio_regs, sense_regs, ack_regs) \
111 struct intc_desc symbol __initdata = { \
113 .hw = INTC_HW_DESC(vectors, groups, mask_regs, \
114 prio_regs, sense_regs, ack_regs), \
117 int register_intc_controller(struct intc_desc *desc);
118 void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
119 int intc_set_priority(unsigned int irq, unsigned int prio);
120 int intc_irq_lookup(const char *chipname, intc_enum enum_id);
121 void intc_finalize(void);
123 #ifdef CONFIG_INTC_USERIMASK
124 int register_intc_userimask(unsigned long addr);
126 static inline int register_intc_userimask(unsigned long addr)
132 #endif /* __SH_INTC_H */