18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * This header file describes this specific Xtensa processor's TIE extensions
38c2ecf20Sopenharmony_ci * that extend basic Xtensa core functionality.  It is customized to this
48c2ecf20Sopenharmony_ci * Xtensa processor configuration.
58c2ecf20Sopenharmony_ci *
68c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
78c2ecf20Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
88c2ecf20Sopenharmony_ci * for more details.
98c2ecf20Sopenharmony_ci *
108c2ecf20Sopenharmony_ci * Copyright (C) 1999-2007 Tensilica Inc.
118c2ecf20Sopenharmony_ci */
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#ifndef _XTENSA_CORE_TIE_H
148c2ecf20Sopenharmony_ci#define _XTENSA_CORE_TIE_H
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define XCHAL_CP_NUM			1	/* number of coprocessors */
178c2ecf20Sopenharmony_ci#define XCHAL_CP_MAX			8	/* max CP ID + 1 (0 if none) */
188c2ecf20Sopenharmony_ci#define XCHAL_CP_MASK			0x80	/* bitmask of all CPs by ID */
198c2ecf20Sopenharmony_ci#define XCHAL_CP_PORT_MASK		0x80	/* bitmask of only port CPs */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/*  Basic parameters of each coprocessor:  */
228c2ecf20Sopenharmony_ci#define XCHAL_CP7_NAME			"XTIOP"
238c2ecf20Sopenharmony_ci#define XCHAL_CP7_IDENT			XTIOP
248c2ecf20Sopenharmony_ci#define XCHAL_CP7_SA_SIZE		0	/* size of state save area */
258c2ecf20Sopenharmony_ci#define XCHAL_CP7_SA_ALIGN		1	/* min alignment of save area */
268c2ecf20Sopenharmony_ci#define XCHAL_CP_ID_XTIOP		7	/* coprocessor ID (0..7) */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci/*  Filler info for unassigned coprocessors, to simplify arrays etc:  */
298c2ecf20Sopenharmony_ci#define XCHAL_CP0_SA_SIZE		0
308c2ecf20Sopenharmony_ci#define XCHAL_CP0_SA_ALIGN		1
318c2ecf20Sopenharmony_ci#define XCHAL_CP1_SA_SIZE		0
328c2ecf20Sopenharmony_ci#define XCHAL_CP1_SA_ALIGN		1
338c2ecf20Sopenharmony_ci#define XCHAL_CP2_SA_SIZE		0
348c2ecf20Sopenharmony_ci#define XCHAL_CP2_SA_ALIGN		1
358c2ecf20Sopenharmony_ci#define XCHAL_CP3_SA_SIZE		0
368c2ecf20Sopenharmony_ci#define XCHAL_CP3_SA_ALIGN		1
378c2ecf20Sopenharmony_ci#define XCHAL_CP4_SA_SIZE		0
388c2ecf20Sopenharmony_ci#define XCHAL_CP4_SA_ALIGN		1
398c2ecf20Sopenharmony_ci#define XCHAL_CP5_SA_SIZE		0
408c2ecf20Sopenharmony_ci#define XCHAL_CP5_SA_ALIGN		1
418c2ecf20Sopenharmony_ci#define XCHAL_CP6_SA_SIZE		0
428c2ecf20Sopenharmony_ci#define XCHAL_CP6_SA_ALIGN		1
438c2ecf20Sopenharmony_ci
448c2ecf20Sopenharmony_ci/*  Save area for non-coprocessor optional and custom (TIE) state:  */
458c2ecf20Sopenharmony_ci#define XCHAL_NCP_SA_SIZE		32
468c2ecf20Sopenharmony_ci#define XCHAL_NCP_SA_ALIGN		4
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/*  Total save area for optional and custom state (NCP + CPn):  */
498c2ecf20Sopenharmony_ci#define XCHAL_TOTAL_SA_SIZE		32	/* with 16-byte align padding */
508c2ecf20Sopenharmony_ci#define XCHAL_TOTAL_SA_ALIGN		4	/* actual minimum alignment */
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci/*
538c2ecf20Sopenharmony_ci * Detailed contents of save areas.
548c2ecf20Sopenharmony_ci * NOTE:  caller must define the XCHAL_SA_REG macro (not defined here)
558c2ecf20Sopenharmony_ci * before expanding the XCHAL_xxx_SA_LIST() macros.
568c2ecf20Sopenharmony_ci *
578c2ecf20Sopenharmony_ci * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,
588c2ecf20Sopenharmony_ci *		dbnum,base,regnum,bitsz,gapsz,reset,x...)
598c2ecf20Sopenharmony_ci *
608c2ecf20Sopenharmony_ci *	s = passed from XCHAL_*_LIST(s), eg. to select how to expand
618c2ecf20Sopenharmony_ci *	ccused = set if used by compiler without special options or code
628c2ecf20Sopenharmony_ci *	abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)
638c2ecf20Sopenharmony_ci *	kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)
648c2ecf20Sopenharmony_ci *	opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)
658c2ecf20Sopenharmony_ci *	name = lowercase reg name (no quotes)
668c2ecf20Sopenharmony_ci *	galign = group byte alignment (power of 2) (galign >= align)
678c2ecf20Sopenharmony_ci *	align = register byte alignment (power of 2)
688c2ecf20Sopenharmony_ci *	asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)
698c2ecf20Sopenharmony_ci *	  (not including any pad bytes required to galign this or next reg)
708c2ecf20Sopenharmony_ci *	dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)
718c2ecf20Sopenharmony_ci *	base = reg shortname w/o index (or sr=special, ur=TIE user reg)
728c2ecf20Sopenharmony_ci *	regnum = reg index in regfile, or special/TIE-user reg number
738c2ecf20Sopenharmony_ci *	bitsz = number of significant bits (regfile width, or ur/sr mask bits)
748c2ecf20Sopenharmony_ci *	gapsz = intervening bits, if bitsz bits not stored contiguously
758c2ecf20Sopenharmony_ci *	(padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)
768c2ecf20Sopenharmony_ci *	reset = register reset value (or 0 if undefined at reset)
778c2ecf20Sopenharmony_ci *	x = reserved for future use (0 until then)
788c2ecf20Sopenharmony_ci *
798c2ecf20Sopenharmony_ci *  To filter out certain registers, e.g. to expand only the non-global
808c2ecf20Sopenharmony_ci *  registers used by the compiler, you can do something like this:
818c2ecf20Sopenharmony_ci *
828c2ecf20Sopenharmony_ci *  #define XCHAL_SA_REG(s,ccused,p...)	SELCC##ccused(p)
838c2ecf20Sopenharmony_ci *  #define SELCC0(p...)
848c2ecf20Sopenharmony_ci *  #define SELCC1(abikind,p...)	SELAK##abikind(p)
858c2ecf20Sopenharmony_ci *  #define SELAK0(p...)		REG(p)
868c2ecf20Sopenharmony_ci *  #define SELAK1(p...)		REG(p)
878c2ecf20Sopenharmony_ci *  #define SELAK2(p...)
888c2ecf20Sopenharmony_ci *  #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \
898c2ecf20Sopenharmony_ci *		...what you want to expand...
908c2ecf20Sopenharmony_ci */
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define XCHAL_NCP_SA_NUM	8
938c2ecf20Sopenharmony_ci#define XCHAL_NCP_SA_LIST(s)	\
948c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,1,0,0,1,          acclo, 4, 4, 4,0x0210,  sr,16 , 32,0,0,0) \
958c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,1,0,0,1,          acchi, 4, 4, 4,0x0211,  sr,17 ,  8,0,0,0) \
968c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m0, 4, 4, 4,0x0220,  sr,32 , 32,0,0,0) \
978c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m1, 4, 4, 4,0x0221,  sr,33 , 32,0,0,0) \
988c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m2, 4, 4, 4,0x0222,  sr,34 , 32,0,0,0) \
998c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m3, 4, 4, 4,0x0223,  sr,35 , 32,0,0,0) \
1008c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,      scompare1, 4, 4, 4,0x020C,  sr,12 , 32,0,0,0) \
1018c2ecf20Sopenharmony_ci XCHAL_SA_REG(s,1,2,1,1,      threadptr, 4, 4, 4,0x03E7,  ur,231, 32,0,0,0)
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ci#define XCHAL_CP0_SA_NUM	0
1048c2ecf20Sopenharmony_ci#define XCHAL_CP0_SA_LIST(s)	/* empty */
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define XCHAL_CP1_SA_NUM	0
1078c2ecf20Sopenharmony_ci#define XCHAL_CP1_SA_LIST(s)	/* empty */
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define XCHAL_CP2_SA_NUM	0
1108c2ecf20Sopenharmony_ci#define XCHAL_CP2_SA_LIST(s)	/* empty */
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define XCHAL_CP3_SA_NUM	0
1138c2ecf20Sopenharmony_ci#define XCHAL_CP3_SA_LIST(s)	/* empty */
1148c2ecf20Sopenharmony_ci
1158c2ecf20Sopenharmony_ci#define XCHAL_CP4_SA_NUM	0
1168c2ecf20Sopenharmony_ci#define XCHAL_CP4_SA_LIST(s)	/* empty */
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define XCHAL_CP5_SA_NUM	0
1198c2ecf20Sopenharmony_ci#define XCHAL_CP5_SA_LIST(s)	/* empty */
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ci#define XCHAL_CP6_SA_NUM	0
1228c2ecf20Sopenharmony_ci#define XCHAL_CP6_SA_LIST(s)	/* empty */
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#define XCHAL_CP7_SA_NUM	0
1258c2ecf20Sopenharmony_ci#define XCHAL_CP7_SA_LIST(s)	/* empty */
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ci/* Byte length of instruction from its first nibble (op0 field), per FLIX.  */
1288c2ecf20Sopenharmony_ci#define XCHAL_OP0_FORMAT_LENGTHS	3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#endif /*_XTENSA_CORE_TIE_H*/
1318c2ecf20Sopenharmony_ci
132