diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/sbi/sbi_hart.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/sbi/sbi_hart.c b/lib/sbi/sbi_hart.c index 56878b4..0bd1db1 100644 --- a/lib/sbi/sbi_hart.c +++ b/lib/sbi/sbi_hart.c @@ -259,6 +259,9 @@ static inline char *sbi_hart_feature_id2string(unsigned long feature) case SBI_HART_HAS_MCOUNTEREN: fstr = "mcounteren"; break; + case SBI_HART_HAS_MCOUNTINHIBIT: + fstr = "mcountinhibit"; + break; case SBI_HART_HAS_TIME: fstr = "time"; break; @@ -421,6 +424,14 @@ __mhpm_skip: hfeatures->features |= SBI_HART_HAS_MCOUNTEREN; } + /* Detect if hart supports MCOUNTINHIBIT feature */ + val = csr_read_allowed(CSR_MCOUNTINHIBIT, (unsigned long)&trap); + if (!trap.cause) { + csr_write_allowed(CSR_MCOUNTINHIBIT, (unsigned long)&trap, val); + if (!trap.cause) + hfeatures->features |= SBI_HART_HAS_MCOUNTINHIBIT; + } + /* Detect if hart supports time CSR */ csr_read_allowed(CSR_TIME, (unsigned long)&trap); if (!trap.cause) |