162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci#ifndef _SPARC64_PSTATE_H
362306a36Sopenharmony_ci#define _SPARC64_PSTATE_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#include <linux/const.h>
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/* The V9 PSTATE Register (with SpitFire extensions).
862306a36Sopenharmony_ci *
962306a36Sopenharmony_ci * -----------------------------------------------------------------------
1062306a36Sopenharmony_ci * | Resv | IG | MG | CLE | TLE |  MM  | RED | PEF | AM | PRIV | IE | AG |
1162306a36Sopenharmony_ci * -----------------------------------------------------------------------
1262306a36Sopenharmony_ci *  63  12  11   10    9     8    7   6   5     4     3     2     1    0
1362306a36Sopenharmony_ci */
1462306a36Sopenharmony_ci/* IG on V9 conflicts with MCDE on M7. PSTATE_MCDE will only be used on
1562306a36Sopenharmony_ci * processors that support ADI which do not use IG, hence there is no
1662306a36Sopenharmony_ci * functional conflict
1762306a36Sopenharmony_ci */
1862306a36Sopenharmony_ci#define PSTATE_IG   _AC(0x0000000000000800,UL) /* Interrupt Globals.	*/
1962306a36Sopenharmony_ci#define PSTATE_MCDE _AC(0x0000000000000800,UL) /* MCD Enable		*/
2062306a36Sopenharmony_ci#define PSTATE_MG   _AC(0x0000000000000400,UL) /* MMU Globals.		*/
2162306a36Sopenharmony_ci#define PSTATE_CLE  _AC(0x0000000000000200,UL) /* Current Little Endian.*/
2262306a36Sopenharmony_ci#define PSTATE_TLE  _AC(0x0000000000000100,UL) /* Trap Little Endian.	*/
2362306a36Sopenharmony_ci#define PSTATE_MM   _AC(0x00000000000000c0,UL) /* Memory Model.		*/
2462306a36Sopenharmony_ci#define PSTATE_TSO  _AC(0x0000000000000000,UL) /* MM: TotalStoreOrder	*/
2562306a36Sopenharmony_ci#define PSTATE_PSO  _AC(0x0000000000000040,UL) /* MM: PartialStoreOrder	*/
2662306a36Sopenharmony_ci#define PSTATE_RMO  _AC(0x0000000000000080,UL) /* MM: RelaxedMemoryOrder*/
2762306a36Sopenharmony_ci#define PSTATE_RED  _AC(0x0000000000000020,UL) /* Reset Error Debug.	*/
2862306a36Sopenharmony_ci#define PSTATE_PEF  _AC(0x0000000000000010,UL) /* Floating Point Enable.*/
2962306a36Sopenharmony_ci#define PSTATE_AM   _AC(0x0000000000000008,UL) /* Address Mask.		*/
3062306a36Sopenharmony_ci#define PSTATE_PRIV _AC(0x0000000000000004,UL) /* Privilege.		*/
3162306a36Sopenharmony_ci#define PSTATE_IE   _AC(0x0000000000000002,UL) /* Interrupt Enable.	*/
3262306a36Sopenharmony_ci#define PSTATE_AG   _AC(0x0000000000000001,UL) /* Alternate Globals.	*/
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* The V9 TSTATE Register (with SpitFire and Linux extensions).
3562306a36Sopenharmony_ci *
3662306a36Sopenharmony_ci * ---------------------------------------------------------------------
3762306a36Sopenharmony_ci * |  Resv |  GL  |  CCR  |  ASI  |  %pil  |  PSTATE  |  Resv  |  CWP  |
3862306a36Sopenharmony_ci * ---------------------------------------------------------------------
3962306a36Sopenharmony_ci *  63   43 42  40 39   32 31   24 23    20 19       8 7      5 4     0
4062306a36Sopenharmony_ci */
4162306a36Sopenharmony_ci#define TSTATE_GL	_AC(0x0000070000000000,UL) /* Global reg level  */
4262306a36Sopenharmony_ci#define TSTATE_CCR	_AC(0x000000ff00000000,UL) /* Condition Codes.	*/
4362306a36Sopenharmony_ci#define TSTATE_XCC	_AC(0x000000f000000000,UL) /* Condition Codes.	*/
4462306a36Sopenharmony_ci#define TSTATE_XNEG	_AC(0x0000008000000000,UL) /* %xcc Negative.	*/
4562306a36Sopenharmony_ci#define TSTATE_XZERO	_AC(0x0000004000000000,UL) /* %xcc Zero.	*/
4662306a36Sopenharmony_ci#define TSTATE_XOVFL	_AC(0x0000002000000000,UL) /* %xcc Overflow.	*/
4762306a36Sopenharmony_ci#define TSTATE_XCARRY	_AC(0x0000001000000000,UL) /* %xcc Carry.	*/
4862306a36Sopenharmony_ci#define TSTATE_ICC	_AC(0x0000000f00000000,UL) /* Condition Codes.	*/
4962306a36Sopenharmony_ci#define TSTATE_INEG	_AC(0x0000000800000000,UL) /* %icc Negative.	*/
5062306a36Sopenharmony_ci#define TSTATE_IZERO	_AC(0x0000000400000000,UL) /* %icc Zero.	*/
5162306a36Sopenharmony_ci#define TSTATE_IOVFL	_AC(0x0000000200000000,UL) /* %icc Overflow.	*/
5262306a36Sopenharmony_ci#define TSTATE_ICARRY	_AC(0x0000000100000000,UL) /* %icc Carry.	*/
5362306a36Sopenharmony_ci#define TSTATE_ASI	_AC(0x00000000ff000000,UL) /* AddrSpace ID.	*/
5462306a36Sopenharmony_ci#define TSTATE_PIL	_AC(0x0000000000f00000,UL) /* %pil (Linux traps)*/
5562306a36Sopenharmony_ci#define TSTATE_PSTATE	_AC(0x00000000000fff00,UL) /* PSTATE.		*/
5662306a36Sopenharmony_ci/* IG on V9 conflicts with MCDE on M7. TSTATE_MCDE will only be used on
5762306a36Sopenharmony_ci * processors that support ADI which do not support IG, hence there is
5862306a36Sopenharmony_ci * no functional conflict
5962306a36Sopenharmony_ci */
6062306a36Sopenharmony_ci#define TSTATE_IG	_AC(0x0000000000080000,UL) /* Interrupt Globals.*/
6162306a36Sopenharmony_ci#define TSTATE_MCDE	_AC(0x0000000000080000,UL) /* MCD enable.       */
6262306a36Sopenharmony_ci#define TSTATE_MG	_AC(0x0000000000040000,UL) /* MMU Globals.	*/
6362306a36Sopenharmony_ci#define TSTATE_CLE	_AC(0x0000000000020000,UL) /* CurrLittleEndian.	*/
6462306a36Sopenharmony_ci#define TSTATE_TLE	_AC(0x0000000000010000,UL) /* TrapLittleEndian.	*/
6562306a36Sopenharmony_ci#define TSTATE_MM	_AC(0x000000000000c000,UL) /* Memory Model.	*/
6662306a36Sopenharmony_ci#define TSTATE_TSO	_AC(0x0000000000000000,UL) /* MM: TSO		*/
6762306a36Sopenharmony_ci#define TSTATE_PSO	_AC(0x0000000000004000,UL) /* MM: PSO		*/
6862306a36Sopenharmony_ci#define TSTATE_RMO	_AC(0x0000000000008000,UL) /* MM: RMO		*/
6962306a36Sopenharmony_ci#define TSTATE_RED	_AC(0x0000000000002000,UL) /* Reset Error Debug.*/
7062306a36Sopenharmony_ci#define TSTATE_PEF	_AC(0x0000000000001000,UL) /* FPU Enable.	*/
7162306a36Sopenharmony_ci#define TSTATE_AM	_AC(0x0000000000000800,UL) /* Address Mask.	*/
7262306a36Sopenharmony_ci#define TSTATE_PRIV	_AC(0x0000000000000400,UL) /* Privilege.	*/
7362306a36Sopenharmony_ci#define TSTATE_IE	_AC(0x0000000000000200,UL) /* Interrupt Enable.	*/
7462306a36Sopenharmony_ci#define TSTATE_AG	_AC(0x0000000000000100,UL) /* Alternate Globals.*/
7562306a36Sopenharmony_ci#define TSTATE_SYSCALL	_AC(0x0000000000000020,UL) /* in syscall trap   */
7662306a36Sopenharmony_ci#define TSTATE_CWP	_AC(0x000000000000001f,UL) /* Curr Win-Pointer.	*/
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ci/* Floating-Point Registers State Register.
7962306a36Sopenharmony_ci *
8062306a36Sopenharmony_ci * --------------------------------
8162306a36Sopenharmony_ci * |  Resv  |  FEF  |  DU  |  DL  |
8262306a36Sopenharmony_ci * --------------------------------
8362306a36Sopenharmony_ci *  63     3    2       1      0
8462306a36Sopenharmony_ci */
8562306a36Sopenharmony_ci#define FPRS_FEF	_AC(0x0000000000000004,UL) /* FPU Enable.	*/
8662306a36Sopenharmony_ci#define FPRS_DU		_AC(0x0000000000000002,UL) /* Dirty Upper.	*/
8762306a36Sopenharmony_ci#define FPRS_DL		_AC(0x0000000000000001,UL) /* Dirty Lower.	*/
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ci/* Version Register.
9062306a36Sopenharmony_ci *
9162306a36Sopenharmony_ci * ------------------------------------------------------
9262306a36Sopenharmony_ci * | MANUF | IMPL | MASK | Resv | MAXTL | Resv | MAXWIN |
9362306a36Sopenharmony_ci * ------------------------------------------------------
9462306a36Sopenharmony_ci *  63   48 47  32 31  24 23  16 15    8 7    5 4      0
9562306a36Sopenharmony_ci */
9662306a36Sopenharmony_ci#define VERS_MANUF	_AC(0xffff000000000000,UL) /* Manufacturer.	*/
9762306a36Sopenharmony_ci#define VERS_IMPL	_AC(0x0000ffff00000000,UL) /* Implementation.	*/
9862306a36Sopenharmony_ci#define VERS_MASK	_AC(0x00000000ff000000,UL) /* Mask Set Revision.*/
9962306a36Sopenharmony_ci#define VERS_MAXTL	_AC(0x000000000000ff00,UL) /* Max Trap Level.	*/
10062306a36Sopenharmony_ci#define VERS_MAXWIN	_AC(0x000000000000001f,UL) /* Max RegWindow Idx.*/
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci/* Compatibility Feature Register (%asr26), SPARC-T4 and later  */
10362306a36Sopenharmony_ci#define CFR_AES		_AC(0x0000000000000001,UL) /* Supports AES opcodes     */
10462306a36Sopenharmony_ci#define CFR_DES		_AC(0x0000000000000002,UL) /* Supports DES opcodes     */
10562306a36Sopenharmony_ci#define CFR_KASUMI	_AC(0x0000000000000004,UL) /* Supports KASUMI opcodes  */
10662306a36Sopenharmony_ci#define CFR_CAMELLIA	_AC(0x0000000000000008,UL) /* Supports CAMELLIA opcodes*/
10762306a36Sopenharmony_ci#define CFR_MD5		_AC(0x0000000000000010,UL) /* Supports MD5 opcodes     */
10862306a36Sopenharmony_ci#define CFR_SHA1	_AC(0x0000000000000020,UL) /* Supports SHA1 opcodes    */
10962306a36Sopenharmony_ci#define CFR_SHA256	_AC(0x0000000000000040,UL) /* Supports SHA256 opcodes  */
11062306a36Sopenharmony_ci#define CFR_SHA512	_AC(0x0000000000000080,UL) /* Supports SHA512 opcodes  */
11162306a36Sopenharmony_ci#define CFR_MPMUL	_AC(0x0000000000000100,UL) /* Supports MPMUL opcodes   */
11262306a36Sopenharmony_ci#define CFR_MONTMUL	_AC(0x0000000000000200,UL) /* Supports MONTMUL opcodes */
11362306a36Sopenharmony_ci#define CFR_MONTSQR	_AC(0x0000000000000400,UL) /* Supports MONTSQR opcodes */
11462306a36Sopenharmony_ci#define CFR_CRC32C	_AC(0x0000000000000800,UL) /* Supports CRC32C opcodes  */
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#endif /* !(_SPARC64_PSTATE_H) */
117