xref: /titanic_52/usr/src/cmd/fm/modules/sun4v/generic-mem/gmem.h (revision 587644a8567e6a9533f88401daa59cbd78c4632f)
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_H
26 #define	_GMEM_H
27 
28 #include <stdarg.h>
29 #include <fm/fmd_api.h>
30 #include <sys/param.h>
31 
32 #include <gmem_util.h>
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #define	GMEM_STAT_BUMP(name)	gmem.gm_stats->name.fmds_value.ui64++
39 #define	GMEM_FLTMAXCONF	95
40 
41 typedef struct gmem_stat {
42 	fmd_stat_t bad_mem_resource;	/* # of malformed hc-scheme resource */
43 	fmd_stat_t bad_close;		/* # of inapplicable case closes */
44 	fmd_stat_t old_erpt;		/* # of erpts for removed components */
45 	fmd_stat_t dimm_creat;		/* # of DIMM state structs created */
46 	fmd_stat_t page_creat;		/* # of page state structs created */
47 	fmd_stat_t ce_unknown;		/* # of unknown CEs seen */
48 	fmd_stat_t ce_interm;		/* # of intermittent CEs seen */
49 	fmd_stat_t ce_clearable_persis;	/* # of clearable persistent CEs seen */
50 	fmd_stat_t ce_sticky;		/* # of sticky CEs seen */
51 	fmd_stat_t dimm_migrat;		/* # of DIMMs migrated to new version */
52 } gmem_stat_t;
53 
54 typedef struct gmem_serd {
55 	const char *cs_name;
56 	uint_t cs_n;
57 	hrtime_t cs_t;
58 } gmem_serd_t;
59 
60 typedef struct gmem {
61 	gmem_list_t gm_dimms;		/* List of DIMM state structures */
62 	gmem_list_t gm_pages;		/* List of page state structures */
63 	gmem_stat_t *gm_stats;		/* Module statistics */
64 	size_t gm_pagesize;		/* Page size, in bytes */
65 	uint64_t gm_pagemask;		/* Mask for page alignments */
66 	uint32_t gm_max_retired_pages;  /* max num retired pages */
67 	uint32_t gm_ce_n;		/* serd n */
68 	uint64_t gm_ce_t;		/* serd t */
69 	uint32_t gm_filter_ratio;	/* serd filter ratio */
70 	uint32_t gm_low_ce_thresh;	/* low threshold retired pages */
71 	uint32_t gm_nupos;		/* same number of upos */
72 	uint32_t gm_dupce;		/* number of dup CEs */
73 } gmem_t;
74 
75 extern gmem_t gmem;
76 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* _GMEM_H */
82