/arch/tile/include/arch/spr_def.h
C++ Header | 113 lines | 71 code | 17 blank | 25 comment | 3 complexity | f3e641a8ba2866e42462512bde3b5112 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
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/* Include the proper base SPR definition file. */ 16#ifdef __tilegx__ 17#include <arch/spr_def_64.h> 18#else 19#include <arch/spr_def_32.h> 20#endif 21 22#ifdef __KERNEL__ 23 24/* 25 * In addition to including the proper base SPR definition file, depending 26 * on machine architecture, this file defines several macros which allow 27 * kernel code to use protection-level dependent SPRs without worrying 28 * about which PL it's running at. In these macros, the PL that the SPR 29 * or interrupt number applies to is replaced by K. 30 */ 31 32#if CONFIG_KERNEL_PL != 1 && CONFIG_KERNEL_PL != 2 33#error CONFIG_KERNEL_PL must be 1 or 2 34#endif 35 36/* Concatenate 4 strings. */ 37#define __concat4(a, b, c, d) a ## b ## c ## d 38#define _concat4(a, b, c, d) __concat4(a, b, c, d) 39 40#ifdef __tilegx__ 41 42/* TILE-Gx dependent, protection-level dependent SPRs. */ 43 44#define SPR_INTERRUPT_MASK_K \ 45 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL,,) 46#define SPR_INTERRUPT_MASK_SET_K \ 47 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL,,) 48#define SPR_INTERRUPT_MASK_RESET_K \ 49 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL,,) 50#define SPR_INTERRUPT_VECTOR_BASE_K \ 51 _concat4(SPR_INTERRUPT_VECTOR_BASE_, CONFIG_KERNEL_PL,,) 52 53#define SPR_IPI_MASK_K \ 54 _concat4(SPR_IPI_MASK_, CONFIG_KERNEL_PL,,) 55#define SPR_IPI_MASK_RESET_K \ 56 _concat4(SPR_IPI_MASK_RESET_, CONFIG_KERNEL_PL,,) 57#define SPR_IPI_MASK_SET_K \ 58 _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,) 59#define SPR_IPI_EVENT_K \ 60 _concat4(SPR_IPI_EVENT_, CONFIG_KERNEL_PL,,) 61#define SPR_IPI_EVENT_RESET_K \ 62 _concat4(SPR_IPI_EVENT_RESET_, CONFIG_KERNEL_PL,,) 63#define SPR_IPI_MASK_SET_K \ 64 _concat4(SPR_IPI_MASK_SET_, CONFIG_KERNEL_PL,,) 65#define INT_IPI_K \ 66 _concat4(INT_IPI_, CONFIG_KERNEL_PL,,) 67 68#define SPR_SINGLE_STEP_CONTROL_K \ 69 _concat4(SPR_SINGLE_STEP_CONTROL_, CONFIG_KERNEL_PL,,) 70#define SPR_SINGLE_STEP_EN_K_K \ 71 _concat4(SPR_SINGLE_STEP_EN_, CONFIG_KERNEL_PL, _, CONFIG_KERNEL_PL) 72#define INT_SINGLE_STEP_K \ 73 _concat4(INT_SINGLE_STEP_, CONFIG_KERNEL_PL,,) 74 75#else 76 77/* TILEPro dependent, protection-level dependent SPRs. */ 78 79#define SPR_INTERRUPT_MASK_K_0 \ 80 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _0,) 81#define SPR_INTERRUPT_MASK_K_1 \ 82 _concat4(SPR_INTERRUPT_MASK_, CONFIG_KERNEL_PL, _1,) 83#define SPR_INTERRUPT_MASK_SET_K_0 \ 84 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _0,) 85#define SPR_INTERRUPT_MASK_SET_K_1 \ 86 _concat4(SPR_INTERRUPT_MASK_SET_, CONFIG_KERNEL_PL, _1,) 87#define SPR_INTERRUPT_MASK_RESET_K_0 \ 88 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _0,) 89#define SPR_INTERRUPT_MASK_RESET_K_1 \ 90 _concat4(SPR_INTERRUPT_MASK_RESET_, CONFIG_KERNEL_PL, _1,) 91 92#endif 93 94/* Generic protection-level dependent SPRs. */ 95 96#define SPR_SYSTEM_SAVE_K_0 \ 97 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _0,) 98#define SPR_SYSTEM_SAVE_K_1 \ 99 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _1,) 100#define SPR_SYSTEM_SAVE_K_2 \ 101 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _2,) 102#define SPR_SYSTEM_SAVE_K_3 \ 103 _concat4(SPR_SYSTEM_SAVE_, CONFIG_KERNEL_PL, _3,) 104#define SPR_EX_CONTEXT_K_0 \ 105 _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _0,) 106#define SPR_EX_CONTEXT_K_1 \ 107 _concat4(SPR_EX_CONTEXT_, CONFIG_KERNEL_PL, _1,) 108#define SPR_INTCTRL_K_STATUS \ 109 _concat4(SPR_INTCTRL_, CONFIG_KERNEL_PL, _STATUS,) 110#define INT_INTCTRL_K \ 111 _concat4(INT_INTCTRL_, CONFIG_KERNEL_PL,,) 112 113#endif /* __KERNEL__ */