xref: /titanic_53/usr/src/uts/sun4u/sys/cheetahregs.h (revision 25cf1a301a396c38e8adf52c15f537b80d2483f7)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*25cf1a30Sjl139090  * Common Development and Distribution License (the "License").
6*25cf1a30Sjl139090  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22af3c157aSrscott  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef _SYS_CHEETAHREGS_H
277c478bd9Sstevel@tonic-gate #define	_SYS_CHEETAHREGS_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #include <sys/machasi.h>
32*25cf1a30Sjl139090 #include <sys/cpu_impl.h>
337c478bd9Sstevel@tonic-gate #ifdef _KERNEL
347c478bd9Sstevel@tonic-gate #include <sys/fpras.h>
357c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  * This file is cpu dependent.
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
427c478bd9Sstevel@tonic-gate extern "C" {
437c478bd9Sstevel@tonic-gate #endif
447c478bd9Sstevel@tonic-gate 
457c478bd9Sstevel@tonic-gate /*
467c478bd9Sstevel@tonic-gate  * Cheetah includes the process info in its mask to make things
477c478bd9Sstevel@tonic-gate  * more difficult.  The process is the low bit of the major mask,
487c478bd9Sstevel@tonic-gate  * so to convert to the netlist major:
497c478bd9Sstevel@tonic-gate  * netlist_major = ((mask_major >> 1) + 1)
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	REMAP_CHEETAH_MASK(x)	(((((x) >> 1) + 0x10) & 0xf0) | ((x) & 0xf))
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #ifdef _ASM
547c478bd9Sstevel@tonic-gate /*
557c478bd9Sstevel@tonic-gate  * assembler doesn't understand the 'ull' suffix for C constants so
567c478bd9Sstevel@tonic-gate  * use the inttypes.h macros and undefine them here for assembly code
577c478bd9Sstevel@tonic-gate  */
587c478bd9Sstevel@tonic-gate #undef INT64_C
597c478bd9Sstevel@tonic-gate #undef UINT64_C
607c478bd9Sstevel@tonic-gate #define	INT64_C(x)	(x)
617c478bd9Sstevel@tonic-gate #define	UINT64_C(x)	(x)
627c478bd9Sstevel@tonic-gate #endif	/* _ASM */
637c478bd9Sstevel@tonic-gate 
647c478bd9Sstevel@tonic-gate /*
657c478bd9Sstevel@tonic-gate  * DCU Control Register
667c478bd9Sstevel@tonic-gate  *
677c478bd9Sstevel@tonic-gate  * +------+----+----+----+----+----+-----+-----+----+----+----+
687c478bd9Sstevel@tonic-gate  * | Resv | CP | CV | ME | RE | PE | HPE | SPE | SL | WE | PM |
697c478bd9Sstevel@tonic-gate  * +------+----+----+----+----+----+-----+-----+----+----+----+
707c478bd9Sstevel@tonic-gate  *  63:50   49   48   47   46	45    44    43   42   41 40:33
717c478bd9Sstevel@tonic-gate  *
727c478bd9Sstevel@tonic-gate  * +----+----+----+----+----+----------+-----+----+----+----+---+
737c478bd9Sstevel@tonic-gate  * | VM | PR | PW | VR | VW | Reserved | WIH | DM | IM | DC | IC|
747c478bd9Sstevel@tonic-gate  * +----+----+----+----+----+----------+-----+----+----+----+---+
757c478bd9Sstevel@tonic-gate  * 32:25  24   23   22   21      20:5     4     3    2    1   0
767c478bd9Sstevel@tonic-gate  */
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate #define	ASI_DCU	ASI_LSU			    /* same as spitfire ASI_LSU 0x45 */
797c478bd9Sstevel@tonic-gate #define	DCU_IC	INT64_C(0x0000000000000001) /* icache enable		*/
807c478bd9Sstevel@tonic-gate #define	DCU_DC	INT64_C(0x0000000000000002) /* dcache enable		*/
817c478bd9Sstevel@tonic-gate #define	DCU_IM	INT64_C(0x0000000000000004) /* immu enable		*/
827c478bd9Sstevel@tonic-gate #define	DCU_DM	INT64_C(0x0000000000000008) /* dmmu enable		*/
837c478bd9Sstevel@tonic-gate #define	DCU_WIH	INT64_C(0x0000000000000010) /* Jaguar only - W$ hash index */
847c478bd9Sstevel@tonic-gate #define	DCU_VW	INT64_C(0x0000000000200000) /* virt watchpoint write enable  */
857c478bd9Sstevel@tonic-gate #define	DCU_VR	INT64_C(0x0000000000400000) /* virt watchpoint read enable   */
867c478bd9Sstevel@tonic-gate #define	DCU_PW	INT64_C(0x0000000000800000) /* phys watchpoint write enable  */
877c478bd9Sstevel@tonic-gate #define	DCU_PR	INT64_C(0x0000000001000000) /* phys watchpoint read enable   */
887c478bd9Sstevel@tonic-gate #define	DCU_VM	INT64_C(0x00000001FE000000) /* virtual watchpoint write mask */
897c478bd9Sstevel@tonic-gate #define	DCU_PM	INT64_C(0x000001FE00000000) /* phys watchpoint write mask    */
907c478bd9Sstevel@tonic-gate #define	DCU_WE	INT64_C(0x0000020000000000) /* write cache enable	*/
917c478bd9Sstevel@tonic-gate #define	DCU_SL	INT64_C(0x0000040000000000) /* second load control	*/
927c478bd9Sstevel@tonic-gate #define	DCU_SPE	INT64_C(0x0000080000000000) /* software prefetch enable */
937c478bd9Sstevel@tonic-gate #define	DCU_HPE	INT64_C(0x0000100000000000) /* hardware prefetch enable */
947c478bd9Sstevel@tonic-gate #define	DCU_PE	INT64_C(0x0000200000000000) /* prefetch enable		*/
957c478bd9Sstevel@tonic-gate #define	DCU_RE	INT64_C(0x0000400000000000) /* RAW bypass enable	*/
967c478bd9Sstevel@tonic-gate #define	DCU_ME	INT64_C(0x0000800000000000) /* noncache store merging enable */
977c478bd9Sstevel@tonic-gate #define	DCU_CV	INT64_C(0x0001000000000000) /* virt cacheability when DM=0   */
987c478bd9Sstevel@tonic-gate #define	DCU_CP	INT64_C(0x0002000000000000) /* phys cacheable when DM,IM=0   */
997c478bd9Sstevel@tonic-gate #define	DCU_CACHE (DCU_IC|DCU_DC|DCU_WE|DCU_SPE|DCU_HPE|DCU_PE)
1007c478bd9Sstevel@tonic-gate 
1017c478bd9Sstevel@tonic-gate /*
1027c478bd9Sstevel@tonic-gate  * bit shifts for the prefetch enable bit
1037c478bd9Sstevel@tonic-gate  */
1047c478bd9Sstevel@tonic-gate #define	DCU_PE_SHIFT	45
1057c478bd9Sstevel@tonic-gate 
1067c478bd9Sstevel@tonic-gate /*
1077c478bd9Sstevel@tonic-gate  * Safari Configuration Register
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate #define	ASI_SAFARI_CONFIG	ASI_UPA_CONFIG /* Safari Config Reg, 0x4A */
1107c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_1	INT64_C(0x0000000000000000) /* 1/1 clock */
1117c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_1_DIV	1	/* clock divisor: 1 */
1127c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_2	INT64_C(0x0000000040000000) /* 1/2 clock */
1137c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_2_DIV	2	/* clock divisor: 2 */
1147c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_32	INT64_C(0x0000000080000000) /* 1/32 clock */
1157c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_32_DIV	32	/* clock divisor: 32 */
1167c478bd9Sstevel@tonic-gate #define	SAFARI_CONFIG_ECLK_MASK	(SAFARI_CONFIG_ECLK_32 | SAFARI_CONFIG_ECLK_2)
1177c478bd9Sstevel@tonic-gate 
1187c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * JBUS Configuration Register
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate #define	ASI_JBUS_CONFIG		ASI_UPA_CONFIG /* JBUS Config Reg, 0x4A */
1237c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_1	INT64_C(0x0000000000000000) /* 1/1 clock */
1247c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_1_DIV	1	/* clock divisor: 1 */
1257c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_2	INT64_C(0x0000000000002000) /* 1/2 clock */
1267c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_2_DIV	2	/* clock divisor: 2 */
1277c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_32	INT64_C(0x0000000000004000) /* 1/32 clock */
1287c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_32_DIV	32	/* clock divisor: 32 */
1297c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_MASK	(JBUS_CONFIG_ECLK_32 | JBUS_CONFIG_ECLK_2)
1307c478bd9Sstevel@tonic-gate #define	JBUS_CONFIG_ECLK_SHIFT	13
1317c478bd9Sstevel@tonic-gate 
1327c478bd9Sstevel@tonic-gate /*
1337c478bd9Sstevel@tonic-gate  * Jalapeno/Serrano MCU control registers and ASI
1347c478bd9Sstevel@tonic-gate  */
1357c478bd9Sstevel@tonic-gate #define	ASI_MCU_CTRL		0x72		/* MCU Control Reg ASI */
1367c478bd9Sstevel@tonic-gate #define	JP_MCU_FSM_MASK		INT64_C(0x0000000006000000) /* 26..25 */
1377c478bd9Sstevel@tonic-gate #define	JP_MCU_FSM_SHIFT	25
1387c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate #if defined(SERRANO)
1417c478bd9Sstevel@tonic-gate #define	ASI_MCU_AFAR2_VA	0x18	/* captures FRC/FRU addr */
1427c478bd9Sstevel@tonic-gate #endif	/* SERRANO */
1437c478bd9Sstevel@tonic-gate 
1447c478bd9Sstevel@tonic-gate #if defined(JALAPENO) && defined(JALAPENO_ERRATA_85)
1457c478bd9Sstevel@tonic-gate /*
1467c478bd9Sstevel@tonic-gate  * Tomatillo Estar control registers (for JP Errataum 85)
1477c478bd9Sstevel@tonic-gate  */
1487c478bd9Sstevel@tonic-gate #define	JBUS_SLAVE_T_PORT_BIT	48
1497c478bd9Sstevel@tonic-gate #define	TOM_HIGH_PA		0x400		/* Hi 32 bit of Tom reg PA */
1507c478bd9Sstevel@tonic-gate #define	M_T_ESTAR_CTRL_PA	0x0f410050	/* M T estar PA */
1517c478bd9Sstevel@tonic-gate #define	S_T_ESTAR_CTRL_PA	0x0e410050	/* S T estar PA */
1527c478bd9Sstevel@tonic-gate #define	M_T_J_CHNG_INIT_PA	0x0f410058	/* Master T estar PA */
1537c478bd9Sstevel@tonic-gate #define	TOM_ESTAR_ELCK_MASK	0x23		/* bit 5,1,0 */
1547c478bd9Sstevel@tonic-gate #define	TOM_FULL_SPEED		0x1
1557c478bd9Sstevel@tonic-gate #define	TOM_HALF_SPEED		0x2
1567c478bd9Sstevel@tonic-gate #define	TOM_SLOW_SPEED		0x20
1577c478bd9Sstevel@tonic-gate #define	TOM_TRIGGER_MASK	0x18
1587c478bd9Sstevel@tonic-gate #define	TOM_TRIGGER		0x10
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate #endif /* JALAPENO && JALAPENO_ERRATA_85 */
1617c478bd9Sstevel@tonic-gate 
1627c478bd9Sstevel@tonic-gate 
1637c478bd9Sstevel@tonic-gate /*
1647c478bd9Sstevel@tonic-gate  * Miscellaneous ASI definitions not in machasi.h
1657c478bd9Sstevel@tonic-gate  */
1667c478bd9Sstevel@tonic-gate #define	ASI_DC_UTAG		0x43	/* Dcache Microtag Fields */
1677c478bd9Sstevel@tonic-gate #define	ASI_DC_SNP_TAG		0x44	/* Dcache Snoop Tag Fields */
1687c478bd9Sstevel@tonic-gate #define	ASI_IC_SNP_TAG		0x68	/* Icache Snoop Tag Fields */
1697c478bd9Sstevel@tonic-gate #define	ASI_IPB_DATA		0x69	/* Instruction Prefetch Buffer Data */
1707c478bd9Sstevel@tonic-gate #define	ASI_IPB_TAG		0x6A	/* Instruction Prefetch Buffer Tag */
1717c478bd9Sstevel@tonic-gate #define	ASI_MC_DECODE		0x72	/* Memory Address Decoding Registers */
1727c478bd9Sstevel@tonic-gate #define	ASI_EC_CFG_TIMING	0x73	/* Jaguar shared Ecache Control Reg */
1737c478bd9Sstevel@tonic-gate #define	ASI_EC_DATA		0x74	/* Ecache Data Staging Registers */
1747c478bd9Sstevel@tonic-gate #define	ASI_EC_CTRL		0x75	/* Ecache Control Register */
1757c478bd9Sstevel@tonic-gate #define	ASI_PC_STATUS_DATA	0x30	/* Pcache Status Data Access */
1767c478bd9Sstevel@tonic-gate #define	ASI_PC_DATA		0x31	/* Pcache Diagnostic Data Register */
1777c478bd9Sstevel@tonic-gate #define	ASI_PC_TAG		0x32	/* Pcache Virtual Tag/Valid Field */
1787c478bd9Sstevel@tonic-gate #define	ASI_PC_SNP_TAG		0x33	/* Pcache Snoop Tag Register */
1797c478bd9Sstevel@tonic-gate #define	ASI_L2_DATA		0x6B	/* L2 cache Data Diagnostic Access */
1807c478bd9Sstevel@tonic-gate #define	ASI_L2_TAG		0x6C	/* L2 cache Tag Diagnostic Access */
1817c478bd9Sstevel@tonic-gate 
1827c478bd9Sstevel@tonic-gate /*
1837c478bd9Sstevel@tonic-gate  * Bits of Cheetah Asynchronous Fault Status Register
1847c478bd9Sstevel@tonic-gate  *
1857c478bd9Sstevel@tonic-gate  * +---+--+----+----+----+----+---+---+---+---+--+----
1867c478bd9Sstevel@tonic-gate  * |rsv|ME|PRIV|PERR|IERR|ISAP|EMC|EMU|IVC|IVU|TO|BERR
1877c478bd9Sstevel@tonic-gate  * +---+--+----+----+----+----+---+---+---+---+--+----
1887c478bd9Sstevel@tonic-gate  * 63:54 53 52   51   50   49   48  47  46  45 44  43
1897c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+------+---+-------+
1907c478bd9Sstevel@tonic-gate  * |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|rsv|M_SYND|rsv||E_SYND|
1917c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+------+---+-------+
1927c478bd9Sstevel@tonic-gate  *   42  41  40  39  38  37  36  35 34 33 32:20 19:16 15:9 8:0
1937c478bd9Sstevel@tonic-gate  *
1947c478bd9Sstevel@tonic-gate  */
1957c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
1967c478bd9Sstevel@tonic-gate /*
1977c478bd9Sstevel@tonic-gate  * Bits of Cheetah+ Asynchronous Fault Status Register
1987c478bd9Sstevel@tonic-gate  *
1997c478bd9Sstevel@tonic-gate  * +------------------+----------------------------
2007c478bd9Sstevel@tonic-gate  * |rsv|TUE_SH|IMC|IMU|DTO|DBERR|THCE|TSCE|TUE|DUE|
2017c478bd9Sstevel@tonic-gate  * +------------------+---------------------------- . . .
2027c478bd9Sstevel@tonic-gate  *   63    62   61  60  59    58   57   56  55  54
2037c478bd9Sstevel@tonic-gate  *
2047c478bd9Sstevel@tonic-gate  * Note that bits 60-62 are only implemented in Panther (reserved
2057c478bd9Sstevel@tonic-gate  * in Cheetah+ and Jaguar. Also, bit 56 is reserved in Panther instead
2067c478bd9Sstevel@tonic-gate  * of TSCE since those errors are HW corrected in Panther.
2077c478bd9Sstevel@tonic-gate  */
2087c478bd9Sstevel@tonic-gate #define	C_AFSR_TUE_SH INT64_C(0x4000000000000000) /* uncorrectable tag UE  */
2097c478bd9Sstevel@tonic-gate #define	C_AFSR_IMC  INT64_C(0x2000000000000000)	/* intr vector MTAG ECC */
2107c478bd9Sstevel@tonic-gate #define	C_AFSR_IMU  INT64_C(0x1000000000000000)	/* intr vector MTAG ECC */
2117c478bd9Sstevel@tonic-gate #define	C_AFSR_DTO  INT64_C(0x0800000000000000)	/* disrupting TO error */
2127c478bd9Sstevel@tonic-gate #define	C_AFSR_DBERR INT64_C(0x0400000000000000) /* disrupting BERR error */
2137c478bd9Sstevel@tonic-gate #define	C_AFSR_THCE INT64_C(0x0200000000000000)	/* h/w correctable E$ tag err */
2147c478bd9Sstevel@tonic-gate #define	C_AFSR_TSCE INT64_C(0x0100000000000000)	/* s/w correctable E$ tag err */
2157c478bd9Sstevel@tonic-gate #define	C_AFSR_TUE  INT64_C(0x0080000000000000)	/* uncorrectable E$ tag error */
2167c478bd9Sstevel@tonic-gate #define	C_AFSR_DUE  INT64_C(0x0040000000000000)	/* disrupting UE error */
2177c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
2187c478bd9Sstevel@tonic-gate #define	C_AFSR_ME   INT64_C(0x0020000000000000)	/* errors > 1, same type!=CE */
2197c478bd9Sstevel@tonic-gate #define	C_AFSR_PRIV INT64_C(0x0010000000000000)	/* priv code access error    */
2207c478bd9Sstevel@tonic-gate #define	C_AFSR_PERR INT64_C(0x0008000000000000)	/* system interface protocol */
2217c478bd9Sstevel@tonic-gate #define	C_AFSR_IERR INT64_C(0x0004000000000000)	/* internal system interface */
2227c478bd9Sstevel@tonic-gate #define	C_AFSR_ISAP INT64_C(0x0002000000000000)	/* system request parity err */
2237c478bd9Sstevel@tonic-gate #define	C_AFSR_EMC  INT64_C(0x0001000000000000)	/* mtag   with   CE   error  */
2247c478bd9Sstevel@tonic-gate #define	C_AFSR_EMU  INT64_C(0x0000800000000000)	/* mtag   with   UE   error  */
2257c478bd9Sstevel@tonic-gate #define	C_AFSR_IVC  INT64_C(0x0000400000000000)	/* intr vector with CE error */
2267c478bd9Sstevel@tonic-gate #define	C_AFSR_IVU  INT64_C(0x0000200000000000)	/* intr vector with UE error */
2277c478bd9Sstevel@tonic-gate #define	C_AFSR_TO   INT64_C(0x0000100000000000)	/* bus timeout from sys bus  */
2287c478bd9Sstevel@tonic-gate #define	C_AFSR_BERR INT64_C(0x0000080000000000)	/* bus error from system bus */
2297c478bd9Sstevel@tonic-gate #define	C_AFSR_UCC  INT64_C(0x0000040000000000)	/* E$ with software CE error */
2307c478bd9Sstevel@tonic-gate #define	C_AFSR_UCU  INT64_C(0x0000020000000000)	/* E$ with software UE error */
2317c478bd9Sstevel@tonic-gate #define	C_AFSR_CPC  INT64_C(0x0000010000000000) /* copyout  with  CE  error  */
2327c478bd9Sstevel@tonic-gate #define	C_AFSR_CPU  INT64_C(0x0000008000000000) /* copyout  with  UE  error  */
2337c478bd9Sstevel@tonic-gate #define	C_AFSR_WDC  INT64_C(0x0000004000000000) /* writeback ecache CE error */
2347c478bd9Sstevel@tonic-gate #define	C_AFSR_WDU  INT64_C(0x0000002000000000) /* writeback ecache UE error */
2357c478bd9Sstevel@tonic-gate #define	C_AFSR_EDC  INT64_C(0x0000001000000000) /* ecache  CE  ECC  error    */
2367c478bd9Sstevel@tonic-gate #define	C_AFSR_EDU  INT64_C(0x0000000800000000) /* ecache  UE  ECC  error    */
2377c478bd9Sstevel@tonic-gate #define	C_AFSR_UE   INT64_C(0x0000000400000000) /* uncorrectable ECC error   */
2387c478bd9Sstevel@tonic-gate #define	C_AFSR_CE   INT64_C(0x0000000200000000) /* correctable   ECC error   */
2397c478bd9Sstevel@tonic-gate #define	C_AFSR_M_SYND	INT64_C(0x00000000000f0000) /* mtag  ECC  syndrome   */
2407c478bd9Sstevel@tonic-gate #define	C_AFSR_E_SYND	INT64_C(0x00000000000001ff) /* data  ECC  syndrome   */
2417c478bd9Sstevel@tonic-gate 
2427c478bd9Sstevel@tonic-gate /* AFSR bits that could result in CPU removal due to E$ error */
2437c478bd9Sstevel@tonic-gate #define	C_AFSR_L2_SERD_FAIL_UE	(C_AFSR_UCU | C_AFSR_CPU | C_AFSR_WDU | \
2447c478bd9Sstevel@tonic-gate 				C_AFSR_EDU)
2457c478bd9Sstevel@tonic-gate #define	C_AFSR_L2_SERD_FAIL_CE	(C_AFSR_UCC | C_AFSR_CPC | C_AFSR_WDC | \
2467c478bd9Sstevel@tonic-gate 				C_AFSR_EDC)
2477c478bd9Sstevel@tonic-gate /*
2487c478bd9Sstevel@tonic-gate  * Bits of the Panther Extended Asynchronous Fault Status Register (AFSR_EXT)
2497c478bd9Sstevel@tonic-gate  *
2507c478bd9Sstevel@tonic-gate  * +-----+-------+-----------+-------+-------+---------+------+------+------+
2517c478bd9Sstevel@tonic-gate  * | rsv |RED_ERR|EFA_PAR_ERR|L3_MECC|L3_THCE|L3_TUE_SH|L3_TUE|L3_EDC|L3_EDU|
2527c478bd9Sstevel@tonic-gate  * +-----+-------+-----------+-------+-------+---------+------+------+------+
2537c478bd9Sstevel@tonic-gate  *  63:14   13        12        11       10       9        8      7      6
2547c478bd9Sstevel@tonic-gate  *
2557c478bd9Sstevel@tonic-gate  * +------+------+------+------+------+------+
2567c478bd9Sstevel@tonic-gate  * |L3_UCC|L3_UCU|L3_CPC|L3_CPU|L3_WDC|L3_WDU|
2577c478bd9Sstevel@tonic-gate  * +------+------+------+------+------+------+
2587c478bd9Sstevel@tonic-gate  *     5      4      3      2      1      0
2597c478bd9Sstevel@tonic-gate  *
2607c478bd9Sstevel@tonic-gate  * If the L3_MECC bit is set along with any of the L3 cache errors (bits 0-7)
2617c478bd9Sstevel@tonic-gate  * above, it indicates that an address parity error has occured.
2627c478bd9Sstevel@tonic-gate  */
2637c478bd9Sstevel@tonic-gate #define	C_AFSR_RED_ERR   INT64_C(0x0000000000002000) /* redunancy Efuse error */
2647c478bd9Sstevel@tonic-gate #define	C_AFSR_EFA_PAR_ERR INT64_C(0x0000000000001000) /* Efuse parity error */
2657c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_MECC   INT64_C(0x0000000000000800) /* L3 address parity */
2667c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_THCE   INT64_C(0x0000000000000400) /* tag CE */
2677c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_TUE_SH INT64_C(0x0000000000000200) /* tag UE from snp/cpy */
2687c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_TUE    INT64_C(0x0000000000000100) /* tag UE */
2697c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_EDC    INT64_C(0x0000000000000080) /* L3 cache CE */
2707c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_EDU    INT64_C(0x0000000000000040) /* L3 cache UE */
2717c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_UCC    INT64_C(0x0000000000000020) /* software recover CE */
2727c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_UCU    INT64_C(0x0000000000000010) /* software recover UE */
2737c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_CPC    INT64_C(0x0000000000000008) /* copyout with CE */
2747c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_CPU    INT64_C(0x0000000000000004) /* copyout with UE */
2757c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_WDC    INT64_C(0x0000000000000002) /* writeback CE */
2767c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_WDU    INT64_C(0x0000000000000001) /* writeback UE */
2777c478bd9Sstevel@tonic-gate 
2787c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
2797c478bd9Sstevel@tonic-gate /*
2807c478bd9Sstevel@tonic-gate  * Bits of Jalapeno Asynchronous Fault Status Register
2817c478bd9Sstevel@tonic-gate  *
2827c478bd9Sstevel@tonic-gate  * +-----+------------------------------------------------------------------
2837c478bd9Sstevel@tonic-gate  * | rsv |JETO|SCE|JEIC|JEIT|ME|PRIV|JEIS|IERR|ISAP|ETP|OM|UMS|IVPE|TO|BERR|
2847c478bd9Sstevel@tonic-gate  * +-----+------------------------------------------------------------------
2857c478bd9Sstevel@tonic-gate  * 63:58   57   56   55  54  53  52   51   50   49  48  47  46  45  44  43
2867c478bd9Sstevel@tonic-gate  *
2877c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
2887c478bd9Sstevel@tonic-gate  * |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|RUE|RCE|BP|WBP|FRC|FRU|
2897c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
2907c478bd9Sstevel@tonic-gate  *   42  41  40  39  38  37  36  35 34 33 32  31  30 29  28  27
2917c478bd9Sstevel@tonic-gate  *
2927c478bd9Sstevel@tonic-gate  * +-----+-----+-----+------+-----------+-------+
2937c478bd9Sstevel@tonic-gate  * | JREQ| ETW | rsv |B_SYND| rsv | AID | E_SYND|
2947c478bd9Sstevel@tonic-gate  * +-----+-----+-----+------+-----+-----+-------+
2957c478bd9Sstevel@tonic-gate  *  26:24 23:22 21:20  19:16 15:14 13:9   8:0
2967c478bd9Sstevel@tonic-gate  *
2977c478bd9Sstevel@tonic-gate  */
2987c478bd9Sstevel@tonic-gate 
2997c478bd9Sstevel@tonic-gate /*
3007c478bd9Sstevel@tonic-gate  * Bits of Serrano Asynchronous Fault Status Register
3017c478bd9Sstevel@tonic-gate  *
3027c478bd9Sstevel@tonic-gate  * +-----+------------------------------------------------------------------
3037c478bd9Sstevel@tonic-gate  * | rsv |JETO|SCE|JEIC|JEIT|ME|PRIV|JEIS|IERR|ISAP|ETU|OM|UMS|IVPE|TO|BERR|
3047c478bd9Sstevel@tonic-gate  * +-----+------------------------------------------------------------------
3057c478bd9Sstevel@tonic-gate  * 63:58   57   56   55  54  53  52   51   50   49  48  47  46  45  44  43
3067c478bd9Sstevel@tonic-gate  *
3077c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
3087c478bd9Sstevel@tonic-gate  * |UCC|UCU|CPC|CPU|WDC|WDU|EDC|EDU|UE|CE|RUE|RCE|BP|WBP|FRC|FRU|
3097c478bd9Sstevel@tonic-gate  * +---+---+---+---+---+---+---+---+--+--+---+---+--+---+-------+
3107c478bd9Sstevel@tonic-gate  *   42  41  40  39  38  37  36  35 34 33 32  31  30 29  28  27
3117c478bd9Sstevel@tonic-gate  *
3127c478bd9Sstevel@tonic-gate  * +-----+-----+------+---+------+---+---+-----+-------+
3137c478bd9Sstevel@tonic-gate  * | JREQ| ETW | EFES |ETS|B_SYND|ETI|ETC| AID | E_SYND|
3147c478bd9Sstevel@tonic-gate  * +-----+-----+------+---+------+---+---+-----+-------+
3157c478bd9Sstevel@tonic-gate  *  26:24 23:22    21   20  19:16  15  14  13:9    8:0
3167c478bd9Sstevel@tonic-gate  *
3177c478bd9Sstevel@tonic-gate  */
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate #define	C_AFSR_JETO	INT64_C(0x0200000000000000) /* JBus Timeout */
3207c478bd9Sstevel@tonic-gate #define	C_AFSR_SCE	INT64_C(0x0100000000000000) /* Snoop parity error */
3217c478bd9Sstevel@tonic-gate #define	C_AFSR_JEIC	INT64_C(0x0080000000000000) /* JBus Illegal Cmd */
3227c478bd9Sstevel@tonic-gate #define	C_AFSR_JEIT	INT64_C(0x0040000000000000) /* Illegal ADTYPE */
3237c478bd9Sstevel@tonic-gate #define	C_AFSR_JEIS	INT64_C(0x0008000000000000) /* Illegal Install State */
3247c478bd9Sstevel@tonic-gate #if defined(SERRANO)
3257c478bd9Sstevel@tonic-gate #define	C_AFSR_ETU	INT64_C(0x0001000000000000) /* L2$ tag CE error */
3267c478bd9Sstevel@tonic-gate #elif defined(JALAPENO)
3277c478bd9Sstevel@tonic-gate #define	C_AFSR_ETP	INT64_C(0x0001000000000000) /* L2$ tag parity error */
3287c478bd9Sstevel@tonic-gate #endif /* JALAPENO */
3297c478bd9Sstevel@tonic-gate #define	C_AFSR_OM	INT64_C(0x0000800000000000) /* out of range mem error */
3307c478bd9Sstevel@tonic-gate #define	C_AFSR_UMS	INT64_C(0x0000400000000000) /* Unsupported store */
3317c478bd9Sstevel@tonic-gate #define	C_AFSR_IVPE	INT64_C(0x0000200000000000) /* intr vector parity err */
3327c478bd9Sstevel@tonic-gate #define	C_AFSR_RUE	INT64_C(0x0000000100000000) /* remote mem UE error */
3337c478bd9Sstevel@tonic-gate #define	C_AFSR_RCE	INT64_C(0x0000000080000000) /* remote mem CE error */
3347c478bd9Sstevel@tonic-gate #define	C_AFSR_BP	INT64_C(0x0000000040000000) /* read data parity err */
3357c478bd9Sstevel@tonic-gate #define	C_AFSR_WBP	INT64_C(0x0000000020000000) /* wb/bs data parity err */
3367c478bd9Sstevel@tonic-gate #define	C_AFSR_FRC	INT64_C(0x0000000010000000) /* foregin mem CE error */
3377c478bd9Sstevel@tonic-gate #define	C_AFSR_FRU	INT64_C(0x0000000008000000) /* foregin mem UE error */
3387c478bd9Sstevel@tonic-gate #define	C_AFSR_JREQ	INT64_C(0x0000000007000000) /* Active JBus req at err */
3397c478bd9Sstevel@tonic-gate #define	C_AFSR_ETW	INT64_C(0x0000000000c00000) /* AID causing UE/CE */
3407c478bd9Sstevel@tonic-gate 
3417c478bd9Sstevel@tonic-gate #if defined(SERRANO)
3427c478bd9Sstevel@tonic-gate #define	C_AFSR_EFES	INT64_C(0x0000000000200000) /* E-fuse error summary */
3437c478bd9Sstevel@tonic-gate #define	C_AFSR_ETS	INT64_C(0x0000000000100000) /* L2$ tag SRAM stuck-at */
3447c478bd9Sstevel@tonic-gate #endif /* SERRANO */
3457c478bd9Sstevel@tonic-gate 
3467c478bd9Sstevel@tonic-gate #define	C_AFSR_B_SYND	INT64_C(0x00000000000f0000) /* jbus parity syndrome */
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate #if defined(SERRANO)
3497c478bd9Sstevel@tonic-gate #define	C_AFSR_ETI	INT64_C(0x0000000000008000) /* L2$ tag intermittent */
3507c478bd9Sstevel@tonic-gate #define	C_AFSR_ETC	INT64_C(0x0000000000004000) /* L2$ tag CE */
3517c478bd9Sstevel@tonic-gate #endif /* SERRANO */
3527c478bd9Sstevel@tonic-gate 
3537c478bd9Sstevel@tonic-gate #define	C_AFSR_AID	INT64_C(0x0000000000003e00) /* AID causing UE/CE */
3547c478bd9Sstevel@tonic-gate 
3557c478bd9Sstevel@tonic-gate /* bit shifts for selected errors */
3567c478bd9Sstevel@tonic-gate #define	C_AFSR_WDU_SHIFT	37
3577c478bd9Sstevel@tonic-gate #define	C_AFSR_UCU_SHIFT	41
3587c478bd9Sstevel@tonic-gate #define	C_AFSR_UCC_SHIFT	42
3597c478bd9Sstevel@tonic-gate #define	C_AFSR_JREQ_SHIFT	24
3607c478bd9Sstevel@tonic-gate #define	C_AFSR_AID_SHIFT	9
3617c478bd9Sstevel@tonic-gate 
3627c478bd9Sstevel@tonic-gate /*
3637c478bd9Sstevel@tonic-gate  * Overloaded AFSR fields. During error processing, some of the reserved
3647c478bd9Sstevel@tonic-gate  * fields within the saved AFSR are overwritten with extra information.
3657c478bd9Sstevel@tonic-gate  */
3667c478bd9Sstevel@tonic-gate #define	C_AFSR_PANIC_SHIFT		62
3677c478bd9Sstevel@tonic-gate #define	C_AFSR_IPE_SHIFT		59
3687c478bd9Sstevel@tonic-gate #define	C_AFSR_DPE_SHIFT		58
3697c478bd9Sstevel@tonic-gate 
3707c478bd9Sstevel@tonic-gate #else /* JALAPENO || SERRANO */
3717c478bd9Sstevel@tonic-gate 
3727c478bd9Sstevel@tonic-gate /* bit shifts for selected errors */
3737c478bd9Sstevel@tonic-gate #define	C_AFSR_WDU_SHIFT	37
3747c478bd9Sstevel@tonic-gate #define	C_AFSR_UCU_SHIFT	41
3757c478bd9Sstevel@tonic-gate #define	C_AFSR_UCC_SHIFT	42
3767c478bd9Sstevel@tonic-gate #define	C_AFSR_L3_UCU_SHIFT	4
3777c478bd9Sstevel@tonic-gate 
3787c478bd9Sstevel@tonic-gate /*
3797c478bd9Sstevel@tonic-gate  * Overloaded AFSR fields. During error processing, some of the reserved fields
3807c478bd9Sstevel@tonic-gate  * within the saved AFSR are overwritten with extra information.
3817c478bd9Sstevel@tonic-gate  */
3827c478bd9Sstevel@tonic-gate #define	C_AFSR_FIRSTFLT_SHIFT	63
3837c478bd9Sstevel@tonic-gate #define	C_AFSR_PANIC_SHIFT	30
3847c478bd9Sstevel@tonic-gate #define	C_AFSR_DPE_SHIFT	20
3857c478bd9Sstevel@tonic-gate #define	C_AFSR_IPE_SHIFT	21
3867c478bd9Sstevel@tonic-gate 
3877c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
3887c478bd9Sstevel@tonic-gate 
3897c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
3907c478bd9Sstevel@tonic-gate /*
3917c478bd9Sstevel@tonic-gate  * Jalapeno L2 Cache Control Register Bits.
3927c478bd9Sstevel@tonic-gate  *
3937c478bd9Sstevel@tonic-gate  *	Bit#	Name		Description
3947c478bd9Sstevel@tonic-gate  *	63-24	-		reserved
3957c478bd9Sstevel@tonic-gate  *	23:20	EC_ACT_WAY	(read only) indicates which sets are present
3967c478bd9Sstevel@tonic-gate  *	19:16	EC_BLK_WAY	Bit mask indicating which sets are blocked
3977c478bd9Sstevel@tonic-gate  *				from replacement
3987c478bd9Sstevel@tonic-gate  *	15:14	EC_SIZE		L2 cache size
3997c478bd9Sstevel@tonic-gate  *	13:12	-		reserved
4007c478bd9Sstevel@tonic-gate  *	11	EC_PAR_EN	Enables parity checking on L2 cache tags
4017c478bd9Sstevel@tonic-gate  *	10	EC_ECC_EN	Enables ECC checking on L2 cache data
4027c478bd9Sstevel@tonic-gate  *	9	EC_ECC_FORCE	Enables EC_CHECK[8:0] onto L2 cache ECC bits
4037c478bd9Sstevel@tonic-gate  *	8:0	EC_CHECK	ECC check vector to force onto ECC bits
4047c478bd9Sstevel@tonic-gate  */
4057c478bd9Sstevel@tonic-gate 
4067c478bd9Sstevel@tonic-gate #define	JP_ECCTRL_ECSIZE_MASK		0xc000
4077c478bd9Sstevel@tonic-gate #define	JP_ECCTRL_ECSIZE_SHIFT		14
4087c478bd9Sstevel@tonic-gate #define	JP_ECCTRL_ECSIZE_MIN		0x80000
4097c478bd9Sstevel@tonic-gate 
4107c478bd9Sstevel@tonic-gate /*
4117c478bd9Sstevel@tonic-gate  * Jalapeno L2 Cache Error Enable Register Bits
4127c478bd9Sstevel@tonic-gate  *
4137c478bd9Sstevel@tonic-gate  *	Bit#	Name	Description
4147c478bd9Sstevel@tonic-gate  *	63-33	-	reserved
4157c478bd9Sstevel@tonic-gate  *	32	SCDE	Enable detection of JBUS control parity error
4167c478bd9Sstevel@tonic-gate  *	31:24	-	reserved
4177c478bd9Sstevel@tonic-gate  *	23	IAEN	Enable trap on illegal physical address
4187c478bd9Sstevel@tonic-gate  *	22	IERREN	Enable FERR system reset on CPU internal errors
4197c478bd9Sstevel@tonic-gate  *	21	PERREN	Enable FERR system reset on JBUS protocol errors
4207c478bd9Sstevel@tonic-gate  *	20	SCEN	Enable FERR system reset on JBUS control parity error
4217c478bd9Sstevel@tonic-gate  *	19:11	FMED	Forced error on the memory ECC
4227c478bd9Sstevel@tonic-gate  *	10	FME	Force error on memory ECC
4237c478bd9Sstevel@tonic-gate  *	9:6	FPD	Bits to use when FSP forces JBUS addr/data parity error
4247c478bd9Sstevel@tonic-gate  *	5	FSP	Force error on outgoing JBUS addr/data parity
4257c478bd9Sstevel@tonic-gate  *	4	ETPEN	Enable FERR system reset on L2 tags parity error
4267c478bd9Sstevel@tonic-gate  *	3	UCEEN	Enable trap on SW handled external cache error
4277c478bd9Sstevel@tonic-gate  *	2	ISAPEN	Enable FERR system reset on request parity error
4287c478bd9Sstevel@tonic-gate  *	1	NCEEN	Enable trap on uncorrectable ECC error and system err
4297c478bd9Sstevel@tonic-gate  *	0	CEEN	Enable trap on correctable ECC errors
4307c478bd9Sstevel@tonic-gate  */
4317c478bd9Sstevel@tonic-gate 
4327c478bd9Sstevel@tonic-gate #define	EN_REG_UCEEN	INT64_C(0x0000000000000008) /* enable UCC,UCU */
4337c478bd9Sstevel@tonic-gate #define	EN_REG_ISAPEN	INT64_C(0x0000000000000004) /* enable ISAP */
4347c478bd9Sstevel@tonic-gate #define	EN_REG_NCEEN INT64_C(0x0000000000000002) /* UE,EDU,WDU,BERR,IVU,EMU */
4357c478bd9Sstevel@tonic-gate #define	EN_REG_CEEN INT64_C(0x0000000000000001) /* enable CE,EDC,WDC,IVC,EMC */
4367c478bd9Sstevel@tonic-gate 
4377c478bd9Sstevel@tonic-gate #define	EN_REG_DISABLE	INT64_C(0x0000000000000000) /* no errors enabled */
4387c478bd9Sstevel@tonic-gate #define	EN_REG_ECC_DISABLE (EN_REG_UCEEN | EN_REG_ISAPEN)
4397c478bd9Sstevel@tonic-gate #define	EN_REG_CE_DISABLE (EN_REG_UCEEN | EN_REG_ISAPEN | EN_REG_NCEEN)
4407c478bd9Sstevel@tonic-gate #define	EN_REG_ENABLE \
4417c478bd9Sstevel@tonic-gate 	(EN_REG_UCEEN | EN_REG_ISAPEN | EN_REG_NCEEN | EN_REG_CEEN)
4427c478bd9Sstevel@tonic-gate 
4437c478bd9Sstevel@tonic-gate #else /* JALAPENO || SERRANO */
4447c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
4457c478bd9Sstevel@tonic-gate /*
4467c478bd9Sstevel@tonic-gate  * Cheetah+ External Cache Control Register Bits.
4477c478bd9Sstevel@tonic-gate  */
4487c478bd9Sstevel@tonic-gate #define	ECCR_ASSOC	INT64_C(0x0000000001000000) /* Ecache Assoc. */
4497c478bd9Sstevel@tonic-gate #define	ECCR_ASSOC_SHIFT	24
4507c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
4517c478bd9Sstevel@tonic-gate 
4527c478bd9Sstevel@tonic-gate /*
4537c478bd9Sstevel@tonic-gate  * Bits of Cheetah External Cache Error Enable Register
4547c478bd9Sstevel@tonic-gate  *
4557c478bd9Sstevel@tonic-gate  * +-----+-----+-------+-----+-------+-------+--------+-------+------+
4567c478bd9Sstevel@tonic-gate  * | rsv | FMT | FMECC | FMD | FDECC | UCEEN | ISAPEN | NCEEN | CEEN |
4577c478bd9Sstevel@tonic-gate  * +-----+-----+-------+-----+-------+-------+--------+-------+------+
4587c478bd9Sstevel@tonic-gate  *  63:19   18  17  14    13    12:4     3        2       1       0
4597c478bd9Sstevel@tonic-gate  *
4607c478bd9Sstevel@tonic-gate  */
4617c478bd9Sstevel@tonic-gate #define	EN_REG_FMT	INT64_C(0x0000000000040000) /* force system mtag ECC */
4627c478bd9Sstevel@tonic-gate #define	EN_REG_FMECC	INT64_C(0x000000000003C000) /* forced mtag ECC vector */
4637c478bd9Sstevel@tonic-gate #define	EN_REG_FMD	INT64_C(0x0000000000002000) /* force system data ECC */
4647c478bd9Sstevel@tonic-gate #define	EN_REG_FDECC	INT64_C(0x0000000000001ff0) /* forced data ECC vector */
4657c478bd9Sstevel@tonic-gate #define	EN_REG_UCEEN	INT64_C(0x0000000000000008) /* enable UCC,UCU */
4667c478bd9Sstevel@tonic-gate #define	EN_REG_ISAPEN	INT64_C(0x0000000000000004) /* enable ISAP */
4677c478bd9Sstevel@tonic-gate #define	EN_REG_NCEEN INT64_C(0x0000000000000002) /* UE,EDU,WDU,BERR,IVU,EMU */
4687c478bd9Sstevel@tonic-gate #define	EN_REG_CEEN INT64_C(0x0000000000000001) /* enable CE,EDC,WDC,IVC,EMC */
4697c478bd9Sstevel@tonic-gate #define	EN_REG_DISABLE	INT64_C(0x0000000000000000) /* no errors enabled */
4707c478bd9Sstevel@tonic-gate #define	EN_REG_ECC_DISABLE (EN_REG_UCEEN | EN_REG_ISAPEN)
4717c478bd9Sstevel@tonic-gate #define	EN_REG_CE_DISABLE (EN_REG_UCEEN | EN_REG_ISAPEN | EN_REG_NCEEN)
4727c478bd9Sstevel@tonic-gate #define	EN_REG_ENABLE \
4737c478bd9Sstevel@tonic-gate 	(EN_REG_UCEEN | EN_REG_ISAPEN | EN_REG_NCEEN | EN_REG_CEEN)
4747c478bd9Sstevel@tonic-gate #endif	/* JALAPENO || SERRANO */
4757c478bd9Sstevel@tonic-gate 
4767c478bd9Sstevel@tonic-gate /*
4777c478bd9Sstevel@tonic-gate  * bit shifts for selected bits
4787c478bd9Sstevel@tonic-gate  */
4797c478bd9Sstevel@tonic-gate #define	EN_REG_CEEN_SHIFT	0
4807c478bd9Sstevel@tonic-gate 
4817c478bd9Sstevel@tonic-gate /* Cheetah/Cheetah+ Dcache size */
4827c478bd9Sstevel@tonic-gate #define	CH_DCACHE_SIZE		0x10000
4837c478bd9Sstevel@tonic-gate 
4847c478bd9Sstevel@tonic-gate /* Cheetah/Cheetah+ Dcache linesize */
4857c478bd9Sstevel@tonic-gate #define	CH_DCACHE_LSIZE		0x20
4867c478bd9Sstevel@tonic-gate 
4877c478bd9Sstevel@tonic-gate /* Cheetah/Cheetah+/Jaguar Icache size */
4887c478bd9Sstevel@tonic-gate #define	CH_ICACHE_SIZE		0x8000
4897c478bd9Sstevel@tonic-gate 
4907c478bd9Sstevel@tonic-gate /* Cheetah/Cheetah+/Jaguar Icache linesize */
4917c478bd9Sstevel@tonic-gate #define	CH_ICACHE_LSIZE		0x20
4927c478bd9Sstevel@tonic-gate 
4937c478bd9Sstevel@tonic-gate /* Panther Icache size */
4947c478bd9Sstevel@tonic-gate #define	PN_ICACHE_SIZE		0x10000
4957c478bd9Sstevel@tonic-gate 
4967c478bd9Sstevel@tonic-gate /* Panther Icache linesize */
4977c478bd9Sstevel@tonic-gate #define	PN_ICACHE_LSIZE		0x40
4987c478bd9Sstevel@tonic-gate 
4997c478bd9Sstevel@tonic-gate /* Pcache size for the cheetah family of CPUs */
5007c478bd9Sstevel@tonic-gate #define	CH_PCACHE_SIZE		0x800
5017c478bd9Sstevel@tonic-gate 
5027c478bd9Sstevel@tonic-gate /* Pcache linesize  for the cheetah family of CPUs */
5037c478bd9Sstevel@tonic-gate #define	CH_PCACHE_LSIZE		0x40
5047c478bd9Sstevel@tonic-gate 
5057c478bd9Sstevel@tonic-gate /*
5067c478bd9Sstevel@tonic-gate  * The cheetah+ CPU module handles Cheetah+, Jaguar, and Panther so
5077c478bd9Sstevel@tonic-gate  * we have to pick max size and min linesize values for the Icache
5087c478bd9Sstevel@tonic-gate  * accordingly.
5097c478bd9Sstevel@tonic-gate  */
5107c478bd9Sstevel@tonic-gate #define	CHP_ICACHE_MAX_SIZE	PN_ICACHE_SIZE
5117c478bd9Sstevel@tonic-gate #define	CHP_ICACHE_MIN_LSIZE	CH_ICACHE_LSIZE
5127c478bd9Sstevel@tonic-gate 
5137c478bd9Sstevel@tonic-gate /*
5147c478bd9Sstevel@tonic-gate  * The minimum size needed to ensure consistency on a virtually address
5157c478bd9Sstevel@tonic-gate  * cache.  Computed by taking the largest virtually indexed cache and dividing
5167c478bd9Sstevel@tonic-gate  * by its associativity.
5177c478bd9Sstevel@tonic-gate  */
5187c478bd9Sstevel@tonic-gate #define	CH_VAC_SIZE		0x4000
5197c478bd9Sstevel@tonic-gate 
5207c478bd9Sstevel@tonic-gate /*
5217c478bd9Sstevel@tonic-gate  * The following definitions give the syndromes that will be seen when attempts
5227c478bd9Sstevel@tonic-gate  * are made to read data that has been intentionally poisoned.  Intentional
5237c478bd9Sstevel@tonic-gate  * poisoning is performed when an error has been detected, and is designed to
5247c478bd9Sstevel@tonic-gate  * allow software to effectively distinguish between root problems and secondary
5257c478bd9Sstevel@tonic-gate  * effects.  The following syndromes and their descriptions are taken from the
5267c478bd9Sstevel@tonic-gate  * UltraSPARC-III Cu Error Manual, Section 5.4.3.1.
5277c478bd9Sstevel@tonic-gate  */
5287c478bd9Sstevel@tonic-gate 
5297c478bd9Sstevel@tonic-gate /*
5307c478bd9Sstevel@tonic-gate  * For a DSTAT = 2 or 3 event (see Sec 5.3.4.4) from the system bus for a
5317c478bd9Sstevel@tonic-gate  * cacheable load, data bits [1:0] are inverted in the data stored in the
5327c478bd9Sstevel@tonic-gate  * L2-cache.  The syndrome seen when one of these signalling words is read will
5337c478bd9Sstevel@tonic-gate  * be 0x11c.
5347c478bd9Sstevel@tonic-gate  */
5357c478bd9Sstevel@tonic-gate #define	CH_POISON_SYND_FROM_DSTAT23	0x11c
5367c478bd9Sstevel@tonic-gate 
5377c478bd9Sstevel@tonic-gate /*
5387c478bd9Sstevel@tonic-gate  * For an uncorrectable data ECC error from the L2-cache, data bits [127:126]
5397c478bd9Sstevel@tonic-gate  * are inverted in data sent to the system bus as part of a writeback or
5407c478bd9Sstevel@tonic-gate  * copyout.  The syndrome seen when one of these signalling words is read will
5417c478bd9Sstevel@tonic-gate  * be 0x071.
5427c478bd9Sstevel@tonic-gate  */
5437c478bd9Sstevel@tonic-gate #define	CH_POISON_SYND_FROM_XXU_WRITE	0x71
5447c478bd9Sstevel@tonic-gate 
5457c478bd9Sstevel@tonic-gate /*
5467c478bd9Sstevel@tonic-gate  * For uncorrectable data ECC error on the L2-cache read done to complete a
5477c478bd9Sstevel@tonic-gate  * store merge event, where bytes written by the processor are merged with
5487c478bd9Sstevel@tonic-gate  * bytes from an L2-cache line, ECC check bits [1:0] are inverted in the data
5497c478bd9Sstevel@tonic-gate  * scrubbed back to the L2-cache.  The syndrome seen when one of these
5507c478bd9Sstevel@tonic-gate  * signalling words is read will be 0x003.
5517c478bd9Sstevel@tonic-gate  */
5527c478bd9Sstevel@tonic-gate #define	CH_POISON_SYND_FROM_XXU_WRMERGE	0x3
5537c478bd9Sstevel@tonic-gate 
5547c478bd9Sstevel@tonic-gate /*
5557c478bd9Sstevel@tonic-gate  * To help understand the following definitions, this block of comments
5567c478bd9Sstevel@tonic-gate  * provides information on Cheetah's E$.
5577c478bd9Sstevel@tonic-gate  *
5587c478bd9Sstevel@tonic-gate  * Cheetah supports three different E$ sizes (1MB, 4MB, and 8MB). The
5597c478bd9Sstevel@tonic-gate  * number of E$ lines remains constant regardless of the size of the E$
5607c478bd9Sstevel@tonic-gate  * as does the subblock size, however the number of 64-byte subblocks per
5617c478bd9Sstevel@tonic-gate  * line varies depending on the E$ size.
5627c478bd9Sstevel@tonic-gate  *
5637c478bd9Sstevel@tonic-gate  * An E$ tag (for an E$ line) contains an EC_tag field, corresponding to the
5647c478bd9Sstevel@tonic-gate  * high order physical address bits of that E$ line's contents, and 1 to 8
5657c478bd9Sstevel@tonic-gate  * EC_state fields, indicating the state of each subblock. Due to the E$ line
5667c478bd9Sstevel@tonic-gate  * size variance depending on the total size of the E$, the number of bits in
5677c478bd9Sstevel@tonic-gate  * the EC_tag field varies as does the number of subblocks (and EC_state
5687c478bd9Sstevel@tonic-gate  * fields) per E$ line.
5697c478bd9Sstevel@tonic-gate  *
5707c478bd9Sstevel@tonic-gate  * A 1MB E$ has a line size of 64 bytes, containing 1 subblock per line.
5717c478bd9Sstevel@tonic-gate  * A 4MB E$ has a line size of 256 bytes, containing 4 subblocks per line.
5727c478bd9Sstevel@tonic-gate  * An 8MB E$ has a line size of 512 bytes, containing 8 subblocks per line.
5737c478bd9Sstevel@tonic-gate  *
5747c478bd9Sstevel@tonic-gate  * An E$ tag for a particular E$ line can be read via a diagnostic ASI
5757c478bd9Sstevel@tonic-gate  * as a 64-bit value.
5767c478bd9Sstevel@tonic-gate  * Within the E$ tag 64-bit value, the EC_tag field is interpreted as follows:
5777c478bd9Sstevel@tonic-gate  *	- for a 1MB E$, the EC_tag is in bits <43:21> and corresponds
5787c478bd9Sstevel@tonic-gate  *		to physical address bits <42:20> (bits <41:19> for Cheetah+)
5797c478bd9Sstevel@tonic-gate  *	- for a 4MB E$, the EC_tag is in bits <43:23> and corresponds
5807c478bd9Sstevel@tonic-gate  *		to physical address bits <42:22> (bits <41:21> for Cheetah+)
5817c478bd9Sstevel@tonic-gate  *	- for an 8MB E$, the EC_tag is in bits <43:24> and corresponds
5827c478bd9Sstevel@tonic-gate  *		to physical address bits <42:23> (bits <41:22> for Cheetah+)
5837c478bd9Sstevel@tonic-gate  * Within the E$ tag 64-bit value, the EC_state field(s) is(are) interpreted
5847c478bd9Sstevel@tonic-gate  * as follows:
5857c478bd9Sstevel@tonic-gate  *	- for a 1MB E$, EC_state0 is in bits <2:0>
5867c478bd9Sstevel@tonic-gate  *	- for a 4MB E$, EC_state0 is in bits <2:0>, EC_state1 is in
5877c478bd9Sstevel@tonic-gate  *		bits <5:3>, EC_state2 is in bits <8:6>, EC_state3 is
5887c478bd9Sstevel@tonic-gate  *		in bits <11:9>
5897c478bd9Sstevel@tonic-gate  *	- for an 8MB E$, EC_state0 is in bits <2:0>, EC_state1 is in
5907c478bd9Sstevel@tonic-gate  *		bits <5:3>, EC_state2 is in bits <8:6>, EC_state3 is
5917c478bd9Sstevel@tonic-gate  *		in bits <11:9>, EC_state4 is in bits <14:12>, EC_state5
5927c478bd9Sstevel@tonic-gate  *		is in bits <17:15>, EC_state6 is in bits <20:18>,
5937c478bd9Sstevel@tonic-gate  *		EC_state7 is in bits <23:21>
5947c478bd9Sstevel@tonic-gate  * Note that each EC_state field contains a value representing the state
5957c478bd9Sstevel@tonic-gate  * of its corresponding subblock.
5967c478bd9Sstevel@tonic-gate  *
5977c478bd9Sstevel@tonic-gate  */
5987c478bd9Sstevel@tonic-gate /*
5997c478bd9Sstevel@tonic-gate  * Jaguar changes from Cheetah/Cheetah+ Ecache:
6007c478bd9Sstevel@tonic-gate  *
6017c478bd9Sstevel@tonic-gate  * The Jaguar Ecache is similiar to that used for Cheetah/Cheetah+ with a
6027c478bd9Sstevel@tonic-gate  * couple of differences :
6037c478bd9Sstevel@tonic-gate  *	- Jaguar Ecache only comes in 4MB and 8MB versions.
6047c478bd9Sstevel@tonic-gate  *		- 8MB E$ has 2 64 byte subblocks per line.
6057c478bd9Sstevel@tonic-gate  *		- 4MB E$ has 1 64 byte subblock per line.
6067c478bd9Sstevel@tonic-gate  *
6077c478bd9Sstevel@tonic-gate  * An E$ tag for a particular E$ line can be read via a diagnostic ASI
6087c478bd9Sstevel@tonic-gate  * as a 64-bit value.
6097c478bd9Sstevel@tonic-gate  * Within the E$ tag 64-bit value, the EC_tag field is interpreted as follows:
6107c478bd9Sstevel@tonic-gate  *	- for a 4MB E$, the EC_tag is in bits <41:21> and corresponds
6117c478bd9Sstevel@tonic-gate  *		to physical address bits <41:21>
6127c478bd9Sstevel@tonic-gate  *	- for a 8MB E$, the EC_tag is in bits <41:22> and corresponds
6137c478bd9Sstevel@tonic-gate  *		to physical address bits <41:22>
6147c478bd9Sstevel@tonic-gate  *
6157c478bd9Sstevel@tonic-gate  * The Jaguar E$ tag also contains LRU field in bit <42> which must be
6167c478bd9Sstevel@tonic-gate  * masked off when the tag value is being compared to a PA.
6177c478bd9Sstevel@tonic-gate  *
6187c478bd9Sstevel@tonic-gate  * Within the E$ tag 64-bit value, the EC_state field(s) is(are) interpreted
6197c478bd9Sstevel@tonic-gate  * as follows:
6207c478bd9Sstevel@tonic-gate  *	- for 4MB E$, EC_state0 is in bits <2:0>
6217c478bd9Sstevel@tonic-gate  *	- for 8MB E$, EC_state0 is in bits <2:0>, EC_state1 is in bits <5:3>.
6227c478bd9Sstevel@tonic-gate  * Each EC_state field contains a value representing the state of its
6237c478bd9Sstevel@tonic-gate  * corresponding subblock.
6247c478bd9Sstevel@tonic-gate  *
6257c478bd9Sstevel@tonic-gate  * Note that the subblock size and state values are the same for both
6267c478bd9Sstevel@tonic-gate  * Cheetah/Cheetah+ and Jaguar.
6277c478bd9Sstevel@tonic-gate  */
6287c478bd9Sstevel@tonic-gate 
6297c478bd9Sstevel@tonic-gate /* Ecache sizes */
6307c478bd9Sstevel@tonic-gate #define	CH_ECACHE_8M_SIZE	0x800000
6317c478bd9Sstevel@tonic-gate #define	CH_ECACHE_4M_SIZE	0x400000
6327c478bd9Sstevel@tonic-gate #define	CH_ECACHE_1M_SIZE	0x100000
6337c478bd9Sstevel@tonic-gate 
6347c478bd9Sstevel@tonic-gate #define	PN_L2_SIZE		0x200000
6357c478bd9Sstevel@tonic-gate #define	PN_L2_LINESIZE		64
6367c478bd9Sstevel@tonic-gate #define	PN_L2_ECC_WORDS		2
6377c478bd9Sstevel@tonic-gate #define	PN_L2_NWAYS		4
6387c478bd9Sstevel@tonic-gate #define	PN_L2_SET_SIZE		(PN_L2_SIZE / PN_L2_NWAYS)
6397c478bd9Sstevel@tonic-gate #define	PN_L2_MAX_SET		(PN_L2_SIZE - PN_L2_SET_SIZE)
6407c478bd9Sstevel@tonic-gate #define	PN_L2_DATA_ECC_SEL	0x200000 /* bit 21 selects ECC */
6417c478bd9Sstevel@tonic-gate #define	PN_L2_ECC_LO_REG	0x20 /* bit 5 set for L2 tag access */
6427c478bd9Sstevel@tonic-gate #define	PN_L2_INDEX_MASK	0x7ffc0 /* bits 18:6 */
6437c478bd9Sstevel@tonic-gate #define	PN_L2_WAY_INCR		0x80000	/* l2-ec-way = <20:19> */
6447c478bd9Sstevel@tonic-gate #define	PN_L2_WAY_LIM		INT64_C(0x200000)
6457c478bd9Sstevel@tonic-gate #define	PN_L2_WAY_SHIFT		19
6467c478bd9Sstevel@tonic-gate 
6477c478bd9Sstevel@tonic-gate #define	PN_L3_SIZE		0x2000000
6487c478bd9Sstevel@tonic-gate #define	PN_L3_LINESIZE		64
6497c478bd9Sstevel@tonic-gate #define	PN_L3_NWAYS		4
6507c478bd9Sstevel@tonic-gate #define	PN_L3_SET_SIZE		(PN_L3_SIZE / PN_L3_NWAYS)
6517c478bd9Sstevel@tonic-gate #define	PN_L3_MAX_SET		(PN_L3_SIZE - PN_L3_SET_SIZE)
6527c478bd9Sstevel@tonic-gate #define	PN_L3_WAY_SHIFT		23
6537c478bd9Sstevel@tonic-gate #define	PN_L3_TAG_RD_MASK	0x7fffc0	/* ec_tag = PA<22:6>  */
6547c478bd9Sstevel@tonic-gate #define	PN_L3_WAY_INCR		0x800000	/* ec_way = <24:23> */
6557c478bd9Sstevel@tonic-gate #define	PN_L3_WAY_LIM		INT64_C(0x2000000)
6567c478bd9Sstevel@tonic-gate 
6577c478bd9Sstevel@tonic-gate /* Pcache Defines */
6587c478bd9Sstevel@tonic-gate #define	PN_PCACHE_ADDR_MASK	0x1c0		/* PC_addr = <8:6> */
6597c478bd9Sstevel@tonic-gate #define	PN_PCACHE_WAY_INCR	0x200		/* PC_way = <10:9> */
6607c478bd9Sstevel@tonic-gate #define	PN_PCACHE_WORD_SHIFT	3		/* PC_dbl_word = <5:3> */
6617c478bd9Sstevel@tonic-gate #define	PN_PCACHE_NWAYS		4
6627c478bd9Sstevel@tonic-gate 
6637c478bd9Sstevel@tonic-gate /* Cheetah Ecache is direct-mapped, Cheetah+ can be 2-way or direct-mapped */
6647c478bd9Sstevel@tonic-gate #define	CH_ECACHE_NWAY		1
6657c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
6667c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_NWAY		2
6677c478bd9Sstevel@tonic-gate #define	PN_ECACHE_NWAY		4
6687c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
6697c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
6707c478bd9Sstevel@tonic-gate #define	JP_ECACHE_NWAY		4
6717c478bd9Sstevel@tonic-gate #define	JP_ECACHE_NWAY_SHIFT	2
6727c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
6737c478bd9Sstevel@tonic-gate 
6747c478bd9Sstevel@tonic-gate /* Maximum Ecache size */
6757c478bd9Sstevel@tonic-gate #define	CH_ECACHE_MAX_SIZE	CH_ECACHE_8M_SIZE
6767c478bd9Sstevel@tonic-gate 
6777c478bd9Sstevel@tonic-gate /* Minimum Ecache line size */
6787c478bd9Sstevel@tonic-gate #define	CH_ECACHE_MIN_LSIZE	64
6797c478bd9Sstevel@tonic-gate 
6807c478bd9Sstevel@tonic-gate /* Maximum Ecache line size - 8Mb Ecache has 512 byte linesize */
6817c478bd9Sstevel@tonic-gate #define	CH_ECACHE_MAX_LSIZE	512
6827c478bd9Sstevel@tonic-gate 
6837c478bd9Sstevel@tonic-gate /* Size of Ecache data staging register size (see Cheetah PRM 10.7.2) */
6847c478bd9Sstevel@tonic-gate #define	CH_ECACHE_STGREG_SIZE	32
6857c478bd9Sstevel@tonic-gate #define	CH_ECACHE_STGREG_TOTALSIZE	40	/* data regs + ecc */
6867c478bd9Sstevel@tonic-gate 
6877c478bd9Sstevel@tonic-gate /* The number of staging registers containing data, for ASI_EC_DATA */
6887c478bd9Sstevel@tonic-gate #define	CH_ECACHE_STGREG_NUM	(CH_ECACHE_STGREG_SIZE / sizeof (uint64_t))
6897c478bd9Sstevel@tonic-gate 
6907c478bd9Sstevel@tonic-gate /* Size of Ecache data subblock which has state field in Ecache tag */
6917c478bd9Sstevel@tonic-gate #define	CH_ECACHE_SUBBLK_SIZE	64
6927c478bd9Sstevel@tonic-gate #define	CH_ECACHE_SUBBLK_SHIFT	6
6937c478bd9Sstevel@tonic-gate 
6947c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
6957c478bd9Sstevel@tonic-gate #define	JP_ECACHE_MAX_LSIZE	CH_ECACHE_SUBBLK_SIZE
6967c478bd9Sstevel@tonic-gate #define	JP_ECACHE_MAX_SIZE	0x400000
6977c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
6987c478bd9Sstevel@tonic-gate 
6997c478bd9Sstevel@tonic-gate /*
7007c478bd9Sstevel@tonic-gate  * Maximum ecache setsize to support page coloring of heterogenous
7017c478bd9Sstevel@tonic-gate  * cheetah+ cpus. Max ecache setsize is calculated to be the max ecache size
7027c478bd9Sstevel@tonic-gate  * divided by the minimum associativity of the max ecache.
7037c478bd9Sstevel@tonic-gate  *
7047c478bd9Sstevel@tonic-gate  * NOTE: CHP_ECACHE_MAX_SIZE and CHP_ECACHE_MIN_NWAY need to be updated with
7057c478bd9Sstevel@tonic-gate  * new cheetah+ cpus. The maximum setsize may not necessarily be associated with
7067c478bd9Sstevel@tonic-gate  * the max ecache size if the cache associativity is large. If so, MAX_SETSIZE
7077c478bd9Sstevel@tonic-gate  * needs to be updated accordingly.
7087c478bd9Sstevel@tonic-gate  */
7097c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
7107c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_MIN_NWAY	1	/* direct-mapped */
7117c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_MAX_SIZE	CH_ECACHE_MAX_SIZE
7127c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_MAX_SETSIZE	(CHP_ECACHE_MAX_SIZE / CHP_ECACHE_MIN_NWAY)
7137c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
7147c478bd9Sstevel@tonic-gate 
7157c478bd9Sstevel@tonic-gate /*
7167c478bd9Sstevel@tonic-gate  * Bits to shift EC_tag field of E$ tag to form PA
7177c478bd9Sstevel@tonic-gate  * (See Cheetah PRM 10.7.4, Cheetah+ Delta PRM 10.7)
7187c478bd9Sstevel@tonic-gate  */
7197c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
7207c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_SHIFT	18
7217c478bd9Sstevel@tonic-gate #elif defined(CHEETAH_PLUS)
7227c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_SHIFT	2
7237c478bd9Sstevel@tonic-gate #else	/* CHEETAH_PLUS */
7247c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_SHIFT	1
7257c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
7267c478bd9Sstevel@tonic-gate #define	PN_L3TAG_PA_SHIFT	1
7277c478bd9Sstevel@tonic-gate #define	PN_L3TAG_PA_MASK	0xfffff000000	/* tag bits[43:24] */
7287c478bd9Sstevel@tonic-gate #define	PN_L2TAG_PA_MASK	0x7fffff80000	/* tag bits[42:19] */
7297c478bd9Sstevel@tonic-gate 
7307c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
7317c478bd9Sstevel@tonic-gate /*
7327c478bd9Sstevel@tonic-gate  * Macros for Jalapeno L2 Cache Tag/State/Parity
7337c478bd9Sstevel@tonic-gate  *
7347c478bd9Sstevel@tonic-gate  * +-----------+--------+--------+----------------------+
7357c478bd9Sstevel@tonic-gate  * |   -       | EC_par |EC_state|  EC_tag = PA[42:18]  |
7367c478bd9Sstevel@tonic-gate  * +-----------+--------+--------+----------------------+
7377c478bd9Sstevel@tonic-gate  *    63:29        28      27:25         24:0
7387c478bd9Sstevel@tonic-gate  */
7397c478bd9Sstevel@tonic-gate /*
7407c478bd9Sstevel@tonic-gate  * Constants representing the complete Jalapeno Ecache tag state:
7417c478bd9Sstevel@tonic-gate  */
7427c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_SIZE		3		/* three bits */
7437c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_MASK		0x7		/* three bit field */
7447c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_INV		0x0		/* invalid */
7457c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_SHR		0x1		/* shared */
7467c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_RES1		0x2		/* reserved */
7477c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_EXL		0x3		/* exclusive */
7487c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_RES2		0x4		/* reserved */
7497c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_OWN		0x5		/* owner */
7507c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_MOD		0x7		/* modified */
7517c478bd9Sstevel@tonic-gate #define	JP_ECSTATE_RES3		0x6		/* reserved */
7527c478bd9Sstevel@tonic-gate #define	JP_ECTAG_STATE_SHIFT	25
7537c478bd9Sstevel@tonic-gate 
7547c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_SIZE		JP_ECSTATE_SIZE
7557c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_MASK		JP_ECSTATE_MASK
7567c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_INV		JP_ECSTATE_INV
7577c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_SHR		JP_ECSTATE_SHR
7587c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_EXL		JP_ECSTATE_EXL
7597c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_OWN		JP_ECSTATE_OWN
7607c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_MOD		JP_ECSTATE_MOD
7617c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_RES1		JP_ECSTATE_RES1
7627c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_OWS		JP_ECSTATE_RES3
7637c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_RES2		JP_ECSTATE_RES2
7647c478bd9Sstevel@tonic-gate 
7657c478bd9Sstevel@tonic-gate /* Number of subblock states per Ecache line. */
7667c478bd9Sstevel@tonic-gate #define	CH_ECTAG_NSUBBLKS(totalsize)	1
7677c478bd9Sstevel@tonic-gate 
7687c478bd9Sstevel@tonic-gate /* Mask for Tag state(s) field, 3 bits per subblock state. */
7697c478bd9Sstevel@tonic-gate #define	CH_ECTAG_STATE_SHIFT(subblk)	JP_ECTAG_STATE_SHIFT
7707c478bd9Sstevel@tonic-gate #define	CH_ECTAG_STATE_MASK(totalsize)			\
7717c478bd9Sstevel@tonic-gate 	((uint64_t)(JP_ECSTATE_MASK<<JP_ECTAG_STATE_SHIFT))
7727c478bd9Sstevel@tonic-gate 
7737c478bd9Sstevel@tonic-gate /* For a line to be invalid, all of its subblock states must be invalid. */
7747c478bd9Sstevel@tonic-gate #define	CH_ECTAG_LINE_INVALID(totalsize, tag)		\
7757c478bd9Sstevel@tonic-gate 	(((tag) & CH_ECTAG_STATE_MASK(totalsize)) == 0)
7767c478bd9Sstevel@tonic-gate 
7777c478bd9Sstevel@tonic-gate /* Build address mask for tag physical address bits. */
7787c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_MASK(setsize)	P2ALIGN(C_AFAR_PA, (int)(setsize))
7797c478bd9Sstevel@tonic-gate 
7807c478bd9Sstevel@tonic-gate /* Get physical address bits from the EC_tag field of an E$ tag */
7817c478bd9Sstevel@tonic-gate #define	CH_ECTAG_TO_PA(setsize, tag)	(((tag) << CH_ECTAG_PA_SHIFT) &	\
7827c478bd9Sstevel@tonic-gate 	CH_ECTAG_PA_MASK(setsize))
7837c478bd9Sstevel@tonic-gate 
7847c478bd9Sstevel@tonic-gate /* Given a physical address, compute index for subblock tag state. */
7857c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_TO_SUBBLK(totalsize, pa)		1
7867c478bd9Sstevel@tonic-gate 
7877c478bd9Sstevel@tonic-gate /* Given a physical address and assoc. tag, get the subblock state. */
7887c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_TO_SUBBLK_STATE(totalsize, pa, tag)			\
7897c478bd9Sstevel@tonic-gate 	(((tag) >> JP_ECTAG_STATE_SHIFT) &	JP_ECSTATE_MASK)
7907c478bd9Sstevel@tonic-gate 
7917c478bd9Sstevel@tonic-gate #else /* JALAPENO || SERRANO */
7927c478bd9Sstevel@tonic-gate 
7937c478bd9Sstevel@tonic-gate /*
7947c478bd9Sstevel@tonic-gate  * Constants representing the complete Cheetah Ecache tag state:
7957c478bd9Sstevel@tonic-gate  */
7967c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_SIZE		3		/* three bits per subblock */
7977c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_MASK		0x7		/* three bit field */
7987c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_INV		0x0		/* invalid */
7997c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_SHR		0x1		/* shared */
8007c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_EXL		0x2		/* exclusive */
8017c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_OWN		0x3		/* owner */
8027c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_MOD		0x4		/* modified */
8037c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_RES1		0x5		/* reserved */
8047c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_OWS		0x6		/* owner/shared */
8057c478bd9Sstevel@tonic-gate #define	CH_ECSTATE_RES2		0x7		/* reserved */
8067c478bd9Sstevel@tonic-gate 
8077c478bd9Sstevel@tonic-gate /*
8087c478bd9Sstevel@tonic-gate  * Macros for Cheetah Ecache tags
8097c478bd9Sstevel@tonic-gate  */
8107c478bd9Sstevel@tonic-gate 
8117c478bd9Sstevel@tonic-gate /* Number of subblock states per Ecache line. */
8127c478bd9Sstevel@tonic-gate #define	CH_ECTAG_NSUBBLKS(totalsize)	((totalsize) / CH_ECACHE_1M_SIZE)
8137c478bd9Sstevel@tonic-gate 
8147c478bd9Sstevel@tonic-gate /* Mask for Tag state(s) field, 3 bits per subblock state. */
8157c478bd9Sstevel@tonic-gate #define	CH_ECTAG_STATE_SHIFT(subblk)	(subblk * CH_ECSTATE_SIZE)
8167c478bd9Sstevel@tonic-gate #define	CH_ECTAG_STATE_MASK(totalsize)			\
8177c478bd9Sstevel@tonic-gate 	((uint64_t)					\
8187c478bd9Sstevel@tonic-gate 	((1 << (CH_ECTAG_NSUBBLKS(totalsize) * CH_ECSTATE_SIZE)) - 1))
8197c478bd9Sstevel@tonic-gate 
8207c478bd9Sstevel@tonic-gate /* For a line to be invalid, all of its subblock states must be invalid. */
8217c478bd9Sstevel@tonic-gate #define	CH_ECTAG_LINE_INVALID(totalsize, tag)		\
8227c478bd9Sstevel@tonic-gate 	(((tag) & CH_ECTAG_STATE_MASK(totalsize)) == 0)
8237c478bd9Sstevel@tonic-gate 
8247c478bd9Sstevel@tonic-gate /* Build address mask for tag physical address bits. */
8257c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_MASK(setsize)	P2ALIGN(C_AFAR_PA, (int)(setsize))
8267c478bd9Sstevel@tonic-gate 
8277c478bd9Sstevel@tonic-gate /* Get physical address bits from the EC_tag field of an E$ tag */
8287c478bd9Sstevel@tonic-gate #define	CH_ECTAG_TO_PA(setsize, tag)	(((tag) >> CH_ECTAG_PA_SHIFT) &	\
8297c478bd9Sstevel@tonic-gate 	CH_ECTAG_PA_MASK(setsize))
8307c478bd9Sstevel@tonic-gate 
8317c478bd9Sstevel@tonic-gate /* Given a physical address, compute index for subblock tag state. */
8327c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_TO_SUBBLK(totalsize, pa)		\
8337c478bd9Sstevel@tonic-gate 	(((pa) >> CH_ECACHE_SUBBLK_SHIFT) & (CH_ECTAG_NSUBBLKS(totalsize) - 1))
8347c478bd9Sstevel@tonic-gate 
8357c478bd9Sstevel@tonic-gate /* Given a physical address and assoc. tag, get the subblock state. */
8367c478bd9Sstevel@tonic-gate #define	CH_ECTAG_PA_TO_SUBBLK_STATE(totalsize, pa, tag)			\
8377c478bd9Sstevel@tonic-gate 	(((tag) >>							\
8387c478bd9Sstevel@tonic-gate 	(CH_ECTAG_PA_TO_SUBBLK(totalsize, pa) * CH_ECSTATE_SIZE)) &	\
8397c478bd9Sstevel@tonic-gate 	CH_ECSTATE_MASK)
8407c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
8417c478bd9Sstevel@tonic-gate 
8427c478bd9Sstevel@tonic-gate /* Panther only has one EC_State field in the L3 tag */
8437c478bd9Sstevel@tonic-gate #define	PN_L3_LINE_INVALID(tag)		(((tag) & CH_ECSTATE_MASK) == 0)
8447c478bd9Sstevel@tonic-gate 
8457c478bd9Sstevel@tonic-gate /* Panther only has one State field in the L2 tag */
8467c478bd9Sstevel@tonic-gate #define	PN_L2_LINE_INVALID(tag)		(((tag) & CH_ECSTATE_MASK) == 0)
8477c478bd9Sstevel@tonic-gate 
8487c478bd9Sstevel@tonic-gate /* Get physical address bits from the EC_tag field of an L3$ tag */
8497c478bd9Sstevel@tonic-gate #define	PN_L3TAG_TO_PA(tag)		(((tag) & PN_L3TAG_PA_MASK) >> \
8507c478bd9Sstevel@tonic-gate 	PN_L3TAG_PA_SHIFT)
8517c478bd9Sstevel@tonic-gate 
8527c478bd9Sstevel@tonic-gate /* Get physical address bits from the tag field of an L2$ tag */
8537c478bd9Sstevel@tonic-gate #define	PN_L2TAG_TO_PA(tag)		((tag) & PN_L2TAG_PA_MASK)
8547c478bd9Sstevel@tonic-gate 
8557c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
8567c478bd9Sstevel@tonic-gate /*
8577c478bd9Sstevel@tonic-gate  * Jalapeno L2 Cache ASI_ECACHE_FLUSH:
8587c478bd9Sstevel@tonic-gate  * +-------+-----------------+--------+---+-----+-------------+------+
8597c478bd9Sstevel@tonic-gate  * |   -   | Port_ID |   -   | EC_Way | 1 |  -  | EC_Tag_Addr |   -  |
8607c478bd9Sstevel@tonic-gate  * +-------+-----------------+--------+---+-----+-------------+------+
8617c478bd9Sstevel@tonic-gate  *  63:41     40:36    35:34    33:32  31  30:18      17:6       5:0
8627c478bd9Sstevel@tonic-gate  */
8637c478bd9Sstevel@tonic-gate 
8647c478bd9Sstevel@tonic-gate #define	JP_EC_TO_SET_SIZE_SHIFT		2
8657c478bd9Sstevel@tonic-gate #define	JP_ECACHE_IDX_DISP_FLUSH	INT64_C(0x0000000080000000)
8667c478bd9Sstevel@tonic-gate #define	JP_ECFLUSH_PORTID_SHIFT		36
8677c478bd9Sstevel@tonic-gate #define	JP_ECFLUSH_EC_WAY_SHIFT		32
8687c478bd9Sstevel@tonic-gate #define	JP_EC_TAG_DATA_WAY_SHIFT	JP_ECFLUSH_EC_WAY_SHIFT
8697c478bd9Sstevel@tonic-gate #endif	/* JALAPENO || SERRANO */
8707c478bd9Sstevel@tonic-gate 
8717c478bd9Sstevel@tonic-gate /*
8727c478bd9Sstevel@tonic-gate  * Macros for Jaguar Ecache tags
8737c478bd9Sstevel@tonic-gate  */
8747c478bd9Sstevel@tonic-gate 
8757c478bd9Sstevel@tonic-gate /* Ecache sizes */
8767c478bd9Sstevel@tonic-gate #define	JG_ECACHE_8M_SIZE	0x800000
8777c478bd9Sstevel@tonic-gate #define	JG_ECACHE_4M_SIZE	0x400000
8787c478bd9Sstevel@tonic-gate 
8797c478bd9Sstevel@tonic-gate /* Jaguar E$ tag LRU mask */
8807c478bd9Sstevel@tonic-gate #define	JG_LRU_MASK UINT64_C(0x0000040000000000) /* PA<42> LRU bit */
8817c478bd9Sstevel@tonic-gate 
8827c478bd9Sstevel@tonic-gate /*
8837c478bd9Sstevel@tonic-gate  * Note that Jaguar and Cheetah/Cheetah+ have the same subblock state size
8847c478bd9Sstevel@tonic-gate  * so rather than duplicating existing defn's we can use the Cheetah+ versions
8857c478bd9Sstevel@tonic-gate  * in the Jaguar defn's below.
8867c478bd9Sstevel@tonic-gate  */
8877c478bd9Sstevel@tonic-gate /* Number of subblock states per Ecache line. */
8887c478bd9Sstevel@tonic-gate #define	JG_ECTAG_NSUBBLKS(cachesize)	((cachesize) / JG_ECACHE_4M_SIZE)
8897c478bd9Sstevel@tonic-gate 
8907c478bd9Sstevel@tonic-gate /* Mask for Tag state(s) field, 3 bits per subblock state. */
8917c478bd9Sstevel@tonic-gate #define	JG_ECTAG_STATE_MASK(totalsize)			\
8927c478bd9Sstevel@tonic-gate 	((uint64_t)					\
8937c478bd9Sstevel@tonic-gate 	((1 << (JG_ECTAG_NSUBBLKS(totalsize) * CH_ECSTATE_SIZE)) - 1))
8947c478bd9Sstevel@tonic-gate 
8957c478bd9Sstevel@tonic-gate /* For a line to be invalid, all of its subblock states must be invalid. */
8967c478bd9Sstevel@tonic-gate #define	JG_ECTAG_LINE_INVALID(totalsize, tag)		\
8977c478bd9Sstevel@tonic-gate 	(((tag) & JG_ECTAG_STATE_MASK(totalsize)) == 0)
8987c478bd9Sstevel@tonic-gate 
8997c478bd9Sstevel@tonic-gate /* Build address mask for tag physical address bits. */
9007c478bd9Sstevel@tonic-gate #define	JG_ECTAG_PA_MASK(setsize)	P2ALIGN(((~JG_LRU_MASK) & C_AFAR_PA), \
9017c478bd9Sstevel@tonic-gate 							(int)(setsize))
9027c478bd9Sstevel@tonic-gate 
9037c478bd9Sstevel@tonic-gate /* Get physical address bits from the EC_tag field of an E$ tag */
9047c478bd9Sstevel@tonic-gate #define	JG_ECTAG_TO_PA(setsize, tag)	((tag & JG_ECTAG_PA_MASK(setsize)))
9057c478bd9Sstevel@tonic-gate 
9067c478bd9Sstevel@tonic-gate /* Given a physical address, compute index for subblock tag state. */
9077c478bd9Sstevel@tonic-gate #define	JG_ECTAG_PA_TO_SUBBLK(totalsize, pa)		\
9087c478bd9Sstevel@tonic-gate 	(((pa) >> CH_ECACHE_SUBBLK_SHIFT) & (JG_ECTAG_NSUBBLKS(totalsize) - 1))
9097c478bd9Sstevel@tonic-gate 
9107c478bd9Sstevel@tonic-gate /* Given a physical address and assoc. tag, get the subblock state. */
9117c478bd9Sstevel@tonic-gate #define	JG_ECTAG_PA_TO_SUBBLK_STATE(totalsize, pa, tag)			\
9127c478bd9Sstevel@tonic-gate 	(((tag) >>							\
9137c478bd9Sstevel@tonic-gate 	(JG_ECTAG_PA_TO_SUBBLK(totalsize, pa) * CH_ECSTATE_SIZE)) &	\
9147c478bd9Sstevel@tonic-gate 	CH_ECSTATE_MASK)
9157c478bd9Sstevel@tonic-gate 
9167c478bd9Sstevel@tonic-gate 
9177c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
9187c478bd9Sstevel@tonic-gate /*
9197c478bd9Sstevel@tonic-gate  * Cheetah+ Tag ECC Bit and Displacement Flush Bit in Ecache Tag Access.
9207c478bd9Sstevel@tonic-gate  * See Cheetah+ Delta PRM 10.7
9217c478bd9Sstevel@tonic-gate  */
9227c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_IDX_TAG_ECC		INT64_C(0x0000000000800000)
9237c478bd9Sstevel@tonic-gate #define	CHP_ECACHE_IDX_DISP_FLUSH	INT64_C(0x0000000001000000)
9247c478bd9Sstevel@tonic-gate #define	PN_L2_IDX_DISP_FLUSH		INT64_C(0x0000000000800000)
9257c478bd9Sstevel@tonic-gate #define	PN_L3_IDX_DISP_FLUSH		INT64_C(0x0000000004000000)
9267c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
9277c478bd9Sstevel@tonic-gate 
9287c478bd9Sstevel@tonic-gate /*
9297c478bd9Sstevel@tonic-gate  * Macros for Cheetah Dcache diagnostic accesses.
9307c478bd9Sstevel@tonic-gate  */
9317c478bd9Sstevel@tonic-gate 
9327c478bd9Sstevel@tonic-gate /*
9337c478bd9Sstevel@tonic-gate  * Dcache Index Mask for bits from *AFAR*.  Note that Dcache is virtually
9347c478bd9Sstevel@tonic-gate  * indexed, so only bits [12:5] are valid from the AFAR.  This
9357c478bd9Sstevel@tonic-gate  * means we have to search through the 4 ways + bit 13 (i.e. we have
9367c478bd9Sstevel@tonic-gate  * to try 8 indexes).
9377c478bd9Sstevel@tonic-gate  */
9387c478bd9Sstevel@tonic-gate #define	CH_DCACHE_IDX_MASK		0x01fe0
9397c478bd9Sstevel@tonic-gate #define	CH_DCACHE_IDX_INCR		0x02000
9407c478bd9Sstevel@tonic-gate #define	CH_DCACHE_IDX_LIMIT		0x10000
9417c478bd9Sstevel@tonic-gate #define	CH_DCACHE_NWAY			4
9427c478bd9Sstevel@tonic-gate #define	CH_DCACHE_WAY_MASK		0x0c000
9437c478bd9Sstevel@tonic-gate #define	CH_DCACHE_WAY_SHIFT		14
9447c478bd9Sstevel@tonic-gate #define	CH_DCIDX_TO_WAY(idx)		(((idx) & CH_DCACHE_WAY_MASK) >> \
9457c478bd9Sstevel@tonic-gate 						CH_DCACHE_WAY_SHIFT)
9467c478bd9Sstevel@tonic-gate #define	CH_DCTAG_PA_MASK		INT64_C(0x000007ffffffe000)
9477c478bd9Sstevel@tonic-gate #define	CH_DCTAG_PA_SHIFT		12
9487c478bd9Sstevel@tonic-gate #define	CH_DCTAG_VALID_BIT		INT64_C(0x0000000000000001)
9497c478bd9Sstevel@tonic-gate #define	CH_DCTAG_LINE_INVALID(tag)	(((tag) & CH_DCTAG_VALID_BIT) == 0)
9507c478bd9Sstevel@tonic-gate #define	CH_DCIDX_TO_ADDR(idx)		((idx) & CH_DCACHE_IDX_MASK)
9517c478bd9Sstevel@tonic-gate #define	CH_DCTAG_TO_PA(tag)		(((tag) << CH_DCTAG_PA_SHIFT) & \
9527c478bd9Sstevel@tonic-gate 					    CH_DCTAG_PA_MASK)
9537c478bd9Sstevel@tonic-gate #define	CH_DCTAG_MATCH(tag, pa)		(!CH_DCTAG_LINE_INVALID(tag) && \
9547c478bd9Sstevel@tonic-gate 			    ((pa) & CH_DCTAG_PA_MASK) == CH_DCTAG_TO_PA(tag))
9557c478bd9Sstevel@tonic-gate #define	CH_DCSNTAG_MASK			INT64_C(0x000007ffffffe000)
9567c478bd9Sstevel@tonic-gate #define	CH_DCSNTAG_TO_PA(tag)		((tag << CH_DCTAG_PA_SHIFT) \
9577c478bd9Sstevel@tonic-gate 							& CH_DCSNTAG_MASK)
9587c478bd9Sstevel@tonic-gate #define	CH_DCUTAG_TO_UTAG(tag)		((tag) & 0xff)
9597c478bd9Sstevel@tonic-gate #define	CH_DCUTAG_TO_VA(tag)		((tag & 0xff) << 14)
9607c478bd9Sstevel@tonic-gate #define	CH_DCUTAG_IDX_MASK		0x03fe0
9617c478bd9Sstevel@tonic-gate #define	CH_DC_DATA_REG_SIZE		32
9627c478bd9Sstevel@tonic-gate #define	CH_DC_UTAG_MASK			0xff
9637c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS) || defined(JALAPENO) || defined(SERRANO)
9647c478bd9Sstevel@tonic-gate #define	CHP_DCTAG_PARMASK		INT64_C(0x000000007ffffffe)
9657c478bd9Sstevel@tonic-gate #define	CHP_DCSNTAG_PARMASK		INT64_C(0x000000007ffffffe)
9667c478bd9Sstevel@tonic-gate #define	CHP_DCTAG_MASK			INT64_C(0x000003ffffffe000)
9677c478bd9Sstevel@tonic-gate #define	CHP_DCSNTAG_MASK		INT64_C(0x000003ffffffe000)
9687c478bd9Sstevel@tonic-gate #define	CHP_DCWAY_MASK			INT64_C(0x0000000000003fe0)
9697c478bd9Sstevel@tonic-gate #define	CHP_DCUTAG_TO_UTAG(tag)		((tag) & 0xffff)
9707c478bd9Sstevel@tonic-gate #define	CHP_DCPATAG_TO_PA(tag)		((tag << CH_DCTAG_PA_SHIFT) \
9717c478bd9Sstevel@tonic-gate 							& CHP_DCTAG_MASK)
9727c478bd9Sstevel@tonic-gate #define	CHP_DCSNTAG_TO_PA(tag)		((tag << CH_DCTAG_PA_SHIFT) \
9737c478bd9Sstevel@tonic-gate 							& CHP_DCSNTAG_MASK)
9747c478bd9Sstevel@tonic-gate #define	CHP_DC_IDX(dcp)			((dcp->dc_idx & 0x1fc0) >> 5)
9757c478bd9Sstevel@tonic-gate #define	CHP_DCTAG_PARITY(tag)		(tag & CHP_DC_TAG)
9767c478bd9Sstevel@tonic-gate #define	CHP_DCSNTAG_PARITY(tag)		(tag & CHP_DC_SNTAG)
9777c478bd9Sstevel@tonic-gate #define	CHP_DC_TAG			0x1
9787c478bd9Sstevel@tonic-gate #define	CHP_DC_SNTAG			0x2
9797c478bd9Sstevel@tonic-gate #define	PN_DC_DATA_PARITY_SHIFT    	8
9807c478bd9Sstevel@tonic-gate #define	PN_DC_DATA_PARITY_MASK    	0xff
9817c478bd9Sstevel@tonic-gate #define	PN_DC_DATA_ALL_PARITY_MASK    	0xffffffff
9827c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS || JALAPENO || SERRANO */
9837c478bd9Sstevel@tonic-gate #define	PN_DC_DATA_PARITY_BIT_SHIFT    	16
9847c478bd9Sstevel@tonic-gate 
9857c478bd9Sstevel@tonic-gate /*
9867c478bd9Sstevel@tonic-gate  * Macros for Cheetah Icache diagnostic accesses.
9877c478bd9Sstevel@tonic-gate  */
9887c478bd9Sstevel@tonic-gate 
9897c478bd9Sstevel@tonic-gate /*
9907c478bd9Sstevel@tonic-gate  * Icache Index Mask for bits from *AFAR*. Note that the Icache is virtually
9917c478bd9Sstevel@tonic-gate  * indexed for Panther and physically indexed for other CPUs. For Panther,
9927c478bd9Sstevel@tonic-gate  * we obtain an index by looking at bits[12:6] of the AFAR PA and we check
9937c478bd9Sstevel@tonic-gate  * both lines associated with bit 13 = 0 or 1 (total of 8 entries to check).
9947c478bd9Sstevel@tonic-gate  * For non-Panther CPUs we get our index by just looking at bits[12:5] of
9957c478bd9Sstevel@tonic-gate  * the AFAR PA (total of 4 entries to check). The Icache index is also
9967c478bd9Sstevel@tonic-gate  * confusing because we need to shift the virtual address bits left by one
9977c478bd9Sstevel@tonic-gate  * for the index.
9987c478bd9Sstevel@tonic-gate  */
9997c478bd9Sstevel@tonic-gate #define	CH_ICACHE_IDX_MASK		0x01fe0
10007c478bd9Sstevel@tonic-gate #define	PN_ICACHE_IDX_MASK		0x03fc0
10017c478bd9Sstevel@tonic-gate #define	PN_ICACHE_VA_IDX_MASK		0x01fc0
10027c478bd9Sstevel@tonic-gate #define	CH_ICACHE_IDX_SHIFT		1
10037c478bd9Sstevel@tonic-gate #define	CH_ICACHE_IDX_INCR		0x04000
10047c478bd9Sstevel@tonic-gate #define	PN_ICACHE_IDX_INCR		0x08000
10057c478bd9Sstevel@tonic-gate #define	CH_ICACHE_IDX_LIMIT		0x10000
10067c478bd9Sstevel@tonic-gate #define	PN_ICACHE_IDX_LIMIT		0x20000
10077c478bd9Sstevel@tonic-gate #define	CH_ICACHE_NWAY			4
10087c478bd9Sstevel@tonic-gate #define	CH_ICACHE_WAY_MASK		0x0c000
10097c478bd9Sstevel@tonic-gate #define	CH_ICACHE_WAY_SHIFT		14
10107c478bd9Sstevel@tonic-gate #define	PN_ICACHE_WAY_MASK		0x18000
10117c478bd9Sstevel@tonic-gate #define	PN_ICACHE_WAY_SHIFT		15
10127c478bd9Sstevel@tonic-gate #define	CH_ICTAG_PA			0x00
10137c478bd9Sstevel@tonic-gate #define	CH_ICTAG_UTAG			0x08
10147c478bd9Sstevel@tonic-gate #define	CH_ICTAG_UPPER			0x10
10157c478bd9Sstevel@tonic-gate #define	CH_ICTAG_LOWER			0x30
10167c478bd9Sstevel@tonic-gate #define	CH_ICTAG_TMASK			0x3f
10177c478bd9Sstevel@tonic-gate #define	CH_ICPATAG_MASK			INT64_C(0x000007ffffffe000)
10187c478bd9Sstevel@tonic-gate #define	CH_ICPATAG_LBITS		0xff	/* lower 8 bits undefined */
10197c478bd9Sstevel@tonic-gate #define	CH_ICPATAG_SHIFT		5
10207c478bd9Sstevel@tonic-gate #define	CH_ICIDX_TO_WAY(idx)		(((idx) & CH_ICACHE_WAY_MASK) >> \
10217c478bd9Sstevel@tonic-gate 						CH_ICACHE_WAY_SHIFT)
10227c478bd9Sstevel@tonic-gate #define	PN_ICIDX_TO_WAY(idx)		(((idx) & PN_ICACHE_WAY_MASK) >> \
10237c478bd9Sstevel@tonic-gate 						PN_ICACHE_WAY_SHIFT)
10247c478bd9Sstevel@tonic-gate #define	CH_ICIDX_TO_ADDR(idx)		(((idx) >> CH_ICACHE_IDX_SHIFT) & \
10257c478bd9Sstevel@tonic-gate 						CH_ICACHE_IDX_MASK)
10267c478bd9Sstevel@tonic-gate #define	PN_ICIDX_TO_ADDR(idx)		(((idx) >> CH_ICACHE_IDX_SHIFT) & \
10277c478bd9Sstevel@tonic-gate 						PN_ICACHE_IDX_MASK)
10287c478bd9Sstevel@tonic-gate #define	CH_ICPATAG_TO_PA(tag)		(((tag) << CH_ICPATAG_SHIFT) & \
10297c478bd9Sstevel@tonic-gate 						CH_ICPATAG_MASK)
10307c478bd9Sstevel@tonic-gate #define	CH_ICPATAG_MATCH(tag, pa)	(CH_ICPATAG_TO_PA(tag) == \
10317c478bd9Sstevel@tonic-gate 						((pa) & CH_ICPATAG_MASK))
10327c478bd9Sstevel@tonic-gate #define	CH_ICUTAG_MASK			INT64_C(0x00000000001fe000)
10337c478bd9Sstevel@tonic-gate #define	CH_ICUTAG_TO_UTAG(tag)		(((tag) >> 38) & 0xff)
10347c478bd9Sstevel@tonic-gate #define	CH_ICUTAG_TO_VA(tag)		(((tag) >> 25) & CH_ICUTAG_MASK)
10357c478bd9Sstevel@tonic-gate #define	CH_ICSNTAG_MASK			INT64_C(0x000007ffffffe000)
10367c478bd9Sstevel@tonic-gate #define	CH_ICSNTAG_TO_PA(tag)		(((tag) << 5) & CH_ICSNTAG_MASK)
10377c478bd9Sstevel@tonic-gate #define	CH_ICLOWER_VALID		INT64_C(0x0004000000000000)
10387c478bd9Sstevel@tonic-gate #define	CH_ICUPPER_VALID		INT64_C(0x0004000000000000)
10397c478bd9Sstevel@tonic-gate #define	CH_ICLOWER_TO_VPRED(lower)	(((lower) >> 46) & 0xf)
10407c478bd9Sstevel@tonic-gate #define	CH_ICUPPER_TO_VPRED(upper)	(((upper) >> 46) & 0xf)
10417c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
10427c478bd9Sstevel@tonic-gate #define	CH_ICTAG_MATCH(icp, pa)		(((icp->ic_lower | icp->ic_upper) & \
10437c478bd9Sstevel@tonic-gate 					    CH_ICLOWER_VALID) && \
10447c478bd9Sstevel@tonic-gate 					    CH_ICPATAG_MATCH(icp->ic_patag, pa))
10457c478bd9Sstevel@tonic-gate #define	PN_ICUTAG_TO_VA(tag)		((tag >> 24) & PN_ICUTAG_MASK)
10467c478bd9Sstevel@tonic-gate #else	/* CHEETAH_PLUS */
10477c478bd9Sstevel@tonic-gate #define	CH_ICTAG_MATCH(icp, pa)		((icp->ic_lower & CH_ICLOWER_VALID) &&\
10487c478bd9Sstevel@tonic-gate 					    CH_ICPATAG_MATCH(icp->ic_patag, pa))
10497c478bd9Sstevel@tonic-gate #define	PN_ICUTAG_TO_VA(tag)		0
10507c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
10517c478bd9Sstevel@tonic-gate 
10527c478bd9Sstevel@tonic-gate #define	CH_IC_DATA_REG_SIZE		64
10537c478bd9Sstevel@tonic-gate #define	PN_IC_DATA_REG_SIZE		128
10547c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS) || defined(JALAPENO) || defined(SERRANO)
10557c478bd9Sstevel@tonic-gate #define	CHP_IC_IDX(icp)			((icp->ic_idx & 0x3fc0) >> 6)
10567c478bd9Sstevel@tonic-gate #define	PN_IC_IDX(icp)			((icp->ic_idx & 0x7f80) >> 7)
10577c478bd9Sstevel@tonic-gate #define	CHP_ICPATAG_MASK		INT64_C(0x000003ffffffe000)
10587c478bd9Sstevel@tonic-gate #define	CHP_ICSNTAG_MASK		INT64_C(0x000003ffffffe000)
10597c478bd9Sstevel@tonic-gate #define	CHP_ICUTAG_MASK			INT64_C(0x00000000001fe000)
10607c478bd9Sstevel@tonic-gate #define	PN_ICUTAG_MASK			INT64_C(0x00000000003fc000)
10617c478bd9Sstevel@tonic-gate #define	CHP_ICWAY_MASK			INT64_C(0x0000000000003fe0)
10627c478bd9Sstevel@tonic-gate #define	CHP_ICPATAG_TO_PA(tag)		((tag << 5) & CHP_ICPATAG_MASK)
10637c478bd9Sstevel@tonic-gate #define	CHP_ICSNTAG_TO_PA(tag)		((tag << 5) & CHP_ICSNTAG_MASK)
10647c478bd9Sstevel@tonic-gate #define	CHP_ICUTAG_TO_VA(tag)		((tag >> 25) & CHP_ICUTAG_MASK)
10657c478bd9Sstevel@tonic-gate #define	CHP_ICPATAG_PARMASK		INT64_C(0x0000003fffffff00)
10667c478bd9Sstevel@tonic-gate #define	CHP_ICSNTAG_PARMASK		INT64_C(0x0000003fffffff00)
10677c478bd9Sstevel@tonic-gate 
10687c478bd9Sstevel@tonic-gate /*
10697c478bd9Sstevel@tonic-gate  * Cheetah+ Icache data parity masks, see Cheetah+ Delta PRM 7.3
10707c478bd9Sstevel@tonic-gate  * PC-relative instructions have different bits protected by parity.
10717c478bd9Sstevel@tonic-gate  * Predecode bit 7 is not parity protected and indicates if the instruction
10727c478bd9Sstevel@tonic-gate  * is PC-relative or not.
10737c478bd9Sstevel@tonic-gate  */
10747c478bd9Sstevel@tonic-gate #define	CH_ICDATA_PRED_ISPCREL		INT64_C(0x0000008000000000)
10757c478bd9Sstevel@tonic-gate #define	CHP_ICDATA_PCREL_PARMASK	INT64_C(0x0000039ffffff800)
10767c478bd9Sstevel@tonic-gate #define	CHP_ICDATA_NPCREL_PARMASK	INT64_C(0x000003bfffffffff)
10777c478bd9Sstevel@tonic-gate #define	PN_ICDATA_PARITY_BIT_MASK	INT64_C(0x40000000000)
10787c478bd9Sstevel@tonic-gate #define	CHP_ICTAG_PARITY(tag)		(tag & CHP_IC_TAG)
10797c478bd9Sstevel@tonic-gate #define	CHP_ICSNTAG_PARITY(tag)		(tag & CHP_IC_SNTAG)
10807c478bd9Sstevel@tonic-gate #define	CHP_IC_TAG			0x1
10817c478bd9Sstevel@tonic-gate #define	CHP_IC_SNTAG			0x2
10827c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS || JALAPENO || SERRANO */
10837c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
10847c478bd9Sstevel@tonic-gate #define	PN_IPB_TAG_ADDR_LINESIZE	0x40
10857c478bd9Sstevel@tonic-gate #define	PN_IPB_TAG_ADDR_MAX		0x3c0
10867c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
10877c478bd9Sstevel@tonic-gate 
10887c478bd9Sstevel@tonic-gate /*
10897c478bd9Sstevel@tonic-gate  * Macros for Pcache diagnostic accesses.
10907c478bd9Sstevel@tonic-gate  */
10917c478bd9Sstevel@tonic-gate #define	CH_PC_WAY_MASK			0x600
10927c478bd9Sstevel@tonic-gate #define	CH_PC_WAY_SHIFT			9
10937c478bd9Sstevel@tonic-gate #define	CH_PCIDX_TO_WAY(idx)		(((idx) & CH_PC_WAY_MASK) >> \
10947c478bd9Sstevel@tonic-gate 						CH_PC_WAY_SHIFT)
10957c478bd9Sstevel@tonic-gate #define	CH_PC_DATA_REG_SIZE		64
10967c478bd9Sstevel@tonic-gate #define	CH_PCACHE_NWAY			4
10977c478bd9Sstevel@tonic-gate #define	PN_PC_PARITY_SHIFT		50
10987c478bd9Sstevel@tonic-gate #define	PN_PC_PARITY_MASK		0xff
10997c478bd9Sstevel@tonic-gate #define	PN_PC_PARITY_BITS(status)	\
11007c478bd9Sstevel@tonic-gate 	(((status) >> PN_PC_PARITY_SHIFT) & PN_PC_PARITY_MASK)
11017c478bd9Sstevel@tonic-gate #define	CH_PC_IDX_ADR(pcp)		((pcp->pc_idx & 0x1c0) >> 6)
11027c478bd9Sstevel@tonic-gate #define	CH_PCTAG_ADDR_SHIFT		6
11037c478bd9Sstevel@tonic-gate #define	CH_PC_PA_MASK			0x7ffffffffc0
11047c478bd9Sstevel@tonic-gate #define	CH_PCTAG_TO_VA(tag)		((tag) << CH_PCTAG_ADDR_SHIFT)
11057c478bd9Sstevel@tonic-gate #define	CH_PCSTAG_TO_PA(tag)		(((tag) << CH_PCTAG_ADDR_SHIFT) & \
11067c478bd9Sstevel@tonic-gate 					    CH_PC_PA_MASK)
11077c478bd9Sstevel@tonic-gate #define	CH_PCTAG_BNK0_VALID_MASK	0x2000000000000000
11087c478bd9Sstevel@tonic-gate #define	CH_PCTAG_BNK1_VALID_MASK	0x1000000000000000
11097c478bd9Sstevel@tonic-gate #define	CH_PCTAG_BNK0_INVALID(tag)	(((tag) & CH_PCTAG_BNK0_VALID_MASK) == \
11107c478bd9Sstevel@tonic-gate 					    0)
11117c478bd9Sstevel@tonic-gate #define	CH_PCTAG_BNK1_INVALID(tag)	(((tag) & CH_PCTAG_BNK1_VALID_MASK) == \
11127c478bd9Sstevel@tonic-gate 					    0)
11137c478bd9Sstevel@tonic-gate 
11147c478bd9Sstevel@tonic-gate /*
11157c478bd9Sstevel@tonic-gate  * CPU Log Out Structure parameters.
11167c478bd9Sstevel@tonic-gate  * This structure is filled in by the Error Trap handlers and captures the
11177c478bd9Sstevel@tonic-gate  * Ecache/Dcache/Icache line(s) associated with the AFAR.
11187c478bd9Sstevel@tonic-gate  * For Cheetah Phase II, this structure is filled in at the TL=0 code.  For
11197c478bd9Sstevel@tonic-gate  * Cheetah Phase III, this will be filled in at the trap handlers.
11207c478bd9Sstevel@tonic-gate  */
11217c478bd9Sstevel@tonic-gate 
11227c478bd9Sstevel@tonic-gate /*
11237c478bd9Sstevel@tonic-gate  * We use this to mark the LOGOUT structure as invalid.  Note that
11247c478bd9Sstevel@tonic-gate  * this cannot be a valid AFAR, as AFAR bits outside of [41:5] should always
11257c478bd9Sstevel@tonic-gate  * be zero.
11267c478bd9Sstevel@tonic-gate  */
11277c478bd9Sstevel@tonic-gate #define	LOGOUT_INVALID_U32	0xecc1ecc1
11287c478bd9Sstevel@tonic-gate #define	LOGOUT_INVALID_L32	0xecc1ecc1
11297c478bd9Sstevel@tonic-gate #define	LOGOUT_INVALID		UINT64_C(0xecc1ecc1ecc1ecc1)
11307c478bd9Sstevel@tonic-gate 
11317c478bd9Sstevel@tonic-gate /*
11327c478bd9Sstevel@tonic-gate  * Max number of TLs to support for Fast ECC or Cache Parity Errors
11337c478bd9Sstevel@tonic-gate  * at TL>0.  Traps are OK from TL=1-2, at TL>=3, we will Red Mode.
11347c478bd9Sstevel@tonic-gate  */
11357c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_TLMAX	2
11367c478bd9Sstevel@tonic-gate 
11377c478bd9Sstevel@tonic-gate /*
11387c478bd9Sstevel@tonic-gate  * Software traps used by TL>0 handlers.
11397c478bd9Sstevel@tonic-gate  */
11407c478bd9Sstevel@tonic-gate #define	SWTRAP_0		0	/* Used by Fast ECC */
11417c478bd9Sstevel@tonic-gate #define	SWTRAP_1		1	/* Used by Dcache Parity */
11427c478bd9Sstevel@tonic-gate #define	SWTRAP_2		2	/* Used by Icache Parity */
11437c478bd9Sstevel@tonic-gate 
11447c478bd9Sstevel@tonic-gate /*
11457c478bd9Sstevel@tonic-gate  * Bit mask defines for various Cheetah Error conditions.
11467c478bd9Sstevel@tonic-gate  */
11477c478bd9Sstevel@tonic-gate #define	CH_ERR_FECC	0x01	/* Data/Event is Fast ECC */
11487c478bd9Sstevel@tonic-gate #define	CH_ERR_IPE	0x02	/* Data/Event is Icache Parity Error */
11497c478bd9Sstevel@tonic-gate #define	CH_ERR_DPE	0x04	/* Data/Event is Dcache Parity Error */
11507c478bd9Sstevel@tonic-gate #define	CH_ERR_PANIC	0x08	/* Fatal error in TL>0 handler */
11517c478bd9Sstevel@tonic-gate #define	CH_ERR_TL	0x10	/* Error occured at TL>0 */
11527c478bd9Sstevel@tonic-gate #define	CH_ERR_ME_SHIFT	   8	/* If multiple errors, shift left newest */
11537c478bd9Sstevel@tonic-gate #define	CH_ERR_ME_FLAGS(x)	((x) >> CH_ERR_ME_SHIFT)
11547c478bd9Sstevel@tonic-gate 
11557c478bd9Sstevel@tonic-gate /*
11567c478bd9Sstevel@tonic-gate  * Defines for Bit8 (CH_ERR_TSTATE_IC_ON) and Bit9 (CH_ERR_TSTATE_DC_ON)
11577c478bd9Sstevel@tonic-gate  * in %tstate, which is used to remember D$/I$ state on Fast ECC handler
11587c478bd9Sstevel@tonic-gate  * at TL>0.  Note that DCU_IC=0x1, DCU_DC=0x2.
11597c478bd9Sstevel@tonic-gate  */
11607c478bd9Sstevel@tonic-gate #define	CH_ERR_G2_TO_TSTATE_SHFT	10
11617c478bd9Sstevel@tonic-gate #define	CH_ERR_DCU_TO_TSTATE_SHFT	8
11627c478bd9Sstevel@tonic-gate #define	CH_ERR_TSTATE_IC_ON	(DCU_IC << CH_ERR_DCU_TO_TSTATE_SHFT)
11637c478bd9Sstevel@tonic-gate #define	CH_ERR_TSTATE_DC_ON	(DCU_DC << CH_ERR_DCU_TO_TSTATE_SHFT)
11647c478bd9Sstevel@tonic-gate 
11657c478bd9Sstevel@tonic-gate /*
11667c478bd9Sstevel@tonic-gate  * Multiple offset TL>0 handler structure elements
11677c478bd9Sstevel@tonic-gate  */
11687c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_DATA		(CH_ERR_TL1_LOGOUT + CH_CLO_DATA)
11697c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_SDW_DATA	(CH_ERR_TL1_LOGOUT + CH_CLO_SDW_DATA)
11707c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_NEST_CNT	(CH_ERR_TL1_LOGOUT + CH_CLO_NEST_CNT)
1171af3c157aSrscott #define	CH_ERR_TL1_AFAR		(CH_ERR_TL1_DATA + CH_CHD_AFAR)
11727c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_AFSR		(CH_ERR_TL1_DATA + CH_CHD_AFSR)
1173af3c157aSrscott #define	CH_ERR_TL1_SDW_AFAR	(CH_ERR_TL1_SDW_DATA + CH_CHD_AFAR)
11747c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_SDW_AFSR	(CH_ERR_TL1_SDW_DATA + CH_CHD_AFSR)
11757c478bd9Sstevel@tonic-gate #define	CH_ERR_TL1_SDW_AFSR_EXT	(CH_ERR_TL1_SDW_DATA + CH_CHD_AFSR_EXT)
11767c478bd9Sstevel@tonic-gate 
11777c478bd9Sstevel@tonic-gate /*
11787c478bd9Sstevel@tonic-gate  * Interval for deferred CEEN reenable
11797c478bd9Sstevel@tonic-gate  */
11807c478bd9Sstevel@tonic-gate #define	CPU_CEEN_DELAY_SECS		6
11817c478bd9Sstevel@tonic-gate 
11827c478bd9Sstevel@tonic-gate /*
11837c478bd9Sstevel@tonic-gate  * flags for flt_trapped_ce variable
11847c478bd9Sstevel@tonic-gate  */
11857c478bd9Sstevel@tonic-gate #define	CE_CEEN_DEFER		0x1	/* no CEEN reenable in trap handler */
11867c478bd9Sstevel@tonic-gate #define	CE_CEEN_NODEFER		0x2	/* reenable CEEN in handler */
11877c478bd9Sstevel@tonic-gate #define	CE_CEEN_TIMEOUT		0x4	/* CE caught by timeout */
11887c478bd9Sstevel@tonic-gate #define	CE_CEEN_TRAPPED		0x8	/* CE caught by trap */
11897c478bd9Sstevel@tonic-gate 
11907c478bd9Sstevel@tonic-gate /*
11917c478bd9Sstevel@tonic-gate  * default value for cpu_ce_not_deferred
11927c478bd9Sstevel@tonic-gate  */
11937c478bd9Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
11947c478bd9Sstevel@tonic-gate #define	CPU_CE_NOT_DEFERRED	(C_AFSR_CECC_ERRS & \
11957c478bd9Sstevel@tonic-gate 		~(C_AFSR_CE | C_AFSR_FRC | C_AFSR_RCE | C_AFSR_EMC))
11967c478bd9Sstevel@tonic-gate #else /* JALAPENO || SERRANO */
11977c478bd9Sstevel@tonic-gate #define	CPU_CE_NOT_DEFERRED		C_AFSR_CECC_ERRS & \
11987c478bd9Sstevel@tonic-gate 					    ~(C_AFSR_CE | C_AFSR_EMC)
11997c478bd9Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
12007c478bd9Sstevel@tonic-gate 
12017c478bd9Sstevel@tonic-gate #define	CPU_CE_NOT_DEFERRED_EXT		C_AFSR_EXT_CECC_ERRS
12027c478bd9Sstevel@tonic-gate 
12037c478bd9Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
12047c478bd9Sstevel@tonic-gate 
12057c478bd9Sstevel@tonic-gate /*
12067c478bd9Sstevel@tonic-gate  * VA for primary and shadow AFSR/AFAR/AFSR_EXT registers
12077c478bd9Sstevel@tonic-gate  */
12087c478bd9Sstevel@tonic-gate #define	ASI_SHADOW_REG_VA	0x8
12097c478bd9Sstevel@tonic-gate #define	ASI_AFSR_EXT_VA		0x10
12107c478bd9Sstevel@tonic-gate #define	ASI_SHADOW_AFSR_EXT_VA	0x18
12117c478bd9Sstevel@tonic-gate 
12127c478bd9Sstevel@tonic-gate /*
12137c478bd9Sstevel@tonic-gate  * Bitmask for keeping track of core parking in ECC error handlers.
12147c478bd9Sstevel@tonic-gate  * We share a register that also saves the DCUCR value so we use
12157c478bd9Sstevel@tonic-gate  * one of the reserved bit positions of the DCUCR register to keep
12167c478bd9Sstevel@tonic-gate  * track of whether or not we have parked our sibling core.
12177c478bd9Sstevel@tonic-gate  */
12187c478bd9Sstevel@tonic-gate #define	PN_PARKED_OTHER_CORE	0x20
12197c478bd9Sstevel@tonic-gate #define	PN_BOTH_CORES_RUNNING	0x3
12207c478bd9Sstevel@tonic-gate 
12217c478bd9Sstevel@tonic-gate /*
12227c478bd9Sstevel@tonic-gate  * Panther EMU Activity Status Register Bits.
12237c478bd9Sstevel@tonic-gate  */
12247c478bd9Sstevel@tonic-gate #define	ASI_EMU_ACT_STATUS_VA	0x18
12257c478bd9Sstevel@tonic-gate #define	MCU_ACT_STATUS		INT64_C(0x0000000000000001)
12267c478bd9Sstevel@tonic-gate #define	SIU_ACT_STATUS		INT64_C(0x0000000000000002)
12277c478bd9Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
12287c478bd9Sstevel@tonic-gate 
12297c478bd9Sstevel@tonic-gate #define	ASI_CESR_ID_VA		0x40    /* ASI_CESRD_ID per-core registers */
12307c478bd9Sstevel@tonic-gate 
12317c478bd9Sstevel@tonic-gate #define	ASR_DISPATCH_CONTROL		%asr18
12327c478bd9Sstevel@tonic-gate #define	ASR_DISPATCH_CONTROL_BPE	0x20
12337c478bd9Sstevel@tonic-gate 
12347c478bd9Sstevel@tonic-gate /*
12357c478bd9Sstevel@tonic-gate  * Max number of E$ sets logged in ch_diag_data structure
12367c478bd9Sstevel@tonic-gate  */
12377c478bd9Sstevel@tonic-gate #define	CHD_EC_DATA_SETS	4	/* max 4 sets of E$ data */
12387c478bd9Sstevel@tonic-gate 
12397c478bd9Sstevel@tonic-gate /*
12407c478bd9Sstevel@tonic-gate  * Definitions for Panther TLB parity handling.
12417c478bd9Sstevel@tonic-gate  */
12427c478bd9Sstevel@tonic-gate #define	PN_ITLB_NWAYS		2
12437c478bd9Sstevel@tonic-gate #define	PN_NUM_512_ITLBS	1
12447c478bd9Sstevel@tonic-gate #define	PN_DTLB_NWAYS		2
12457c478bd9Sstevel@tonic-gate #define	PN_NUM_512_DTLBS	2
12467c478bd9Sstevel@tonic-gate #define	PN_SFSR_PARITY_SHIFT	12
12477c478bd9Sstevel@tonic-gate #define	PN_ITLB_PGSZ_SHIFT	22
12487c478bd9Sstevel@tonic-gate #define	PN_ITLB_PGSZ_MASK	(7 << PN_ITLB_PGSZ_SHIFT)
12497c478bd9Sstevel@tonic-gate #define	PN_DTLB_PGSZ0_SHIFT	16
12507c478bd9Sstevel@tonic-gate #define	PN_DTLB_PGSZ0_MASK	(7 << PN_DTLB_PGSZ0_SHIFT)
12517c478bd9Sstevel@tonic-gate #define	PN_DTLB_PGSZ1_SHIFT	19
12527c478bd9Sstevel@tonic-gate #define	PN_DTLB_PGSZ1_MASK	(7 << PN_DTLB_PGSZ1_SHIFT)
12537c478bd9Sstevel@tonic-gate #define	PN_DTLB_PGSZ_MASK	(PN_DTLB_PGSZ1_MASK | PN_DTLB_PGSZ0_MASK)
12547c478bd9Sstevel@tonic-gate #define	PN_DTLB_T512_0		(2 << 16)
12557c478bd9Sstevel@tonic-gate #define	PN_DTLB_T512_1		(3 << 16)
12567c478bd9Sstevel@tonic-gate #define	PN_TLO_INFO_IMMU_SHIFT	14
12577c478bd9Sstevel@tonic-gate #define	PN_TLO_INFO_IMMU	(1 << PN_TLO_INFO_IMMU_SHIFT)
12587c478bd9Sstevel@tonic-gate #define	PN_TLO_INFO_TL1_SHIFT	13
12597c478bd9Sstevel@tonic-gate #define	PN_TLO_INFO_TL1		(1 << PN_TLO_INFO_TL1_SHIFT)
12607c478bd9Sstevel@tonic-gate #define	PN_ITLB_T512		(2 << 16)
12617c478bd9Sstevel@tonic-gate #define	PN_TLB_ACC_IDX_SHIFT	3
12627c478bd9Sstevel@tonic-gate #define	PN_TLB_ACC_WAY_BIT	(1 << 11)
12637c478bd9Sstevel@tonic-gate #define	PN_TLB_DIAGACC_OFFSET	0x40000	/* Diag Acc ASI VA offset */
12647c478bd9Sstevel@tonic-gate /*
12657c478bd9Sstevel@tonic-gate  * tag parity = XOR(Size[2:0],Global,VA[63:21],Context[12:0])
12667c478bd9Sstevel@tonic-gate  * which requires looking at both the tag and the data.
12677c478bd9Sstevel@tonic-gate  */
12687c478bd9Sstevel@tonic-gate #define	PN_TLB_TAG_PARITY_TAG_MASK	0xffffffffffe01fff
12697c478bd9Sstevel@tonic-gate #define	PN_TLB_TAG_PARITY_DATA_MASK	0x6001400000000001
12707c478bd9Sstevel@tonic-gate /* data parity = XOR(NFO,IE,PA[42:13],CP,CV,E,P,W) */
12717c478bd9Sstevel@tonic-gate #define	PN_TLB_DATA_PARITY_DATA_MASK	0x180087ffffffe03e
12727c478bd9Sstevel@tonic-gate 
12737c478bd9Sstevel@tonic-gate #ifdef _KERNEL
12747c478bd9Sstevel@tonic-gate 
12757c478bd9Sstevel@tonic-gate #ifndef	_ASM
12767c478bd9Sstevel@tonic-gate 
12777c478bd9Sstevel@tonic-gate #include <sys/kstat.h>
12787c478bd9Sstevel@tonic-gate 
12797c478bd9Sstevel@tonic-gate /*
12807c478bd9Sstevel@tonic-gate  * One Ecache data element, 32 bytes of data, 8 bytes of ECC.
12817c478bd9Sstevel@tonic-gate  * See Cheetah PRM 10.7.2.
12827c478bd9Sstevel@tonic-gate  */
12837c478bd9Sstevel@tonic-gate typedef struct ec_data_elm {
12847c478bd9Sstevel@tonic-gate 	uint64_t ec_d8[CH_ECACHE_STGREG_NUM];
12857c478bd9Sstevel@tonic-gate 	uint64_t ec_eccd;	/* EC_data_ECC field */
12867c478bd9Sstevel@tonic-gate } ec_data_elm_t;
12877c478bd9Sstevel@tonic-gate 
12887c478bd9Sstevel@tonic-gate /*
12897c478bd9Sstevel@tonic-gate  * L2 and L3 cache data captured by cpu log out code.
12907c478bd9Sstevel@tonic-gate  * See Cheetah PRM 10.7.4.
12917c478bd9Sstevel@tonic-gate  */
12927c478bd9Sstevel@tonic-gate typedef struct ch_ec_data {
12937c478bd9Sstevel@tonic-gate 	uint64_t ec_logflag;	/* Flag indicates if data was logged */
12947c478bd9Sstevel@tonic-gate 	uint64_t ec_idx;	/* Ecache index */
12957c478bd9Sstevel@tonic-gate 	uint64_t ec_way;	/* Ecache way */
12967c478bd9Sstevel@tonic-gate 	uint64_t ec_tag;	/* Ecache Tag */
12977c478bd9Sstevel@tonic-gate 	uint64_t ec_tag_ecc;	/* Ecache Tag ECC (Cheetah+ only) */
12987c478bd9Sstevel@tonic-gate 	ec_data_elm_t ec_data[CH_ECACHE_SUBBLK_SIZE/CH_ECACHE_STGREG_SIZE];
12997c478bd9Sstevel@tonic-gate } ch_ec_data_t;
13007c478bd9Sstevel@tonic-gate 
13017c478bd9Sstevel@tonic-gate /*
13027c478bd9Sstevel@tonic-gate  * Dcache data captured by cpu log out code and get_dcache_dtag.
13037c478bd9Sstevel@tonic-gate  * See Cheetah PRM 10.6.[1-4].
13047c478bd9Sstevel@tonic-gate  */
13057c478bd9Sstevel@tonic-gate typedef struct ch_dc_data {
13067c478bd9Sstevel@tonic-gate 	uint64_t dc_logflag;	/* Flag indicates if data was logged */
13077c478bd9Sstevel@tonic-gate 	uint64_t dc_idx;	/* Dcache index */
13087c478bd9Sstevel@tonic-gate 	uint64_t dc_way;	/* Dcache way */
13097c478bd9Sstevel@tonic-gate 	uint64_t dc_tag;	/* Tag/Valid Fields */
13107c478bd9Sstevel@tonic-gate 	uint64_t dc_utag;	/* Microtag */
13117c478bd9Sstevel@tonic-gate 	uint64_t dc_sntag;	/* Snoop Tag */
13127c478bd9Sstevel@tonic-gate 	uint64_t dc_data[CH_DC_DATA_REG_SIZE/sizeof (uint64_t)]; /* Data */
13137c478bd9Sstevel@tonic-gate 	uint64_t dc_pn_data_parity;	/* Data parity bits for Panther */
13147c478bd9Sstevel@tonic-gate } ch_dc_data_t;
13157c478bd9Sstevel@tonic-gate 
13167c478bd9Sstevel@tonic-gate /*
13177c478bd9Sstevel@tonic-gate  * Icache data captured by cpu log out code and get_icache_dtag.
13187c478bd9Sstevel@tonic-gate  * See Cheetah PRM 10.4.[1-3].
13197c478bd9Sstevel@tonic-gate  */
13207c478bd9Sstevel@tonic-gate typedef struct ch_ic_data {
13217c478bd9Sstevel@tonic-gate 	uint64_t ic_logflag;	/* Flag indicates if data was logged */
13227c478bd9Sstevel@tonic-gate 	uint64_t ic_idx;	/* Icache index */
13237c478bd9Sstevel@tonic-gate 	uint64_t ic_way;	/* Icache way */
13247c478bd9Sstevel@tonic-gate 	uint64_t ic_patag;	/* Physical address tag */
13257c478bd9Sstevel@tonic-gate 	uint64_t ic_utag;	/* Microtag */
13267c478bd9Sstevel@tonic-gate 	uint64_t ic_upper;	/* Upper valid/predict tag */
13277c478bd9Sstevel@tonic-gate 	uint64_t ic_lower;	/* Lower valid/predict tag */
13287c478bd9Sstevel@tonic-gate 	uint64_t ic_sntag;	/* Snoop Tag */
13297c478bd9Sstevel@tonic-gate 	uint64_t ic_data[PN_IC_DATA_REG_SIZE/sizeof (uint64_t)]; /* Data */
13307c478bd9Sstevel@tonic-gate } ch_ic_data_t;
13317c478bd9Sstevel@tonic-gate 
13327c478bd9Sstevel@tonic-gate /*
13337c478bd9Sstevel@tonic-gate  * Pcache data captured by get_pcache_dtag
13347c478bd9Sstevel@tonic-gate  */
13357c478bd9Sstevel@tonic-gate typedef struct ch_pc_data {
13367c478bd9Sstevel@tonic-gate 	uint64_t pc_logflag;	/* Flag indicates if data was logged */
13377c478bd9Sstevel@tonic-gate 	uint64_t pc_idx;	/* Pcache index */
13387c478bd9Sstevel@tonic-gate 	uint64_t pc_way;	/* Pcache way */
13397c478bd9Sstevel@tonic-gate 	uint64_t pc_status;	/* Pcache status data */
13407c478bd9Sstevel@tonic-gate 	uint64_t pc_tag;	/* Tag/Valid Fields */
13417c478bd9Sstevel@tonic-gate 	uint64_t pc_sntag;	/* Snoop Tag */
13427c478bd9Sstevel@tonic-gate 	uint64_t pc_data[CH_PC_DATA_REG_SIZE/sizeof (uint64_t)]; /* Data */
13437c478bd9Sstevel@tonic-gate } ch_pc_data_t;
13447c478bd9Sstevel@tonic-gate 
13457c478bd9Sstevel@tonic-gate /*
13467c478bd9Sstevel@tonic-gate  * CPU Error State
13477c478bd9Sstevel@tonic-gate  */
13487c478bd9Sstevel@tonic-gate typedef struct ch_cpu_errors {
13497c478bd9Sstevel@tonic-gate 	uint64_t afsr;		/* AFSR */
13507c478bd9Sstevel@tonic-gate 	uint64_t afar;		/* AFAR */
13517c478bd9Sstevel@tonic-gate 	/*
13527c478bd9Sstevel@tonic-gate 	 * The following registers don't exist on cheetah
13537c478bd9Sstevel@tonic-gate 	 */
13547c478bd9Sstevel@tonic-gate 	uint64_t shadow_afsr;	/* Shadow AFSR */
13557c478bd9Sstevel@tonic-gate 	uint64_t shadow_afar;	/* Shadow AFAR */
13567c478bd9Sstevel@tonic-gate 	uint64_t afsr_ext;	/* AFSR1_EXT */
13577c478bd9Sstevel@tonic-gate 	uint64_t shadow_afsr_ext;	/* AFSR2_EXT */
13587c478bd9Sstevel@tonic-gate 	uint64_t afar2;		/* AFAR2 - Serrano only */
13597c478bd9Sstevel@tonic-gate } ch_cpu_errors_t;
13607c478bd9Sstevel@tonic-gate 
13617c478bd9Sstevel@tonic-gate /*
13627c478bd9Sstevel@tonic-gate  * CPU logout structures.
13637c478bd9Sstevel@tonic-gate  * NOTE: These structures should be the same for Cheetah, Cheetah+,
13647c478bd9Sstevel@tonic-gate  *	 Jaguar, Panther, and Jalapeno since the assembler code relies
13657c478bd9Sstevel@tonic-gate  *	 on one set of offsets. Panther is the only processor that
13667c478bd9Sstevel@tonic-gate  *	 uses the chd_l2_data field since it has both L3 and L2 caches.
13677c478bd9Sstevel@tonic-gate  */
13687c478bd9Sstevel@tonic-gate typedef struct ch_diag_data {
13697c478bd9Sstevel@tonic-gate 	uint64_t chd_afar;				/* AFAR */
13707c478bd9Sstevel@tonic-gate 	uint64_t chd_afsr;				/* AFSR */
13717c478bd9Sstevel@tonic-gate 	uint64_t chd_afsr_ext;				/* AFSR_EXT */
13727c478bd9Sstevel@tonic-gate 	uint64_t chd_afar2;			/* AFAR2 - Serrano only */
13737c478bd9Sstevel@tonic-gate 	ch_ec_data_t chd_ec_data[CHD_EC_DATA_SETS];	/* Ecache data */
13747c478bd9Sstevel@tonic-gate 	ch_ec_data_t chd_l2_data[PN_L2_NWAYS];		/* L2 cache data */
13757c478bd9Sstevel@tonic-gate 	ch_dc_data_t chd_dc_data;			/* Dcache data */
13767c478bd9Sstevel@tonic-gate 	ch_ic_data_t chd_ic_data;			/* Icache data */
13777c478bd9Sstevel@tonic-gate } ch_diag_data_t;
13787c478bd9Sstevel@tonic-gate 
13797c478bd9Sstevel@tonic-gate 
13807c478bd9Sstevel@tonic-gate /*
13817c478bd9Sstevel@tonic-gate  * Top level CPU logout structure.
13827c478bd9Sstevel@tonic-gate  * clo_flags is used to hold information such as trap type, trap level,
13837c478bd9Sstevel@tonic-gate  * CEEN value, etc that is needed by the individual trap handlers. Not
13847c478bd9Sstevel@tonic-gate  * all fields in this flag are used by all trap handlers but when they
13857c478bd9Sstevel@tonic-gate  * are used, here's how they are laid out:
13867c478bd9Sstevel@tonic-gate  *
13877c478bd9Sstevel@tonic-gate  * |-------------------------------------------------------|
13887c478bd9Sstevel@tonic-gate  * |        | trap type | trap level |  |UCEEN| |NCEEN|CEEN|
13897c478bd9Sstevel@tonic-gate  * |-------------------------------------------------------|
13907c478bd9Sstevel@tonic-gate  *  63       19       12 11         8      3   2   1    0
13917c478bd9Sstevel@tonic-gate  *
13927c478bd9Sstevel@tonic-gate  * Note that the *CEEN bits correspond exactly to the same bit positions
13937c478bd9Sstevel@tonic-gate  * that are used in the error enable register.
13947c478bd9Sstevel@tonic-gate  */
13957c478bd9Sstevel@tonic-gate typedef struct ch_cpu_logout {
13967c478bd9Sstevel@tonic-gate 	uint64_t clo_flags;		/* Information about this trap */
13977c478bd9Sstevel@tonic-gate 	uint64_t clo_nest_cnt;		/* To force an upper bound */
13987c478bd9Sstevel@tonic-gate 	ch_diag_data_t clo_data;	/* Diag data for primary AFAR */
13997c478bd9Sstevel@tonic-gate 	ch_diag_data_t clo_sdw_data;	/* Diag data for shadow AFAR */
14007c478bd9Sstevel@tonic-gate } ch_cpu_logout_t;
14017c478bd9Sstevel@tonic-gate 
14027c478bd9Sstevel@tonic-gate typedef struct ch_tte_entry {
14037c478bd9Sstevel@tonic-gate 	uint64_t ch_tte_tag;
14047c478bd9Sstevel@tonic-gate 	uint64_t ch_tte_data;
14057c478bd9Sstevel@tonic-gate } ch_tte_entry_t;
14067c478bd9Sstevel@tonic-gate 
14077c478bd9Sstevel@tonic-gate /*
14087c478bd9Sstevel@tonic-gate  * Top level CPU logout structure for TLB parity errors.
14097c478bd9Sstevel@tonic-gate  *
14107c478bd9Sstevel@tonic-gate  * tlo_logflag  - Flag indicates if data was logged
14117c478bd9Sstevel@tonic-gate  * tlo_info	- Used to keep track of a number of values:
14127c478bd9Sstevel@tonic-gate  *   itlb pgsz	  - Page size of the VA whose lookup in the ITLB caused
14137c478bd9Sstevel@tonic-gate  *		    the exception (from ASI_IMMU_TAG_ACCESS_EXT.)
14147c478bd9Sstevel@tonic-gate  *   dtlb pgsz1	  - Page size of the VA whose lookup in the DTLB T512_1
14157c478bd9Sstevel@tonic-gate  *		    caused the exception (from ASI_DMMU_TAG_ACCESS_EXT.).
14167c478bd9Sstevel@tonic-gate  *   dtlb pgsz0	  - Page size of the VA whose lookup in the DTLB T512_0
14177c478bd9Sstevel@tonic-gate  *		    caused the exception (from ASI_DMMU_TAG_ACCESS_EXT.).
14187c478bd9Sstevel@tonic-gate  *   immu	  - Trap is the result of an ITLB exception if immu == 1.
14197c478bd9Sstevel@tonic-gate  *		    Otherwise, for DTLB exceptions immu == 0.
14207c478bd9Sstevel@tonic-gate  *   tl1	  - Set to 1 if the exception occured at TL>0.
14217c478bd9Sstevel@tonic-gate  *   context	  - Context of the VA whose lookup in the TLB caused the
14227c478bd9Sstevel@tonic-gate  *		    exception (from ASI_[I|D]MMU_TAG_ACCESS.)
14237c478bd9Sstevel@tonic-gate  * |---------------------------------------------------------------------|
14247c478bd9Sstevel@tonic-gate  * |...| itlb pgsz  | dtlb pgsz1 | dtlb pgsz0 |...| immu | tl1 | context |
14257c478bd9Sstevel@tonic-gate  * |---------------------------------------------------------------------|
14267c478bd9Sstevel@tonic-gate  *      24        22 21        19 18        16       14    13   12      0
14277c478bd9Sstevel@tonic-gate  *
14287c478bd9Sstevel@tonic-gate  * tlo_addr	- VA that cause the MMU exception trap.
14297c478bd9Sstevel@tonic-gate  * tlo_pc	- PC where the exception occured.
14307c478bd9Sstevel@tonic-gate  * tlo_itlb_tte	- TTEs that were in the ITLB after the trap at the index
14317c478bd9Sstevel@tonic-gate  *		  specific to the VA and page size in question.
14327c478bd9Sstevel@tonic-gate  * tlo_dtlb_tte	- TTEs that were in the DTLB after the trap at the index
14337c478bd9Sstevel@tonic-gate  *		  specific to the VA and page size in question.
14347c478bd9Sstevel@tonic-gate  */
14357c478bd9Sstevel@tonic-gate typedef struct pn_tlb_logout {
14367c478bd9Sstevel@tonic-gate 	uint64_t tlo_logflag;
14377c478bd9Sstevel@tonic-gate 	uint64_t tlo_info;
14387c478bd9Sstevel@tonic-gate 	uint64_t tlo_addr;
14397c478bd9Sstevel@tonic-gate 	uint64_t tlo_pc;
14407c478bd9Sstevel@tonic-gate 	ch_tte_entry_t tlo_itlb_tte[PN_ITLB_NWAYS * PN_NUM_512_ITLBS];
14417c478bd9Sstevel@tonic-gate 	ch_tte_entry_t tlo_dtlb_tte[PN_DTLB_NWAYS * PN_NUM_512_DTLBS];
14427c478bd9Sstevel@tonic-gate } pn_tlb_logout_t;
14437c478bd9Sstevel@tonic-gate 
14447c478bd9Sstevel@tonic-gate #if defined(CPU_IMP_L1_CACHE_PARITY)
14457c478bd9Sstevel@tonic-gate /*
14467c478bd9Sstevel@tonic-gate  * Parity error logging structure.
14477c478bd9Sstevel@tonic-gate  */
14487c478bd9Sstevel@tonic-gate typedef union ch_l1_parity_log {
14497c478bd9Sstevel@tonic-gate 	struct {
14507c478bd9Sstevel@tonic-gate 		int cpl_way;				/* Faulty line way */
14517c478bd9Sstevel@tonic-gate 		int cpl_off;				/* Faulty line offset */
14527c478bd9Sstevel@tonic-gate 		int cpl_tag;				/* Faulty tags list */
14537c478bd9Sstevel@tonic-gate 		int cpl_lcnt;				/* Faulty cache lines */
14547c478bd9Sstevel@tonic-gate 		ch_dc_data_t cpl_dc[CH_DCACHE_NWAY];	/* D$ data nWays */
14557c478bd9Sstevel@tonic-gate 		ch_pc_data_t cpl_pc[CH_PCACHE_NWAY];	/* P$ data nWays */
14567c478bd9Sstevel@tonic-gate 		int cpl_cache;				/* error in D$ or P$? */
14577c478bd9Sstevel@tonic-gate 	} dpe;	/* D$ parity error */
14587c478bd9Sstevel@tonic-gate 	struct {
14597c478bd9Sstevel@tonic-gate 		int cpl_way;				/* Faulty line way */
14607c478bd9Sstevel@tonic-gate 		int cpl_off;				/* Faulty line offset */
14617c478bd9Sstevel@tonic-gate 		int cpl_tag;				/* Faulty tags list */
14627c478bd9Sstevel@tonic-gate 		int cpl_lcnt;				/* Faulty cache lines */
14637c478bd9Sstevel@tonic-gate 		ch_ic_data_t cpl_ic[CH_ICACHE_NWAY];	/* I$ data nWays */
14647c478bd9Sstevel@tonic-gate 	} ipe;	/* I$ parity error */
14657c478bd9Sstevel@tonic-gate } ch_l1_parity_log_t;
14667c478bd9Sstevel@tonic-gate 
14677c478bd9Sstevel@tonic-gate #endif	/* CPU_IMP_L1_CACHE_PARITY */
14687c478bd9Sstevel@tonic-gate 
14697c478bd9Sstevel@tonic-gate /*
14707c478bd9Sstevel@tonic-gate  * Error at TL>0 CPU logout data.
14717c478bd9Sstevel@tonic-gate  *   Needs some extra space to save %g registers and miscellaneous info.
14727c478bd9Sstevel@tonic-gate  */
14737c478bd9Sstevel@tonic-gate typedef struct ch_err_tl1_data {
14747c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g1;		/* Saved %g1 */
14757c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g2;		/* Saved %g2 */
14767c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g3;		/* Saved %g3 */
14777c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g4;		/* Saved %g4 */
14787c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g5;		/* Saved %g5 */
14797c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g6;		/* Saved %g6 */
14807c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_g7;		/* Saved %g7 */
14817c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_tpc;	/* Trap PC */
14827c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_flags;	/* miscellaneous flags */
14837c478bd9Sstevel@tonic-gate 	uint64_t ch_err_tl1_tmp;	/* some handlers may use as tmp */
14847c478bd9Sstevel@tonic-gate 	ch_cpu_logout_t ch_err_tl1_logout;	/* logout */
14857c478bd9Sstevel@tonic-gate } ch_err_tl1_data_t;
14867c478bd9Sstevel@tonic-gate 
14877c478bd9Sstevel@tonic-gate /* Indices into chsm_outstanding and friends */
14887c478bd9Sstevel@tonic-gate #define	CACHE_SCRUBBER_INFO_E	0
14897c478bd9Sstevel@tonic-gate #define	CACHE_SCRUBBER_INFO_D	1
14907c478bd9Sstevel@tonic-gate #define	CACHE_SCRUBBER_INFO_I	2
14917c478bd9Sstevel@tonic-gate 
14927c478bd9Sstevel@tonic-gate /* We define 3 scrubbers: E$, D$, and I$ */
14937c478bd9Sstevel@tonic-gate #define	CACHE_SCRUBBER_COUNT	3
14947c478bd9Sstevel@tonic-gate 
14957c478bd9Sstevel@tonic-gate /*
14967c478bd9Sstevel@tonic-gate  * The ch_scrub_misc structure contains miscellaneous bookkeeping
14977c478bd9Sstevel@tonic-gate  * items for scrubbing the I$, D$, and E$.
14987c478bd9Sstevel@tonic-gate  *
14997c478bd9Sstevel@tonic-gate  * For a description of the use of chsm_core_state and why it's not needed
15007c478bd9Sstevel@tonic-gate  * on Jaguar, see the comment above cpu_scrub_cpu_setup() in us3_cheetahplus.c.
15017c478bd9Sstevel@tonic-gate  */
15027c478bd9Sstevel@tonic-gate typedef struct ch_scrub_misc {
15037c478bd9Sstevel@tonic-gate 	uint32_t	chsm_outstanding[CACHE_SCRUBBER_COUNT];
15047c478bd9Sstevel@tonic-gate 						/* outstanding requests */
15057c478bd9Sstevel@tonic-gate 	int		chsm_flush_index[CACHE_SCRUBBER_COUNT];
15067c478bd9Sstevel@tonic-gate 						/* next line to flush */
15077c478bd9Sstevel@tonic-gate 	int		chsm_enable[CACHE_SCRUBBER_COUNT];
15087c478bd9Sstevel@tonic-gate 				/* is this scrubber enabled on this core? */
15097c478bd9Sstevel@tonic-gate 	int		chsm_ecache_nlines;	/* no. of E$ lines */
15107c478bd9Sstevel@tonic-gate 	int		chsm_ecache_busy;	/* keeps track if cpu busy */
15117c478bd9Sstevel@tonic-gate 	int		chsm_icache_nlines;	/* no. of I$ lines */
15127c478bd9Sstevel@tonic-gate 	int		chsm_core_state;	/* which core the scrubber is */
15137c478bd9Sstevel@tonic-gate 						/* running on (Panther only) */
15147c478bd9Sstevel@tonic-gate } ch_scrub_misc_t;
15157c478bd9Sstevel@tonic-gate 
15167c478bd9Sstevel@tonic-gate /*
15177c478bd9Sstevel@tonic-gate  * Cheetah module private data structure.  One of these is allocated for
15187c478bd9Sstevel@tonic-gate  * each valid cpu at setup time and is pointed to by the machcpu
15197c478bd9Sstevel@tonic-gate  * "cpu_private" pointer.  For Cheetah, we have the miscellaneous scrubber
15207c478bd9Sstevel@tonic-gate  * variables and cpu log out structures for Fast ECC traps at TL=0,
15217c478bd9Sstevel@tonic-gate  * Disrupting (correctable) traps and Deferred (asynchronous) traps.  For
15227c478bd9Sstevel@tonic-gate  * Disrupting traps only one log out structure is needed because we cannot
15237c478bd9Sstevel@tonic-gate  * get a TL>0 disrupting trap since it obeys IE.  For Deferred traps we
15247c478bd9Sstevel@tonic-gate  * cannot get a TL>0 because we turn off NCEEN during log out capture.  E$
15257c478bd9Sstevel@tonic-gate  * set size (E$ size / nways) is saved here to avoid repeated calculations.
15267c478bd9Sstevel@tonic-gate  * NB: The ch_err_tl1_data_t structures cannot cross a page boundary
15277c478bd9Sstevel@tonic-gate  *      because we use physical addresses to access them.  We ensure this
15287c478bd9Sstevel@tonic-gate  *      by allocating them near the front of cheetah_private_t, which is
15297c478bd9Sstevel@tonic-gate  *      aligned on PAGESIZE (8192) via kmem_cache_create, and by ASSERTing
15307c478bd9Sstevel@tonic-gate  *	sizeof (chpr_tl1_err_data) <= CH_ECACHE_MAX_LSIZE in the
15317c478bd9Sstevel@tonic-gate  *	cpu_init_private routines.
15327c478bd9Sstevel@tonic-gate  * NB:  chpr_icache_size and chpr_icache_linesize need to be at the front
15337c478bd9Sstevel@tonic-gate  *	of cheetah_private_t because putting them after chpr_tl1_err_data
15347c478bd9Sstevel@tonic-gate  *	would make their offsets > 4195.
15357c478bd9Sstevel@tonic-gate  */
15367c478bd9Sstevel@tonic-gate typedef struct cheetah_private {
15377c478bd9Sstevel@tonic-gate 	int			chpr_icache_size;
15387c478bd9Sstevel@tonic-gate 	int			chpr_icache_linesize;
15397c478bd9Sstevel@tonic-gate 	ch_err_tl1_data_t	chpr_tl1_err_data[CH_ERR_TL1_TLMAX];
15407c478bd9Sstevel@tonic-gate 	ch_scrub_misc_t		chpr_scrub_misc;
15417c478bd9Sstevel@tonic-gate 	int			chpr_ec_set_size;
15427c478bd9Sstevel@tonic-gate 	ch_cpu_logout_t		chpr_fecctl0_logout;
15437c478bd9Sstevel@tonic-gate 	ch_cpu_logout_t		chpr_cecc_logout;
15447c478bd9Sstevel@tonic-gate 	ch_cpu_logout_t		chpr_async_logout;
15457c478bd9Sstevel@tonic-gate 	pn_tlb_logout_t		chpr_tlb_logout;
15467c478bd9Sstevel@tonic-gate 	uint64_t		chpr_fpras_timestamp[FPRAS_NCOPYOPS];
15477c478bd9Sstevel@tonic-gate 	hrtime_t		chpr_ceptnr_seltime;
15487c478bd9Sstevel@tonic-gate 	int			chpr_ceptnr_id;
15497c478bd9Sstevel@tonic-gate } cheetah_private_t;
15507c478bd9Sstevel@tonic-gate 
15517c478bd9Sstevel@tonic-gate #endif /* _ASM */
15527c478bd9Sstevel@tonic-gate 
15537c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
15547c478bd9Sstevel@tonic-gate 
15557c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
15567c478bd9Sstevel@tonic-gate }
15577c478bd9Sstevel@tonic-gate #endif
15587c478bd9Sstevel@tonic-gate 
15597c478bd9Sstevel@tonic-gate #endif	/* _SYS_CHEETAHREGS_H */
1560