mpc-i2c: Propagate error values properly
[linux-2.6/kmemtrace.git] / include / asm-xtensa / coprocessor.h
blobaa2121034558684f3f6a654b383a77bb838ae558
1 /*
2 * include/asm-xtensa/coprocessor.h
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.
8 * Copyright (C) 2003 - 2005 Tensilica Inc.
9 */
11 #ifndef _XTENSA_COPROCESSOR_H
12 #define _XTENSA_COPROCESSOR_H
14 #include <asm/variant/core.h>
15 #include <asm/variant/tie.h>
17 #if !XCHAL_HAVE_CP
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
23 #else
25 #define XTOFS(last_start,last_size,align) \
26 ((last_start+last_size+align-1) & -align)
28 #define XTENSA_CP_EXTRA_OFFSET 0
29 #define XTENSA_CP_EXTRA_ALIGN XCHAL_EXTRA_SA_ALIGN
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)
50 #if XCHAL_CP_NUM > 0
51 # ifndef __ASSEMBLY__
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
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
67 #endif /* XCHAL_HAVE_CP */
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
79 typedef unsigned char cp_state_t[XTENSA_CP_EXTRA_SIZE]
80 __attribute__ ((aligned (XTENSA_CP_EXTRA_ALIGN)));
82 #endif /* !__ASSEMBLY__ */
85 #endif /* _XTENSA_COPROCESSOR_H */