xref: /titanic_41/usr/src/cmd/fm/modules/sun4v/generic-mem/gmem_mem.h (revision d4ac42a1cd3016618a9ba0330862d410f0058f89)
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  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
23  */
24 
25 #ifndef _GMEM_MEM_H
26 #define	_GMEM_MEM_H
27 
28 /*
29  * Support routines for managing state related to memory modules.
30  * Correctable errors generally cause changes to the DIMM-related state.
31  */
32 
33 #include <gmem.h>
34 #include <gmem_page.h>
35 #include <gmem_state.h>
36 #include <gmem_fmri.h>
37 #include <sys/errclassify.h>
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 #define	GMEM_ERPT_PAYLOAD_DIAGNOSE	"diagnose"
44 #define	GMEM_ERPT_PAYLOAD_RESOURCE	"resource"
45 #define	GMEM_ERPT_PAYLOAD_DETECTOR	"detector"
46 #define	GMEM_ERPT_PAYLOAD_PHYSADDR	"phys-addr"
47 #define	GMEM_ERPT_PAYLOAD_OFFSET	"offset"
48 #define	GMEM_ERPT_PAYLOAD_SERDN		"serd_n"
49 #define	GMEM_ERPT_PAYLOAD_SERDT		"serd_t"
50 #define	GMEM_ERPT_PAYLOAD_SYMBOLPOS	"symbol-pos"
51 #define	GMEM_ERPT_PAYLOAD_DRAM		"dram"
52 #define	GMEM_ERPT_PAYLOAD_FILTER_RATIO	"filter_ratio"
53 #define	GMEM_ERPT_PAYLOAD_CKW		"relative-ckword"
54 
55 #define	GMEM_F_FAULTING	0x1
56 #define	GMEM_FAULT_DIMM_PAGES	"fault.memory.dimm-page-retires-excessive"
57 #define	GMEM_FAULT_DIMM_4A	"fault.memory.dimm-ue-imminent"
58 #define	GMEM_FAULT_DIMM_4B	"fault.memory.dram-ue-imminent"
59 #define	GMEM_FAULT_PAGE		"fault.memory.page"
60 #define	INVALID_DRAM		-1
61 
62 #define	DEFAULT_SERDN	0x2
63 #define	DEFAULT_SERDT	0xebbdb3ed0000ULL
64 
65 typedef struct gmem_dimm gmem_dimm_t;
66 
67 /*
68  * Correctable memory errors
69  * "unknown symbol" (mem-us) and "intermittent symbol" (mem-is) CEs are
70  * not used in diagnosis, except for rules 4A & 4B checking.
71  *
72  * "clearable symbol" (mem-cs) CEs are added to the SERD engines. When the
73  * engine the page corresponding to the CE that caused the engine to
74  * fire is retired
75  *
76  * "sticky symbol" (mem-ss) CEs trigger immediate page retirement.
77  *
78  */
79 
80 extern gmem_evdisp_t gmem_ce(fmd_hdl_t *, fmd_event_t *, nvlist_t *,
81     const char *);
82 extern void gmem_dimm_close(fmd_hdl_t *, void *);
83 
84 extern void gmem_mem_case_restore(fmd_hdl_t *, gmem_case_t *, fmd_case_t *,
85     const char *, const char *);
86 extern char *gmem_mem_serdnm_create(fmd_hdl_t *, const char *, const char *);
87 extern char *gmem_page_serdnm_create(fmd_hdl_t *, const char *, uint64_t);
88 extern char *gmem_mq_serdnm_create(fmd_hdl_t *, const char *, uint64_t,
89     uint16_t, uint16_t);
90 extern void gmem_page_serd_create(fmd_hdl_t *, gmem_page_t *, nvlist_t *);
91 extern uint32_t gmem_get_serd_filter_ratio(nvlist_t *);
92 extern int gmem_serd_record(fmd_hdl_t *, const char *, uint32_t, fmd_event_t *);
93 extern void gmem_mem_retirestat_create(fmd_hdl_t *, fmd_stat_t *, const char *,
94     uint64_t, const char *);
95 
96 extern void gmem_mem_gc(fmd_hdl_t *);
97 extern void gmem_mem_fini(fmd_hdl_t *);
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _GMEM_MEM_H */
104