forked from Mirrors/opensbi
lib: sbi_irqchip: Call driver warm_init from SBI core
Currently, each platform keeps track of which irqchip driver is in use and calls its warm init function. Since the generic platform may use multiple irqchip drivers, it has logic to track an array of drivers. The code is simplified and made common across platforms by treating warm init and exit as properties of the driver, not the platform. Then the platform's only role is to select and prepare a driver during cold boot. For now, only add a .warm_init hook, since none of the existing drivers need an .exit hook. It could be added in the future if needed. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
e3e5686ef9
commit
2dd6eaf680
@@ -16,12 +16,6 @@
|
||||
#include <sbi_utils/irqchip/fdt_irqchip.h>
|
||||
#include <sbi_utils/irqchip/aplic.h>
|
||||
|
||||
static int irqchip_aplic_warm_init(void)
|
||||
{
|
||||
/* Nothing to do here. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int irqchip_aplic_cold_init(const void *fdt, int nodeoff,
|
||||
const struct fdt_match *match)
|
||||
{
|
||||
@@ -55,6 +49,6 @@ static const struct fdt_match irqchip_aplic_match[] = {
|
||||
struct fdt_irqchip fdt_irqchip_aplic = {
|
||||
.match_table = irqchip_aplic_match,
|
||||
.cold_init = irqchip_aplic_cold_init,
|
||||
.warm_init = irqchip_aplic_warm_init,
|
||||
.warm_init = NULL,
|
||||
.exit = NULL,
|
||||
};
|
||||
|
@@ -95,5 +95,5 @@ static const struct fdt_match irqchip_imsic_match[] = {
|
||||
struct fdt_irqchip fdt_irqchip_imsic = {
|
||||
.match_table = irqchip_imsic_match,
|
||||
.cold_init = irqchip_imsic_cold_init,
|
||||
.warm_init = imsic_warm_irqchip_init,
|
||||
.warm_init = NULL,
|
||||
};
|
||||
|
@@ -108,6 +108,6 @@ static const struct fdt_match irqchip_plic_match[] = {
|
||||
struct fdt_irqchip fdt_irqchip_plic = {
|
||||
.match_table = irqchip_plic_match,
|
||||
.cold_init = irqchip_plic_cold_init,
|
||||
.warm_init = plic_warm_irqchip_init,
|
||||
.warm_init = NULL,
|
||||
.exit = NULL,
|
||||
};
|
||||
|
@@ -255,7 +255,7 @@ void imsic_local_irqchip_init(void)
|
||||
imsic_local_eix_update(IMSIC_IPI_ID, 1, false, true);
|
||||
}
|
||||
|
||||
int imsic_warm_irqchip_init(void)
|
||||
static int imsic_warm_irqchip_init(struct sbi_irqchip_device *dev)
|
||||
{
|
||||
struct imsic_data *imsic = imsic_get_data(current_hartindex());
|
||||
|
||||
@@ -346,6 +346,7 @@ int imsic_data_check(struct imsic_data *imsic)
|
||||
}
|
||||
|
||||
static struct sbi_irqchip_device imsic_device = {
|
||||
.warm_init = imsic_warm_irqchip_init,
|
||||
};
|
||||
|
||||
int imsic_cold_irqchip_init(struct imsic_data *imsic)
|
||||
|
@@ -190,7 +190,7 @@ void plic_resume(void)
|
||||
plic_delegate(plic);
|
||||
}
|
||||
|
||||
int plic_warm_irqchip_init(void)
|
||||
static int plic_warm_irqchip_init(struct sbi_irqchip_device *dev)
|
||||
{
|
||||
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
|
||||
const struct plic_data *plic = plic_get_hart_data_ptr(scratch);
|
||||
@@ -222,6 +222,7 @@ int plic_warm_irqchip_init(void)
|
||||
}
|
||||
|
||||
static struct sbi_irqchip_device plic_device = {
|
||||
.warm_init = plic_warm_irqchip_init,
|
||||
};
|
||||
|
||||
int plic_cold_irqchip_init(struct plic_data *plic)
|
||||
|
Reference in New Issue
Block a user