summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorAtish Patra <atish.patra@wdc.com>2020-05-10 02:47:28 +0300
committerAnup Patel <anup@brainfault.org>2020-05-10 07:35:41 +0300
commitb2df751acfd2858f2370d896f91543593647b243 (patch)
tree75bb454392222a4686dbf12191ce3831738662d6 /lib/utils
parent6a053f6e6cb4db8a291239e882e9a778c2738e0a (diff)
downloadopensbi-b2df751acfd2858f2370d896f91543593647b243.tar.xz
platform: Move platform features to hart
PMP & performance counters belong to a hart rather than a platform. In addition to that, these features enable reading/writing from a particular csr. Thus, they can be detected and set at runtime rather than compile time. Move PMP/MCOUNTEREN/SCOUNTEREN features to hart and detect them at runtime. Signed-off-by: Atish Patra <atish.patra@wdc.com> Tested-by: Jonathan Balkind <jbalkind@cs.princeton.edu> Reviewed-by: Anup Patel <anup.patel@wdc.com>
Diffstat (limited to 'lib/utils')
-rw-r--r--lib/utils/fdt/fdt_fixup.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/fdt/fdt_fixup.c b/lib/utils/fdt/fdt_fixup.c
index e209cb6..e69ba1d 100644
--- a/lib/utils/fdt/fdt_fixup.c
+++ b/lib/utils/fdt/fdt_fixup.c
@@ -11,6 +11,7 @@
#include <sbi/riscv_asm.h>
#include <sbi/sbi_console.h>
#include <sbi/sbi_math.h>
+#include <sbi/sbi_hart.h>
#include <sbi/sbi_platform.h>
#include <sbi/sbi_scratch.h>
#include <sbi/sbi_string.h>
@@ -143,7 +144,6 @@ static int fdt_resv_memory_update_node(void *fdt, unsigned long addr,
int fdt_reserved_memory_fixup(void *fdt)
{
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
- const struct sbi_platform *plat = sbi_platform_ptr(scratch);
unsigned long prot, addr, size;
int parent, i, j;
int err;
@@ -183,7 +183,7 @@ int fdt_reserved_memory_fixup(void *fdt)
return err;
}
- if (!sbi_platform_has_pmp(plat)) {
+ if (!sbi_hart_has_feature(current_hartid(), SBI_HART_HAS_PMP)) {
/* update the DT with firmware start & size even if PMP is not
* supported. This makes sure that supervisor OS is always
* aware of wheren OpenSBI resident memory area.