/arch/tile/include/arch/spr_def.h

https://bitbucket.org/ndreys/linux-sunxi · C++ Header · 113 lines · 71 code · 17 blank · 25 comment · 3 complexity · f3e641a8ba2866e42462512bde3b5112 MD5 · raw file

  1. /*
  2. * Copyright 2010 Tilera Corporation. All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation, version 2.
  7. *
  8. * This program is distributed in the hope that it will be useful, but
  9. * WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  11. * NON INFRINGEMENT. See the GNU General Public License for
  12. * more details.
  13. */
  14. /* Include the proper base SPR definition file. */
  15. #ifdef __tilegx__
  16. #include <arch/spr_def_64.h>
  17. #else
  18. #include <arch/spr_def_32.h>
  19. #endif
  20. #ifdef __KERNEL__
  21. /*
  22. * In addition to including the proper base SPR definition file, depending
  23. * on machine architecture, this file defines several macros which allow
  24. * kernel code to use protection-level dependent SPRs without worrying
  25. * about which PL it's running at. In these macros, the PL that the SPR
  26. * or interrupt number applies to is replaced by K.
  27. */
  28. #if CONFIG_KERNEL_PL != 1 && CONFIG_KERNEL_PL != 2
  29. #error CONFIG_KERNEL_PL must be 1 or 2
  30. #endif
  31. /* Concatenate 4 strings. */
  32. #define __concat4(a, b, c, d) a ## b ## c ## d
  33. #define _concat4(a, b, c, d) __concat4(a, b, c, d)
  34. #ifdef __tilegx__
  35. /* TILE-Gx dependent, protection-level dependent SPRs. */
  36. #define SPR_INTERRUPT_MASK_K \
  37. _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL,,)
  38. #define SPR_INTERRUPT_MASK_SET_K \
  39. _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL,,)
  40. #define SPR_INTERRUPT_MASK_RESET_K \
  41. _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL,,)
  42. #define SPR_INTERRUPT_VECTOR_BASE_K \
  43. _concat4(SPR_INTERRUPT_VECTOR_BASE_, CONFIG_KERNEL_PL,,)
  44. #define SPR_IPI_MASK_K \
  45. _concat4(SPR_IPI_MASK_, CONFIG_KERNEL_PL,,)
  46. #define SPR_IPI_MASK_RESET_K \
  47. _concat4(SPR_IPI_MASK_RESET_, CONFIG_KERNEL_PL,,)
  48. #define SPR_IPI_MASK_SET_K \
  49. _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,)
  50. #define SPR_IPI_EVENT_K \
  51. _concat4(SPR_IPI_EVENT_, CONFIG_KERNEL_PL,,)
  52. #define SPR_IPI_EVENT_RESET_K \
  53. _concat4(SPR_IPI_EVENT_RESET_, CONFIG_KERNEL_PL,,)
  54. #define SPR_IPI_MASK_SET_K \
  55. _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,)
  56. #define INT_IPI_K \
  57. _concat4(INT_IPI_, CONFIG_KERNEL_PL,,)
  58. #define SPR_SINGLE_STEP_CONTROL_K \
  59. _concat4(SPR_SINGLE_STEP_CONTROL_, CONFIG_KERNEL_PL,,)
  60. #define SPR_SINGLE_STEP_EN_K_K \
  61. _concat4(SPR_SINGLE_STEP_EN_, CONFIG_KERNEL_PL, _, CONFIG_KERNEL_PL)
  62. #define INT_SINGLE_STEP_K \
  63. _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,)
  64. #else
  65. /* TILEPro dependent, protection-level dependent SPRs. */
  66. #define SPR_INTERRUPT_MASK_K_0 \
  67. _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _0,)
  68. #define SPR_INTERRUPT_MASK_K_1 \
  69. _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _1,)
  70. #define SPR_INTERRUPT_MASK_SET_K_0 \
  71. _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _0,)
  72. #define SPR_INTERRUPT_MASK_SET_K_1 \
  73. _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _1,)
  74. #define SPR_INTERRUPT_MASK_RESET_K_0 \
  75. _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _0,)
  76. #define SPR_INTERRUPT_MASK_RESET_K_1 \
  77. _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _1,)
  78. #endif
  79. /* Generic protection-level dependent SPRs. */
  80. #define SPR_SYSTEM_SAVE_K_0 \
  81. _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _0,)
  82. #define SPR_SYSTEM_SAVE_K_1 \
  83. _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _1,)
  84. #define SPR_SYSTEM_SAVE_K_2 \
  85. _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _2,)
  86. #define SPR_SYSTEM_SAVE_K_3 \
  87. _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _3,)
  88. #define SPR_EX_CONTEXT_K_0 \
  89. _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _0,)
  90. #define SPR_EX_CONTEXT_K_1 \
  91. _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _1,)
  92. #define SPR_INTCTRL_K_STATUS \
  93. _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,)
  94. #define INT_INTCTRL_K \
  95. _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,)
  96. #endif /* __KERNEL__ */