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 2010 Sun Microsystems, Inc.  All rights reserved.
24 * Use is subject to license terms.
25 */
26
27#define	DIAGNOSE_ERPT (payloadprop_defined("diagnose") && \
28	payloadprop("diagnose") != 0x0)
29
30#define DIMMPATH dimm
31
32#define CONTAINS_DIMM (payloadprop_contains("resource", asru(DIMMPATH)))
33
34#define	SET_ADDR (!payloadprop_defined("phys-addr") || \
35	setpayloadprop("physaddr", payloadprop("phys-addr")))
36
37#define SET_OFFSET (!payloadprop_defined("offset") || \
38	setpayloadprop("offset",\
39        payloadprop("offset")))
40
41#define SET_SERDT (!payloadprop_defined("serd_t") || \
42	setserdt(payloadprop("serd_t")))
43
44#define SET_SERDN (!payloadprop_defined("serd_n") || \
45	setserdn(payloadprop("serd_n")))
46
47#define SET_RATIO        \
48	((payloadprop_defined("filter_ratio") && \
49	payloadprop("filter_ratio") != 0x0) ? \
50	(setserdincrement(payloadprop("filter_ratio"))) : 1)
51
52/*
53 * fault.memory.generic-sparc.bank & fault.memory.generic-sparc.page
54 * are generated for memory ue error.
55 */
56#define	MEMUE_ERPT(level)	\
57	event ereport.cpu.generic-sparc.mem-uc@level { within(1s)}
58
59MEMUE_ERPT(chip);
60MEMUE_ERPT(core);
61MEMUE_ERPT(strand);
62
63#define	FLT_MEM_UE_BANK(level)						\
64	event fault.memory.bank@DIMMPATH;				\
65									\
66	prop fault.memory.bank@DIMMPATH					\
67	    { DIAGNOSE_ERPT && CONTAINS_DIMM } (0)->			\
68	    ereport.cpu.generic-sparc.mem-uc@level<>;			\
69									\
70	event upset.memory.bank@DIMMPATH;				\
71									\
72	prop upset.memory.bank@DIMMPATH					\
73	    { !DIAGNOSE_ERPT } (0)->					\
74	    ereport.cpu.generic-sparc.mem-uc@level<>
75
76FLT_MEM_UE_BANK(chip);
77FLT_MEM_UE_BANK(core);
78FLT_MEM_UE_BANK(strand);
79
80#define FLT_MEM_UE_PAGE(level)						\
81	event fault.memory.page@DIMMPATH,				\
82	     message=0;							\
83									\
84	prop fault.memory.page@DIMMPATH					\
85	    { DIAGNOSE_ERPT && CONTAINS_DIMM && SET_ADDR && SET_OFFSET } (0)-> \
86	    ereport.cpu.generic-sparc.mem-uc@level<>;			\
87									\
88	event upset.memory.page@DIMMPATH;				\
89									\
90	prop upset.memory.page@DIMMPATH					\
91	    { !DIAGNOSE_ERPT } (0)->					\
92	    ereport.cpu.generic-sparc.mem-uc@level<>
93
94FLT_MEM_UE_PAGE(chip);
95FLT_MEM_UE_PAGE(core);
96FLT_MEM_UE_PAGE(strand);
97
98
99#define CHIP		chip
100#define	MEM_BUFF	memory-buffer
101#define	MEM_CTRL	memory-controller
102
103#define	CONTAINS_CHIP     (payloadprop_contains("sender", asru(CHIP)))
104#define	CONTAINS_MEMBUFF  (payloadprop_contains("sender", asru(MEM_BUFF)))
105#define	CONTAINS_MEMCTRL  (payloadprop_contains("sender", asru(MEM_CTRL)))
106
107engine serd.memory.generic-sparc.membuf-crc@CHIP, N=120, T=30min;
108engine serd.memory.generic-sparc.membuf-crc@MEM_BUFF, N=120, T=30min;
109engine serd.memory.generic-sparc.membuf-crc@MEM_CTRL, N=120, T=30min;
110
111
112event fault.memory.memlink@CHIP,
113    engine=serd.memory.generic-sparc.membuf-crc@CHIP;
114event fault.memory.memlink@MEM_BUFF,
115    engine=serd.memory.generic-sparc.membuf-crc@MEM_BUFF;
116event fault.memory.memlink@MEM_CTRL,
117    engine=serd.memory.generic-sparc.membuf-crc@MEM_CTRL;
118
119/*
120 * 1. if ereport has both sender & detector: membuf-crc errors will fault
121 * both detector & sender.
122 * - if detector is chip or memory-controller, the sender is memory-buffer.
123 * - if detector is memory-buffer, the sender is chip or memory-controller
124 * 2. if ereport does not have sender:
125 * - if detector is chip, sender is memory-buffer
126 * - if detector is memory-controller, sender is memory-buffer
127 * - if detector is memory-buffer:
128 *	+ if topology is chip/memory-buffer, sender is chip
129 *	+ if topology is memory-controller/memory-buffer, sender is
130 *	memory-controller.
131 */
132
133#define	HAS_SENDER	(payloadprop_defined("sender"))
134
135event ereport.cpu.generic-sparc.membuf-crc@CHIP { within(1s) };
136event ereport.cpu.generic-sparc.membuf-crc@MEM_BUFF { within(1s) };
137event ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL { within(1s) };
138
139/*
140 * detector is chip and ereport has a sender
141 */
142prop fault.memory.memlink@CHIP
143    { DIAGNOSE_ERPT && SET_SERDN && SET_SERDT && SET_RATIO } (0) ->
144    ereport.cpu.generic-sparc.membuf-crc@CHIP;
145
146prop fault.memory.memlink@MEM_BUFF
147    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF && SET_SERDN &&
148    SET_SERDT && SET_RATIO } (0)->
149    ereport.cpu.generic-sparc.membuf-crc@CHIP<>;
150
151/*
152 * detector is chip and ereport does not have sender
153 */
154engine serd.memory.generic-sparc.membuf-crc@CHIP/MEM_BUFF, N=120, T=30min;
155event fault.memory.memlink@CHIP/MEM_BUFF,
156    engine=serd.memory.generic-sparc.membuf-crc@CHIP/MEM_BUFF;
157
158prop fault.memory.memlink@CHIP/MEM_BUFF
159    { DIAGNOSE_ERPT && !HAS_SENDER &&
160    SET_SERDN && SET_SERDT && SET_RATIO } (0)->
161    ereport.cpu.generic-sparc.membuf-crc@CHIP;
162
163event upset.memory.memlink@CHIP;
164
165prop upset.memory.memlink@CHIP
166    { !DIAGNOSE_ERPT } (0)->
167    ereport.cpu.generic-sparc.membuf-crc@CHIP;
168
169/*
170 * detector is memory-buffer and ereport has sender
171 */
172prop fault.memory.memlink@MEM_BUFF
173    { DIAGNOSE_ERPT && SET_SERDN && SET_SERDT && SET_RATIO } (0) ->
174    ereport.cpu.generic-sparc.membuf-crc@MEM_BUFF;
175
176prop fault.memory.memlink@CHIP
177    { DIAGNOSE_ERPT && CONTAINS_CHIP && SET_SERDN &&
178    SET_SERDT && SET_RATIO } (0) ->
179    ereport.cpu.generic-sparc.membuf-crc@MEM_BUFF<>;
180
181prop fault.memory.memlink@MEM_CTRL
182    { DIAGNOSE_ERPT && CONTAINS_MEMCTRL && SET_SERDN &&
183    SET_SERDT && SET_RATIO } (0)->
184    ereport.cpu.generic-sparc.membuf-crc@MEM_BUFF<>;
185
186/*
187 * detector is memory-buffer and ereport does not have sender
188 */
189event ereport.cpu.generic-sparc.membuf-crc@CHIP/MEM_BUFF { within(1s) };
190event ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL/MEM_BUFF { within(1s) };
191
192prop fault.memory.memlink@CHIP
193    { DIAGNOSE_ERPT && !HAS_SENDER &&
194    SET_SERDN && SET_SERDT && SET_RATIO } (0) ->
195    ereport.cpu.generic-sparc.membuf-crc@CHIP/MEM_BUFF<>;
196
197prop fault.memory.memlink@MEM_CTRL
198    { DIAGNOSE_ERPT && !HAS_SENDER &&
199    SET_SERDN && SET_SERDT && SET_RATIO } (0) ->
200    ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL/MEM_BUFF<>;
201
202event upset.memory.memlink@MEM_BUFF;
203
204prop upset.memory.memlink@MEM_BUFF
205    { !DIAGNOSE_ERPT } (0)->
206    ereport.cpu.generic-sparc.membuf-crc@MEM_BUFF;
207
208/*
209 * detector is memory-controller and ereport has a sender
210 */
211prop fault.memory.memlink@MEM_CTRL
212    { DIAGNOSE_ERPT && SET_SERDN && SET_SERDT && SET_RATIO } (0)->
213    ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL;
214
215prop fault.memory.memlink@MEM_BUFF
216    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF && SET_SERDN &&
217    SET_SERDT && SET_RATIO } (0)->
218    ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL<>;
219
220/*
221 * detector is memory-controller and ereport does not have a sender
222 */
223engine serd.cpu.generic-sparc.membuf-crc@MEM_CTRL/MEM_BUFF, N=120, T=30min;
224event fault.memory.memlink@MEM_CTRL/MEM_BUFF,
225    engine=serd.cpu.generic-sparc.membuf-crc@MEM_CTRL/MEM_BUFF;
226
227prop fault.memory.memlink@MEM_CTRL/MEM_BUFF
228    { DIAGNOSE_ERPT && !HAS_SENDER &&
229    SET_SERDN && SET_SERDT && SET_RATIO } (0)->
230    ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL;
231
232event upset.memory.memlink@MEM_CTRL;
233
234prop upset.memory.memlink@MEM_CTRL
235    { !DIAGNOSE_ERPT } (0)->
236    ereport.cpu.generic-sparc.membuf-crc@MEM_CTRL;
237
238/*
239 * membuf-crc-uc, membuf-other-uc will fault the detector FRU and sender FRU
240 * if detector is CHIP or MEM_CTRL, the sender is MEM_BUFF.
241 * if detector is MEM_BUFF, the sender is CHIP or MEM_CTRL
242 */
243event ereport.cpu.generic-sparc.membuf-crc-uc@CHIP { within(1s) };
244event ereport.cpu.generic-sparc.membuf-crc-uc@MEM_BUFF { within(1s) };
245event ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL { within(1s) };
246
247event ereport.cpu.generic-sparc.membuf-other-uc@CHIP { within(1s) };
248event ereport.cpu.generic-sparc.membuf-other-uc@MEM_BUFF { within(1s) };
249event ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL { within(1s) };
250
251event fault.memory.memlink-uc@CHIP;
252event fault.memory.memlink-uc@MEM_BUFF;
253event fault.memory.memlink-uc@MEM_CTRL;
254
255/*
256 * chip is detector and ereport has a sender
257 */
258prop fault.memory.memlink-uc@CHIP
259    { DIAGNOSE_ERPT } (0) ->
260    ereport.cpu.generic-sparc.membuf-crc-uc@CHIP,
261    ereport.cpu.generic-sparc.membuf-other-uc@CHIP;
262
263prop fault.memory.memlink-uc@MEM_BUFF
264    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF } (0) ->
265    ereport.cpu.generic-sparc.membuf-crc-uc@CHIP<>,
266    ereport.cpu.generic-sparc.membuf-other-uc@CHIP<>;
267
268/*
269 * chip is detector and ereport does not have a sender
270 */
271event fault.memory.memlink-uc@CHIP/MEM_BUFF;
272
273prop fault.memory.memlink-uc@CHIP/MEM_BUFF
274    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
275    ereport.cpu.generic-sparc.membuf-crc-uc@CHIP,
276    ereport.cpu.generic-sparc.membuf-other-uc@CHIP;
277
278event upset.memory.memlink-uc@CHIP;
279
280prop upset.memory.memlink-uc@CHIP
281    { !DIAGNOSE_ERPT } (0)->
282    ereport.cpu.generic-sparc.membuf-crc-uc@CHIP,
283    ereport.cpu.generic-sparc.membuf-other-uc@CHIP;
284
285/*
286 * memory-buffer is detector and ereport has a sender
287 */
288prop fault.memory.memlink-uc@MEM_BUFF
289    { DIAGNOSE_ERPT } (0) ->
290    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_BUFF,
291    ereport.cpu.generic-sparc.membuf-other-uc@MEM_BUFF;
292
293prop fault.memory.memlink-uc@CHIP
294    { DIAGNOSE_ERPT && CONTAINS_CHIP } (0) ->
295    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_BUFF<>,
296    ereport.cpu.generic-sparc.membuf-other-uc@MEM_BUFF<>;
297
298prop fault.memory.memlink-uc@MEM_CTRL
299    { DIAGNOSE_ERPT && CONTAINS_MEMCTRL } (0) ->
300    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_BUFF<>,
301    ereport.cpu.generic-sparc.membuf-other-uc@MEM_BUFF<>;
302
303/*
304 * memory-buffer is detector and ereport does not have sender
305 */
306event ereport.cpu.generic-sparc.membuf-crc-uc@CHIP/MEM_BUFF { within(1s) };
307event ereport.cpu.generic-sparc.membuf-other-uc@CHIP/MEM_BUFF { within(1s) };
308event ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL/MEM_BUFF { within(1s) };
309event ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL/MEM_BUFF
310    { within(1s) };
311
312prop fault.memory.memlink-uc@CHIP
313    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
314    ereport.cpu.generic-sparc.membuf-crc-uc@CHIP/MEM_BUFF<>,
315    ereport.cpu.generic-sparc.membuf-other-uc@CHIP/MEM_BUFF<>;
316
317prop fault.memory.memlink-uc@MEM_CTRL
318    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
319    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL/MEM_BUFF<>,
320    ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL/MEM_BUFF<>;
321
322event upset.memory.memlink-uc@MEM_BUFF;
323
324prop upset.memory.memlink-uc@MEM_BUFF
325    { !DIAGNOSE_ERPT } (0)->
326    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_BUFF,
327    ereport.cpu.generic-sparc.membuf-other-uc@MEM_BUFF;
328
329/*
330 * memory-controller is detector and ereport has a sender
331 */
332prop fault.memory.memlink-uc@MEM_CTRL
333    { DIAGNOSE_ERPT } (0) ->
334    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL,
335    ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL;
336
337prop fault.memory.memlink-uc@MEM_BUFF
338    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF } (0) ->
339    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL<>,
340    ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL<>;
341
342/*
343 * memory-controller is detector and ereport does not have sender
344 */
345event fault.memory.memlink-uc@MEM_CTRL/MEM_BUFF;
346
347prop fault.memory.memlink-uc@MEM_CTRL/MEM_BUFF
348    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
349    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL,
350    ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL;
351
352event upset.memory.memlink-uc@MEM_CTRL;
353
354prop upset.memory.memlink-uc@MEM_CTRL
355    { !DIAGNOSE_ERPT } (0)->
356    ereport.cpu.generic-sparc.membuf-crc-uc@MEM_CTRL,
357    ereport.cpu.generic-sparc.membuf-other-uc@MEM_CTRL;
358
359/*
360 * membuf-crc-failover will fault the detector FRU and sender FRU
361 * if detector is chip or memory-controller, the sender is memory-buffer.
362 * if detector is memory-buffer, the sender is chip or memory-controller
363 */
364event ereport.cpu.generic-sparc.membuf-crc-failover@CHIP { within(1s) };
365event ereport.cpu.generic-sparc.membuf-crc-failover@MEM_BUFF
366    { within(1s) };
367event ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL
368    { within(1s) };
369
370event fault.memory.memlink-failover@CHIP;
371event fault.memory.memlink-failover@MEM_BUFF;
372event fault.memory.memlink-failover@MEM_CTRL;
373
374/*
375 * chip is detector and ereport has a sender
376 */
377prop fault.memory.memlink-failover@CHIP
378    { DIAGNOSE_ERPT } (0) ->
379    ereport.cpu.generic-sparc.membuf-crc-failover@CHIP;
380
381prop fault.memory.memlink-failover@MEM_BUFF
382    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF } (0) ->
383    ereport.cpu.generic-sparc.membuf-crc-failover@CHIP<>;
384
385/*
386 * chip is detector and ereport does not have sender
387 */
388event fault.memory.memlink-failover@CHIP/MEM_BUFF;
389
390prop fault.memory.memlink-failover@CHIP/MEM_BUFF
391    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
392    ereport.cpu.generic-sparc.membuf-crc-failover@CHIP;
393
394event upset.memory.memlink-failover@CHIP;
395
396prop upset.memory.memlink-failover@CHIP
397    { !DIAGNOSE_ERPT } (0)->
398    ereport.cpu.generic-sparc.membuf-crc-failover@CHIP;
399/*
400 * memory-buffer is detector and ereport has a sender
401 */
402prop fault.memory.memlink-failover@MEM_BUFF
403    { DIAGNOSE_ERPT } (0) ->
404    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_BUFF;
405
406prop fault.memory.memlink-failover@CHIP
407    { DIAGNOSE_ERPT && CONTAINS_CHIP } (0) ->
408    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_BUFF<>;
409
410prop fault.memory.memlink-failover@MEM_CTRL
411    { DIAGNOSE_ERPT && CONTAINS_MEMCTRL } (0) ->
412    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_BUFF<>;
413
414/*
415 * memory-buffer is detector and ereport does not have sender
416 */
417event ereport.cpu.generic-sparc.membuf-crc-failover@CHIP/MEM_BUFF
418    { within(1s) };
419event ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL/MEM_BUFF
420    { within(1s) };
421
422prop fault.memory.memlink-failover@CHIP
423    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
424    ereport.cpu.generic-sparc.membuf-crc-failover@CHIP/MEM_BUFF<>;
425
426prop fault.memory.memlink-failover@MEM_CTRL
427    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
428    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL/MEM_BUFF<>;
429
430event upset.memory.memlink-failover@MEM_BUFF;
431
432prop upset.memory.memlink-failover@MEM_BUFF
433    { !DIAGNOSE_ERPT } (0)->
434    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_BUFF;
435/*
436 * memory-controller is detector and ereport has a sender
437 */
438prop fault.memory.memlink-failover@MEM_CTRL
439    { DIAGNOSE_ERPT } (0) ->
440    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL;
441
442prop fault.memory.memlink-failover@MEM_BUFF
443    { DIAGNOSE_ERPT && CONTAINS_MEMBUFF } (0) ->
444    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL<>;
445
446/*
447 * memory-controller is detector and ereport does not have sender
448 */
449event fault.memory.memlink-failover@MEM_CTRL/MEM_BUFF;
450
451prop fault.memory.memlink-failover@MEM_CTRL/MEM_BUFF
452    { DIAGNOSE_ERPT && !HAS_SENDER } (0) ->
453    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL;
454
455event upset.memory.memlink-failover@MEM_CTRL;
456
457prop upset.memory.memlink-failover@MEM_CTRL
458    { !DIAGNOSE_ERPT } (0)->
459    ereport.cpu.generic-sparc.membuf-crc-failover@MEM_CTRL;
460/*
461 * ignore the membuf-other errors
462 */
463event ereport.cpu.generic-sparc.membuf-other@CHIP;
464event ereport.cpu.generic-sparc.membuf-other@MEM_BUFF;
465event ereport.cpu.generic-sparc.membuf-other@MEM_CTRL;
466
467event upset.memory.discard@CHIP;
468event upset.memory.discard@MEM_BUFF;
469event upset.memory.discard@MEM_CTRL;
470
471prop upset.memory.discard@CHIP (1)->
472    ereport.cpu.generic-sparc.membuf-other@CHIP;
473
474prop upset.memory.discard@MEM_BUFF (1)->
475    ereport.cpu.generic-sparc.membuf-other@MEM_BUFF;
476
477prop upset.memory.discard@MEM_CTRL (1)->
478    ereport.cpu.generic-sparc.membuf-other@MEM_CTRL;
479