xref: /titanic_41/usr/src/uts/intel/io/intel_nb5000/nb5000.h (revision 29bd28862cfb8abbd3a0f0a4b17e08bbc3652836)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _NB5000_H
28 #define	_NB5000_H
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <sys/cpu_module.h>
35 
36 #define	NB_5000_MAX_MEM_CONTROLLERS	2
37 #define	NB_MAX_DIMMS_PER_CHANNEL	(nb_chipset == INTEL_NB_7300 ? 8 : 4)
38 #define	NB_MEM_BRANCH_SELECT		(nb_chipset == INTEL_NB_5400 ? 2 : 3)
39 #define	NB_MAX_MEM_BRANCH_SELECT	3
40 #define	NB_MEM_RANK_SELECT		(nb_chipset == INTEL_NB_7300 ? 7 : 5)
41 #define	NB_MAX_MEM_RANK_SELECT		7
42 #define	NB_RANKS_IN_SELECT		4
43 #define	NB_PCI_DEV			10
44 
45 #define	NB_PCI_NFUNC	4
46 
47 #define	DOCMD_PEX_MASK	0x00
48 #define	DOCMD_5400_PEX_MASK	0x000
49 #define	DOCMD_PEX	0xf0
50 #define	DOCMD_5400_PEX	0xff0
51 
52 #define	SPD_BUSY	0x1000
53 #define	SPD_BUS_ERROR	0x2000
54 #define	SPD_READ_DATA_VALID	0x8000
55 #define	SPD_EEPROM_WRITE	0xa8000000
56 #define	SPD_ADDR(slave, addr) ((((slave) & 7) << 24) | (((addr) & 0xff) << 16))
57 
58 #define	MC_MIRROR	0x10000
59 #define	MC_PATROL_SCRUB	0x80
60 #define	MC_DEMAND_SCRUB	0x40
61 
62 #define	MCA_SCHDIMM	0x4000
63 
64 #define	TLOW_MAX	0x100000000ULL
65 
66 #define	MTR_PRESENT(mtr) \
67 	((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0400 : 0x0100))
68 #define	MTR_ETHROTTLE(mtr) \
69 	((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0200 : 0x0080))
70 #define	MTR_WIDTH(mtr) \
71 	(((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0100 : 0x0040)) ? 8 : 4)
72 #define	MTR_NUMBANK(mtr) \
73 	(((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0040 : 0x0020)) ? 8 : 4)
74 #define	MTR_NUMRANK(mtr) \
75 	(((mtr) & (nb_chipset == INTEL_NB_5400 ? 0x0020 : 0x0010)) ? 2 : 1)
76 #define	MTR_NUMROW(mtr) ((((mtr) >> 2) & 3) + 13)
77 #define	MTR_NUMCOL(mtr) (((mtr) & 3) + 10)
78 
79 #define	MTR_DIMMSIZE(mtr) 	((1ULL << (MTR_NUMCOL(mtr) + MTR_NUMROW(mtr))) \
80 	* MTR_NUMRANK(mtr) * MTR_NUMBANK(mtr) * MTR_WIDTH(mtr))
81 
82 /* FERR_GLOBAL and NERR_GLOBAL */
83 #define	GE_FERR_FSB3_FATAL	0x800000000ULL	/* FSB3 Fatal Error */
84 #define	GE_FERR_FSB2_FATAL	0x400000000ULL	/* FSB2 Fatal Error */
85 #define	GE_FERR_FSB3_NF	0x200000000ULL	/* FSB3 Non-Fatal Error */
86 #define	GE_FERR_FSB2_NF	0x100000000ULL	/* FSB2 Non-Fatal Error */
87 
88 #define	GE_INT_FATAL	0x80000000	/* North Bridge Internal Error */
89 #define	GE_DMA_FATAL	0x40000000	/* DMA engine Fatal Error */
90 #define	GE_FSB1_FATAL	0x20000000	/* FSB1 Fatal Error */
91 #define	GE_FSB0_FATAL	0x10000000	/* FSB0 Fatal Error */
92 #define	GE_FERR_FBD_FATAL	0x08000000	/* FBD channel Fatal Error */
93 #define	GE_FERR_FBD3_FATAL	0x08000000	/* FBD3 channel Fatal Error */
94 #define	GE_FERR_FBD2_FATAL	0x04000000	/* FBD2 channel Fatal Error */
95 #define	GE_FERR_FBD1_FATAL	0x02000000	/* FBD1 channel Fatal Error */
96 #define	GE_FERR_FBD0_FATAL	0x01000000	/* FBD0 channel Fatal Error */
97 #define	GE_FERR_THERMAL_FATAL	0x04000000	/* Thermal Fatal Error */
98 #define	GE_PCIEX9_FATAL	0x02000000	/* PCI Express device 9 Fatal Error */
99 #define	GE_PCIEX8_FATAL	0x01000000	/* PCI Express device 8 Fatal Error */
100 #define	GE_PCIEX7_FATAL	0x00800000	/* PCI Express device 7 Fatal Error */
101 #define	GE_PCIEX6_FATAL	0x00400000	/* PCI Express device 6 Fatal Error */
102 #define	GE_PCIEX5_FATAL	0x00200000	/* PCI Express device 5 Fatal Error */
103 #define	GE_PCIEX4_FATAL	0x00100000	/* PCI Express device 4 Fatal Error */
104 #define	GE_PCIEX3_FATAL	0x00080000	/* PCI Express device 3 Fatal Error */
105 #define	GE_PCIEX2_FATAL	0x00040000	/* PCI Express device 2 Fatal Error */
106 #define	GE_PCIEX1_FATAL	0x00020000	/* PCI Express device 1 Fatal Error */
107 #define	GE_ESI_FATAL	0x00010000	/* ESI Fatal Error */
108 #define	GE_INT_NF	0x00008000	/* North Bridge Internal Error */
109 #define	GE_DMA_NF	0x00004000	/* DMA engine Non-Fatal Error */
110 #define	GE_FSB1_NF	0x00002000	/* FSB1 Non-Fatal Error */
111 #define	GE_FSB0_NF	0x00001000	/* FSB0 Non-Fatal Error */
112 #define	GE_FERR_FBD3_NF	0x00000800	/* FBD channel 3 Non-Fatal Error */
113 #define	GE_FERR_FBD2_NF	0x00000400	/* FBD channel 2 Non-Fatal Error */
114 #define	GE_FERR_FBD1_NF	0x00000200	/* FBD channel 1 Non-Fatal Error */
115 #define	GE_FERR_FBD0_NF	0x00000100	/* FBD channel 0 Non-Fatal Error */
116 #define	GE_FERR_FBD_NF	0x00000800	/* FBD channel Non-Fatal Error */
117 #define	GE_FERR_THERMAL_NF 0x00000400	/* Thermal Non-Fatal Error */
118 #define	GE_PCIEX9_NF	0x00000200	/* PCI Express dev 9 Non-Fatal Error */
119 #define	GE_PCIEX8_NF	0x00000100	/* PCI Express dev 8 Non-Fatal Error */
120 #define	GE_PCIEX7_NF	0x00000080	/* PCI Express dev 7 Non-Fatal Error */
121 #define	GE_PCIEX6_NF	0x00000040	/* PCI Express dev 6 Non-Fatal Error */
122 #define	GE_PCIEX5_NF	0x00000020	/* PCI Express dev 5 Non-Fatal Error */
123 #define	GE_PCIEX4_NF	0x00000010	/* PCI Express dev 4 Non-Fatal Error */
124 #define	GE_PCIEX3_NF	0x00000008	/* PCI Express dev 3 Non-Fatal Error */
125 #define	GE_PCIEX2_NF	0x00000004	/* PCI Express dev 2 Non-Fatal Error */
126 #define	GE_PCIEX1_NF	0x00000002	/* PCI Express dev 1 Non-Fatal Error */
127 #define	GE_ESI_NF	0x00000001	/* ESI Non-Fatal Error */
128 
129 #define	GE_NERR_FSB2_FATAL	0x08000000 /* FSB2 Fatal Error */
130 #define	GE_NERR_FSB3_FATAL	0x04000000 /* FSB3 Fatal Error */
131 #define	GE_NERR_FBD_FATAL	0x01000000 /* FBD channel Fatal Error */
132 #define	GE_NERR_FSB2_NF		0x00000800 /* FSB2 Non-Fatal Error */
133 #define	GE_NERR_FSB3_NF		0x00000400 /* FSB3 Non-Fatal Error */
134 #define	GE_NERR_FBD_NF		0x00000100 /* FBD channel Non-Fatal Error */
135 
136 #define	ERR_FAT_FSB_F9		0x20	/* F9Msk FSB Protocol */
137 #define	ERR_FAT_FSB_F2		0x08	/* F2Msk Unsupported Bus Transaction */
138 #define	ERR_FAT_FSB_F1		0x01 	/* F1Msk Request/Address Parity */
139 
140 #define	ERR_NF_FSB_F7		0x04	/* F7Msk Detected MCERR */
141 #define	ERR_NF_FSB_F8		0x02	/* F8Msk B-INIT */
142 #define	ERR_NF_FSB_F6		0x01	/* F6Msk Data Parity */
143 
144 #define	EMASK_FSB_F1		0x0001 	/* F1Msk Request/Address Parity */
145 #define	EMASK_FSB_F2		0x0002	/* F2Msk Unsupported Bus Transaction */
146 #define	EMASK_FSB_F6		0x0020	/* F6Msk Data Parity */
147 #define	EMASK_FSB_F7		0x0040	/* F7Msk Detected MCERR */
148 #define	EMASK_FSB_F8		0x0080	/* F8Msk B-INIT */
149 #define	EMASK_FSB_F9		0x0100	/* F9Msk FSB Protocol */
150 
151 #define	EMASK_FSB_FATAL		(EMASK_FSB_F1 | EMASK_FSB_F2 | EMASK_FSB_F9)
152 #define	EMASK_FSB_NF		(EMASK_FSB_F6 | EMASK_FSB_F7 | EMASK_FSB_F8)
153 
154 #define	ERR_FBD_CH_SHIFT	28 /* channel index in fat_fbd and nf_fbd */
155 
156 #define	ERR_FAT_FBD_M23	0x00400000	/* M23Err Non-Redundant Fast Reset */
157 					/* Timeout */
158 #define	ERR_FAT_FBD_M3	0x00000004	/* M3Err >Tmid thermal event with */
159 					/* intelligent throttling disabled */
160 #define	ERR_FAT_FBD_M2	0x00000002	/* M2Err memory or FBD configuration */
161 					/* CRC read error */
162 #define	ERR_FAT_FBD_M1	0x00000001	/* M1Err memory write error on */
163 					/* non-redundant retry or FBD */
164 					/* configuration write error on retry */
165 #define	ERR_FAT_FBD_MASK 0x007fffff
166 
167 #define	ERR_NF_FBD_M29	0x02000000	/* M29Err DIMM-Isolation Completed */
168 #define	ERR_NF_FBD_M28	0x01000000	/* M28Err DIMM-Spare Copy Completed */
169 #define	ERR_NF_FBD_M27	0x00800000	/* M27Err DIMM-Spare Copy Initiated */
170 #define	ERR_NF_FBD_M26	0x00400000	/* M26Err Redundant Fast Reset */
171 					/* Timeout */
172 #define	ERR_NF_FBD_M25	0x00200000	/* M25Err Memory write error on */
173 #define	ERR_NF_FBD_M24	0x00100000	/* M24Err refresh error */
174 					/* redundant retry */
175 #define	ERR_NF_FBD_M22	0x00040000	/* M22Err SPD protocol */
176 #define	ERR_NF_FBD_M21	0x00020000	/* M21Err FBD Northbound parity on */
177 					/* FBD sync status */
178 #define	ERR_NF_FBD_M20	0x00010000	/* M20Err Correctable patrol data ECC */
179 #define	ERR_NF_FBD_M19	0x00008000	/* M19Err Correctasble resilver or */
180 					/* spare-copy data ECC */
181 #define	ERR_NF_FBD_M18	0x00004000	/* M18Err Correctable Mirrored demand */
182 					/* data ECC */
183 #define	ERR_NF_FBD_M17	0x00002000	/* M17Err Correctable Non-mirrored */
184 					/* demand data ECC */
185 #define	ERR_NF_FBD_M16	0x00001000	/* M16Err channel failed over */
186 #define	ERR_NF_FBD_M15	0x00000800	/* M15Err Memory or FBD configuration */
187 					/* CRC read error */
188 #define	ERR_NF_FBD_M14	0x00000400	/* M14Err FBD configuration write */
189 					/* error on first attempt */
190 #define	ERR_NF_FBD_M13	0x00000200	/* M13Err Memory write error on first */
191 					/* attempt */
192 #define	ERR_NF_FBD_M12	0x00000100	/* M12Err Non-Aliased uncorrectable */
193 					/* patrol data ECC */
194 #define	ERR_NF_FBD_M11	0x00000080	/* M11Err Non-Aliased uncorrectable */
195 					/* resilver or spare copy data ECC */
196 #define	ERR_NF_FBD_M10	0x00000040	/* M10Err Non-Aliased uncorrectable */
197 					/* mirrored demand data ECC */
198 #define	ERR_NF_FBD_M9	0x00000020	/* M9Err Non-Aliased uncorrectable */
199 					/* non-mirrored demand data ECC */
200 #define	ERR_NF_FBD_M8	0x00000010	/* M8Err Aliased uncorrectable */
201 					/* patrol data ECC */
202 #define	ERR_NF_FBD_M7	0x00000008	/* M7Err Aliased uncorrectable */
203 					/* resilver or spare copy data ECC */
204 #define	ERR_NF_FBD_M6	0x00000004	/* M6Err Aliased uncorrectable */
205 					/* mirrored demand data ECC */
206 #define	ERR_NF_FBD_M5	0x00000002	/* M5Err Aliased uncorrectable */
207 					/* non-mirrored demand data ECC */
208 #define	ERR_NF_FBD_M4	0x00000001	/* M4Err uncorrectable data ECC on */
209 					/* replay */
210 
211 #define	ERR_NF_FBD_MASK	0x01ffffff
212 #define	ERR_NF_FBD_ECC_UE	(ERR_NF_FBD_M12|ERR_NF_FBD_M11|ERR_NF_FBD_M10| \
213     ERR_NF_FBD_M9|ERR_NF_FBD_M8|ERR_NF_FBD_M7|ERR_NF_FBD_M6|ERR_NF_FBD_M5| \
214     ERR_NF_FBD_M4)
215 #define	ERR_NF_FBD_MA	(ERR_NF_FBD_M14)
216 #define	ERR_NF_FBD_ECC_CE	(ERR_NF_FBD_M20|ERR_NF_FBD_M19|ERR_NF_FBD_M18| \
217     ERR_NF_FBD_M17|ERR_NF_FBD_M15|ERR_NF_FBD_M21)
218 #define	ERR_NF_FBD_SPARE (ERR_NF_FBD_M28|ERR_NF_FBD_M27)
219 
220 #define	EMASK_FBD_M29	0x10000000	/* M29Err DIMM-Isolation Completed */
221 #define	EMASK_FBD_M28	0x08000000	/* M28Err DIMM-Spare Copy Completed */
222 #define	EMASK_FBD_M27	0x04000000	/* M27Err DIMM-Spare Copy Initiated */
223 #define	EMASK_FBD_M26	0x02000000	/* M26Err Redundant Fast Reset */
224 					/* Timeout */
225 #define	EMASK_FBD_M25	0x01000000	/* M25Err Memory write error on */
226 					/* redundant retry */
227 #define	EMASK_FBD_M24	0x00800000	/* M24Err refresh error */
228 #define	EMASK_FBD_M23	0x00400000	/* M23Err Non-Redundant Fast Reset */
229 					/* Timeout */
230 #define	EMASK_FBD_M22	0x00200000	/* M22Err SPD protocol */
231 #define	EMASK_FBD_M21	0x00100000	/* M21Err FBD Northbound parity on */
232 					/* FBD sync status */
233 #define	EMASK_FBD_M20	0x00080000	/* M20Err Correctable patrol data ECC */
234 #define	EMASK_FBD_M19	0x00040000	/* M19Err Correctasble resilver or */
235 					/* spare-copy data ECC */
236 #define	EMASK_FBD_M18	0x00020000	/* M18Err Correctable Mirrored demand */
237 					/* data ECC */
238 #define	EMASK_FBD_M17	0x00010000	/* M17Err Correctable Non-mirrored */
239 					/* demand data ECC */
240 #define	EMASK_FBD_M16	0x00008000	/* M16Err channel failed over */
241 #define	EMASK_FBD_M15	0x00004000	/* M15Err Memory or FBD configuration */
242 					/* CRC read error */
243 #define	EMASK_FBD_M14	0x00002000	/* M14Err FBD configuration write */
244 					/* error on first attempt */
245 #define	EMASK_FBD_M13	0x00001000	/* M13Err Memory write error on first */
246 					/* attempt */
247 #define	EMASK_FBD_M12	0x00000800	/* M12Err Non-Aliased uncorrectable */
248 					/* patrol data ECC */
249 #define	EMASK_FBD_M11	0x00000400	/* M11Err Non-Aliased uncorrectable */
250 					/* resilver or spare copy data ECC */
251 #define	EMASK_FBD_M10	0x00000200	/* M10Err Non-Aliased uncorrectable */
252 					/* mirrored demand data ECC */
253 #define	EMASK_FBD_M9	0x00000100	/* M9Err Non-Aliased uncorrectable */
254 					/* non-mirrored demand data ECC */
255 #define	EMASK_FBD_M8	0x00000080	/* M8Err Aliased uncorrectable */
256 					/* patrol data ECC */
257 #define	EMASK_FBD_M7	0x00000040	/* M7Err Aliased uncorrectable */
258 					/* resilver or spare copy data ECC */
259 #define	EMASK_FBD_M6	0x00000020	/* M6Err Aliased uncorrectable */
260 					/* mirrored demand data ECC */
261 #define	EMASK_FBD_M5	0x00000010	/* M5Err Aliased uncorrectable */
262 					/* non-mirrored demand data ECC */
263 #define	EMASK_FBD_M4	0x00000008	/* M4Err uncorrectable data ECC on */
264 					/* replay */
265 #define	EMASK_FBD_M3	0x00000004	/* M3Err >Tmid thermal event with */
266 					/* intelligent throttling disabled */
267 #define	EMASK_FBD_M2	0x00000002	/* M2Err memory or FBD configuration */
268 					/* CRC read error */
269 #define	EMASK_FBD_M1	0x00000001	/* M1Err memory write error on */
270 					/* non-redundant retry or FBD */
271 					/* configuration write error on retry */
272 /* MCH 7300 errata 34 (reserved mask bits) */
273 #define	EMASK_5000_FBD_RES	(EMASK_FBD_M24|EMASK_FBD_M16)
274 #define	EMASK_FBD_RES	(nb_chipset == INTEL_NB_5400 ? 0 : EMASK_5000_FBD_RES)
275 
276 #define	EMASK_FBD_FATAL	(EMASK_FBD_M23|EMASK_FBD_M3|EMASK_FBD_M2|EMASK_FBD_M1)
277 #define	EMASK_FBD_NF (EMASK_FBD_M28|EMASK_FBD_M27|EMASK_FBD_M26|EMASK_FBD_M25| \
278 	EMASK_FBD_M22|EMASK_FBD_M21|EMASK_FBD_M20|EMASK_FBD_M19|EMASK_FBD_M18| \
279 	EMASK_FBD_M17|EMASK_FBD_M15|EMASK_FBD_M14|EMASK_FBD_M13|EMASK_FBD_M12| \
280 	EMASK_FBD_M11|EMASK_FBD_M10|EMASK_FBD_M9|EMASK_FBD_M8|EMASK_FBD_M7| \
281 	EMASK_FBD_M6|EMASK_FBD_M5|EMASK_FBD_M4)
282 #define	EMASK_5400_FBD_FATAL	(EMASK_FBD_M23|EMASK_FBD_M2|EMASK_FBD_M1)
283 #define	EMASK_5400_FBD_NF (EMASK_FBD_M29|EMASK_FBD_M28|EMASK_FBD_M27| \
284 	EMASK_FBD_M26|EMASK_FBD_M25|EMASK_FBD_M24|EMASK_FBD_M22|EMASK_FBD_M21| \
285 	EMASK_FBD_M20|EMASK_FBD_M19|EMASK_FBD_M18|EMASK_FBD_M17|EMASK_FBD_M16| \
286 	EMASK_FBD_M15|EMASK_FBD_M14|EMASK_FBD_M13|EMASK_FBD_M12| \
287 	EMASK_FBD_M11|EMASK_FBD_M10|EMASK_FBD_M9|EMASK_FBD_M8|EMASK_FBD_M7| \
288 	EMASK_FBD_M6|EMASK_FBD_M5|EMASK_FBD_M4)
289 
290 #define	ERR_INT_ALL	(nb_chipset == INTEL_NB_5400 ? 0xffffffff : 0xff)
291 
292 #define	ERR_FAT_INT_B14	0x0400	/* B14Msk SF Scrub DBE */
293 #define	ERR_FAT_INT_B12	0x0100	/* B12Msk Parity Protected register */
294 #define	ERR_FAT_INT_B25	0x0080	/* B25Msk illegal HISMM/TSEG access */
295 #define	ERR_FAT_INT_B23	0x0040	/* B23Msk Vt Unaffiliated port error */
296 #define	ERR_FAT_INT_B21	0x0020	/* B21Msk illegal way */
297 #define	ERR_FAT_INT_B7	0x0010	/* B7Msk Multiple ECC error in any of */
298 					/* the ways during SF lookup */
299 #define	ERR_FAT_INT_B4	0x08	/* B4Msk Virtual pin port error */
300 #define	ERR_FAT_INT_B3	0x04	/* B3Msk Coherency violation error for EWB */
301 #define	ERR_FAT_INT_B2	0x02	/* B2Msk Multi-tag hit SF */
302 #define	ERR_FAT_INT_B1	0x01	/* B1Msk DM parity error */
303 
304 #define	ERR_NF_INT_B27	0x4000	/* B27Msk Request received when in S1 */
305 #define	ERR_NF_INT_B24	0x2000	/* B24Msk DFXERR */
306 #define	ERR_NF_INT_B19	0x1000	/* B19Msk scrub SBE (SF) */
307 #define	ERR_NF_INT_B18	0x0800	/* B18Msk perfmon task completion */
308 #define	ERR_NF_INT_B17	0x0400	/* B17Msk JTAG/TAP error status */
309 #define	ERR_NF_INT_B16	0x0200	/* B16Msk SMBus error status */
310 #define	ERR_NF_INT_B22	0x0080	/* B22Msk Victim ROM parity */
311 #define	ERR_NF_INT_B20	0x0040	/* B20Msk Configuration write abort */
312 #define	ERR_NF_INT_B11	0x0020	/* B11Msk Victim Ram parity error */
313 #define	ERR_NF_INT_B10	0x0010	/* B10Msk DM Parity */
314 #define	ERR_NF_INT_B9	0x0008	/* B9Msk illeagl access */
315 #define	ERR_NF_INT_B8	0x0004	/* B8Msk SF Coherency Error for BIL */
316 #define	ERR_NF_INT_B6	0x0002	/* B6Msk Single ECC error on SF lookup */
317 #define	ERR_NF_INT_B5	0x0001	/* B5Msk Address Map error */
318 
319 #define	NERR_NF_5400_INT_B26	0x0004	/* B26Msk Illeagl Access to */
320 				/* non-coherent address space */
321 
322 #define	EMASK_INT_RES	0x02000000	/* Do not change */
323 #define	EMASK_INT_B25	0x01000000	/* B25Msk illegal HISMM/TSEG access */
324 #define	EMASK_INT_B23	0x00400000	/* B23Msk Vt Unaffiliated port error */
325 #define	EMASK_INT_B22	0x00200000	/* B22Msk Victim ROM parity */
326 #define	EMASK_INT_B21	0x00100000	/* B21Msk illegal way */
327 #define	EMASK_INT_B20	0x00080000	/* B20Msk Configuration write abort  */
328 #define	EMASK_INT_B19	0x00040000	/* B19Msk Scrub SBE */
329 #define	EMASK_INT_B14	0x00002000	/* B14Msk Scrub DBE */
330 #define	EMASK_INT_B12	0x00000800	/* B12Msk Parity Protected */
331 #define	EMASK_INT_B11	0x00000400	/* B11Msk Victim Ram parity error */
332 #define	EMASK_INT_B10	0x00000200	/* B10Msk DM Parity */
333 #define	EMASK_INT_B9	0x00000100	/* B9Msk Illegal Accesss */
334 
335 #define	EMASK_INT_B8	0x80	/* B8Msk SF Coherency Error for BIL */
336 #define	EMASK_INT_B7	0x40	/* B7Msk Multiple ECC error in any of */
337 				/* the ways during SF lookup */
338 #define	EMASK_INT_B6	0x20	/* B6Msk Single ECC error on SF lookup */
339 #define	EMASK_INT_B5	0x10	/* B5Msk Address Map error */
340 #define	EMASK_INT_B4	0x08	/* B4Msk Virtual pin port error */
341 #define	EMASK_INT_B3	0x04	/* B3Msk Coherency violation error for EWB */
342 #define	EMASK_INT_B2	0x02	/* B2Msk Multi-tag hit SF */
343 #define	EMASK_INT_B1	0x01	/* B1Msk DM parity error */
344 
345 /* MCH 5000 errata 2 */
346 #define	EMASK_INT_5000	EMASK_INT_B1
347 /* MCH 7300 errata 17 & 20 */
348 #define	EMASK_INT_7300	(EMASK_INT_B3|EMASK_INT_B1)
349 /* MCH 7300 errata 17,20 & 21 */
350 #define	EMASK_INT_7300_STEP_0	(EMASK_INT_B7|EMASK_INT_B3|EMASK_INT_B1)
351 #define	EMASK_INT_5400 0
352 
353 #define	EMASK_INT_FATAL (EMASK_INT_B7|EMASK_INT_B4|EMASK_INT_B3|EMASK_INT_B2| \
354 	EMASK_INT_B1)
355 #define	EMASK_INT_NF	(EMASK_INT_B8|EMASK_INT_B6|EMASK_INT_B5)
356 #define	GE_FBD_FATAL ((nb_chipset == INTEL_NB_5400) ? GE_FERR_FBD_FATAL : \
357 	(GE_FERR_FBD0_FATAL|GE_FERR_FBD1_FATAL|GE_FERR_FBD2_FATAL| \
358 	GE_FERR_FBD3_FATAL))
359 #define	GE_FBD_NF ((nb_chipset == INTEL_NB_5400) ? GE_FERR_FBD_NF : \
360 	(GE_FERR_FBD0_NF|GE_FERR_FBD1_NF|GE_FERR_FBD2_NF|GE_FERR_FBD3_NF))
361 
362 #define	EMASK_UNCOR_PEX_IO18	0x00200000	/* ESI Reset timeout */
363 #define	EMASK_UNCOR_PEX_IO2	0x00100000	/* Received an unsupported */
364 						/* request */
365 #define	EMASK_UNCOR_PEX_IO9	0x00040000	/* Malformed TLP Status */
366 #define	EMASK_UNCOR_PEX_IO10	0x00020000	/* Received buffer overflow */
367 #define	EMASK_UNCOR_PEX_IO8	0x00010000	/* unexpected completion */
368 #define	EMASK_UNCOR_PEX_IO7	0x00008000	/* completion abort */
369 #define	EMASK_UNCOR_PEX_IO6	0x00004000	/* completion timeout */
370 #define	EMASK_UNCOR_PEX_IO5	0x00002000	/* flow control protocol */
371 #define	EMASK_UNCOR_PEX_IO4	0x00001000	/* poisoned TLP */
372 #define	EMASK_UNCOR_PEX_IO19	0x00000020	/* surprise link down */
373 #define	EMASK_UNCOR_PEX_IO0	0x00000010	/* data link protocol */
374 #define	EMASK_UNCOR_PEX_IO3	0x00000001	/* training error */
375 
376 #define	EMASK_COR_PEX_IO20	0x00002000	/* Advisory Non Fatal */
377 #define	EMASK_COR_PEX_IO16	0x00001000	/* replay timer timeout */
378 #define	EMASK_COR_PEX_IO15	0x00000100	/* replay num pollover */
379 #define	EMASK_COR_PEX_IO14	0x00000080	/* bad DLLP */
380 #define	EMASK_COR_PEX_IO13	0x00000040	/* bad TLP */
381 #define	EMASK_COR_PEX_IO12	0x00000001	/* receiver error mask */
382 
383 #define	EMASK_RP_PEX_IO1	0x00000004	/* fatal message detect */
384 #define	EMASK_RP_PEX_IO11	0x00000002	/* uncorrectable message */
385 #define	EMASK_RP_PEX_IO17	0x00000001	/* correctable message */
386 
387 #define	EMASK_UNIT_PEX_IO33	0x00002000	/* Link autonomous BW change */
388 #define	EMASK_UNIT_PEX_IO32	0x00001000	/* Received CA Posted Req */
389 #define	EMASK_UNIT_PEX_IO31	0x00000800	/* Received UR Posted Req */
390 #define	EMASK_UNIT_PEX_IO30	0x00000400	/* VT-d internal HW */
391 #define	EMASK_UNIT_PEX_IO29	0x00000200	/* MSI address */
392 #define	EMASK_UNIT_PEX_IO28	0x00000100	/* Link BW change */
393 #define	EMASK_UNIT_PEX_IO27	0x00000080	/* stop & scream */
394 #define	EMASK_UNIT_PEX_IO26	0x00000040	/* Received CA response */
395 #define	EMASK_UNIT_PEX_IO25	0x00000020	/* Received UR response */
396 #define	EMASK_UNIT_PEX_IO24	0x00000010	/* Outbound poisoned data */
397 #define	EMASK_UNIT_PEX_IO23	0x00000008	/* VTd fault */
398 #define	EMASK_UNIT_PEX_IO22	0x00000004	/* internal header/ctl parity */
399 #define	EMASK_UNIT_PEX_IO18	0x00000002	/* ESI reset timeout */
400 #define	EMASK_UNIT_PEX_VPP	0x00000001	/* correctable message detect */
401 
402 #define	PEX_5400_FAT_IO32	0x00800000	/* Received CA Posted Request */
403 #define	PEX_5400_FAT_IO31	0x00400000	/* Received UR Posted Request */
404 #define	PEX_5400_FAT_IO30	0x00200000	/* VT-d Internal HW */
405 #define	PEX_5400_FAT_IO29	0x00100000	/* MSI Address */
406 #define	PEX_5400_FAT_IO27	0x00040000	/* Stop & Scream */
407 #define	PEX_5400_FAT_IO26	0x00020000	/* Received CA Response */
408 #define	PEX_5400_FAT_IO25	0x00010000	/* Received UR Response */
409 #define	PEX_5400_FAT_IO24	0x00008000	/* Outbound poisoned TLP */
410 #define	PEX_5400_FAT_IO23	0x00004000	/* VT-d Fault */
411 #define	PEX_5400_FAT_IO22	0x00002000	/* Internal Header/Control */
412 						/* Parity */
413 #define	PEX_5400_FAT_IO18	0x00001000	/* ESI reset timeout */
414 #define	PEX_5400_FAT_IO1	0x00000400	/* received fatal error msg */
415 #define	PEX_5400_FAT_IO2	0x00000200	/* received unsupported req  */
416 #define	PEX_5400_FAT_IO9	0x00000100	/* malformed TLP */
417 #define	PEX_5400_FAT_IO10	0x00000080	/* receiver buffer overflow */
418 #define	PEX_5400_FAT_IO8	0x00000040	/* unexpected completion */
419 #define	PEX_5400_FAT_IO7	0x00000020	/* completer abort */
420 #define	PEX_5400_FAT_IO6	0x00000010	/* completion timeout */
421 #define	PEX_5400_FAT_IO5	0x00000008	/* flow control protocol */
422 #define	PEX_5400_FAT_IO4	0x00000004	/* poisoned TLP */
423 #define	PEX_5400_FAT_IO19	0x00000002	/* surprise link down */
424 #define	PEX_5400_FAT_IO0	0x00000001	/* data link layer protocol */
425 #define	PEX_FAT_IO19	0x00001000	/* surprise link down */
426 #define	PEX_FAT_IO18	0x00000800	/* ESI reset timeout */
427 #define	PEX_FAT_IO9	0x00000400	/* malformed TLP */
428 #define	PEX_FAT_IO10	0x00000200	/* receiver buffer overflow */
429 #define	PEX_FAT_IO8	0x00000100	/* unexpected completion */
430 #define	PEX_FAT_IO7	0x00000080	/* completer abort */
431 #define	PEX_FAT_IO6	0x00000040	/* completion timeout */
432 #define	PEX_FAT_IO5	0x00000020	/* flow control protocol */
433 #define	PEX_FAT_IO4	0x00000010	/* poisoned TLP */
434 #define	PEX_FAT_IO3	0x00000008	/* training error */
435 #define	PEX_FAT_IO2	0x00000004	/* received unsupported req  */
436 #define	PEX_FAT_IO1	0x00000002	/* received fatal error message */
437 #define	PEX_FAT_IO0	0x00000001	/* data link layer protocol */
438 
439 #define	PEX_5400_NF_IO33	0x20000000	/* link autonomous bandwidth */
440 						/* change (correctable) */
441 #define	PEX_5400_NF_IO32	0x10000000	/* Received CA Posted Request */
442 #define	PEX_5400_NF_IO31	0x08000000	/* Received UR Posted Request */
443 #define	PEX_5400_NF_IO30	0x04000000	/* VT-d Internal HW */
444 #define	PEX_5400_NF_IO29	0x02000000	/* MSI Address */
445 #define	PEX_5400_NF_IO28	0x01000000	/* Link bandwidth change */
446 #define	PEX_5400_NF_IO27	0x00800000	/* Stop & Scream */
447 #define	PEX_5400_NF_IO26	0x00400000	/* Received CA Response */
448 #define	PEX_5400_NF_IO25	0x00200000	/* Received UR Response */
449 #define	PEX_5400_NF_IO24	0x00100000	/* Outbound poisoned TLP */
450 #define	PEX_5400_NF_IO23	0x00080000	/* VT-d Fault */
451 #define	PEX_5400_NF_IO11	0x00040000	/* received non fatal err msg */
452 #define	PEX_5400_NF_IO17	0x00020000 	/* rec correctable error msg */
453 #define	PEX_5400_NF_IO2		0x00008000	/* Received unsupported req */
454 #define	PEX_5400_NF_IO9		0x00004000	/* Malformed TLP */
455 #define	PEX_5400_NF_IO10	0x00002000	/* Received buffer overflow */
456 #define	PEX_5400_NF_IO8		0x00001000	/* unexpected completion err */
457 #define	PEX_5400_NF_IO7		0x00000800	/* completion abort */
458 #define	PEX_5400_NF_IO6		0x00000400	/* completion timeout */
459 #define	PEX_5400_NF_IO5		0x00000200	/* flow control protocol */
460 #define	PEX_5400_NF_IO4		0x00000100	/* poisoned TLP */
461 #define	PEX_5400_NF_IO19	0x00000080	/* surprise link down */
462 #define	PEX_5400_NF_IO0		0x00000040	/* data link layer protocol */
463 #define	PEX_5400_NF_IO20	0x00000020	/* Advisory Non Fatel */
464 #define	PEX_5400_NF_IO16	0x00000010	/* replay timer timeout */
465 #define	PEX_5400_NF_IO15	0x00000008	/* replay num pollover */
466 #define	PEX_5400_NF_IO14	0x00000004	/* bad DLLP */
467 #define	PEX_5400_NF_IO13	0x00000002	/* bad TLP */
468 #define	PEX_5400_NF_IO12	0x00000001	/* receiver error mask */
469 #define	PEX_NF_IO19	0x00020000	/* surprise link down */
470 #define	PEX_NF_IO17	0x00010000	/* received correctable error message */
471 #define	PEX_NF_IO16	0x00008000	/* replay timer timeout */
472 #define	PEX_NF_IO15	0x00004000	/* replay num pollover */
473 #define	PEX_NF_IO14	0x00002000	/* bad DLLP */
474 #define	PEX_NF_IO13	0x00001000	/* bad TLP */
475 #define	PEX_NF_IO12	0x00000800	/* receiver error mask */
476 #define	PEX_NF_IO11	0x00000400	/* received non fatal error message */
477 #define	PEX_NF_IO10	0x00000200	/* Received buffer overflow */
478 #define	PEX_NF_IO9	0x00000100	/* Malformed TLP */
479 #define	PEX_NF_IO8	0x00000080
480 #define	PEX_NF_IO7	0x00000040
481 #define	PEX_NF_IO6	0x00000020	/* completion timeout */
482 #define	PEX_NF_IO5	0x00000010	/* flow control protocol */
483 #define	PEX_NF_IO4	0x00000008	/* poisoned TLP */
484 #define	PEX_NF_IO3	0x00000004
485 #define	PEX_NF_IO2	0x00000002
486 #define	PEX_NF_IO0	0x00000001	/* data link layer protocol */
487 
488 #define	ERR_FAT_TH2	0x02	/* >tmid thermal event */
489 #define	ERR_FAT_TH1	0x01	/* Catastrophic on-die thermal event */
490 
491 #define	ERR_NF_TH5	0x10	/* timeout on cooling update */
492 #define	ERR_NF_TH4	0x08	/* TSMAX update */
493 #define	ERR_NF_TH3	0x04	/* on-die throttling event */
494 
495 #define	EMASK_TH5	0x0010 	/* TH5Msk timeout on cooling update */
496 #define	EMASK_TH4	0x0008 	/* TH4Msk TSMAX update */
497 #define	EMASK_TH3	0x0004 	/* TH3Msk on-die throttling event */
498 #define	EMASK_TH2	0x0002 	/* TH2Msk >tmid thermal event */
499 #define	EMASK_TH1	0x0001 	/* TH1Msk Catastrophic on-die thermal event */
500 
501 #define	GE_FERR_FSB(ferr) ( \
502 	((ferr) & (GE_FSB0_FATAL|GE_FSB0_NF)) ? 0 : \
503 	((ferr) & (GE_FSB1_FATAL|GE_FSB1_NF)) ? 1 : \
504 	(nb_chipset == INTEL_NB_7300) && \
505 	((ferr) & (GE_FERR_FSB2_FATAL|GE_FERR_FSB2_NF)) ? 2 : \
506 	(nb_chipset == INTEL_NB_7300) && \
507 	((ferr) & (GE_FERR_FSB3_FATAL|GE_FERR_FSB3_NF)) ? 3 : \
508 	-1)
509 
510 #define	GE_NERR_TO_FERR_FSB(nerr) \
511 	((((nerr) & GE_NERR_FSB3_FATAL) ? GE_FERR_FSB3_FATAL : 0) | \
512 	(((nerr) & GE_NERR_FSB2_FATAL) ? GE_FERR_FSB2_FATAL : 0) | \
513 	(((nerr) & GE_FSB1_FATAL) ? GE_FSB1_FATAL : 0) | \
514 	(((nerr) & GE_FSB0_FATAL) ? GE_FSB0_FATAL : 0) | \
515 	(((nerr) & GE_NERR_FSB3_NF) ? GE_FERR_FSB3_NF : 0) | \
516 	(((nerr) & GE_NERR_FSB2_NF) ? GE_FERR_FSB2_NF : 0) | \
517 	(((nerr) & GE_FSB1_NF) ? GE_FSB1_NF : 0) | \
518 	(((nerr) & GE_FSB0_NF) ? GE_FSB0_NF : 0))
519 
520 #define	GE_ERR_PEX(ferr) ( \
521 	((ferr) & (GE_ESI_FATAL|GE_ESI_NF)) ? 0 : \
522 	((nb_chipset == INTEL_NB_7300 || nb_chipset == INTEL_NB_5400) && \
523 	((ferr) & (GE_PCIEX1_FATAL|GE_PCIEX1_NF))) ? 1 : \
524 	((ferr) & (GE_PCIEX2_FATAL|GE_PCIEX2_NF)) ? 2 : \
525 	((ferr) & (GE_PCIEX3_FATAL|GE_PCIEX3_NF)) ? 3 : \
526 	((ferr) & (GE_PCIEX4_FATAL|GE_PCIEX4_NF)) ? 4 : \
527 	((ferr) & (GE_PCIEX5_FATAL|GE_PCIEX5_NF)) ? 5 : \
528 	((ferr) & (GE_PCIEX6_FATAL|GE_PCIEX6_NF)) ? 6 : \
529 	((ferr) & (GE_PCIEX7_FATAL|GE_PCIEX7_NF)) ? 7 : \
530 	(nb_chipset == INTEL_NB_5400) && \
531 	((ferr) & (GE_PCIEX8_FATAL|GE_PCIEX8_NF)) ? 8 : \
532 	((ferr) & (GE_PCIEX9_FATAL|GE_PCIEX9_NF)) ? 9 : \
533 	-1)
534 
535 #define	GE_FERR_FATAL	((nb_chipset == INTEL_NB_7300) ? \
536 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FERR_FSB3_FATAL|GE_FERR_FSB2_FATAL| \
537 	GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL|GE_PCIEX7_FATAL| \
538 	GE_PCIEX6_FATAL| GE_PCIEX5_FATAL|GE_PCIEX4_FATAL|GE_PCIEX3_FATAL| \
539 	GE_PCIEX2_FATAL| GE_ESI_FATAL) :  \
540 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL| \
541 	GE_PCIEX7_FATAL|GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL| \
542 	GE_PCIEX3_FATAL|GE_PCIEX2_FATAL|GE_ESI_FATAL))
543 
544 #define	GE_NERR_FATAL	((nb_chipset == INTEL_NB_7300) ? \
545 	(GE_INT_FATAL|GE_DMA_FATAL|GE_NERR_FSB3_FATAL|GE_NERR_FSB2_FATAL| \
546 	GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL|GE_PCIEX7_FATAL| \
547 	GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL|GE_PCIEX3_FATAL| \
548 	GE_PCIEX2_FATALGE_ESI_FATAL) :  \
549 	(GE_INT_FATAL|GE_DMA_FATAL|GE_FSB1_FATAL|GE_FSB0_FATAL|GE_FBD_FATAL| \
550 	GE_PCIEX7_FATAL|GE_PCIEX6_FATAL|GE_PCIEX5_FATAL|GE_PCIEX4_FATAL| \
551 	GE_PCIEX3_FATAL|GE_PCIEX2_FATAL|GE_ESI_FATAL))
552 
553 #define	GE_PCIEX_FATAL	(GE_ESI_FATAL|GE_PCIEX1_FATAL|GE_PCIEX2_FATAL| \
554 	GE_PCIEX3_FATAL|GE_PCIEX4_FATAL|GE_PCIEX5_FATAL|GE_PCIEX6_FATAL| \
555 	GE_PCIEX7_FATAL)
556 #define	GE_PCIEX_NF	(GE_ESI_NF|GE_PCIEX1_NF|GE_PCIEX2_NF|GE_PCIEX3_NF| \
557 	GE_PCIEX4_NF|GE_PCIEX5_NF|GE_PCIEX6_NF|GE_PCIEX7_NF)
558 #define	GE_FERR_FSB_FATAL	((nb_chipset == INTEL_NB_7300) ? \
559 	(GE_FSB0_FATAL|GE_FSB1_FATAL|GE_FERR_FSB2_FATAL|GE_FERR_FSB3_FATAL) : \
560 	(GE_FSB0_FATAL|GE_FSB1_FATAL))
561 #define	GE_NERR_FSB_FATAL	((nb_chipset == INTEL_NB_7300) ? \
562 	(GE_FSB0_FATAL|GE_FSB1_FATAL|GE_NERR_FSB2_FATAL|GE_NERR_FSB3_FATAL) : \
563 	(GE_FSB0_FATAL|GE_FSB1_FATAL))
564 #define	GE_FERR_FSB_NF	((nb_chipset == INTEL_NB_7300) ? \
565 	(GE_FSB0_NF|GE_FSB1_NF|GE_FERR_FSB2_NF|GE_FERR_FSB3_NF) : \
566 	(GE_FSB0_NF|GE_FSB1_NF))
567 #define	GE_NERR_FSB_NF	((nb_chipset == INTEL_NB_7300) ? \
568 	(GE_FSB0_NF|GE_FSB1_NF|GE_NERR_FSB2_NF|GE_NERR_FSB3_NF) : \
569 	(GE_FSB0_NF|GE_FSB1_NF))
570 
571 #define	FERR_FBD_CHANNEL(reg)	((reg)>>28 & 3)
572 
573 #define	NB5000_STEPPING()	nb_pci_getw(0, 0, 0, 8, 0)
574 
575 #define	FERR_GLOBAL_RD()	((nb_chipset == INTEL_NB_7300) ? \
576 				    ((uint64_t)nb_pci_getl(0, 16, 2, \
577 				    0x48, 0) << 32) | nb_pci_getl(0, 16, 2, \
578 				    0x40, 0) : \
579 				    (uint64_t)nb_pci_getl(0, 16, 2, 0x40, 0))
580 #define	NERR_GLOBAL_RD()	nb_pci_getl(0, 16, 2, 0x44, 0)
581 #define	FERR_FAT_FSB_RD(fsb, ip)	((nb_chipset == INTEL_NB_7300) ? \
582 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc0 : 0x40, ip) : \
583 	nb_pci_getb(0, 16, 0, fsb ? 0x480 : 0x180, ip))
584 #define	FERR_NF_FSB_RD(fsb, ip)	((nb_chipset == INTEL_NB_7300) ? \
585 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc1 : 0x41, ip) : \
586 	nb_pci_getb(0, 16, 0, fsb ? 0x481 : 0x181, ip))
587 #define	NERR_FAT_FSB_RD(fsb, ip) ((nb_chipset == INTEL_NB_7300) ? \
588 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc2 : 0x42, ip) : \
589 	nb_pci_getb(0, 16, 0, fsb ? 0x482 : 0x182, ip))
590 #define	NERR_NF_FSB_RD(fsb, ip) ((nb_chipset == INTEL_NB_7300) ? \
591 	nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc3 : 0x43, ip) : \
592 	nb_pci_getb(0, 16, 0, fsb ? 0x483 : 0x183, ip))
593 
594 #define	NRECFSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
595 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc4 : 0x44, 0) : \
596 	nb_pci_getl(0, 16, 0, fsb ? 0x484 : 0x184, 0))
597 #define	NRECFSB_WR(fsb)	\
598 	if (nb_chipset == INTEL_NB_7300) { \
599 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc4 : 0x44, \
600 		    0); \
601 	} else { \
602 		nb_pci_putl(0, 16, 0, fsb ? 0x484 : 0x184, 0); \
603 	}
604 #define	RECFSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
605 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc8 : 0x48, 0) : \
606 	nb_pci_getl(0, 16, 0, fsb ? 0x488 : 0x188, 0))
607 #define	RECFSB_WR(fsb) \
608 	if (nb_chipset == INTEL_NB_7300) { \
609 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc8 : 0x48, \
610 		    0); \
611 	} else { \
612 		nb_pci_putl(0, 16, 0, fsb ? 0x488 : 0x188, 0); \
613 	}
614 #define	NRECADDR_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
615 	((uint64_t)(nb_pci_getb(0, 17, (fsb & 2) ? 3 : 0, \
616 	(fsb & 1) ? 0xd0 : 0x50, 0)) << 32) | \
617 	nb_pci_getl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xcc : 0x4c, 0) : \
618 	((uint64_t)(nb_pci_getb(0, 16, 0, fsb ? 0x490 : 0x190, 0)) << 32) | \
619 	nb_pci_getl(0, 16, 0, fsb ? 0x48c : 0x18c, 0))
620 #define	NRECADDR_WR(fsb) \
621 	if (nb_chipset == INTEL_NB_7300) { \
622 		nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd0 : 0x50, \
623 		    0); \
624 		nb_pci_putl(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xcc : 0x4c, \
625 		    0); \
626 	} else { \
627 		nb_pci_putb(0, 16, 0, fsb ? 0x490 : 0x190, 0); \
628 		nb_pci_putl(0, 16, 0, fsb ? 0x48c : 0x18c, 0); \
629 	}
630 #define	EMASK_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
631 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd2 : 0x52, 0) : \
632 	nb_pci_getw(0, 16, 0, fsb ? 0x492 : 0x192, 0))
633 #define	ERR0_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
634 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd4 : 0x54, 0) : \
635 	nb_pci_getw(0, 16, 0, fsb ? 0x494 : 0x194, 0))
636 #define	ERR1_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
637 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd6 : 0x56, 0) : \
638 	nb_pci_getw(0, 16, 0, fsb ? 0x496 : 0x196, 0))
639 #define	ERR2_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
640 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xd8 : 0x58, 0) : \
641 	nb_pci_getw(0, 16, 0, fsb ? 0x498 : 0x198, 0))
642 #define	MCERR_FSB_RD(fsb)	((nb_chipset == INTEL_NB_7300) ? \
643 	nb_pci_getw(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xda : 0x5a, 0) : \
644 	nb_pci_getw(0, 16, 0, fsb ? 0x49a : 0x19a, 0))
645 
646 #define	FERR_GLOBAL_WR(val) \
647 	if (nb_chipset == INTEL_NB_7300) \
648 	{ \
649 		    nb_pci_putl(0, 16, 2, 0x48, (uint32_t)(val >> 32)); \
650 		    nb_pci_putl(0, 16, 2, 0x40, (uint32_t)val); \
651 	} else { \
652 		    nb_pci_putl(0, 16, 2, 0x40, (uint32_t)val); \
653 	}
654 #define	NERR_GLOBAL_WR(val)	nb_pci_putl(0, 16, 2, 0x44, val)
655 #define	FERR_FAT_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
656 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc0 : 0x40, val) : \
657 	nb_pci_putb(0, 16, 0, fsb ? 0x480 : 0x180, val))
658 #define	FERR_NF_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
659 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc1 : 0x41, val) : \
660 	nb_pci_putb(0, 16, 0, fsb ? 0x481 : 0x181, val))
661 #define	NERR_FAT_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
662 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc2 : 0x42, val) : \
663 	nb_pci_putb(0, 16, 0, fsb ? 0x482 : 0x182, val))
664 #define	NERR_NF_FSB_WR(fsb, val)	((nb_chipset == INTEL_NB_7300) ? \
665 	nb_pci_putb(0, 17, (fsb & 2) ? 3 : 0, (fsb & 1) ? 0xc3 : 0x43, val) : \
666 	nb_pci_putb(0, 16, 0, fsb ? 0x483 : 0x183, val))
667 #define	EMASK_FSB_WR(fsb, val) \
668 	{ \
669 		if (nb_chipset == INTEL_NB_7300) \
670 			nb_pci_putw(0, 17, ((fsb) & 2) ? 3 : 0, \
671 			    ((fsb) & 1) ? 0xd2 : 0x52, val); \
672 		else \
673 			nb_pci_putw(0, 16, 0, fsb ? 0x492 : 0x192, val); \
674 	}
675 #define	ERR0_FSB_WR(fsb, val) \
676 	{ \
677 		if (nb_chipset == INTEL_NB_7300) \
678 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
679 			    (fsb & 1) ? 0xd4 : 0x54, val); \
680 		else \
681 			nb_pci_putw(0, 16, 0, fsb ? 0x494 : 0x194, val); \
682 	}
683 #define	ERR1_FSB_WR(fsb, val) \
684 	{ \
685 		if (nb_chipset == INTEL_NB_7300) \
686 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
687 			    (fsb & 1) ? 0xd6 : 0x56, val); \
688 		else \
689 			nb_pci_putw(0, 16, 0, fsb ? 0x496 : 0x196, val); \
690 	}
691 #define	ERR2_FSB_WR(fsb, val) \
692 	{ \
693 		if (nb_chipset == INTEL_NB_7300) \
694 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
695 			    (fsb & 1) ? 0xd8 : 0x58, val); \
696 		else \
697 			nb_pci_putw(0, 16, 0, fsb ? 0x498 : 0x198, val); \
698 	}
699 #define	MCERR_FSB_WR(fsb, val) \
700 	{ \
701 		if (nb_chipset == INTEL_NB_7300) \
702 			nb_pci_putw(0, 17, (fsb & 2) ? 3 : 0, \
703 			    (fsb & 1) ? 0xda : 0x5a, val); \
704 		else \
705 			nb_pci_putw(0, 16, 0, fsb ? 0x49a : 0x19a, val); \
706 	}
707 
708 #define	NRECSF_RD()	(nb_chipset == INTEL_NB_5000X || \
709 	nb_chipset == INTEL_NB_7300) ? ((uint64_t)( \
710 	nb_pci_getl(0, 16, 2, 0xb4, 0)) << 32) | \
711 	nb_pci_getl(0, 16, 2, 0xb0, 0) : 0LL
712 #define	RECSF_RD()	(nb_chipset == INTEL_NB_5000X || \
713 	nb_chipset == INTEL_NB_7300) ? ((uint64_t)( \
714 	nb_pci_getl(0, 16, 2, 0xbc, 0)) << 32) | \
715 	nb_pci_getl(0, 16, 2, 0xb8, 0) : 0LL
716 
717 #define	NRECSF_WR()	if (nb_chipset == INTEL_NB_5000X || \
718 	nb_chipset == INTEL_NB_7300) { \
719 		nb_pci_putl(0, 16, 2, 0xbc, 0); \
720 		nb_pci_putl(0, 16, 2, 0xb0, 0); \
721 	}
722 #define	RECSF_WR()	if (nb_chipset == INTEL_NB_5000X || \
723 	nb_chipset == INTEL_NB_7300) { \
724 		nb_pci_putl(0, 16, 2, 0xbc, 0); \
725 		nb_pci_putl(0, 16, 2, 0xb8, 0); \
726 	}
727 
728 #define	FERR_FAT_INT_RD(ip)	(((nb_chipset == INTEL_NB_5400) ? \
729 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc1, ip) << 8) : (uint16_t)0) | \
730 	nb_pci_getb(0, 16, 2, 0xc0, ip))
731 #define	FERR_NF_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
732 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc3, ip) << 8) | \
733 	nb_pci_getb(0, 16, 2, 0xc2, ip) : \
734 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc1, ip))
735 #define	NERR_FAT_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
736 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc5, ip) << 8) | \
737 	nb_pci_getb(0, 16, 2, 0xc4, ip) : \
738 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc2, ip))
739 #define	NERR_NF_INT_RD(ip)	((nb_chipset == INTEL_NB_5400) ? \
740 	((uint16_t)nb_pci_getb(0, 16, 2, 0xc7, ip) << 8) | \
741 	nb_pci_getb(0, 16, 2, 0xc6, ip) : \
742 	(uint16_t)nb_pci_getb(0, 16, 2, 0xc3, ip))
743 #define	EMASK_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
744 	nb_pci_getl(0, 16, 2, 0xd0, 0) : nb_pci_getb(0, 16, 2, 0xcc, 0))
745 #define	ERR0_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
746 	nb_pci_getl(0, 16, 2, 0xd4, 0) : nb_pci_getb(0, 16, 2, 0xd0, 0))
747 #define	ERR1_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
748 	nb_pci_getl(0, 16, 2, 0xd8, 0) : nb_pci_getb(0, 16, 2, 0xd1, 0))
749 #define	ERR2_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
750 	nb_pci_getl(0, 16, 2, 0xdc, 0) : nb_pci_getb(0, 16, 2, 0xd2, 0))
751 #define	MCERR_INT_RD()		((nb_chipset == INTEL_NB_5400) ? \
752 	nb_pci_getl(0, 16, 2, 0xe0, 0) : nb_pci_getb(0, 16, 2, 0xd3, 0))
753 
754 #define	FERR_FAT_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
755 					nb_pci_putb(0, 16, 2, 0xc0,  \
756 					    val & 0xff); \
757 					nb_pci_putb(0, 16, 2, 0xc1, val >> 8); \
758 				} else { \
759 					nb_pci_putb(0, 16, 2, 0xc0, val); \
760 				}
761 #define	FERR_NF_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
762 					nb_pci_putb(0, 16, 2, 0xc2,  \
763 					    val & 0xff); \
764 					nb_pci_putb(0, 16, 2, 0xc3, val >> 8); \
765 				} else { \
766 					nb_pci_putb(0, 16, 2, 0xc1, val); \
767 				}
768 #define	NERR_FAT_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
769 					nb_pci_putb(0, 16, 2, 0xc4,  \
770 					    val & 0xff); \
771 					nb_pci_putb(0, 16, 2, 0xc5, val >> 8); \
772 				} else { \
773 					nb_pci_putb(0, 16, 2, 0xc2, val); \
774 				}
775 #define	NERR_NF_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
776 					nb_pci_putb(0, 16, 2, 0xc6,  \
777 					    val & 0xff); \
778 					nb_pci_putb(0, 16, 2, 0xc7, val >> 8); \
779 				} else { \
780 					nb_pci_putb(0, 16, 2, 0xc3, val); \
781 				}
782 #define	EMASK_5000_INT_WR(val)	nb_pci_putb(0, 16, 2, 0xcc, val)
783 #define	EMASK_5400_INT_WR(val)	nb_pci_putl(0, 16, 2, 0xd0, val)
784 #define	EMASK_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
785 					EMASK_5400_INT_WR(val); \
786 				} else { \
787 					EMASK_5000_INT_WR(val); \
788 				}
789 #define	ERR0_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
790 					nb_pci_putl(0, 16, 2, 0xd4, val); \
791 				} else { \
792 					nb_pci_putb(0, 16, 2, 0xd0, val); \
793 				}
794 #define	ERR1_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
795 					nb_pci_putl(0, 16, 2, 0xd8, val); \
796 				} else { \
797 					nb_pci_putb(0, 16, 2, 0xd1, val); \
798 				}
799 #define	ERR2_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
800 					nb_pci_putl(0, 16, 2, 0xdc, val); \
801 				} else { \
802 					nb_pci_putb(0, 16, 2, 0xd2, val); \
803 				}
804 #define	MCERR_INT_WR(val)	if (nb_chipset == INTEL_NB_5400) { \
805 					nb_pci_putl(0, 16, 2, 0xe0, val); \
806 				} else { \
807 					nb_pci_putb(0, 16, 2, 0xd3, val); \
808 				}
809 
810 #define	NRECINT_RD()		nb_pci_getl(0, 16, 2, 0xc4, 0)
811 #define	RECINT_RD()		nb_pci_getl(0, 16, 2, 0xc8, 0)
812 
813 #define	NRECINT_WR()		nb_pci_putl(0, 16, 2, 0xc4, 0)
814 #define	RECINT_WR()		nb_pci_putl(0, 16, 2, 0xc8, 0)
815 
816 #define	FERR_FAT_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0x98, ip)
817 #define	NERR_FAT_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0x9c, ip)
818 #define	FERR_NF_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0xa0, ip)
819 #define	NERR_NF_FBD_RD(ip)	nb_pci_getl(0, 16, 1, 0xa4, ip)
820 #define	EMASK_FBD_RD()		nb_pci_getl(0, 16, 1, 0xa8, 0)
821 #define	ERR0_FBD_RD()		nb_pci_getl(0, 16, 1, 0xac, 0)
822 #define	ERR1_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb0, 0)
823 #define	ERR2_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb4, 0)
824 #define	MCERR_FBD_RD()		nb_pci_getl(0, 16, 1, 0xb8, 0)
825 
826 #define	FERR_FAT_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0x98, val)
827 #define	NERR_FAT_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0x9c, val)
828 #define	FERR_NF_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa0, val)
829 #define	NERR_NF_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa4, val)
830 #define	EMASK_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xa8, val)
831 #define	ERR0_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xac, val)
832 #define	ERR1_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb0, val)
833 #define	ERR2_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb4, val)
834 #define	MCERR_FBD_WR(val)	nb_pci_putl(0, 16, 1, 0xb8, val)
835 
836 #define	NRECMEMA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
837 	nb_pci_getw(0, (branch) ? 22 : 21, 1, 0xbe, 0) : \
838 	nb_pci_getw(0, 16, 1, 0xbe, 0))
839 #define	NRECMEMB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
840 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc0, 0) : \
841 	nb_pci_getl(0, 16, 1, 0xc0, 0))
842 #define	NRECFGLOG_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
843 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x74, 0) : \
844 	nb_pci_getl(0, 16, 1, 0xc4, 0))
845 #define	NRECFBDA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
846 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc4, 0) : \
847 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xc4 : 0xc8, 0))
848 #define	NRECFBDB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
849 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xc8, 0) : \
850 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xc8 : 0xcc, 0))
851 #define	NRECFBDC_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
852 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xcc, 0) : \
853 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xcc : 0xd0, 0))
854 #define	NRECFBDD_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
855 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd0, 0) : \
856 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xd0 : 0xd4, 0))
857 #define	NRECFBDE_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
858 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd4, 0) : \
859 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xd4 : 0xd8, 0))
860 #define	NRECFBDF_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
861 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xd8, 0) : \
862 	nb_chipset == INTEL_NB_7300 ? nb_pci_getw(0, 16, 1, 0xd8, 0) : 0)
863 #define	REDMEMB_RD()	(nb_chipset == INTEL_NB_5400 ? \
864 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x7c, 0) : \
865 	nb_pci_getl(0, 16, 1, 0x7c, 0))
866 #define	RECMEMA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
867 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe0, 0) & 0xffffff : \
868 	nb_pci_getw(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe0 : 0xe2, 0))
869 #define	RECMEMB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
870 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe4, 0) : \
871 	nb_pci_getl(0, 16, 1, 0xe4, 0))
872 #define	RECFGLOG_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
873 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0x78, 0) : \
874 	nb_chipset == INTEL_NB_7300 ?  nb_pci_getl(0, 16, 1, 0x78, 0) : \
875 	nb_pci_getl(0, 16, 1, 0xe8, 0))
876 #define	RECFBDA_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
877 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xe8, 0) : \
878 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe8 : 0xec, 0))
879 #define	RECFBDB_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
880 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xec, 0) : \
881 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xec : 0xf0, 0))
882 #define	RECFBDC_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
883 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf0, 0) : \
884 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf0 : 0xf4, 0))
885 #define	RECFBDD_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
886 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf4, 0) : \
887 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf4 : 0xf8, 0))
888 #define	RECFBDE_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
889 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xf8, 0) : \
890 	nb_pci_getl(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xf8 : 0xfc, 0))
891 #define	RECFBDF_RD(branch)	(nb_chipset == INTEL_NB_5400 ? \
892 	nb_pci_getl(0, (branch) ? 22 : 21, 1, 0xfc, 0) : \
893 	nb_chipset == INTEL_NB_7300 ? nb_pci_getw(0, 16, 1, 0xfc, 0) : 0)
894 #define	NRECMEMA_WR(branch)	(nb_chipset == INTEL_NB_5400 ? \
895 	nb_pci_putw(0, (branch) ? 22 : 21, 1, 0xbe, 0) : \
896 	nb_pci_putw(0, 16, 1, 0xbe, 0))
897 #define	NRECMEMB_WR(branch)	(nb_chipset == INTEL_NB_5400 ? \
898 	nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc0, 0) : \
899 	nb_pci_putl(0, 16, 1, 0xc0, 0))
900 #define	NRECFGLOG_WR(branch) \
901 	if (nb_chipset == INTEL_NB_5400) \
902 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x74, 0); \
903 	else if (nb_chipset == INTEL_NB_7300) \
904 		nb_pci_putl(0, 16, 1, 0x74, 0); \
905 	else \
906 		nb_pci_putl(0, 16, 1, 0xc4, 0)
907 #define	NRECFBDA_WR(branch) \
908 	if (nb_chipset == INTEL_NB_5400) \
909 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc4, 0); \
910 	else if (nb_chipset == INTEL_NB_7300) \
911 		nb_pci_putl(0, 16, 1, 0xc4, 0); \
912 	else \
913 		nb_pci_putl(0, 16, 1, 0xc8, 0)
914 #define	NRECFBDB_WR(branch) \
915 	if (nb_chipset == INTEL_NB_5400) \
916 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xc8, 0); \
917 	else if (nb_chipset == INTEL_NB_7300) \
918 		nb_pci_putl(0, 16, 1, 0xc8, 0); \
919 	else \
920 		nb_pci_putl(0, 16, 1, 0xcc, 0)
921 #define	NRECFBDC_WR(branch) \
922 	if (nb_chipset == INTEL_NB_5400) \
923 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xcc, 0); \
924 	else if (nb_chipset == INTEL_NB_7300) \
925 		nb_pci_putl(0, 16, 1, 0xcc, 0); \
926 	else \
927 		nb_pci_putl(0, 16, 1, 0xd0, 0)
928 #define	NRECFBDD_WR(branch) \
929 	if (nb_chipset == INTEL_NB_5400) \
930 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd0, 0); \
931 	else if (nb_chipset == INTEL_NB_7300) \
932 		nb_pci_putl(0, 16, 1, 0xd0, 0); \
933 	else \
934 		nb_pci_putl(0, 16, 1, 0xd4, 0)
935 #define	NRECFBDE_WR(branch) \
936 	if (nb_chipset == INTEL_NB_5400) \
937 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd4, 0); \
938 	else if (nb_chipset == INTEL_NB_7300) \
939 		nb_pci_putl(0, 16, 1, 0xd4, 0); \
940 	else \
941 		nb_pci_putl(0, 16, 1, 0xd8, 0)
942 #define	NRECFBDF_WR(branch) \
943 	if (nb_chipset == INTEL_NB_5400) \
944 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xd8, 0); \
945 	else if (nb_chipset == INTEL_NB_7300) \
946 		nb_pci_putw(0, 16, 1, 0xd8, 0);
947 #define	REDMEMB_WR(branch) \
948 	if (nb_chipset == INTEL_NB_5400) \
949 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x7c, 0); \
950 	else \
951 		nb_pci_putl(0, 16, 1, 0x7c, 0)
952 #define	RECMEMA_WR(branch) \
953 	if (nb_chipset == INTEL_NB_5400) \
954 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe0, 0); \
955 	else \
956 		nb_pci_putw(0, 16, 1, nb_chipset == INTEL_NB_7300 ? 0xe0 : \
957 		    0xe2, 0)
958 #define	RECMEMB_WR(branch) \
959 	if (nb_chipset == INTEL_NB_5400) \
960 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe4, 0); \
961 	else \
962 		nb_pci_putl(0, 16, 1, 0xe4, 0)
963 #define	RECFGLOG_WR(branch) \
964 	if (nb_chipset == INTEL_NB_5400) \
965 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0x78, 0); \
966 	else if (nb_chipset == INTEL_NB_7300) \
967 		nb_pci_putl(0, 16, 1, 0x78, 0); \
968 	else \
969 		nb_pci_putl(0, 16, 1, 0xe8, 0)
970 #define	RECFBDA_WR(branch) \
971 	if (nb_chipset == INTEL_NB_5400) \
972 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xe8, 0); \
973 	else if (nb_chipset == INTEL_NB_7300) \
974 		nb_pci_putl(0, 16, 1, 0xe8, 0); \
975 	else \
976 		nb_pci_putl(0, 16, 1, 0xec, 0)
977 #define	RECFBDB_WR(branch) \
978 	if (nb_chipset == INTEL_NB_5400) \
979 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xec, 0); \
980 	else if (nb_chipset == INTEL_NB_7300) \
981 		nb_pci_putl(0, 16, 1, 0xec, 0); \
982 	else \
983 		nb_pci_putl(0, 16, 1, 0xf0, 0)
984 #define	RECFBDC_WR(branch) \
985 	if (nb_chipset == INTEL_NB_5400) \
986 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf0, 0); \
987 	else if (nb_chipset == INTEL_NB_7300) \
988 		nb_pci_putl(0, 16, 1, 0xf0, 0); \
989 	else \
990 		nb_pci_putl(0, 16, 1, 0xf4, 0)
991 #define	RECFBDD_WR(branch) \
992 	if (nb_chipset == INTEL_NB_5400) \
993 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf4, 0); \
994 	else if (nb_chipset == INTEL_NB_7300) \
995 		nb_pci_putl(0, 16, 1, 0xf4, 0); \
996 	else \
997 		nb_pci_putl(0, 16, 1, 0xf8, 0)
998 #define	RECFBDE_WR(branch) \
999 	if (nb_chipset == INTEL_NB_5400) \
1000 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xf8, 0); \
1001 	else if (nb_chipset == INTEL_NB_7300) \
1002 		nb_pci_putl(0, 16, 1, 0xf8, 0); \
1003 	else \
1004 		nb_pci_putl(0, 16, 1, 0xfc, 0)
1005 #define	RECFBDF_WR(branch) \
1006 	if (nb_chipset == INTEL_NB_5400) \
1007 		nb_pci_putl(0, (branch) ? 22 : 21, 1, 0xfc, 0); \
1008 	else if (nb_chipset == INTEL_NB_7300) \
1009 		nb_pci_putw(0, 16, 1, 0xf8, 0); \
1010 
1011 #define	MC_RD()		nb_pci_getl(0, 16, 1, 0x40, 0)
1012 #define	MC_WR(val)	nb_pci_putl(0, 16, 1, 0x40, val)
1013 #define	MCA_RD()	nb_pci_getl(0, 16, 1, 0x58, 0)
1014 #define	TOLM_RD()	nb_pci_getw(0, 16, 1, 0x6c, 0)
1015 
1016 #define	MTR_RD(branch, dimm) (nb_chipset == INTEL_NB_5400 ? \
1017 	nb_pci_getw(0, (branch) == 0 ? 21 : 22, 0, 0x80 + dimm * 2, 0) : \
1018 	((branch) == 0) ? \
1019 	nb_pci_getw(0, 21, 0, \
1020 	dimm >= 4 ? 0x82 + (dimm & 3) * 4 : 0x80 + dimm * 4, 0) : \
1021 	(nb_number_memory_controllers == 2) ? \
1022 	nb_pci_getw(0, 22, 0, \
1023 	dimm >= 4 ? 0x82 + (dimm & 3) * 4 : 0x80 + dimm * 4, 0) : 0)
1024 #define	MIR_RD(reg)	nb_pci_getw(0, 16, 1, 0x80 + ((reg)*4), 0)
1025 
1026 #define	DMIR_RD(branch, reg) \
1027 	((branch) == 0) ? nb_pci_getl(0, 21, 0, 0x90 + ((reg)*4), 0) : \
1028 	(nb_number_memory_controllers == 2) ? \
1029 	nb_pci_getl(0, 22, 0, 0x90 + ((reg)*4), 0) : 0
1030 
1031 #define	SPCPC_RD(branch) (nb_chipset == INTEL_NB_5000P || \
1032 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1033 	nb_chipset == INTEL_NB_5000Z ? \
1034 	(((branch) == 0) ? \
1035 	(uint32_t)nb_pci_getb(0, 21, 0, 0x40, 0) : \
1036 	    (nb_number_memory_controllers == 2) ? \
1037 	    (uint32_t)nb_pci_getb(0, 22, 0, 0x40, 0) : 0) : \
1038 	nb_pci_getl(0, ((branch) == 0) ? 21 : 22, 0, 0x40, 0))
1039 
1040 #define	SPCPC_SPARE_ENABLE (nb_chipset == INTEL_NB_5000P || \
1041 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1042 	nb_chipset == INTEL_NB_5000Z ? 1 : 0x20)
1043 #define	SPCPC_SPRANK(spcpc) (nb_chipset == INTEL_NB_5000P || \
1044 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1045 	nb_chipset == INTEL_NB_5000Z ? \
1046 	(((spcpc) >> 1) & 7) : ((spcpc) & 0xf))
1047 
1048 #define	SPCPS_RD(branch) ((branch) == 0) ? \
1049 	nb_pci_getb(0, 21, 0, nb_chipset == INTEL_NB_5000P || \
1050 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1051 	nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0) : \
1052 	(nb_number_memory_controllers == 2) ? \
1053 	nb_pci_getb(0, 22, 0, nb_chipset == INTEL_NB_5000P || \
1054 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1055 	nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0) : 0
1056 
1057 #define	SPCPS_WR(branch) \
1058 	if ((branch) == 0) { \
1059 		nb_pci_putb(0, 21, 0, nb_chipset == INTEL_NB_5000P || \
1060 		    nb_chipset == INTEL_NB_5000X || \
1061 		    nb_chipset == INTEL_NB_5000V || \
1062 		    nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0); \
1063 	} else if (nb_number_memory_controllers == 2) { \
1064 		nb_pci_putb(0, 22, 0, nb_chipset == INTEL_NB_5000P || \
1065 		    nb_chipset == INTEL_NB_5000X || \
1066 		    nb_chipset == INTEL_NB_5000V || \
1067 		    nb_chipset == INTEL_NB_5000Z ? 0x41 : 0x43, 0); \
1068 	}
1069 
1070 #define	SPCPS_SPARE_DEPLOYED (nb_chipset == INTEL_NB_5000P || \
1071 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1072 	nb_chipset == INTEL_NB_5000Z ? 0x11 : 0x60)
1073 #define	SPCPS_FAILED_RANK(spcps) (nb_chipset == INTEL_NB_5000P || \
1074 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1075 	nb_chipset == INTEL_NB_5000Z ? (((spcps) >> 1) & 7) : ((spcps) & 0xf))
1076 
1077 #define	UERRCNT_RD(branch) ((branch) == 0) ? \
1078 	nb_pci_getl(0, 21, 0, 0xa4, 0) : \
1079 	(nb_number_memory_controllers == 2) ? \
1080 	nb_pci_getl(0, 22, 0, 0xa4, 0) : 0
1081 #define	CERRCNT_RD(branch) ((branch) == 0) ? \
1082 	nb_pci_getl(0, 21, 0, 0xa8, 0) : \
1083 	(nb_number_memory_controllers == 2) ? \
1084 	nb_pci_getl(0, 22, 0, 0xa8, 0) : 0
1085 #define	CERRCNTA_RD(branch, channel) \
1086 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1087 	(channel & 1) == 0 ? 0xe0 : 0xf0, 0)
1088 #define	CERRCNTB_RD(branch, channel) \
1089 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1090 	(channel & 1) == 0 ? 0xe4 : 0xf4, 0)
1091 #define	CERRCNTC_RD(branch, channel) \
1092 	(nb_chipset == INTEL_NB_7300 ? \
1093 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1094 	(channel & 1) == 0 ? 0xe8 : 0xf8, 0) : 0)
1095 #define	CERRCNTD_RD(branch, channel) \
1096 	(nb_chipset == INTEL_NB_7300 ? \
1097 	nb_pci_getl(0, branch == 0 ? 21 : 22, 0, \
1098 	(channel & 1) == 0 ? 0xec : 0xfc, 0) : 0)
1099 #define	BADRAMA_RD(branch) ((branch) == 0) ? \
1100 	nb_pci_getl(0, 21, 0, 0xac, 0) : \
1101 	(nb_number_memory_controllers == 2) ? \
1102 	nb_pci_getl(0, 22, 0, 0xac, 0) : 0
1103 #define	BADRAMB_RD(branch) ((branch) == 0) ? \
1104 	nb_pci_getw(0, 21, 0, 0xb0, 0) : \
1105 	(nb_number_memory_controllers == 2) ? \
1106 	nb_pci_getw(0, 22, 0, 0xb0, 0) : 0
1107 #define	BADCNT_RD(branch) ((branch) == 0) ? \
1108 	nb_pci_getl(0, 21, 0, 0xb4, 0) : \
1109 	(nb_number_memory_controllers == 2) ? \
1110 	nb_pci_getl(0, 22, 0, 0xb4, 0) : 0
1111 
1112 #define	UERRCNT_WR(branch, val)	((branch) == 0) ? \
1113 	nb_pci_putl(0, 21, 0, 0xa4, val) : \
1114 	(nb_number_memory_controllers == 2) ? \
1115 	nb_pci_putl(0, 22, 0, 0xa4, val) \
1116 					: 0
1117 #define	CERRCNT_WR(branch, val)	((branch) == 0) ? \
1118 	nb_pci_putl(0, 21, 0, 0xa8, val) : \
1119 	(nb_number_memory_controllers == 2) ? \
1120 	nb_pci_putl(0, 22, 0, 0xa8, val) : 0
1121 #define	BADRAMA_WR(branch, val)	((branch) == 0) ? \
1122 	nb_pci_putl(0, 21, 0, 0xac, val) : \
1123 	(nb_number_memory_controllers == 2) ? \
1124 	nb_pci_putl(0, 22, 0, 0xac, val) : 0
1125 #define	BADRAMB_WR(branch, val)	((branch) == 0) ? \
1126 	nb_pci_putw(0, 21, 0, 0xb0, val) : \
1127 	(nb_number_memory_controllers == 2) ? \
1128 	nb_pci_putw(0, 22, 0, 0xb0) : 0
1129 #define	BADCNT_WR(branch, val) ((branch) == 0) ? \
1130 	nb_pci_putl(0, 21, 0, 0xb4, val) : \
1131 	(nb_number_memory_controllers == 2) ? \
1132 	nb_pci_putl(0, 22, 0, 0xb4, val) : 0
1133 
1134 #define	SPD_RD(branch, channel)	((branch) == 0) ? \
1135 	nb_pci_getw(0, 21, 0, 0x74 + ((channel) * 2), 0) : \
1136 	(nb_number_memory_controllers == 2) ? \
1137 	nb_pci_getw(0, 22, 0, 0x74 + ((channel) * 2), 0) : 0
1138 #define	SPDCMDRD(branch, channel) ((branch) == 0) ? \
1139 	nb_pci_getl(0, 21, 0, 0x78 + ((channel) * 4), 0) : \
1140 	(nb_number_memory_controllers == 2) ? \
1141 	nb_pci_getl(0, 22, 0, 0x78 + ((channel) * 4), 0) : 0
1142 
1143 #define	SPDCMD1_1_WR(val)	nb_pci_putl(0, 21, 0, 0x7c, val)
1144 #define	SPDCMD_WR(branch, channel, val)	\
1145 	if ((branch) == 0) \
1146 	nb_pci_putl(0, 21, 0, 0x78 + ((channel) * 4), val); \
1147 	else if (nb_number_memory_controllers == 2) \
1148 	nb_pci_putl(0, 22, 0, 0x78 + ((channel) * 4), val)
1149 
1150 #define	UNCERRSTS_RD(pex)		nb_pci_getl(0, pex, 0, 0x104, 0)
1151 #define	UNCERRMSK_RD(pex) nb_pci_getl(0, pex, 0, 0x108, 0)
1152 #define	PEX_FAT_FERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x154, 0)
1153 #define	PEX_FAT_NERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x15c, 0)
1154 #define	PEX_NF_FERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x158, 0)
1155 #define	PEX_NF_NERR_ESI_RD()	nb_pci_getl(0, 0, 0, 0x160, 0)
1156 #define	PEX_ERR_DOCMD_RD(pex)	((nb_chipset == INTEL_NB_5400) ? \
1157     nb_pci_getw(0, pex, 0, 0x144, 0) : nb_pci_getl(0, pex, 0, 0x144, 0))
1158 #define	PEX_ERR_PIN_MASK_RD(pex)	nb_pci_getw(0, pex, 0, 0x146, 0)
1159 #define	EMASK_UNCOR_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x148, 0)
1160 #define	EMASK_COR_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x14c, 0)
1161 #define	EMASK_RP_PEX_RD(pex)	nb_pci_getl(0, pex, 0, 0x150, 0)
1162 
1163 #define	UNCERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x104, val)
1164 #define	UNCERRMSK_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x108, val)
1165 #define	PEX_FAT_FERR_ESI_WR(val) nb_pci_putl(0, 0, 0, 0x154, val)
1166 #define	PEX_FAT_NERR_ESI_WR(val) nb_pci_putl(0, 0, 0, 0x15c, val)
1167 #define	PEX_NF_FERR_ESI_WR(val)	nb_pci_putl(0, 0, 0, 0x158, val)
1168 #define	PEX_NF_NERR_ESI_WR(val)	nb_pci_putl(0, 0, 0, 0x160, val)
1169 #define	PEX_ERR_DOCMD_WR(pex, val)	((nb_chipset == INTEL_NB_5400) ? \
1170     nb_pci_putw(0, pex, 0, 0x144, val) : nb_pci_putl(0, pex, 0, 0x144, val))
1171 #define	PEX_ERR_PIN_MASK_WR(pex, val)	nb_pci_putw(0, pex, 0, 0x146, val)
1172 #define	EMASK_UNCOR_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x148, val)
1173 #define	EMASK_COR_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x14c, val)
1174 #define	EMASK_RP_PEX_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x150, val)
1175 
1176 #define	PEX_FAT_FERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x154, ip)
1177 #define	PEX_FAT_NERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x15c, ip)
1178 #define	PEX_NF_FERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x158, ip)
1179 #define	PEX_NF_NERR_RD(pex, ip)	nb_pci_getl(0, pex, 0, 0x160, ip)
1180 #define	UNCERRSEV_RD(pex)	nb_pci_getl(0, pex, 0, 0x10c, 0)
1181 #define	CORERRSTS_RD(pex)	nb_pci_getl(0, pex, 0, 0x110, 0)
1182 #define	RPERRSTS_RD(pex)	nb_pci_getl(0, pex, 0, 0x130, 0)
1183 #define	RPERRSID_RD(pex)	nb_pci_getl(0, pex, 0, 0x134, 0)
1184 #define	AERRCAPCTRL_RD(pex)	nb_pci_getl(0, pex, 0, 0x118, 0)
1185 #define	PEXDEVSTS_RD(pex)	nb_pci_getw(0, pex, 0, 0x76, 0)
1186 #define	PEXROOTCTL_RD(pex)	nb_pci_getw(0, pex, 0, 0x88, 0)
1187 
1188 #define	PEX_FAT_FERR_WR(pex, val) nb_pci_putl(0, pex, 0, 0x154, val)
1189 #define	PEX_FAT_NERR_WR(pex, val) nb_pci_putl(0, pex, 0, 0x15c, val)
1190 #define	PEX_NF_FERR_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x158, val)
1191 #define	PEX_NF_NERR_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x160, val)
1192 #define	CORERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x110, val)
1193 #define	UNCERRSEV_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x10c, val)
1194 #define	RPERRSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x130, val)
1195 #define	PEXDEVSTS_WR(pex, val)	nb_pci_putl(0, pex, 0, 0x76, val)
1196 #define	PEXROOTCTL_WR(pex, val)	nb_pci_putw(0, pex, 0, 0x88, val)
1197 
1198 #define	PCISTS_RD(ip)		nb_pci_getw(0, 8, 0, 0x6, ip)
1199 #define	PCIDEVSTS_RD()		nb_pci_getw(0, 8, 0, 0x76, 0)
1200 #define	PCISTS_WR(val)		nb_pci_putw(0, 8, 0, 0x6, val)
1201 #define	PCIDEVSTS_WR(val)	nb_pci_putw(0, 8, 0, 0x76, val)
1202 
1203 #define	RANK_MASK	(nb_chipset != INTEL_NB_7300 ? 7 : 0xf)
1204 #define	CAS_MASK	(nb_chipset == INTEL_NB_5000P || \
1205 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1206 	nb_chipset == INTEL_NB_5000Z ? 0xfff : 0x1fff)
1207 #define	RAS_MASK	(nb_chipset == INTEL_NB_5000P || \
1208 	nb_chipset == INTEL_NB_5000X || nb_chipset == INTEL_NB_5000V || \
1209 	nb_chipset == INTEL_NB_5000Z ? 0x7fff : 0xffff)
1210 #define	BANK_MASK	7
1211 
1212 #define	DMIR_RANKS(dmir, rank0, rank1, rank2, rank3) \
1213 	if (nb_chipset == INTEL_NB_5000P || nb_chipset == INTEL_NB_5000X || \
1214 	    nb_chipset == INTEL_NB_5000V || nb_chipset == INTEL_NB_5000Z) { \
1215 		rank0 = (dmir) & 3; \
1216 		rank1 = ((dmir) >> 3) & 3; \
1217 		rank2 = ((dmir) >> 6) & 3; \
1218 		rank3 = ((dmir) >> 9) & 3; \
1219 	} else { \
1220 		rank0 = (dmir) & 0xf; \
1221 		rank1 = ((dmir) >> 4) & 0xf; \
1222 		rank2 = ((dmir) >> 8) & 0xf; \
1223 		rank3 = ((dmir) >> 12) & 0xf; \
1224 	}
1225 
1226 #define	FERR_FAT_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf0, ip)
1227 #define	FERR_NF_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf1, ip)
1228 #define	NERR_FAT_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf2, ip)
1229 #define	NERR_NF_THR_RD(ip)	nb_pci_getb(0, 16, 2, 0xf3, ip)
1230 #define	EMASK_THR_RD(ip)	nb_pci_getw(0, 16, 2, 0xf6, ip)
1231 #define	ERR0_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xf8, ip)
1232 #define	ERR1_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xfa, ip)
1233 #define	ERR2_THR_RD(ip)		nb_pci_getw(0, 16, 2, 0xfc, ip)
1234 #define	MCERR_THR_RD(ip)	nb_pci_getw(0, 16, 2, 0xfe, ip)
1235 #define	CTSTS_RD()		nb_pci_getb(0, 16, 4, 0xee, 0)
1236 #define	THRTSTS_RD()		nb_pci_getw(0, 16, 3, 0x68, 0)
1237 
1238 #define	FERR_FAT_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf0, val)
1239 #define	FERR_NF_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf1, val)
1240 #define	NERR_FAT_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf2, val)
1241 #define	NERR_NF_THR_WR(val)	nb_pci_putb(0, 16, 2, 0xf3, val)
1242 #define	EMASK_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xf6, val)
1243 #define	ERR0_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xf8, val)
1244 #define	ERR1_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfa, val)
1245 #define	ERR2_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfc, val)
1246 #define	MCERR_THR_WR(val)	nb_pci_putw(0, 16, 2, 0xfe, val)
1247 #define	CTSTS_WR(val)		nb_pci_putb(0, 16, 4, 0xee, val)
1248 #define	THRTSTS_WR(val)		nb_pci_putw(0, 16, 3, 0x68, val)
1249 
1250 #define	ERR_FAT_THR_F2	0x02	/* >tnid thermal event with intelligent */
1251 				/* throttling disabled */
1252 #define	ERR_FAT_THR_F1	0x01	/* catastrophic on-die thermal event */
1253 
1254 #define	ERR_NF_THR_F5	0x10	/* deadman timeout on cooling update */
1255 #define	ERR_NF_THR_F4	0x08	/* TSMAX Updated */
1256 #define	ERR_NF_THR_F3	0x04	/* On-die throttling event */
1257 
1258 #define	EMASK_THR_FATAL	(ERR_FAT_THR_F2|ERR_FAT_THR_F1)
1259 #define	EMASK_THR_NF	(ERR_NF_THR_F5|ERR_NF_THR_F4|ERR_NF_THR_F3)
1260 
1261 #define	EMASK_THR_F5	0x0010	/* deadman timeout on cooling update */
1262 #define	EMASK_THR_F4	0x0008	/* TSMAX Updated */
1263 #define	EMASK_THR_F3	0x0004	/* On-die throttling event */
1264 #define	EMASK_THR_F2	0x0002	/* >tnid thermal event with intelligent */
1265 				/* throttling disabled */
1266 #define	EMASK_THR_F1	0x0001	/* catastrophic on-die thermal event */
1267 
1268 #ifdef __cplusplus
1269 }
1270 #endif
1271 
1272 #endif /* _NB5000_H */
1273