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>
This commit is contained in:
Nicholas Piggin
2026-04-30 14:55:20 +10:00
committed by Anup Patel
parent c93a89f214
commit e9797b5e57
4 changed files with 122 additions and 90 deletions
+22
View File
@@ -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