···11+/* 22+ * tie-asm.h -- compile-time HAL assembler definitions dependent on CORE & TIE33+ *44+ * NOTE: This header file is not meant to be included directly.55+ */66+77+/* This header file contains assembly-language definitions (assembly88+ macros, etc.) for this specific Xtensa processor's TIE extensions99+ and options. It is customized to this Xtensa processor configuration.1010+1111+ Copyright (c) 1999-2015 Cadence Design Systems Inc.1212+1313+ Permission is hereby granted, free of charge, to any person obtaining1414+ a copy of this software and associated documentation files (the1515+ "Software"), to deal in the Software without restriction, including1616+ without limitation the rights to use, copy, modify, merge, publish,1717+ distribute, sublicense, and/or sell copies of the Software, and to1818+ permit persons to whom the Software is furnished to do so, subject to1919+ the following conditions:2020+2121+ The above copyright notice and this permission notice shall be included2222+ in all copies or substantial portions of the Software.2323+2424+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,2525+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF2626+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.2727+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY2828+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,2929+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE3030+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */3131+3232+#ifndef _XTENSA_CORE_TIE_ASM_H3333+#define _XTENSA_CORE_TIE_ASM_H3434+3535+/* Selection parameter values for save-area save/restore macros: */3636+/* Option vs. TIE: */3737+#define XTHAL_SAS_TIE 0x0001 /* custom extension or coprocessor */3838+#define XTHAL_SAS_OPT 0x0002 /* optional (and not a coprocessor) */3939+#define XTHAL_SAS_ANYOT 0x0003 /* both of the above */4040+/* Whether used automatically by compiler: */4141+#define XTHAL_SAS_NOCC 0x0004 /* not used by compiler w/o special opts/code */4242+#define XTHAL_SAS_CC 0x0008 /* used by compiler without special opts/code */4343+#define XTHAL_SAS_ANYCC 0x000C /* both of the above */4444+/* ABI handling across function calls: */4545+#define XTHAL_SAS_CALR 0x0010 /* caller-saved */4646+#define XTHAL_SAS_CALE 0x0020 /* callee-saved */4747+#define XTHAL_SAS_GLOB 0x0040 /* global across function calls (in thread) */4848+#define XTHAL_SAS_ANYABI 0x0070 /* all of the above three */4949+/* Misc */5050+#define XTHAL_SAS_ALL 0xFFFF /* include all default NCP contents */5151+#define XTHAL_SAS3(optie,ccuse,abi) ( ((optie) & XTHAL_SAS_ANYOT) \5252+ | ((ccuse) & XTHAL_SAS_ANYCC) \5353+ | ((abi) & XTHAL_SAS_ANYABI) )5454+5555+5656+ /*5757+ * Macro to store all non-coprocessor (extra) custom TIE and optional state5858+ * (not including zero-overhead loop registers).5959+ * Required parameters:6060+ * ptr Save area pointer address register (clobbered)6161+ * (register must contain a 4 byte aligned address).6262+ * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS6363+ * registers are clobbered, the remaining are unused).6464+ * Optional parameters:6565+ * continue If macro invoked as part of a larger store sequence, set to 16666+ * if this is not the first in the sequence. Defaults to 0.6767+ * ofs Offset from start of larger sequence (from value of first ptr6868+ * in sequence) at which to store. Defaults to next available space6969+ * (or 0 if <continue> is 0).7070+ * select Select what category(ies) of registers to store, as a bitmask7171+ * (see XTHAL_SAS_xxx constants). Defaults to all registers.7272+ * alloc Select what category(ies) of registers to allocate; if any7373+ * category is selected here that is not in <select>, space for7474+ * the corresponding registers is skipped without doing any store.7575+ */7676+ .macro xchal_ncp_store ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=07777+ xchal_sa_start \continue, \ofs7878+ // Optional caller-saved registers used by default by the compiler:7979+ .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\select)8080+ xchal_sa_align \ptr, 0, 1016, 4, 48181+ rsr.ACCLO \at1 // MAC16 option8282+ s32i \at1, \ptr, .Lxchal_ofs_+08383+ rsr.ACCHI \at1 // MAC16 option8484+ s32i \at1, \ptr, .Lxchal_ofs_+48585+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 88686+ .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\alloc)) == 08787+ xchal_sa_align \ptr, 0, 1016, 4, 48888+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 88989+ .endif9090+ // Optional caller-saved registers not used by default by the compiler:9191+ .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)9292+ xchal_sa_align \ptr, 0, 1004, 4, 49393+ rsr.SCOMPARE1 \at1 // conditional store option9494+ s32i \at1, \ptr, .Lxchal_ofs_+09595+ rsr.M0 \at1 // MAC16 option9696+ s32i \at1, \ptr, .Lxchal_ofs_+49797+ rsr.M1 \at1 // MAC16 option9898+ s32i \at1, \ptr, .Lxchal_ofs_+89999+ rsr.M2 \at1 // MAC16 option100100+ s32i \at1, \ptr, .Lxchal_ofs_+12101101+ rsr.M3 \at1 // MAC16 option102102+ s32i \at1, \ptr, .Lxchal_ofs_+16103103+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 20104104+ .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0105105+ xchal_sa_align \ptr, 0, 1004, 4, 4106106+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 20107107+ .endif108108+ .endm // xchal_ncp_store109109+110110+ /*111111+ * Macro to load all non-coprocessor (extra) custom TIE and optional state112112+ * (not including zero-overhead loop registers).113113+ * Required parameters:114114+ * ptr Save area pointer address register (clobbered)115115+ * (register must contain a 4 byte aligned address).116116+ * at1..at4 Four temporary address registers (first XCHAL_NCP_NUM_ATMPS117117+ * registers are clobbered, the remaining are unused).118118+ * Optional parameters:119119+ * continue If macro invoked as part of a larger load sequence, set to 1120120+ * if this is not the first in the sequence. Defaults to 0.121121+ * ofs Offset from start of larger sequence (from value of first ptr122122+ * in sequence) at which to load. Defaults to next available space123123+ * (or 0 if <continue> is 0).124124+ * select Select what category(ies) of registers to load, as a bitmask125125+ * (see XTHAL_SAS_xxx constants). Defaults to all registers.126126+ * alloc Select what category(ies) of registers to allocate; if any127127+ * category is selected here that is not in <select>, space for128128+ * the corresponding registers is skipped without doing any load.129129+ */130130+ .macro xchal_ncp_load ptr at1 at2 at3 at4 continue=0 ofs=-1 select=XTHAL_SAS_ALL alloc=0131131+ xchal_sa_start \continue, \ofs132132+ // Optional caller-saved registers used by default by the compiler:133133+ .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\select)134134+ xchal_sa_align \ptr, 0, 1016, 4, 4135135+ l32i \at1, \ptr, .Lxchal_ofs_+0136136+ wsr.ACCLO \at1 // MAC16 option137137+ l32i \at1, \ptr, .Lxchal_ofs_+4138138+ wsr.ACCHI \at1 // MAC16 option139139+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 8140140+ .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_CC | XTHAL_SAS_CALR) & ~(\alloc)) == 0141141+ xchal_sa_align \ptr, 0, 1016, 4, 4142142+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 8143143+ .endif144144+ // Optional caller-saved registers not used by default by the compiler:145145+ .ifeq (XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\select)146146+ xchal_sa_align \ptr, 0, 1004, 4, 4147147+ l32i \at1, \ptr, .Lxchal_ofs_+0148148+ wsr.SCOMPARE1 \at1 // conditional store option149149+ l32i \at1, \ptr, .Lxchal_ofs_+4150150+ wsr.M0 \at1 // MAC16 option151151+ l32i \at1, \ptr, .Lxchal_ofs_+8152152+ wsr.M1 \at1 // MAC16 option153153+ l32i \at1, \ptr, .Lxchal_ofs_+12154154+ wsr.M2 \at1 // MAC16 option155155+ l32i \at1, \ptr, .Lxchal_ofs_+16156156+ wsr.M3 \at1 // MAC16 option157157+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 20158158+ .elseif ((XTHAL_SAS_OPT | XTHAL_SAS_NOCC | XTHAL_SAS_CALR) & ~(\alloc)) == 0159159+ xchal_sa_align \ptr, 0, 1004, 4, 4160160+ .set .Lxchal_ofs_, .Lxchal_ofs_ + 20161161+ .endif162162+ .endm // xchal_ncp_load163163+164164+165165+#define XCHAL_NCP_NUM_ATMPS 1166166+167167+#define XCHAL_SA_NUM_ATMPS 1168168+169169+#endif /*_XTENSA_CORE_TIE_ASM_H*/170170+
+136
arch/xtensa/variants/de212/include/variant/tie.h
···11+/* 22+ * tie.h -- compile-time HAL definitions dependent on CORE & TIE configuration33+ *44+ * NOTE: This header file is not meant to be included directly.55+ */66+77+/* This header file describes this specific Xtensa processor's TIE extensions88+ that extend basic Xtensa core functionality. It is customized to this99+ Xtensa processor configuration.1010+1111+ Copyright (c) 1999-2015 Cadence Design Systems Inc.1212+1313+ Permission is hereby granted, free of charge, to any person obtaining1414+ a copy of this software and associated documentation files (the1515+ "Software"), to deal in the Software without restriction, including1616+ without limitation the rights to use, copy, modify, merge, publish,1717+ distribute, sublicense, and/or sell copies of the Software, and to1818+ permit persons to whom the Software is furnished to do so, subject to1919+ the following conditions:2020+2121+ The above copyright notice and this permission notice shall be included2222+ in all copies or substantial portions of the Software.2323+2424+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,2525+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF2626+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.2727+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY2828+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,2929+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE3030+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */3131+3232+#ifndef _XTENSA_CORE_TIE_H3333+#define _XTENSA_CORE_TIE_H3434+3535+#define XCHAL_CP_NUM 0 /* number of coprocessors */3636+#define XCHAL_CP_MAX 0 /* max CP ID + 1 (0 if none) */3737+#define XCHAL_CP_MASK 0x00 /* bitmask of all CPs by ID */3838+#define XCHAL_CP_PORT_MASK 0x00 /* bitmask of only port CPs */3939+4040+/* Save area for non-coprocessor optional and custom (TIE) state: */4141+#define XCHAL_NCP_SA_SIZE 284242+#define XCHAL_NCP_SA_ALIGN 44343+4444+/* Total save area for optional and custom state (NCP + CPn): */4545+#define XCHAL_TOTAL_SA_SIZE 32 /* with 16-byte align padding */4646+#define XCHAL_TOTAL_SA_ALIGN 4 /* actual minimum alignment */4747+4848+/*4949+ * Detailed contents of save areas.5050+ * NOTE: caller must define the XCHAL_SA_REG macro (not defined here)5151+ * before expanding the XCHAL_xxx_SA_LIST() macros.5252+ *5353+ * XCHAL_SA_REG(s,ccused,abikind,kind,opt,name,galign,align,asize,5454+ * dbnum,base,regnum,bitsz,gapsz,reset,x...)5555+ *5656+ * s = passed from XCHAL_*_LIST(s), eg. to select how to expand5757+ * ccused = set if used by compiler without special options or code5858+ * abikind = 0 (caller-saved), 1 (callee-saved), or 2 (thread-global)5959+ * kind = 0 (special reg), 1 (TIE user reg), or 2 (TIE regfile reg)6060+ * opt = 0 (custom TIE extension or coprocessor), or 1 (optional reg)6161+ * name = lowercase reg name (no quotes)6262+ * galign = group byte alignment (power of 2) (galign >= align)6363+ * align = register byte alignment (power of 2)6464+ * asize = allocated size in bytes (asize*8 == bitsz + gapsz + padsz)6565+ * (not including any pad bytes required to galign this or next reg)6666+ * dbnum = unique target number f/debug (see <xtensa-libdb-macros.h>)6767+ * base = reg shortname w/o index (or sr=special, ur=TIE user reg)6868+ * regnum = reg index in regfile, or special/TIE-user reg number6969+ * bitsz = number of significant bits (regfile width, or ur/sr mask bits)7070+ * gapsz = intervening bits, if bitsz bits not stored contiguously7171+ * (padsz = pad bits at end [TIE regfile] or at msbits [ur,sr] of asize)7272+ * reset = register reset value (or 0 if undefined at reset)7373+ * x = reserved for future use (0 until then)7474+ *7575+ * To filter out certain registers, e.g. to expand only the non-global7676+ * registers used by the compiler, you can do something like this:7777+ *7878+ * #define XCHAL_SA_REG(s,ccused,p...) SELCC##ccused(p)7979+ * #define SELCC0(p...)8080+ * #define SELCC1(abikind,p...) SELAK##abikind(p)8181+ * #define SELAK0(p...) REG(p)8282+ * #define SELAK1(p...) REG(p)8383+ * #define SELAK2(p...)8484+ * #define REG(kind,tie,name,galn,aln,asz,csz,dbnum,base,rnum,bsz,rst,x...) \8585+ * ...what you want to expand...8686+ */8787+8888+#define XCHAL_NCP_SA_NUM 78989+#define XCHAL_NCP_SA_LIST(s) \9090+ XCHAL_SA_REG(s,1,0,0,1, acclo, 4, 4, 4,0x0210, sr,16 , 32,0,0,0) \9191+ XCHAL_SA_REG(s,1,0,0,1, acchi, 4, 4, 4,0x0211, sr,17 , 8,0,0,0) \9292+ XCHAL_SA_REG(s,0,0,0,1, scompare1, 4, 4, 4,0x020C, sr,12 , 32,0,0,0) \9393+ XCHAL_SA_REG(s,0,0,0,1, m0, 4, 4, 4,0x0220, sr,32 , 32,0,0,0) \9494+ XCHAL_SA_REG(s,0,0,0,1, m1, 4, 4, 4,0x0221, sr,33 , 32,0,0,0) \9595+ XCHAL_SA_REG(s,0,0,0,1, m2, 4, 4, 4,0x0222, sr,34 , 32,0,0,0) \9696+ XCHAL_SA_REG(s,0,0,0,1, m3, 4, 4, 4,0x0223, sr,35 , 32,0,0,0)9797+9898+#define XCHAL_CP0_SA_NUM 09999+#define XCHAL_CP0_SA_LIST(s) /* empty */100100+101101+#define XCHAL_CP1_SA_NUM 0102102+#define XCHAL_CP1_SA_LIST(s) /* empty */103103+104104+#define XCHAL_CP2_SA_NUM 0105105+#define XCHAL_CP2_SA_LIST(s) /* empty */106106+107107+#define XCHAL_CP3_SA_NUM 0108108+#define XCHAL_CP3_SA_LIST(s) /* empty */109109+110110+#define XCHAL_CP4_SA_NUM 0111111+#define XCHAL_CP4_SA_LIST(s) /* empty */112112+113113+#define XCHAL_CP5_SA_NUM 0114114+#define XCHAL_CP5_SA_LIST(s) /* empty */115115+116116+#define XCHAL_CP6_SA_NUM 0117117+#define XCHAL_CP6_SA_LIST(s) /* empty */118118+119119+#define XCHAL_CP7_SA_NUM 0120120+#define XCHAL_CP7_SA_LIST(s) /* empty */121121+122122+/* Byte length of instruction from its first nibble (op0 field), per FLIX. */123123+#define XCHAL_OP0_FORMAT_LENGTHS 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3124124+/* Byte length of instruction from its first byte, per FLIX. */125125+#define XCHAL_BYTE0_FORMAT_LENGTHS \126126+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\127127+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\128128+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\129129+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\130130+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\131131+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\132132+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3,\133133+ 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3, 3,3,3,3,3,3,3,3,2,2,2,2,2,2,3,3134134+135135+#endif /*_XTENSA_CORE_TIE_H*/136136+