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