xref: /onnv-gate/usr/src/uts/sun4u/sys/us3_module.h (revision 8803:8c01b39012c9)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
52381Smikechr  * Common Development and Distribution License (the "License").
62381Smikechr  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*8803SJonathan.Haslam@Sun.COM  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_US3_MODULE_H
270Sstevel@tonic-gate #define	_SYS_US3_MODULE_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #include <sys/async.h>
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #ifdef _KERNEL
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * Macros to access the "cheetah cpu private" data structure.
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate #define	CPU_PRIVATE_PTR(cp, x)	(&(((cheetah_private_t *)CPU_PRIVATE(cp))->x))
410Sstevel@tonic-gate #define	CPU_PRIVATE_VAL(cp, x)	(((cheetah_private_t *)CPU_PRIVATE(cp))->x)
420Sstevel@tonic-gate 
430Sstevel@tonic-gate #define	CHP_WORD_TO_OFF(word, off)	(((word) * 8) == off)
440Sstevel@tonic-gate 
450Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
460Sstevel@tonic-gate /* JP J_REQ errors */
470Sstevel@tonic-gate #define	C_AFSR_JREQ_ERRS	(C_AFSR_RUE | C_AFSR_BP | C_AFSR_WBP | \
480Sstevel@tonic-gate 			C_AFSR_RCE | C_AFSR_TO | C_AFSR_BERR | C_AFSR_UMS)
490Sstevel@tonic-gate /* JP AID errors */
500Sstevel@tonic-gate #define	C_AFSR_AID_ERRS		(C_AFSR_CPU | C_AFSR_FRU | C_AFSR_CPC | \
510Sstevel@tonic-gate 			C_AFSR_FRC)
520Sstevel@tonic-gate 
530Sstevel@tonic-gate #if defined(SERRANO)
540Sstevel@tonic-gate /* SERRANO AFSR bits from Disrupting (Corrected) ECC error Trap (Trap 0x63) */
550Sstevel@tonic-gate #define	C_AFSR_CECC_ERRS	(C_AFSR_UMS | C_AFSR_IVPE | C_AFSR_CPC | \
560Sstevel@tonic-gate 			C_AFSR_CPU | C_AFSR_WDC | C_AFSR_WDU | C_AFSR_EDC | \
570Sstevel@tonic-gate 			C_AFSR_CE | C_AFSR_RCE | C_AFSR_WBP | C_AFSR_FRC | \
580Sstevel@tonic-gate 			C_AFSR_FRU | C_AFSR_EDU | C_AFSR_ETI | C_AFSR_ETC)
590Sstevel@tonic-gate 
600Sstevel@tonic-gate #else /* SERRANO */
610Sstevel@tonic-gate /* JP AFSR bits from Disrupting (Corrected) ECC error Trap (Trap 0x63) */
620Sstevel@tonic-gate #define	C_AFSR_CECC_ERRS	(C_AFSR_UMS | C_AFSR_IVPE | C_AFSR_CPC | \
630Sstevel@tonic-gate 			C_AFSR_CPU | C_AFSR_WDC | C_AFSR_WDU | C_AFSR_EDC | \
640Sstevel@tonic-gate 			C_AFSR_CE | C_AFSR_RCE | C_AFSR_WBP | C_AFSR_FRC | \
650Sstevel@tonic-gate 			C_AFSR_FRU | C_AFSR_EDU)
660Sstevel@tonic-gate #endif /* SERRANO */
670Sstevel@tonic-gate 
680Sstevel@tonic-gate #if defined(SERRANO)
690Sstevel@tonic-gate /*
700Sstevel@tonic-gate  * SERRANO AFSR bits from {Instruction,Data}_access_error traps
710Sstevel@tonic-gate  * (Traps 0xa, 0x32)
720Sstevel@tonic-gate  */
730Sstevel@tonic-gate #define	C_AFSR_ASYNC_ERRS	(C_AFSR_OM | C_AFSR_TO | C_AFSR_BERR | \
740Sstevel@tonic-gate 			C_AFSR_UE | C_AFSR_RUE | C_AFSR_EDU | C_AFSR_BP | \
750Sstevel@tonic-gate 			C_AFSR_ETU | C_AFSR_ETS)
760Sstevel@tonic-gate #else /* SERRANO */
770Sstevel@tonic-gate /* JP AFSR bits from {Instruction,Data}_access_error traps (Traps 0xa, 0x32) */
780Sstevel@tonic-gate #define	C_AFSR_ASYNC_ERRS	(C_AFSR_OM | C_AFSR_TO | C_AFSR_BERR | \
790Sstevel@tonic-gate 			C_AFSR_UE | C_AFSR_RUE | C_AFSR_EDU | C_AFSR_BP)
800Sstevel@tonic-gate #endif /* SERRANO */
810Sstevel@tonic-gate 
820Sstevel@tonic-gate #if defined(SERRANO)
830Sstevel@tonic-gate /* SERRANO AFSR bits from Fast_ECC_error trap (Trap 0x70) */
840Sstevel@tonic-gate #define	C_AFSR_FECC_ERRS	(C_AFSR_UCU | C_AFSR_UCC | C_AFSR_ETI | \
850Sstevel@tonic-gate 				C_AFSR_ETC)
860Sstevel@tonic-gate 
870Sstevel@tonic-gate #else /* SERRANO */
880Sstevel@tonic-gate /* JP AFSR bits from Fast_ECC_error trap (Trap 0x70) */
890Sstevel@tonic-gate #define	C_AFSR_FECC_ERRS	(C_AFSR_UCU | C_AFSR_UCC)
900Sstevel@tonic-gate #endif /* SERRANO */
910Sstevel@tonic-gate 
920Sstevel@tonic-gate #if defined(SERRANO)
930Sstevel@tonic-gate /* SERRANO AFSR bits from Fatal errors (processor asserts ERROR pin) */
940Sstevel@tonic-gate #define	C_AFSR_FATAL_ERRS	(C_AFSR_JETO | C_AFSR_SCE | C_AFSR_JEIC | \
950Sstevel@tonic-gate 			C_AFSR_JEIT | C_AFSR_JEIS | C_AFSR_IERR | \
960Sstevel@tonic-gate 			C_AFSR_ISAP | C_AFSR_EFES | C_AFSR_ETS | C_AFSR_ETU)
970Sstevel@tonic-gate 
980Sstevel@tonic-gate #else /* SERRANO */
990Sstevel@tonic-gate /* JP AFSR bits from Fatal errors (processor asserts ERROR pin) */
1000Sstevel@tonic-gate #define	C_AFSR_FATAL_ERRS	(C_AFSR_JETO | C_AFSR_SCE | C_AFSR_JEIC | \
1010Sstevel@tonic-gate 			C_AFSR_JEIT | C_AFSR_JEIS | C_AFSR_IERR | \
1020Sstevel@tonic-gate 			C_AFSR_ISAP | C_AFSR_ETP)
1030Sstevel@tonic-gate #endif /* SERRANO */
1040Sstevel@tonic-gate 
1050Sstevel@tonic-gate /* JP AFSR all valid error status bits */
1060Sstevel@tonic-gate #define	C_AFSR_ALL_ERRS	(C_AFSR_FATAL_ERRS | C_AFSR_FECC_ERRS | \
1070Sstevel@tonic-gate 			C_AFSR_CECC_ERRS | C_AFSR_ASYNC_ERRS | C_AFSR_ME)
1080Sstevel@tonic-gate 
1090Sstevel@tonic-gate #if defined(SERRANO)
1100Sstevel@tonic-gate /* SERRANO AFSR all ME status bits */
1110Sstevel@tonic-gate #define	C_AFSR_ALL_ME_ERRS	(C_AFSR_ISAP | C_AFSR_UE | C_AFSR_UCU | \
1120Sstevel@tonic-gate 			C_AFSR_EDU | C_AFSR_WDU | C_AFSR_CPU | C_AFSR_UCC | \
1130Sstevel@tonic-gate 			C_AFSR_BERR | C_AFSR_TO | C_AFSR_ETU | C_AFSR_OM | \
1140Sstevel@tonic-gate 			C_AFSR_UMS | C_AFSR_IVPE | C_AFSR_RUE | C_AFSR_BP | \
1150Sstevel@tonic-gate 			C_AFSR_WBP | C_AFSR_FRU | C_AFSR_JETO | C_AFSR_SCE | \
1160Sstevel@tonic-gate 			C_AFSR_JEIC | C_AFSR_JEIT | C_AFSR_JEIS | \
1170Sstevel@tonic-gate 			C_AFSR_ETC | C_AFSR_ETI)
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate #else /* SERRANO */
1200Sstevel@tonic-gate /* JP AFSR all ME status bits */
1210Sstevel@tonic-gate #define	C_AFSR_ALL_ME_ERRS	(C_AFSR_ISAP | C_AFSR_UE | C_AFSR_UCU | \
1220Sstevel@tonic-gate 			C_AFSR_EDU | C_AFSR_WDU | C_AFSR_CPU | C_AFSR_UCC | \
1230Sstevel@tonic-gate 			C_AFSR_BERR | C_AFSR_TO | C_AFSR_ETP | C_AFSR_OM | \
1240Sstevel@tonic-gate 			C_AFSR_UMS | C_AFSR_IVPE | C_AFSR_RUE | C_AFSR_BP | \
1250Sstevel@tonic-gate 			C_AFSR_WBP | C_AFSR_FRU | C_AFSR_JETO | C_AFSR_SCE | \
1260Sstevel@tonic-gate 			C_AFSR_JEIC | C_AFSR_JEIT | C_AFSR_JEIS)
1270Sstevel@tonic-gate #endif /* SERRANO */
1280Sstevel@tonic-gate 
1290Sstevel@tonic-gate /* JP AFSR bits due to a Memory error */
1300Sstevel@tonic-gate #define	C_AFSR_MEMORY	(C_AFSR_UE | C_AFSR_CE | C_AFSR_FRC | C_AFSR_FRU |\
1310Sstevel@tonic-gate 			C_AFSR_RCE | C_AFSR_RUE)
1320Sstevel@tonic-gate 
1330Sstevel@tonic-gate /* JP AFSR bits due to parity errors and have a valid BSYND */
1340Sstevel@tonic-gate #define	C_AFSR_MSYND_ERRS	(C_AFSR_IVPE | C_AFSR_BP | C_AFSR_WBP)
1350Sstevel@tonic-gate 
1360Sstevel@tonic-gate /* JP AFSR bits with a valid ESYND field */
1370Sstevel@tonic-gate #define	C_AFSR_ESYND_ERRS	(C_AFSR_UE | C_AFSR_CE | \
1380Sstevel@tonic-gate 			C_AFSR_UCU | C_AFSR_UCC | C_AFSR_EDU | C_AFSR_EDC | \
1390Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | C_AFSR_CPC | \
1400Sstevel@tonic-gate 			C_AFSR_FRC | C_AFSR_FRU)
1410Sstevel@tonic-gate 
1420Sstevel@tonic-gate /* JP AFSR error bits for AFT Level 1 messages (uncorrected + TO + BERR) */
1430Sstevel@tonic-gate #define	C_AFSR_LEVEL1	(C_AFSR_UE | C_AFSR_RUE | C_AFSR_UCU | C_AFSR_EDU | \
1440Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_CPU | C_AFSR_IVPE | C_AFSR_TO | \
1450Sstevel@tonic-gate 			C_AFSR_BERR | C_AFSR_UMS | C_AFSR_OM | C_AFSR_WBP | \
1460Sstevel@tonic-gate 			C_AFSR_FRU | C_AFSR_BP)
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate #elif defined(CHEETAH_PLUS)
1490Sstevel@tonic-gate 
1500Sstevel@tonic-gate /* Ch+ AFSR bits from Disrupting (Corrected) ECC error Trap (Trap 0x63) */
1510Sstevel@tonic-gate #define	C_AFSR_CECC_ERRS	(C_AFSR_CE | C_AFSR_EMC | C_AFSR_EDU | \
1520Sstevel@tonic-gate 			C_AFSR_EDC | C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | \
1530Sstevel@tonic-gate 			C_AFSR_CPC | C_AFSR_IVU | C_AFSR_IVC | C_AFSR_DUE | \
1540Sstevel@tonic-gate 			C_AFSR_THCE | C_AFSR_DBERR | C_AFSR_DTO | C_AFSR_IMU | \
1550Sstevel@tonic-gate 			C_AFSR_IMC)
1560Sstevel@tonic-gate 
1570Sstevel@tonic-gate /* Ch+ AFSR bits from {Instruction,Data}_access_error traps (Traps 0xa, 0x32) */
1580Sstevel@tonic-gate #define	C_AFSR_ASYNC_ERRS	(C_AFSR_UE | C_AFSR_EMU | C_AFSR_EDU | \
1590Sstevel@tonic-gate 			C_AFSR_TO | C_AFSR_BERR)
1600Sstevel@tonic-gate 
1610Sstevel@tonic-gate /* Ch+ AFSR bits from Fast_ECC_error trap (Trap 0x70) */
1620Sstevel@tonic-gate #define	C_AFSR_FECC_ERRS	(C_AFSR_UCU | C_AFSR_UCC | C_AFSR_TSCE)
1630Sstevel@tonic-gate 
1640Sstevel@tonic-gate /* Ch+ AFSR bits from Fatal errors (processor asserts ERROR pin) */
1650Sstevel@tonic-gate #define	C_AFSR_FATAL_ERRS	(C_AFSR_PERR | C_AFSR_IERR | C_AFSR_ISAP | \
1660Sstevel@tonic-gate 			C_AFSR_TUE | C_AFSR_TUE_SH | C_AFSR_IMU | C_AFSR_EMU)
1670Sstevel@tonic-gate 
1680Sstevel@tonic-gate /* Ch+ AFSR all valid error status bits */
1690Sstevel@tonic-gate #define	C_AFSR_ALL_ERRS	(C_AFSR_FATAL_ERRS | C_AFSR_FECC_ERRS | \
1700Sstevel@tonic-gate 			C_AFSR_CECC_ERRS | C_AFSR_ASYNC_ERRS | C_AFSR_ME)
1710Sstevel@tonic-gate 
1720Sstevel@tonic-gate /* Ch+ AFSR all errors that set ME bit, in both AFSR and AFSR_EXT */
1730Sstevel@tonic-gate #define	C_AFSR_ALL_ME_ERRS	(C_AFSR_TUE_SH | C_AFSR_IMU | C_AFSR_DTO | \
1740Sstevel@tonic-gate 			C_AFSR_DBERR | C_AFSR_TSCE | C_AFSR_TUE | C_AFSR_DUE | \
1750Sstevel@tonic-gate 			C_AFSR_ISAP | C_AFSR_EMU | C_AFSR_IVU | C_AFSR_TO | \
1760Sstevel@tonic-gate 			C_AFSR_BERR | C_AFSR_UCC | C_AFSR_UCU | C_AFSR_CPU | \
1770Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_EDU | C_AFSR_UE | \
1780Sstevel@tonic-gate 			C_AFSR_L3_TUE_SH | C_AFSR_L3_TUE | C_AFSR_L3_EDU | \
1790Sstevel@tonic-gate 			C_AFSR_L3_UCC | C_AFSR_L3_UCU | C_AFSR_L3_CPU | \
1800Sstevel@tonic-gate 			C_AFSR_L3_WDU)
1810Sstevel@tonic-gate 
1822381Smikechr /* Ch+ AFSR bits due to an Ecache data error */
1832381Smikechr #define	C_AFSR_EC_DATA_ERRS	(C_AFSR_UCU | C_AFSR_UCC | C_AFSR_EDU | \
1842381Smikechr 			C_AFSR_EDC | C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | \
1852381Smikechr 			C_AFSR_CPC)
1860Sstevel@tonic-gate 
1870Sstevel@tonic-gate /* Ch+ AFSR bits due to a Memory error */
1880Sstevel@tonic-gate #define	C_AFSR_MEMORY	(C_AFSR_UE | C_AFSR_CE | C_AFSR_EMU | C_AFSR_EMC | \
1890Sstevel@tonic-gate 			C_AFSR_DUE)
1900Sstevel@tonic-gate 
1910Sstevel@tonic-gate /* Ch+ AFSR bits due to an Mtag error and have a valid MSYND */
1920Sstevel@tonic-gate #define	C_AFSR_MSYND_ERRS	(C_AFSR_EMU | C_AFSR_EMC | C_AFSR_IMU | \
1930Sstevel@tonic-gate 			C_AFSR_IMC)
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate /* Ch+ AFSR bits with a valid ESYND field */
1960Sstevel@tonic-gate #define	C_AFSR_ESYND_ERRS	(C_AFSR_UE | C_AFSR_CE | \
1970Sstevel@tonic-gate 			C_AFSR_UCU | C_AFSR_UCC | C_AFSR_EDU | C_AFSR_EDC | \
1980Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | C_AFSR_CPC | \
1990Sstevel@tonic-gate 			C_AFSR_IVU | C_AFSR_IVC | C_AFSR_DUE)
2000Sstevel@tonic-gate 
2010Sstevel@tonic-gate /* Ch+ AFSR error bits for AFT Level 1 messages (uncorrected + TO + BERR) */
2020Sstevel@tonic-gate #define	C_AFSR_LEVEL1	(C_AFSR_UE | C_AFSR_UCU | C_AFSR_EMU | C_AFSR_EDU | \
2030Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_CPU | C_AFSR_IVU | C_AFSR_TO | \
2040Sstevel@tonic-gate 			C_AFSR_BERR | C_AFSR_DUE | C_AFSR_TUE | C_AFSR_DTO | \
2050Sstevel@tonic-gate 			C_AFSR_DBERR | C_AFSR_TUE_SH | C_AFSR_IMU)
2060Sstevel@tonic-gate 
2070Sstevel@tonic-gate #else	/* CHEETAH_PLUS */
2080Sstevel@tonic-gate 
2090Sstevel@tonic-gate /* AFSR bits from Disrupting (Corrected) ECC error Trap (Trap 0x63) */
2100Sstevel@tonic-gate #define	C_AFSR_CECC_ERRS	(C_AFSR_CE | C_AFSR_EMC | C_AFSR_EDU | \
2110Sstevel@tonic-gate 			C_AFSR_EDC | C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | \
2120Sstevel@tonic-gate 			C_AFSR_CPC | C_AFSR_IVU | C_AFSR_IVC)
2130Sstevel@tonic-gate 
2140Sstevel@tonic-gate /* AFSR bits from {Instruction,Data}_access_error traps (Traps 0xa, 0x32) */
2150Sstevel@tonic-gate #define	C_AFSR_ASYNC_ERRS	(C_AFSR_UE | C_AFSR_EMU | C_AFSR_EDU | \
2160Sstevel@tonic-gate 			C_AFSR_TO | C_AFSR_BERR)
2170Sstevel@tonic-gate 
2180Sstevel@tonic-gate /* AFSR bits from Fast_ECC_error trap (Trap 0x70) */
2190Sstevel@tonic-gate #define	C_AFSR_FECC_ERRS	(C_AFSR_UCU | C_AFSR_UCC)
2200Sstevel@tonic-gate 
2210Sstevel@tonic-gate /* AFSR bits from Fatal errors (processor asserts ERROR pin) */
2220Sstevel@tonic-gate #define	C_AFSR_FATAL_ERRS	(C_AFSR_PERR | C_AFSR_IERR | C_AFSR_ISAP | \
2230Sstevel@tonic-gate 			C_AFSR_EMU)
2240Sstevel@tonic-gate 
2250Sstevel@tonic-gate /* AFSR all valid error status bits */
2260Sstevel@tonic-gate #define	C_AFSR_ALL_ERRS	(C_AFSR_FATAL_ERRS | C_AFSR_FECC_ERRS | \
2270Sstevel@tonic-gate 			C_AFSR_CECC_ERRS | C_AFSR_ASYNC_ERRS | C_AFSR_ME)
2280Sstevel@tonic-gate 
2290Sstevel@tonic-gate /* AFSR all ME status bits */
2300Sstevel@tonic-gate #define	C_AFSR_ALL_ME_ERRS	(C_AFSR_ISAP | C_AFSR_UE | C_AFSR_IVU | \
2310Sstevel@tonic-gate 			C_AFSR_EMU | C_AFSR_UCU | C_AFSR_EDU | C_AFSR_WDU | \
2320Sstevel@tonic-gate 			C_AFSR_CPU | C_AFSR_UCC | C_AFSR_BERR | C_AFSR_TO)
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate /* AFSR bits due to an Ecache error */
2352381Smikechr #define	C_AFSR_EC_DATA_ERRS	(C_AFSR_UCU | C_AFSR_UCC | C_AFSR_EDU | \
2362381Smikechr 			C_AFSR_EDC | C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | \
2372381Smikechr 			C_AFSR_CPC)
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate /* AFSR bits due to a Memory error */
2400Sstevel@tonic-gate #define	C_AFSR_MEMORY	(C_AFSR_UE | C_AFSR_CE | C_AFSR_EMU | C_AFSR_EMC)
2410Sstevel@tonic-gate 
2420Sstevel@tonic-gate /* AFSR bits due to an Mtag error and have a valid MSYND */
2430Sstevel@tonic-gate #define	C_AFSR_MSYND_ERRS	(C_AFSR_EMU | C_AFSR_EMC)
2440Sstevel@tonic-gate 
2450Sstevel@tonic-gate /* AFSR bits with a valid ESYND field */
2460Sstevel@tonic-gate #define	C_AFSR_ESYND_ERRS	(C_AFSR_UE | C_AFSR_CE | \
2470Sstevel@tonic-gate 			C_AFSR_UCU | C_AFSR_UCC | C_AFSR_EDU | C_AFSR_EDC | \
2480Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_WDC | C_AFSR_CPU | C_AFSR_CPC | \
2490Sstevel@tonic-gate 			C_AFSR_IVU | C_AFSR_IVC)
2500Sstevel@tonic-gate 
2510Sstevel@tonic-gate /* AFSR error bits for AFT Level 1 messages (uncorrected + TO + BERR) */
2520Sstevel@tonic-gate #define	C_AFSR_LEVEL1	(C_AFSR_UE | C_AFSR_UCU | C_AFSR_EMU | C_AFSR_EDU | \
2530Sstevel@tonic-gate 			C_AFSR_WDU | C_AFSR_CPU | C_AFSR_IVU | C_AFSR_TO | \
2540Sstevel@tonic-gate 			C_AFSR_BERR)
2550Sstevel@tonic-gate 
2560Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
2570Sstevel@tonic-gate 
2580Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
2590Sstevel@tonic-gate /* AFSR all valid bits (except for ETW) */
2600Sstevel@tonic-gate #define	C_AFSR_MASK	(C_AFSR_ALL_ERRS | C_AFSR_PRIV | C_AFSR_B_SYND | \
2610Sstevel@tonic-gate 			C_AFSR_E_SYND | C_AFSR_AID | C_AFSR_JREQ)
2620Sstevel@tonic-gate #else /* JALAPENO || SERRANO */
2630Sstevel@tonic-gate /* AFSR all valid bits */
2640Sstevel@tonic-gate #define	C_AFSR_MASK	(C_AFSR_ALL_ERRS | C_AFSR_PRIV | C_AFSR_M_SYND | \
2650Sstevel@tonic-gate 			C_AFSR_E_SYND)
2660Sstevel@tonic-gate #endif /* JALAPENO || SERRANO */
2670Sstevel@tonic-gate 
2680Sstevel@tonic-gate /*
2690Sstevel@tonic-gate  * Panther AFSR_EXT bits from Disrupting (Corrected) ECC error Trap
2700Sstevel@tonic-gate  * (Trap 0x63)
2710Sstevel@tonic-gate  */
2720Sstevel@tonic-gate #define	C_AFSR_EXT_CECC_ERRS	(C_AFSR_L3_EDU | C_AFSR_L3_EDC | \
2730Sstevel@tonic-gate 			C_AFSR_L3_WDU | C_AFSR_L3_WDC | C_AFSR_L3_CPU | \
2740Sstevel@tonic-gate 			C_AFSR_L3_CPC | C_AFSR_L3_THCE)
2750Sstevel@tonic-gate 
2760Sstevel@tonic-gate /*
2770Sstevel@tonic-gate  * Panther AFSR_EXT bits from {Instruction,Data}_access_error traps
2780Sstevel@tonic-gate  * (Traps 0xa, 0x32)
2790Sstevel@tonic-gate  */
2800Sstevel@tonic-gate #define	C_AFSR_EXT_ASYNC_ERRS	(C_AFSR_L3_EDU)
2810Sstevel@tonic-gate 
2820Sstevel@tonic-gate /* Panther AFSR_EXT bits from Fast_ECC_error trap (Trap 0x70) */
2830Sstevel@tonic-gate #define	C_AFSR_EXT_FECC_ERRS	(C_AFSR_L3_UCU | C_AFSR_L3_UCC)
2840Sstevel@tonic-gate 
2850Sstevel@tonic-gate /* Panther AFSR_EXT bits from Fatal errors (processor asserts ERROR pin) */
2860Sstevel@tonic-gate #define	C_AFSR_EXT_FATAL_ERRS	(C_AFSR_L3_TUE | C_AFSR_L3_TUE_SH | \
2870Sstevel@tonic-gate 			C_AFSR_RED_ERR | C_AFSR_EFA_PAR_ERR)
2880Sstevel@tonic-gate 
2890Sstevel@tonic-gate /* Panther AFSR_EXT all valid error status bits */
2900Sstevel@tonic-gate #define	C_AFSR_EXT_ALL_ERRS	(C_AFSR_EXT_FATAL_ERRS | \
2910Sstevel@tonic-gate 			C_AFSR_EXT_FECC_ERRS | C_AFSR_EXT_CECC_ERRS | \
2920Sstevel@tonic-gate 			C_AFSR_EXT_ASYNC_ERRS | C_AFSR_L3_MECC)
2930Sstevel@tonic-gate 
2942946Smb91622 /* Panther AFSR_EXT bits for errors to report a L3 cache data resource */
2952381Smikechr #define	C_AFSR_EXT_L3_DATA_ERRS	(C_AFSR_L3_WDU | C_AFSR_L3_WDC | \
2960Sstevel@tonic-gate 			C_AFSR_L3_CPU | C_AFSR_L3_CPC | C_AFSR_L3_UCU | \
2972946Smb91622 			C_AFSR_L3_UCC | C_AFSR_L3_EDU | C_AFSR_L3_EDC | \
2982946Smb91622 			C_AFSR_L3_MECC)
2990Sstevel@tonic-gate 
3000Sstevel@tonic-gate /* Panther AFSR_EXT bits with a valid ESYND field */
3010Sstevel@tonic-gate #define	C_AFSR_EXT_ESYND_ERRS	(C_AFSR_L3_UCU | C_AFSR_L3_UCC | \
3020Sstevel@tonic-gate 			C_AFSR_L3_EDU | C_AFSR_L3_EDC | C_AFSR_L3_WDU | \
3030Sstevel@tonic-gate 			C_AFSR_L3_WDC | C_AFSR_L3_CPU | C_AFSR_L3_CPC)
3040Sstevel@tonic-gate 
3050Sstevel@tonic-gate /* PANTHER AFSR_EXT error bits for AFT Level 1 messages (uncorrected) */
3060Sstevel@tonic-gate #define	C_AFSR_EXT_LEVEL1	(C_AFSR_L3_UCU | C_AFSR_L3_EDU | \
3070Sstevel@tonic-gate 			C_AFSR_L3_WDU | C_AFSR_L3_CPU | C_AFSR_L3_TUE | \
3080Sstevel@tonic-gate 			C_AFSR_L3_TUE_SH)
3090Sstevel@tonic-gate 
3100Sstevel@tonic-gate /*
3110Sstevel@tonic-gate  * AFSR / AFSR_EXT bits for which we need to panic the system.
3120Sstevel@tonic-gate  */
3130Sstevel@tonic-gate #define	C_AFSR_PANIC(errs)	(((errs) & (C_AFSR_FATAL_ERRS | \
3140Sstevel@tonic-gate 			C_AFSR_EXT_FATAL_ERRS)) != 0)
3150Sstevel@tonic-gate 
3160Sstevel@tonic-gate /*
3170Sstevel@tonic-gate  * For the Fast ECC TL1 handler, we are limited in how many registers
3180Sstevel@tonic-gate  * we can use, so we need to store the AFSR_EXT bits within the AFSR
3190Sstevel@tonic-gate  * register using some of the AFSR reserved bits.
3200Sstevel@tonic-gate  */
3210Sstevel@tonic-gate #define	AFSR_EXT_IN_AFSR_MASK	C_AFSR_EXT_ALL_ERRS
3220Sstevel@tonic-gate #define	AFSR_EXT_IN_AFSR_SHIFT	20
3230Sstevel@tonic-gate 
3240Sstevel@tonic-gate /*
3250Sstevel@tonic-gate  * Defines for the flag field in the CPU logout structure.  See the
3260Sstevel@tonic-gate  * definition of ch_cpu_logout_t for further description.
3270Sstevel@tonic-gate  */
3280Sstevel@tonic-gate #define	CLO_FLAGS_TT_MASK	0xff000
3290Sstevel@tonic-gate #define	CLO_FLAGS_TT_SHIFT	12
3300Sstevel@tonic-gate #define	CLO_FLAGS_TL_MASK	0xf00
3310Sstevel@tonic-gate #define	CLO_FLAGS_TL_SHIFT	8
3320Sstevel@tonic-gate #define	CLO_NESTING_MAX		20	/* Arbitrary maximum value */
3330Sstevel@tonic-gate 
3340Sstevel@tonic-gate #define	C_M_SYND_SHIFT	16
3350Sstevel@tonic-gate #define	GET_M_SYND(afsr)	(((afsr) & C_AFSR_M_SYND) >> C_M_SYND_SHIFT)
3360Sstevel@tonic-gate #define	GET_E_SYND(afsr)	((afsr) & C_AFSR_E_SYND)
3370Sstevel@tonic-gate 
3380Sstevel@tonic-gate /*
3390Sstevel@tonic-gate  * Bits of Cheetah Asynchronous Fault Address Register
3400Sstevel@tonic-gate  */
3410Sstevel@tonic-gate #define	C_AFAR_PA INT64_C(0x000007fffffffff0) /* PA<42:4> physical address */
3420Sstevel@tonic-gate 
3430Sstevel@tonic-gate /*
3440Sstevel@tonic-gate  * Defines for the different types of dcache_flush
3450Sstevel@tonic-gate  * it is stored in dflush_type
3460Sstevel@tonic-gate  */
3470Sstevel@tonic-gate #define	FLUSHALL_TYPE	0x0		/* blasts all cache lines */
3480Sstevel@tonic-gate #define	FLUSHMATCH_TYPE	0x1		/* flush entire cache but check each */
3490Sstevel@tonic-gate 					/* each line for a match */
3500Sstevel@tonic-gate #define	FLUSHPAGE_TYPE	0x2		/* flush only one page and check */
3510Sstevel@tonic-gate 					/* each line for a match */
3520Sstevel@tonic-gate 
3530Sstevel@tonic-gate /*
3540Sstevel@tonic-gate  * D-Cache Tag Data Register
3550Sstevel@tonic-gate  *
3560Sstevel@tonic-gate  * +----------+--------+----------+
3570Sstevel@tonic-gate  * | Reserved | DC_Tag | DC_Valid |
3580Sstevel@tonic-gate  * +----------+--------+----------+
3590Sstevel@tonic-gate  *  63	    31 30     1		 0
3600Sstevel@tonic-gate  *
3610Sstevel@tonic-gate  */
3620Sstevel@tonic-gate #define	ICACHE_FLUSHSZ	0x20	/* one line in i$ */
3630Sstevel@tonic-gate #define	CHEETAH_DC_VBIT_SHIFT	1
3640Sstevel@tonic-gate #define	CHEETAH_DC_VBIT_MASK	0x1
3650Sstevel@tonic-gate 
3660Sstevel@tonic-gate /*
3670Sstevel@tonic-gate  * Define for max size of "reason" string in panic flows.  Since this is on
3680Sstevel@tonic-gate  * the stack, we want to keep it as small as is reasonable.
3690Sstevel@tonic-gate  */
3700Sstevel@tonic-gate #define	MAX_REASON_STRING	40
3710Sstevel@tonic-gate 
3720Sstevel@tonic-gate /*
3730Sstevel@tonic-gate  * These error types are specific to Cheetah and are used internally for the
3740Sstevel@tonic-gate  * Cheetah fault structure flt_type field.
3750Sstevel@tonic-gate  */
3760Sstevel@tonic-gate #define	CPU_TO			1	/* Timeout */
3770Sstevel@tonic-gate #define	CPU_BERR		2	/* Bus Error */
3780Sstevel@tonic-gate #define	CPU_CE			3	/* Correctable Memory Error */
3790Sstevel@tonic-gate #define	CPU_UE			4	/* Uncorrectable Memory Error */
3800Sstevel@tonic-gate #define	CPU_CE_ECACHE		5	/* Correctable Ecache Error */
3810Sstevel@tonic-gate #define	CPU_UE_ECACHE		6	/* Uncorrectable Ecache Error */
3820Sstevel@tonic-gate #define	CPU_EMC			7	/* Correctable Mtag Error */
3830Sstevel@tonic-gate #define	CPU_FATAL		8	/* Fatal Error */
3840Sstevel@tonic-gate #define	CPU_ORPH		9	/* Orphaned UCC/UCU error */
3850Sstevel@tonic-gate #define	CPU_IV			10	/* IVU or IVC */
3860Sstevel@tonic-gate #define	CPU_INV_AFSR		11	/* Invalid AFSR */
3870Sstevel@tonic-gate #define	CPU_UE_ECACHE_RETIRE	12	/* Uncorrectable Ecache, retire page */
3880Sstevel@tonic-gate #define	CPU_IC_PARITY		13	/* Icache parity error trap */
3890Sstevel@tonic-gate #define	CPU_DC_PARITY		14	/* Dcache parity error trap */
3900Sstevel@tonic-gate #define	CPU_DUE			15	/* Disrupting UE */
3910Sstevel@tonic-gate #define	CPU_FPUERR		16	/* FPU Error */
3920Sstevel@tonic-gate /*
3930Sstevel@tonic-gate  * These next six error types (17-22) are only used in Jalapeno code
3940Sstevel@tonic-gate  */
3950Sstevel@tonic-gate #define	CPU_RCE			17	/* Correctable remote memory error */
3960Sstevel@tonic-gate #define	CPU_RUE			18	/* Uncorrectable remote memory error */
3970Sstevel@tonic-gate #define	CPU_FRC			19	/* Correctable foreign memory error */
3980Sstevel@tonic-gate #define	CPU_FRU			20	/* Uncorrectable foreign memory error */
3990Sstevel@tonic-gate #define	CPU_BPAR		21	/* Bus parity (BP or WBP) errorrs */
4000Sstevel@tonic-gate #define	CPU_UMS			22	/* Unsupported memory store */
4010Sstevel@tonic-gate /*
4020Sstevel@tonic-gate  * These next four error types (23-26) are only used in Panther code
4030Sstevel@tonic-gate  */
4040Sstevel@tonic-gate #define	CPU_PC_PARITY		23	/* Pcache parity error */
4050Sstevel@tonic-gate #define	CPU_ITLB_PARITY		24	/* Panther ITLB parity error */
4060Sstevel@tonic-gate #define	CPU_DTLB_PARITY		25	/* Panther DTLB parity error */
4070Sstevel@tonic-gate #define	CPU_L3_ADDR_PE		26	/* Panther L3$ address parity error */
4080Sstevel@tonic-gate 
4090Sstevel@tonic-gate /*
4100Sstevel@tonic-gate  * Sets trap table entry ttentry by overwriting eight instructions from ttlabel
4110Sstevel@tonic-gate  */
4120Sstevel@tonic-gate #define	CH_SET_TRAP(ttentry, ttlabel)			\
4130Sstevel@tonic-gate 		bcopy((const void *)&ttlabel, &ttentry, 32);		\
4140Sstevel@tonic-gate 		flush_instr_mem((caddr_t)&ttentry, 32);
4150Sstevel@tonic-gate 
4160Sstevel@tonic-gate /*
4170Sstevel@tonic-gate  * Return values for implementation specific error logging in the routine
4180Sstevel@tonic-gate  * cpu_impl_async_log_err()
4190Sstevel@tonic-gate  */
4200Sstevel@tonic-gate #define	CH_ASYNC_LOG_DONE	0	/* finished logging the error */
4210Sstevel@tonic-gate #define	CH_ASYNC_LOG_CONTINUE	1	/* continue onto handle panicker */
4220Sstevel@tonic-gate #define	CH_ASYNC_LOG_UNKNOWN	2	/* unknown error type */
4230Sstevel@tonic-gate #define	CH_ASYNC_LOG_RECIRC	3	/* suppress logging of error */
4240Sstevel@tonic-gate 
4250Sstevel@tonic-gate #ifndef	_ASM
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate /*
4280Sstevel@tonic-gate  * Define Cheetah family (UltraSPARC-III) specific asynchronous error structure
4290Sstevel@tonic-gate  */
4300Sstevel@tonic-gate typedef struct cheetah_async_flt {
4310Sstevel@tonic-gate 	struct async_flt cmn_asyncflt;	/* common - see sun4u/sys/async.h */
4320Sstevel@tonic-gate 	ushort_t flt_type;		/* types of faults - cpu specific */
4330Sstevel@tonic-gate 	uint64_t flt_bit;		/* fault bit for this log msg */
4340Sstevel@tonic-gate 	uint64_t afsr_ext;		/* Panther has an AFSR_EXT register */
4350Sstevel@tonic-gate 	uint64_t afsr_errs;		/* Store all AFSR error bits together */
4360Sstevel@tonic-gate 	uint64_t afar2;			/* Serrano has an AFAR2 for FRC/FRU */
4370Sstevel@tonic-gate 	ch_diag_data_t flt_diag_data;	/* Diagnostic data */
4380Sstevel@tonic-gate 	int flt_data_incomplete;	/* Diagnostic data is incomplete */
4390Sstevel@tonic-gate 	int flt_trapped_ce;		/* CEEN fault caught by trap handler */
4400Sstevel@tonic-gate #if defined(CPU_IMP_L1_CACHE_PARITY)
4410Sstevel@tonic-gate 	ch_l1_parity_log_t parity_data;	/* L1$ Parity error logging info */
4420Sstevel@tonic-gate #endif	/* CPU_IMP_L1_CACHE_PARITY */
4430Sstevel@tonic-gate 	pn_tlb_logout_t tlb_diag_data;	/* TLB parity error Diagnostic data */
4440Sstevel@tonic-gate 	uint32_t flt_fpdata[16];	/* Data from fpras failure */
4450Sstevel@tonic-gate 	uint64_t flt_sdw_afar;		/* Shadow AFAR */
4460Sstevel@tonic-gate 	uint64_t flt_sdw_afsr;		/* Shadow AFSR */
4470Sstevel@tonic-gate 	uint64_t flt_sdw_afsr_ext;	/* Shadow Extended AFSR */
4480Sstevel@tonic-gate } ch_async_flt_t;
4490Sstevel@tonic-gate 
4500Sstevel@tonic-gate #define	ECC_ALL_TRAPS	(ECC_D_TRAP | ECC_I_TRAP | ECC_C_TRAP | ECC_F_TRAP)
4510Sstevel@tonic-gate #define	ECC_ORPH_TRAPS	(ECC_D_TRAP | ECC_I_TRAP | ECC_C_TRAP)
4520Sstevel@tonic-gate #define	ECC_ASYNC_TRAPS	(ECC_D_TRAP | ECC_I_TRAP)
4530Sstevel@tonic-gate #define	ECC_MECC_TRAPS	(ECC_D_TRAP | ECC_C_TRAP | ECC_F_TRAP)
4540Sstevel@tonic-gate 
4550Sstevel@tonic-gate /*
4560Sstevel@tonic-gate  * Error type table struct.
4570Sstevel@tonic-gate  */
4580Sstevel@tonic-gate typedef struct ecc_type_to_info {
4590Sstevel@tonic-gate 	uint64_t	ec_afsr_bit;	/* AFSR bit of error */
4600Sstevel@tonic-gate 	char		*ec_reason;	/* Short error description */
4610Sstevel@tonic-gate 	uint_t		ec_flags;	/* Trap type error should be seen at */
4620Sstevel@tonic-gate 	int		ec_flt_type;	/* Used by cpu_async_log_err */
4630Sstevel@tonic-gate 	char		*ec_desc;	/* Long error description */
4640Sstevel@tonic-gate 	uint64_t	ec_err_payload;	/* FM ereport payload information */
4650Sstevel@tonic-gate 	char		*ec_err_class;	/* FM ereport class */
4660Sstevel@tonic-gate } ecc_type_to_info_t;
4670Sstevel@tonic-gate 
4680Sstevel@tonic-gate typedef struct bus_config_eclk {
4690Sstevel@tonic-gate 	uint_t		divisor;
4700Sstevel@tonic-gate 	uint64_t	mask;
4710Sstevel@tonic-gate } bus_config_eclk_t;
4720Sstevel@tonic-gate 
4730Sstevel@tonic-gate #endif /* _ASM */
4740Sstevel@tonic-gate 
4750Sstevel@tonic-gate #endif /* _KERNEL */
4760Sstevel@tonic-gate 
4770Sstevel@tonic-gate #ifndef _ASM
4780Sstevel@tonic-gate 
4790Sstevel@tonic-gate #include <sys/cpuvar.h>
4800Sstevel@tonic-gate 
4810Sstevel@tonic-gate /*
4820Sstevel@tonic-gate  * Since all the US3_* files share a bunch of routines between each other
4830Sstevel@tonic-gate  * we will put all the "extern" definitions in this header file so that we
4840Sstevel@tonic-gate  * don't have to repeat it all in every file.
4850Sstevel@tonic-gate  */
4860Sstevel@tonic-gate 
4870Sstevel@tonic-gate /*
4880Sstevel@tonic-gate  * functions that are defined in the US3 cpu module:
4890Sstevel@tonic-gate  * -------------------------------------------------
4900Sstevel@tonic-gate  */
4910Sstevel@tonic-gate extern uint64_t get_safari_config(void);
4920Sstevel@tonic-gate extern void set_safari_config(uint64_t safari_config);
4930Sstevel@tonic-gate extern void shipit(int, int);
4940Sstevel@tonic-gate extern void cpu_aflt_log(int ce_code, int tagnum, ch_async_flt_t *aflt,
4950Sstevel@tonic-gate     uint_t logflags, const char *endstr, const char *fmt, ...);
4960Sstevel@tonic-gate extern uint8_t flt_to_trap_type(struct async_flt *aflt);
4970Sstevel@tonic-gate extern void cpu_log_err(struct async_flt *aflt);
4980Sstevel@tonic-gate extern void cpu_page_retire(ch_async_flt_t *ch_flt);
4990Sstevel@tonic-gate extern int clear_errors(ch_async_flt_t *ch_flt);
5000Sstevel@tonic-gate extern void cpu_init_ecache_scrub_dr(struct cpu *cp);
5010Sstevel@tonic-gate extern void get_cpu_error_state(ch_cpu_errors_t *);
5020Sstevel@tonic-gate extern void set_cpu_error_state(ch_cpu_errors_t *);
5030Sstevel@tonic-gate extern int cpu_flt_in_memory(ch_async_flt_t *ch_flt, uint64_t t_afsr_bit);
5040Sstevel@tonic-gate extern int cpu_queue_events(ch_async_flt_t *ch_flt, char *reason,
5050Sstevel@tonic-gate     uint64_t t_afsr, ch_cpu_logout_t *clop);
5060Sstevel@tonic-gate extern void cpu_error_ecache_flush(ch_async_flt_t *);
5070Sstevel@tonic-gate extern void cpu_clearphys(struct async_flt *aflt);
5080Sstevel@tonic-gate extern void cpu_async_log_ic_parity_err(ch_async_flt_t *);
5090Sstevel@tonic-gate extern void cpu_async_log_dc_parity_err(ch_async_flt_t *);
5100Sstevel@tonic-gate extern uint64_t get_ecache_ctrl(void);
5110Sstevel@tonic-gate extern uint64_t get_jbus_config(void);
5120Sstevel@tonic-gate extern void set_jbus_config(uint64_t jbus_config);
5130Sstevel@tonic-gate extern uint64_t get_mcu_ctl_reg1(void);
5140Sstevel@tonic-gate extern void set_mcu_ctl_reg1(uint64_t mcu_ctl);
5150Sstevel@tonic-gate extern void cpu_init_trap(void);
5160Sstevel@tonic-gate extern int cpu_ecache_nway(void);
5170Sstevel@tonic-gate extern void cpu_delayed_logout(size_t, ch_cpu_logout_t *);
5180Sstevel@tonic-gate extern void cpu_payload_add_pcache(struct async_flt *, nvlist_t *);
5190Sstevel@tonic-gate extern void cpu_payload_add_tlb(struct async_flt *, nvlist_t *);
5200Sstevel@tonic-gate extern int cpu_scrub_cpu_setup(cpu_setup_t, int, void *);
5210Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
5220Sstevel@tonic-gate extern int afsr_to_jaid_status(uint64_t afsr, uint64_t afsr_bit);
5230Sstevel@tonic-gate #endif	/* JALAPENO || SERRANO */
5240Sstevel@tonic-gate /*
5250Sstevel@tonic-gate  * Address of the level 15 interrupt handler preamble, used to log Fast ECC
5260Sstevel@tonic-gate  * at TL>0 errors, which will be moved to the trap table address above.
5270Sstevel@tonic-gate  */
5280Sstevel@tonic-gate extern void ch_pil15_interrupt_instr();
5290Sstevel@tonic-gate #ifdef CHEETAHPLUS_ERRATUM_25
5300Sstevel@tonic-gate extern int mondo_recover(uint16_t, int);
5310Sstevel@tonic-gate #endif	/* CHEETAHPLUS_ERRATUM_25 */
5320Sstevel@tonic-gate /*
5330Sstevel@tonic-gate  * Adddresses of the Fast ECC Error trap handler preambles which will be
5340Sstevel@tonic-gate  * moved to the appropriate trap table addresses.
5350Sstevel@tonic-gate  */
5360Sstevel@tonic-gate extern void fecc_err_instr(void);
5370Sstevel@tonic-gate extern void fecc_err_tl1_instr(void);
5380Sstevel@tonic-gate extern void fecc_err_tl1_cont_instr(void);
5390Sstevel@tonic-gate 
5400Sstevel@tonic-gate extern int afsr_to_overw_status(uint64_t afsr, uint64_t afsr_bit,
5410Sstevel@tonic-gate     uint64_t *ow_bits);
5420Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
5430Sstevel@tonic-gate extern int afsr_to_pn_esynd_status(uint64_t afsr, uint64_t afsr_bit);
5440Sstevel@tonic-gate #endif	/* CHEETAH_PLUS */
5450Sstevel@tonic-gate extern void flush_ecache(uint64_t physaddr, size_t ecachesize, size_t linesize);
5460Sstevel@tonic-gate extern void flush_dcache(void);
5470Sstevel@tonic-gate extern void flush_icache(void);
5480Sstevel@tonic-gate extern void flush_pcache(void);
5490Sstevel@tonic-gate extern void flush_ipb(void);
5500Sstevel@tonic-gate extern uint64_t get_dcu(void);
5510Sstevel@tonic-gate extern void set_dcu(uint64_t ncc);
5520Sstevel@tonic-gate extern void scrubphys(uint64_t paddr, int ecache_set_size);
5530Sstevel@tonic-gate extern void clearphys(uint64_t paddr, int ecache_set_size, int ecache_linesize);
5540Sstevel@tonic-gate extern void stick_adj(int64_t skew);
5550Sstevel@tonic-gate extern void stick_timestamp(int64_t *ts);
5560Sstevel@tonic-gate extern void icache_inval_all(void);
5570Sstevel@tonic-gate extern void dcache_inval_line(int index);
5580Sstevel@tonic-gate extern void ecache_flush_line(uint64_t flushaddr, int ec_size);
5590Sstevel@tonic-gate extern int ecache_get_lineinfo(uint32_t ecache_index, uint64_t *tag,
5600Sstevel@tonic-gate 		uint64_t *data);
5610Sstevel@tonic-gate #if defined(CPU_IMP_L1_CACHE_PARITY)
5620Sstevel@tonic-gate extern void get_dcache_dtag(uint32_t dcache_idx, uint64_t *data);
5630Sstevel@tonic-gate extern void get_icache_dtag(uint32_t icache_idx, uint64_t *data);
5640Sstevel@tonic-gate extern void get_pcache_dtag(uint32_t pcache_idx, uint64_t *data);
5650Sstevel@tonic-gate extern void correct_dcache_parity(size_t dcache_size, size_t dcache_linesize);
5660Sstevel@tonic-gate #endif	/* CPU_IMP_L1_CACHE_PARITY */
5670Sstevel@tonic-gate extern void cpu_check_block(caddr_t, uint_t);
5680Sstevel@tonic-gate extern uint32_t us3_gen_ecc(uint64_t data_low, uint64_t data_high);
5690Sstevel@tonic-gate extern int cpu_impl_async_log_err(void *, errorq_elem_t *);
5700Sstevel@tonic-gate extern void cpu_fast_ecc_error(struct regs *rp, ulong_t p_clo_flags);
5710Sstevel@tonic-gate extern void cpu_tl1_error(struct regs *rp, int panic);
5720Sstevel@tonic-gate extern void cpu_tl1_err_panic(struct regs *rp, ulong_t flags);
5730Sstevel@tonic-gate extern void cpu_disrupting_error(struct regs *rp, ulong_t p_clo_flags);
5740Sstevel@tonic-gate extern void cpu_deferred_error(struct regs *rp, ulong_t p_clo_flags);
5750Sstevel@tonic-gate #if defined(CPU_IMP_L1_CACHE_PARITY)
5760Sstevel@tonic-gate extern void cpu_parity_error(struct regs *rp, uint_t flags, caddr_t tpc);
5770Sstevel@tonic-gate #endif	/* CPU_IMP_L1_CACHE_PARITY */
5780Sstevel@tonic-gate extern void claimlines(uint64_t startpa, size_t len, int stride);
5790Sstevel@tonic-gate extern void copy_tsb_entry(uintptr_t src, uintptr_t dest);
5800Sstevel@tonic-gate extern void hwblkpagecopy(const void *src, void *dst);
5810Sstevel@tonic-gate #if defined(CHEETAH_PLUS)
5820Sstevel@tonic-gate extern void pn_cpu_log_diag_l2_info(ch_async_flt_t *ch_flt);
5830Sstevel@tonic-gate extern void set_afsr_ext(uint64_t afsr_ext);
5840Sstevel@tonic-gate #endif
5850Sstevel@tonic-gate extern void cpu_tlb_parity_error(struct regs *rp, ulong_t trap_va,
5860Sstevel@tonic-gate     ulong_t tlb_info);
5870Sstevel@tonic-gate extern void log_flt_func(struct async_flt *aflt, char *unum);
5880Sstevel@tonic-gate extern uint64_t pn_get_tlb_index(uint64_t va, uint64_t pg_sz);
5890Sstevel@tonic-gate extern int popc64(uint64_t val);
5900Sstevel@tonic-gate 
5910Sstevel@tonic-gate /*
5920Sstevel@tonic-gate  * variables and structures that are defined in the US3 cpu module:
5930Sstevel@tonic-gate  * ----------------------------------------------------------------
5940Sstevel@tonic-gate  */
5950Sstevel@tonic-gate extern bus_config_eclk_t bus_config_eclk[];
5960Sstevel@tonic-gate extern ecc_type_to_info_t ecc_type_to_info[];
5970Sstevel@tonic-gate extern uint64_t ch_err_tl1_paddrs[];
5980Sstevel@tonic-gate extern uchar_t ch_err_tl1_pending[];
5990Sstevel@tonic-gate #ifdef CHEETAHPLUS_ERRATUM_25
6000Sstevel@tonic-gate /*
6010Sstevel@tonic-gate  * Tunable defined in us3_common.c
6020Sstevel@tonic-gate  */
6030Sstevel@tonic-gate extern int cheetah_sendmondo_recover;
6040Sstevel@tonic-gate #endif	/* CHEETAHPLUS_ERRATUM_25 */
6050Sstevel@tonic-gate /*
6060Sstevel@tonic-gate  * The following allows for a one time calculation of the number of dcache
6070Sstevel@tonic-gate  * lines vs. calculating the number every time through the scrub routine.
6080Sstevel@tonic-gate  */
6090Sstevel@tonic-gate int dcache_nlines;			/* max number of D$ lines */
6100Sstevel@tonic-gate 
6110Sstevel@tonic-gate extern uint64_t afar_overwrite[];
6120Sstevel@tonic-gate extern uint64_t esynd_overwrite[];
6130Sstevel@tonic-gate extern uint64_t msynd_overwrite[];
6140Sstevel@tonic-gate 
6150Sstevel@tonic-gate #if defined(JALAPENO) || defined(SERRANO)
6160Sstevel@tonic-gate extern uint64_t jreq_overwrite[];
6170Sstevel@tonic-gate #if defined(SERRANO)
6180Sstevel@tonic-gate extern uint64_t	afar2_overwrite[];
6190Sstevel@tonic-gate #endif	/* SERRANO */
6200Sstevel@tonic-gate #endif	/* JALAPENO || SERRANO */
6210Sstevel@tonic-gate 
6220Sstevel@tonic-gate /*
6230Sstevel@tonic-gate  * variables and structures that are defined outside the US3 cpu module:
6240Sstevel@tonic-gate  * ---------------------------------------------------------------------
6250Sstevel@tonic-gate  */
6260Sstevel@tonic-gate extern uint64_t xc_tick_limit;
6270Sstevel@tonic-gate extern uint64_t xc_tick_jump_limit;
6280Sstevel@tonic-gate extern struct kmem_cache *ch_private_cache;
6290Sstevel@tonic-gate 
6300Sstevel@tonic-gate #if defined(CPU_IMP_L1_CACHE_PARITY)
6310Sstevel@tonic-gate /*
6320Sstevel@tonic-gate  * Addresses of the Dcache and Icache parity error trap table entries.
6330Sstevel@tonic-gate  * If L1 cache parity protection is implemented, need to replace Dcache and
6340Sstevel@tonic-gate  * Icache parity error handlers.
6350Sstevel@tonic-gate  */
6360Sstevel@tonic-gate extern void *tt0_dperr;
6370Sstevel@tonic-gate extern void *tt1_dperr;
6380Sstevel@tonic-gate extern void *tt1_swtrap1;
6390Sstevel@tonic-gate extern void *tt0_iperr;
6400Sstevel@tonic-gate extern void *tt1_iperr;
6410Sstevel@tonic-gate extern void *tt1_swtrap2;
6420Sstevel@tonic-gate /*
6430Sstevel@tonic-gate  * Addresses of the Dcache and Icache parity error trap preambles, which will
6440Sstevel@tonic-gate  * be moved to the appropriate trap table addresses.
6450Sstevel@tonic-gate  */
6460Sstevel@tonic-gate extern void dcache_parity_instr();
6470Sstevel@tonic-gate extern void dcache_parity_tl1_instr();
6480Sstevel@tonic-gate extern void dcache_parity_tl1_cont_instr();
6490Sstevel@tonic-gate extern void icache_parity_instr();
6500Sstevel@tonic-gate extern void icache_parity_tl1_instr();
6510Sstevel@tonic-gate extern void icache_parity_tl1_cont_instr();
6520Sstevel@tonic-gate #endif	/* CPU_IMP_L1_CACHE_PARITY */
6530Sstevel@tonic-gate 
6540Sstevel@tonic-gate /*
6550Sstevel@tonic-gate  * Addresses of the Fast ECC error trap table entries.
6560Sstevel@tonic-gate  */
6570Sstevel@tonic-gate extern void *tt0_fecc;
6580Sstevel@tonic-gate extern void *tt1_fecc;
6590Sstevel@tonic-gate extern void *tt1_swtrap0;
6600Sstevel@tonic-gate /*
6610Sstevel@tonic-gate  * Address of trap table level 15 interrupt handler in the trap table.
6620Sstevel@tonic-gate  */
663*8803SJonathan.Haslam@Sun.COM extern void *pil15_epilogue;
6640Sstevel@tonic-gate /*
6650Sstevel@tonic-gate  * D$ and I$ global parameters.
6660Sstevel@tonic-gate  */
6670Sstevel@tonic-gate extern int dcache_size;
6680Sstevel@tonic-gate extern int dcache_linesize;
6690Sstevel@tonic-gate extern int icache_size;
6700Sstevel@tonic-gate extern int icache_linesize;
6710Sstevel@tonic-gate 
6720Sstevel@tonic-gate /*
6730Sstevel@tonic-gate  * Set of all offline cpus
6740Sstevel@tonic-gate  */
6750Sstevel@tonic-gate extern cpuset_t cpu_offline_set;
6760Sstevel@tonic-gate 
6770Sstevel@tonic-gate #endif /* _ASM */
6780Sstevel@tonic-gate 
6790Sstevel@tonic-gate #ifdef	__cplusplus
6800Sstevel@tonic-gate }
6810Sstevel@tonic-gate #endif
6820Sstevel@tonic-gate 
6830Sstevel@tonic-gate #endif	/* _SYS_US3_MODULE_H */
684