xref: /onnv-gate/usr/src/uts/sun4u/sys/pci/pcisch.h (revision 6026:4898f2ba5e8b)
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
52050Ssuha  * Common Development and Distribution License (the "License").
62050Ssuha  * 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*6026Sdanice  * Copyright 2008 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_PCISCH_H
270Sstevel@tonic-gate #define	_SYS_PCISCH_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * Performance counters information.
370Sstevel@tonic-gate  */
380Sstevel@tonic-gate #define	SCHIZO_SHIFT_PIC0	4
390Sstevel@tonic-gate #define	SCHIZO_SHIFT_PIC1	11
400Sstevel@tonic-gate 
410Sstevel@tonic-gate /*
420Sstevel@tonic-gate  * Schizo-specific register offsets & bit field positions.
430Sstevel@tonic-gate  */
440Sstevel@tonic-gate 
450Sstevel@tonic-gate /*
460Sstevel@tonic-gate  * [msb]				[lsb]
470Sstevel@tonic-gate  * 0x00 <chip_type> <version#> <module-revision#>
480Sstevel@tonic-gate  */
490Sstevel@tonic-gate #define	SCHIZO_VER_10		CHIP_ID(PCI_CHIP_SCHIZO, 0x00, 0x00)
500Sstevel@tonic-gate #define	SCHIZO_VER_20		CHIP_ID(PCI_CHIP_SCHIZO, 0x02, 0x00)
510Sstevel@tonic-gate #define	SCHIZO_VER_21		CHIP_ID(PCI_CHIP_SCHIZO, 0x03, 0x00)
520Sstevel@tonic-gate #define	SCHIZO_VER_22		CHIP_ID(PCI_CHIP_SCHIZO, 0x04, 0x00)
530Sstevel@tonic-gate #define	SCHIZO_VER_23		CHIP_ID(PCI_CHIP_SCHIZO, 0x05, 0x00)
540Sstevel@tonic-gate #define	SCHIZO_VER_24		CHIP_ID(PCI_CHIP_SCHIZO, 0x06, 0x00)
550Sstevel@tonic-gate #define	SCHIZO_VER_25		CHIP_ID(PCI_CHIP_SCHIZO, 0x07, 0x00)
560Sstevel@tonic-gate #define	XMITS_VER_10		CHIP_ID(PCI_CHIP_XMITS, 0x05, 0x01)
570Sstevel@tonic-gate #define	XMITS_VER_21		CHIP_ID(PCI_CHIP_XMITS, 0x05, 0x03)
580Sstevel@tonic-gate #define	XMITS_VER_30		CHIP_ID(PCI_CHIP_XMITS, 0x05, 0x04)
590Sstevel@tonic-gate #define	TOMATILLO_VER_10	CHIP_ID(PCI_CHIP_TOMATILLO, 0x00, 0x00)
600Sstevel@tonic-gate #define	TOMATILLO_VER_20	CHIP_ID(PCI_CHIP_TOMATILLO, 0x01, 0x00)
610Sstevel@tonic-gate #define	TOMATILLO_VER_21	CHIP_ID(PCI_CHIP_TOMATILLO, 0x02, 0x00)
620Sstevel@tonic-gate #define	TOMATILLO_VER_22	CHIP_ID(PCI_CHIP_TOMATILLO, 0x03, 0x00)
630Sstevel@tonic-gate #define	TOMATILLO_VER_23	CHIP_ID(PCI_CHIP_TOMATILLO, 0x04, 0x00)
640Sstevel@tonic-gate #define	TOMATILLO_VER_24	CHIP_ID(PCI_CHIP_TOMATILLO, 0X05, 0X00)
650Sstevel@tonic-gate 
660Sstevel@tonic-gate /*
670Sstevel@tonic-gate  * Offsets of Control Block registers ("reg" property 2nd entry)
680Sstevel@tonic-gate  */
690Sstevel@tonic-gate #define	SCHIZO_CB_CSR_OFFSET			0x0	/* reg 1 */
700Sstevel@tonic-gate #define	SCHIZO_CB_ERRCTRL_OFFSET		0x8
710Sstevel@tonic-gate #define	SCHIZO_CB_INTCTRL_OFFSET		0x10
720Sstevel@tonic-gate #define	SCHIZO_CB_ERRLOG_OFFSET			0x18
730Sstevel@tonic-gate #define	SCHIZO_CB_ECCCTRL_OFFSET		0x20
740Sstevel@tonic-gate #define	SCHIZO_CB_UEAFSR_OFFSET			0x30
750Sstevel@tonic-gate #define	SCHIZO_CB_UEAFAR_OFFSET			0x38
760Sstevel@tonic-gate #define	SCHIZO_CB_CEAFSR_OFFSET			0x40
770Sstevel@tonic-gate #define	SCHIZO_CB_CEAFAR_OFFSET			0x48
780Sstevel@tonic-gate #define	SCHIZO_CB_ESTRCTRL_OFFSET		0x50
790Sstevel@tonic-gate #define	XMITS_CB_SOFT_PAUSE_OFFSET		0x58
800Sstevel@tonic-gate #define	XMITS_CB_IO_LOOPBACK_CONTROL_OFFSET	0x60
810Sstevel@tonic-gate #define	XMITS_CB_SAF_PED_CONTROL_OFFSET		0x68
820Sstevel@tonic-gate #define	XMITS_CB_SAF_PED_LOG_OFFSET		0x70
830Sstevel@tonic-gate #define	XMITS_CB_SAF_PAR_INJECT_IMM_OFFSET	0x78
840Sstevel@tonic-gate #define	XMITS_CB_SAF_PAR_INJECT_1_OFFSET	0x80
850Sstevel@tonic-gate #define	XMITS_CB_SAF_PAR_INJECT_0_OFFSET	0x88
860Sstevel@tonic-gate #define	XMITS_CB_FIRST_ERROR_LOG		0x90
870Sstevel@tonic-gate #define	XMITS_CB_FIRST_ERROR_ADDR		0x98
880Sstevel@tonic-gate #define	XMITS_CB_PCI_LEAF_STATUS		0xA0
890Sstevel@tonic-gate 
900Sstevel@tonic-gate /*
910Sstevel@tonic-gate  * Tomatillo only bits in IOMMU control registers.
920Sstevel@tonic-gate  */
930Sstevel@tonic-gate #define	TOMATILLO_IOMMU_SEG_DISP_SHIFT		4
940Sstevel@tonic-gate #define	TOMATILLO_IOMMU_TSB_MAX			7
950Sstevel@tonic-gate #define	TOMATIILO_IOMMU_ERR_REG_SHIFT		24
960Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERRSTS_SHIFT		25
970Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERR			(1ull << 24)
980Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERRSTS			(3ull << 25)
990Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERR_ILLTSBTBW		(1ull << 27)
1000Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERR_BAD_VA		(1ull << 28)
1010Sstevel@tonic-gate 
1020Sstevel@tonic-gate #define	TOMATILLO_IOMMU_PROTECTION_ERR		0x0
1030Sstevel@tonic-gate #define	TOMATILLO_IOMMU_INVALID_ERR		0x1
1040Sstevel@tonic-gate #define	TOMATILLO_IOMMU_TIMEOUT_ERR		0x2
1050Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ECC_ERR			0x3
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate /*
1080Sstevel@tonic-gate  * Offsets of performance monitoring registers.
1090Sstevel@tonic-gate  */
1100Sstevel@tonic-gate #define	SCHIZO_PERF_PCI_PCR_OFFSET		0x00000100
1110Sstevel@tonic-gate #define	SCHIZO_PERF_PCI_PIC_OFFSET		0x00000108
1120Sstevel@tonic-gate #define	SCHIZO_PERF_PCI_ICD_OFFSET		0x00000110
1130Sstevel@tonic-gate #define	SCHIZO_PERF_SAF_PCR_OFFSET		0x00007000
1140Sstevel@tonic-gate #define	SCHIZO_PERF_SAF_PIC_OFFSET		0x00007008
1150Sstevel@tonic-gate 
1160Sstevel@tonic-gate /*
1170Sstevel@tonic-gate  * Offsets of registers in the PBM block:
1180Sstevel@tonic-gate  */
1190Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_REG_OFFSET		0x2000
1200Sstevel@tonic-gate #define	SCHIZO_PCI_ASYNC_FLT_STATUS_REG_OFFSET	0x2010
1210Sstevel@tonic-gate #define	SCHIZO_PCI_ASYNC_FLT_ADDR_REG_OFFSET	0x2018
1220Sstevel@tonic-gate #define	SCHIZO_PCI_DIAG_REG_OFFSET		0x2020
1230Sstevel@tonic-gate #define	SCHIZO_PCI_ESTAR_REG_OFFSET		0x2028
1240Sstevel@tonic-gate #define	TOMATILLO_TGT_ADDR_SPACE_OFFSET		0x2490
1250Sstevel@tonic-gate #define	TOMATILLO_TGT_ERR_VALOG_OFFSET		0x2498
1260Sstevel@tonic-gate 
1270Sstevel@tonic-gate #define	XMITS10_PCI_X_ERROR_STATUS_REG_OFFSET	0x2030
1280Sstevel@tonic-gate #define	XMITS10_PCI_X_DIAG_REG_OFFSET		0x2038
1290Sstevel@tonic-gate #define	XMITS_PCI_X_ERROR_STATUS_REG_OFFSET	0x2300
1300Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_REG_OFFSET		0x2308
1310Sstevel@tonic-gate #define	XMITS_PARITY_DETECT_REG_OFFSET		0x2040
1320Sstevel@tonic-gate #define	XMITS_PARITY_LOG_REG_OFFSET		0x2048
1330Sstevel@tonic-gate #define	XMITS_PARITY_INJECT_REG_OFFSET		0x2050
1340Sstevel@tonic-gate #define	XMITS_PARITY_INJECT_1_REG_OFFSET	0x2058
1350Sstevel@tonic-gate #define	XMITS_PARITY_INJECT_0_REG_OFFSET	0x2060
1361295Sdanice #define	XMITS_UPPER_RETRY_COUNTER_REG_OFFSET	0x2310
1370Sstevel@tonic-gate 
1380Sstevel@tonic-gate /*
1390Sstevel@tonic-gate  * Offsets of IO Cache Registers:
1400Sstevel@tonic-gate  */
1410Sstevel@tonic-gate #define	TOMATILLO_IOC_CSR_OFF			0x2248
1420Sstevel@tonic-gate #define	TOMATILLO_IOC_TAG_OFF			0x2250
1430Sstevel@tonic-gate #define	TOMATIILO_IOC_DAT_OFF			0x2290
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate /*
1460Sstevel@tonic-gate  * Offsets of registers in the iommu block:
1470Sstevel@tonic-gate  */
1480Sstevel@tonic-gate #define	SCHIZO_IOMMU_FLUSH_CTX_REG_OFFSET	0x00000218
1490Sstevel@tonic-gate #define	TOMATILLO_IOMMU_ERR_TFAR_OFFSET		0x0220
1500Sstevel@tonic-gate 
1510Sstevel@tonic-gate /*
1520Sstevel@tonic-gate  * Offsets of registers in the streaming cache block:
1530Sstevel@tonic-gate  */
1540Sstevel@tonic-gate #define	SCHIZO_SC_CTRL_REG_OFFSET		0x00002800
1550Sstevel@tonic-gate #define	SCHIZO_SC_INVL_REG_OFFSET		0x00002808
1560Sstevel@tonic-gate #define	SCHIZO_SC_SYNC_REG_OFFSET		0x00002810
1570Sstevel@tonic-gate #define	SCHIZO_SC_CTX_INVL_REG_OFFSET		0x00002818
1580Sstevel@tonic-gate #define	SCHIZO_SC_CTX_MATCH_REG_OFFSET		0x00010000
1590Sstevel@tonic-gate #define	SCHIZO_SC_DATA_DIAG_OFFSET		0x0000b000
1600Sstevel@tonic-gate #define	SCHIZO_SC_TAG_DIAG_OFFSET		0x0000ba00
1610Sstevel@tonic-gate #define	SCHIZO_SC_LTAG_DIAG_OFFSET		0x0000bb00
1620Sstevel@tonic-gate 
1630Sstevel@tonic-gate /*
1640Sstevel@tonic-gate  * MAX_PRF when enabled will always prefetch the max of 8
1650Sstevel@tonic-gate  * prefetches if possible.
1660Sstevel@tonic-gate  */
1670Sstevel@tonic-gate #define	XMITS_SC_MAX_PRF			(0x1ull << 7)
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate /*
1700Sstevel@tonic-gate  * Offsets of registers in the PCI Idle Check Diagnostics Register.
1710Sstevel@tonic-gate  */
1720Sstevel@tonic-gate #define	SCHIZO_PERF_PCI_ICD_DMAW_PARITY_INT_ENABLE	0x4000
1730Sstevel@tonic-gate #define	SCHIZO_PERF_PCI_ICD_PCI_2_0_COMPATIBLE		0x8000
1740Sstevel@tonic-gate 
1750Sstevel@tonic-gate /*
1760Sstevel@tonic-gate  * Offsets of registers in the interrupt block:
1770Sstevel@tonic-gate  */
1780Sstevel@tonic-gate #define	SCHIZO_IB_SLOT_INTR_MAP_REG_OFFSET	0x1100
1790Sstevel@tonic-gate #define	SCHIZO_IB_INTR_MAP_REG_OFFSET		0x1000
1800Sstevel@tonic-gate #define	SCHIZO_IB_CLEAR_INTR_REG_OFFSET		0x1400
1810Sstevel@tonic-gate #define	SCHIZO_PBM_DMA_SYNC_REG_OFFSET		0x1A08
1820Sstevel@tonic-gate #define	PBM_DMA_SYNC_COMP_REG_OFFSET		0x1A10
1830Sstevel@tonic-gate #define	PBM_DMA_SYNC_PEND_REG_OFFSET		0x1A18
1840Sstevel@tonic-gate 
1850Sstevel@tonic-gate /*
1860Sstevel@tonic-gate  * Address space offsets and sizes:
1870Sstevel@tonic-gate  */
1880Sstevel@tonic-gate #define	SCHIZO_SIZE				0x0000800000000000ull
1890Sstevel@tonic-gate 
1900Sstevel@tonic-gate /*
1910Sstevel@tonic-gate  * Schizo-specific fields of interrupt mapping register:
1920Sstevel@tonic-gate  */
1930Sstevel@tonic-gate #define	SCHIZO_INTR_MAP_REG_NID			0x0000000003E00000ull
1940Sstevel@tonic-gate #define	SCHIZO_INTR_MAP_REG_NID_SHIFT		21
1950Sstevel@tonic-gate 
1960Sstevel@tonic-gate /*
1970Sstevel@tonic-gate  * schizo ECC UE AFSR bit definitions:
1980Sstevel@tonic-gate  */
1990Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_ERRPNDG		0x0300000000000000ull
2000Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MASK			0x000003ff00000000ull
2010Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MASK_SHIFT		32
2020Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_QW_OFFSET		0x00000000C0000000ull
2030Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_QW_OFFSET_SHIFT	30
2040Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_AGENT_MID		0x000000001f000000ull
2050Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_AGENT_MID_SHIFT	24
2060Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_PARTIAL		0x0000000000800000ull
2070Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_OWNED_IN		0x0000000000400000ull
2080Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MTAG_SYND		0x00000000000f0000ull
2090Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MTAG_SYND_SHIFT	16
2100Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MTAG			0x000000000000e000ull
2110Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_MTAG_SHIFT		13
2120Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_SYND			0x00000000000001ffull
2130Sstevel@tonic-gate #define	SCHIZO_ECC_UE_AFSR_SYND_SHIFT		0
2140Sstevel@tonic-gate 
2150Sstevel@tonic-gate /*
2160Sstevel@tonic-gate  * schizo ECC CE AFSR bit definitions:
2170Sstevel@tonic-gate  */
2180Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_ERRPNDG		0x0300000000000000ull
2190Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MASK			0x000003ff00000000ull
2200Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MASK_SHIFT		32
2210Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_QW_OFFSET		0x00000000C0000000ull
2220Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_QW_OFFSET_SHIFT	30
2230Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_AGENT_MID		0x000000001f000000ull
2240Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_AGENT_MID_SHIFT	24
2250Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_PARTIAL		0x0000000000800000ull
2260Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_OWNED_IN		0x0000000000400000ull
2270Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MTAG_SYND		0x00000000000f0000ull
2280Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MTAG_SYND_SHIFT	16
2290Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MTAG			0x000000000000e000ull
2300Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_MTAG_SHIFT		13
2310Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_SYND			0x00000000000001ffull
2320Sstevel@tonic-gate #define	SCHIZO_ECC_CE_AFSR_SYND_SHIFT		0
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate /*
2350Sstevel@tonic-gate  * schizo ECC UE/CE AFAR bit definitions:
2360Sstevel@tonic-gate  */
2370Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_IO_TXN			0x0000080000000000ull
2380Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_MASK		0x0000078000000000ull
2390Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_UPA64S		0x0000078000000000ull
2400Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_NL_REG		0x0000040000000000ull
2410Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_NL			0x0000050000000000ull
2420Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_NL_ALT		0x0000051000000000ull
2430Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIA_REG		0x0000020000000000ull
2440Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIA_MEM		0x0000030000000000ull
2450Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIA_CFGIO		0x0000031000000000ull
2460Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIB_REG		0x0000000000000000ull
2470Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIB_MEM		0x0000010000000000ull
2480Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_PCIB_CFGIO		0x0000011000000000ull
2490Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_SAFARI_REGS	0x0000060000000000ull
2500Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_PIOW_ADDR_MASK		0x0000000fffffffffull
2510Sstevel@tonic-gate #define	SCHIZO_ECC_AFAR_ADDR_MASK		0x000007ffffffffffull
2520Sstevel@tonic-gate 
2530Sstevel@tonic-gate /*
2540Sstevel@tonic-gate  * schizo pci control register bits:
2550Sstevel@tonic-gate  */
2560Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_BUS_UNUSABLE		(1ull << 63)
2570Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_PCI_DTO_ERR		(1ull << 62)
2580Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_DTO_INT_EN		(1ull << 61)
2590Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ERR_SLOT_LOCK		(1ull << 51)
2600Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ERR_SLOT		(7ull << 48)
2610Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ERR_SLOT_SHIFT		48
2620Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_PCI_TTO_ERR		(1ull << 38)
2630Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_PCI_RTRY_ERR		(1ull << 37)
2640Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_PCI_MMU_ERR		(1ull << 36)
2650Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_PEN_RD_MLTPL		(1ull << 30)
2660Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_PEN_RD_ONE		(1ull << 29)
2670Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_PEN_RD_LINE		(1ull << 28)
2680Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_FRC_TRGT_ABRT	(1ull << 27)
2690Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_FRC_TRGT_RTRY	(1ull << 26)
2700Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_PTO			(3ull << 24)
2710Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_PTO_SHIFT		24
2720Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_TRGT_RW_STL_WT	(3ull << 21)
2730Sstevel@tonic-gate #define	TOMATILLO_PCI_CTRL_TRGT_RW_STL_WT_SHIFT	21
2740Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_MMU_INT_EN		(1ull << 19)
2750Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_SBH_INT_EN		(1ull << 18)
2760Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ERR_INT_EN		(1ull << 17)
2770Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ARB_PARK		(1ull << 16)
2780Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_RST			(1ull << 8)
2790Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_ARB_EN_MASK		0xffull
2800Sstevel@tonic-gate 
2810Sstevel@tonic-gate #define	XMITS10_PCI_CTRL_ARB_EN_MASK		0x0full
2820Sstevel@tonic-gate #define	XMITS_PCI_CTRL_X_MODE			(0x1ull << 32)
2830Sstevel@tonic-gate #define	XMITS_PCI_CTRL_X_ERRINT_EN		(0x1ull << 20)
2840Sstevel@tonic-gate #define	XMITS_PCI_CTRL_DMA_WR_PERR		(0x1ull << 51)
2850Sstevel@tonic-gate 
2860Sstevel@tonic-gate /*
2870Sstevel@tonic-gate  * schizo PCI asynchronous fault status register bit definitions:
2880Sstevel@tonic-gate  */
2890Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_PE_SHIFT		58
2900Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_SE_SHIFT		52
2910Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_MA			0x0000000000000020ull
2920Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_TA			0x0000000000000010ull
2930Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_RTRY			0x0000000000000008ull
2940Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_PERR			0x0000000000000004ull
2950Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_TTO			0x0000000000000002ull
2960Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_UNUSABLE		0x0000000000000001ull
2970Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_E_MASK			0x000000000000003full
2980Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_DWORDMASK		0x0000030000000000ull
2990Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_DWORDMASK_SHIFT		40
3000Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_BYTEMASK		0x000000ff00000000ull
3010Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_BYTEMASK_SHIFT		32
3020Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_BLK			0x0000000080000000ull
3030Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_CONF_SPACE		0x0000000040000000ull
3040Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_MEM_SPACE		0x0000000020000000ull
3050Sstevel@tonic-gate #define	SCHIZO_PCI_AFSR_IO_SPACE		0x0000000010000000ull
3060Sstevel@tonic-gate 
3070Sstevel@tonic-gate /* Schizo/Xmits control block Safari Error log bits */
3080Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_BAD_CMD			(0x1ull << 62)
3090Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_SSM_DIS			(0x1ull << 61)
3100Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_BAD_CMD_PCIA		(0x1ull << 60)
3110Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_BAD_CMD_PCIB		(0x1ull << 59)
3120Sstevel@tonic-gate #define	XMITS_CB_ELOG_PAR_ERR_INT_PCIB		(0x1ull << 19)
3130Sstevel@tonic-gate #define	XMITS_CB_ELOG_PAR_ERR_INT_PCIA		(0x1ull << 18)
3140Sstevel@tonic-gate #define	XMITS_CB_ELOG_PAR_ERR_INT_SAF		(0x1ull << 17)
3150Sstevel@tonic-gate #define	XMITS_CB_ELOG_PLL_ERR_PCIB		(0x1ull << 16)
3160Sstevel@tonic-gate #define	XMITS_CB_ELOG_PLL_ERR_PCIA		(0x1ull << 15)
3170Sstevel@tonic-gate #define	XMITS_CB_ELOG_PLL_ERR_SAF		(0x1ull << 14)
3180Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_CPU1_PAR_SINGLE		(0x1ull << 13)
3190Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_CPU1_PAR_BIDI		(0x1ull << 12)
3200Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_CPU0_PAR_SINGLE		(0x1ull << 11)
3210Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_CPU0_PAR_BIDI		(0x1ull << 10)
3220Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_SAF_CIQ_TO		(0x1ull << 9)
3230Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_SAF_LPQ_TO		(0x1ull << 8)
3240Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_SAF_SFPQ_TO		(0x1ull << 7)
3250Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_SAF_UFPQ_TO		(0x1ull << 6)
3260Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_ADDR_PAR_ERR		(0x1ull << 5)
3270Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_UNMAP_ERR		(0x1ull << 4)
3280Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_BUS_ERR			(0x1ull << 2)
3290Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_TO_ERR			(0x1ull << 1)
3300Sstevel@tonic-gate #define	SCHIZO_CB_ELOG_DSTAT_ERR		0x1ull
3310Sstevel@tonic-gate 
3320Sstevel@tonic-gate /* Used for the tomatillo micro tlb bug. errata #82 */
3330Sstevel@tonic-gate #define	SCHIZO_VPN_MASK			((1 << 19) - 1)
3340Sstevel@tonic-gate 
3350Sstevel@tonic-gate /* Tomatillo control block JBUS error log bits */
3360Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_GR		(0x1ull << 21)
3370Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_PCI		(0x1ull << 20)
3380Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_RD		(0x1ull << 19)
3390Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_RDS		(0x1ull << 17)
3400Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_RDSA	(0x1ull << 16)
3410Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_OWN		(0x1ull << 15)
3420Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR_RDO		(0x1ull << 14)
3430Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_WR_DATA_PAR_ERR	(0x1ull << 13)
3440Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_CTL_PAR_ERR		(0x1ull << 12)
3450Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_SNOOP_ERR		(0x1ull << 11)
3460Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_ILL_BYTE_EN		(0x1ull << 10)
3470Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_ILL_COH_IN		(0x1ull << 8)
3480Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_RD_DATA_PAR_ERR	(0x1ull << 6)
3490Sstevel@tonic-gate #define	TOMATILLO_CB_ELOG_TO_EXP_ERR		(0x1ull << 3)
3500Sstevel@tonic-gate 
3510Sstevel@tonic-gate /* Tomatillo control block JBUS control/status bits */
3520Sstevel@tonic-gate #define	TOMATILLO_CB_CSR_CTRL_PERR_GEN		(0x1ull << 29)
3530Sstevel@tonic-gate 
3540Sstevel@tonic-gate #define	XMITS_PCI_X_AFSR_P_SC_ERR		(0x1ull << 51)
3550Sstevel@tonic-gate #define	XMITS_PCI_X_AFSR_S_SC_ERR		(0x1ull << 50)
3560Sstevel@tonic-gate 
3570Sstevel@tonic-gate #define	XMITS_PCIX_MSG_CLASS_MASK		0xf00
3580Sstevel@tonic-gate #define	XMITS_PCIX_MSG_INDEX_MASK		0xff
3590Sstevel@tonic-gate #define	XMITS_PCIX_MSG_MASK	\
3600Sstevel@tonic-gate 		(XMITS_PCIX_MSG_CLASS_MASK | XMITS_PCIX_MSG_INDEX_MASK)
3610Sstevel@tonic-gate 
3620Sstevel@tonic-gate #define	XMITS_PCI_X_P_MSG_SHIFT			16
3630Sstevel@tonic-gate #define	XMITS_PCI_X_S_MSG_SHIFT			4
3640Sstevel@tonic-gate 
3650Sstevel@tonic-gate #define	PBM_AFSR_TO_PRIERR(afsr)	\
3660Sstevel@tonic-gate 	(afsr >> SCHIZO_PCI_AFSR_PE_SHIFT & SCHIZO_PCI_AFSR_E_MASK)
3670Sstevel@tonic-gate #define	PBM_AFSR_TO_SECERR(afsr)	\
3680Sstevel@tonic-gate 	(afsr >> SCHIZO_PCI_AFSR_SE_SHIFT & SCHIZO_PCI_AFSR_E_MASK)
3690Sstevel@tonic-gate #define	PBM_AFSR_TO_BYTEMASK(afsr)	\
3700Sstevel@tonic-gate 	((afsr & SCHIZO_PCI_AFSR_BYTEMASK) >> SCHIZO_PCI_AFSR_BYTEMASK_SHIFT)
3710Sstevel@tonic-gate #define	PBM_AFSR_TO_DWORDMASK(afsr)	\
3720Sstevel@tonic-gate 	((afsr & SCHIZO_PCI_AFSR_DWORDMASK) >>	\
3730Sstevel@tonic-gate 		SCHIZO_PCI_AFSR_DWORDMASK_SHIFT)
3740Sstevel@tonic-gate 
3750Sstevel@tonic-gate /*
3761295Sdanice  * XMITS Upper Retry Counter Register (bits 15:0)
3771295Sdanice  */
3781295Sdanice #define	XMITS_UPPER_RETRY_MASK			0xFFFF
3791295Sdanice 
3801295Sdanice /*
3810Sstevel@tonic-gate  * XMITS PCI-X Diagnostic Register bit definitions
3820Sstevel@tonic-gate  */
3830Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_DIS_FAIR		(0x1ull << 19)
3840Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_CRCQ_VALID		(0x1ull << 18)
3850Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_SRCQ_VALID_SHIFT	10
3860Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_SRCQ_ONE		(0x1ull << 9)
3870Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_CRCQ_FLUSH		(0x1ull << 8)
3880Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_SRCQ_FLUSH_SHIFT	0
3892358Sdanice #define	XMITS_PCI_X_DIAG_BUGCNTL_MASK		0xFFFF  /* bits 47:32 */
3902358Sdanice #define	XMITS_PCI_X_DIAG_BUGCNTL_SHIFT		32
3910Sstevel@tonic-gate 
3920Sstevel@tonic-gate #define	XMITS_PCI_X_DIAG_SRCQ_MASK		0xff
3930Sstevel@tonic-gate 
3940Sstevel@tonic-gate /*
3950Sstevel@tonic-gate  * XMITS PCI-X Error Status Register bit definitions
3960Sstevel@tonic-gate  */
3970Sstevel@tonic-gate 
3980Sstevel@tonic-gate #define	XMITS_PCI_X_STATUS_PE_SHIFT		58
3990Sstevel@tonic-gate #define	XMITS_PCI_X_STATUS_SE_SHIFT		50
4000Sstevel@tonic-gate #define	XMITS_PCI_X_STATUS_E_MASK		0x3f
4010Sstevel@tonic-gate #define	XMITS_PCI_X_STATUS_PFAR_MASK		0xffffffff
4020Sstevel@tonic-gate #define	XMITS_PCIX_STAT_SC_DSCRD		0x20ull
4030Sstevel@tonic-gate #define	XMITS_PCIX_STAT_SC_TTO			0x10ull
404*6026Sdanice /*
405*6026Sdanice  * As a workaround for an XMITS ASIC bug, the following PCI-X errors are
406*6026Sdanice  * assigned new bit positions within the PCI-X Error Status Register to
407*6026Sdanice  * match what is actually implemented in the XMITS ASIC:
408*6026Sdanice  *
409*6026Sdanice  *      			Spec		New
410*6026Sdanice  * Error			Bit Position	Bit Position
411*6026Sdanice  * --------------------		------------	------------
412*6026Sdanice  * XMITS_PCIX_STAT_SMMU		0x8ull		0x4ull
413*6026Sdanice  * XMITS_PCIX_STAT_SDSTAT	0x4ull		0x8ull
414*6026Sdanice  * XMITS_PCIX_STAT_CMMU		0x2ull		0x1ull
415*6026Sdanice  * XMITS_PCIX_STAT_CDSTAT	0x1ull		0x2ull
416*6026Sdanice  *
417*6026Sdanice  */
418*6026Sdanice #define	XMITS_PCIX_STAT_SMMU			0x4ull
419*6026Sdanice #define	XMITS_PCIX_STAT_SDSTAT			0x8ull
420*6026Sdanice #define	XMITS_PCIX_STAT_CMMU			0x1ull
421*6026Sdanice #define	XMITS_PCIX_STAT_CDSTAT			0x2ull
422*6026Sdanice 
4230Sstevel@tonic-gate #define	XMITS_PCIX_STAT_SERR_ON_PERR		(1ull << 32)
4240Sstevel@tonic-gate #define	XMITS_PCIX_STAT_PERR_RECOV_INT_EN	(1ull << 33)
4250Sstevel@tonic-gate #define	XMITS_PCIX_STAT_PERR_RECOV_INT		(1ull << 34)
4260Sstevel@tonic-gate 
4270Sstevel@tonic-gate /*
4280Sstevel@tonic-gate  * PCI-X Message Classes and Indexes
4290Sstevel@tonic-gate  */
4300Sstevel@tonic-gate #define	PCIX_CLASS_WRITE_COMPLETION		0x000
4310Sstevel@tonic-gate #define	PCIX_WRITE_COMPLETION_NORMAL		0x00
4320Sstevel@tonic-gate 
4330Sstevel@tonic-gate #define	PCIX_CLASS_BRIDGE			0x100
4340Sstevel@tonic-gate #define	PCIX_BRIDGE_MASTER_ABORT		0x00
4350Sstevel@tonic-gate #define	PCIX_BRIDGE_TARGET_ABORT		0x01
4360Sstevel@tonic-gate #define	PCIX_BRIDGE_WRITE_DATA_PARITY		0x02
4370Sstevel@tonic-gate 
4380Sstevel@tonic-gate #define	PCIX_CLASS_CPLT				0x200
4390Sstevel@tonic-gate #define	PCIX_CPLT_OUT_OF_RANGE			0x00
4400Sstevel@tonic-gate #define	PCIX_CPLT_SPLIT_WRITE_DATA		0x01
4410Sstevel@tonic-gate #define	XMITS_CPLT_NO_ERROR			0x80
4420Sstevel@tonic-gate #define	XMITS_CPLT_STREAM_DSTAT			0x81
4430Sstevel@tonic-gate #define	XMITS_CPLT_STREAM_MMU			0x82
4440Sstevel@tonic-gate #define	XMITS_CPLT_CONSIST_DSTAT		0x85
4450Sstevel@tonic-gate #define	XMITS_CPLT_CONSIST_MMU			0x86
4460Sstevel@tonic-gate 
4470Sstevel@tonic-gate #define	PCIX_NO_CLASS				0x999
4480Sstevel@tonic-gate #define	PCIX_MULTI_ERR	1
4490Sstevel@tonic-gate #define	PCIX_SINGLE_ERR	0
4500Sstevel@tonic-gate 
4510Sstevel@tonic-gate #define	PBM_PCIX_TO_PRIERR(pcix_stat)   \
4520Sstevel@tonic-gate 	(pcix_stat >> XMITS_PCI_X_STATUS_PE_SHIFT & XMITS_PCI_X_STATUS_E_MASK)
4530Sstevel@tonic-gate #define	PBM_PCIX_TO_SECERR(pcix_stat)   \
4540Sstevel@tonic-gate 	(pcix_stat >> XMITS_PCI_X_STATUS_SE_SHIFT & XMITS_PCI_X_STATUS_E_MASK)
4550Sstevel@tonic-gate #define	PBM_AFSR_TO_PRISPLIT(afsr)      \
4560Sstevel@tonic-gate 	((afsr >> XMITS_PCI_X_P_MSG_SHIFT) & XMITS_PCIX_MSG_MASK)
4570Sstevel@tonic-gate #define	PBM_AFSR_TO_SECSPLIT(afsr)      \
4580Sstevel@tonic-gate 	((afsr >> XMITS_PCI_X_S_MSG_SHIFT) & XMITS_PCIX_MSG_MASK)
4590Sstevel@tonic-gate 
4600Sstevel@tonic-gate #define	PCIX_ERRREG_OFFSET (XMITS_PCI_X_ERROR_STATUS_REG_OFFSET -\
4610Sstevel@tonic-gate 		SCHIZO_PCI_CTRL_REG_OFFSET)
4620Sstevel@tonic-gate 
4630Sstevel@tonic-gate /*
4640Sstevel@tonic-gate  * Nested message structure to allow for storing all the PCI-X
4650Sstevel@tonic-gate  * split completion messages in tabular form.
4660Sstevel@tonic-gate  */
4670Sstevel@tonic-gate typedef struct pcix_err_msg_rec {
4680Sstevel@tonic-gate 	uint32_t msg_key;
4690Sstevel@tonic-gate 	char	*msg_class;
4700Sstevel@tonic-gate 	char    *msg_str;
4710Sstevel@tonic-gate } pcix_err_msg_rec_t;
4720Sstevel@tonic-gate 
4730Sstevel@tonic-gate typedef struct pcix_err_tbl {
4740Sstevel@tonic-gate 	uint32_t err_class;
4750Sstevel@tonic-gate 	uint32_t err_rec_num;
4760Sstevel@tonic-gate 	pcix_err_msg_rec_t *err_msg_tbl;
4770Sstevel@tonic-gate } pcix_err_tbl_t;
4780Sstevel@tonic-gate 
4790Sstevel@tonic-gate 
4800Sstevel@tonic-gate /*
4810Sstevel@tonic-gate  * Tomatillo IO Cache CSR bit definitions:
4820Sstevel@tonic-gate  */
4830Sstevel@tonic-gate 
4840Sstevel@tonic-gate #define	TOMATILLO_WRT_PEN		(1ull << 19)
4850Sstevel@tonic-gate #define	TOMATILLO_NC_PEN_RD_MLTPL	(1ull << 18)
4860Sstevel@tonic-gate #define	TOMATILLO_NC_PEN_RD_ONE		(1ull << 17)
4870Sstevel@tonic-gate #define	TOMATILLO_NC_PEN_RD_LINE	(1ull << 16)
4880Sstevel@tonic-gate #define	TOMATILLO_PLEN_RD_MTLPL		(3ull << 14)
4890Sstevel@tonic-gate #define	TOMATILLO_PLEN_RD_ONE		(3ull << 12)
4900Sstevel@tonic-gate #define	TOMATILLO_PLEN_RD_LINE		(3ull << 10)
4910Sstevel@tonic-gate #define	TOMATILLO_POFFSET_SHIFT		3
4920Sstevel@tonic-gate #define	TOMATILLO_POFFSET		(0x7full << TOMATILLO_POFFSET_SHIFT)
4930Sstevel@tonic-gate #define	TOMATILLO_C_PEN_RD_MLTPL	(1ull << 2)
4940Sstevel@tonic-gate #define	TOMATILLO_C_PEN_RD_ONE		(1ull << 1)
4950Sstevel@tonic-gate #define	TOMATILLO_C_PEN_RD_LINE		(1ull << 0)
4960Sstevel@tonic-gate 
4970Sstevel@tonic-gate /*
4980Sstevel@tonic-gate  * schizo PCI diagnostic register bit definitions:
4990Sstevel@tonic-gate  */
5000Sstevel@tonic-gate #define	SCHIZO_PCI_DIAG_DIS_RTRY_ARB		0x0000000000000080ull
5010Sstevel@tonic-gate 
5020Sstevel@tonic-gate /*
5030Sstevel@tonic-gate  * schizo IOMMU TLB TAG diagnostic register bits
5040Sstevel@tonic-gate  */
5050Sstevel@tonic-gate #define	TLBTAG_CONTEXT_SHIFT		25
5060Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_SHIFT		23
5070Sstevel@tonic-gate #define	TLBTAG_CONTEXT_BITS		(0xfffull << TLBTAG_CONTEXT_SHIFT)
5080Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_BITS		(0x3ull << TLBTAG_ERRSTAT_SHIFT)
5090Sstevel@tonic-gate #define	TLBTAG_ERR_BIT			(0x1ull << 22)
5100Sstevel@tonic-gate #define	TLBTAG_WRITABLE_BIT		(0x1ull << 21)
5110Sstevel@tonic-gate #define	TLBTAG_STREAM_BIT		(0x1ull << 20)
5120Sstevel@tonic-gate #define	TLBTAG_PGSIZE_BIT		(0x1ull << 19)
5130Sstevel@tonic-gate #define	TLBTAG_PCIVPN_BITS		0x7ffffull
5140Sstevel@tonic-gate 
5150Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_PROT		0
5160Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_INVALID		1
5170Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_TIMEOUT		2
5180Sstevel@tonic-gate #define	TLBTAG_ERRSTAT_ECCUE		3
5190Sstevel@tonic-gate 
5200Sstevel@tonic-gate /*
5210Sstevel@tonic-gate  * schizo IOMMU TLB Data RAM diagnostic register bits
5220Sstevel@tonic-gate  */
5230Sstevel@tonic-gate #define	TLBDATA_VALID_BIT			(0x1ull << 32)
5240Sstevel@tonic-gate #define	TLBDATA_CACHE_BIT			(0x1ull << 30)
5250Sstevel@tonic-gate #define	TLBDATA_MEMPA_BITS			((0x1ull << 30) - 1)
5260Sstevel@tonic-gate 
5270Sstevel@tonic-gate extern uint_t cb_buserr_intr(caddr_t a);
5280Sstevel@tonic-gate 
5290Sstevel@tonic-gate /*
5300Sstevel@tonic-gate  * pbm_cdma_flag(schizo only): consistent dma sync handshake
5310Sstevel@tonic-gate  */
5320Sstevel@tonic-gate #define	PBM_CDMA_DONE	0xcc /* arbitrary pattern set by interrupt handler */
5330Sstevel@tonic-gate #define	PBM_CDMA_PEND	0x55 /* arbitrary pattern set by sync requester */
5340Sstevel@tonic-gate #define	PBM_CDMA_INO_BASE	0x35    /* ino can be used for cdma sync */
5350Sstevel@tonic-gate 
5360Sstevel@tonic-gate /*
5370Sstevel@tonic-gate  * Estar control bit for schizo estar reg
5380Sstevel@tonic-gate  */
5390Sstevel@tonic-gate #define	SCHIZO_PCI_CTRL_BUS_SPEED		0x0000000000000001ull
5400Sstevel@tonic-gate 
5410Sstevel@tonic-gate #define	PCI_CMN_ID(chip_type, id) \
5420Sstevel@tonic-gate 	((chip_type) == PCI_CHIP_TOMATILLO ? ((id) >> 1) << 1 : (id))
5430Sstevel@tonic-gate #define	PCI_ID_TO_IGN(pci_id)		((pci_ign_t)((pci_id) & 0x1f))
5440Sstevel@tonic-gate #define	PCI_ID_TO_NODEID(pci_id)	((cb_nid_t)((pci_id) >> PCI_IGN_BITS))
5450Sstevel@tonic-gate 
5460Sstevel@tonic-gate #define	PCI_BRIDGE_TYPE(cmn_p) \
5470Sstevel@tonic-gate 	(((cmn_p->pci_chip_id >> 16) == PCI_CHIP_SCHIZO) ? PCI_SCHIZO : \
5480Sstevel@tonic-gate 	((cmn_p->pci_chip_id >> 16) == PCI_CHIP_TOMATILLO) ? PCI_TOMATILLO : \
5490Sstevel@tonic-gate 	((cmn_p->pci_chip_id >> 16) == PCI_CHIP_XMITS) ? PCI_XMITS : "")
5500Sstevel@tonic-gate /*
5510Sstevel@tonic-gate  * Tomatillo only
5520Sstevel@tonic-gate  */
5530Sstevel@tonic-gate #define	NBIGN(ib_p)			((ib_p)->ib_ign ^ 1)
5540Sstevel@tonic-gate #define	IB_INO_TO_NBMONDO(ib_p, ino)	IB_IGN_TO_MONDO(NBIGN(ib_p), ino)
5550Sstevel@tonic-gate 
5560Sstevel@tonic-gate /*
5570Sstevel@tonic-gate  * Mask to tell which PCI Side we are on
5580Sstevel@tonic-gate  */
5590Sstevel@tonic-gate #define	PCI_SIDE_ADDR_MASK			0x100000ull
5600Sstevel@tonic-gate 
5610Sstevel@tonic-gate /*
5620Sstevel@tonic-gate  * Offset from Schizo Base of Schizo CSR Base
5630Sstevel@tonic-gate  */
5640Sstevel@tonic-gate #define	PBM_CTRL_OFFSET				0x410000ull
5650Sstevel@tonic-gate 
5662050Ssuha /*
5672050Ssuha  * The following macro defines the 42-bit bus width support for SAFARI bus
5682050Ssuha  * and JBUS in DVMA and iommu bypass transfers:
5692050Ssuha  */
5702050Ssuha 
5712050Ssuha #define	SAFARI_JBUS_IOMMU_BYPASS_END		0xFFFC03FFFFFFFFFFull
5722050Ssuha 
5730Sstevel@tonic-gate #ifdef	__cplusplus
5740Sstevel@tonic-gate }
5750Sstevel@tonic-gate #endif
5760Sstevel@tonic-gate 
5770Sstevel@tonic-gate #endif	/* _SYS_PCISCH_H */
578