2 * Copyright 2010 Tilera Corporation. All Rights Reserved.
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.
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
14 #ifndef __ARCH_SPR_DEF_H__
15 #define __ARCH_SPR_DEF_H__
17 #include <uapi/arch/spr_def.h>
21 * In addition to including the proper base SPR definition file, depending
22 * on machine architecture, this file defines several macros which allow
23 * kernel code to use protection-level dependent SPRs without worrying
24 * about which PL it's running at. In these macros, the PL that the SPR
25 * or interrupt number applies to is replaced by K.
28 #if CONFIG_KERNEL_PL != 1 && CONFIG_KERNEL_PL != 2
29 #error CONFIG_KERNEL_PL must be 1 or 2
32 /* Concatenate 4 strings. */
33 #define __concat4(a, b, c, d) a ## b ## c ## d
34 #define _concat4(a, b, c, d) __concat4(a, b, c, d)
38 /* TILE-Gx dependent, protection-level dependent SPRs. */
40 #define SPR_INTERRUPT_MASK_K \
41 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL,,)
42 #define SPR_INTERRUPT_MASK_SET_K \
43 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL,,)
44 #define SPR_INTERRUPT_MASK_RESET_K \
45 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL,,)
46 #define SPR_INTERRUPT_VECTOR_BASE_K \
47 _concat4(SPR_INTERRUPT_VECTOR_BASE_, CONFIG_KERNEL_PL,,)
49 #define SPR_IPI_MASK_K \
50 _concat4(SPR_IPI_MASK_, CONFIG_KERNEL_PL,,)
51 #define SPR_IPI_MASK_RESET_K \
52 _concat4(SPR_IPI_MASK_RESET_, CONFIG_KERNEL_PL,,)
53 #define SPR_IPI_MASK_SET_K \
54 _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,)
55 #define SPR_IPI_EVENT_K \
56 _concat4(SPR_IPI_EVENT_, CONFIG_KERNEL_PL,,)
57 #define SPR_IPI_EVENT_RESET_K \
58 _concat4(SPR_IPI_EVENT_RESET_, CONFIG_KERNEL_PL,,)
59 #define SPR_IPI_EVENT_SET_K \
60 _concat4(SPR_IPI_EVENT_SET_, CONFIG_KERNEL_PL,,)
62 _concat4(INT_IPI_, CONFIG_KERNEL_PL,,)
64 #define SPR_SINGLE_STEP_CONTROL_K \
65 _concat4(SPR_SINGLE_STEP_CONTROL_, CONFIG_KERNEL_PL,,)
66 #define SPR_SINGLE_STEP_EN_K_K \
67 _concat4(SPR_SINGLE_STEP_EN_, CONFIG_KERNEL_PL, _, CONFIG_KERNEL_PL)
68 #define INT_SINGLE_STEP_K \
69 _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,)
73 /* TILEPro dependent, protection-level dependent SPRs. */
75 #define SPR_INTERRUPT_MASK_K_0 \
76 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _0,)
77 #define SPR_INTERRUPT_MASK_K_1 \
78 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _1,)
79 #define SPR_INTERRUPT_MASK_SET_K_0 \
80 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _0,)
81 #define SPR_INTERRUPT_MASK_SET_K_1 \
82 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _1,)
83 #define SPR_INTERRUPT_MASK_RESET_K_0 \
84 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _0,)
85 #define SPR_INTERRUPT_MASK_RESET_K_1 \
86 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _1,)
90 /* Generic protection-level dependent SPRs. */
92 #define SPR_SYSTEM_SAVE_K_0 \
93 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _0,)
94 #define SPR_SYSTEM_SAVE_K_1 \
95 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _1,)
96 #define SPR_SYSTEM_SAVE_K_2 \
97 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _2,)
98 #define SPR_SYSTEM_SAVE_K_3 \
99 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _3,)
100 #define SPR_EX_CONTEXT_K_0 \
101 _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _0,)
102 #define SPR_EX_CONTEXT_K_1 \
103 _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _1,)
104 #define SPR_INTCTRL_K_STATUS \
105 _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,)
106 #define INT_INTCTRL_K \
107 _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,)
109 #endif /* __ARCH_SPR_DEF_H__ */