1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (C) 2005-2017 Andes Technology Corporation
4 #ifndef _ASM_NDS32_NDS32_H_
5 #define _ASM_NDS32_NDS32_H_
7 #include <asm/bitfield.h>
8 #include <asm/cachectl.h>
11 #include <linux/init.h>
12 #include <asm/barrier.h>
13 #include <nds32_intrinsic.h>
15 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
16 #define FP_OFFSET (-3)
18 #define FP_OFFSET (-2)
20 #define LP_OFFSET (-1)
22 extern void __init
early_trap_init(void);
23 static inline void GIE_ENABLE(void)
29 static inline void GIE_DISABLE(void)
35 static inline unsigned long CACHE_SET(unsigned char cache
)
39 return 64 << ((__nds32__mfsr(NDS32_SR_ICM_CFG
) & ICM_CFG_mskISET
) >>
42 return 64 << ((__nds32__mfsr(NDS32_SR_DCM_CFG
) & DCM_CFG_mskDSET
) >>
46 static inline unsigned long CACHE_WAY(unsigned char cache
)
51 ((__nds32__mfsr(NDS32_SR_ICM_CFG
) & ICM_CFG_mskIWAY
) >> ICM_CFG_offIWAY
);
54 ((__nds32__mfsr(NDS32_SR_DCM_CFG
) & DCM_CFG_mskDWAY
) >> DCM_CFG_offDWAY
);
57 static inline unsigned long CACHE_LINE_SIZE(unsigned char cache
)
62 (((__nds32__mfsr(NDS32_SR_ICM_CFG
) & ICM_CFG_mskISZ
) >> ICM_CFG_offISZ
) - 1);
65 (((__nds32__mfsr(NDS32_SR_DCM_CFG
) & DCM_CFG_mskDSZ
) >> DCM_CFG_offDSZ
) - 1);
68 #endif /* __ASSEMBLY__ */
70 #define IVB_BASE PHYS_OFFSET /* in user space for intr/exc/trap/break table base, 64KB aligned
71 * We defined at the start of the physical memory */
73 /* dispatched sub-entry exception handler numbering */
74 #define RD_PROT 0 /* read protrection */
75 #define WRT_PROT 1 /* write protection */
76 #define NOEXEC 2 /* non executable */
77 #define PAGE_MODIFY 3 /* page modified */
78 #define ACC_BIT 4 /* access bit */
79 #define RESVED_PTE 5 /* reserved PTE attribute */
82 #endif /* _ASM_NDS32_NDS32_H_ */