xref: /titanic_50/usr/src/cmd/fm/modules/common/cpumem-retire/cma.h (revision 03831d35f7499c87d51205817c93e9a8d42c4bae)
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 2006 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 	uint_t cma_page_maxretries;	/* Maximum retry on page retires */
61 } cma_t;
62 
63 typedef struct cma_stats {
64 	fmd_stat_t cpu_flts;		/* Successful offlines */
65 	fmd_stat_t cpu_fails;		/* Failed offlines */
66 	fmd_stat_t cpu_blfails;		/* Failed blacklists */
67 	fmd_stat_t cpu_supp;		/* Suppressed offlines */
68 	fmd_stat_t cpu_blsupp;		/* Suppressed blacklists */
69 	fmd_stat_t page_flts;		/* Successful page retires */
70 	fmd_stat_t page_fails;		/* Failed page retires */
71 	fmd_stat_t page_supp;		/* Suppressed retires */
72 	fmd_stat_t page_nonent;		/* Retires for non-present pages */
73 	fmd_stat_t page_retmax;		/* Retires for page reached max */
74 	fmd_stat_t bad_flts;		/* Malformed faults */
75 	fmd_stat_t nop_flts;		/* Inapplicable faults */
76 	fmd_stat_t auto_flts;		/* Auto-close faults */
77 } cma_stats_t;
78 
79 extern cma_stats_t cma_stats;
80 extern cma_t cma;
81 
82 extern void cma_cpu_retire(fmd_hdl_t *, nvlist_t *, nvlist_t *, const char *);
83 
84 extern void cma_page_retire(fmd_hdl_t *, nvlist_t *, nvlist_t *, const char *);
85 extern void cma_page_retry(fmd_hdl_t *);
86 extern void cma_page_fini(fmd_hdl_t *);
87 
88 extern int cma_set_errno(int);
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* _CMA_H */
95