/** Possible feature flags of a hart */
enum sbi_hart_features {
- /** Hart has PMP support */
- SBI_HART_HAS_PMP = (1 << 0),
/** Hart has S-mode counter enable */
- SBI_HART_HAS_SCOUNTEREN = (1 << 1),
+ SBI_HART_HAS_SCOUNTEREN = (1 << 0),
/** Hart has M-mode counter enable */
- SBI_HART_HAS_MCOUNTEREN = (1 << 2),
+ SBI_HART_HAS_MCOUNTEREN = (1 << 1),
/** HART has timer csr implementation in hardware */
- SBI_HART_HAS_TIME = (1 << 3),
+ SBI_HART_HAS_TIME = (1 << 2),
/** Last index of Hart features*/
SBI_HART_HAS_LAST_FEATURE = SBI_HART_HAS_TIME,
unsigned long prot, addr, size;
unsigned int i, pmp_count;
- if (!sbi_hart_has_feature(scratch, SBI_HART_HAS_PMP))
- return;
-
pmp_count = sbi_hart_pmp_count(scratch);
for (i = 0; i < pmp_count; i++) {
pmp_get(i, &prot, &addr, &size);
unsigned long prot, size, tempaddr;
unsigned int i, pmp_count;
- if (!sbi_hart_has_feature(scratch, SBI_HART_HAS_PMP))
- return SBI_OK;
-
pmp_count = sbi_hart_pmp_count(scratch);
for (i = 0; i < pmp_count; i++) {
pmp_get(i, &prot, &tempaddr, &size);
ulong prot, addr, log2size;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
- if (!sbi_hart_has_feature(scratch, SBI_HART_HAS_PMP))
+ if (!sbi_hart_pmp_count(scratch))
return 0;
/* Firmware PMP region to protect OpenSBI firmware */
return NULL;
switch (feature) {
- case SBI_HART_HAS_PMP:
- fstr = "pmp";
- break;
case SBI_HART_HAS_SCOUNTEREN:
fstr = "scounteren";
break;
__detect_pmp(CSR_PMPADDR15);
#undef __detect_pmp
- /* Set hart PMP feature if we have at least one PMP region */
- if (hfeatures->pmp_count)
- hfeatures->features |= SBI_HART_HAS_PMP;
-
/* Detect if hart supports SCOUNTEREN feature */
trap.cause = 0;
val = csr_read_allowed(CSR_SCOUNTEREN, (unsigned long)&trap);
* With above assumption, we create child nodes directly.
*/
- if (!sbi_hart_has_feature(scratch, SBI_HART_HAS_PMP)) {
+ if (!sbi_hart_pmp_count(scratch)) {
/*
* Update the DT with firmware start & size even if PMP is not
* supported. This makes sure that supervisor OS is always