18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * arch/xtensa/include/asm/xchal_vaddr_remap.h
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Xtensa macros for MMU V3 Support. Deals with re-mapping the Virtual
58c2ecf20Sopenharmony_ci * Memory Addresses from "Virtual == Physical" to their prevvious V2 MMU
68c2ecf20Sopenharmony_ci * mappings (KSEG at 0xD0000000 and KIO at 0XF0000000).
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
98c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
108c2ecf20Sopenharmony_ci * for more details.
118c2ecf20Sopenharmony_ci *
128c2ecf20Sopenharmony_ci * Copyright (C) 2008 - 2012 Tensilica Inc.
138c2ecf20Sopenharmony_ci *
148c2ecf20Sopenharmony_ci * Pete Delaney <piet@tensilica.com>
158c2ecf20Sopenharmony_ci * Marc Gauthier <marc@tensilica.com
168c2ecf20Sopenharmony_ci */
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#ifndef _XTENSA_VECTORS_H
198c2ecf20Sopenharmony_ci#define _XTENSA_VECTORS_H
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#include <asm/core.h>
228c2ecf20Sopenharmony_ci#include <asm/kmem_layout.h>
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#if defined(CONFIG_MMU) && XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
258c2ecf20Sopenharmony_ci#ifdef CONFIG_KERNEL_VIRTUAL_ADDRESS
268c2ecf20Sopenharmony_ci#define KERNELOFFSET			CONFIG_KERNEL_VIRTUAL_ADDRESS
278c2ecf20Sopenharmony_ci#else
288c2ecf20Sopenharmony_ci#define KERNELOFFSET			(CONFIG_KERNEL_LOAD_ADDRESS + \
298c2ecf20Sopenharmony_ci					 XCHAL_KSEG_CACHED_VADDR - \
308c2ecf20Sopenharmony_ci					 XCHAL_KSEG_PADDR)
318c2ecf20Sopenharmony_ci#endif
328c2ecf20Sopenharmony_ci#else
338c2ecf20Sopenharmony_ci#define KERNELOFFSET			CONFIG_KERNEL_LOAD_ADDRESS
348c2ecf20Sopenharmony_ci#endif
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
378c2ecf20Sopenharmony_ci#ifdef CONFIG_VECTORS_ADDR
388c2ecf20Sopenharmony_ci#define VECBASE_VADDR			(CONFIG_VECTORS_ADDR)
398c2ecf20Sopenharmony_ci#else
408c2ecf20Sopenharmony_ci#define VECBASE_VADDR			_vecbase
418c2ecf20Sopenharmony_ci#endif
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci#if XCHAL_HAVE_VECBASE
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ci#define VECTOR_VADDR(offset)		(VECBASE_VADDR + offset)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define USER_VECTOR_VADDR		VECTOR_VADDR(XCHAL_USER_VECOFS)
488c2ecf20Sopenharmony_ci#define KERNEL_VECTOR_VADDR		VECTOR_VADDR(XCHAL_KERNEL_VECOFS)
498c2ecf20Sopenharmony_ci#define DOUBLEEXC_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DOUBLEEXC_VECOFS)
508c2ecf20Sopenharmony_ci#define WINDOW_VECTORS_VADDR		VECTOR_VADDR(XCHAL_WINDOW_OF4_VECOFS)
518c2ecf20Sopenharmony_ci#define INTLEVEL2_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL2_VECOFS)
528c2ecf20Sopenharmony_ci#define INTLEVEL3_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL3_VECOFS)
538c2ecf20Sopenharmony_ci#define INTLEVEL4_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL4_VECOFS)
548c2ecf20Sopenharmony_ci#define INTLEVEL5_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL5_VECOFS)
558c2ecf20Sopenharmony_ci#define INTLEVEL6_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL6_VECOFS)
568c2ecf20Sopenharmony_ci#define INTLEVEL7_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL7_VECOFS)
578c2ecf20Sopenharmony_ci#define DEBUG_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DEBUG_VECOFS)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/*
608c2ecf20Sopenharmony_ci * These XCHAL_* #defines from varian/core.h
618c2ecf20Sopenharmony_ci * are not valid to use with V3 MMU. Non-XCHAL
628c2ecf20Sopenharmony_ci * constants are defined above and should be used.
638c2ecf20Sopenharmony_ci */
648c2ecf20Sopenharmony_ci#undef  XCHAL_VECBASE_RESET_VADDR
658c2ecf20Sopenharmony_ci#undef  XCHAL_USER_VECTOR_VADDR
668c2ecf20Sopenharmony_ci#undef  XCHAL_KERNEL_VECTOR_VADDR
678c2ecf20Sopenharmony_ci#undef  XCHAL_DOUBLEEXC_VECTOR_VADDR
688c2ecf20Sopenharmony_ci#undef  XCHAL_WINDOW_VECTORS_VADDR
698c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL2_VECTOR_VADDR
708c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL3_VECTOR_VADDR
718c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL4_VECTOR_VADDR
728c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL5_VECTOR_VADDR
738c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL6_VECTOR_VADDR
748c2ecf20Sopenharmony_ci#undef  XCHAL_INTLEVEL7_VECTOR_VADDR
758c2ecf20Sopenharmony_ci#undef  XCHAL_DEBUG_VECTOR_VADDR
768c2ecf20Sopenharmony_ci
778c2ecf20Sopenharmony_ci#else
788c2ecf20Sopenharmony_ci
798c2ecf20Sopenharmony_ci#define USER_VECTOR_VADDR		XCHAL_USER_VECTOR_VADDR
808c2ecf20Sopenharmony_ci#define KERNEL_VECTOR_VADDR		XCHAL_KERNEL_VECTOR_VADDR
818c2ecf20Sopenharmony_ci#define DOUBLEEXC_VECTOR_VADDR		XCHAL_DOUBLEEXC_VECTOR_VADDR
828c2ecf20Sopenharmony_ci#define WINDOW_VECTORS_VADDR		XCHAL_WINDOW_VECTORS_VADDR
838c2ecf20Sopenharmony_ci#define INTLEVEL2_VECTOR_VADDR		XCHAL_INTLEVEL2_VECTOR_VADDR
848c2ecf20Sopenharmony_ci#define INTLEVEL3_VECTOR_VADDR		XCHAL_INTLEVEL3_VECTOR_VADDR
858c2ecf20Sopenharmony_ci#define INTLEVEL4_VECTOR_VADDR		XCHAL_INTLEVEL4_VECTOR_VADDR
868c2ecf20Sopenharmony_ci#define INTLEVEL5_VECTOR_VADDR		XCHAL_INTLEVEL5_VECTOR_VADDR
878c2ecf20Sopenharmony_ci#define INTLEVEL6_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
888c2ecf20Sopenharmony_ci#define INTLEVEL7_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
898c2ecf20Sopenharmony_ci#define DEBUG_VECTOR_VADDR		XCHAL_DEBUG_VECTOR_VADDR
908c2ecf20Sopenharmony_ci
918c2ecf20Sopenharmony_ci#endif
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci#endif /* _XTENSA_VECTORS_H */
94