162306a36Sopenharmony_ci/*
262306a36Sopenharmony_ci * This header file describes this specific Xtensa processor's TIE extensions
362306a36Sopenharmony_ci * that extend basic Xtensa core functionality.  It is customized to this
462306a36Sopenharmony_ci * Xtensa processor configuration.
562306a36Sopenharmony_ci *
662306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public
762306a36Sopenharmony_ci * License.  See the file "COPYING" in the main directory of this archive
862306a36Sopenharmony_ci * for more details.
962306a36Sopenharmony_ci *
1062306a36Sopenharmony_ci * Copyright (C) 1999-2007 Tensilica Inc.
1162306a36Sopenharmony_ci */
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#ifndef _XTENSA_CORE_TIE_H
1462306a36Sopenharmony_ci#define _XTENSA_CORE_TIE_H
1562306a36Sopenharmony_ci
1662306a36Sopenharmony_ci#define XCHAL_CP_NUM			1	/* number of coprocessors */
1762306a36Sopenharmony_ci#define XCHAL_CP_MAX			8	/* max CP ID + 1 (0 if none) */
1862306a36Sopenharmony_ci#define XCHAL_CP_MASK			0x80	/* bitmask of all CPs by ID */
1962306a36Sopenharmony_ci#define XCHAL_CP_PORT_MASK		0x80	/* bitmask of only port CPs */
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci/*  Basic parameters of each coprocessor:  */
2262306a36Sopenharmony_ci#define XCHAL_CP7_NAME			"XTIOP"
2362306a36Sopenharmony_ci#define XCHAL_CP7_IDENT			XTIOP
2462306a36Sopenharmony_ci#define XCHAL_CP7_SA_SIZE		0	/* size of state save area */
2562306a36Sopenharmony_ci#define XCHAL_CP7_SA_ALIGN		1	/* min alignment of save area */
2662306a36Sopenharmony_ci#define XCHAL_CP_ID_XTIOP		7	/* coprocessor ID (0..7) */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ci/*  Filler info for unassigned coprocessors, to simplify arrays etc:  */
2962306a36Sopenharmony_ci#define XCHAL_CP0_SA_SIZE		0
3062306a36Sopenharmony_ci#define XCHAL_CP0_SA_ALIGN		1
3162306a36Sopenharmony_ci#define XCHAL_CP1_SA_SIZE		0
3262306a36Sopenharmony_ci#define XCHAL_CP1_SA_ALIGN		1
3362306a36Sopenharmony_ci#define XCHAL_CP2_SA_SIZE		0
3462306a36Sopenharmony_ci#define XCHAL_CP2_SA_ALIGN		1
3562306a36Sopenharmony_ci#define XCHAL_CP3_SA_SIZE		0
3662306a36Sopenharmony_ci#define XCHAL_CP3_SA_ALIGN		1
3762306a36Sopenharmony_ci#define XCHAL_CP4_SA_SIZE		0
3862306a36Sopenharmony_ci#define XCHAL_CP4_SA_ALIGN		1
3962306a36Sopenharmony_ci#define XCHAL_CP5_SA_SIZE		0
4062306a36Sopenharmony_ci#define XCHAL_CP5_SA_ALIGN		1
4162306a36Sopenharmony_ci#define XCHAL_CP6_SA_SIZE		0
4262306a36Sopenharmony_ci#define XCHAL_CP6_SA_ALIGN		1
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/*  Save area for non-coprocessor optional and custom (TIE) state:  */
4562306a36Sopenharmony_ci#define XCHAL_NCP_SA_SIZE		32
4662306a36Sopenharmony_ci#define XCHAL_NCP_SA_ALIGN		4
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/*  Total save area for optional and custom state (NCP + CPn):  */
4962306a36Sopenharmony_ci#define XCHAL_TOTAL_SA_SIZE		32	/* with 16-byte align padding */
5062306a36Sopenharmony_ci#define XCHAL_TOTAL_SA_ALIGN		4	/* actual minimum alignment */
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci/*
5362306a36Sopenharmony_ci * Detailed contents of save areas.
5462306a36Sopenharmony_ci * NOTE:  caller must define the XCHAL_SA_REG macro (not defined here)
5562306a36Sopenharmony_ci * before expanding the XCHAL_xxx_SA_LIST() macros.
5662306a36Sopenharmony_ci *
5762306a36Sopenharmony_ci * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,
5862306a36Sopenharmony_ci *		dbnum,base,regnum,bitsz,gapsz,reset,x...)
5962306a36Sopenharmony_ci *
6062306a36Sopenharmony_ci *	s = passed from XCHAL_*_LIST(s), eg. to select how to expand
6162306a36Sopenharmony_ci *	ccused = set if used by compiler without special options or code
6262306a36Sopenharmony_ci *	abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)
6362306a36Sopenharmony_ci *	kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)
6462306a36Sopenharmony_ci *	opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)
6562306a36Sopenharmony_ci *	name = lowercase reg name (no quotes)
6662306a36Sopenharmony_ci *	galign = group byte alignment (power of 2) (galign >= align)
6762306a36Sopenharmony_ci *	align = register byte alignment (power of 2)
6862306a36Sopenharmony_ci *	asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)
6962306a36Sopenharmony_ci *	  (not including any pad bytes required to galign this or next reg)
7062306a36Sopenharmony_ci *	dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)
7162306a36Sopenharmony_ci *	base = reg shortname w/o index (or sr=special, ur=TIE user reg)
7262306a36Sopenharmony_ci *	regnum = reg index in regfile, or special/TIE-user reg number
7362306a36Sopenharmony_ci *	bitsz = number of significant bits (regfile width, or ur/sr mask bits)
7462306a36Sopenharmony_ci *	gapsz = intervening bits, if bitsz bits not stored contiguously
7562306a36Sopenharmony_ci *	(padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)
7662306a36Sopenharmony_ci *	reset = register reset value (or 0 if undefined at reset)
7762306a36Sopenharmony_ci *	x = reserved for future use (0 until then)
7862306a36Sopenharmony_ci *
7962306a36Sopenharmony_ci *  To filter out certain registers, e.g. to expand only the non-global
8062306a36Sopenharmony_ci *  registers used by the compiler, you can do something like this:
8162306a36Sopenharmony_ci *
8262306a36Sopenharmony_ci *  #define XCHAL_SA_REG(s,ccused,p...)	SELCC##ccused(p)
8362306a36Sopenharmony_ci *  #define SELCC0(p...)
8462306a36Sopenharmony_ci *  #define SELCC1(abikind,p...)	SELAK##abikind(p)
8562306a36Sopenharmony_ci *  #define SELAK0(p...)		REG(p)
8662306a36Sopenharmony_ci *  #define SELAK1(p...)		REG(p)
8762306a36Sopenharmony_ci *  #define SELAK2(p...)
8862306a36Sopenharmony_ci *  #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \
8962306a36Sopenharmony_ci *		...what you want to expand...
9062306a36Sopenharmony_ci */
9162306a36Sopenharmony_ci
9262306a36Sopenharmony_ci#define XCHAL_NCP_SA_NUM	8
9362306a36Sopenharmony_ci#define XCHAL_NCP_SA_LIST(s)	\
9462306a36Sopenharmony_ci XCHAL_SA_REG(s,1,0,0,1,          acclo, 4, 4, 4,0x0210,  sr,16 , 32,0,0,0) \
9562306a36Sopenharmony_ci XCHAL_SA_REG(s,1,0,0,1,          acchi, 4, 4, 4,0x0211,  sr,17 ,  8,0,0,0) \
9662306a36Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m0, 4, 4, 4,0x0220,  sr,32 , 32,0,0,0) \
9762306a36Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m1, 4, 4, 4,0x0221,  sr,33 , 32,0,0,0) \
9862306a36Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m2, 4, 4, 4,0x0222,  sr,34 , 32,0,0,0) \
9962306a36Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,             m3, 4, 4, 4,0x0223,  sr,35 , 32,0,0,0) \
10062306a36Sopenharmony_ci XCHAL_SA_REG(s,0,0,0,1,      scompare1, 4, 4, 4,0x020C,  sr,12 , 32,0,0,0) \
10162306a36Sopenharmony_ci XCHAL_SA_REG(s,1,2,1,1,      threadptr, 4, 4, 4,0x03E7,  ur,231, 32,0,0,0)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define XCHAL_CP0_SA_NUM	0
10462306a36Sopenharmony_ci#define XCHAL_CP0_SA_LIST(s)	/* empty */
10562306a36Sopenharmony_ci
10662306a36Sopenharmony_ci#define XCHAL_CP1_SA_NUM	0
10762306a36Sopenharmony_ci#define XCHAL_CP1_SA_LIST(s)	/* empty */
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define XCHAL_CP2_SA_NUM	0
11062306a36Sopenharmony_ci#define XCHAL_CP2_SA_LIST(s)	/* empty */
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci#define XCHAL_CP3_SA_NUM	0
11362306a36Sopenharmony_ci#define XCHAL_CP3_SA_LIST(s)	/* empty */
11462306a36Sopenharmony_ci
11562306a36Sopenharmony_ci#define XCHAL_CP4_SA_NUM	0
11662306a36Sopenharmony_ci#define XCHAL_CP4_SA_LIST(s)	/* empty */
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ci#define XCHAL_CP5_SA_NUM	0
11962306a36Sopenharmony_ci#define XCHAL_CP5_SA_LIST(s)	/* empty */
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ci#define XCHAL_CP6_SA_NUM	0
12262306a36Sopenharmony_ci#define XCHAL_CP6_SA_LIST(s)	/* empty */
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#define XCHAL_CP7_SA_NUM	0
12562306a36Sopenharmony_ci#define XCHAL_CP7_SA_LIST(s)	/* empty */
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ci/* Byte length of instruction from its first nibble (op0 field), per FLIX.  */
12862306a36Sopenharmony_ci#define XCHAL_OP0_FORMAT_LENGTHS	3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3
12962306a36Sopenharmony_ci
13062306a36Sopenharmony_ci#endif /*_XTENSA_CORE_TIE_H*/
13162306a36Sopenharmony_ci
132