19 #define pr_fmt(fmt) "intc: " fmt
24 #include <linux/slab.h>
25 #include <linux/stat.h>
29 #include <linux/device.h>
31 #include <linux/list.h>
34 #include <linux/export.h>
40 static unsigned int nr_intc_controllers;
46 static unsigned int default_prio_level = 2;
51 return default_prio_level;
56 return intc_prio_level[irq];
64 intc_prio_level[irq] =
level;
68 static void intc_redirect_irq(
unsigned int irq,
struct irq_desc *
desc)
105 if (!data[0] && data[1])
108 if (!data[0] && !data[1])
109 pr_warning(
"missing unique irq mask for irq %d (vect 0x%04x)\n",
162 d->
chip.irq_mask(irq_data);
190 unsigned int i,
k,
smp;
195 pr_info(
"Registered controller '%s' with %u IRQs\n",
202 INIT_LIST_HEAD(&d->
list);
208 d->
index = nr_intc_controllers;
221 d->
window[
k].size = resource_size(res);
230 #ifdef CONFIG_INTC_BALANCING
253 k += save_reg(d, k, hw->
mask_regs[i].set_reg, smp);
254 k += save_reg(d, k, hw->
mask_regs[i].clr_reg, smp);
255 #ifdef CONFIG_INTC_BALANCING
256 k += save_reg(d, k, hw->
mask_regs[i].dist_reg, 0);
269 k += save_reg(d, k, hw->
prio_regs[i].set_reg, smp);
270 k += save_reg(d, k, hw->
prio_regs[i].clr_reg, smp);
274 intc_handle_int_cmp,
NULL);
284 k += save_reg(d, k, hw->
sense_regs[i].reg, 0);
287 intc_handle_int_cmp,
NULL);
293 k+= save_reg(d, k, hw->
subgroups[i].reg, 0);
300 k += save_reg(d, k, hw->
ack_regs[i].set_reg, 0);
302 d->
chip.irq_mask_ack = d->
chip.irq_disable;
325 res = irq_create_identity_mapping(d->
domain, irq);
328 res = irq_domain_associate(d->
domain, irq, irq);
330 pr_err(
"domain association failure\n");
334 pr_err(
"can't identity map IRQ %d\n", irq);
340 intc_register_irq(desc, d, vect->
enum_id, irq);
354 res = irq_create_identity_mapping(d->
domain, irq2);
357 res = irq_domain_associate(d->
domain,
360 pr_err(
"domain association "
365 pr_err(
"can't identity map IRQ %d\n",
375 irq_set_chained_handler(irq2, intc_redirect_irq);
388 nr_intc_controllers++;
408 pr_err(
"unable to allocate INTC memory\n");
424 for_each_active_irq(irq) {
425 struct irq_data *
data;
429 chip = irq_data_get_irq_chip(data);
430 if (chip != &d->
chip)
432 if (irqd_is_wakeup_set(data))
449 for_each_active_irq(irq) {
450 struct irq_data *
data;
454 chip = irq_data_get_irq_chip(data);
459 if (chip != &d->
chip)
461 if (irqd_irq_disabled(data))
491 static int __init register_intc_devs(
void)
513 pr_err(
"device registration error\n");