Path: blob/master/arch/xtensa/include/asm/coprocessor.h
26442 views
/*1* include/asm-xtensa/coprocessor.h2*3* This file is subject to the terms and conditions of the GNU General Public4* License. See the file "COPYING" in the main directory of this archive5* for more details.6*7* Copyright (C) 2003 - 2007 Tensilica Inc.8*/91011#ifndef _XTENSA_COPROCESSOR_H12#define _XTENSA_COPROCESSOR_H1314#include <variant/tie.h>15#include <asm/core.h>16#include <asm/types.h>1718#ifdef __ASSEMBLER__19# include <variant/tie-asm.h>2021.macro xchal_sa_start a b22.set .Lxchal_pofs_, 023.set .Lxchal_ofs_, 024.endm2526.macro xchal_sa_align ptr minofs maxofs ofsalign totalign27.set .Lxchal_ofs_, .Lxchal_ofs_ + .Lxchal_pofs_ + \totalign - 128.set .Lxchal_ofs_, (.Lxchal_ofs_ & -\totalign) - .Lxchal_pofs_29.endm3031#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \32| XTHAL_SAS_CC \33| XTHAL_SAS_CALR | XTHAL_SAS_CALE )3435.macro save_xtregs_opt ptr clb at1 at2 at3 at4 offset36.if XTREGS_OPT_SIZE > 037addi \clb, \ptr, \offset38xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT39.endif40.endm4142.macro load_xtregs_opt ptr clb at1 at2 at3 at4 offset43.if XTREGS_OPT_SIZE > 044addi \clb, \ptr, \offset45xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT46.endif47.endm48#undef _SELECT4950#define _SELECT ( XTHAL_SAS_TIE | XTHAL_SAS_OPT \51| XTHAL_SAS_NOCC \52| XTHAL_SAS_CALR | XTHAL_SAS_CALE | XTHAL_SAS_GLOB )5354.macro save_xtregs_user ptr clb at1 at2 at3 at4 offset55.if XTREGS_USER_SIZE > 056addi \clb, \ptr, \offset57xchal_ncp_store \clb \at1 \at2 \at3 \at4 select=_SELECT58.endif59.endm6061.macro load_xtregs_user ptr clb at1 at2 at3 at4 offset62.if XTREGS_USER_SIZE > 063addi \clb, \ptr, \offset64xchal_ncp_load \clb \at1 \at2 \at3 \at4 select=_SELECT65.endif66.endm67#undef _SELECT68697071#endif /* __ASSEMBLER__ */7273/*74* XTENSA_HAVE_COPROCESSOR(x) returns 1 if coprocessor x is configured.75*76* XTENSA_HAVE_IO_PORT(x) returns 1 if io-port x is configured.77*78*/7980#define XTENSA_HAVE_COPROCESSOR(x) \81((XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK) & (1 << (x)))82#define XTENSA_HAVE_COPROCESSORS \83(XCHAL_CP_MASK ^ XCHAL_CP_PORT_MASK)84#define XTENSA_HAVE_IO_PORT(x) \85(XCHAL_CP_PORT_MASK & (1 << (x)))86#define XTENSA_HAVE_IO_PORTS \87XCHAL_CP_PORT_MASK8889#ifndef __ASSEMBLER__9091/*92* Additional registers.93* We define three types of additional registers:94* ext: extra registers that are used by the compiler95* cpn: optional registers that can be used by a user application96* cpX: coprocessor registers that can only be used if the corresponding97* CPENABLE bit is set.98*/99100#define XCHAL_SA_REG(list,cc,abi,type,y,name,z,align,size,...) \101__REG ## list (cc, abi, type, name, size, align)102103#define __REG0(cc,abi,t,name,s,a) __REG0_ ## cc (abi,name)104#define __REG1(cc,abi,t,name,s,a) __REG1_ ## cc (name)105#define __REG2(cc,abi,type,...) __REG2_ ## type (__VA_ARGS__)106107#define __REG0_0(abi,name)108#define __REG0_1(abi,name) __REG0_1 ## abi (name)109#define __REG0_10(name) __u32 name;110#define __REG0_11(name) __u32 name;111#define __REG0_12(name)112113#define __REG1_0(name) __u32 name;114#define __REG1_1(name)115116#define __REG2_0(n,s,a) __u32 name;117#define __REG2_1(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));118#define __REG2_2(n,s,a) unsigned char n[s] __attribute__ ((aligned(a)));119120typedef struct { XCHAL_NCP_SA_LIST(0) } xtregs_opt_t121__attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));122typedef struct { XCHAL_NCP_SA_LIST(1) } xtregs_user_t123__attribute__ ((aligned (XCHAL_NCP_SA_ALIGN)));124125#if XTENSA_HAVE_COPROCESSORS126127typedef struct { XCHAL_CP0_SA_LIST(2) } xtregs_cp0_t128__attribute__ ((aligned (XCHAL_CP0_SA_ALIGN)));129typedef struct { XCHAL_CP1_SA_LIST(2) } xtregs_cp1_t130__attribute__ ((aligned (XCHAL_CP1_SA_ALIGN)));131typedef struct { XCHAL_CP2_SA_LIST(2) } xtregs_cp2_t132__attribute__ ((aligned (XCHAL_CP2_SA_ALIGN)));133typedef struct { XCHAL_CP3_SA_LIST(2) } xtregs_cp3_t134__attribute__ ((aligned (XCHAL_CP3_SA_ALIGN)));135typedef struct { XCHAL_CP4_SA_LIST(2) } xtregs_cp4_t136__attribute__ ((aligned (XCHAL_CP4_SA_ALIGN)));137typedef struct { XCHAL_CP5_SA_LIST(2) } xtregs_cp5_t138__attribute__ ((aligned (XCHAL_CP5_SA_ALIGN)));139typedef struct { XCHAL_CP6_SA_LIST(2) } xtregs_cp6_t140__attribute__ ((aligned (XCHAL_CP6_SA_ALIGN)));141typedef struct { XCHAL_CP7_SA_LIST(2) } xtregs_cp7_t142__attribute__ ((aligned (XCHAL_CP7_SA_ALIGN)));143144struct thread_info;145void coprocessor_flush(struct thread_info *ti, int cp_index);146void coprocessor_release_all(struct thread_info *ti);147void coprocessor_flush_all(struct thread_info *ti);148void coprocessor_flush_release_all(struct thread_info *ti);149void local_coprocessors_flush_release_all(void);150151#endif /* XTENSA_HAVE_COPROCESSORS */152153#endif /* !__ASSEMBLER__ */154#endif /* _XTENSA_COPROCESSOR_H */155156157