mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi_ipi: Move initial IPI clear to sbi_ipi_init()
sbi_ipi_init() expects the platform warm init function to clear IPIs on the local hart, but there is already a generic function to do this. After this change, none of the existing drivers need a warm init callback. 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
be9752a071
commit
693afc818f
@@ -26,8 +26,6 @@ struct aclint_mswi_data {
|
|||||||
u32 hart_count;
|
u32 hart_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
int aclint_mswi_warm_init(void);
|
|
||||||
|
|
||||||
int aclint_mswi_cold_init(struct aclint_mswi_data *mswi);
|
int aclint_mswi_cold_init(struct aclint_mswi_data *mswi);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -32,8 +32,6 @@ struct plicsw_data {
|
|||||||
uint32_t hart_count;
|
uint32_t hart_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
int plicsw_warm_ipi_init(void);
|
|
||||||
|
|
||||||
int plicsw_cold_ipi_init(struct plicsw_data *plicsw);
|
int plicsw_cold_ipi_init(struct plicsw_data *plicsw);
|
||||||
|
|
||||||
#endif /* _IPI_ANDES_PLICSW_H_ */
|
#endif /* _IPI_ANDES_PLICSW_H_ */
|
||||||
|
@@ -178,7 +178,7 @@ static void sbi_hsm_hart_wait(struct sbi_scratch *scratch)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* No need to clear IPI here because the sbi_ipi_init() will
|
* No need to clear IPI here because the sbi_ipi_init() will
|
||||||
* clear it for current HART via sbi_platform_ipi_init().
|
* clear it for current HART.
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -332,14 +332,14 @@ int sbi_ipi_init(struct sbi_scratch *scratch, bool cold_boot)
|
|||||||
ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off);
|
ipi_data = sbi_scratch_offset_ptr(scratch, ipi_data_off);
|
||||||
ipi_data->ipi_type = 0x00;
|
ipi_data->ipi_type = 0x00;
|
||||||
|
|
||||||
/*
|
/* Initialize platform IPI support */
|
||||||
* Initialize platform IPI support. This will also clear any
|
|
||||||
* pending IPIs for current/calling HART.
|
|
||||||
*/
|
|
||||||
ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot);
|
ret = sbi_platform_ipi_init(sbi_platform_ptr(scratch), cold_boot);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
/* Clear any pending IPIs for the current hart */
|
||||||
|
sbi_ipi_raw_clear();
|
||||||
|
|
||||||
/* Enable software interrupts */
|
/* Enable software interrupts */
|
||||||
csr_set(CSR_MIE, MIP_MSIP);
|
csr_set(CSR_MIE, MIP_MSIP);
|
||||||
|
|
||||||
|
@@ -66,14 +66,6 @@ static struct sbi_ipi_device aclint_mswi = {
|
|||||||
.ipi_clear = mswi_ipi_clear
|
.ipi_clear = mswi_ipi_clear
|
||||||
};
|
};
|
||||||
|
|
||||||
int aclint_mswi_warm_init(void)
|
|
||||||
{
|
|
||||||
/* Clear IPI for current HART */
|
|
||||||
mswi_ipi_clear();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int aclint_mswi_cold_init(struct aclint_mswi_data *mswi)
|
int aclint_mswi_cold_init(struct aclint_mswi_data *mswi)
|
||||||
{
|
{
|
||||||
u32 i;
|
u32 i;
|
||||||
|
@@ -65,14 +65,6 @@ static struct sbi_ipi_device plicsw_ipi = {
|
|||||||
.ipi_clear = plicsw_ipi_clear
|
.ipi_clear = plicsw_ipi_clear
|
||||||
};
|
};
|
||||||
|
|
||||||
int plicsw_warm_ipi_init(void)
|
|
||||||
{
|
|
||||||
/* Clear PLICSW IPI */
|
|
||||||
plicsw_ipi_clear();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int plicsw_cold_ipi_init(struct plicsw_data *plicsw)
|
int plicsw_cold_ipi_init(struct plicsw_data *plicsw)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@@ -64,6 +64,6 @@ static const struct fdt_match ipi_mswi_match[] = {
|
|||||||
struct fdt_ipi fdt_ipi_mswi = {
|
struct fdt_ipi fdt_ipi_mswi = {
|
||||||
.match_table = ipi_mswi_match,
|
.match_table = ipi_mswi_match,
|
||||||
.cold_init = ipi_mswi_cold_init,
|
.cold_init = ipi_mswi_cold_init,
|
||||||
.warm_init = aclint_mswi_warm_init,
|
.warm_init = NULL,
|
||||||
.exit = NULL,
|
.exit = NULL,
|
||||||
};
|
};
|
||||||
|
@@ -42,6 +42,6 @@ static const struct fdt_match ipi_plicsw_match[] = {
|
|||||||
struct fdt_ipi fdt_ipi_plicsw = {
|
struct fdt_ipi fdt_ipi_plicsw = {
|
||||||
.match_table = ipi_plicsw_match,
|
.match_table = ipi_plicsw_match,
|
||||||
.cold_init = fdt_plicsw_cold_ipi_init,
|
.cold_init = fdt_plicsw_cold_ipi_init,
|
||||||
.warm_init = plicsw_warm_ipi_init,
|
.warm_init = NULL,
|
||||||
.exit = NULL,
|
.exit = NULL,
|
||||||
};
|
};
|
||||||
|
@@ -143,7 +143,7 @@ static int ariane_ipi_init(bool cold_boot)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aclint_mswi_warm_init();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -174,7 +174,7 @@ static int openpiton_ipi_init(bool cold_boot)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aclint_mswi_warm_init();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -156,7 +156,7 @@ static int k210_ipi_init(bool cold_boot)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aclint_mswi_warm_init();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int k210_timer_init(void)
|
static int k210_timer_init(void)
|
||||||
|
@@ -212,7 +212,7 @@ static int ux600_ipi_init(bool cold_boot)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aclint_mswi_warm_init();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ux600_timer_init(void)
|
static int ux600_timer_init(void)
|
||||||
|
@@ -112,7 +112,7 @@ static int platform_ipi_init(bool cold_boot)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aclint_mswi_warm_init();
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user