SBI_HART_HAS_SCOUNTEREN = (1 << 0),
/** Hart has M-mode counter enable */
SBI_HART_HAS_MCOUNTEREN = (1 << 1),
+ /** Hart has counter inhibit CSR */
+ SBI_HART_HAS_MCOUNTINHIBIT = (1 << 2),
/** HART has timer csr implementation in hardware */
- SBI_HART_HAS_TIME = (1 << 2),
+ SBI_HART_HAS_TIME = (1 << 3),
/** Last index of Hart features*/
SBI_HART_HAS_LAST_FEATURE = SBI_HART_HAS_TIME,
case SBI_HART_HAS_MCOUNTEREN:
fstr = "mcounteren";
break;
+ case SBI_HART_HAS_MCOUNTINHIBIT:
+ fstr = "mcountinhibit";
+ break;
case SBI_HART_HAS_TIME:
fstr = "time";
break;
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)