vectors.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. #ifndef _XTENSA_VECTORS_H
  18. #define _XTENSA_VECTORS_H
  19. #include <variant/core.h>
  20. #include <platform/hardware.h>
  21. #include <asm/kmem_layout.h>
  22. #if XCHAL_HAVE_PTP_MMU
  23. #define XCHAL_KIO_CACHED_VADDR 0xe0000000
  24. #define XCHAL_KIO_BYPASS_VADDR 0xf0000000
  25. #define XCHAL_KIO_DEFAULT_PADDR 0xf0000000
  26. #else
  27. #define XCHAL_KIO_BYPASS_VADDR XCHAL_KIO_PADDR
  28. #define XCHAL_KIO_DEFAULT_PADDR 0x90000000
  29. #endif
  30. #define XCHAL_KIO_SIZE 0x10000000
  31. #if (!XCHAL_HAVE_PTP_MMU || XCHAL_HAVE_SPANNING_WAY) && defined(CONFIG_OF)
  32. #define XCHAL_KIO_PADDR xtensa_get_kio_paddr()
  33. #ifndef __ASSEMBLY__
  34. extern unsigned long xtensa_kio_paddr;
  35. static inline unsigned long xtensa_get_kio_paddr(void)
  36. {
  37. return xtensa_kio_paddr;
  38. }
  39. #endif
  40. #else
  41. #define XCHAL_KIO_PADDR XCHAL_KIO_DEFAULT_PADDR
  42. #endif
  43. #if defined(CONFIG_MMU)
  44. #if XCHAL_HAVE_PTP_MMU && XCHAL_HAVE_SPANNING_WAY
  45. /* Image Virtual Start Address */
  46. #define KERNELOFFSET (XCHAL_KSEG_CACHED_VADDR + \
  47. CONFIG_KERNEL_LOAD_ADDRESS - \
  48. XCHAL_KSEG_PADDR)
  49. #else
  50. #define KERNELOFFSET CONFIG_KERNEL_LOAD_ADDRESS
  51. #endif
  52. #else /* !defined(CONFIG_MMU) */
  53. /* MMU Not being used - Virtual == Physical */
  54. /* Location of the start of the kernel text, _start */
  55. #define KERNELOFFSET CONFIG_KERNEL_LOAD_ADDRESS
  56. #endif /* CONFIG_MMU */
  57. #define RESET_VECTOR1_VADDR (XCHAL_RESET_VECTOR1_VADDR)
  58. #define VECBASE_VADDR (KERNELOFFSET - CONFIG_VECTORS_OFFSET)
  59. #if defined(XCHAL_HAVE_VECBASE) && XCHAL_HAVE_VECBASE
  60. #define VECTOR_VADDR(offset) (VECBASE_VADDR + offset)
  61. #define USER_VECTOR_VADDR VECTOR_VADDR(XCHAL_USER_VECOFS)
  62. #define KERNEL_VECTOR_VADDR VECTOR_VADDR(XCHAL_KERNEL_VECOFS)
  63. #define DOUBLEEXC_VECTOR_VADDR VECTOR_VADDR(XCHAL_DOUBLEEXC_VECOFS)
  64. #define WINDOW_VECTORS_VADDR VECTOR_VADDR(XCHAL_WINDOW_OF4_VECOFS)
  65. #define INTLEVEL2_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL2_VECOFS)
  66. #define INTLEVEL3_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL3_VECOFS)
  67. #define INTLEVEL4_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL4_VECOFS)
  68. #define INTLEVEL5_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL5_VECOFS)
  69. #define INTLEVEL6_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL6_VECOFS)
  70. #define INTLEVEL7_VECTOR_VADDR VECTOR_VADDR(XCHAL_INTLEVEL7_VECOFS)
  71. #define DEBUG_VECTOR_VADDR VECTOR_VADDR(XCHAL_DEBUG_VECOFS)
  72. /*
  73. * These XCHAL_* #defines from varian/core.h
  74. * are not valid to use with V3 MMU. Non-XCHAL
  75. * constants are defined above and should be used.
  76. */
  77. #undef XCHAL_VECBASE_RESET_VADDR
  78. #undef XCHAL_USER_VECTOR_VADDR
  79. #undef XCHAL_KERNEL_VECTOR_VADDR
  80. #undef XCHAL_DOUBLEEXC_VECTOR_VADDR
  81. #undef XCHAL_WINDOW_VECTORS_VADDR
  82. #undef XCHAL_INTLEVEL2_VECTOR_VADDR
  83. #undef XCHAL_INTLEVEL3_VECTOR_VADDR
  84. #undef XCHAL_INTLEVEL4_VECTOR_VADDR
  85. #undef XCHAL_INTLEVEL5_VECTOR_VADDR
  86. #undef XCHAL_INTLEVEL6_VECTOR_VADDR
  87. #undef XCHAL_INTLEVEL7_VECTOR_VADDR
  88. #undef XCHAL_DEBUG_VECTOR_VADDR
  89. #else
  90. #define USER_VECTOR_VADDR XCHAL_USER_VECTOR_VADDR
  91. #define KERNEL_VECTOR_VADDR XCHAL_KERNEL_VECTOR_VADDR
  92. #define DOUBLEEXC_VECTOR_VADDR XCHAL_DOUBLEEXC_VECTOR_VADDR
  93. #define WINDOW_VECTORS_VADDR XCHAL_WINDOW_VECTORS_VADDR
  94. #define INTLEVEL2_VECTOR_VADDR XCHAL_INTLEVEL2_VECTOR_VADDR
  95. #define INTLEVEL3_VECTOR_VADDR XCHAL_INTLEVEL3_VECTOR_VADDR
  96. #define INTLEVEL4_VECTOR_VADDR XCHAL_INTLEVEL4_VECTOR_VADDR
  97. #define INTLEVEL5_VECTOR_VADDR XCHAL_INTLEVEL5_VECTOR_VADDR
  98. #define INTLEVEL6_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR
  99. #define INTLEVEL7_VECTOR_VADDR XCHAL_INTLEVEL6_VECTOR_VADDR
  100. #define DEBUG_VECTOR_VADDR XCHAL_DEBUG_VECTOR_VADDR
  101. #endif
  102. #endif /* _XTENSA_VECTORS_H */