Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-2.6
[pandora-kernel.git] / arch / tile / include / arch / spr_def.h
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
15 /*
16  * In addition to including the proper base SPR definition file, depending
17  * on machine architecture, this file defines several macros which allow
18  * kernel code to use protection-level dependent SPRs without worrying
19  * about which PL it's running at.  In these macros, the PL that the SPR
20  * or interrupt number applies to is replaced by K.
21  */
22
23 #if CONFIG_KERNEL_PL != 1 && CONFIG_KERNEL_PL != 2
24 #error CONFIG_KERNEL_PL must be 1 or 2
25 #endif
26
27 /* Concatenate 4 strings. */
28 #define __concat4(a, b, c, d) a ## b ## c ## d
29 #define _concat4(a, b, c, d)  __concat4(a, b, c, d)
30
31 #ifdef __tilegx__
32 #include <arch/spr_def_64.h>
33
34 /* TILE-Gx dependent, protection-level dependent SPRs. */
35
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
45 #define SPR_IPI_MASK_K \
46         _concat4(SPR_IPI_MASK_, CONFIG_KERNEL_PL,,)
47 #define SPR_IPI_MASK_RESET_K \
48         _concat4(SPR_IPI_MASK_RESET_, CONFIG_KERNEL_PL,,)
49 #define SPR_IPI_MASK_SET_K \
50         _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,)
51 #define SPR_IPI_EVENT_K \
52         _concat4(SPR_IPI_EVENT_, CONFIG_KERNEL_PL,,)
53 #define SPR_IPI_EVENT_RESET_K \
54         _concat4(SPR_IPI_EVENT_RESET_, CONFIG_KERNEL_PL,,)
55 #define SPR_IPI_MASK_SET_K \
56         _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,)
57 #define INT_IPI_K \
58         _concat4(INT_IPI_, CONFIG_KERNEL_PL,,)
59
60 #define SPR_SINGLE_STEP_CONTROL_K \
61         _concat4(SPR_SINGLE_STEP_CONTROL_, CONFIG_KERNEL_PL,,)
62 #define SPR_SINGLE_STEP_EN_K_K \
63         _concat4(SPR_SINGLE_STEP_EN_, CONFIG_KERNEL_PL, _, CONFIG_KERNEL_PL)
64 #define INT_SINGLE_STEP_K \
65         _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,)
66
67 #else
68 #include <arch/spr_def_32.h>
69
70 /* TILEPro dependent, protection-level dependent SPRs. */
71
72 #define SPR_INTERRUPT_MASK_K_0 \
73         _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _0,)
74 #define SPR_INTERRUPT_MASK_K_1 \
75         _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _1,)
76 #define SPR_INTERRUPT_MASK_SET_K_0 \
77         _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _0,)
78 #define SPR_INTERRUPT_MASK_SET_K_1 \
79         _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _1,)
80 #define SPR_INTERRUPT_MASK_RESET_K_0 \
81         _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _0,)
82 #define SPR_INTERRUPT_MASK_RESET_K_1 \
83         _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _1,)
84
85 #endif
86
87 /* Generic protection-level dependent SPRs. */
88
89 #define SPR_SYSTEM_SAVE_K_0 \
90         _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _0,)
91 #define SPR_SYSTEM_SAVE_K_1 \
92         _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _1,)
93 #define SPR_SYSTEM_SAVE_K_2 \
94         _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _2,)
95 #define SPR_SYSTEM_SAVE_K_3 \
96         _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _3,)
97 #define SPR_EX_CONTEXT_K_0 \
98         _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _0,)
99 #define SPR_EX_CONTEXT_K_1 \
100         _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _1,)
101 #define SPR_INTCTRL_K_STATUS \
102         _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,)
103 #define INT_INTCTRL_K \
104         _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,)