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 #ifndef __ARCH_SPR_DEF_H__ 15 #define __ARCH_SPR_DEF_H__ 16 17 #include <uapi/arch/spr_def.h> 18 19 20 /* 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. 26 */ 27 28 #if CONFIG_KERNEL_PL != 1 && CONFIG_KERNEL_PL != 2 29 #error CONFIG_KERNEL_PL must be 1 or 2 30 #endif 31 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) 35 36 #ifdef __tilegx__ 37 38 /* TILE-Gx dependent, protection-level dependent SPRs. */ 39 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,,) 48 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,,) 61 #define INT_IPI_K \ 62 _concat4(INT_IPI_, CONFIG_KERNEL_PL,,) 63 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,,) 70 71 #else 72 73 /* TILEPro dependent, protection-level dependent SPRs. */ 74 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,) 87 88 #endif 89 90 /* Generic protection-level dependent SPRs. */ 91 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,,) 108 109 #endif /* __ARCH_SPR_DEF_H__ */ 110