static int icu_get_irq(unsigned int irq) { uint16_t pend1, pend2; uint16_t mask1, mask2; int i; pend1 = icu1_read(SYSINT1REG); mask1 = icu1_read(MSYSINT1REG); pend2 = icu2_read(SYSINT2REG); mask2 = icu2_read(MSYSINT2REG); mask1 &= pend1; mask2 &= pend2; if (mask1) { for (i = 0; i < 16; i++) { if (irq == INT_TO_IRQ(sysint1_assign[i]) && (mask1 & (1 << i))) return SYSINT1_IRQ(i); } } if (mask2) { for (i = 0; i < 16; i++) { if (irq == INT_TO_IRQ(sysint2_assign[i]) && (mask2 & (1 << i))) return SYSINT2_IRQ(i); } } printk(KERN_ERR "spurious ICU interrupt: %04x,%04x\n", pend1, pend2); atomic_inc(&irq_err_count); return -1; }
asmlinkage void irq_dispatch(unsigned char intnum, struct pt_regs *regs) { uint16_t pend1, pend2; uint16_t mask1, mask2; int i; pend1 = read_icu1(SYSINT1REG); mask1 = read_icu1(MSYSINT1REG); pend2 = read_icu2(SYSINT2REG); mask2 = read_icu2(MSYSINT2REG); mask1 &= pend1; mask2 &= pend2; if (mask1) { for (i = 0; i < 16; i++) { if (intnum == sysint1_assign[i] && (mask1 & ((uint16_t)1 << i))) { if (i == 8) giuint_irq_dispatch(regs); else do_IRQ(SYSINT1_IRQ(i), regs); return; } } } if (mask2) { for (i = 0; i < 16; i++) { if (intnum == sysint2_assign[i] && (mask2 & ((uint16_t)1 << i))) { do_IRQ(SYSINT2_IRQ(i), regs); return; } } } printk(KERN_ERR "spurious ICU interrupt: %04x,%04x\n", pend1, pend2); atomic_inc(&irq_err_count); }