diff options
| author | Anup Patel <[email protected]> | 2023-09-01 17:41:07 +0530 |
|---|---|---|
| committer | Anup Patel <[email protected]> | 2023-09-24 11:39:38 +0530 |
| commit | 78c667b6fc07d2ea783fbd18f43a3f8191de6164 (patch) | |
| tree | 9f69058b6b03f528b40c08ad0a61d20804e57745 /lib/utils/ipi | |
| parent | e632cd7c816736dc9dab7597b59f9f77a7925fb3 (diff) | |
lib: sbi: Prefer hartindex over hartid in IPI framework
Let us prefer hartindex over hartid in IPI framework which in-turn
forces IPI users to also prefer hartindex.
Signed-off-by: Anup Patel <[email protected]>
Diffstat (limited to 'lib/utils/ipi')
| -rw-r--r-- | lib/utils/ipi/aclint_mswi.c | 14 | ||||
| -rw-r--r-- | lib/utils/ipi/andes_plicsw.c | 8 |
2 files changed, 14 insertions, 8 deletions
diff --git a/lib/utils/ipi/aclint_mswi.c b/lib/utils/ipi/aclint_mswi.c index 140a49b5..a3bfb4a9 100644 --- a/lib/utils/ipi/aclint_mswi.c +++ b/lib/utils/ipi/aclint_mswi.c @@ -25,13 +25,13 @@ static unsigned long mswi_ptr_offset; #define mswi_set_hart_data_ptr(__scratch, __mswi) \ sbi_scratch_write_type((__scratch), void *, mswi_ptr_offset, (__mswi)) -static void mswi_ipi_send(u32 target_hart) +static void mswi_ipi_send(u32 hart_index) { u32 *msip; struct sbi_scratch *scratch; struct aclint_mswi_data *mswi; - scratch = sbi_hartid_to_scratch(target_hart); + scratch = sbi_hartindex_to_scratch(hart_index); if (!scratch) return; @@ -41,16 +41,17 @@ static void mswi_ipi_send(u32 target_hart) /* Set ACLINT IPI */ msip = (void *)mswi->addr; - writel(1, &msip[target_hart - mswi->first_hartid]); + writel(1, &msip[sbi_hartindex_to_hartid(hart_index) - + mswi->first_hartid]); } -static void mswi_ipi_clear(u32 target_hart) +static void mswi_ipi_clear(u32 hart_index) { u32 *msip; struct sbi_scratch *scratch; struct aclint_mswi_data *mswi; - scratch = sbi_hartid_to_scratch(target_hart); + scratch = sbi_hartindex_to_scratch(hart_index); if (!scratch) return; @@ -60,7 +61,8 @@ static void mswi_ipi_clear(u32 target_hart) /* Clear ACLINT IPI */ msip = (void *)mswi->addr; - writel(0, &msip[target_hart - mswi->first_hartid]); + writel(0, &msip[sbi_hartindex_to_hartid(hart_index) - + mswi->first_hartid]); } static struct sbi_ipi_device aclint_mswi = { diff --git a/lib/utils/ipi/andes_plicsw.c b/lib/utils/ipi/andes_plicsw.c index db25ae23..dde39c04 100644 --- a/lib/utils/ipi/andes_plicsw.c +++ b/lib/utils/ipi/andes_plicsw.c @@ -68,8 +68,10 @@ static inline void plic_sw_pending(u32 target_hart) writel(val, (void *)plicsw.addr + PLICSW_PENDING_BASE + word_index * 4); } -static void plicsw_ipi_send(u32 target_hart) +static void plicsw_ipi_send(u32 hart_index) { + u32 target_hart = sbi_hartindex_to_hartid(hart_index); + if (plicsw.hart_count <= target_hart) ebreak(); @@ -77,8 +79,10 @@ static void plicsw_ipi_send(u32 target_hart) plic_sw_pending(target_hart); } -static void plicsw_ipi_clear(u32 target_hart) +static void plicsw_ipi_clear(u32 hart_index) { + u32 target_hart = sbi_hartindex_to_hartid(hart_index); + if (plicsw.hart_count <= target_hart) ebreak(); |
