8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / cmd / fm / modules / sun4v / generic-mem / gmem_dimm.h
blob972b78834536120713bff8186cc2c8e2c6e1aeb2
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
25 #ifndef _GMEM_DIMM_H
26 #define _GMEM_DIMM_H
30 * Memory modules are described by the gmem_dimm general-purpose state
31 * structure.
33 * Data structure P? Case? Notes
34 * ---------------- --- ----- ----------------------------------------------
35 * gmem_dimm_t Yes No Name is derived from the serial ("dimm_%s")
36 * gmem_case_ptr_t Yes Yes Name is case's UUID
37 * dimm_asru Yes No Name is derived from the serial
38 * ("dimm_asru_%s")
39 * dimm_serial No No Pointer into ASRU - relinked during restore
42 #include <gmem_mem.h>
43 #include <values.h>
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
50 * GMEM_MAX_CKWDS denotes the highest number, across all covered
51 * SPARC architectures, of checkwords per cache line.
54 #define GMEM_MAX_CKWDS 8
55 #define FINDRSC 0
56 #define FINDFRU 1
57 #define FINDASRU 2
59 #define DIMM_MKVERSION(version) (version)
61 #define GMEM_DIMM_VERSION_0 DIMM_MKVERSION(0)
62 #define GMEM_DIMM_VERSION_1 DIMM_MKVERSION(1)
63 #define GMEM_DIMM_VERSION GMEM_DIMM_VERSION_1
65 #define GMEM_DIMM_VERSIONED(dimm) ((dimm)->dimm_version)
67 #define GMEM_DIMM_STAT_PREFIX "DIMM_"
69 typedef struct gmem_dimm_0 {
70 gmem_header_t dimm0_header; /* Nodetype must be GMEM_NT_DIMM */
71 uint_t dimm0_version; /* DIMM version */
72 gmem_fmri_t dimm0_asru; /* ASRU for this DIMM */
73 uint_t dimm0_flags; /* GMEM_MEM_F_* */
74 uint_t dimm0_nretired; /* # ret'd pages for CEs in DIMM */
75 } gmem_dimm_0_t;
77 typedef struct gmem_dimm_pers {
78 gmem_header_t dimmp_header; /* Nodetype must be GMEM_NT_DIMM */
79 uint_t dimmp_version;
80 gmem_fmri_t dimmp_asru; /* ASRU for this DIMM */
81 uint_t dimmp_flags; /* GMEM_MEM_F_* */
82 uint_t dimmp_nretired; /* # ret'd pages for CEs in DIMM */
83 uint64_t dimmp_phys_addr_hi; /* retired page addr high */
84 uint64_t dimmp_phys_addr_low; /* retired page addr low */
85 } gmem_dimm_pers_t;
88 * Index block for MQSC rules 4A and 4B correlation of memory CEs
89 * on a single DIMM. "Unit Position" refers to bit or nibble depending
90 * on the memory ECC. This structure is not persisted.
93 typedef struct gmem_mq {
94 gmem_list_t mq_l; /* pointers to prev and next */
95 uint64_t mq_tstamp; /* timestamp of ereport in secs */
96 uint16_t mq_ckwd; /* phys addr mod 64 */
97 uint64_t mq_phys_addr; /* from ereport */
98 uint16_t mq_unit_position; /* bit for sun4u, nibble for sun4v */
99 fmd_event_t *mq_ep; /* ereport - for potential fault */
100 char *mq_serdnm; /* serd eng to retain CE events */
101 uint16_t mq_dupce_count; /* count dup CEs */
102 gmem_list_t mq_dupce_tstamp; /* list dup CE time stamp */
103 } gmem_mq_t;
105 typedef struct tstamp {
106 gmem_list_t ts_l;
107 uint64_t tstamp;
108 } tstamp_t;
110 struct gmem_dimm {
111 gmem_dimm_pers_t dimm_pers;
112 char *dimm_serial; /* Dimm serial number */
113 gmem_case_t dimm_case; /* Open CE case against this DIMM */
114 fmd_stat_t dimm_retstat; /* retirement statistics, this DIMM */
115 uint16_t dimm_syl_error; /* bad rw symbol-in-error */
116 uint32_t dimm_chipid; /* detector */
117 gmem_list_t
118 mq_root[GMEM_MAX_CKWDS]; /* per-checkword CEs to correlate */
121 #define GMEM_MQ_TIMELIM (72*60*60) /* 72 hours */
122 #define GMEM_MQ_SERDT MAXINT /* Never expected to fire */
123 #define GMEM_MQ_SERDN 2 /* Dup CEs not allowed */
124 #define GMEM_MQ_512KB 0x80000 /* space between hi-low addr */
125 #define GMEM_MQ_RATIO 0.0625 /* bad r/w page ratio (1/16) */
128 #define GMEM_DIMM_MAXSIZE MAX(sizeof (gmem_dimm_0_t), sizeof (gmem_dimm_pers_t))
129 #define GMEM_DIMM_MINSIZE MIN(sizeof (gmem_dimm_0_t), sizeof (gmem_dimm_pers_t))
131 #define dimm_header dimm_pers.dimmp_header
132 #define dimm_nodetype dimm_pers.dimmp_header.hdr_nodetype
133 #define dimm_bufname dimm_pers.dimmp_header.hdr_bufname
134 #define dimm_version dimm_pers.dimmp_version
135 #define dimm_asru dimm_pers.dimmp_asru
136 #define dimm_asru_nvl dimm_pers.dimmp_asru.fmri_nvl
137 #define dimm_flags dimm_pers.dimmp_flags
138 #define dimm_nretired dimm_pers.dimmp_nretired
139 #define dimm_phys_addr_hi dimm_pers.dimmp_phys_addr_hi
140 #define dimm_phys_addr_low dimm_pers.dimmp_phys_addr_low
142 extern gmem_dimm_t *gmem_dimm_lookup(fmd_hdl_t *, nvlist_t *);
143 extern gmem_dimm_t *gmem_dimm_create(fmd_hdl_t *, nvlist_t *, nvlist_t *);
144 extern nvlist_t *gmem_dimm_fru(gmem_dimm_t *);
145 extern int gmem_dimm_thresh_reached(fmd_hdl_t *, gmem_dimm_t *, uint64_t,
146 uint16_t);
147 extern nvlist_t *gmem_find_dimm_fru(fmd_hdl_t *, char *);
148 extern nvlist_t *gmem_find_dimm_rsc(fmd_hdl_t *, char *);
149 extern nvlist_t *gmem_find_dimm_asru(fmd_hdl_t *, char *);
150 extern int gmem_dimm_present(fmd_hdl_t *, nvlist_t *asru);
151 extern void gmem_dimm_dirty(fmd_hdl_t *, gmem_dimm_t *);
152 extern void *gmem_dimm_restore(fmd_hdl_t *, fmd_case_t *, gmem_case_ptr_t *);
153 extern void gmem_dimm_destroy(fmd_hdl_t *, gmem_dimm_t *);
154 extern void gmem_dimm_validate(fmd_hdl_t *);
155 extern void gmem_dimm_gc(fmd_hdl_t *);
156 extern void gmem_dimm_fini(fmd_hdl_t *);
157 extern int gmem_same_datapath_dimms(fmd_hdl_t *, gmem_dimm_t *, gmem_dimm_t *);
158 extern int gmem_check_symbol_error(fmd_hdl_t *, gmem_dimm_t *, uint16_t);
159 extern void gmem_save_symbol_error(fmd_hdl_t *, gmem_dimm_t *, uint16_t);
161 #ifdef __cplusplus
163 #endif
165 #endif /* _GMEM_DIMM_H */