Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 1 | /* |
Uwe Zeisberger | f30c226 | 2006-10-03 23:01:26 +0200 | [diff] [blame] | 2 | * include/asm-xtensa/coprocessor.h |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 3 | * |
| 4 | * This file is subject to the terms and conditions of the GNU General Public |
| 5 | * License. See the file "COPYING" in the main directory of this archive |
| 6 | * for more details. |
| 7 | * |
| 8 | * Copyright (C) 2003 - 2005 Tensilica Inc. |
| 9 | */ |
| 10 | |
| 11 | #ifndef _XTENSA_COPROCESSOR_H |
| 12 | #define _XTENSA_COPROCESSOR_H |
| 13 | |
Chris Zankel | 173d6681 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 14 | #include <asm/variant/core.h> |
| 15 | #include <asm/variant/tie.h> |
| 16 | |
| 17 | #if !XCHAL_HAVE_CP |
| 18 | |
| 19 | #define XTENSA_CP_EXTRA_OFFSET 0 |
| 20 | #define XTENSA_CP_EXTRA_ALIGN 1 /* must be a power of 2 */ |
| 21 | #define XTENSA_CP_EXTRA_SIZE 0 |
| 22 | |
| 23 | #else |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 24 | |
| 25 | #define XTOFS(last_start,last_size,align) \ |
| 26 | ((last_start+last_size+align-1) & -align) |
| 27 | |
| 28 | #define XTENSA_CP_EXTRA_OFFSET 0 |
| 29 | #define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN |
| 30 | |
| 31 | #define XTENSA_CPE_CP0_OFFSET \ |
| 32 | XTOFS(XTENSA_CP_EXTRA_OFFSET, XCHAL_EXTRA_SA_SIZE, XCHAL_CP0_SA_ALIGN) |
| 33 | #define XTENSA_CPE_CP1_OFFSET \ |
| 34 | XTOFS(XTENSA_CPE_CP0_OFFSET, XCHAL_CP0_SA_SIZE, XCHAL_CP1_SA_ALIGN) |
| 35 | #define XTENSA_CPE_CP2_OFFSET \ |
| 36 | XTOFS(XTENSA_CPE_CP1_OFFSET, XCHAL_CP1_SA_SIZE, XCHAL_CP2_SA_ALIGN) |
| 37 | #define XTENSA_CPE_CP3_OFFSET \ |
| 38 | XTOFS(XTENSA_CPE_CP2_OFFSET, XCHAL_CP2_SA_SIZE, XCHAL_CP3_SA_ALIGN) |
| 39 | #define XTENSA_CPE_CP4_OFFSET \ |
| 40 | XTOFS(XTENSA_CPE_CP3_OFFSET, XCHAL_CP3_SA_SIZE, XCHAL_CP4_SA_ALIGN) |
| 41 | #define XTENSA_CPE_CP5_OFFSET \ |
| 42 | XTOFS(XTENSA_CPE_CP4_OFFSET, XCHAL_CP4_SA_SIZE, XCHAL_CP5_SA_ALIGN) |
| 43 | #define XTENSA_CPE_CP6_OFFSET \ |
| 44 | XTOFS(XTENSA_CPE_CP5_OFFSET, XCHAL_CP5_SA_SIZE, XCHAL_CP6_SA_ALIGN) |
| 45 | #define XTENSA_CPE_CP7_OFFSET \ |
| 46 | XTOFS(XTENSA_CPE_CP6_OFFSET, XCHAL_CP6_SA_SIZE, XCHAL_CP7_SA_ALIGN) |
| 47 | #define XTENSA_CP_EXTRA_SIZE \ |
| 48 | XTOFS(XTENSA_CPE_CP7_OFFSET, XCHAL_CP7_SA_SIZE, 16) |
| 49 | |
| 50 | #if XCHAL_CP_NUM > 0 |
| 51 | # ifndef __ASSEMBLY__ |
| 52 | /* |
| 53 | * Tasks that own contents of (last user) each coprocessor. |
| 54 | * Entries are 0 for not-owned or non-existent coprocessors. |
| 55 | * Note: The size of this structure is fixed to 8 bytes in entry.S |
| 56 | */ |
| 57 | typedef struct { |
| 58 | struct task_struct *owner; /* owner */ |
| 59 | int offset; /* offset in cpextra space. */ |
| 60 | } coprocessor_info_t; |
| 61 | # else |
| 62 | # define COPROCESSOR_INFO_OWNER 0 |
| 63 | # define COPROCESSOR_INFO_OFFSET 4 |
| 64 | # define COPROCESSOR_INFO_SIZE 8 |
| 65 | # endif |
| 66 | #endif |
Chris Zankel | 29c4dfd | 2007-05-31 17:49:32 -0700 | [diff] [blame] | 67 | #endif /* XCHAL_HAVE_CP */ |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 68 | |
| 69 | |
| 70 | #ifndef __ASSEMBLY__ |
| 71 | # if XCHAL_CP_NUM > 0 |
| 72 | struct task_struct; |
| 73 | extern void release_coprocessors (struct task_struct*); |
| 74 | extern void save_coprocessor_registers(void*, int); |
| 75 | # else |
| 76 | # define release_coprocessors(task) |
| 77 | # endif |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 78 | |
Chris Zankel | 29c4dfd | 2007-05-31 17:49:32 -0700 | [diff] [blame] | 79 | typedef unsigned char cp_state_t[XTENSA_CP_EXTRA_SIZE] |
| 80 | __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN))); |
| 81 | |
| 82 | #endif /* !__ASSEMBLY__ */ |
| 83 | |
Chris Zankel | 173d6681 | 2006-12-10 02:18:48 -0800 | [diff] [blame] | 84 | |
Chris Zankel | 9a8fd55 | 2005-06-23 22:01:26 -0700 | [diff] [blame] | 85 | #endif /* _XTENSA_COPROCESSOR_H */ |