Files
opensbi/include/sbi/sbi_hart_pmp.h
T
Nicholas Piggin a59c8fb9fb lib: sbi: Move hart PMP functions to sbi_hart_pmp.c
The sbi_hart_pmp.c looks like a good place for the hart PMP CSR
access functions.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260430045528.420437-9-npiggin@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
2026-06-10 17:55:33 +05:30

34 lines
946 B
C

/*
* SPDX-License-Identifier: BSD-2-Clause
*
* Copyright (c) 2025 Ventana Micro Systems Inc.
*/
#ifndef __SBI_HART_PMP_H__
#define __SBI_HART_PMP_H__
#include <sbi/sbi_types.h>
/* Disable pmp entry at a given index */
int sbi_hart_pmp_disable(unsigned int n);
/* Check if the matching field is set */
bool sbi_hart_is_pmp_enabled(unsigned int n);
int sbi_hart_pmp_set(unsigned int n, unsigned long prot,
unsigned long addr, unsigned long log2len);
int sbi_hart_pmp_get(unsigned int n, unsigned long *prot_out,
unsigned long *addr_out, unsigned long *log2len);
struct sbi_scratch;
unsigned int sbi_hart_pmp_count(struct sbi_scratch *scratch);
unsigned int sbi_hart_pmp_log2gran(struct sbi_scratch *scratch);
unsigned int sbi_hart_pmp_addrbits(struct sbi_scratch *scratch);
bool sbi_hart_smepmp_is_fw_region(unsigned int pmp_idx);
void sbi_hart_pmp_fence(void);
int sbi_hart_pmp_init(struct sbi_scratch *scratch);
#endif