xref: /titanic_44/usr/src/uts/i86pc/sys/cpu_module_ms.h (revision 3f7d54a6b84904c8f4d8daa4c7b577bede7df8b9)
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 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_CPU_MODULE_MS_H
28 #define	_CPU_MODULE_MS_H
29 
30 #include <sys/types.h>
31 #include <sys/cpuvar.h>
32 #include <sys/nvpair.h>
33 #include <sys/cpu_module.h>
34 
35 #ifdef  __cplusplus
36 extern "C" {
37 #endif
38 
39 #ifdef _KERNEL
40 
41 #define	CMSERR_BASE 0xe000
42 
43 typedef enum cms_errno {
44 	CMS_SUCCESS = 0,
45 	CMSERR_UNKNOWN = CMSERR_BASE,	/* No specific error reason given */
46 	CMSERR_NOTSUP,			/* Unsupported operation */
47 	CMSERR_BADMSRWRITE		/* Error on wrmsr */
48 
49 } cms_errno_t;
50 
51 extern void cms_init(cmi_hdl_t);
52 extern boolean_t cms_present(cmi_hdl_t);
53 extern void *cms_hdl_getcmsdata(cmi_hdl_t);
54 extern void cms_post_startup(cmi_hdl_t);
55 extern void cms_post_mpstartup(cmi_hdl_t);
56 
57 extern size_t cms_logout_size(cmi_hdl_t);
58 
59 extern uint64_t cms_mcgctl_val(cmi_hdl_t, int, uint64_t);
60 
61 extern boolean_t cms_bankctl_skipinit(cmi_hdl_t, int);
62 extern uint64_t cms_bankctl_val(cmi_hdl_t, int, uint64_t);
63 extern boolean_t cms_bankstatus_skipinit(cmi_hdl_t, int);
64 extern uint64_t cms_bankstatus_val(cmi_hdl_t, int, uint64_t);
65 
66 extern void cms_mca_init(cmi_hdl_t, int);
67 
68 extern uint64_t cms_poll_ownermask(cmi_hdl_t, hrtime_t);
69 
70 extern void cms_bank_logout(cmi_hdl_t, int, uint64_t, uint64_t, uint64_t,
71     void *);
72 
73 extern cms_errno_t cms_msrinject(cmi_hdl_t, uint_t, uint64_t);
74 
75 extern void cms_fini(cmi_hdl_t);
76 
77 /*
78  * Return flags for cms_error_action.  The model-specific implementation
79  * can perform additional error handling during this call (e.g., cache
80  * flush). but it needs to return an indication to the caller as to
81  * the high-level impact of the error.
82  *
83  * CMS_ERRSCOPE_CLEAREDUC indicates that a UC error has in some way
84  * been cleared by the model-specific handling, and that no bad data
85  * remains in the system as far as this error is concerned.
86  *
87  * CMS_ERRSCOPE_POISONED indicates that the uncorrected data has
88  * been marked in some way to ensure that is cannot subsequently be mistaken
89  * for good data.
90  *
91  * CMS_ERRSCOPE_CURCONTEXT_OK indicates that the interrupted context is
92  * unaffected by the uncorrected error.
93  *
94  * CMS_ERRSCOPE_IGNORE_ERR indicates that the error should be ignored,
95  * regardless of apparent current context status and presence of uncorrected
96  * data.
97  *
98  * CMS_ERRSCOPE_FORCE_FATAL indicates that the error should be considered
99  * terminal, even if no uncorrected data is present and context appears ok
100  */
101 
102 #define	CMS_ERRSCOPE_CLEARED_UC		0x01
103 #define	CMS_ERRSCOPE_POISONED		0x02
104 #define	CMS_ERRSCOPE_CURCONTEXT_OK	0x04
105 #define	CMS_ERRSCOPE_IGNORE_ERR		0x08
106 #define	CMS_ERRSCOPE_FORCE_FATAL	0x10
107 
108 typedef void *cms_cookie_t;
109 
110 extern uint32_t cms_error_action(cmi_hdl_t, int, int, uint64_t, uint64_t,
111     uint64_t, void *);
112 
113 extern cms_cookie_t cms_disp_match(cmi_hdl_t, int, uint64_t, uint64_t, uint64_t,
114     void *);
115 extern void cms_ereport_class(cmi_hdl_t, cms_cookie_t, const char **,
116     const char **);
117 extern nvlist_t *cms_ereport_detector(cmi_hdl_t, int, cms_cookie_t,
118     nv_alloc_t *);
119 extern boolean_t cms_ereport_includestack(cmi_hdl_t, cms_cookie_t);
120 extern void cms_ereport_add_logout(cmi_hdl_t, nvlist_t *, nv_alloc_t *, int,
121     uint64_t, uint64_t, uint64_t, void *, cms_cookie_t);
122 
123 #endif /* _KERNEL */
124 
125 #ifdef	__cplusplus
126 }
127 #endif
128 
129 #endif /* _CPU_MODULE_MS_H */
130