162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Register definitions specific to the A2 core
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci *  Copyright (C) 2008 Ben. Herrenschmidt (benh@kernel.crashing.org), IBM Corp.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __ASM_POWERPC_REG_A2_H__
962306a36Sopenharmony_ci#define __ASM_POWERPC_REG_A2_H__
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <asm/asm-const.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#define SPRN_TENSR	0x1b5
1462306a36Sopenharmony_ci#define SPRN_TENS	0x1b6	/* Thread ENable Set */
1562306a36Sopenharmony_ci#define SPRN_TENC	0x1b7	/* Thread ENable Clear */
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define SPRN_A2_CCR0	0x3f0	/* Core Configuration Register 0 */
1862306a36Sopenharmony_ci#define SPRN_A2_CCR1	0x3f1	/* Core Configuration Register 1 */
1962306a36Sopenharmony_ci#define SPRN_A2_CCR2	0x3f2	/* Core Configuration Register 2 */
2062306a36Sopenharmony_ci#define SPRN_MMUCR0	0x3fc	/* MMU Control Register 0 */
2162306a36Sopenharmony_ci#define SPRN_MMUCR1	0x3fd	/* MMU Control Register 1 */
2262306a36Sopenharmony_ci#define SPRN_MMUCR2	0x3fe	/* MMU Control Register 2 */
2362306a36Sopenharmony_ci#define SPRN_MMUCR3	0x3ff	/* MMU Control Register 3 */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci#define SPRN_IAR	0x372
2662306a36Sopenharmony_ci
2762306a36Sopenharmony_ci#define SPRN_IUCR0	0x3f3
2862306a36Sopenharmony_ci#define IUCR0_ICBI_ACK	0x1000
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#define SPRN_XUCR0	0x3f6	/* Execution Unit Config Register 0 */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ci#define A2_IERAT_SIZE	16
3362306a36Sopenharmony_ci#define A2_DERAT_SIZE	32
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci/* A2 MMUCR0 bits */
3662306a36Sopenharmony_ci#define MMUCR0_ECL	0x80000000	/* Extended Class for TLB fills */
3762306a36Sopenharmony_ci#define MMUCR0_TID_NZ	0x40000000	/* TID is non-zero */
3862306a36Sopenharmony_ci#define MMUCR0_TS	0x10000000	/* Translation space for TLB fills */
3962306a36Sopenharmony_ci#define MMUCR0_TGS	0x20000000	/* Guest space for TLB fills */
4062306a36Sopenharmony_ci#define MMUCR0_TLBSEL	0x0c000000	/* TLB or ERAT target for TLB fills */
4162306a36Sopenharmony_ci#define MMUCR0_TLBSEL_U	0x00000000	/*  TLBSEL = UTLB */
4262306a36Sopenharmony_ci#define MMUCR0_TLBSEL_I	0x08000000	/*  TLBSEL = I-ERAT */
4362306a36Sopenharmony_ci#define MMUCR0_TLBSEL_D	0x0c000000	/*  TLBSEL = D-ERAT */
4462306a36Sopenharmony_ci#define MMUCR0_LOCKSRSH	0x02000000	/* Use TLB lock on tlbsx. */
4562306a36Sopenharmony_ci#define MMUCR0_TID_MASK	0x000000ff	/* TID field */
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci/* A2 MMUCR1 bits */
4862306a36Sopenharmony_ci#define MMUCR1_IRRE		0x80000000	/* I-ERAT round robin enable */
4962306a36Sopenharmony_ci#define MMUCR1_DRRE		0x40000000	/* D-ERAT round robin enable */
5062306a36Sopenharmony_ci#define MMUCR1_REE		0x20000000	/* Reference Exception Enable*/
5162306a36Sopenharmony_ci#define MMUCR1_CEE		0x10000000	/* Change exception enable */
5262306a36Sopenharmony_ci#define MMUCR1_CSINV_ALL	0x00000000	/* Inval ERAT on all CS evts */
5362306a36Sopenharmony_ci#define MMUCR1_CSINV_NISYNC	0x04000000	/* Inval ERAT on all ex isync*/
5462306a36Sopenharmony_ci#define MMUCR1_CSINV_NEVER	0x0c000000	/* Don't inval ERAT on CS */
5562306a36Sopenharmony_ci#define MMUCR1_ICTID		0x00080000	/* IERAT class field as TID */
5662306a36Sopenharmony_ci#define MMUCR1_ITTID		0x00040000	/* IERAT thdid field as TID */
5762306a36Sopenharmony_ci#define MMUCR1_DCTID		0x00020000	/* DERAT class field as TID */
5862306a36Sopenharmony_ci#define MMUCR1_DTTID		0x00010000	/* DERAT thdid field as TID */
5962306a36Sopenharmony_ci#define MMUCR1_DCCD		0x00008000	/* DERAT class ignore */
6062306a36Sopenharmony_ci#define MMUCR1_TLBWE_BINV	0x00004000	/* back invalidate on tlbwe */
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ci/* A2 MMUCR2 bits */
6362306a36Sopenharmony_ci#define MMUCR2_PSSEL_SHIFT	4
6462306a36Sopenharmony_ci
6562306a36Sopenharmony_ci/* A2 MMUCR3 bits */
6662306a36Sopenharmony_ci#define MMUCR3_THID		0x0000000f	/* Thread ID */
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ci/* *** ERAT TLB bits definitions */
6962306a36Sopenharmony_ci#define TLB0_EPN_MASK		ASM_CONST(0xfffffffffffff000)
7062306a36Sopenharmony_ci#define TLB0_CLASS_MASK		ASM_CONST(0x0000000000000c00)
7162306a36Sopenharmony_ci#define TLB0_CLASS_00		ASM_CONST(0x0000000000000000)
7262306a36Sopenharmony_ci#define TLB0_CLASS_01		ASM_CONST(0x0000000000000400)
7362306a36Sopenharmony_ci#define TLB0_CLASS_10		ASM_CONST(0x0000000000000800)
7462306a36Sopenharmony_ci#define TLB0_CLASS_11		ASM_CONST(0x0000000000000c00)
7562306a36Sopenharmony_ci#define TLB0_V			ASM_CONST(0x0000000000000200)
7662306a36Sopenharmony_ci#define TLB0_X			ASM_CONST(0x0000000000000100)
7762306a36Sopenharmony_ci#define TLB0_SIZE_MASK		ASM_CONST(0x00000000000000f0)
7862306a36Sopenharmony_ci#define TLB0_SIZE_4K		ASM_CONST(0x0000000000000010)
7962306a36Sopenharmony_ci#define TLB0_SIZE_64K		ASM_CONST(0x0000000000000030)
8062306a36Sopenharmony_ci#define TLB0_SIZE_1M		ASM_CONST(0x0000000000000050)
8162306a36Sopenharmony_ci#define TLB0_SIZE_16M		ASM_CONST(0x0000000000000070)
8262306a36Sopenharmony_ci#define TLB0_SIZE_1G		ASM_CONST(0x00000000000000a0)
8362306a36Sopenharmony_ci#define TLB0_THDID_MASK		ASM_CONST(0x000000000000000f)
8462306a36Sopenharmony_ci#define TLB0_THDID_0		ASM_CONST(0x0000000000000001)
8562306a36Sopenharmony_ci#define TLB0_THDID_1		ASM_CONST(0x0000000000000002)
8662306a36Sopenharmony_ci#define TLB0_THDID_2		ASM_CONST(0x0000000000000004)
8762306a36Sopenharmony_ci#define TLB0_THDID_3		ASM_CONST(0x0000000000000008)
8862306a36Sopenharmony_ci#define TLB0_THDID_ALL		ASM_CONST(0x000000000000000f)
8962306a36Sopenharmony_ci
9062306a36Sopenharmony_ci#define TLB1_RESVATTR		ASM_CONST(0x00f0000000000000)
9162306a36Sopenharmony_ci#define TLB1_U0			ASM_CONST(0x0008000000000000)
9262306a36Sopenharmony_ci#define TLB1_U1			ASM_CONST(0x0004000000000000)
9362306a36Sopenharmony_ci#define TLB1_U2			ASM_CONST(0x0002000000000000)
9462306a36Sopenharmony_ci#define TLB1_U3			ASM_CONST(0x0001000000000000)
9562306a36Sopenharmony_ci#define TLB1_R			ASM_CONST(0x0000800000000000)
9662306a36Sopenharmony_ci#define TLB1_C			ASM_CONST(0x0000400000000000)
9762306a36Sopenharmony_ci#define TLB1_RPN_MASK		ASM_CONST(0x000003fffffff000)
9862306a36Sopenharmony_ci#define TLB1_W			ASM_CONST(0x0000000000000800)
9962306a36Sopenharmony_ci#define TLB1_I			ASM_CONST(0x0000000000000400)
10062306a36Sopenharmony_ci#define TLB1_M			ASM_CONST(0x0000000000000200)
10162306a36Sopenharmony_ci#define TLB1_G			ASM_CONST(0x0000000000000100)
10262306a36Sopenharmony_ci#define TLB1_E			ASM_CONST(0x0000000000000080)
10362306a36Sopenharmony_ci#define TLB1_VF			ASM_CONST(0x0000000000000040)
10462306a36Sopenharmony_ci#define TLB1_UX			ASM_CONST(0x0000000000000020)
10562306a36Sopenharmony_ci#define TLB1_SX			ASM_CONST(0x0000000000000010)
10662306a36Sopenharmony_ci#define TLB1_UW			ASM_CONST(0x0000000000000008)
10762306a36Sopenharmony_ci#define TLB1_SW			ASM_CONST(0x0000000000000004)
10862306a36Sopenharmony_ci#define TLB1_UR			ASM_CONST(0x0000000000000002)
10962306a36Sopenharmony_ci#define TLB1_SR			ASM_CONST(0x0000000000000001)
11062306a36Sopenharmony_ci
11162306a36Sopenharmony_ci/* A2 erativax attributes definitions */
11262306a36Sopenharmony_ci#define ERATIVAX_RS_IS_ALL		0x000
11362306a36Sopenharmony_ci#define ERATIVAX_RS_IS_TID		0x040
11462306a36Sopenharmony_ci#define ERATIVAX_RS_IS_CLASS		0x080
11562306a36Sopenharmony_ci#define ERATIVAX_RS_IS_FULLMATCH	0x0c0
11662306a36Sopenharmony_ci#define ERATIVAX_CLASS_00		0x000
11762306a36Sopenharmony_ci#define ERATIVAX_CLASS_01		0x010
11862306a36Sopenharmony_ci#define ERATIVAX_CLASS_10		0x020
11962306a36Sopenharmony_ci#define ERATIVAX_CLASS_11		0x030
12062306a36Sopenharmony_ci#define ERATIVAX_PSIZE_4K		(TLB_PSIZE_4K >> 1)
12162306a36Sopenharmony_ci#define ERATIVAX_PSIZE_64K		(TLB_PSIZE_64K >> 1)
12262306a36Sopenharmony_ci#define ERATIVAX_PSIZE_1M		(TLB_PSIZE_1M >> 1)
12362306a36Sopenharmony_ci#define ERATIVAX_PSIZE_16M		(TLB_PSIZE_16M >> 1)
12462306a36Sopenharmony_ci#define ERATIVAX_PSIZE_1G		(TLB_PSIZE_1G >> 1)
12562306a36Sopenharmony_ci
12662306a36Sopenharmony_ci/* A2 eratilx attributes definitions */
12762306a36Sopenharmony_ci#define ERATILX_T_ALL			0
12862306a36Sopenharmony_ci#define ERATILX_T_TID			1
12962306a36Sopenharmony_ci#define ERATILX_T_TGS			2
13062306a36Sopenharmony_ci#define ERATILX_T_FULLMATCH		3
13162306a36Sopenharmony_ci#define ERATILX_T_CLASS0		4
13262306a36Sopenharmony_ci#define ERATILX_T_CLASS1		5
13362306a36Sopenharmony_ci#define ERATILX_T_CLASS2		6
13462306a36Sopenharmony_ci#define ERATILX_T_CLASS3		7
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* XUCR0 bits */
13762306a36Sopenharmony_ci#define XUCR0_TRACE_UM_T0		0x40000000	/* Thread 0 */
13862306a36Sopenharmony_ci#define XUCR0_TRACE_UM_T1		0x20000000	/* Thread 1 */
13962306a36Sopenharmony_ci#define XUCR0_TRACE_UM_T2		0x10000000	/* Thread 2 */
14062306a36Sopenharmony_ci#define XUCR0_TRACE_UM_T3		0x08000000	/* Thread 3 */
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci/* A2 CCR0 register */
14362306a36Sopenharmony_ci#define A2_CCR0_PME_DISABLED		0x00000000
14462306a36Sopenharmony_ci#define A2_CCR0_PME_SLEEP		0x40000000
14562306a36Sopenharmony_ci#define A2_CCR0_PME_RVW			0x80000000
14662306a36Sopenharmony_ci#define A2_CCR0_PME_DISABLED2		0xc0000000
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ci/* A2 CCR2 register */
14962306a36Sopenharmony_ci#define A2_CCR2_ERAT_ONLY_MODE		0x00000001
15062306a36Sopenharmony_ci#define A2_CCR2_ENABLE_ICSWX		0x00000002
15162306a36Sopenharmony_ci#define A2_CCR2_ENABLE_PC		0x20000000
15262306a36Sopenharmony_ci#define A2_CCR2_ENABLE_TRACE		0x40000000
15362306a36Sopenharmony_ci
15462306a36Sopenharmony_ci#endif /* __ASM_POWERPC_REG_A2_H__ */
155