summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnup Patel <anup.patel@wdc.com>2020-01-03 07:50:12 +0300
committerAnup Patel <anup.patel@wdc.com>2020-01-07 09:41:25 +0300
commit2aa43a13cdd32f11c2dac30265272c9af8c6e42b (patch)
tree921368ae232f75540edfb621afa950effd24fc1a /lib
parent1993182f032b71a4d16e39bff12c142dd25dd67e (diff)
downloadopensbi-2aa43a13cdd32f11c2dac30265272c9af8c6e42b.tar.xz
lib: save/restore MIE CSR in sbi_hart_wait_for_coldboot()
Currently, sbi_hart_wait_for_coldboot() leaves MIE.MSIP bit set when it returns which is not correct because MIE.MSIP should be left enabled only by sbi_ipi_init(). This patch does save/restore of MIE CSR to ensure that MIE CSR is in original state after sbi_hart_wait_for_coldboot() returns. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/sbi/sbi_hart.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c
index a704c60..dd2f99e 100644
--- a/lib/sbi/sbi_hart.c
+++ b/lib/sbi/sbi_hart.c
@@ -354,12 +354,16 @@ static unsigned long coldboot_wait_bitmap = 0;
void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
{
+ unsigned long saved_mie;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
if ((sbi_platform_hart_count(plat) <= hartid) ||
(COLDBOOT_WAIT_BITMAP_SIZE <= hartid))
sbi_hart_hang();
+ /* Save MIE CSR */
+ saved_mie = csr_read(CSR_MIE);
+
/* Set MSIE bit to receive IPI */
csr_set(CSR_MIE, MIP_MSIP);
@@ -382,6 +386,9 @@ void sbi_hart_wait_for_coldboot(struct sbi_scratch *scratch, u32 hartid)
/* Release coldboot lock */
spin_unlock(&coldboot_lock);
+ /* Restore MIE CSR */
+ csr_write(CSR_MIE, saved_mie);
+
/* Clear current HART IPI */
sbi_platform_ipi_clear(plat, hartid);
}