From b2f77f5fa839ab8d55be295b5681848299c9e758 Mon Sep 17 00:00:00 2001 From: Clément Léger Date: Fri, 18 Oct 2024 10:40:06 +0200 Subject: lib: sbi: fwft: factorize menvcfg read/write MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit MENVCFG access will be used as well for double trap, landing pad and shadow stack fwft support. Factorize that in a common function. Signed-off-by: Clément Léger Reviewed-by: Samuel Holland --- include/sbi/riscv_encoding.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/sbi/riscv_encoding.h b/include/sbi/riscv_encoding.h index 22644274..fd34ba76 100644 --- a/include/sbi/riscv_encoding.h +++ b/include/sbi/riscv_encoding.h @@ -214,7 +214,8 @@ #define ENVCFG_STCE (_ULL(1) << 63) #define ENVCFG_PBMTE (_ULL(1) << 62) -#define ENVCFG_ADUE (_ULL(1) << 61) +#define ENVCFG_ADUE_SHIFT 61 +#define ENVCFG_ADUE (_ULL(1) << ENVCFG_ADUE_SHIFT) #define ENVCFG_CDE (_ULL(1) << 60) #define ENVCFG_DTE (_ULL(1) << 59) #define ENVCFG_PMM (_ULL(0x3) << 32) @@ -228,8 +229,10 @@ #define ENVCFG_CBIE_ILL _UL(0x0) #define ENVCFG_CBIE_FLUSH _UL(0x1) #define ENVCFG_CBIE_INV _UL(0x3) -#define ENVCFG_SSE (_UL(1) << 3) -#define ENVCFG_LPE (_UL(1) << 2) +#define ENVCFG_SSE_SHIFT 3 +#define ENVCFG_SSE (_UL(1) << ENVCFG_SSE_SHIFT) +#define ENVCFG_LPE_SHIFT 2 +#define ENVCFG_LPE (_UL(1) << ENVCFG_LPE_SHIFT) #define ENVCFG_FIOM _UL(0x1) /* ===== User-level CSRs ===== */ -- cgit v1.3.1