xref: /illumos-gate/usr/src/uts/i86pc/sys/cpu_module_ms_impl.h (revision 45ede40b2394db7967e59f19288fae9b62efd4aa)
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_IMPL_H
27 #define	_CPU_MODULE_MS_IMPL_H
28 
29 #include <sys/cpu_module_ms.h>
30 #include <sys/cpuvar.h>
31 #include <sys/x86_archext.h>
32 #include <sys/nvpair.h>
33 
34 #ifdef  __cplusplus
35 extern "C" {
36 #endif
37 
38 typedef uint32_t cms_api_ver_t;
39 
40 #define	_CMS_API_VERSION_MAGIC	0xc5500000
41 #define	_CMS_API_VERSION(n)	(_CMS_API_VERSION_MAGIC | (n))
42 
43 #define	CMS_API_VERSION_CHKMAGIC(v) \
44 	(((v) & 0xfff00000) == _CMS_API_VERSION_MAGIC)
45 #define	CMS_API_VERSION_TOPRINT(v) ((v) & 0x000fffff)
46 
47 #define	CMS_API_VERSION_2	_CMS_API_VERSION(2)
48 
49 #define	CMS_API_VERSION		CMS_API_VERSION_2
50 
51 typedef struct cms_ops {
52 	int (*cms_init)(cmi_hdl_t, void **);
53 	void (*cms_post_startup)(cmi_hdl_t);
54 	void (*cms_post_mpstartup)(cmi_hdl_t);
55 	size_t (*cms_logout_size)(cmi_hdl_t);
56 	uint64_t (*cms_mcgctl_val)(cmi_hdl_t, int, uint64_t);
57 	boolean_t (*cms_bankctl_skipinit)(cmi_hdl_t, int);
58 	uint64_t (*cms_bankctl_val)(cmi_hdl_t, int, uint64_t);
59 	boolean_t (*cms_bankstatus_skipinit)(cmi_hdl_t, int);
60 	uint64_t (*cms_bankstatus_val)(cmi_hdl_t, int, uint64_t);
61 	void (*cms_mca_init)(cmi_hdl_t, int);
62 	uint64_t (*cms_poll_ownermask)(cmi_hdl_t, hrtime_t);
63 	void (*cms_bank_logout)(cmi_hdl_t, int, uint64_t,
64 	    uint64_t, uint64_t, void *);
65 	uint32_t (*cms_error_action)(cmi_hdl_t, int, int, uint64_t,
66 	    uint64_t, uint64_t, void *);
67 	cms_cookie_t (*cms_disp_match)(cmi_hdl_t, int, int, uint64_t, uint64_t,
68 	    uint64_t, void *);
69 	void (*cms_ereport_class)(cmi_hdl_t, cms_cookie_t, const char **,
70 	    const char **);
71 	nvlist_t *(*cms_ereport_detector)(cmi_hdl_t, int, cms_cookie_t,
72 	    nv_alloc_t *);
73 	boolean_t (*cms_ereport_includestack)(cmi_hdl_t, cms_cookie_t);
74 	void (*cms_ereport_add_logout)(cmi_hdl_t, nvlist_t *,
75 	    nv_alloc_t *, int, uint64_t, uint64_t, uint64_t, void *,
76 	    cms_cookie_t);
77 	cms_errno_t (*cms_msrinject)(cmi_hdl_t, uint_t, uint64_t);
78 	void (*cms_fini)(cmi_hdl_t);
79 } cms_ops_t;
80 
81 #ifdef	__cplusplus
82 }
83 #endif
84 
85 #endif /* _CPU_MODULE_MS_IMPL_H */
86