static void chip_mask(struct irq_data *d) { unsigned ien; ien = RDCTL(CTL_IENABLE); ien &= ~(1 << d->irq); WRCTL(CTL_IENABLE, ien); }
/* Unhandled exception handler */ asmlinkage void unhandled_exception(struct pt_regs *regs, int cause) { unsigned long addr = RDCTL(CTL_BADADDR); cause /= 4; pr_emerg("Unhandled exception #%d in %s mode (badaddr=0x%08lx)\n", cause, user_mode(regs) ? "user" : "kernel", addr); regs->ea -= 4; show_regs(regs); pr_emerg("opcode: 0x%08lx\n", *(unsigned long *)(regs->ea)); }
void __init init_IRQ(void) { struct irq_domain *domain; struct device_node *node; node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.0"); if (!node) node = of_find_compatible_node(NULL, NULL, "altr,nios2-1.1"); BUG_ON(!node); domain = irq_domain_add_linear(node, NIOS2_CPU_NR_IRQS, &irq_ops, NULL); BUG_ON(!domain); irq_set_default_host(domain); of_node_put(node); /* Load the initial ienable value */ ienable = RDCTL(CTL_IENABLE); }
/* Alignment exception handler */ asmlinkage void handle_unaligned_c(struct pt_regs *fp, int cause) { unsigned long addr = RDCTL(CTL_BADADDR); cause >>= 2; fp->ea -= 4; if (fixup_exception(fp)) return; if (!user_mode(fp)) { pr_alert("Unaligned access from kernel mode, this might be a hardware\n"); pr_alert("problem, dump registers and restart the instruction\n"); pr_alert(" BADADDR 0x%08lx\n", addr); pr_alert(" cause %d\n", cause); pr_alert(" op-code 0x%08lx\n", *(unsigned long *)(fp->ea)); show_regs(fp); return; } _exception(SIGBUS, fp, BUS_ADRALN, addr); }