xref: /titanic_51/usr/src/uts/sun4u/sys/opl_olympus_regs.h (revision 444ce08e035c2cafaa89f7236e38bbe82a287904)
125cf1a30Sjl139090 /*
225cf1a30Sjl139090  * CDDL HEADER START
325cf1a30Sjl139090  *
425cf1a30Sjl139090  * The contents of this file are subject to the terms of the
525cf1a30Sjl139090  * Common Development and Distribution License (the "License").
625cf1a30Sjl139090  * You may not use this file except in compliance with the License.
725cf1a30Sjl139090  *
825cf1a30Sjl139090  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
925cf1a30Sjl139090  * or http://www.opensolaris.org/os/licensing.
1025cf1a30Sjl139090  * See the License for the specific language governing permissions
1125cf1a30Sjl139090  * and limitations under the License.
1225cf1a30Sjl139090  *
1325cf1a30Sjl139090  * When distributing Covered Code, include this CDDL HEADER in each
1425cf1a30Sjl139090  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
1525cf1a30Sjl139090  * If applicable, add the following below this CDDL HEADER, with the
1625cf1a30Sjl139090  * fields enclosed by brackets "[]" replaced with your own identifying
1725cf1a30Sjl139090  * information: Portions Copyright [yyyy] [name of copyright owner]
1825cf1a30Sjl139090  *
1925cf1a30Sjl139090  * CDDL HEADER END
2025cf1a30Sjl139090  */
2125cf1a30Sjl139090 /*
221426d65aSsm142603  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
2325cf1a30Sjl139090  * Use is subject to license terms.
2425cf1a30Sjl139090  */
2525cf1a30Sjl139090 
2625cf1a30Sjl139090 #ifndef _SYS_OPL_OLYMPUS_REGS_H
2725cf1a30Sjl139090 #define	_SYS_OPL_OLYMPUS_REGS_H
2825cf1a30Sjl139090 
2925cf1a30Sjl139090 #include <sys/machasi.h>
3025cf1a30Sjl139090 #include <sys/cpu_impl.h>
3125cf1a30Sjl139090 
3225cf1a30Sjl139090 /*
3325cf1a30Sjl139090  * This file is cpu dependent.
3425cf1a30Sjl139090  */
3525cf1a30Sjl139090 
3625cf1a30Sjl139090 #ifdef	__cplusplus
3725cf1a30Sjl139090 extern "C" {
3825cf1a30Sjl139090 #endif
3925cf1a30Sjl139090 
4025cf1a30Sjl139090 #ifdef _ASM
4125cf1a30Sjl139090 /*
4225cf1a30Sjl139090  * assembler doesn't understand the 'ull' suffix for C constants so
4325cf1a30Sjl139090  * use the inttypes.h macros and undefine them here for assembly code
4425cf1a30Sjl139090  */
4525cf1a30Sjl139090 #undef	INT64_C
4625cf1a30Sjl139090 #define	INT64_C(x)	(x)
4725cf1a30Sjl139090 #undef	UINT64_C
4825cf1a30Sjl139090 #define	UINT64_C(x)	(x)
4925cf1a30Sjl139090 #endif	/* _ASM */
5025cf1a30Sjl139090 
5125cf1a30Sjl139090 /*
5225cf1a30Sjl139090  * Synchronous Fault Physical Address Register
5325cf1a30Sjl139090  */
5425cf1a30Sjl139090 #define	OPL_MMU_SFPAR	0x78
5525cf1a30Sjl139090 
5625cf1a30Sjl139090 /*
5725cf1a30Sjl139090  * ASI_MCNTL: MEMORY CONTROL Register layout (ASI 0x45, VA 8)
5825cf1a30Sjl139090  *
5925cf1a30Sjl139090  * +-------------------------+---------+--------+--------+-----+---------+
6025cf1a30Sjl139090  * |   reserved [63:17]      | NC_Cache|fw_fITLB|fw_fDTLB|00000|JPS1_TSBP|
6125cf1a30Sjl139090  * +-------------------------+---------+--------+--------+-----+---------+
6225cf1a30Sjl139090  *                              16       15       14      13-9   8
6325cf1a30Sjl139090  * +---------+---------+------+
6425cf1a30Sjl139090  * |mpg_sITLB|mpg_sDTLB|000000|
6525cf1a30Sjl139090  * +---------+---------+------+
6625cf1a30Sjl139090  *  7         6         5-0
6725cf1a30Sjl139090  */
6825cf1a30Sjl139090 #define	ASI_MCNTL	0x45
6925cf1a30Sjl139090 #define	LSU_MCNTL	0x8		/* vaddr offset of ASI_MCNTL	*/
7025cf1a30Sjl139090 #define	MCNTL_FW_FDTLB	INT64_C(0x0000000000004000)
7125cf1a30Sjl139090 #define	MCNTL_FW_FITLB	INT64_C(0x0000000000008000)
7225cf1a30Sjl139090 #define	MCNTL_JPS1_TSBP	INT64_C(0x0000000000000100)
7325cf1a30Sjl139090 #define	MCNTL_MPG_SITLB	INT64_C(0x0000000000000080)
7425cf1a30Sjl139090 #define	MCNTL_MPG_SDTLB	INT64_C(0x0000000000000040)
7525cf1a30Sjl139090 #define	MCNTL_SPECULATIVE_SHIFT	41	/* bit 41 is speculative mode bit */
7625cf1a30Sjl139090 
7725cf1a30Sjl139090 /*
7825cf1a30Sjl139090  * ASI_UGESR: URGENT ERROR STATES layout (ASI 0x4C, VA 0x8)
7925cf1a30Sjl139090  *
8025cf1a30Sjl139090  * +--------+---+----+----+---+---+--+--+---+---+-+----+----+----+
8125cf1a30Sjl139090  * |0[63:23]|CRE|TSBX|TSBP|PST|TST| F| R|SDC|WDT|0|DTLB|ITLB|CORE|
8225cf1a30Sjl139090  * +--------+---+----+----+---+---+--+--+---+---+-+----+----+----+
8325cf1a30Sjl139090  *           22  21   20   19  18 17 16  15  14    10    9    8
8425cf1a30Sjl139090  * +-------+----+---+---+---+
8525cf1a30Sjl139090  * |INSTEND|PRIV|DAE|IAE|UGE|
8625cf1a30Sjl139090  * +-------+----+---+---+---+
8725cf1a30Sjl139090  *  5  4    3    2   1   0
8825cf1a30Sjl139090  *
8925cf1a30Sjl139090  */
9025cf1a30Sjl139090 #define	ASI_UGERSR		0x8
9125cf1a30Sjl139090 #define	UGESR_IAUG_CRE		INT64_C(0x0000000000400000)
9225cf1a30Sjl139090 #define	UGESR_IAUG_TSBCTXT	INT64_C(0x0000000000200000)
9325cf1a30Sjl139090 #define	UGESR_IUG_TSBP		INT64_C(0x0000000000100000)
9425cf1a30Sjl139090 #define	UGESR_IUG_PSTATE	INT64_C(0x0000000000080000)
9525cf1a30Sjl139090 #define	UGESR_IUG_TSTATE	INT64_C(0x0000000000040000)
9625cf1a30Sjl139090 #define	UGESR_IUG_F		INT64_C(0x0000000000020000)
9725cf1a30Sjl139090 #define	UGESR_IUG_R		INT64_C(0x0000000000010000)
9825cf1a30Sjl139090 #define	UGESR_AUG_SDC		INT64_C(0x0000000000008000)
9925cf1a30Sjl139090 #define	UGESR_IUG_WDT		INT64_C(0x0000000000004000)
10025cf1a30Sjl139090 #define	UGESR_IUG_DTLB		INT64_C(0x0000000000000400)
10125cf1a30Sjl139090 #define	UGESR_IUG_ITLB		INT64_C(0x0000000000000200)
10225cf1a30Sjl139090 #define	UGESR_IUG_COREERR	INT64_C(0x0000000000000100)
10325cf1a30Sjl139090 #define	UGESR_PRIV		INT64_C(0x0000000000000008)
10425cf1a30Sjl139090 #define	UGESR_MULTI_DAE		INT64_C(0x0000000000000004)
10525cf1a30Sjl139090 #define	UGESR_MULTI_IAE		INT64_C(0x0000000000000002)
10625cf1a30Sjl139090 #define	UGESR_MULTI_UGE		INT64_C(0x0000000000000001)
10725cf1a30Sjl139090 
10825cf1a30Sjl139090 #define	UGESR_CAN_RECOVER	(UGESR_IUG_DTLB |	\
10925cf1a30Sjl139090 				UGESR_IUG_ITLB |	\
11025cf1a30Sjl139090 				UGESR_IUG_COREERR)
11125cf1a30Sjl139090 
11225cf1a30Sjl139090 #define	UGESR_MULTI	(UGESR_MULTI_DAE |	\
11325cf1a30Sjl139090 			UGESR_MULTI_IAE |	\
11425cf1a30Sjl139090 			UGESR_MULTI_UGE)
11525cf1a30Sjl139090 
11625cf1a30Sjl139090 #define	UGESR_NOSYNC_PANIC	(UGESR_IAUG_CRE  |	\
11725cf1a30Sjl139090 				UGESR_AUG_SDC   |	\
11825cf1a30Sjl139090 				UGESR_MULTI_DAE |	\
11925cf1a30Sjl139090 				UGESR_MULTI_IAE |	\
12025cf1a30Sjl139090 				UGESR_MULTI_UGE)
12125cf1a30Sjl139090 /*
12225cf1a30Sjl139090  * The value means 10000 Mz per 10ms.
12325cf1a30Sjl139090  */
12425cf1a30Sjl139090 #define	OPL_UGER_STICK_DIFF	10000
12525cf1a30Sjl139090 
12625cf1a30Sjl139090 
12725cf1a30Sjl139090 /*
12825cf1a30Sjl139090  * ASI_ECR: Control of Error Action layout (ASI 0x4C, VA 0x10)
12925cf1a30Sjl139090  *
13025cf1a30Sjl139090  * +-------------------------+------+--------+-----+-------+-----------+
13125cf1a30Sjl139090  * |   reserved [63:10]      |RTE_UE|RTE_CEDG|0...0|WEAK_ED|UGE_HANDLER|
13225cf1a30Sjl139090  * +-------------------------+------+--------+-----+-------+-----------+
13325cf1a30Sjl139090  *                              9        8    7 - 2    1       0
13425cf1a30Sjl139090  *
13525cf1a30Sjl139090  */
13625cf1a30Sjl139090 #define	ASI_ECR			ASI_AFSR
13725cf1a30Sjl139090 #define	AFSR_ECR		0x10
13825cf1a30Sjl139090 #define	ASI_ECR_RTE_UE		INT64_C(0x0000000000000200)
13925cf1a30Sjl139090 #define	ASI_ECR_RTE_CEDG	INT64_C(0x0000000000000100)
14025cf1a30Sjl139090 #define	ASI_ECR_WEAK_ED		INT64_C(0x0000000000000002)
14125cf1a30Sjl139090 #define	ASI_ECR_UGE_HANDLER	INT64_C(0x0000000000000001)
14225cf1a30Sjl139090 
14325cf1a30Sjl139090 
14425cf1a30Sjl139090 /*
14525cf1a30Sjl139090  * ASI_L2_CTRL: Level-2 Cache Control Register (ASI 0x6A, VA 0x10)
14625cf1a30Sjl139090  *
14725cf1a30Sjl139090  * +---------------------+--------+-----+---------+----+--------+
14825cf1a30Sjl139090  * |   reserved[63:25]   |UGE_TRAP|0...0|NUMINSWAY|0..0|U2_FLUSH|
14925cf1a30Sjl139090  * +---------------------+--------+-----+---------+----+--------+
15025cf1a30Sjl139090  *                          24    23  19 18     16 15 1     0
15125cf1a30Sjl139090  *
15225cf1a30Sjl139090  */
15325cf1a30Sjl139090 #define	ASI_L2_CTRL			0x6A	/* L2$ Control Register */
15425cf1a30Sjl139090 #define	ASI_L2_CTRL_RW_ADDR		0x10
15525cf1a30Sjl139090 #define	ASI_L2_CTRL_UGE_TRAP		INT64_C(0x0000000001000000)
15625cf1a30Sjl139090 #define	ASI_L2_CTRL_NUMINSWAY_MASK	INT64_C(0x0000000000070000)
15725cf1a30Sjl139090 #define	ASI_L2_CTRL_U2_FLUSH		INT64_C(0x0000000000000001)
15825cf1a30Sjl139090 
15925cf1a30Sjl139090 
16025cf1a30Sjl139090 /*
16125cf1a30Sjl139090  * Synchronous Fault Status Register Layout (ASI 0x50/0x58, VA 0x18)
16225cf1a30Sjl139090  *
16325cf1a30Sjl139090  * IMMU and DMMU maintain their own SFSR Register
16425cf1a30Sjl139090  *
16525cf1a30Sjl139090  * +----+----+-----+----+--+-----+--+---+-+----+--+--+-----+--+-+
16625cf1a30Sjl139090  * |TLB#|0..0|index|0..0|MK| EID |UE|UPA|0|mTLB|NC|NF| ASI |TM|0|
16725cf1a30Sjl139090  * +----+----+-----+----+--+-----+--+---+-+----+--+--+-----+--+-+
16825cf1a30Sjl139090  * 63 62 61    58   48   46 45 32 31 30 28 27   25 24 23 16 15 14
16925cf1a30Sjl139090  * +----+-+---+--+-+--+--+
17025cf1a30Sjl139090  * | FT |E| CT|PR|W|OW|FV|
17125cf1a30Sjl139090  * +----+-+---+--+-+--+--+
17225cf1a30Sjl139090  *  13 7 6 5 4 3  2 1  0
17325cf1a30Sjl139090  *
17425cf1a30Sjl139090  */
17525cf1a30Sjl139090 #define	SFSR_MK_UE	INT64_C(0x0000400000000000)
17625cf1a30Sjl139090 #define	SFSR_EID_MOD	INT64_C(0x0000300000000000)
17725cf1a30Sjl139090 #define	SFSR_EID_SID	INT64_C(0x00000FFF00000000)
17825cf1a30Sjl139090 #define	SFSR_UE		INT64_C(0x0000000080000000)
17925cf1a30Sjl139090 #define	SFSR_BERR	INT64_C(0x0000000040000000)
18025cf1a30Sjl139090 #define	SFSR_TO		INT64_C(0x0000000020000000)
18125cf1a30Sjl139090 #define	SFSR_TLB_MUL	INT64_C(0x0000000008000000)
18225cf1a30Sjl139090 #define	SFSR_TLB_PRT	INT64_C(0x0000000004000000)
18325cf1a30Sjl139090 
18425cf1a30Sjl139090 #define	SFSR_EID_MOD_SHIFT		44
18525cf1a30Sjl139090 #define	SFSR_EID_SID_SHIFT		32
18625cf1a30Sjl139090 
18725cf1a30Sjl139090 /*
18825cf1a30Sjl139090  * Error Mark ID: Module Type
18925cf1a30Sjl139090  */
19025cf1a30Sjl139090 #define	OPL_ERRID_MEM		0
19125cf1a30Sjl139090 #define	OPL_ERRID_CHANNEL	1
19225cf1a30Sjl139090 #define	OPL_ERRID_CPU		2
19325cf1a30Sjl139090 #define	OPL_ERRID_PATH		3
19425cf1a30Sjl139090 
19525cf1a30Sjl139090 
19625cf1a30Sjl139090 #define	SFSR_ERRS	(SFSR_UE | SFSR_BERR |	\
19725cf1a30Sjl139090 	    SFSR_TO | SFSR_TLB_MUL |		\
19825cf1a30Sjl139090 	    SFSR_TLB_PRT)
19925cf1a30Sjl139090 
20025cf1a30Sjl139090 #define	SFSR_MEMORY	(SFSR_UE |	\
20125cf1a30Sjl139090 	    SFSR_BERR |			\
20225cf1a30Sjl139090 	    SFSR_TO)
20325cf1a30Sjl139090 
20425cf1a30Sjl139090 /*
20525cf1a30Sjl139090  * Miscellaneous ASI definitions
20625cf1a30Sjl139090  */
20725cf1a30Sjl139090 #define	ASI_IIU_INST_TRAP	0x60	/* Instruction breakpoint */
20825cf1a30Sjl139090 #define	ASI_ALL_FLUSH_L1I	0x67	/* Flush Level-1 Inst. cache */
20925cf1a30Sjl139090 #define	ASI_L2_TAG_READ		0x6B	/* L2 Diagnostics Tag Read */
21025cf1a30Sjl139090 #define	ASI_L2_TAG_READ_REG	0x6C	/* L2 Diagnostics Tag Read Register */
21125cf1a30Sjl139090 #define	ASI_EIDR		0x6E	/* Urgent errors */
21225cf1a30Sjl139090 #define	ASI_CACHE_INV		0x74	/* Cache invalidation */
21325cf1a30Sjl139090 #define	ASI_ERR_INJCT		0x76	/* Error injection */
21425cf1a30Sjl139090 /*
21525cf1a30Sjl139090  * Address of ASI scratch register. ASI 0x4F
21625cf1a30Sjl139090  */
21725cf1a30Sjl139090 #define	OPL_SCRATCHPAD_SAVE_AG1	0x00	/* used for saving global registers */
21825cf1a30Sjl139090 #define	OPL_SCRATCHPAD_SAVE_AG2	0x08	/* used for saving global registers */
21925cf1a30Sjl139090 #define	OPL_SCRATCHPAD_SAVE_AG3	0x10	/* used for saving global registers */
22025cf1a30Sjl139090 #define	OPL_SCRATCHPAD_ERRLOG	0x18	/* keeps EIDR, log's PA & err counter */
22125cf1a30Sjl139090 #define	OPL_SCRATCHPAD_UTSBREG4	0x20
2221426d65aSsm142603 #define	OPL_SCRATCHPAD_UTSBREG5 0x28
2231426d65aSsm142603 #define	OPL_SCRATCHPAD_UTSBREG6 0x30
22425cf1a30Sjl139090 #define	OPL_SCRATCHPAD_UNUSED7  0x38
22525cf1a30Sjl139090 
22625cf1a30Sjl139090 /*
22725cf1a30Sjl139090  * Error log scratchpad register format.
22825cf1a30Sjl139090  *
22925cf1a30Sjl139090  * +--------+-------------------+----------+
23025cf1a30Sjl139090  * |ASI_EIDR| PA to logging buf | # of err |
23125cf1a30Sjl139090  * +--------+-------------------+----------+
23225cf1a30Sjl139090  *  63    50 49                6 5        0
23325cf1a30Sjl139090  *
23425cf1a30Sjl139090  */
23525cf1a30Sjl139090 
23625cf1a30Sjl139090 #define	ERRLOG_REG_LOGPA_MASK	INT64_C(0x0003ffffffffffc0) /* PA to log */
23725cf1a30Sjl139090 #define	ERRLOG_REG_NUMERR_MASK	INT64_C(0x000000000000003f) /* Counter */
23825cf1a30Sjl139090 #define	ERRLOG_REG_EIDR_MASK	INT64_C(0x0000000000003fff) /* EIDR */
23925cf1a30Sjl139090 
24025cf1a30Sjl139090 #define	ERRLOG_REG_EIDR_SHIFT	50
24125cf1a30Sjl139090 #define	ERRLOG_REG_ERR_SHIFT	6
24225cf1a30Sjl139090 #define	ERRLOG_REG_EIDR(reg)	((reg >> ERRLOG_REG_EIDR_SHIFT) &	\
24325cf1a30Sjl139090 	    ERRLOG_REG_EIDR_MASK)
24425cf1a30Sjl139090 #define	ERRLOG_REG_LOGPA(reg)	(reg & ERRLOG_REG_LOGPA_MASK)
24525cf1a30Sjl139090 #define	ERRLOG_REG_NUMERR(reg)	(reg & ERRLOG_REG_NUMERR_MASK)
24625cf1a30Sjl139090 
24725cf1a30Sjl139090 #define	ERRLOG_BUFSZ		0x2000
24825cf1a30Sjl139090 #define	ERRLOG_SZ		(1 << ERRLOG_REG_ERR_SHIFT)
24925cf1a30Sjl139090 #define	ERRLOG_ALLOC_SZ		(ERRLOG_BUFSZ * 512)
25025cf1a30Sjl139090 
25125cf1a30Sjl139090 /*
25225cf1a30Sjl139090  * Olympus-C default cache parameters.
25325cf1a30Sjl139090  */
25425cf1a30Sjl139090 #define	OPL_DCACHE_SIZE		0x20000
25525cf1a30Sjl139090 #define	OPL_DCACHE_LSIZE	0x40
25625cf1a30Sjl139090 #define	OPL_ICACHE_SIZE		0x20000
25725cf1a30Sjl139090 #define	OPL_ICACHE_LSIZE	0x40
25825cf1a30Sjl139090 #define	OPL_ECACHE_SIZE		0x600000
25925cf1a30Sjl139090 #define	OPL_ECACHE_LSIZE	0x100
26025cf1a30Sjl139090 #define	OPL_ECACHE_NWAY		12
26125cf1a30Sjl139090 #define	OPL_ECACHE_SETSIZE	0x80000
26225cf1a30Sjl139090 
26325cf1a30Sjl139090 /*
264*444ce08eSDonghai Qiao  * OPL platform has no vac consistent issue. So set it to 8KB.
26525cf1a30Sjl139090  */
266*444ce08eSDonghai Qiao #define	OPL_VAC_SIZE		0x2000
26725cf1a30Sjl139090 
26825cf1a30Sjl139090 /* these are field offsets for opl_errlog structure */
26925cf1a30Sjl139090 #define	LOG_STICK_OFF	0x0
27025cf1a30Sjl139090 #define	LOG_TL_OFF	0x8
27125cf1a30Sjl139090 #define	LOG_ASI3_OFF	0x10
27225cf1a30Sjl139090 #define	LOG_SFSR_OFF	0x18
27325cf1a30Sjl139090 #define	LOG_SFAR_OFF	0x20
27425cf1a30Sjl139090 
27525cf1a30Sjl139090 #define	LOG_UGER_OFF	0x18
27625cf1a30Sjl139090 #define	LOG_TSTATE_OFF	0x20
27725cf1a30Sjl139090 #define	LOG_TPC_OFF	0x28
27825cf1a30Sjl139090 
27925cf1a30Sjl139090 #ifndef	_ASM
28025cf1a30Sjl139090 typedef struct opl_errlog {
28125cf1a30Sjl139090 	uint64_t stick;
28225cf1a30Sjl139090 	uint32_t tl;
28325cf1a30Sjl139090 	uint32_t tt;
28425cf1a30Sjl139090 	uint64_t asi3;
28525cf1a30Sjl139090 	union {
28625cf1a30Sjl139090 		struct {
28725cf1a30Sjl139090 			uint64_t sfsr;
28825cf1a30Sjl139090 			union {
28925cf1a30Sjl139090 				uint64_t sfar;
29025cf1a30Sjl139090 				uint64_t sfpar;
29125cf1a30Sjl139090 			} sync_addr;
29225cf1a30Sjl139090 		} sync;
29325cf1a30Sjl139090 		struct {
29425cf1a30Sjl139090 			uint64_t ugesr;
29525cf1a30Sjl139090 			uint64_t tstate;
29625cf1a30Sjl139090 		} ugesr;
29725cf1a30Sjl139090 	} reg;
29825cf1a30Sjl139090 	uint64_t tpc;
29925cf1a30Sjl139090 } opl_errlog_t;
30025cf1a30Sjl139090 #endif /* _ASM */
30125cf1a30Sjl139090 
30225cf1a30Sjl139090 #ifdef	__cplusplus
30325cf1a30Sjl139090 }
30425cf1a30Sjl139090 #endif
30525cf1a30Sjl139090 
30625cf1a30Sjl139090 #endif	/* _SYS_OPL_OLYMPUS_REGS_H */
307