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

@@ -15,6 +15,7 @@
#include <sbi/sbi_domain.h>
#include <sbi/sbi_error.h>
#include <sbi/sbi_heap.h>
#include <sbi/sbi_irqchip.h>
#include <sbi/sbi_string.h>
#include <sbi_utils/irqchip/plic.h>
@@ -220,6 +221,9 @@ int plic_warm_irqchip_init(void)
return 0;
}
static struct sbi_irqchip_device plic_device = {
};
int plic_cold_irqchip_init(struct plic_data *plic)
{
int i, ret;
@@ -278,5 +282,8 @@ int plic_cold_irqchip_init(struct plic_data *plic)
plic_set_hart_data_ptr(sbi_hartindex_to_scratch(i), plic);
}
/* Register irqchip device */
sbi_irqchip_add_device(&plic_device);
return 0;
}