xref: /titanic_51/usr/src/cmd/fm/modules/common/cpumem-retire/cma.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _CMA_H
28 #define	_CMA_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <fm/fmd_api.h>
33 
34 #include <sys/types.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 typedef struct cma_page {
41 	struct cma_page *pg_next;	/* List of page retirements for retry */
42 	nvlist_t *pg_fmri;		/* FMRI for this page */
43 	uint64_t pg_addr;		/* Address of this page */
44 	char *pg_uuid;			/* UUID for this page's case */
45 	uint_t pg_nretries;		/* Number of retries so far for page */
46 } cma_page_t;
47 
48 typedef struct cma {
49 	struct timespec cma_cpu_delay;	/* CPU offline retry interval */
50 	uint_t cma_cpu_tries;		/* Number of CPU offline retries */
51 	uint_t cma_cpu_dooffline;	/* Whether to offline CPUs */
52 	uint_t cma_cpu_forcedoffline;	/* Whether to do forced CPU offline */
53 	uint_t cma_cpu_doblacklist;	/* Whether to blacklist CPUs */
54 	cma_page_t *cma_pages;		/* List of page retirements for retry */
55 	hrtime_t cma_page_curdelay;	/* Current retry sleep interval */
56 	hrtime_t cma_page_mindelay;	/* Minimum retry sleep interval */
57 	hrtime_t cma_page_maxdelay;	/* Maximum retry sleep interval */
58 	id_t cma_page_timerid;		/* fmd timer ID for retry sleep */
59 	uint_t cma_page_doretire;	/* Whether to retire pages */
60 } cma_t;
61 
62 typedef struct cma_stats {
63 	fmd_stat_t cpu_flts;		/* Successful offlines */
64 	fmd_stat_t cpu_fails;		/* Failed offlines */
65 	fmd_stat_t cpu_blfails;		/* Failed blacklists */
66 	fmd_stat_t cpu_supp;		/* Suppressed offlines */
67 	fmd_stat_t cpu_blsupp;		/* Suppressed blacklists */
68 	fmd_stat_t page_flts;		/* Successful page retires */
69 	fmd_stat_t page_fails;		/* Failed page retires */
70 	fmd_stat_t page_supp;		/* Suppressed retires */
71 	fmd_stat_t page_nonent;		/* Retires for non-present pages */
72 	fmd_stat_t bad_flts;		/* Malformed faults */
73 	fmd_stat_t nop_flts;		/* Inapplicable faults */
74 	fmd_stat_t auto_flts;		/* Auto-close faults */
75 } cma_stats_t;
76 
77 extern cma_stats_t cma_stats;
78 extern cma_t cma;
79 
80 extern void cma_cpu_retire(fmd_hdl_t *, nvlist_t *, nvlist_t *, const char *);
81 
82 extern void cma_page_retire(fmd_hdl_t *, nvlist_t *, nvlist_t *, const char *);
83 extern void cma_page_retry(fmd_hdl_t *);
84 extern void cma_page_fini(fmd_hdl_t *);
85 
86 extern int cma_set_errno(int);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif /* _CMA_H */
93