xref: /OK3568_Linux_fs/kernel/arch/xtensa/variants/fsf/include/variant/tie-asm.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * This header file contains assembly-language definitions (assembly
3*4882a593Smuzhiyun  * macros, etc.) for this specific Xtensa processor's TIE extensions
4*4882a593Smuzhiyun  * and options.  It is customized to this Xtensa processor configuration.
5*4882a593Smuzhiyun  *
6*4882a593Smuzhiyun  * This file is subject to the terms and conditions of the GNU General Public
7*4882a593Smuzhiyun  * License.  See the file "COPYING" in the main directory of this archive
8*4882a593Smuzhiyun  * for more details.
9*4882a593Smuzhiyun  *
10*4882a593Smuzhiyun  * Copyright (C) 1999-2008 Tensilica Inc.
11*4882a593Smuzhiyun  */
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun #ifndef _XTENSA_CORE_TIE_ASM_H
14*4882a593Smuzhiyun #define _XTENSA_CORE_TIE_ASM_H
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun /*  Selection parameter values for save-area save/restore macros:  */
17*4882a593Smuzhiyun /*  Option vs. TIE:  */
18*4882a593Smuzhiyun #define XTHAL_SAS_TIE	0x0001	/* custom extension or coprocessor */
19*4882a593Smuzhiyun #define XTHAL_SAS_OPT	0x0002	/* optional (and not a coprocessor) */
20*4882a593Smuzhiyun /*  Whether used automatically by compiler:  */
21*4882a593Smuzhiyun #define XTHAL_SAS_NOCC	0x0004	/* not used by compiler w/o special opts/code */
22*4882a593Smuzhiyun #define XTHAL_SAS_CC	0x0008	/* used by compiler without special opts/code */
23*4882a593Smuzhiyun /*  ABI handling across function calls:  */
24*4882a593Smuzhiyun #define XTHAL_SAS_CALR	0x0010	/* caller-saved */
25*4882a593Smuzhiyun #define XTHAL_SAS_CALE	0x0020	/* callee-saved */
26*4882a593Smuzhiyun #define XTHAL_SAS_GLOB	0x0040	/* global across function calls (in thread) */
27*4882a593Smuzhiyun /*  Misc  */
28*4882a593Smuzhiyun #define XTHAL_SAS_ALL	0xFFFF	/* include all default NCP contents */
29*4882a593Smuzhiyun 
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun /* Macro to save all non-coprocessor (extra) custom TIE and optional state
33*4882a593Smuzhiyun  * (not including zero-overhead loop registers).
34*4882a593Smuzhiyun  * Save area ptr (clobbered):  ptr  (1 byte aligned)
35*4882a593Smuzhiyun  * Scratch regs  (clobbered):  at1..at4  (only first XCHAL_NCP_NUM_ATMPS needed)
36*4882a593Smuzhiyun  */
37*4882a593Smuzhiyun 	.macro xchal_ncp_store  ptr at1 at2 at3 at4  continue=0 ofs=-1 select=XTHAL_SAS_ALL
38*4882a593Smuzhiyun 	xchal_sa_start	\continue, \ofs
39*4882a593Smuzhiyun 	.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
40*4882a593Smuzhiyun 	xchal_sa_align	\ptr, 0, 1024-4, 4, 4
41*4882a593Smuzhiyun 	rur	\at1, THREADPTR		// threadptr option
42*4882a593Smuzhiyun 	s32i	\at1, \ptr, .Lxchal_ofs_ + 0
43*4882a593Smuzhiyun 	.set	.Lxchal_ofs_, .Lxchal_ofs_ + 4
44*4882a593Smuzhiyun 	.endif
45*4882a593Smuzhiyun 	.endm	// xchal_ncp_store
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun /* Macro to save all non-coprocessor (extra) custom TIE and optional state
48*4882a593Smuzhiyun  * (not including zero-overhead loop registers).
49*4882a593Smuzhiyun  * Save area ptr (clobbered):  ptr  (1 byte aligned)
50*4882a593Smuzhiyun  * Scratch regs  (clobbered):  at1..at4  (only first XCHAL_NCP_NUM_ATMPS needed)
51*4882a593Smuzhiyun  */
52*4882a593Smuzhiyun 	.macro xchal_ncp_load  ptr at1 at2 at3 at4  continue=0 ofs=-1 select=XTHAL_SAS_ALL
53*4882a593Smuzhiyun 	xchal_sa_start	\continue, \ofs
54*4882a593Smuzhiyun 	.ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_GLOB) & ~\select
55*4882a593Smuzhiyun 	xchal_sa_align	\ptr, 0, 1024-4, 4, 4
56*4882a593Smuzhiyun 	l32i	\at1, \ptr, .Lxchal_ofs_ + 0
57*4882a593Smuzhiyun 	wur	\at1, THREADPTR		// threadptr option
58*4882a593Smuzhiyun 	.set	.Lxchal_ofs_, .Lxchal_ofs_ + 4
59*4882a593Smuzhiyun 	.endif
60*4882a593Smuzhiyun 	.endm	// xchal_ncp_load
61*4882a593Smuzhiyun 
62*4882a593Smuzhiyun 
63*4882a593Smuzhiyun 
64*4882a593Smuzhiyun #define XCHAL_NCP_NUM_ATMPS	1
65*4882a593Smuzhiyun 
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun #define XCHAL_SA_NUM_ATMPS	1
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun #endif /*_XTENSA_CORE_TIE_ASM_H*/
70*4882a593Smuzhiyun 
71