vectors.h 4.0 KB
Newer Older
M
Max Filippov 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/*
 * arch/xtensa/include/asm/xchal_vaddr_remap.h
 *
 * Xtensa macros for MMU V3 Support. Deals with re-mapping the Virtual
 * Memory Addresses from "Virtual == Physical" to their prevvious V2 MMU
 * mappings (KSEG at 0xD0000000 and KIO at 0XF0000000).
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2008 - 2012 Tensilica Inc.
 *
 * Pete Delaney <piet@tensilica.com>
 * Marc Gauthier <marc@tensilica.com
 */

#ifndef _XTENSA_VECTORS_H
#define _XTENSA_VECTORS_H

#include <variant/core.h>
22
#include <platform/hardware.h>
23
#include <asm/kmem_layout.h>
M
Max Filippov 已提交
24

25
#if XCHAL_HAVE_PTP_MMU
26 27
#define XCHAL_KIO_CACHED_VADDR		0xe0000000
#define XCHAL_KIO_BYPASS_VADDR		0xf0000000
28
#define XCHAL_KIO_DEFAULT_PADDR		0xf0000000
29 30 31 32
#else
#define XCHAL_KIO_BYPASS_VADDR		XCHAL_KIO_PADDR
#define XCHAL_KIO_DEFAULT_PADDR		0x90000000
#endif
33 34
#define XCHAL_KIO_SIZE			0x10000000

35
#if (!XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY) && defined(CONFIG_OF)
36
#define XCHAL_KIO_PADDR			xtensa_get_kio_paddr()
37 38 39 40 41 42 43 44
#ifndef __ASSEMBLY__
extern unsigned long xtensa_kio_paddr;

static inline unsigned long xtensa_get_kio_paddr(void)
{
	return xtensa_kio_paddr;
}
#endif
45 46 47 48
#else
#define XCHAL_KIO_PADDR			XCHAL_KIO_DEFAULT_PADDR
#endif

M
Max Filippov 已提交
49 50
#if defined(CONFIG_MMU)

51
#if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
M
Max Filippov 已提交
52
/* Image Virtual Start Address */
53 54 55
#define KERNELOFFSET			(XCHAL_KSEG_CACHED_VADDR + \
					 CONFIG_KERNEL_LOAD_ADDRESS - \
					 XCHAL_KSEG_PADDR)
M
Max Filippov 已提交
56
#else
57
#define KERNELOFFSET			CONFIG_KERNEL_LOAD_ADDRESS
M
Max Filippov 已提交
58 59 60 61 62
#endif

#else /* !defined(CONFIG_MMU) */
  /* MMU Not being used - Virtual == Physical */

63 64
/* Location of the start of the kernel text, _start */
#define KERNELOFFSET			CONFIG_KERNEL_LOAD_ADDRESS
M
Max Filippov 已提交
65

66

M
Max Filippov 已提交
67 68
#endif /* CONFIG_MMU */

69 70
#define RESET_VECTOR1_VADDR		(XCHAL_RESET_VECTOR1_VADDR)
#define VECBASE_VADDR			(KERNELOFFSET - CONFIG_VECTORS_OFFSET)
M
Max Filippov 已提交
71

72
#if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
M
Max Filippov 已提交
73

74
#define VECTOR_VADDR(offset)		(VECBASE_VADDR + offset)
M
Max Filippov 已提交
75

76 77 78 79 80 81 82 83 84 85 86
#define USER_VECTOR_VADDR		VECTOR_VADDR(XCHAL_USER_VECOFS)
#define KERNEL_VECTOR_VADDR		VECTOR_VADDR(XCHAL_KERNEL_VECOFS)
#define DOUBLEEXC_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DOUBLEEXC_VECOFS)
#define WINDOW_VECTORS_VADDR		VECTOR_VADDR(XCHAL_WINDOW_OF4_VECOFS)
#define INTLEVEL2_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL2_VECOFS)
#define INTLEVEL3_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL3_VECOFS)
#define INTLEVEL4_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL4_VECOFS)
#define INTLEVEL5_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL5_VECOFS)
#define INTLEVEL6_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL6_VECOFS)
#define INTLEVEL7_VECTOR_VADDR		VECTOR_VADDR(XCHAL_INTLEVEL7_VECOFS)
#define DEBUG_VECTOR_VADDR		VECTOR_VADDR(XCHAL_DEBUG_VECOFS)
M
Max Filippov 已提交
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103

/*
 * These XCHAL_* #defines from varian/core.h
 * are not valid to use with V3 MMU. Non-XCHAL
 * constants are defined above and should be used.
 */
#undef  XCHAL_VECBASE_RESET_VADDR
#undef  XCHAL_USER_VECTOR_VADDR
#undef  XCHAL_KERNEL_VECTOR_VADDR
#undef  XCHAL_DOUBLEEXC_VECTOR_VADDR
#undef  XCHAL_WINDOW_VECTORS_VADDR
#undef  XCHAL_INTLEVEL2_VECTOR_VADDR
#undef  XCHAL_INTLEVEL3_VECTOR_VADDR
#undef  XCHAL_INTLEVEL4_VECTOR_VADDR
#undef  XCHAL_INTLEVEL5_VECTOR_VADDR
#undef  XCHAL_INTLEVEL6_VECTOR_VADDR
#undef  XCHAL_INTLEVEL7_VECTOR_VADDR
104
#undef  XCHAL_DEBUG_VECTOR_VADDR
M
Max Filippov 已提交
105 106 107 108 109 110 111 112 113 114 115 116

#else

#define USER_VECTOR_VADDR		XCHAL_USER_VECTOR_VADDR
#define KERNEL_VECTOR_VADDR		XCHAL_KERNEL_VECTOR_VADDR
#define DOUBLEEXC_VECTOR_VADDR		XCHAL_DOUBLEEXC_VECTOR_VADDR
#define WINDOW_VECTORS_VADDR		XCHAL_WINDOW_VECTORS_VADDR
#define INTLEVEL2_VECTOR_VADDR		XCHAL_INTLEVEL2_VECTOR_VADDR
#define INTLEVEL3_VECTOR_VADDR		XCHAL_INTLEVEL3_VECTOR_VADDR
#define INTLEVEL4_VECTOR_VADDR		XCHAL_INTLEVEL4_VECTOR_VADDR
#define INTLEVEL5_VECTOR_VADDR		XCHAL_INTLEVEL5_VECTOR_VADDR
#define INTLEVEL6_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
117
#define INTLEVEL7_VECTOR_VADDR		XCHAL_INTLEVEL6_VECTOR_VADDR
M
Max Filippov 已提交
118 119 120 121 122
#define DEBUG_VECTOR_VADDR		XCHAL_DEBUG_VECTOR_VADDR

#endif

#endif /* _XTENSA_VECTORS_H */