Re: [PATCH] lib: Allow custom CSRs in csr_read_num() and csr_write_num()

Andrew Jones
2025-09-30T15:47:32Z

On Tue, Sep 30, 2025 at 09:02:16PM +0530, Anup Patel wrote:
> Some of the platforms use platform specific CSR access functions for
> configuring implementation specific CSRs (such as PMA registers).
>
> Extend the common csr_read_num() and csr_write_num() to allow custom
> CSRs so that platform specific CSR access functions are not needed.
>
> Signed-off-by: Anup Patel <apatel@ventanamicro.com>
> ---
> include/sbi/riscv_encoding.h | 34 ++++++++
> lib/sbi/riscv_asm.c | 135 ++++++++++++++++++-----------
> platform/generic/andes/andes_pma.c | 90 ++-----------------
> platform/generic/mips/p8700.c | 76 +---------------
> 4 files changed, 127 insertions(+), 208 deletions(-)
>

Reviewed-by: Andrew Jones <ajones@ventanamicro.com>