18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ARCH_ARM_FAULT_H 38c2ecf20Sopenharmony_ci#define __ARCH_ARM_FAULT_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci/* 68c2ecf20Sopenharmony_ci * Fault status register encodings. We steal bit 31 for our own purposes. 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci#define FSR_LNX_PF (1 << 31) 98c2ecf20Sopenharmony_ci#define FSR_CM (1 << 13) 108c2ecf20Sopenharmony_ci#define FSR_WRITE (1 << 11) 118c2ecf20Sopenharmony_ci#define FSR_FS4 (1 << 10) 128c2ecf20Sopenharmony_ci#define FSR_FS3_0 (15) 138c2ecf20Sopenharmony_ci#define FSR_FS5_0 (0x3f) 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#ifdef CONFIG_ARM_LPAE 168c2ecf20Sopenharmony_ci#define FSR_FS_AEA 17 178c2ecf20Sopenharmony_ci#define FS_PERM_NOLL 0xC 188c2ecf20Sopenharmony_ci#define FS_PERM_NOLL_MASK 0x3C 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_cistatic inline int fsr_fs(unsigned int fsr) 218c2ecf20Sopenharmony_ci{ 228c2ecf20Sopenharmony_ci return fsr & FSR_FS5_0; 238c2ecf20Sopenharmony_ci} 248c2ecf20Sopenharmony_ci#else 258c2ecf20Sopenharmony_ci#define FSR_FS_AEA 22 268c2ecf20Sopenharmony_ci#define FS_L1_PERM 0xD 278c2ecf20Sopenharmony_ci#define FS_L2_PERM 0xF 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic inline int fsr_fs(unsigned int fsr) 308c2ecf20Sopenharmony_ci{ 318c2ecf20Sopenharmony_ci return (fsr & FSR_FS3_0) | (fsr & FSR_FS4) >> 6; 328c2ecf20Sopenharmony_ci} 338c2ecf20Sopenharmony_ci#endif 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_civoid do_bad_area(unsigned long addr, unsigned int fsr, struct pt_regs *regs); 368c2ecf20Sopenharmony_civoid early_abt_enable(void); 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci#endif /* __ARCH_ARM_FAULT_H */ 39