xref: /illumos-gate/usr/src/uts/intel/sys/mca_amd.h (revision f00e6aa6)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 
23 /*
24  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef _SYS_MCA_AMD_H
29 #define	_SYS_MCA_AMD_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 /*
34  * Constants the Memory Check Architecture as implemented on AMD CPUs.
35  */
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 #define	AMD_MSR_MCG_CAP			0x179
42 #define	AMD_MSR_MCG_STATUS		0x17a
43 #define	AMD_MSR_MCG_CTL			0x17b
44 
45 #define	AMD_MCA_BANK_DC			0	/* Data Cache */
46 #define	AMD_MCA_BANK_IC			1	/* Instruction Cache */
47 #define	AMD_MCA_BANK_BU			2	/* Bus Unit */
48 #define	AMD_MCA_BANK_LS			3	/* Load/Store Unit */
49 #define	AMD_MCA_BANK_NB			4	/* Northbridge */
50 #define	AMD_MCA_BANK_COUNT		5
51 
52 #define	AMD_MSR_DC_CTL			0x400
53 #define	AMD_MSR_DC_MASK			0xc0010044
54 #define	AMD_MSR_DC_STATUS		0x401
55 #define	AMD_MSR_DC_ADDR			0x402
56 
57 #define	AMD_MSR_IC_CTL			0x404
58 #define	AMD_MSR_IC_MASK			0xc0010045
59 #define	AMD_MSR_IC_STATUS		0x405
60 #define	AMD_MSR_IC_ADDR			0x406
61 
62 #define	AMD_MSR_BU_CTL			0x408
63 #define	AMD_MSR_BU_MASK			0xc0010046
64 #define	AMD_MSR_BU_STATUS		0x409
65 #define	AMD_MSR_BU_ADDR			0x40a
66 
67 #define	AMD_MSR_LS_CTL			0x40c
68 #define	AMD_MSR_LS_MASK			0xc0010047
69 #define	AMD_MSR_LS_STATUS		0x40d
70 #define	AMD_MSR_LS_ADDR			0x40e
71 
72 #define	AMD_MSR_NB_CTL			0x410
73 #define	AMD_MSR_NB_MASK			0xc0010048
74 #define	AMD_MSR_NB_STATUS		0x411
75 #define	AMD_MSR_NB_ADDR			0x412
76 
77 #define	AMD_MCG_EN_DC			0x01
78 #define	AMD_MCG_EN_IC			0x02
79 #define	AMD_MCG_EN_BU			0x04
80 #define	AMD_MCG_EN_LS			0x08
81 #define	AMD_MCG_EN_NB			0x10
82 #define	AMD_MCG_EN_ALL \
83 	(AMD_MCG_EN_DC | AMD_MCG_EN_IC | AMD_MCG_EN_BU | AMD_MCG_EN_LS | \
84 	AMD_MCG_EN_NB)
85 
86 /*
87  * Data Cache (DC) bank error-detection enabling bits and CTL register
88  * initializer value.
89  */
90 
91 #define	AMD_DC_EN_ECCI			0x00000001ULL
92 #define	AMD_DC_EN_ECCM			0x00000002ULL
93 #define	AMD_DC_EN_DECC			0x00000004ULL
94 #define	AMD_DC_EN_DMTP			0x00000008ULL
95 #define	AMD_DC_EN_DSTP			0x00000010ULL
96 #define	AMD_DC_EN_L1TP			0x00000020ULL
97 #define	AMD_DC_EN_L2TP			0x00000040ULL
98 
99 #define	AMD_DC_CTL_INIT \
100 	(AMD_DC_EN_ECCI | AMD_DC_EN_ECCM | AMD_DC_EN_DECC | AMD_DC_EN_DMTP | \
101 	AMD_DC_EN_DSTP | AMD_DC_EN_L1TP | AMD_DC_EN_L2TP)
102 
103 /*
104  * Instruction Cache (IC) bank error-detection enabling bits and CTL register
105  * initializer value.
106  *
107  * The Northbridge will handle Read Data errors.  Our initializer will enable
108  * all but the RDDE detector.
109  */
110 
111 #define	AMD_IC_EN_ECCI			0x00000001ULL
112 #define	AMD_IC_EN_ECCM			0x00000002ULL
113 #define	AMD_IC_EN_IDP			0x00000004ULL
114 #define	AMD_IC_EN_IMTP			0x00000008ULL
115 #define	AMD_IC_EN_ISTP			0x00000010ULL
116 #define	AMD_IC_EN_L1TP			0x00000020ULL
117 #define	AMD_IC_EN_L2TP			0x00000040ULL
118 #define	AMD_IC_EN_RDDE			0x00000200ULL
119 
120 #define	AMD_IC_CTL_INIT \
121 	(AMD_IC_EN_ECCI | AMD_IC_EN_ECCM | AMD_IC_EN_IDP | AMD_IC_EN_IMTP | \
122 	AMD_IC_EN_ISTP | AMD_IC_EN_L1TP | AMD_IC_EN_L2TP)
123 
124 /*
125  * Bus Unit (BU) bank error-detection enabling bits and CTL register
126  * initializer value.
127  *
128  * The Northbridge will handle Read Data errors.  Our initializer will enable
129  * all but the S_RDE_* detectors.
130  */
131 
132 #define	AMD_BU_EN_S_RDE_HP		0x00000001ULL
133 #define	AMD_BU_EN_S_RDE_TLB		0x00000002ULL
134 #define	AMD_BU_EN_S_RDE_ALL		0x00000004ULL
135 #define	AMD_BU_EN_S_ECC1_TLB		0x00000008ULL
136 #define	AMD_BU_EN_S_ECC1_HP		0x00000010ULL
137 #define	AMD_BU_EN_S_ECCM_TLB		0x00000020ULL
138 #define	AMD_BU_EN_S_ECCM_HP		0x00000040ULL
139 #define	AMD_BU_EN_L2T_PAR_ICDC		0x00000080ULL
140 #define	AMD_BU_EN_L2T_PAR_TLB		0x00000100ULL
141 #define	AMD_BU_EN_L2T_PAR_SNP		0x00000200ULL
142 #define	AMD_BU_EN_L2T_PAR_CPB		0x00000400ULL
143 #define	AMD_BU_EN_L2T_PAR_SCR		0x00000800ULL
144 #define	AMD_BU_EN_L2D_ECC1_TLB		0x00001000ULL
145 #define	AMD_BU_EN_L2D_ECC1_SNP		0x00002000ULL
146 #define	AMD_BU_EN_L2D_ECC1_CPB		0x00004000ULL
147 #define	AMD_BU_EN_L2D_ECCM_TLB		0x00008000ULL
148 #define	AMD_BU_EN_L2D_ECCM_SNP		0x00010000ULL
149 #define	AMD_BU_EN_L2D_ECCM_CPB		0x00020000ULL
150 #define	AMD_BU_EN_L2T_ECC1_SCR		0x00040000ULL
151 #define	AMD_BU_EN_L2T_ECCM_SCR		0x00080000ULL
152 
153 #define	AMD_BU_CTL_INIT \
154 	(AMD_BU_EN_S_ECC1_TLB | AMD_BU_EN_S_ECC1_HP | \
155 	AMD_BU_EN_S_ECCM_TLB | AMD_BU_EN_S_ECCM_HP | \
156 	AMD_BU_EN_L2T_PAR_ICDC | AMD_BU_EN_L2T_PAR_TLB | \
157 	AMD_BU_EN_L2T_PAR_SNP |	AMD_BU_EN_L2T_PAR_CPB | \
158 	AMD_BU_EN_L2T_PAR_SCR |	AMD_BU_EN_L2D_ECC1_TLB | \
159 	AMD_BU_EN_L2D_ECC1_SNP | AMD_BU_EN_L2D_ECC1_CPB | \
160 	AMD_BU_EN_L2D_ECCM_TLB | AMD_BU_EN_L2D_ECCM_SNP | \
161 	AMD_BU_EN_L2D_ECCM_CPB | AMD_BU_EN_L2T_ECC1_SCR | \
162 	AMD_BU_EN_L2T_ECCM_SCR)
163 
164 /*
165  * Load/Store (LS) bank error-detection enabling bits and CTL register
166  * initializer value.
167  *
168  * The Northbridge will handle Read Data errors.  That's the only type of
169  * error the LS unit can detect at present, so we won't be enabling any
170  * LS detectors.
171  */
172 
173 #define	AMD_LS_EN_S_RDE_S		0x00000001ULL
174 #define	AMD_LS_EN_S_RDE_L		0x00000002ULL
175 
176 #define	AMD_LS_CTL_INIT			0ULL
177 
178 /*
179  * The Northbridge (NB) is configured using both the standard MCA CTL register
180  * and a NB-specific configuration register (NB CFG).  The AMD_NB_EN_* macros
181  * are the detector enabling bits for the NB MCA CTL register.  The
182  * AMD_NB_CFG_* bits are for the NB CFG register.
183  *
184  * The CTL register can be initialized statically, but portions of the NB CFG
185  * register must be initialized based on the current machine's configuration.
186  *
187  * The MCA NB Control Register maps to MC4_CTL[31:0].
188  *
189  */
190 #define	AMD_NB_EN_CORRECC		0x00000001
191 #define	AMD_NB_EN_UNCORRECC		0x00000002
192 #define	AMD_NB_EN_CRCERR0		0x00000004
193 #define	AMD_NB_EN_CRCERR1		0x00000008
194 #define	AMD_NB_EN_CRCERR2		0x00000010
195 #define	AMD_NB_EN_SYNCPKT0		0x00000020
196 #define	AMD_NB_EN_SYNCPKT1		0x00000040
197 #define	AMD_NB_EN_SYNCPKT2		0x00000080
198 #define	AMD_NB_EN_MSTRABRT		0x00000100
199 #define	AMD_NB_EN_TGTABRT		0x00000200
200 #define	AMD_NB_EN_GARTTBLWK		0x00000400
201 #define	AMD_NB_EN_ATOMICRMW		0x00000800
202 #define	AMD_NB_EN_WCHDOGTMR		0x00001000
203 
204 #define	AMD_NB_CTL_INIT /* All but GARTTBLWK */ \
205 	(AMD_NB_EN_CORRECC | AMD_NB_EN_UNCORRECC | \
206 	AMD_NB_EN_CRCERR0 | AMD_NB_EN_CRCERR1 | AMD_NB_EN_CRCERR2 | \
207 	AMD_NB_EN_SYNCPKT0 | AMD_NB_EN_SYNCPKT1 | AMD_NB_EN_SYNCPKT2 | \
208 	AMD_NB_EN_MSTRABRT | AMD_NB_EN_TGTABRT | \
209 	AMD_NB_EN_ATOMICRMW | AMD_NB_EN_WCHDOGTMR)
210 
211 #define	AMD_NB_CFG_CPUECCERREN		0x00000001
212 #define	AMD_NB_CFG_CPURDDATERREN	0x00000002
213 #define	AMD_NB_CFG_SYNCONUCECCEN	0x00000004
214 #define	AMD_NB_CFG_SYNCPKTGENDIS	0x00000008
215 #define	AMD_NB_CFG_SYNCPKTPROPDIS	0x00000010
216 #define	AMD_NB_CFG_IOMSTABORTDIS	0x00000020
217 #define	AMD_NB_CFG_CPUERRDIS		0x00000040
218 #define	AMD_NB_CFG_IOERRDIS		0x00000080
219 #define	AMD_NB_CFG_WDOGTMRDIS		0x00000100
220 #define	AMD_NB_CFG_SYNCONWDOGEN		0x00100000
221 #define	AMD_NB_CFG_SYNCONANYERREN	0x00200000
222 #define	AMD_NB_CFG_ECCEN		0x00400000
223 #define	AMD_NB_CFG_CHIPKILLECCEN	0x00800000
224 #define	AMD_NB_CFG_IORDDATERREN		0x01000000
225 #define	AMD_NB_CFG_DISPCICFGCPUERRRSP	0x02000000
226 #define	AMD_NB_CFG_NBMCATOMSTCPUEN	0x08000000
227 
228 #define	AMD_NB_CFG_WDOGTMRCNTSEL_4095	0x00000000
229 #define	AMD_NB_CFG_WDOGTMRCNTSEL_2047	0x00000200
230 #define	AMD_NB_CFG_WDOGTMRCNTSEL_1023	0x00000400
231 #define	AMD_NB_CFG_WDOGTMRCNTSEL_511	0x00000600
232 #define	AMD_NB_CFG_WDOGTMRCNTSEL_255	0x00000800
233 #define	AMD_NB_CFG_WDOGTMRCNTSEL_127	0x00000a00
234 #define	AMD_NB_CFG_WDOGTMRCNTSEL_63	0x00000c00
235 #define	AMD_NB_CFG_WDOGTMRCNTSEL_31	0x00000e00
236 #define	AMD_NB_CFG_WDOGTMRCNTSEL_MASK	0x00000e00
237 #define	AMD_NB_CFG_WDOGTMRCNTSEL_SHIFT	9
238 
239 #define	AMD_NB_CFG_WDOGTMRBASESEL_1MS	0x00000000
240 #define	AMD_NB_CFG_WDOGTMRBASESEL_1US	0x00001000
241 #define	AMD_NB_CFG_WDOGTMRBASESEL_5NS	0x00002000
242 #define	AMD_NB_CFG_WDOGTMRBASESEL_MASK	0x00003000
243 #define	AMD_NB_CFG_WDOGTMRBASESEL_SHIFT	12
244 
245 #define	AMD_NB_CFG_LDTLINKSEL_MASK	0x0000c000
246 #define	AMD_NB_CFG_LDTLINKSEL_SHIFT	14
247 
248 #define	AMD_NB_CFG_GENCRCERRBYTE0	0x00010000
249 #define	AMD_NB_CFG_GENCRCERRBYTE1	0x00020000
250 
251 /* Generic bank status register bits */
252 #define	AMD_BANK_STAT_VALID		0x8000000000000000
253 #define	AMD_BANK_STAT_OVER		0x4000000000000000
254 #define	AMD_BANK_STAT_UC		0x2000000000000000
255 #define	AMD_BANK_STAT_EN		0x1000000000000000
256 #define	AMD_BANK_STAT_MISCV		0x0800000000000000
257 #define	AMD_BANK_STAT_ADDRV		0x0400000000000000
258 #define	AMD_BANK_STAT_PCC		0x0200000000000000
259 
260 #define	AMD_BANK_STAT_CECC		0x0000400000000000
261 #define	AMD_BANK_STAT_UECC		0x0000200000000000
262 #define	AMD_BANK_STAT_SCRUB		0x0000010000000000
263 
264 #define	AMD_BANK_STAT_SYND_MASK		0x007f800000000000 /* syndrome[7:0] */
265 #define	AMD_BANK_STAT_SYND_SHIFT	47
266 
267 #define	AMD_BANK_SYND(stat) \
268 	(((stat) & AMD_BANK_STAT_SYND_MASK) >> AMD_BANK_STAT_SYND_SHIFT)
269 #define	AMD_BANK_MKSYND(synd) \
270 	(((uint64_t)(synd) << AMD_BANK_STAT_SYND_SHIFT) & \
271 	AMD_BANK_STAT_SYND_MASK)
272 
273 /* northbridge (NB) status registers */
274 
275 #define	AMD_NB_FUNC			3
276 #define	AMD_NB_REG_CFG			0x44
277 #define	AMD_NB_REG_STLO			0x48	/* alias: NB_STATUS[0:31] */
278 #define	AMD_NB_REG_STHI			0x4c	/* alias: NB_STATUS[32:63] */
279 #define	AMD_NB_REG_ADDRLO		0x50	/* alias: NB_ADDR[0:31] */
280 #define	AMD_NB_REG_ADDRHI		0x54	/* alias: NB_ADDR[32:63] */
281 
282 #define	AMD_NB_REG_SCRUBCTL		0x58
283 #define	AMD_NB_REG_SCRUBADDR_LO		0x5c
284 #define	AMD_NB_REG_SCRUBADDR_HI		0x60
285 
286 #define	AMD_NB_STAT_LDTLINK_MASK	0x0000007000000000
287 #define	AMD_NB_STAT_LDTLINK_SHIFT	4
288 #define	AMD_NB_STAT_ERRCPU1		0x0000000200000000
289 #define	AMD_NB_STAT_ERRCPU0		0x0000000100000000
290 #define	AMD_NB_STAT_CKSYND_MASK		0x00000000ff000000 /* syndrome[15:8] */
291 #define	AMD_NB_STAT_CKSYND_SHIFT	(24 - 8) /* shift [31:24] to [15:8] */
292 
293 #define	AMD_NB_STAT_CKSYND(stat) \
294 	((((stat) & AMD_NB_STAT_CKSYND_MASK) >> AMD_NB_STAT_CKSYND_SHIFT) | \
295 	AMD_BANK_SYND((stat)))
296 
297 #define	AMD_NB_STAT_MKCKSYND(synd) \
298 	((((uint64_t)(synd) << AMD_NB_STAT_CKSYND_SHIFT) & \
299 	AMD_NB_STAT_CKSYND_MASK) | AMD_BANK_MKSYND(synd))
300 
301 #define	AMD_ERRCODE_MASK		0x000000000000ffff
302 #define	AMD_ERREXT_MASK			0x00000000000f0000
303 #define	AMD_ERREXT_SHIFT		16
304 
305 #define	AMD_ERRCODE_TT_MASK		0x000c
306 #define	AMD_ERRCODE_TT_SHIFT		2
307 #define	AMD_ERRCODE_TT_INSTR		0x0
308 #define	AMD_ERRCODE_TT_DATA		0x1
309 #define	AMD_ERRCODE_TT_GEN		0x2
310 
311 #define	AMD_ERRCODE_LL_MASK		0x0003
312 #define	AMD_ERRCODE_LL_L0		0x0
313 #define	AMD_ERRCODE_LL_L1		0x1
314 #define	AMD_ERRCODE_LL_L2		0x2
315 #define	AMD_ERRCODE_LL_LG		0x3
316 
317 #define	AMD_ERRCODE_R4_MASK		0x00f0
318 #define	AMD_ERRCODE_R4_SHIFT		4
319 #define	AMD_ERRCODE_R4_GEN		0x0
320 #define	AMD_ERRCODE_R4_RD		0x1
321 #define	AMD_ERRCODE_R4_WR		0x2
322 #define	AMD_ERRCODE_R4_DRD		0x3
323 #define	AMD_ERRCODE_R4_DWR		0x4
324 #define	AMD_ERRCODE_R4_IRD		0x5
325 #define	AMD_ERRCODE_R4_PREFETCH		0x6
326 #define	AMD_ERRCODE_R4_EVICT		0x7
327 #define	AMD_ERRCODE_R4_SNOOP		0x8
328 
329 #define	AMD_ERRCODE_PP_MASK		0x0600
330 #define	AMD_ERRCODE_PP_SHIFT		9
331 #define	AMD_ERRCODE_PP_SRC		0x0
332 #define	AMD_ERRCODE_PP_RSP		0x1
333 #define	AMD_ERRCODE_PP_OBS		0x2
334 #define	AMD_ERRCODE_PP_GEN		0x3
335 
336 #define	AMD_ERRCODE_T_MASK		0x0100
337 #define	AMD_ERRCODE_T_SHIFT		8
338 #define	AMD_ERRCODE_T_NONE		0x0
339 #define	AMD_ERRCODE_T_TIMEOUT		0x1
340 
341 #define	AMD_ERRCODE_II_MASK		0x000c
342 #define	AMD_ERRCODE_II_SHIFT		2
343 #define	AMD_ERRCODE_II_MEM		0x0
344 #define	AMD_ERRCODE_II_IO		0x2
345 #define	AMD_ERRCODE_II_GEN		0x3
346 
347 #define	AMD_ERRCODE_TLB_BIT		4
348 #define	AMD_ERRCODE_MEM_BIT		8
349 #define	AMD_ERRCODE_BUS_BIT		11
350 
351 #define	AMD_ERRCODE_TLB_MASK		0xfff0
352 #define	AMD_ERRCODE_TLB_VAL		0x0010
353 #define	AMD_ERRCODE_MEM_MASK		0xff00
354 #define	AMD_ERRCODE_MEM_VAL		0x0100
355 #define	AMD_ERRCODE_BUS_MASK		0xf800
356 #define	AMD_ERRCODE_BUS_VAL		0x0800
357 
358 #define	AMD_ERRCODE_MKTLB(tt, ll) \
359 	(AMD_ERRCODE_TLB_VAL | \
360 	(((tt) << AMD_ERRCODE_TT_SHIFT) & AMD_ERRCODE_TT_MASK) | \
361 	((ll) & AMD_ERRCODE_LL_MASK))
362 #define	AMD_ERRCODE_ISTLB(code) \
363 	(((code) & AMD_ERRCODE_TLB_MASK) == AMD_ERRCODE_TLB_VAL)
364 
365 #define	AMD_ERRCODE_MKMEM(r4, tt, ll) \
366 	(AMD_ERRCODE_MEM_VAL | \
367 	(((r4) << AMD_ERRCODE_R4_SHIFT) & AMD_ERRCODE_R4_MASK) | \
368 	(((tt) << AMD_ERRCODE_TT_SHIFT) & AMD_ERRCODE_TT_MASK) | \
369 	((ll) & AMD_ERRCODE_LL_MASK))
370 #define	AMD_ERRCODE_ISMEM(code) \
371 	(((code) & AMD_ERRCODE_MEM_MASK) == AMD_ERRCODE_MEM_VAL)
372 
373 #define	AMD_ERRCODE_MKBUS(pp, t, r4, ii, ll) \
374 	(AMD_ERRCODE_BUS_VAL | \
375 	(((pp) << AMD_ERRCODE_PP_SHIFT) & AMD_ERRCODE_PP_MASK) | \
376 	(((t) << AMD_ERRCODE_T_SHIFT) & AMD_ERRCODE_T_MASK) | \
377 	(((r4) << AMD_ERRCODE_R4_SHIFT) & AMD_ERRCODE_R4_MASK) | \
378 	(((ii) << AMD_ERRCODE_II_SHIFT) & AMD_ERRCODE_II_MASK) | \
379 	((ll) & AMD_ERRCODE_LL_MASK))
380 #define	AMD_ERRCODE_ISBUS(code) \
381 	(((code) & AMD_ERRCODE_BUS_MASK) == AMD_ERRCODE_BUS_VAL)
382 
383 #define	AMD_NB_ADDRLO_MASK		0xfffffff8
384 #define	AMD_NB_ADDRHI_MASK		0x000000ff
385 
386 #define	AMD_SYNDTYPE_ECC		0
387 #define	AMD_SYNDTYPE_CHIPKILL		1
388 
389 #define	AMD_NB_SCRUBCTL_DRAM_MASK	0x0000001f
390 #define	AMD_NB_SCRUBCTL_DRAM_SHIFT	0
391 #define	AMD_NB_SCRUBCTL_L2_MASK		0x00001f00
392 #define	AMD_NB_SCRUBCTL_L2_SHIFT	8
393 #define	AMD_NB_SCRUBCTL_DC_MASK		0x001f0000
394 #define	AMD_NB_SCRUBCTL_DC_SHIFT	16
395 
396 #define	AMD_NB_SCRUBCTL_RATE_NONE	0
397 #define	AMD_NB_SCRUBCTL_RATE_MAX	0x16
398 
399 #define	AMD_NB_SCRUBADDR_LO_MASK	0xffffffc0
400 #define	AMD_NB_SCRUBADDR_LO_SCRUBREDIREN 0x1
401 #define	AMD_NB_SCRUBADDR_HI_MASK	0x000000ff
402 
403 #define	AMD_NB_SCRUBADDR_MKLO(addr) \
404 	((addr) & AMD_NB_SCRUBADDR_LO_MASK)
405 
406 #define	AMD_NB_SCRUBADDR_MKHI(addr) \
407 	(((addr) >> 32) & AMD_NB_SCRUBADDR_HI_MASK)
408 
409 #define	AMD_NB_MKSCRUBCTL(dc, l2, dr) ( \
410 	(((dc) << AMD_NB_SCRUBCTL_DC_SHIFT) & AMD_NB_SCRUBCTL_DC_MASK) | \
411 	(((l2) << AMD_NB_SCRUBCTL_L2_SHIFT) & AMD_NB_SCRUBCTL_L2_MASK) | \
412 	(((dr) << AMD_NB_SCRUBCTL_DRAM_SHIFT) & AMD_NB_SCRUBCTL_DRAM_MASK))
413 
414 #ifdef __cplusplus
415 }
416 #endif
417 
418 #endif /* _SYS_MCA_AMD_H */
419