xref: /linux/arch/xtensa/include/asm/vectors.h (revision 6591685d50043f615a1ad7ddd5bb263ef54808fc)
1 /*
2  * arch/xtensa/include/asm/xchal_vaddr_remap.h
3  *
4  * Xtensa macros for MMU V3 Support. Deals with re-mapping the Virtual
5  * Memory Addresses from "Virtual == Physical" to their prevvious V2 MMU
6  * mappings (KSEG at 0xD0000000 and KIO at 0XF0000000).
7  *
8  * This file is subject to the terms and conditions of the GNU General Public
9  * License.  See the file "COPYING" in the main directory of this archive
10  * for more details.
11  *
12  * Copyright (C) 2008 - 2012 Tensilica Inc.
13  *
14  * Pete Delaney <piet@tensilica.com>
15  * Marc Gauthier <marc@tensilica.com
16  */
17 
18 #ifndef _XTENSA_VECTORS_H
19 #define _XTENSA_VECTORS_H
20 
21 #include <asm/core.h>
22 #include <asm/kmem_layout.h>
23 
24 #if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
25 #define KERNELOFFSET			(CONFIG_KERNEL_LOAD_ADDRESS + \
26 					 XCHAL_KSEG_CACHED_VADDR - \
27 					 XCHAL_KSEG_PADDR)
28 #else
29 #define KERNELOFFSET			CONFIG_KERNEL_LOAD_ADDRESS
30 #endif
31 
32 #define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
33 #ifdef CONFIG_VECTORS_OFFSET
34 #define VECBASE_VADDR			(KERNELOFFSET - CONFIG_VECTORS_OFFSET)
35 #else
36 #define VECBASE_VADDR			_vecbase
37 #endif
38 
39 #if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
40 
41 #define VECTOR_VADDR(offset)		(VECBASE_VADDR + offset)
42 
43 #define USER_VECTOR_VADDR		VECTOR_VADDR(XCHAL_USER_VECOFS)
44 #define KERNEL_VECTOR_VADDR		VECTOR_VADDR(XCHAL_KERNEL_VECOFS)
45 #define DOUBLEEXC_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DOUBLEEXC_VECOFS)
46 #define WINDOW_VECTORS_VADDR		VECTOR_VADDR(XCHAL_WINDOW_OF4_VECOFS)
47 #define INTLEVEL2_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL2_VECOFS)
48 #define INTLEVEL3_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL3_VECOFS)
49 #define INTLEVEL4_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL4_VECOFS)
50 #define INTLEVEL5_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL5_VECOFS)
51 #define INTLEVEL6_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL6_VECOFS)
52 #define INTLEVEL7_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL7_VECOFS)
53 #define DEBUG_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DEBUG_VECOFS)
54 
55 /*
56  * These XCHAL_* #defines from varian/core.h
57  * are not valid to use with V3 MMU. Non-XCHAL
58  * constants are defined above and should be used.
59  */
60 #undef  XCHAL_VECBASE_RESET_VADDR
61 #undef  XCHAL_USER_VECTOR_VADDR
62 #undef  XCHAL_KERNEL_VECTOR_VADDR
63 #undef  XCHAL_DOUBLEEXC_VECTOR_VADDR
64 #undef  XCHAL_WINDOW_VECTORS_VADDR
65 #undef  XCHAL_INTLEVEL2_VECTOR_VADDR
66 #undef  XCHAL_INTLEVEL3_VECTOR_VADDR
67 #undef  XCHAL_INTLEVEL4_VECTOR_VADDR
68 #undef  XCHAL_INTLEVEL5_VECTOR_VADDR
69 #undef  XCHAL_INTLEVEL6_VECTOR_VADDR
70 #undef  XCHAL_INTLEVEL7_VECTOR_VADDR
71 #undef  XCHAL_DEBUG_VECTOR_VADDR
72 
73 #else
74 
75 #define USER_VECTOR_VADDR		XCHAL_USER_VECTOR_VADDR
76 #define KERNEL_VECTOR_VADDR		XCHAL_KERNEL_VECTOR_VADDR
77 #define DOUBLEEXC_VECTOR_VADDR		XCHAL_DOUBLEEXC_VECTOR_VADDR
78 #define WINDOW_VECTORS_VADDR		XCHAL_WINDOW_VECTORS_VADDR
79 #define INTLEVEL2_VECTOR_VADDR		XCHAL_INTLEVEL2_VECTOR_VADDR
80 #define INTLEVEL3_VECTOR_VADDR		XCHAL_INTLEVEL3_VECTOR_VADDR
81 #define INTLEVEL4_VECTOR_VADDR		XCHAL_INTLEVEL4_VECTOR_VADDR
82 #define INTLEVEL5_VECTOR_VADDR		XCHAL_INTLEVEL5_VECTOR_VADDR
83 #define INTLEVEL6_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
84 #define INTLEVEL7_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
85 #define DEBUG_VECTOR_VADDR		XCHAL_DEBUG_VECTOR_VADDR
86 
87 #endif
88 
89 #endif /* _XTENSA_VECTORS_H */
90