xref: /titanic_50/usr/src/uts/intel/io/intel_nb5000/nb5000.h (revision ee63a9c96aceb3724cf0ee9b2e586b0dce3908a2)
1e4b86885SCheng Sean Ye /*
2e4b86885SCheng Sean Ye  * CDDL HEADER START
3e4b86885SCheng Sean Ye  *
4e4b86885SCheng Sean Ye  * The contents of this file are subject to the terms of the
5e4b86885SCheng Sean Ye  * Common Development and Distribution License (the "License").
6e4b86885SCheng Sean Ye  * You may not use this file except in compliance with the License.
7e4b86885SCheng Sean Ye  *
8e4b86885SCheng Sean Ye  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9e4b86885SCheng Sean Ye  * or http://www.opensolaris.org/os/licensing.
10e4b86885SCheng Sean Ye  * See the License for the specific language governing permissions
11e4b86885SCheng Sean Ye  * and limitations under the License.
12e4b86885SCheng Sean Ye  *
13e4b86885SCheng Sean Ye  * When distributing Covered Code, include this CDDL HEADER in each
14e4b86885SCheng Sean Ye  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15e4b86885SCheng Sean Ye  * If applicable, add the following below this CDDL HEADER, with the
16e4b86885SCheng Sean Ye  * fields enclosed by brackets "[]" replaced with your own identifying
17e4b86885SCheng Sean Ye  * information: Portions Copyright [yyyy] [name of copyright owner]
18e4b86885SCheng Sean Ye  *
19e4b86885SCheng Sean Ye  * CDDL HEADER END
20e4b86885SCheng Sean Ye  */
21e4b86885SCheng Sean Ye 
22e4b86885SCheng Sean Ye /*
239ff4cbe7SAdrian Frost  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24e4b86885SCheng Sean Ye  * Use is subject to license terms.
25e4b86885SCheng Sean Ye  */
26e4b86885SCheng Sean Ye 
27e4b86885SCheng Sean Ye #ifndef _NB5000_H
28e4b86885SCheng Sean Ye #define	_NB5000_H
29e4b86885SCheng Sean Ye 
30e4b86885SCheng Sean Ye #ifdef __cplusplus
31e4b86885SCheng Sean Ye extern "C" {
32e4b86885SCheng Sean Ye #endif
33e4b86885SCheng Sean Ye 
34e4b86885SCheng Sean Ye #include <sys/cpu_module.h>
35e4b86885SCheng Sean Ye 
36e4b86885SCheng Sean Ye #define	NB_5000_MAX_MEM_CONTROLLERS	2
3785738508SVuong Nguyen #define	NB_MAX_DIMMS_PER_CHANNEL	(nb_chipset == INTEL_NB_5100 ? 3 : \
3885738508SVuong Nguyen 	(nb_chipset == INTEL_NB_7300 ? 8 : 4))
3985738508SVuong Nguyen #define	NB_MAX_CHANNELS_PER_BRANCH	2
4085738508SVuong Nguyen #define	NB_5100_RANKS_PER_CHANNEL	6
4185738508SVuong Nguyen #define	NB_MEM_BRANCH_SELECT \
4285738508SVuong Nguyen 	(nb_chipset == INTEL_NB_5400 || nb_chipset == INTEL_NB_5100 ? 2 : 3)
43e4b86885SCheng Sean Ye #define	NB_MAX_MEM_BRANCH_SELECT	3
44e4b86885SCheng Sean Ye #define	NB_MEM_RANK_SELECT		(nb_chipset == INTEL_NB_7300 ? 7 : 5)
45e4b86885SCheng Sean Ye #define	NB_MAX_MEM_RANK_SELECT		7
46e4b86885SCheng Sean Ye #define	NB_RANKS_IN_SELECT		4
47e4b86885SCheng Sean Ye #define	NB_PCI_DEV			10
48e4b86885SCheng Sean Ye 
49e4b86885SCheng Sean Ye #define	NB_PCI_NFUNC	4
50e4b86885SCheng Sean Ye 
51e4b86885SCheng Sean Ye #define	DOCMD_PEX_MASK	0x00
52e4b86885SCheng Sean Ye #define	DOCMD_5400_PEX_MASK	0x000
53e4b86885SCheng Sean Ye #define	DOCMD_PEX	0xf0
54e4b86885SCheng Sean Ye #define	DOCMD_5400_PEX	0xff0
55e4b86885SCheng Sean Ye 
56e4b86885SCheng Sean Ye #define	SPD_BUSY	0x1000
57e4b86885SCheng Sean Ye #define	SPD_BUS_ERROR	0x2000
58e4b86885SCheng Sean Ye #define	SPD_READ_DATA_VALID	0x8000
59e4b86885SCheng Sean Ye #define	SPD_EEPROM_WRITE	0xa8000000
60e4b86885SCheng Sean Ye #define	SPD_ADDR(slave, addr) ((((slave) & 7) << 24) | (((addr) & 0xff) << 16))
61e4b86885SCheng Sean Ye 
62e4b86885SCheng Sean Ye #define	MC_MIRROR	0x10000
63e4b86885SCheng Sean Ye #define	MC_PATROL_SCRUB	0x80
64e4b86885SCheng Sean Ye #define	MC_DEMAND_SCRUB	0x40
65e4b86885SCheng Sean Ye 
66e4b86885SCheng Sean Ye #define	MCA_SCHDIMM	0x4000
67e4b86885SCheng Sean Ye 
68e4b86885SCheng Sean Ye #define	TLOW_MAX	0x100000000ULL
69e4b86885SCheng Sean Ye 
70e4b86885SCheng Sean Ye #define	MTR_PRESENT(mtr) \
71*ee63a9c9SRichard Lowe 	(((mtr) & (nb_chipset == INTEL_NB_5400 || nb_chipset == INTEL_NB_5100) \
72*ee63a9c9SRichard Lowe 	? 0x0400 : 0x0100) != 0)
73e4b86885SCheng Sean Ye #define	MTR_ETHROTTLE(mtr) \
7485738508SVuong Nguyen 	((mtr) & (nb_chipset == INTEL_NB_5400 || nb_chipset == INTEL_NB_5100 ? \
7585738508SVuong Nguyen 	? 0x0200 : 0x0080))
76e4b86885SCheng Sean Ye #define	MTR_WIDTH(mtr) \
7785738508SVuong Nguyen 	((mtr) & (nb_chipset == INTEL_NB_5400 || nb_chipset == INTEL_NB_5100 ? \
7885738508SVuong Nguyen 	0x0100 : 0x0040) ? 8 : 4)
79e4b86885SCheng Sean Ye #define	MTR_NUMBANK(mtr) \
8085738508SVuong Nguyen 	((mtr) & (nb_chipset == INTEL_NB_5400 || nb_chipset == INTEL_NB_5100 ? \
8185738508SVuong Nguyen 	0x0040 : 0x0020) ? 8 : 4)
8285738508SVuong Nguyen #define	MTR_NUMRANK(mtr) (nb_chipset == INTEL_NB_5100 ? 1 : \
8385738508SVuong Nguyen 	(((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0020 : 0x0010)) ? 2 : 1))
84e4b86885SCheng Sean Ye #define	MTR_NUMROW(mtr) ((((mtr) >> 2) & 3) + 13)
85e4b86885SCheng Sean Ye #define	MTR_NUMCOL(mtr) (((mtr) & 3) + 10)
86e4b86885SCheng Sean Ye 
87e4b86885SCheng Sean Ye #define	MTR_DIMMSIZE(mtr) 	((1ULL << (MTR_NUMCOL(mtr) + MTR_NUMROW(mtr))) \
88e4b86885SCheng Sean Ye 	* MTR_NUMRANK(mtr) * MTR_NUMBANK(mtr) * MTR_WIDTH(mtr))
8985738508SVuong Nguyen #define	DIMMSIZE(nrow, ncol, nrank, nbank, width) \
9085738508SVuong Nguyen 	((1ULL << ((ncol) + (nrow))) * (nrank) * (nbank) * (width))
9185738508SVuong Nguyen #define	MTR_DDR2_DIMMSIZE(mtr, nrank) \
9285738508SVuong Nguyen 	((1ULL << (MTR_NUMCOL(mtr) + MTR_NUMROW(mtr))) \
9385738508SVuong Nguyen 	* (nrank) * MTR_NUMBANK(mtr) * MTR_WIDTH(mtr))
94e4b86885SCheng Sean Ye 
95e4b86885SCheng Sean Ye /* FERR_GLOBAL and NERR_GLOBAL */
96e4b86885SCheng Sean Ye #define	GE_FERR_FSB3_FATAL	0x800000000ULL	/* FSB3 Fatal Error */
97e4b86885SCheng Sean Ye #define	GE_FERR_FSB2_FATAL	0x400000000ULL	/* FSB2 Fatal Error */
98e4b86885SCheng Sean Ye #define	GE_FERR_FSB3_NF	0x200000000ULL	/* FSB3 Non-Fatal Error */
99e4b86885SCheng Sean Ye #define	GE_FERR_FSB2_NF	0x100000000ULL	/* FSB2 Non-Fatal Error */
100e4b86885SCheng Sean Ye 
101e4b86885SCheng Sean Ye #define	GE_INT_FATAL	0x80000000	/* North Bridge Internal Error */
102e4b86885SCheng Sean Ye #define	GE_DMA_FATAL	0x40000000	/* DMA engine Fatal Error */
103e4b86885SCheng Sean Ye #define	GE_FSB1_FATAL	0x20000000	/* FSB1 Fatal Error */
104e4b86885SCheng Sean Ye #define	GE_FSB0_FATAL	0x10000000	/* FSB0 Fatal Error */
105e4b86885SCheng Sean Ye #define	GE_FERR_FBD_FATAL	0x08000000	/* FBD channel Fatal Error */
106e4b86885SCheng Sean Ye #define	GE_FERR_FBD3_FATAL	0x08000000	/* FBD3 channel Fatal Error */
107e4b86885SCheng Sean Ye #define	GE_FERR_FBD2_FATAL	0x04000000	/* FBD2 channel Fatal Error */
108e4b86885SCheng Sean Ye #define	GE_FERR_FBD1_FATAL	0x02000000	/* FBD1 channel Fatal Error */
109e4b86885SCheng Sean Ye #define	GE_FERR_FBD0_FATAL	0x01000000	/* FBD0 channel Fatal Error */
110e4b86885SCheng Sean Ye #define	GE_FERR_THERMAL_FATAL	0x04000000	/* Thermal Fatal Error */
111e4b86885SCheng Sean Ye #define	GE_PCIEX9_FATAL	0x02000000	/* PCI Express device 9 Fatal Error */
112e4b86885SCheng Sean Ye #define	GE_PCIEX8_FATAL	0x01000000	/* PCI Express device 8 Fatal Error */
113e4b86885SCheng Sean Ye #define	GE_PCIEX7_FATAL	0x00800000	/* PCI Express device 7 Fatal Error */
114e4b86885SCheng Sean Ye #define	GE_PCIEX6_FATAL	0x00400000	/* PCI Express device 6 Fatal Error */
115e4b86885SCheng Sean Ye #define	GE_PCIEX5_FATAL	0x00200000	/* PCI Express device 5 Fatal Error */
116e4b86885SCheng Sean Ye #define	GE_PCIEX4_FATAL	0x00100000	/* PCI Express device 4 Fatal Error */
117e4b86885SCheng Sean Ye #define	GE_PCIEX3_FATAL	0x00080000	/* PCI Express device 3 Fatal Error */
118e4b86885SCheng Sean Ye #define	GE_PCIEX2_FATAL	0x00040000	/* PCI Express device 2 Fatal Error */
119e4b86885SCheng Sean Ye #define	GE_PCIEX1_FATAL	0x00020000	/* PCI Express device 1 Fatal Error */
120e4b86885SCheng Sean Ye #define	GE_ESI_FATAL	0x00010000	/* ESI Fatal Error */
121e4b86885SCheng Sean Ye #define	GE_INT_NF	0x00008000	/* North Bridge Internal Error */
122e4b86885SCheng Sean Ye #define	GE_DMA_NF	0x00004000	/* DMA engine Non-Fatal Error */
123e4b86885SCheng Sean Ye #define	GE_FSB1_NF	0x00002000	/* FSB1 Non-Fatal Error */
124e4b86885SCheng Sean Ye #define	GE_FSB0_NF	0x00001000	/* FSB0 Non-Fatal Error */
125e4b86885SCheng Sean Ye #define	GE_FERR_FBD3_NF	0x00000800	/* FBD channel 3 Non-Fatal Error */
126e4b86885SCheng Sean Ye #define	GE_FERR_FBD2_NF	0x00000400	/* FBD channel 2 Non-Fatal Error */
127e4b86885SCheng Sean Ye #define	GE_FERR_FBD1_NF	0x00000200	/* FBD channel 1 Non-Fatal Error */
128e4b86885SCheng Sean Ye #define	GE_FERR_FBD0_NF	0x00000100	/* FBD channel 0 Non-Fatal Error */
129e4b86885SCheng Sean Ye #define	GE_FERR_FBD_NF	0x00000800	/* FBD channel Non-Fatal Error */
13085738508SVuong Nguyen #define	GE_FERR_MEM1_NF	0x00000200	/* DDR channel 1 Non-Fatal Error */
13185738508SVuong Nguyen #define	GE_FERR_MEM0_NF	0x00000100	/* DDR channel 0 Non-Fatal Error */
132e4b86885SCheng Sean Ye #define	GE_FERR_THERMAL_NF 0x00000400	/* Thermal Non-Fatal Error */
133e4b86885SCheng Sean Ye #define	GE_PCIEX9_NF	0x00000200	/* PCI Express dev 9 Non-Fatal Error */
134e4b86885SCheng Sean Ye #define	GE_PCIEX8_NF	0x00000100	/* PCI Express dev 8 Non-Fatal Error */
135e4b86885SCheng Sean Ye #define	GE_PCIEX7_NF	0x00000080	/* PCI Express dev 7 Non-Fatal Error */
136e4b86885SCheng Sean Ye #define	GE_PCIEX6_NF	0x00000040	/* PCI Express dev 6 Non-Fatal Error */
137e4b86885SCheng Sean Ye #define	GE_PCIEX5_NF	0x00000020	/* PCI Express dev 5 Non-Fatal Error */
138e4b86885SCheng Sean Ye #define	GE_PCIEX4_NF	0x00000010	/* PCI Express dev 4 Non-Fatal Error */
139e4b86885SCheng Sean Ye #define	GE_PCIEX3_NF	0x00000008	/* PCI Express dev 3 Non-Fatal Error */
140e4b86885SCheng Sean Ye #define	GE_PCIEX2_NF	0x00000004	/* PCI Express dev 2 Non-Fatal Error */
141e4b86885SCheng Sean Ye #define	GE_PCIEX1_NF	0x00000002	/* PCI Express dev 1 Non-Fatal Error */
142e4b86885SCheng Sean Ye #define	GE_ESI_NF	0x00000001	/* ESI Non-Fatal Error */
143e4b86885SCheng Sean Ye 
144e4b86885SCheng Sean Ye #define	GE_NERR_FSB2_FATAL	0x08000000 /* FSB2 Fatal Error */
145e4b86885SCheng Sean Ye #define	GE_NERR_FSB3_FATAL	0x04000000 /* FSB3 Fatal Error */
14685738508SVuong Nguyen #define	GE_NERR_FBD_FATAL	(nb_chipset == INTEL_NB_5100 ? 0 : 0x01000000)
14785738508SVuong Nguyen 					/* FBD channel Fatal Error */
148e4b86885SCheng Sean Ye #define	GE_NERR_FSB2_NF		0x00000800 /* FSB2 Non-Fatal Error */
149e4b86885SCheng Sean Ye #define	GE_NERR_FSB3_NF		0x00000400 /* FSB3 Non-Fatal Error */
15085738508SVuong Nguyen #define	GE_NERR_FBD_NF		(nb_chipset == INTEL_NB_5100 ? 0 : 0x00000100)
15185738508SVuong Nguyen 					/* FBD channel Non-Fatal Error */
15285738508SVuong Nguyen #define	GE_NERR_MEM_NF		(nb_chipset == INTEL_NB_5100 ? 0x00000100 : 0)
15385738508SVuong Nguyen 					/* DDR channel0,1 Non-Fatal Error */
154e4b86885SCheng Sean Ye #define	ERR_FAT_FSB_F9		0x20	/* F9Msk FSB Protocol */
155e4b86885SCheng Sean Ye #define	ERR_FAT_FSB_F2		0x08	/* F2Msk Unsupported Bus Transaction */
156e4b86885SCheng Sean Ye #define	ERR_FAT_FSB_F1		0x01 	/* F1Msk Request/Address Parity */
157e4b86885SCheng Sean Ye 
158e4b86885SCheng Sean Ye #define	ERR_NF_FSB_F7		0x04	/* F7Msk Detected MCERR */
159e4b86885SCheng Sean Ye #define	ERR_NF_FSB_F8		0x02	/* F8Msk B-INIT */
160e4b86885SCheng Sean Ye #define	ERR_NF_FSB_F6		0x01	/* F6Msk Data Parity */
161e4b86885SCheng Sean Ye 
162e4b86885SCheng Sean Ye #define	EMASK_FSB_F1		0x0001 	/* F1Msk Request/Address Parity */
163e4b86885SCheng Sean Ye #define	EMASK_FSB_F2		0x0002	/* F2Msk Unsupported Bus Transaction */
164e4b86885SCheng Sean Ye #define	EMASK_FSB_F6		0x0020	/* F6Msk Data Parity */
165e4b86885SCheng Sean Ye #define	EMASK_FSB_F7		0x0040	/* F7Msk Detected MCERR */
166e4b86885SCheng Sean Ye #define	EMASK_FSB_F8		0x0080	/* F8Msk B-INIT */
167e4b86885SCheng Sean Ye #define	EMASK_FSB_F9		0x0100	/* F9Msk FSB Protocol */
168e4b86885SCheng Sean Ye 
169e4b86885SCheng Sean Ye #define	EMASK_FSB_FATAL		(EMASK_FSB_F1 | EMASK_FSB_F2 | EMASK_FSB_F9)
170e4b86885SCheng Sean Ye #define	EMASK_FSB_NF		(EMASK_FSB_F6 | EMASK_FSB_F7 | EMASK_FSB_F8)
171e4b86885SCheng Sean Ye 
172e4b86885SCheng Sean Ye #define	ERR_FBD_CH_SHIFT	28 /* channel index in fat_fbd and nf_fbd */
173e4b86885SCheng Sean Ye 
174e4b86885SCheng Sean Ye #define	ERR_FAT_FBD_M23	0x00400000	/* M23Err Non-Redundant Fast Reset */
175e4b86885SCheng Sean Ye 					/* Timeout */
176e4b86885SCheng Sean Ye #define	ERR_FAT_FBD_M3	0x00000004	/* M3Err >Tmid thermal event with */
177e4b86885SCheng Sean Ye 					/* intelligent throttling disabled */
178e4b86885SCheng Sean Ye #define	ERR_FAT_FBD_M2	0x00000002	/* M2Err memory or FBD configuration */
179e4b86885SCheng Sean Ye 					/* CRC read error */
180e4b86885SCheng Sean Ye #define	ERR_FAT_FBD_M1	0x00000001	/* M1Err memory write error on */
181e4b86885SCheng Sean Ye 					/* non-redundant retry or FBD */
182e4b86885SCheng Sean Ye 					/* configuration write error on retry */
183e4b86885SCheng Sean Ye #define	ERR_FAT_FBD_MASK 0x007fffff
184e4b86885SCheng Sean Ye 
185e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M29	0x02000000	/* M29Err DIMM-Isolation Completed */
186e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M28	0x01000000	/* M28Err DIMM-Spare Copy Completed */
187e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M27	0x00800000	/* M27Err DIMM-Spare Copy Initiated */
188e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M26	0x00400000	/* M26Err Redundant Fast Reset */
189e4b86885SCheng Sean Ye 					/* Timeout */
190e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M25	0x00200000	/* M25Err Memory write error on */
191e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M24	0x00100000	/* M24Err refresh error */
192e4b86885SCheng Sean Ye 					/* redundant retry */
193e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M22	0x00040000	/* M22Err SPD protocol */
194e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M21	0x00020000	/* M21Err FBD Northbound parity on */
195e4b86885SCheng Sean Ye 					/* FBD sync status */
196e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M20	0x00010000	/* M20Err Correctable patrol data ECC */
197e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M19	0x00008000	/* M19Err Correctasble resilver or */
198e4b86885SCheng Sean Ye 					/* spare-copy data ECC */
199e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M18	0x00004000	/* M18Err Correctable Mirrored demand */
200e4b86885SCheng Sean Ye 					/* data ECC */
201e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M17	0x00002000	/* M17Err Correctable Non-mirrored */
202e4b86885SCheng Sean Ye 					/* demand data ECC */
203e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M16	0x00001000	/* M16Err channel failed over */
204e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M15	0x00000800	/* M15Err Memory or FBD configuration */
205e4b86885SCheng Sean Ye 					/* CRC read error */
206e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M14	0x00000400	/* M14Err FBD configuration write */
207e4b86885SCheng Sean Ye 					/* error on first attempt */
208e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M13	0x00000200	/* M13Err Memory write error on first */
209e4b86885SCheng Sean Ye 					/* attempt */
210e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M12	0x00000100	/* M12Err Non-Aliased uncorrectable */
211e4b86885SCheng Sean Ye 					/* patrol data ECC */
212e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M11	0x00000080	/* M11Err Non-Aliased uncorrectable */
213e4b86885SCheng Sean Ye 					/* resilver or spare copy data ECC */
214e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M10	0x00000040	/* M10Err Non-Aliased uncorrectable */
215e4b86885SCheng Sean Ye 					/* mirrored demand data ECC */
216e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M9	0x00000020	/* M9Err Non-Aliased uncorrectable */
217e4b86885SCheng Sean Ye 					/* non-mirrored demand data ECC */
218e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M8	0x00000010	/* M8Err Aliased uncorrectable */
219e4b86885SCheng Sean Ye 					/* patrol data ECC */
220e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M7	0x00000008	/* M7Err Aliased uncorrectable */
221e4b86885SCheng Sean Ye 					/* resilver or spare copy data ECC */
222e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M6	0x00000004	/* M6Err Aliased uncorrectable */
223e4b86885SCheng Sean Ye 					/* mirrored demand data ECC */
224e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M5	0x00000002	/* M5Err Aliased uncorrectable */
225e4b86885SCheng Sean Ye 					/* non-mirrored demand data ECC */
226e4b86885SCheng Sean Ye #define	ERR_NF_FBD_M4	0x00000001	/* M4Err uncorrectable data ECC on */
227e4b86885SCheng Sean Ye 					/* replay */
228e4b86885SCheng Sean Ye 
229339f53f3SVuong Nguyen #define	ERR_DEFAULT_NF_FBD_MASK	0x01ffffff
230339f53f3SVuong Nguyen #define	ERR_5000_NF_FBD_MASK	(ERR_NF_FBD_M28|ERR_NF_FBD_M27|ERR_NF_FBD_M22| \
231339f53f3SVuong Nguyen     ERR_NF_FBD_M21|ERR_NF_FBD_M20|ERR_NF_FBD_M19|ERR_NF_FBD_M18| \
232339f53f3SVuong Nguyen     ERR_NF_FBD_M17|ERR_NF_FBD_M15|ERR_NF_FBD_M14|ERR_NF_FBD_M13| \
233339f53f3SVuong Nguyen     ERR_NF_FBD_M12|ERR_NF_FBD_M11|ERR_NF_FBD_M10|ERR_NF_FBD_M9|ERR_NF_FBD_M8| \
234339f53f3SVuong Nguyen     ERR_NF_FBD_M7|ERR_NF_FBD_M6|ERR_NF_FBD_M5|ERR_NF_FBD_M4)
235339f53f3SVuong Nguyen #define	ERR_5400_NF_FBD_MASK	(ERR_NF_FBD_M29|ERR_NF_FBD_M28|ERR_NF_FBD_M27| \
236339f53f3SVuong Nguyen     ERR_NF_FBD_M26|ERR_NF_FBD_M25|ERR_NF_FBD_M24|ERR_NF_FBD_M22| \
237339f53f3SVuong Nguyen     ERR_NF_FBD_M21|ERR_NF_FBD_M20|ERR_NF_FBD_M19|ERR_NF_FBD_M18| \
238339f53f3SVuong Nguyen     ERR_NF_FBD_M17|ERR_NF_FBD_M16|ERR_NF_FBD_M15|ERR_NF_FBD_M14| \
239339f53f3SVuong Nguyen     ERR_NF_FBD_M13|ERR_NF_FBD_M12|ERR_NF_FBD_M11|ERR_NF_FBD_M10| \
240339f53f3SVuong Nguyen     ERR_NF_FBD_M9|ERR_NF_FBD_M8|ERR_NF_FBD_M7|ERR_NF_FBD_M6|ERR_NF_FBD_M5| \
241339f53f3SVuong Nguyen     ERR_NF_FBD_M4)
242339f53f3SVuong Nguyen #define	ERR_7300_NF_FBD_MASK	(ERR_NF_FBD_M28|ERR_NF_FBD_M27|ERR_NF_FBD_M26| \
243339f53f3SVuong Nguyen     ERR_NF_FBD_M25|ERR_NF_FBD_M22|ERR_NF_FBD_M21|ERR_NF_FBD_M20| \
244339f53f3SVuong Nguyen     ERR_NF_FBD_M19|ERR_NF_FBD_M18|ERR_NF_FBD_M17|ERR_NF_FBD_M15| \
245339f53f3SVuong Nguyen     ERR_NF_FBD_M14|ERR_NF_FBD_M13|ERR_NF_FBD_M12|ERR_NF_FBD_M11| \
246339f53f3SVuong Nguyen     ERR_NF_FBD_M10|ERR_NF_FBD_M9|ERR_NF_FBD_M8|ERR_NF_FBD_M7|ERR_NF_FBD_M6| \
247339f53f3SVuong Nguyen     ERR_NF_FBD_M5|ERR_NF_FBD_M4)
248339f53f3SVuong Nguyen 
249339f53f3SVuong Nguyen /* Bitmask of the FB-DIMM non-fatal errors */
250339f53f3SVuong Nguyen #define	ERR_NF_FBD_MASK ( \
251339f53f3SVuong Nguyen 	(nb_chipset == INTEL_NB_5000P || nb_chipset == INTEL_NB_5000V || \
252339f53f3SVuong Nguyen 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000Z) ? \
253339f53f3SVuong Nguyen 	ERR_5000_NF_FBD_MASK : \
254339f53f3SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? ERR_5400_NF_FBD_MASK : \
255339f53f3SVuong Nguyen 	nb_chipset == INTEL_NB_7300 ? ERR_7300_NF_FBD_MASK : \
256339f53f3SVuong Nguyen 	ERR_DEFAULT_NF_FBD_MASK)
257339f53f3SVuong Nguyen 
258e4b86885SCheng Sean Ye #define	ERR_NF_FBD_ECC_UE	(ERR_NF_FBD_M12|ERR_NF_FBD_M11|ERR_NF_FBD_M10| \
259e4b86885SCheng Sean Ye     ERR_NF_FBD_M9|ERR_NF_FBD_M8|ERR_NF_FBD_M7|ERR_NF_FBD_M6|ERR_NF_FBD_M5| \
260e4b86885SCheng Sean Ye     ERR_NF_FBD_M4)
261e4b86885SCheng Sean Ye #define	ERR_NF_FBD_MA	(ERR_NF_FBD_M14)
262e4b86885SCheng Sean Ye #define	ERR_NF_FBD_ECC_CE	(ERR_NF_FBD_M20|ERR_NF_FBD_M19|ERR_NF_FBD_M18| \
263e4b86885SCheng Sean Ye     ERR_NF_FBD_M17|ERR_NF_FBD_M15|ERR_NF_FBD_M21)
264e4b86885SCheng Sean Ye #define	ERR_NF_FBD_SPARE (ERR_NF_FBD_M28|ERR_NF_FBD_M27)
265e4b86885SCheng Sean Ye 
266e4b86885SCheng Sean Ye #define	EMASK_FBD_M29	0x10000000	/* M29Err DIMM-Isolation Completed */
267e4b86885SCheng Sean Ye #define	EMASK_FBD_M28	0x08000000	/* M28Err DIMM-Spare Copy Completed */
268e4b86885SCheng Sean Ye #define	EMASK_FBD_M27	0x04000000	/* M27Err DIMM-Spare Copy Initiated */
269e4b86885SCheng Sean Ye #define	EMASK_FBD_M26	0x02000000	/* M26Err Redundant Fast Reset */
270e4b86885SCheng Sean Ye 					/* Timeout */
271e4b86885SCheng Sean Ye #define	EMASK_FBD_M25	0x01000000	/* M25Err Memory write error on */
272e4b86885SCheng Sean Ye 					/* redundant retry */
273e4b86885SCheng Sean Ye #define	EMASK_FBD_M24	0x00800000	/* M24Err refresh error */
274e4b86885SCheng Sean Ye #define	EMASK_FBD_M23	0x00400000	/* M23Err Non-Redundant Fast Reset */
275e4b86885SCheng Sean Ye 					/* Timeout */
276e4b86885SCheng Sean Ye #define	EMASK_FBD_M22	0x00200000	/* M22Err SPD protocol */
277e4b86885SCheng Sean Ye #define	EMASK_FBD_M21	0x00100000	/* M21Err FBD Northbound parity on */
278e4b86885SCheng Sean Ye 					/* FBD sync status */
279e4b86885SCheng Sean Ye #define	EMASK_FBD_M20	0x00080000	/* M20Err Correctable patrol data ECC */
280e4b86885SCheng Sean Ye #define	EMASK_FBD_M19	0x00040000	/* M19Err Correctasble resilver or */
281e4b86885SCheng Sean Ye 					/* spare-copy data ECC */
282e4b86885SCheng Sean Ye #define	EMASK_FBD_M18	0x00020000	/* M18Err Correctable Mirrored demand */
283e4b86885SCheng Sean Ye 					/* data ECC */
284e4b86885SCheng Sean Ye #define	EMASK_FBD_M17	0x00010000	/* M17Err Correctable Non-mirrored */
285e4b86885SCheng Sean Ye 					/* demand data ECC */
286e4b86885SCheng Sean Ye #define	EMASK_FBD_M16	0x00008000	/* M16Err channel failed over */
287e4b86885SCheng Sean Ye #define	EMASK_FBD_M15	0x00004000	/* M15Err Memory or FBD configuration */
288e4b86885SCheng Sean Ye 					/* CRC read error */
289e4b86885SCheng Sean Ye #define	EMASK_FBD_M14	0x00002000	/* M14Err FBD configuration write */
290e4b86885SCheng Sean Ye 					/* error on first attempt */
291e4b86885SCheng Sean Ye #define	EMASK_FBD_M13	0x00001000	/* M13Err Memory write error on first */
292e4b86885SCheng Sean Ye 					/* attempt */
293e4b86885SCheng Sean Ye #define	EMASK_FBD_M12	0x00000800	/* M12Err Non-Aliased uncorrectable */
294e4b86885SCheng Sean Ye 					/* patrol data ECC */
295e4b86885SCheng Sean Ye #define	EMASK_FBD_M11	0x00000400	/* M11Err Non-Aliased uncorrectable */
296e4b86885SCheng Sean Ye 					/* resilver or spare copy data ECC */
297e4b86885SCheng Sean Ye #define	EMASK_FBD_M10	0x00000200	/* M10Err Non-Aliased uncorrectable */
298e4b86885SCheng Sean Ye 					/* mirrored demand data ECC */
299e4b86885SCheng Sean Ye #define	EMASK_FBD_M9	0x00000100	/* M9Err Non-Aliased uncorrectable */
300e4b86885SCheng Sean Ye 					/* non-mirrored demand data ECC */
301e4b86885SCheng Sean Ye #define	EMASK_FBD_M8	0x00000080	/* M8Err Aliased uncorrectable */
302e4b86885SCheng Sean Ye 					/* patrol data ECC */
303e4b86885SCheng Sean Ye #define	EMASK_FBD_M7	0x00000040	/* M7Err Aliased uncorrectable */
304e4b86885SCheng Sean Ye 					/* resilver or spare copy data ECC */
305e4b86885SCheng Sean Ye #define	EMASK_FBD_M6	0x00000020	/* M6Err Aliased uncorrectable */
306e4b86885SCheng Sean Ye 					/* mirrored demand data ECC */
307e4b86885SCheng Sean Ye #define	EMASK_FBD_M5	0x00000010	/* M5Err Aliased uncorrectable */
308e4b86885SCheng Sean Ye 					/* non-mirrored demand data ECC */
309e4b86885SCheng Sean Ye #define	EMASK_FBD_M4	0x00000008	/* M4Err uncorrectable data ECC on */
310e4b86885SCheng Sean Ye 					/* replay */
311e4b86885SCheng Sean Ye #define	EMASK_FBD_M3	0x00000004	/* M3Err >Tmid thermal event with */
312e4b86885SCheng Sean Ye 					/* intelligent throttling disabled */
313e4b86885SCheng Sean Ye #define	EMASK_FBD_M2	0x00000002	/* M2Err memory or FBD configuration */
314e4b86885SCheng Sean Ye 					/* CRC read error */
315e4b86885SCheng Sean Ye #define	EMASK_FBD_M1	0x00000001	/* M1Err memory write error on */
316e4b86885SCheng Sean Ye 					/* non-redundant retry or FBD */
317e4b86885SCheng Sean Ye 					/* configuration write error on retry */
318e4b86885SCheng Sean Ye /* MCH 7300 errata 34 (reserved mask bits) */
319e4b86885SCheng Sean Ye #define	EMASK_5000_FBD_RES	(EMASK_FBD_M24|EMASK_FBD_M16)
320e4b86885SCheng Sean Ye #define	EMASK_FBD_RES	(nb_chipset == INTEL_NB_5400 ? 0 : EMASK_5000_FBD_RES)
321e4b86885SCheng Sean Ye 
322f8e921e3SVuong Nguyen #define	EMASK_FBD_FATAL	(EMASK_FBD_M3|EMASK_FBD_M2|EMASK_FBD_M1)
323e4b86885SCheng Sean Ye #define	EMASK_FBD_NF (EMASK_FBD_M28|EMASK_FBD_M27|EMASK_FBD_M26|EMASK_FBD_M25| \
324e4b86885SCheng Sean Ye 	EMASK_FBD_M22|EMASK_FBD_M21|EMASK_FBD_M20|EMASK_FBD_M19|EMASK_FBD_M18| \
325e4b86885SCheng Sean Ye 	EMASK_FBD_M17|EMASK_FBD_M15|EMASK_FBD_M14|EMASK_FBD_M13|EMASK_FBD_M12| \
326e4b86885SCheng Sean Ye 	EMASK_FBD_M11|EMASK_FBD_M10|EMASK_FBD_M9|EMASK_FBD_M8|EMASK_FBD_M7| \
327e4b86885SCheng Sean Ye 	EMASK_FBD_M6|EMASK_FBD_M5|EMASK_FBD_M4)
328e4b86885SCheng Sean Ye #define	EMASK_5400_FBD_FATAL	(EMASK_FBD_M23|EMASK_FBD_M2|EMASK_FBD_M1)
329e4b86885SCheng Sean Ye #define	EMASK_5400_FBD_NF (EMASK_FBD_M29|EMASK_FBD_M28|EMASK_FBD_M27| \
330e4b86885SCheng Sean Ye 	EMASK_FBD_M26|EMASK_FBD_M25|EMASK_FBD_M24|EMASK_FBD_M22|EMASK_FBD_M21| \
331e4b86885SCheng Sean Ye 	EMASK_FBD_M20|EMASK_FBD_M19|EMASK_FBD_M18|EMASK_FBD_M17|EMASK_FBD_M16| \
332e4b86885SCheng Sean Ye 	EMASK_FBD_M15|EMASK_FBD_M14|EMASK_FBD_M13|EMASK_FBD_M12| \
333e4b86885SCheng Sean Ye 	EMASK_FBD_M11|EMASK_FBD_M10|EMASK_FBD_M9|EMASK_FBD_M8|EMASK_FBD_M7| \
334e4b86885SCheng Sean Ye 	EMASK_FBD_M6|EMASK_FBD_M5|EMASK_FBD_M4)
335f8e921e3SVuong Nguyen #define	EMASK_7300_FBD_FATAL	(EMASK_FBD_M23|EMASK_FBD_M3|EMASK_FBD_M2| \
336f8e921e3SVuong Nguyen 	EMASK_FBD_M1)
337f8e921e3SVuong Nguyen #define	EMASK_7300_FBD_NF	EMASK_FBD_NF
338e4b86885SCheng Sean Ye 
33985738508SVuong Nguyen /* FERR_NF_MEM: MC First non-fatal errors */
34085738508SVuong Nguyen #define	ERR_MEM_CH_SHIFT	28	/* channel index in nf_mem */
34185738508SVuong Nguyen 
34285738508SVuong Nguyen #define	ERR_NF_MEM_M21	0x00200000	/* M21Err Spare Copy Completed */
34385738508SVuong Nguyen #define	ERR_NF_MEM_M20	0x00100000	/* M20Err Spare Copy Initiated */
34485738508SVuong Nguyen #define	ERR_NF_MEM_M18	0x00040000	/* M18Err SPD protocal */
34585738508SVuong Nguyen #define	ERR_NF_MEM_M16	0x00010000	/* M16Err Correctable Patrol Data ECC */
34685738508SVuong Nguyen #define	ERR_NF_MEM_M15	0x00008000	/* M15Err Correctable Spare-copy ECC */
34785738508SVuong Nguyen #define	ERR_NF_MEM_M14	0x00004000	/* M14Err Correctable demand data ECC */
34885738508SVuong Nguyen #define	ERR_NF_MEM_M12	0x00001000	/* M12Err non-aliased ue Patrol ECC */
34985738508SVuong Nguyen #define	ERR_NF_MEM_M11	0x00000800	/* M11Err non-aliased ue  Spare-copy */
35085738508SVuong Nguyen #define	ERR_NF_MEM_M10	0x00000400	/* M10Err non-aliased ue demand data */
35185738508SVuong Nguyen #define	ERR_NF_MEM_M6	0x00000040	/* M6Err aliased ue Patrol Data ECC */
35285738508SVuong Nguyen #define	ERR_NF_MEM_M5	0x00000020	/* M5Err aliased ue Spare-copy ECC */
35385738508SVuong Nguyen #define	ERR_NF_MEM_M4	0x00000010	/* M4Err aliased ue demand data ECC */
35485738508SVuong Nguyen #define	ERR_NF_MEM_M1	0x00000002	/* M1Err ue data ECC on replay */
35585738508SVuong Nguyen 
35685738508SVuong Nguyen #define	ERR_NF_MEM_MASK 0x0003fffff
35785738508SVuong Nguyen #define	ERR_NF_MEM_ECC_UE	(ERR_NF_MEM_M12|ERR_NF_MEM_M11|ERR_NF_MEM_M10| \
35885738508SVuong Nguyen     ERR_NF_MEM_M6|ERR_NF_MEM_M5|ERR_NF_MEM_M4|ERR_NF_MEM_M1)
35985738508SVuong Nguyen #define	ERR_NF_MEM_ECC_CE	(ERR_NF_MEM_M16|ERR_NF_MEM_M15|ERR_NF_MEM_M14)
36085738508SVuong Nguyen #define	ERR_NF_MEM_SPARE	(ERR_NF_MEM_M21|ERR_NF_MEM_M20)
36185738508SVuong Nguyen 
36285738508SVuong Nguyen #define	EMASK_MEM_M21	ERR_NF_MEM_M21
36385738508SVuong Nguyen #define	EMASK_MEM_M20	ERR_NF_MEM_M20
36485738508SVuong Nguyen #define	EMASK_MEM_M18	ERR_NF_MEM_M18
36585738508SVuong Nguyen #define	EMASK_MEM_M16	ERR_NF_MEM_M16
36685738508SVuong Nguyen #define	EMASK_MEM_M15	ERR_NF_MEM_M15
36785738508SVuong Nguyen #define	EMASK_MEM_M14	ERR_NF_MEM_M14
36885738508SVuong Nguyen #define	EMASK_MEM_M12	ERR_NF_MEM_M12
36985738508SVuong Nguyen #define	EMASK_MEM_M11	ERR_NF_MEM_M11
37085738508SVuong Nguyen #define	EMASK_MEM_M10	ERR_NF_MEM_M10
37185738508SVuong Nguyen #define	EMASK_MEM_M6	ERR_NF_MEM_M6
37285738508SVuong Nguyen #define	EMASK_MEM_M5	ERR_NF_MEM_M5
37385738508SVuong Nguyen #define	EMASK_MEM_M4	ERR_NF_MEM_M4
37485738508SVuong Nguyen #define	EMASK_MEM_M1	ERR_NF_MEM_M1
37585738508SVuong Nguyen 
37685738508SVuong Nguyen #define	EMASK_MEM_NF (EMASK_FBD_M21|EMASK_FBD_M20|EMASK_FBD_M18|EMASK_FBD_M16| \
37785738508SVuong Nguyen 	EMASK_FBD_M15|EMASK_FBD_M14|EMASK_FBD_M12|EMASK_FBD_M11|EMASK_FBD_M10| \
37885738508SVuong Nguyen 	EMASK_MEM_M6|EMASK_MEM_M5|EMASK_MEM_M4|EMASK_MEM_M1)
37985738508SVuong Nguyen 
3809ff4cbe7SAdrian Frost #define	ERR_INT_ALL	(nb_chipset == INTEL_NB_5400 ? 0xffffffff : 0xff)
3819ff4cbe7SAdrian Frost 
382e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B14	0x0400	/* B14Msk SF Scrub DBE */
383e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B12	0x0100	/* B12Msk Parity Protected register */
384e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B25	0x0080	/* B25Msk illegal HISMM/TSEG access */
385e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B23	0x0040	/* B23Msk Vt Unaffiliated port error */
386e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B21	0x0020	/* B21Msk illegal way */
387e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B7	0x0010	/* B7Msk Multiple ECC error in any of */
388e4b86885SCheng Sean Ye 					/* the ways during SF lookup */
389e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B4	0x08	/* B4Msk Virtual pin port error */
390e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B3	0x04	/* B3Msk Coherency violation error for EWB */
391e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B2	0x02	/* B2Msk Multi-tag hit SF */
392e4b86885SCheng Sean Ye #define	ERR_FAT_INT_B1	0x01	/* B1Msk DM parity error */
393e4b86885SCheng Sean Ye 
394e4b86885SCheng Sean Ye #define	ERR_NF_INT_B27	0x4000	/* B27Msk Request received when in S1 */
395e4b86885SCheng Sean Ye #define	ERR_NF_INT_B24	0x2000	/* B24Msk DFXERR */
396e4b86885SCheng Sean Ye #define	ERR_NF_INT_B19	0x1000	/* B19Msk scrub SBE (SF) */
397e4b86885SCheng Sean Ye #define	ERR_NF_INT_B18	0x0800	/* B18Msk perfmon task completion */
398e4b86885SCheng Sean Ye #define	ERR_NF_INT_B17	0x0400	/* B17Msk JTAG/TAP error status */
399e4b86885SCheng Sean Ye #define	ERR_NF_INT_B16	0x0200	/* B16Msk SMBus error status */
400e4b86885SCheng Sean Ye #define	ERR_NF_INT_B22	0x0080	/* B22Msk Victim ROM parity */
401e4b86885SCheng Sean Ye #define	ERR_NF_INT_B20	0x0040	/* B20Msk Configuration write abort */
402e4b86885SCheng Sean Ye #define	ERR_NF_INT_B11	0x0020	/* B11Msk Victim Ram parity error */
403e4b86885SCheng Sean Ye #define	ERR_NF_INT_B10	0x0010	/* B10Msk DM Parity */
404e4b86885SCheng Sean Ye #define	ERR_NF_INT_B9	0x0008	/* B9Msk illeagl access */
405e4b86885SCheng Sean Ye #define	ERR_NF_INT_B8	0x0004	/* B8Msk SF Coherency Error for BIL */
406e4b86885SCheng Sean Ye #define	ERR_NF_INT_B6	0x0002	/* B6Msk Single ECC error on SF lookup */
407e4b86885SCheng Sean Ye #define	ERR_NF_INT_B5	0x0001	/* B5Msk Address Map error */
408e4b86885SCheng Sean Ye 
409e4b86885SCheng Sean Ye #define	NERR_NF_5400_INT_B26	0x0004	/* B26Msk Illeagl Access to */
410e4b86885SCheng Sean Ye 				/* non-coherent address space */
411e4b86885SCheng Sean Ye 
412e4b86885SCheng Sean Ye #define	EMASK_INT_RES	0x02000000	/* Do not change */
413e4b86885SCheng Sean Ye #define	EMASK_INT_B25	0x01000000	/* B25Msk illegal HISMM/TSEG access */
414e4b86885SCheng Sean Ye #define	EMASK_INT_B23	0x00400000	/* B23Msk Vt Unaffiliated port error */
415e4b86885SCheng Sean Ye #define	EMASK_INT_B22	0x00200000	/* B22Msk Victim ROM parity */
416e4b86885SCheng Sean Ye #define	EMASK_INT_B21	0x00100000	/* B21Msk illegal way */
417e4b86885SCheng Sean Ye #define	EMASK_INT_B20	0x00080000	/* B20Msk Configuration write abort  */
418e4b86885SCheng Sean Ye #define	EMASK_INT_B19	0x00040000	/* B19Msk Scrub SBE */
419e4b86885SCheng Sean Ye #define	EMASK_INT_B14	0x00002000	/* B14Msk Scrub DBE */
420e4b86885SCheng Sean Ye #define	EMASK_INT_B12	0x00000800	/* B12Msk Parity Protected */
421e4b86885SCheng Sean Ye #define	EMASK_INT_B11	0x00000400	/* B11Msk Victim Ram parity error */
422e4b86885SCheng Sean Ye #define	EMASK_INT_B10	0x00000200	/* B10Msk DM Parity */
423e4b86885SCheng Sean Ye #define	EMASK_INT_B9	0x00000100	/* B9Msk Illegal Accesss */
424e4b86885SCheng Sean Ye 
425e4b86885SCheng Sean Ye #define	EMASK_INT_B8	0x80	/* B8Msk SF Coherency Error for BIL */
426e4b86885SCheng Sean Ye #define	EMASK_INT_B7	0x40	/* B7Msk Multiple ECC error in any of */
427e4b86885SCheng Sean Ye 				/* the ways during SF lookup */
428e4b86885SCheng Sean Ye #define	EMASK_INT_B6	0x20	/* B6Msk Single ECC error on SF lookup */
429e4b86885SCheng Sean Ye #define	EMASK_INT_B5	0x10	/* B5Msk Address Map error */
430e4b86885SCheng Sean Ye #define	EMASK_INT_B4	0x08	/* B4Msk Virtual pin port error */
431e4b86885SCheng Sean Ye #define	EMASK_INT_B3	0x04	/* B3Msk Coherency violation error for EWB */
432e4b86885SCheng Sean Ye #define	EMASK_INT_B2	0x02	/* B2Msk Multi-tag hit SF */
433e4b86885SCheng Sean Ye #define	EMASK_INT_B1	0x01	/* B1Msk DM parity error */
434e4b86885SCheng Sean Ye 
435f8e921e3SVuong Nguyen /* MCH 5000 errata 2: disable B1 */
436e4b86885SCheng Sean Ye #define	EMASK_INT_5000	EMASK_INT_B1
437f8e921e3SVuong Nguyen /* MCH 5100: mask all except B3 and B5 */
438f8e921e3SVuong Nguyen #define	EMASK_INT_5100	(~(EMASK_INT_B5|EMASK_INT_B3) & 0xff)
439e4b86885SCheng Sean Ye /* MCH 7300 errata 17 & 20 */
440e4b86885SCheng Sean Ye #define	EMASK_INT_7300	(EMASK_INT_B3|EMASK_INT_B1)
441e4b86885SCheng Sean Ye /* MCH 7300 errata 17,20 & 21 */
442e4b86885SCheng Sean Ye #define	EMASK_INT_7300_STEP_0	(EMASK_INT_B7|EMASK_INT_B3|EMASK_INT_B1)
4439ff4cbe7SAdrian Frost #define	EMASK_INT_5400 0
444e4b86885SCheng Sean Ye 
445e4b86885SCheng Sean Ye #define	EMASK_INT_FATAL (EMASK_INT_B7|EMASK_INT_B4|EMASK_INT_B3|EMASK_INT_B2| \
446e4b86885SCheng Sean Ye 	EMASK_INT_B1)
447e4b86885SCheng Sean Ye #define	EMASK_INT_NF	(EMASK_INT_B8|EMASK_INT_B6|EMASK_INT_B5)
448f8e921e3SVuong Nguyen #define	EMASK_INT_5100_FATAL	(EMASK_INT_B3|EMASK_INT_B1)
449f8e921e3SVuong Nguyen #define	EMASK_INT_5100_NF	(EMASK_INT_B5)
450f8e921e3SVuong Nguyen 
451e4b86885SCheng Sean Ye #define	GE_FBD_FATAL ((nb_chipset == INTEL_NB_5400) ? GE_FERR_FBD_FATAL : \
45285738508SVuong Nguyen 	(nb_chipset == INTEL_NB_5100) ? 0 : \
453e4b86885SCheng Sean Ye 	(GE_FERR_FBD0_FATAL|GE_FERR_FBD1_FATAL|GE_FERR_FBD2_FATAL| \
454e4b86885SCheng Sean Ye 	GE_FERR_FBD3_FATAL))
455e4b86885SCheng Sean Ye #define	GE_FBD_NF ((nb_chipset == INTEL_NB_5400) ? GE_FERR_FBD_NF : \
45685738508SVuong Nguyen 	(nb_chipset == INTEL_NB_5100) ? 0 : \
457e4b86885SCheng Sean Ye 	(GE_FERR_FBD0_NF|GE_FERR_FBD1_NF|GE_FERR_FBD2_NF|GE_FERR_FBD3_NF))
45885738508SVuong Nguyen #define	GE_MEM_NF	((nb_chipset == INTEL_NB_5100) ? \
45985738508SVuong Nguyen 	(GE_FERR_MEM0_NF|GE_FERR_MEM1_NF) : 0)
460e4b86885SCheng Sean Ye 
461e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO18	0x00200000	/* ESI Reset timeout */
462e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO2	0x00100000	/* Received an unsupported */
463e4b86885SCheng Sean Ye 						/* request */
464e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO9	0x00040000	/* Malformed TLP Status */
465e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO10	0x00020000	/* Received buffer overflow */
466e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO8	0x00010000	/* unexpected completion */
467e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO7	0x00008000	/* completion abort */
468e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO6	0x00004000	/* completion timeout */
469e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO5	0x00002000	/* flow control protocol */
470e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO4	0x00001000	/* poisoned TLP */
471e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO19	0x00000020	/* surprise link down */
472e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO0	0x00000010	/* data link protocol */
473e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_IO3	0x00000001	/* training error */
474e4b86885SCheng Sean Ye 
475e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO20	0x00002000	/* Advisory Non Fatal */
476e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO16	0x00001000	/* replay timer timeout */
477e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO15	0x00000100	/* replay num pollover */
478e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO14	0x00000080	/* bad DLLP */
479e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO13	0x00000040	/* bad TLP */
480e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_IO12	0x00000001	/* receiver error mask */
481e4b86885SCheng Sean Ye 
482e4b86885SCheng Sean Ye #define	EMASK_RP_PEX_IO1	0x00000004	/* fatal message detect */
483e4b86885SCheng Sean Ye #define	EMASK_RP_PEX_IO11	0x00000002	/* uncorrectable message */
484e4b86885SCheng Sean Ye #define	EMASK_RP_PEX_IO17	0x00000001	/* correctable message */
485e4b86885SCheng Sean Ye 
486e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO33	0x00002000	/* Link autonomous BW change */
487e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO32	0x00001000	/* Received CA Posted Req */
488e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO31	0x00000800	/* Received UR Posted Req */
489e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO30	0x00000400	/* VT-d internal HW */
490e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO29	0x00000200	/* MSI address */
491e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO28	0x00000100	/* Link BW change */
492e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO27	0x00000080	/* stop & scream */
493e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO26	0x00000040	/* Received CA response */
494e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO25	0x00000020	/* Received UR response */
495e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO24	0x00000010	/* Outbound poisoned data */
496e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO23	0x00000008	/* VTd fault */
497e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO22	0x00000004	/* internal header/ctl parity */
498e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_IO18	0x00000002	/* ESI reset timeout */
499e4b86885SCheng Sean Ye #define	EMASK_UNIT_PEX_VPP	0x00000001	/* correctable message detect */
500e4b86885SCheng Sean Ye 
501e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO32	0x00800000	/* Received CA Posted Request */
502e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO31	0x00400000	/* Received UR Posted Request */
503e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO30	0x00200000	/* VT-d Internal HW */
504e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO29	0x00100000	/* MSI Address */
505e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO27	0x00040000	/* Stop & Scream */
506e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO26	0x00020000	/* Received CA Response */
507e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO25	0x00010000	/* Received UR Response */
508e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO24	0x00008000	/* Outbound poisoned TLP */
509e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO23	0x00004000	/* VT-d Fault */
510e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO22	0x00002000	/* Internal Header/Control */
511e4b86885SCheng Sean Ye 						/* Parity */
512e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO18	0x00001000	/* ESI reset timeout */
513e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO1	0x00000400	/* received fatal error msg */
514e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO2	0x00000200	/* received unsupported req  */
515e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO9	0x00000100	/* malformed TLP */
516e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO10	0x00000080	/* receiver buffer overflow */
517e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO8	0x00000040	/* unexpected completion */
518e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO7	0x00000020	/* completer abort */
519e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO6	0x00000010	/* completion timeout */
520e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO5	0x00000008	/* flow control protocol */
521e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO4	0x00000004	/* poisoned TLP */
522e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO19	0x00000002	/* surprise link down */
523e4b86885SCheng Sean Ye #define	PEX_5400_FAT_IO0	0x00000001	/* data link layer protocol */
524e4b86885SCheng Sean Ye #define	PEX_FAT_IO19	0x00001000	/* surprise link down */
525e4b86885SCheng Sean Ye #define	PEX_FAT_IO18	0x00000800	/* ESI reset timeout */
526e4b86885SCheng Sean Ye #define	PEX_FAT_IO9	0x00000400	/* malformed TLP */
527e4b86885SCheng Sean Ye #define	PEX_FAT_IO10	0x00000200	/* receiver buffer overflow */
528e4b86885SCheng Sean Ye #define	PEX_FAT_IO8	0x00000100	/* unexpected completion */
529e4b86885SCheng Sean Ye #define	PEX_FAT_IO7	0x00000080	/* completer abort */
530e4b86885SCheng Sean Ye #define	PEX_FAT_IO6	0x00000040	/* completion timeout */
531e4b86885SCheng Sean Ye #define	PEX_FAT_IO5	0x00000020	/* flow control protocol */
532e4b86885SCheng Sean Ye #define	PEX_FAT_IO4	0x00000010	/* poisoned TLP */
533e4b86885SCheng Sean Ye #define	PEX_FAT_IO3	0x00000008	/* training error */
534e4b86885SCheng Sean Ye #define	PEX_FAT_IO2	0x00000004	/* received unsupported req  */
535e4b86885SCheng Sean Ye #define	PEX_FAT_IO1	0x00000002	/* received fatal error message */
536e4b86885SCheng Sean Ye #define	PEX_FAT_IO0	0x00000001	/* data link layer protocol */
537e4b86885SCheng Sean Ye 
538e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO33	0x20000000	/* link autonomous bandwidth */
539e4b86885SCheng Sean Ye 						/* change (correctable) */
540e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO32	0x10000000	/* Received CA Posted Request */
541e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO31	0x08000000	/* Received UR Posted Request */
542e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO30	0x04000000	/* VT-d Internal HW */
543e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO29	0x02000000	/* MSI Address */
544e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO28	0x01000000	/* Link bandwidth change */
545e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO27	0x00800000	/* Stop & Scream */
546e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO26	0x00400000	/* Received CA Response */
547e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO25	0x00200000	/* Received UR Response */
548e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO24	0x00100000	/* Outbound poisoned TLP */
549e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO23	0x00080000	/* VT-d Fault */
550e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO11	0x00040000	/* received non fatal err msg */
551e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO17	0x00020000 	/* rec correctable error msg */
552e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO2		0x00008000	/* Received unsupported req */
553e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO9		0x00004000	/* Malformed TLP */
554e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO10	0x00002000	/* Received buffer overflow */
555e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO8		0x00001000	/* unexpected completion err */
556e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO7		0x00000800	/* completion abort */
557e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO6		0x00000400	/* completion timeout */
558e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO5		0x00000200	/* flow control protocol */
559e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO4		0x00000100	/* poisoned TLP */
560e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO19	0x00000080	/* surprise link down */
561e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO0		0x00000040	/* data link layer protocol */
562e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO20	0x00000020	/* Advisory Non Fatel */
563e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO16	0x00000010	/* replay timer timeout */
564e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO15	0x00000008	/* replay num pollover */
565e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO14	0x00000004	/* bad DLLP */
566e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO13	0x00000002	/* bad TLP */
567e4b86885SCheng Sean Ye #define	PEX_5400_NF_IO12	0x00000001	/* receiver error mask */
568e4b86885SCheng Sean Ye #define	PEX_NF_IO19	0x00020000	/* surprise link down */
569e4b86885SCheng Sean Ye #define	PEX_NF_IO17	0x00010000	/* received correctable error message */
570e4b86885SCheng Sean Ye #define	PEX_NF_IO16	0x00008000	/* replay timer timeout */
571e4b86885SCheng Sean Ye #define	PEX_NF_IO15	0x00004000	/* replay num pollover */
572e4b86885SCheng Sean Ye #define	PEX_NF_IO14	0x00002000	/* bad DLLP */
573e4b86885SCheng Sean Ye #define	PEX_NF_IO13	0x00001000	/* bad TLP */
574e4b86885SCheng Sean Ye #define	PEX_NF_IO12	0x00000800	/* receiver error mask */
575e4b86885SCheng Sean Ye #define	PEX_NF_IO11	0x00000400	/* received non fatal error message */
576e4b86885SCheng Sean Ye #define	PEX_NF_IO10	0x00000200	/* Received buffer overflow */
577e4b86885SCheng Sean Ye #define	PEX_NF_IO9	0x00000100	/* Malformed TLP */
578e4b86885SCheng Sean Ye #define	PEX_NF_IO8	0x00000080
579e4b86885SCheng Sean Ye #define	PEX_NF_IO7	0x00000040
580e4b86885SCheng Sean Ye #define	PEX_NF_IO6	0x00000020	/* completion timeout */
581e4b86885SCheng Sean Ye #define	PEX_NF_IO5	0x00000010	/* flow control protocol */
582e4b86885SCheng Sean Ye #define	PEX_NF_IO4	0x00000008	/* poisoned TLP */
583e4b86885SCheng Sean Ye #define	PEX_NF_IO3	0x00000004
584e4b86885SCheng Sean Ye #define	PEX_NF_IO2	0x00000002
585e4b86885SCheng Sean Ye #define	PEX_NF_IO0	0x00000001	/* data link layer protocol */
586e4b86885SCheng Sean Ye 
587e4b86885SCheng Sean Ye #define	ERR_FAT_TH2	0x02	/* >tmid thermal event */
588e4b86885SCheng Sean Ye #define	ERR_FAT_TH1	0x01	/* Catastrophic on-die thermal event */
589e4b86885SCheng Sean Ye 
590e4b86885SCheng Sean Ye #define	ERR_NF_TH5	0x10	/* timeout on cooling update */
591e4b86885SCheng Sean Ye #define	ERR_NF_TH4	0x08	/* TSMAX update */
592e4b86885SCheng Sean Ye #define	ERR_NF_TH3	0x04	/* on-die throttling event */
593e4b86885SCheng Sean Ye 
594e4b86885SCheng Sean Ye #define	EMASK_TH5	0x0010 	/* TH5Msk timeout on cooling update */
595e4b86885SCheng Sean Ye #define	EMASK_TH4	0x0008 	/* TH4Msk TSMAX update */
596e4b86885SCheng Sean Ye #define	EMASK_TH3	0x0004 	/* TH3Msk on-die throttling event */
597e4b86885SCheng Sean Ye #define	EMASK_TH2	0x0002 	/* TH2Msk >tmid thermal event */
598e4b86885SCheng Sean Ye #define	EMASK_TH1	0x0001 	/* TH1Msk Catastrophic on-die thermal event */
599e4b86885SCheng Sean Ye 
600e4b86885SCheng Sean Ye #define	GE_FERR_FSB(ferr) ( \
601e4b86885SCheng Sean Ye 	((ferr) & (GE_FSB0_FATAL|GE_FSB0_NF)) ? 0 : \
602e4b86885SCheng Sean Ye 	((ferr) & (GE_FSB1_FATAL|GE_FSB1_NF)) ? 1 : \
603e4b86885SCheng Sean Ye 	(nb_chipset == INTEL_NB_7300) && \
604e4b86885SCheng Sean Ye 	((ferr) & (GE_FERR_FSB2_FATAL|GE_FERR_FSB2_NF)) ? 2 : \
605e4b86885SCheng Sean Ye 	(nb_chipset == INTEL_NB_7300) && \
606e4b86885SCheng Sean Ye 	((ferr) & (GE_FERR_FSB3_FATAL|GE_FERR_FSB3_NF)) ? 3 : \
607e4b86885SCheng Sean Ye 	-1)
608e4b86885SCheng Sean Ye 
609e4b86885SCheng Sean Ye #define	GE_NERR_TO_FERR_FSB(nerr) \
610e4b86885SCheng Sean Ye 	((((nerr) & GE_NERR_FSB3_FATAL) ? GE_FERR_FSB3_FATAL : 0) | \
611e4b86885SCheng Sean Ye 	(((nerr) & GE_NERR_FSB2_FATAL) ? GE_FERR_FSB2_FATAL : 0) | \
612e4b86885SCheng Sean Ye 	(((nerr) & GE_FSB1_FATAL) ? GE_FSB1_FATAL : 0) | \
613e4b86885SCheng Sean Ye 	(((nerr) & GE_FSB0_FATAL) ? GE_FSB0_FATAL : 0) | \
614e4b86885SCheng Sean Ye 	(((nerr) & GE_NERR_FSB3_NF) ? GE_FERR_FSB3_NF : 0) | \
615e4b86885SCheng Sean Ye 	(((nerr) & GE_NERR_FSB2_NF) ? GE_FERR_FSB2_NF : 0) | \
616e4b86885SCheng Sean Ye 	(((nerr) & GE_FSB1_NF) ? GE_FSB1_NF : 0) | \
617e4b86885SCheng Sean Ye 	(((nerr) & GE_FSB0_NF) ? GE_FSB0_NF : 0))
618e4b86885SCheng Sean Ye 
619e4b86885SCheng Sean Ye #define	GE_ERR_PEX(ferr) ( \
620e4b86885SCheng Sean Ye 	((ferr) & (GE_ESI_FATAL|GE_ESI_NF)) ? 0 : \
621e4b86885SCheng Sean Ye 	((nb_chipset == INTEL_NB_7300 || nb_chipset == INTEL_NB_5400) && \
622e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX1_FATAL|GE_PCIEX1_NF))) ? 1 : \
623e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX2_FATAL|GE_PCIEX2_NF)) ? 2 : \
624e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX3_FATAL|GE_PCIEX3_NF)) ? 3 : \
625e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX4_FATAL|GE_PCIEX4_NF)) ? 4 : \
626e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX5_FATAL|GE_PCIEX5_NF)) ? 5 : \
627e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX6_FATAL|GE_PCIEX6_NF)) ? 6 : \
628e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX7_FATAL|GE_PCIEX7_NF)) ? 7 : \
629e4b86885SCheng Sean Ye 	(nb_chipset == INTEL_NB_5400) && \
630e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX8_FATAL|GE_PCIEX8_NF)) ? 8 : \
631e4b86885SCheng Sean Ye 	((ferr) & (GE_PCIEX9_FATAL|GE_PCIEX9_NF)) ? 9 : \
632e4b86885SCheng Sean Ye 	-1)
633e4b86885SCheng Sean Ye 
634e4b86885SCheng Sean Ye #define	GE_FERR_FATAL	((nb_chipset == INTEL_NB_7300) ? \
635e4b86885SCheng Sean Ye 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FERR_FSB3_FATAL|GE_FERR_FSB2_FATAL| \
636e4b86885SCheng Sean Ye 	GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL|GE_PCIEX7_FATAL| \
637e4b86885SCheng Sean Ye 	GE_PCIEX6_FATAL| GE_PCIEX5_FATAL|GE_PCIEX4_FATAL|GE_PCIEX3_FATAL| \
638e4b86885SCheng Sean Ye 	GE_PCIEX2_FATAL| GE_ESI_FATAL) :  \
639e4b86885SCheng Sean Ye 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL| \
640e4b86885SCheng Sean Ye 	GE_PCIEX7_FATAL|GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL| \
641e4b86885SCheng Sean Ye 	GE_PCIEX3_FATAL|GE_PCIEX2_FATAL|GE_ESI_FATAL))
642e4b86885SCheng Sean Ye 
643e4b86885SCheng Sean Ye #define	GE_NERR_FATAL	((nb_chipset == INTEL_NB_7300) ? \
644e4b86885SCheng Sean Ye 	(GE_INT_FATAL|GE_DMA_FATAL|GE_NERR_FSB3_FATAL|GE_NERR_FSB2_FATAL| \
645e4b86885SCheng Sean Ye 	GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL|GE_PCIEX7_FATAL| \
646e4b86885SCheng Sean Ye 	GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL|GE_PCIEX3_FATAL| \
647e4b86885SCheng Sean Ye 	GE_PCIEX2_FATALGE_ESI_FATAL) :  \
648e4b86885SCheng Sean Ye 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL| \
649e4b86885SCheng Sean Ye 	GE_PCIEX7_FATAL|GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL| \
650e4b86885SCheng Sean Ye 	GE_PCIEX3_FATAL|GE_PCIEX2_FATAL|GE_ESI_FATAL))
651e4b86885SCheng Sean Ye 
652e4b86885SCheng Sean Ye #define	GE_PCIEX_FATAL	(GE_ESI_FATAL|GE_PCIEX1_FATAL|GE_PCIEX2_FATAL| \
653e4b86885SCheng Sean Ye 	GE_PCIEX3_FATAL|GE_PCIEX4_FATAL|GE_PCIEX5_FATAL|GE_PCIEX6_FATAL| \
654e4b86885SCheng Sean Ye 	GE_PCIEX7_FATAL)
655e4b86885SCheng Sean Ye #define	GE_PCIEX_NF	(GE_ESI_NF|GE_PCIEX1_NF|GE_PCIEX2_NF|GE_PCIEX3_NF| \
656e4b86885SCheng Sean Ye 	GE_PCIEX4_NF|GE_PCIEX5_NF|GE_PCIEX6_NF|GE_PCIEX7_NF)
657e4b86885SCheng Sean Ye #define	GE_FERR_FSB_FATAL	((nb_chipset == INTEL_NB_7300) ? \
658e4b86885SCheng Sean Ye 	(GE_FSB0_FATAL|GE_FSB1_FATAL|GE_FERR_FSB2_FATAL|GE_FERR_FSB3_FATAL) : \
659e4b86885SCheng Sean Ye 	(GE_FSB0_FATAL|GE_FSB1_FATAL))
660e4b86885SCheng Sean Ye #define	GE_NERR_FSB_FATAL	((nb_chipset == INTEL_NB_7300) ? \
661e4b86885SCheng Sean Ye 	(GE_FSB0_FATAL|GE_FSB1_FATAL|GE_NERR_FSB2_FATAL|GE_NERR_FSB3_FATAL) : \
662e4b86885SCheng Sean Ye 	(GE_FSB0_FATAL|GE_FSB1_FATAL))
663e4b86885SCheng Sean Ye #define	GE_FERR_FSB_NF	((nb_chipset == INTEL_NB_7300) ? \
664e4b86885SCheng Sean Ye 	(GE_FSB0_NF|GE_FSB1_NF|GE_FERR_FSB2_NF|GE_FERR_FSB3_NF) : \
665e4b86885SCheng Sean Ye 	(GE_FSB0_NF|GE_FSB1_NF))
666e4b86885SCheng Sean Ye #define	GE_NERR_FSB_NF	((nb_chipset == INTEL_NB_7300) ? \
667e4b86885SCheng Sean Ye 	(GE_FSB0_NF|GE_FSB1_NF|GE_NERR_FSB2_NF|GE_NERR_FSB3_NF) : \
668e4b86885SCheng Sean Ye 	(GE_FSB0_NF|GE_FSB1_NF))
669e4b86885SCheng Sean Ye 
670e4b86885SCheng Sean Ye #define	FERR_FBD_CHANNEL(reg)	((reg)>>28 & 3)
671e4b86885SCheng Sean Ye 
672e4b86885SCheng Sean Ye #define	NB5000_STEPPING()	nb_pci_getw(0, 0, 0, 8, 0)
673e4b86885SCheng Sean Ye 
674e4b86885SCheng Sean Ye #define	FERR_GLOBAL_RD()	((nb_chipset == INTEL_NB_7300) ? \
675e4b86885SCheng Sean Ye 				    ((uint64_t)nb_pci_getl(0, 16, 2, \
676e4b86885SCheng Sean Ye 				    0x48, 0) << 32) | nb_pci_getl(0, 16, 2, \
677e4b86885SCheng Sean Ye 				    0x40, 0) : \
678e4b86885SCheng Sean Ye 				    (uint64_t)nb_pci_getl(0, 16, 2, 0x40, 0))
679e4b86885SCheng Sean Ye #define	NERR_GLOBAL_RD()	nb_pci_getl(0, 16, 2, 0x44, 0)
680e4b86885SCheng Sean Ye #define	FERR_FAT_FSB_RD(fsb, ip)	((nb_chipset == INTEL_NB_7300) ? \
681e4b86885SCheng Sean Ye 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc0 : 0x40, ip) : \
682e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 0, fsb ? 0x480 : 0x180, ip))
683e4b86885SCheng Sean Ye #define	FERR_NF_FSB_RD(fsb, ip)	((nb_chipset == INTEL_NB_7300) ? \
684e4b86885SCheng Sean Ye 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc1 : 0x41, ip) : \
685e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 0, fsb ? 0x481 : 0x181, ip))
686e4b86885SCheng Sean Ye #define	NERR_FAT_FSB_RD(fsb, ip) ((nb_chipset == INTEL_NB_7300) ? \
687e4b86885SCheng Sean Ye 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc2 : 0x42, ip) : \
688e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 0, fsb ? 0x482 : 0x182, ip))
689e4b86885SCheng Sean Ye #define	NERR_NF_FSB_RD(fsb, ip) ((nb_chipset == INTEL_NB_7300) ? \
690e4b86885SCheng Sean Ye 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc3 : 0x43, ip) : \
691e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 0, fsb ? 0x483 : 0x183, ip))
692e4b86885SCheng Sean Ye 
693e4b86885SCheng Sean Ye #define	NRECFSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
694e4b86885SCheng Sean Ye 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc4 : 0x44, 0) : \
695e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 0, fsb ? 0x484 : 0x184, 0))
696e4b86885SCheng Sean Ye #define	NRECFSB_WR(fsb)	\
697e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_7300) { \
698e4b86885SCheng Sean Ye 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc4 : 0x44, \
699e4b86885SCheng Sean Ye 		    0); \
700e4b86885SCheng Sean Ye 	} else { \
701e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 0, fsb ? 0x484 : 0x184, 0); \
702e4b86885SCheng Sean Ye 	}
703e4b86885SCheng Sean Ye #define	RECFSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
704e4b86885SCheng Sean Ye 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc8 : 0x48, 0) : \
705e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 0, fsb ? 0x488 : 0x188, 0))
706e4b86885SCheng Sean Ye #define	RECFSB_WR(fsb) \
707e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_7300) { \
708e4b86885SCheng Sean Ye 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc8 : 0x48, \
709e4b86885SCheng Sean Ye 		    0); \
710e4b86885SCheng Sean Ye 	} else { \
711e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 0, fsb ? 0x488 : 0x188, 0); \
712e4b86885SCheng Sean Ye 	}
713e4b86885SCheng Sean Ye #define	NRECADDR_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
714e4b86885SCheng Sean Ye 	((uint64_t)(nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, \
715e4b86885SCheng Sean Ye 	(fsb & 1) ? 0xd0 : 0x50, 0)) << 32) | \
716e4b86885SCheng Sean Ye 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xcc : 0x4c, 0) : \
717e4b86885SCheng Sean Ye 	((uint64_t)(nb_pci_getb(0, 16, 0, fsb ? 0x490 : 0x190, 0)) << 32) | \
718e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 0, fsb ? 0x48c : 0x18c, 0))
719e4b86885SCheng Sean Ye #define	NRECADDR_WR(fsb) \
720e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_7300) { \
721e4b86885SCheng Sean Ye 		nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd0 : 0x50, \
722e4b86885SCheng Sean Ye 		    0); \
723e4b86885SCheng Sean Ye 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xcc : 0x4c, \
724e4b86885SCheng Sean Ye 		    0); \
725e4b86885SCheng Sean Ye 	} else { \
726e4b86885SCheng Sean Ye 		nb_pci_putb(0, 16, 0, fsb ? 0x490 : 0x190, 0); \
727e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 0, fsb ? 0x48c : 0x18c, 0); \
728e4b86885SCheng Sean Ye 	}
729e4b86885SCheng Sean Ye #define	EMASK_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
730e4b86885SCheng Sean Ye 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd2 : 0x52, 0) : \
731e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 0, fsb ? 0x492 : 0x192, 0))
732e4b86885SCheng Sean Ye #define	ERR0_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
733e4b86885SCheng Sean Ye 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd4 : 0x54, 0) : \
734e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 0, fsb ? 0x494 : 0x194, 0))
735e4b86885SCheng Sean Ye #define	ERR1_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
736e4b86885SCheng Sean Ye 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd6 : 0x56, 0) : \
737e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 0, fsb ? 0x496 : 0x196, 0))
738e4b86885SCheng Sean Ye #define	ERR2_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
739e4b86885SCheng Sean Ye 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd8 : 0x58, 0) : \
740e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 0, fsb ? 0x498 : 0x198, 0))
741e4b86885SCheng Sean Ye #define	MCERR_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
742e4b86885SCheng Sean Ye 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xda : 0x5a, 0) : \
743e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 0, fsb ? 0x49a : 0x19a, 0))
744e4b86885SCheng Sean Ye 
745e4b86885SCheng Sean Ye #define	FERR_GLOBAL_WR(val) \
746e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_7300) \
747e4b86885SCheng Sean Ye 	{ \
748e4b86885SCheng Sean Ye 		    nb_pci_putl(0, 16, 2, 0x48, (uint32_t)(val >> 32)); \
749e4b86885SCheng Sean Ye 		    nb_pci_putl(0, 16, 2, 0x40, (uint32_t)val); \
750e4b86885SCheng Sean Ye 	} else { \
751e4b86885SCheng Sean Ye 		    nb_pci_putl(0, 16, 2, 0x40, (uint32_t)val); \
752e4b86885SCheng Sean Ye 	}
753e4b86885SCheng Sean Ye #define	NERR_GLOBAL_WR(val)	nb_pci_putl(0, 16, 2, 0x44, val)
754e4b86885SCheng Sean Ye #define	FERR_FAT_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
755e4b86885SCheng Sean Ye 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc0 : 0x40, val) : \
756e4b86885SCheng Sean Ye 	nb_pci_putb(0, 16, 0, fsb ? 0x480 : 0x180, val))
757e4b86885SCheng Sean Ye #define	FERR_NF_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
758e4b86885SCheng Sean Ye 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc1 : 0x41, val) : \
759e4b86885SCheng Sean Ye 	nb_pci_putb(0, 16, 0, fsb ? 0x481 : 0x181, val))
760e4b86885SCheng Sean Ye #define	NERR_FAT_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
761e4b86885SCheng Sean Ye 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc2 : 0x42, val) : \
762e4b86885SCheng Sean Ye 	nb_pci_putb(0, 16, 0, fsb ? 0x482 : 0x182, val))
763e4b86885SCheng Sean Ye #define	NERR_NF_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
764e4b86885SCheng Sean Ye 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc3 : 0x43, val) : \
765e4b86885SCheng Sean Ye 	nb_pci_putb(0, 16, 0, fsb ? 0x483 : 0x183, val))
766e4b86885SCheng Sean Ye #define	EMASK_FSB_WR(fsb, val) \
767e4b86885SCheng Sean Ye 	{ \
768e4b86885SCheng Sean Ye 		if (nb_chipset == INTEL_NB_7300) \
769e4b86885SCheng Sean Ye 			nb_pci_putw(0, 17, ((fsb) & 2) ? 3 : 0, \
770e4b86885SCheng Sean Ye 			    ((fsb) & 1) ? 0xd2 : 0x52, val); \
771e4b86885SCheng Sean Ye 		else \
772e4b86885SCheng Sean Ye 			nb_pci_putw(0, 16, 0, fsb ? 0x492 : 0x192, val); \
773e4b86885SCheng Sean Ye 	}
774e4b86885SCheng Sean Ye #define	ERR0_FSB_WR(fsb, val) \
775e4b86885SCheng Sean Ye 	{ \
776e4b86885SCheng Sean Ye 		if (nb_chipset == INTEL_NB_7300) \
777e4b86885SCheng Sean Ye 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
778e4b86885SCheng Sean Ye 			    (fsb & 1) ? 0xd4 : 0x54, val); \
779e4b86885SCheng Sean Ye 		else \
780e4b86885SCheng Sean Ye 			nb_pci_putw(0, 16, 0, fsb ? 0x494 : 0x194, val); \
781e4b86885SCheng Sean Ye 	}
782e4b86885SCheng Sean Ye #define	ERR1_FSB_WR(fsb, val) \
783e4b86885SCheng Sean Ye 	{ \
784e4b86885SCheng Sean Ye 		if (nb_chipset == INTEL_NB_7300) \
785e4b86885SCheng Sean Ye 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
786e4b86885SCheng Sean Ye 			    (fsb & 1) ? 0xd6 : 0x56, val); \
787e4b86885SCheng Sean Ye 		else \
788e4b86885SCheng Sean Ye 			nb_pci_putw(0, 16, 0, fsb ? 0x496 : 0x196, val); \
789e4b86885SCheng Sean Ye 	}
790e4b86885SCheng Sean Ye #define	ERR2_FSB_WR(fsb, val) \
791e4b86885SCheng Sean Ye 	{ \
792e4b86885SCheng Sean Ye 		if (nb_chipset == INTEL_NB_7300) \
793e4b86885SCheng Sean Ye 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
794e4b86885SCheng Sean Ye 			    (fsb & 1) ? 0xd8 : 0x58, val); \
795e4b86885SCheng Sean Ye 		else \
796e4b86885SCheng Sean Ye 			nb_pci_putw(0, 16, 0, fsb ? 0x498 : 0x198, val); \
797e4b86885SCheng Sean Ye 	}
798e4b86885SCheng Sean Ye #define	MCERR_FSB_WR(fsb, val) \
799e4b86885SCheng Sean Ye 	{ \
800e4b86885SCheng Sean Ye 		if (nb_chipset == INTEL_NB_7300) \
801e4b86885SCheng Sean Ye 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
802e4b86885SCheng Sean Ye 			    (fsb & 1) ? 0xda : 0x5a, val); \
803e4b86885SCheng Sean Ye 		else \
804e4b86885SCheng Sean Ye 			nb_pci_putw(0, 16, 0, fsb ? 0x49a : 0x19a, val); \
805e4b86885SCheng Sean Ye 	}
806e4b86885SCheng Sean Ye 
807e4b86885SCheng Sean Ye #define	NRECSF_RD()	(nb_chipset == INTEL_NB_5000X || \
808e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300) ? ((uint64_t)( \
809e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xb4, 0)) << 32) | \
810e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xb0, 0) : 0LL
811e4b86885SCheng Sean Ye #define	RECSF_RD()	(nb_chipset == INTEL_NB_5000X || \
812e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300) ? ((uint64_t)( \
813e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xbc, 0)) << 32) | \
814e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xb8, 0) : 0LL
815e4b86885SCheng Sean Ye 
816e4b86885SCheng Sean Ye #define	NRECSF_WR()	if (nb_chipset == INTEL_NB_5000X || \
817e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300) { \
818e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 2, 0xbc, 0); \
819e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 2, 0xb0, 0); \
820e4b86885SCheng Sean Ye 	}
821e4b86885SCheng Sean Ye #define	RECSF_WR()	if (nb_chipset == INTEL_NB_5000X || \
822e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300) { \
823e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 2, 0xbc, 0); \
824e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 2, 0xb8, 0); \
825e4b86885SCheng Sean Ye 	}
826e4b86885SCheng Sean Ye 
827e4b86885SCheng Sean Ye #define	FERR_FAT_INT_RD(ip)	(((nb_chipset == INTEL_NB_5400) ? \
828e4b86885SCheng Sean Ye 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc1, ip) << 8) : (uint16_t)0) | \
829e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 2, 0xc0, ip))
830e4b86885SCheng Sean Ye #define	FERR_NF_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
831e4b86885SCheng Sean Ye 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc3, ip) << 8) | \
832e4b86885SCheng Sean Ye 	nb_pci_getb(0, 16, 2, 0xc2, ip) : \
833e4b86885SCheng Sean Ye 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc1, ip))
834e4b86885SCheng Sean Ye #define	NERR_FAT_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
8359ff4cbe7SAdrian Frost 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc5, ip) << 8) | \
8369ff4cbe7SAdrian Frost 	nb_pci_getb(0, 16, 2, 0xc4, ip) : \
837e4b86885SCheng Sean Ye 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc2, ip))
838e4b86885SCheng Sean Ye #define	NERR_NF_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
8399ff4cbe7SAdrian Frost 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc7, ip) << 8) | \
8409ff4cbe7SAdrian Frost 	nb_pci_getb(0, 16, 2, 0xc6, ip) : \
841e4b86885SCheng Sean Ye 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc3, ip))
842e4b86885SCheng Sean Ye #define	EMASK_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
843e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xd0, 0) : nb_pci_getb(0, 16, 2, 0xcc, 0))
844e4b86885SCheng Sean Ye #define	ERR0_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
845e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xd4, 0) : nb_pci_getb(0, 16, 2, 0xd0, 0))
846e4b86885SCheng Sean Ye #define	ERR1_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
847e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xd8, 0) : nb_pci_getb(0, 16, 2, 0xd1, 0))
848e4b86885SCheng Sean Ye #define	ERR2_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
849e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xdc, 0) : nb_pci_getb(0, 16, 2, 0xd2, 0))
850e4b86885SCheng Sean Ye #define	MCERR_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
851e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 2, 0xe0, 0) : nb_pci_getb(0, 16, 2, 0xd3, 0))
852e4b86885SCheng Sean Ye 
853e4b86885SCheng Sean Ye #define	FERR_FAT_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
854e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc0,  \
855e4b86885SCheng Sean Ye 					    val & 0xff); \
856e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc1, val >> 8); \
857e4b86885SCheng Sean Ye 				} else { \
858e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc0, val); \
859e4b86885SCheng Sean Ye 				}
860e4b86885SCheng Sean Ye #define	FERR_NF_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
861e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc2,  \
862e4b86885SCheng Sean Ye 					    val & 0xff); \
863e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc3, val >> 8); \
864e4b86885SCheng Sean Ye 				} else { \
865e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc1, val); \
866e4b86885SCheng Sean Ye 				}
867e4b86885SCheng Sean Ye #define	NERR_FAT_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
868e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc4,  \
869e4b86885SCheng Sean Ye 					    val & 0xff); \
870e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc5, val >> 8); \
871e4b86885SCheng Sean Ye 				} else { \
872e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc2, val); \
873e4b86885SCheng Sean Ye 				}
874e4b86885SCheng Sean Ye #define	NERR_NF_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
875e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc6,  \
876e4b86885SCheng Sean Ye 					    val & 0xff); \
877e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc7, val >> 8); \
878e4b86885SCheng Sean Ye 				} else { \
879e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xc3, val); \
880e4b86885SCheng Sean Ye 				}
881e4b86885SCheng Sean Ye #define	EMASK_5000_INT_WR(val)	nb_pci_putb(0, 16, 2, 0xcc, val)
882e4b86885SCheng Sean Ye #define	EMASK_5400_INT_WR(val)	nb_pci_putl(0, 16, 2, 0xd0, val)
883e4b86885SCheng Sean Ye #define	EMASK_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
884e4b86885SCheng Sean Ye 					EMASK_5400_INT_WR(val); \
885e4b86885SCheng Sean Ye 				} else { \
886e4b86885SCheng Sean Ye 					EMASK_5000_INT_WR(val); \
887e4b86885SCheng Sean Ye 				}
888e4b86885SCheng Sean Ye #define	ERR0_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
889e4b86885SCheng Sean Ye 					nb_pci_putl(0, 16, 2, 0xd4, val); \
890e4b86885SCheng Sean Ye 				} else { \
891e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xd0, val); \
892e4b86885SCheng Sean Ye 				}
893e4b86885SCheng Sean Ye #define	ERR1_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
894e4b86885SCheng Sean Ye 					nb_pci_putl(0, 16, 2, 0xd8, val); \
895e4b86885SCheng Sean Ye 				} else { \
896e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xd1, val); \
897e4b86885SCheng Sean Ye 				}
898e4b86885SCheng Sean Ye #define	ERR2_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
899e4b86885SCheng Sean Ye 					nb_pci_putl(0, 16, 2, 0xdc, val); \
900e4b86885SCheng Sean Ye 				} else { \
901e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xd2, val); \
902e4b86885SCheng Sean Ye 				}
903e4b86885SCheng Sean Ye #define	MCERR_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
904e4b86885SCheng Sean Ye 					nb_pci_putl(0, 16, 2, 0xe0, val); \
905e4b86885SCheng Sean Ye 				} else { \
906e4b86885SCheng Sean Ye 					nb_pci_putb(0, 16, 2, 0xd3, val); \
907e4b86885SCheng Sean Ye 				}
908e4b86885SCheng Sean Ye 
90985738508SVuong Nguyen #define	NRECINT_RD()		nb_pci_getl(0, 16, 2, \
91085738508SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? 0xc8 : 0xc4, 0)
91185738508SVuong Nguyen #define	RECINT_RD()		nb_pci_getl(0, 16, 2, \
91285738508SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? 0xcc : 0xc8, 0)
913e4b86885SCheng Sean Ye 
91485738508SVuong Nguyen #define	NRECINT_WR()		nb_pci_putl(0, 16, 2, \
91585738508SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? 0xc8 : 0xc4, 0)
91685738508SVuong Nguyen #define	RECINT_WR()		nb_pci_putl(0, 16, 2, \
91785738508SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? 0xcc : 0xc8, 0)
91885738508SVuong Nguyen 
919e4b86885SCheng Sean Ye 
920e4b86885SCheng Sean Ye #define	FERR_FAT_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0x98, ip)
921e4b86885SCheng Sean Ye #define	NERR_FAT_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0x9c, ip)
922e4b86885SCheng Sean Ye #define	FERR_NF_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0xa0, ip)
923e4b86885SCheng Sean Ye #define	NERR_NF_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0xa4, ip)
924e4b86885SCheng Sean Ye #define	EMASK_FBD_RD()		nb_pci_getl(0, 16, 1, 0xa8, 0)
925e4b86885SCheng Sean Ye #define	ERR0_FBD_RD()		nb_pci_getl(0, 16, 1, 0xac, 0)
926e4b86885SCheng Sean Ye #define	ERR1_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb0, 0)
927e4b86885SCheng Sean Ye #define	ERR2_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb4, 0)
928e4b86885SCheng Sean Ye #define	MCERR_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb8, 0)
929e4b86885SCheng Sean Ye 
930e4b86885SCheng Sean Ye #define	FERR_FAT_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0x98, val)
931e4b86885SCheng Sean Ye #define	NERR_FAT_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0x9c, val)
932e4b86885SCheng Sean Ye #define	FERR_NF_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa0, val)
933e4b86885SCheng Sean Ye #define	NERR_NF_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa4, val)
934e4b86885SCheng Sean Ye #define	EMASK_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa8, val)
935e4b86885SCheng Sean Ye #define	ERR0_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xac, val)
936e4b86885SCheng Sean Ye #define	ERR1_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb0, val)
937e4b86885SCheng Sean Ye #define	ERR2_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb4, val)
938e4b86885SCheng Sean Ye #define	MCERR_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb8, val)
939e4b86885SCheng Sean Ye 
940e4b86885SCheng Sean Ye #define	NRECMEMA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
941e4b86885SCheng Sean Ye 	nb_pci_getw(0, (branch) ? 22 : 21, 1, 0xbe, 0) : \
942e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 1, 0xbe, 0))
943e4b86885SCheng Sean Ye #define	NRECMEMB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
944e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc0, 0) : \
945e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, 0xc0, 0))
946e4b86885SCheng Sean Ye #define	NRECFGLOG_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
947e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x74, 0) : \
948f899e573SVuong Nguyen 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0x74 : 0xc4, 0))
949e4b86885SCheng Sean Ye #define	NRECFBDA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
950e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc4, 0) : \
951e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xc4 : 0xc8, 0))
952e4b86885SCheng Sean Ye #define	NRECFBDB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
953e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc8, 0) : \
954e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xc8 : 0xcc, 0))
955e4b86885SCheng Sean Ye #define	NRECFBDC_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
956e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xcc, 0) : \
957e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xcc : 0xd0, 0))
958e4b86885SCheng Sean Ye #define	NRECFBDD_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
959e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd0, 0) : \
960e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xd0 : 0xd4, 0))
961e4b86885SCheng Sean Ye #define	NRECFBDE_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
962e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd4, 0) : \
963e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xd4 : 0xd8, 0))
964e4b86885SCheng Sean Ye #define	NRECFBDF_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
965e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd8, 0) : \
966e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300 ? nb_pci_getw(0, 16, 1, 0xd8, 0) : 0)
967e4b86885SCheng Sean Ye #define	REDMEMB_RD()	(nb_chipset == INTEL_NB_5400 ? \
968e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x7c, 0) : \
969e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, 0x7c, 0))
970e4b86885SCheng Sean Ye #define	RECMEMA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
971e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe0, 0) & 0xffffff : \
972e4b86885SCheng Sean Ye 	nb_pci_getw(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe0 : 0xe2, 0))
973e4b86885SCheng Sean Ye #define	RECMEMB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
974e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe4, 0) : \
975e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, 0xe4, 0))
976e4b86885SCheng Sean Ye #define	RECFGLOG_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
977e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x78, 0) : \
978e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300 ?  nb_pci_getl(0, 16, 1, 0x78, 0) : \
979e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, 0xe8, 0))
980e4b86885SCheng Sean Ye #define	RECFBDA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
981e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe8, 0) : \
982e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe8 : 0xec, 0))
983e4b86885SCheng Sean Ye #define	RECFBDB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
984e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xec, 0) : \
985e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xec : 0xf0, 0))
986e4b86885SCheng Sean Ye #define	RECFBDC_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
987e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf0, 0) : \
988e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf0 : 0xf4, 0))
989e4b86885SCheng Sean Ye #define	RECFBDD_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
990e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf4, 0) : \
991e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf4 : 0xf8, 0))
992e4b86885SCheng Sean Ye #define	RECFBDE_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
993e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf8, 0) : \
994e4b86885SCheng Sean Ye 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf8 : 0xfc, 0))
995e4b86885SCheng Sean Ye #define	RECFBDF_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
996e4b86885SCheng Sean Ye 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xfc, 0) : \
997e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_7300 ? nb_pci_getw(0, 16, 1, 0xfc, 0) : 0)
998e4b86885SCheng Sean Ye #define	NRECMEMA_WR(branch)	(nb_chipset == INTEL_NB_5400 ? \
999e4b86885SCheng Sean Ye 	nb_pci_putw(0, (branch) ? 22 : 21, 1, 0xbe, 0) : \
1000e4b86885SCheng Sean Ye 	nb_pci_putw(0, 16, 1, 0xbe, 0))
1001e4b86885SCheng Sean Ye #define	NRECMEMB_WR(branch)	(nb_chipset == INTEL_NB_5400 ? \
1002e4b86885SCheng Sean Ye 	nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc0, 0) : \
1003e4b86885SCheng Sean Ye 	nb_pci_putl(0, 16, 1, 0xc0, 0))
1004e4b86885SCheng Sean Ye #define	NRECFGLOG_WR(branch) \
1005e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1006e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x74, 0); \
1007e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1008e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0x74, 0); \
1009e4b86885SCheng Sean Ye 	else \
1010e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xc4, 0)
1011e4b86885SCheng Sean Ye #define	NRECFBDA_WR(branch) \
1012e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1013e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc4, 0); \
1014e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1015e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xc4, 0); \
1016e4b86885SCheng Sean Ye 	else \
1017e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xc8, 0)
1018e4b86885SCheng Sean Ye #define	NRECFBDB_WR(branch) \
1019e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1020e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc8, 0); \
1021e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1022e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xc8, 0); \
1023e4b86885SCheng Sean Ye 	else \
1024e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xcc, 0)
1025e4b86885SCheng Sean Ye #define	NRECFBDC_WR(branch) \
1026e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1027e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xcc, 0); \
1028e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1029e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xcc, 0); \
1030e4b86885SCheng Sean Ye 	else \
1031e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xd0, 0)
1032e4b86885SCheng Sean Ye #define	NRECFBDD_WR(branch) \
1033e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1034e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd0, 0); \
1035e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1036e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xd0, 0); \
1037e4b86885SCheng Sean Ye 	else \
1038e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xd4, 0)
1039e4b86885SCheng Sean Ye #define	NRECFBDE_WR(branch) \
1040e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1041e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd4, 0); \
1042e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1043e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xd4, 0); \
1044e4b86885SCheng Sean Ye 	else \
1045e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xd8, 0)
1046e4b86885SCheng Sean Ye #define	NRECFBDF_WR(branch) \
1047e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1048e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd8, 0); \
1049e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1050e4b86885SCheng Sean Ye 		nb_pci_putw(0, 16, 1, 0xd8, 0);
1051e4b86885SCheng Sean Ye #define	REDMEMB_WR(branch) \
1052e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1053e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x7c, 0); \
1054e4b86885SCheng Sean Ye 	else \
1055e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0x7c, 0)
1056e4b86885SCheng Sean Ye #define	RECMEMA_WR(branch) \
1057e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1058e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe0, 0); \
1059e4b86885SCheng Sean Ye 	else \
1060e4b86885SCheng Sean Ye 		nb_pci_putw(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe0 : \
1061e4b86885SCheng Sean Ye 		    0xe2, 0)
1062e4b86885SCheng Sean Ye #define	RECMEMB_WR(branch) \
1063e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1064e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe4, 0); \
1065e4b86885SCheng Sean Ye 	else \
1066e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xe4, 0)
1067e4b86885SCheng Sean Ye #define	RECFGLOG_WR(branch) \
1068e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1069e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x78, 0); \
1070e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1071e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0x78, 0); \
1072e4b86885SCheng Sean Ye 	else \
1073e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xe8, 0)
1074e4b86885SCheng Sean Ye #define	RECFBDA_WR(branch) \
1075e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1076e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe8, 0); \
1077e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1078e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xe8, 0); \
1079e4b86885SCheng Sean Ye 	else \
1080e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xec, 0)
1081e4b86885SCheng Sean Ye #define	RECFBDB_WR(branch) \
1082e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1083e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xec, 0); \
1084e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1085e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xec, 0); \
1086e4b86885SCheng Sean Ye 	else \
1087e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf0, 0)
1088e4b86885SCheng Sean Ye #define	RECFBDC_WR(branch) \
1089e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1090e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf0, 0); \
1091e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1092e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf0, 0); \
1093e4b86885SCheng Sean Ye 	else \
1094e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf4, 0)
1095e4b86885SCheng Sean Ye #define	RECFBDD_WR(branch) \
1096e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1097e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf4, 0); \
1098e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1099e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf4, 0); \
1100e4b86885SCheng Sean Ye 	else \
1101e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf8, 0)
1102e4b86885SCheng Sean Ye #define	RECFBDE_WR(branch) \
1103e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1104e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf8, 0); \
1105e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1106e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xf8, 0); \
1107e4b86885SCheng Sean Ye 	else \
1108e4b86885SCheng Sean Ye 		nb_pci_putl(0, 16, 1, 0xfc, 0)
1109e4b86885SCheng Sean Ye #define	RECFBDF_WR(branch) \
1110e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5400) \
1111e4b86885SCheng Sean Ye 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xfc, 0); \
1112e4b86885SCheng Sean Ye 	else if (nb_chipset == INTEL_NB_7300) \
1113e4b86885SCheng Sean Ye 		nb_pci_putw(0, 16, 1, 0xf8, 0); \
1114e4b86885SCheng Sean Ye 
111585738508SVuong Nguyen #define	FERR_NF_MEM_RD(ip)	nb_pci_getl(0, 16, 1, 0xa0, ip)
111685738508SVuong Nguyen #define	NERR_NF_MEM_RD(ip)	nb_pci_getl(0, 16, 1, 0xa4, ip)
111785738508SVuong Nguyen #define	EMASK_MEM_RD()		nb_pci_getl(0, 16, 1, 0xa8, 0)
111885738508SVuong Nguyen #define	ERR0_MEM_RD()		nb_pci_getl(0, 16, 1, 0xac, 0)
111985738508SVuong Nguyen #define	ERR1_MEM_RD()		nb_pci_getl(0, 16, 1, 0xb0, 0)
112085738508SVuong Nguyen #define	ERR2_MEM_RD()		nb_pci_getl(0, 16, 1, 0xb4, 0)
112185738508SVuong Nguyen #define	MCERR_MEM_RD()		nb_pci_getl(0, 16, 1, 0xb8, 0)
112285738508SVuong Nguyen #define	FERR_NF_MEM_WR(val)	\
112385738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xa0, (val))
112485738508SVuong Nguyen #define	NERR_NF_MEM_WR(val)	\
112585738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xa4, (val))
112685738508SVuong Nguyen #define	EMASK_MEM_WR(val)	\
112785738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xa8, (val))
112885738508SVuong Nguyen #define	ERR0_MEM_WR(val)	\
112985738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xac, (val))
113085738508SVuong Nguyen #define	ERR1_MEM_WR(val)	\
113185738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xb0, (val))
113285738508SVuong Nguyen #define	ERR2_MEM_WR(val)	\
113385738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xb4, (val))
113485738508SVuong Nguyen #define	MCERR_MEM_WR(val)	\
113585738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0xb8, (val))
113685738508SVuong Nguyen #define	VALIDLOG_RD(branch)	\
113785738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x18c, 0)
113885738508SVuong Nguyen #define	MEM_NRECMEMA_RD(branch) \
113985738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x190, 0)
114085738508SVuong Nguyen #define	MEM_NRECMEMB_RD(branch) \
114185738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x194, 0)
114285738508SVuong Nguyen #define	MEM_REDMEMA_RD(branch) \
114385738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x198, 0)
114485738508SVuong Nguyen #define	MEM_REDMEMB_RD(branch) \
114585738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x19c, 0)
114685738508SVuong Nguyen #define	MEM_RECMEMA_RD(branch) \
114785738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x1a0, 0)
114885738508SVuong Nguyen #define	MEM_RECMEMB_RD(branch) \
114985738508SVuong Nguyen 	nb_pci_getl(0, (branch) ? 22 : 21, 0, 0x1a4, 0)
115085738508SVuong Nguyen #define	MEM_CERRCNT_RD(branch) nb_pci_getl(0, 21, 0, 0x180, 0)
115185738508SVuong Nguyen #define	MEM_CERRCNT_EXT_RD(branch) nb_pci_getw(0, 21, 0, 0x184, 0)
115285738508SVuong Nguyen #define	MEM_NRECMEMA_WR(branch) \
115385738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x190, 0)
115485738508SVuong Nguyen #define	MEM_NRECMEMB_WR(branch) \
115585738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x194, 0)
115685738508SVuong Nguyen #define	MEM_REDMEMA_WR(branch) \
115785738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x198, 0)
115885738508SVuong Nguyen #define	MEM_REDMEMB_WR(branch) \
115985738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x19c, 0)
116085738508SVuong Nguyen #define	MEM_RECMEMA_WR(branch) \
116185738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x1a0, 0)
116285738508SVuong Nguyen #define	MEM_RECMEMB_WR(branch) \
116385738508SVuong Nguyen 	nb_pci_putl(0, (branch) ? 22 : 21, 0, 0x1a4, 0)
116485738508SVuong Nguyen 
1165e4b86885SCheng Sean Ye #define	MC_RD()		nb_pci_getl(0, 16, 1, 0x40, 0)
1166e4b86885SCheng Sean Ye #define	MC_WR(val)	nb_pci_putl(0, 16, 1, 0x40, val)
1167e4b86885SCheng Sean Ye #define	MCA_RD()	nb_pci_getl(0, 16, 1, 0x58, 0)
1168e4b86885SCheng Sean Ye #define	TOLM_RD()	nb_pci_getw(0, 16, 1, 0x6c, 0)
1169e4b86885SCheng Sean Ye 
117085738508SVuong Nguyen #define	MTR_5100_RD(channel, rank) ((rank) < 4 ? \
117185738508SVuong Nguyen 	nb_pci_getw(0, (channel) == 0 ? 21 : 22, 0, 0x154 + ((rank) * 2), 0) : \
117285738508SVuong Nguyen 	nb_pci_getw(0, (channel) == 0 ? 21 : 22, 0, 0x1b0 + (((rank) & 3) * 2),\
117385738508SVuong Nguyen 	0))
117485738508SVuong Nguyen 
117585738508SVuong Nguyen #define	MTR_RD(branch, dimm) (nb_chipset == INTEL_NB_5100 ? \
117685738508SVuong Nguyen 	MTR_5100_RD(branch, dimm) : \
117785738508SVuong Nguyen 	nb_chipset == INTEL_NB_5400 ? \
1178e4b86885SCheng Sean Ye 	nb_pci_getw(0, (branch) == 0 ? 21 : 22, 0, 0x80 + dimm * 2, 0) : \
1179e4b86885SCheng Sean Ye 	((branch) == 0) ? \
1180e4b86885SCheng Sean Ye 	nb_pci_getw(0, 21, 0, \
1181e4b86885SCheng Sean Ye 	dimm >= 4 ? 0x82 + (dimm & 3) * 4 : 0x80 + dimm * 4, 0) : \
1182e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1183e4b86885SCheng Sean Ye 	nb_pci_getw(0, 22, 0, \
1184e4b86885SCheng Sean Ye 	dimm >= 4 ? 0x82 + (dimm & 3) * 4 : 0x80 + dimm * 4, 0) : 0)
1185e4b86885SCheng Sean Ye #define	MIR_RD(reg)	nb_pci_getw(0, 16, 1, 0x80 + ((reg)*4), 0)
1186e4b86885SCheng Sean Ye 
1187e4b86885SCheng Sean Ye #define	DMIR_RD(branch, reg) \
118885738508SVuong Nguyen 	nb_chipset == INTEL_NB_5100 ? \
118985738508SVuong Nguyen 	nb_pci_getl(0, ((branch) == 0) ? 21 : 22, 0, 0x15c + ((reg)*4), 0) : \
1190e4b86885SCheng Sean Ye 	((branch) == 0) ? nb_pci_getl(0, 21, 0, 0x90 + ((reg)*4), 0) : \
1191e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1192e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0x90 + ((reg)*4), 0) : 0
1193e4b86885SCheng Sean Ye 
1194e4b86885SCheng Sean Ye #define	SPCPC_RD(branch) (nb_chipset == INTEL_NB_5000P || \
1195e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1196e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? \
1197e4b86885SCheng Sean Ye 	(((branch) == 0) ? \
1198e4b86885SCheng Sean Ye 	(uint32_t)nb_pci_getb(0, 21, 0, 0x40, 0) : \
1199e4b86885SCheng Sean Ye 	    (nb_number_memory_controllers == 2) ? \
1200e4b86885SCheng Sean Ye 	    (uint32_t)nb_pci_getb(0, 22, 0, 0x40, 0) : 0) : \
1201e4b86885SCheng Sean Ye 	nb_pci_getl(0, ((branch) == 0) ? 21 : 22, 0, 0x40, 0))
1202e4b86885SCheng Sean Ye 
1203e4b86885SCheng Sean Ye #define	SPCPC_SPARE_ENABLE (nb_chipset == INTEL_NB_5000P || \
1204e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1205e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 1 : 0x20)
1206e4b86885SCheng Sean Ye #define	SPCPC_SPRANK(spcpc) (nb_chipset == INTEL_NB_5000P || \
1207e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1208e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? \
1209e4b86885SCheng Sean Ye 	(((spcpc) >> 1) & 7) : ((spcpc) & 0xf))
1210e4b86885SCheng Sean Ye 
1211e4b86885SCheng Sean Ye #define	SPCPS_RD(branch) ((branch) == 0) ? \
1212e4b86885SCheng Sean Ye 	nb_pci_getb(0, 21, 0, nb_chipset == INTEL_NB_5000P || \
1213e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1214e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0) : \
1215e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1216e4b86885SCheng Sean Ye 	nb_pci_getb(0, 22, 0, nb_chipset == INTEL_NB_5000P || \
1217e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1218e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0) : 0
1219e4b86885SCheng Sean Ye 
1220e4b86885SCheng Sean Ye #define	SPCPS_WR(branch) \
1221e4b86885SCheng Sean Ye 	if ((branch) == 0) { \
1222e4b86885SCheng Sean Ye 		nb_pci_putb(0, 21, 0, nb_chipset == INTEL_NB_5000P || \
1223e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000X || \
1224e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000V || \
1225e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0); \
1226e4b86885SCheng Sean Ye 	} else if (nb_number_memory_controllers == 2) { \
1227e4b86885SCheng Sean Ye 		nb_pci_putb(0, 22, 0, nb_chipset == INTEL_NB_5000P || \
1228e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000X || \
1229e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000V || \
1230e4b86885SCheng Sean Ye 		    nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0); \
1231e4b86885SCheng Sean Ye 	}
1232e4b86885SCheng Sean Ye 
1233e4b86885SCheng Sean Ye #define	SPCPS_SPARE_DEPLOYED (nb_chipset == INTEL_NB_5000P || \
1234e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1235e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 0x11 : 0x60)
1236e4b86885SCheng Sean Ye #define	SPCPS_FAILED_RANK(spcps) (nb_chipset == INTEL_NB_5000P || \
1237e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1238e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? (((spcps) >> 1) & 7) : ((spcps) & 0xf))
1239e4b86885SCheng Sean Ye 
1240e4b86885SCheng Sean Ye #define	UERRCNT_RD(branch) ((branch) == 0) ? \
1241e4b86885SCheng Sean Ye 	nb_pci_getl(0, 21, 0, 0xa4, 0) : \
1242e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1243e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0xa4, 0) : 0
1244e4b86885SCheng Sean Ye #define	CERRCNT_RD(branch) ((branch) == 0) ? \
1245e4b86885SCheng Sean Ye 	nb_pci_getl(0, 21, 0, 0xa8, 0) : \
1246e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1247e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0xa8, 0) : 0
1248e4b86885SCheng Sean Ye #define	CERRCNTA_RD(branch, channel) \
1249e4b86885SCheng Sean Ye 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1250e4b86885SCheng Sean Ye 	(channel & 1) == 0 ? 0xe0 : 0xf0, 0)
1251e4b86885SCheng Sean Ye #define	CERRCNTB_RD(branch, channel) \
1252e4b86885SCheng Sean Ye 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1253e4b86885SCheng Sean Ye 	(channel & 1) == 0 ? 0xe4 : 0xf4, 0)
1254e4b86885SCheng Sean Ye #define	CERRCNTC_RD(branch, channel) \
1255e4b86885SCheng Sean Ye 	(nb_chipset == INTEL_NB_7300 ? \
1256e4b86885SCheng Sean Ye 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1257e4b86885SCheng Sean Ye 	(channel & 1) == 0 ? 0xe8 : 0xf8, 0) : 0)
1258e4b86885SCheng Sean Ye #define	CERRCNTD_RD(branch, channel) \
1259e4b86885SCheng Sean Ye 	(nb_chipset == INTEL_NB_7300 ? \
1260e4b86885SCheng Sean Ye 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1261e4b86885SCheng Sean Ye 	(channel & 1) == 0 ? 0xec : 0xfc, 0) : 0)
1262e4b86885SCheng Sean Ye #define	BADRAMA_RD(branch) ((branch) == 0) ? \
1263e4b86885SCheng Sean Ye 	nb_pci_getl(0, 21, 0, 0xac, 0) : \
1264e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1265e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0xac, 0) : 0
1266e4b86885SCheng Sean Ye #define	BADRAMB_RD(branch) ((branch) == 0) ? \
1267e4b86885SCheng Sean Ye 	nb_pci_getw(0, 21, 0, 0xb0, 0) : \
1268e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1269e4b86885SCheng Sean Ye 	nb_pci_getw(0, 22, 0, 0xb0, 0) : 0
1270e4b86885SCheng Sean Ye #define	BADCNT_RD(branch) ((branch) == 0) ? \
1271e4b86885SCheng Sean Ye 	nb_pci_getl(0, 21, 0, 0xb4, 0) : \
1272e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1273e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0xb4, 0) : 0
1274e4b86885SCheng Sean Ye 
1275e4b86885SCheng Sean Ye #define	UERRCNT_WR(branch, val)	((branch) == 0) ? \
1276e4b86885SCheng Sean Ye 	nb_pci_putl(0, 21, 0, 0xa4, val) : \
1277e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1278e4b86885SCheng Sean Ye 	nb_pci_putl(0, 22, 0, 0xa4, val) \
1279e4b86885SCheng Sean Ye 					: 0
1280e4b86885SCheng Sean Ye #define	CERRCNT_WR(branch, val)	((branch) == 0) ? \
1281e4b86885SCheng Sean Ye 	nb_pci_putl(0, 21, 0, 0xa8, val) : \
1282e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1283e4b86885SCheng Sean Ye 	nb_pci_putl(0, 22, 0, 0xa8, val) : 0
1284e4b86885SCheng Sean Ye #define	BADRAMA_WR(branch, val)	((branch) == 0) ? \
1285e4b86885SCheng Sean Ye 	nb_pci_putl(0, 21, 0, 0xac, val) : \
1286e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1287e4b86885SCheng Sean Ye 	nb_pci_putl(0, 22, 0, 0xac, val) : 0
1288e4b86885SCheng Sean Ye #define	BADRAMB_WR(branch, val)	((branch) == 0) ? \
1289e4b86885SCheng Sean Ye 	nb_pci_putw(0, 21, 0, 0xb0, val) : \
1290e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1291e4b86885SCheng Sean Ye 	nb_pci_putw(0, 22, 0, 0xb0) : 0
1292e4b86885SCheng Sean Ye #define	BADCNT_WR(branch, val) ((branch) == 0) ? \
1293e4b86885SCheng Sean Ye 	nb_pci_putl(0, 21, 0, 0xb4, val) : \
1294e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1295e4b86885SCheng Sean Ye 	nb_pci_putl(0, 22, 0, 0xb4, val) : 0
1296e4b86885SCheng Sean Ye 
129785738508SVuong Nguyen #define	SPD_RD(branch, channel) \
129885738508SVuong Nguyen 	nb_chipset == INTEL_NB_5100 ? nb_pci_getw(0, 16, 1, 0x48, 0) : \
129985738508SVuong Nguyen 	((branch) == 0) ? \
1300e4b86885SCheng Sean Ye 	nb_pci_getw(0, 21, 0, 0x74 + ((channel) * 2), 0) : \
1301e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1302e4b86885SCheng Sean Ye 	nb_pci_getw(0, 22, 0, 0x74 + ((channel) * 2), 0) : 0
1303e4b86885SCheng Sean Ye #define	SPDCMDRD(branch, channel) ((branch) == 0) ? \
1304e4b86885SCheng Sean Ye 	nb_pci_getl(0, 21, 0, 0x78 + ((channel) * 4), 0) : \
1305e4b86885SCheng Sean Ye 	(nb_number_memory_controllers == 2) ? \
1306e4b86885SCheng Sean Ye 	nb_pci_getl(0, 22, 0, 0x78 + ((channel) * 4), 0) : 0
1307e4b86885SCheng Sean Ye 
1308e4b86885SCheng Sean Ye #define	SPDCMD1_1_WR(val)	nb_pci_putl(0, 21, 0, 0x7c, val)
1309e4b86885SCheng Sean Ye #define	SPDCMD_WR(branch, channel, val)	\
131085738508SVuong Nguyen 	if (nb_chipset == INTEL_NB_5100) \
131185738508SVuong Nguyen 	nb_pci_putl(0, 16, 1, 0x4c, val); \
131285738508SVuong Nguyen 	else if ((branch) == 0) \
1313e4b86885SCheng Sean Ye 	nb_pci_putl(0, 21, 0, 0x78 + ((channel) * 4), val); \
1314e4b86885SCheng Sean Ye 	else if (nb_number_memory_controllers == 2) \
1315e4b86885SCheng Sean Ye 	nb_pci_putl(0, 22, 0, 0x78 + ((channel) * 4), val)
1316e4b86885SCheng Sean Ye 
1317e4b86885SCheng Sean Ye #define	UNCERRSTS_RD(pex)		nb_pci_getl(0, pex, 0, 0x104, 0)
1318e4b86885SCheng Sean Ye #define	UNCERRMSK_RD(pex) nb_pci_getl(0, pex, 0, 0x108, 0)
1319e4b86885SCheng Sean Ye #define	PEX_FAT_FERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x154, 0)
1320e4b86885SCheng Sean Ye #define	PEX_FAT_NERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x15c, 0)
1321e4b86885SCheng Sean Ye #define	PEX_NF_FERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x158, 0)
1322e4b86885SCheng Sean Ye #define	PEX_NF_NERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x160, 0)
1323e4b86885SCheng Sean Ye #define	PEX_ERR_DOCMD_RD(pex)	((nb_chipset == INTEL_NB_5400) ? \
1324e4b86885SCheng Sean Ye     nb_pci_getw(0, pex, 0, 0x144, 0) : nb_pci_getl(0, pex, 0, 0x144, 0))
1325e4b86885SCheng Sean Ye #define	PEX_ERR_PIN_MASK_RD(pex)	nb_pci_getw(0, pex, 0, 0x146, 0)
1326e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x148, 0)
1327e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x14c, 0)
1328e4b86885SCheng Sean Ye #define	EMASK_RP_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x150, 0)
1329e4b86885SCheng Sean Ye 
1330e4b86885SCheng Sean Ye #define	UNCERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x104, val)
1331e4b86885SCheng Sean Ye #define	UNCERRMSK_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x108, val)
1332e4b86885SCheng Sean Ye #define	PEX_FAT_FERR_ESI_WR(val) nb_pci_putl(0, 0, 0, 0x154, val)
1333e4b86885SCheng Sean Ye #define	PEX_FAT_NERR_ESI_WR(val) nb_pci_putl(0, 0, 0, 0x15c, val)
1334e4b86885SCheng Sean Ye #define	PEX_NF_FERR_ESI_WR(val)	nb_pci_putl(0, 0, 0, 0x158, val)
1335e4b86885SCheng Sean Ye #define	PEX_NF_NERR_ESI_WR(val)	nb_pci_putl(0, 0, 0, 0x160, val)
1336e4b86885SCheng Sean Ye #define	PEX_ERR_DOCMD_WR(pex, val)	((nb_chipset == INTEL_NB_5400) ? \
1337e4b86885SCheng Sean Ye     nb_pci_putw(0, pex, 0, 0x144, val) : nb_pci_putl(0, pex, 0, 0x144, val))
1338e4b86885SCheng Sean Ye #define	PEX_ERR_PIN_MASK_WR(pex, val)	nb_pci_putw(0, pex, 0, 0x146, val)
1339e4b86885SCheng Sean Ye #define	EMASK_UNCOR_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x148, val)
1340e4b86885SCheng Sean Ye #define	EMASK_COR_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x14c, val)
1341e4b86885SCheng Sean Ye #define	EMASK_RP_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x150, val)
1342e4b86885SCheng Sean Ye 
1343e4b86885SCheng Sean Ye #define	PEX_FAT_FERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x154, ip)
1344e4b86885SCheng Sean Ye #define	PEX_FAT_NERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x15c, ip)
1345e4b86885SCheng Sean Ye #define	PEX_NF_FERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x158, ip)
1346e4b86885SCheng Sean Ye #define	PEX_NF_NERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x160, ip)
1347e4b86885SCheng Sean Ye #define	UNCERRSEV_RD(pex)	nb_pci_getl(0, pex, 0, 0x10c, 0)
1348e4b86885SCheng Sean Ye #define	CORERRSTS_RD(pex)	nb_pci_getl(0, pex, 0, 0x110, 0)
1349e4b86885SCheng Sean Ye #define	RPERRSTS_RD(pex)	nb_pci_getl(0, pex, 0, 0x130, 0)
1350e4b86885SCheng Sean Ye #define	RPERRSID_RD(pex)	nb_pci_getl(0, pex, 0, 0x134, 0)
1351e4b86885SCheng Sean Ye #define	AERRCAPCTRL_RD(pex)	nb_pci_getl(0, pex, 0, 0x118, 0)
1352e4b86885SCheng Sean Ye #define	PEXDEVSTS_RD(pex)	nb_pci_getw(0, pex, 0, 0x76, 0)
1353e4b86885SCheng Sean Ye #define	PEXROOTCTL_RD(pex)	nb_pci_getw(0, pex, 0, 0x88, 0)
1354e4b86885SCheng Sean Ye 
1355e4b86885SCheng Sean Ye #define	PEX_FAT_FERR_WR(pex, val) nb_pci_putl(0, pex, 0, 0x154, val)
1356e4b86885SCheng Sean Ye #define	PEX_FAT_NERR_WR(pex, val) nb_pci_putl(0, pex, 0, 0x15c, val)
1357e4b86885SCheng Sean Ye #define	PEX_NF_FERR_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x158, val)
1358e4b86885SCheng Sean Ye #define	PEX_NF_NERR_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x160, val)
1359e4b86885SCheng Sean Ye #define	CORERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x110, val)
1360e4b86885SCheng Sean Ye #define	UNCERRSEV_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x10c, val)
1361e4b86885SCheng Sean Ye #define	RPERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x130, val)
1362e4b86885SCheng Sean Ye #define	PEXDEVSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x76, val)
1363e4b86885SCheng Sean Ye #define	PEXROOTCTL_WR(pex, val)	nb_pci_putw(0, pex, 0, 0x88, val)
1364e4b86885SCheng Sean Ye 
1365e4b86885SCheng Sean Ye #define	PCISTS_RD(ip)		nb_pci_getw(0, 8, 0, 0x6, ip)
1366e4b86885SCheng Sean Ye #define	PCIDEVSTS_RD()		nb_pci_getw(0, 8, 0, 0x76, 0)
1367e4b86885SCheng Sean Ye #define	PCISTS_WR(val)		nb_pci_putw(0, 8, 0, 0x6, val)
1368e4b86885SCheng Sean Ye #define	PCIDEVSTS_WR(val)	nb_pci_putw(0, 8, 0, 0x76, val)
1369e4b86885SCheng Sean Ye 
1370e4b86885SCheng Sean Ye #define	RANK_MASK	(nb_chipset != INTEL_NB_7300 ? 7 : 0xf)
1371e4b86885SCheng Sean Ye #define	CAS_MASK	(nb_chipset == INTEL_NB_5000P || \
1372e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1373e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 0xfff : 0x1fff)
1374e4b86885SCheng Sean Ye #define	RAS_MASK	(nb_chipset == INTEL_NB_5000P || \
1375e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1376e4b86885SCheng Sean Ye 	nb_chipset == INTEL_NB_5000Z ? 0x7fff : 0xffff)
1377e4b86885SCheng Sean Ye #define	BANK_MASK	7
1378e4b86885SCheng Sean Ye 
1379e4b86885SCheng Sean Ye #define	DMIR_RANKS(dmir, rank0, rank1, rank2, rank3) \
1380e4b86885SCheng Sean Ye 	if (nb_chipset == INTEL_NB_5000P || nb_chipset == INTEL_NB_5000X || \
1381f899e573SVuong Nguyen 	    nb_chipset == INTEL_NB_5000V || nb_chipset == INTEL_NB_5000Z) { \
1382f899e573SVuong Nguyen 		rank0 = (dmir) & 0x7; \
1383f899e573SVuong Nguyen 		rank1 = ((dmir) >> 3) & 0x7; \
1384f899e573SVuong Nguyen 		rank2 = ((dmir) >> 6) & 0x7; \
1385f899e573SVuong Nguyen 		rank3 = ((dmir) >> 9) & 0x7; \
1386f899e573SVuong Nguyen 	} else if (nb_chipset == INTEL_NB_5100) { \
1387f899e573SVuong Nguyen 		rank0 = (dmir) & 0x7; \
1388f899e573SVuong Nguyen 		rank1 = ((dmir) >> 4) & 0x7; \
1389f899e573SVuong Nguyen 		rank2 = ((dmir) >> 8) & 0x7; \
1390f899e573SVuong Nguyen 		rank3 = ((dmir) >> 12) & 0x7; \
1391e4b86885SCheng Sean Ye 	} else { \
1392e4b86885SCheng Sean Ye 		rank0 = (dmir) & 0xf; \
1393e4b86885SCheng Sean Ye 		rank1 = ((dmir) >> 4) & 0xf; \
1394e4b86885SCheng Sean Ye 		rank2 = ((dmir) >> 8) & 0xf; \
1395e4b86885SCheng Sean Ye 		rank3 = ((dmir) >> 12) & 0xf; \
1396e4b86885SCheng Sean Ye 	}
1397e4b86885SCheng Sean Ye 
1398e4b86885SCheng Sean Ye #define	FERR_FAT_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf0, ip)
1399e4b86885SCheng Sean Ye #define	FERR_NF_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf1, ip)
1400e4b86885SCheng Sean Ye #define	NERR_FAT_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf2, ip)
1401e4b86885SCheng Sean Ye #define	NERR_NF_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf3, ip)
1402e4b86885SCheng Sean Ye #define	EMASK_THR_RD(ip)	nb_pci_getw(0, 16, 2, 0xf6, ip)
1403e4b86885SCheng Sean Ye #define	ERR0_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xf8, ip)
1404e4b86885SCheng Sean Ye #define	ERR1_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xfa, ip)
1405e4b86885SCheng Sean Ye #define	ERR2_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xfc, ip)
1406e4b86885SCheng Sean Ye #define	MCERR_THR_RD(ip)	nb_pci_getw(0, 16, 2, 0xfe, ip)
1407e4b86885SCheng Sean Ye #define	CTSTS_RD()		nb_pci_getb(0, 16, 4, 0xee, 0)
1408e4b86885SCheng Sean Ye #define	THRTSTS_RD()		nb_pci_getw(0, 16, 3, 0x68, 0)
1409e4b86885SCheng Sean Ye 
1410e4b86885SCheng Sean Ye #define	FERR_FAT_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf0, val)
1411e4b86885SCheng Sean Ye #define	FERR_NF_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf1, val)
1412e4b86885SCheng Sean Ye #define	NERR_FAT_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf2, val)
1413e4b86885SCheng Sean Ye #define	NERR_NF_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf3, val)
1414e4b86885SCheng Sean Ye #define	EMASK_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xf6, val)
1415e4b86885SCheng Sean Ye #define	ERR0_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xf8, val)
1416e4b86885SCheng Sean Ye #define	ERR1_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfa, val)
1417e4b86885SCheng Sean Ye #define	ERR2_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfc, val)
1418e4b86885SCheng Sean Ye #define	MCERR_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfe, val)
1419e4b86885SCheng Sean Ye #define	CTSTS_WR(val)		nb_pci_putb(0, 16, 4, 0xee, val)
1420e4b86885SCheng Sean Ye #define	THRTSTS_WR(val)		nb_pci_putw(0, 16, 3, 0x68, val)
1421e4b86885SCheng Sean Ye 
1422e4b86885SCheng Sean Ye #define	ERR_FAT_THR_F2	0x02	/* >tnid thermal event with intelligent */
1423e4b86885SCheng Sean Ye 				/* throttling disabled */
1424e4b86885SCheng Sean Ye #define	ERR_FAT_THR_F1	0x01	/* catastrophic on-die thermal event */
1425e4b86885SCheng Sean Ye 
1426e4b86885SCheng Sean Ye #define	ERR_NF_THR_F5	0x10	/* deadman timeout on cooling update */
1427e4b86885SCheng Sean Ye #define	ERR_NF_THR_F4	0x08	/* TSMAX Updated */
1428e4b86885SCheng Sean Ye #define	ERR_NF_THR_F3	0x04	/* On-die throttling event */
1429e4b86885SCheng Sean Ye 
1430e4b86885SCheng Sean Ye #define	EMASK_THR_FATAL	(ERR_FAT_THR_F2|ERR_FAT_THR_F1)
1431e4b86885SCheng Sean Ye #define	EMASK_THR_NF	(ERR_NF_THR_F5|ERR_NF_THR_F4|ERR_NF_THR_F3)
1432e4b86885SCheng Sean Ye 
1433e4b86885SCheng Sean Ye #define	EMASK_THR_F5	0x0010	/* deadman timeout on cooling update */
1434e4b86885SCheng Sean Ye #define	EMASK_THR_F4	0x0008	/* TSMAX Updated */
1435e4b86885SCheng Sean Ye #define	EMASK_THR_F3	0x0004	/* On-die throttling event */
1436e4b86885SCheng Sean Ye #define	EMASK_THR_F2	0x0002	/* >tnid thermal event with intelligent */
1437e4b86885SCheng Sean Ye 				/* throttling disabled */
1438e4b86885SCheng Sean Ye #define	EMASK_THR_F1	0x0001	/* catastrophic on-die thermal event */
1439e4b86885SCheng Sean Ye 
144085738508SVuong Nguyen /* dimm type */
144185738508SVuong Nguyen #define	SPD_MEM_TYPE	2
144285738508SVuong Nguyen #define	SPD_DDR2	8
144385738508SVuong Nguyen #define	SPD_FBDIMM	9
144485738508SVuong Nguyen 
1445e4b86885SCheng Sean Ye #ifdef __cplusplus
1446e4b86885SCheng Sean Ye }
1447e4b86885SCheng Sean Ye #endif
1448e4b86885SCheng Sean Ye 
1449e4b86885SCheng Sean Ye #endif /* _NB5000_H */
1450