summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2026-04-30 14:55:20 +1000
committerAnup Patel <anup@brainfault.org>2026-06-10 13:17:30 +0530
commite9797b5e574c87332679a30e542b519c93e650ca (patch)
treed66a8a5fff4eae36a54c7256eb3996897f70be6c /include
parentc93a89f214ecbad7af3de54842ee93960aaf0d15 (diff)
downloadopensbi-e9797b5e574c87332679a30e542b519c93e650ca.tar.gz
opensbi-e9797b5e574c87332679a30e542b519c93e650ca.zip
lib: sbi: Move RISC-V PMP encoding functions to sbi_pmp.c
Create a new file for handling the RISC-V PMP format and the new pmp_t type, as opposed to hart PMP CSR specific access. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20260430045528.420437-4-npiggin@gmail.com Signed-off-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_pmp.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/include/sbi/sbi_pmp.h b/include/sbi/sbi_pmp.h
new file mode 100644
index 00000000..c38dda55
--- /dev/null
+++ b/include/sbi/sbi_pmp.h
@@ -0,0 +1,22 @@
+/*
+ * SPDX-FileCopyrightText: (c) 2025-2026 Tenstorrent USA, Inc.
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#ifndef __SBI_PMP_H__
+#define __SBI_PMP_H__
+
+#include <sbi/sbi_types.h>
+
+struct pmp {
+ unsigned long addr;
+ u8 cfg;
+};
+typedef struct pmp pmp_t;
+
+int sbi_pmp_encode(pmp_t *pmp, unsigned long prot, unsigned long addr,
+ unsigned long log2len);
+int sbi_pmp_decode(pmp_t *pmp, unsigned long *prot, unsigned long *addr,
+ unsigned long *log2len);
+
+#endif