xref: /illumos-gate/usr/src/uts/sun4u/sys/ecc_kstat.h (revision 7c478bd9)
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 (c) 2001 by Sun Microsystems, Inc.
25  * All rights reserved.
26  */
27 
28 #ifndef	_SYS_ECC_KSTAT_H
29 #define	_SYS_ECC_KSTAT_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #ifdef	__cplusplus
34 extern "C" {
35 #endif
36 
37 #define	KSTAT_CE_UNUM_NAMLEN 60
38 
39 /*
40  * Using these stats are not reset to zero during system operation.
41  * To determine the number of errors between times "A" and "B" a program
42  * would have to snapshot the kstats and subtract the counts at time "A"
43  * from the counts at time "B".
44  */
45 
46 /*
47  * Legacy raw kstat: unix:0:ecc-mm-info
48  */
49 struct kstat_ecc_mm_info_1 {
50 	struct kstat_ecc_mm {
51 		char name[KSTAT_CE_UNUM_NAMLEN];
52 		uint64_t intermittent_total;
53 		uint64_t persistent_total;
54 		uint64_t sticky_total;
55 	} ecc_mm[1];    /* variable-length array */
56 };
57 
58 /*
59  * Named kstat: mm:(instance):ecc-info
60  */
61 struct kstat_ecc_mm_info_2 {
62 	struct kstat_named name;
63 	struct kstat_named intermittent_total;
64 	struct kstat_named persistent_total;
65 	struct kstat_named sticky_total;
66 };
67 
68 #define	kstat_ecc_mm_info	kstat_ecc_mm_info_2
69 #define	KSTAT_CE_INFO_VER_1	1
70 #define	KSTAT_CE_INFO_VER_2	2
71 #define	KSTAT_CE_INFO_VER	KSTAT_CE_INFO_VER_2
72 
73 /*
74  * Clients of this kstat will have to check the version and maintain
75  * compatibility code to handle the previous versions.
76  *
77  * named kstat: unix:0:ecc-info:version
78  *	- the version of the kstats implemented by the running kernel
79  *
80  * named kstat: unix:0:ecc-info:count
81  *	- the current count of valid mm:ecc-info kstats
82  *
83  * named kstat: unix:0:ecc-info:maxcount
84  *	- the maximum number of mm:ecc-info kstats
85  */
86 struct ecc_error_info {
87 	struct kstat_named version;
88 	struct kstat_named maxcount;
89 	struct kstat_named count;
90 };
91 
92 #ifdef	__cplusplus
93 }
94 #endif
95 
96 #endif	/* _SYS_ECC_KSTAT_H */
97