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