xref: /openbmc/linux/arch/riscv/kernel/irq.c (revision 724ba675)
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * Copyright (C) 2012 Regents of the University of California
4  * Copyright (C) 2017 SiFive
5  * Copyright (C) 2018 Christoph Hellwig
6  */
7 
8 #include <linux/interrupt.h>
9 #include <linux/irqchip.h>
10 #include <linux/irqdomain.h>
11 #include <linux/module.h>
12 #include <linux/seq_file.h>
13 #include <asm/sbi.h>
14 
15 static struct fwnode_handle *(*__get_intc_node)(void);
16 
17 void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void))
18 {
19 	__get_intc_node = fn;
20 }
21 
22 struct fwnode_handle *riscv_get_intc_hwnode(void)
23 {
24 	if (__get_intc_node)
25 		return __get_intc_node();
26 
27 	return NULL;
28 }
29 EXPORT_SYMBOL_GPL(riscv_get_intc_hwnode);
30 
31 int arch_show_interrupts(struct seq_file *p, int prec)
32 {
33 	show_ipi_stats(p, prec);
34 	return 0;
35 }
36 
37 void __init init_IRQ(void)
38 {
39 	irqchip_init();
40 	if (!handle_arch_irq)
41 		panic("No interrupt controller found.");
42 	sbi_ipi_init();
43 }
44