lib: sbi_irqchip: Register devices during cold init

Have the SBI irqchip core keep track of registered irqchip devices. This
is useful for any callbacks the irqchip driver may have, such as for
warm initialization, the external interrupt handler function, and any
future support for handling external interrupts (beyond IPIs) in M-mode.

This improves on the tracking done in fdt_irqchip.c, as it tracks device
instances, not just drivers, so callbacks can target a specific device.

Signed-off-by: Samuel Holland <samuel.holland@sifive.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Samuel Holland
2024-11-04 20:10:07 -08:00
committed by Anup Patel
parent 56fddce83f
commit e3e5686ef9
5 changed files with 38 additions and 0 deletions

View File

@@ -8,8 +8,11 @@
*/
#include <sbi/sbi_irqchip.h>
#include <sbi/sbi_list.h>
#include <sbi/sbi_platform.h>
static SBI_LIST_HEAD(irqchip_list);
static int default_irqfn(void)
{
return SBI_ENODEV;
@@ -28,6 +31,11 @@ int sbi_irqchip_process(void)
return ext_irqfn();
}
void sbi_irqchip_add_device(struct sbi_irqchip_device *dev)
{
sbi_list_add_tail(&dev->node, &irqchip_list);
}
int sbi_irqchip_init(struct sbi_scratch *scratch, bool cold_boot)
{
int rc;