12 #ifndef _XTENSA_COPROCESSOR_H
13 #define _XTENSA_COPROCESSOR_H
16 #include <variant/core.h>
17 #include <variant/tie.h>
18 #include <asm/types.h>
21 # include <variant/tie-asm.h>
23 .macro xchal_sa_start
a b
28 .macro xchal_sa_align
ptr minofs maxofs ofsalign totalign
29 .set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + \totalign - 1
30 .set .Lxchal_ofs_, (.Lxchal_ofs_ & -\totalign) - .Lxchal_pofs_
38 .if XTREGS_OPT_SIZE > 0
40 xchal_ncp_store \clb \at1 \at2 \at3 \at4
select=_SELECT
45 .if XTREGS_OPT_SIZE > 0
47 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
52 #define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \
54 | XTHAL_SAS_CALR | XTHAL_SAS_CALE | XTHAL_SAS_GLOB )
57 .if XTREGS_USER_SIZE > 0
59 xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT
64 .if XTREGS_USER_SIZE > 0
66 xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT
82 #define XTENSA_HAVE_COPROCESSOR(x) \
83 ((XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK) & (1 << (x)))
84 #define XTENSA_HAVE_COPROCESSORS \
85 (XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK)
86 #define XTENSA_HAVE_IO_PORT(x) \
87 (XCHAL_CP_PORT_MASK & (1 << (x)))
88 #define XTENSA_HAVE_IO_PORTS \
96 #define RSR_CPENABLE(x) do { \
97 __asm__ __volatile__("rsr %0, cpenable" : "=a" (x)); \
99 #define WSR_CPENABLE(x) do { \
100 __asm__ __volatile__("wsr %0, cpenable; rsync" :: "a" (x)); \
115 #define XCHAL_SA_REG(list,cc,abi,type,y,name,z,align,size,...) \
116 __REG ## list (cc, abi, type, name, size, align)
118 #define __REG0(cc,abi,t,name,s,a) __REG0_ ## cc (abi,name)
119 #define __REG1(cc,abi,t,name,s,a) __REG1_ ## cc (name)
120 #define __REG2(cc,abi,type,...) __REG2_ ## type (__VA_ARGS__)
122 #define __REG0_0(abi,name)
123 #define __REG0_1(abi,name) __REG0_1 ## abi (name)
124 #define __REG0_10(name) __u32 name;
125 #define __REG0_11(name) __u32 name;
126 #define __REG0_12(name)
128 #define __REG1_0(name) __u32 name;
129 #define __REG1_1(name)
131 #define __REG2_0(n,s,a) __u32 name;
132 #define __REG2_1(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
133 #define __REG2_2(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));
140 #if XTENSA_HAVE_COPROCESSORS
160 extern void coprocessor_save(
void*,
int);
161 extern void coprocessor_load(
void*,
int);
162 extern void coprocessor_flush(
struct thread_info*,
int);
163 extern void coprocessor_restore(
struct thread_info*,
int);
165 extern void coprocessor_release_all(
struct thread_info*);
166 extern void coprocessor_flush_all(
struct thread_info*);
168 static inline void coprocessor_clear_cpenable(
void)