xref: /titanic_51/usr/src/uts/i86pc/sys/cpu_module_impl.h (revision e4b86885570d77af552e9cf94f142f4d744fb8c8)
17aec1d6eScindi /*
27aec1d6eScindi  * CDDL HEADER START
37aec1d6eScindi  *
47aec1d6eScindi  * The contents of this file are subject to the terms of the
53ad553a7Sgavinm  * Common Development and Distribution License (the "License").
63ad553a7Sgavinm  * You may not use this file except in compliance with the License.
77aec1d6eScindi  *
87aec1d6eScindi  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97aec1d6eScindi  * or http://www.opensolaris.org/os/licensing.
107aec1d6eScindi  * See the License for the specific language governing permissions
117aec1d6eScindi  * and limitations under the License.
127aec1d6eScindi  *
137aec1d6eScindi  * When distributing Covered Code, include this CDDL HEADER in each
147aec1d6eScindi  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157aec1d6eScindi  * If applicable, add the following below this CDDL HEADER, with the
167aec1d6eScindi  * fields enclosed by brackets "[]" replaced with your own identifying
177aec1d6eScindi  * information: Portions Copyright [yyyy] [name of copyright owner]
187aec1d6eScindi  *
197aec1d6eScindi  * CDDL HEADER END
207aec1d6eScindi  */
217aec1d6eScindi 
227aec1d6eScindi /*
23e3d60c9bSAdrian Frost  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
247aec1d6eScindi  * Use is subject to license terms.
257aec1d6eScindi  */
267aec1d6eScindi 
277aec1d6eScindi #ifndef _SYS_CPU_MODULE_IMPL_H
287aec1d6eScindi #define	_SYS_CPU_MODULE_IMPL_H
297aec1d6eScindi 
307aec1d6eScindi #include <sys/cpu_module.h>
317aec1d6eScindi #include <sys/cpuvar.h>
327aec1d6eScindi #include <sys/types.h>
337aec1d6eScindi 
347aec1d6eScindi #ifdef __cplusplus
357aec1d6eScindi extern "C" {
367aec1d6eScindi #endif
377aec1d6eScindi 
3820c794b3Sgavinm typedef uint32_t cmi_api_ver_t;
3920c794b3Sgavinm 
4020c794b3Sgavinm #define	_CMI_API_VERSION_MAGIC	0xa5100000
4120c794b3Sgavinm #define	_CMI_API_VERSION(n)	(_CMI_API_VERSION_MAGIC | (n))
4220c794b3Sgavinm 
4320c794b3Sgavinm #define	CMI_API_VERSION_CHKMAGIC(v) \
4420c794b3Sgavinm 	(((v) & 0xfff00000) == _CMI_API_VERSION_MAGIC)
4520c794b3Sgavinm #define	CMI_API_VERSION_TOPRINT(v) ((v) & 0x000fffff)
4620c794b3Sgavinm 
4720c794b3Sgavinm #define	CMI_API_VERSION_0	_CMI_API_VERSION(0)
4820c794b3Sgavinm #define	CMI_API_VERSION_1	_CMI_API_VERSION(1)
49e3d60c9bSAdrian Frost #define	CMI_API_VERSION_2	_CMI_API_VERSION(2)
50*e4b86885SCheng Sean Ye #define	CMI_API_VERSION_3	_CMI_API_VERSION(3)
5120c794b3Sgavinm 
52*e4b86885SCheng Sean Ye #define	CMI_API_VERSION		CMI_API_VERSION_3
537aec1d6eScindi 
547aec1d6eScindi typedef struct cmi_ops {
5520c794b3Sgavinm 	int (*cmi_init)(cmi_hdl_t, void **);
5620c794b3Sgavinm 	void (*cmi_post_startup)(cmi_hdl_t);
5720c794b3Sgavinm 	void (*cmi_post_mpstartup)(cmi_hdl_t);
5820c794b3Sgavinm 	void (*cmi_faulted_enter)(cmi_hdl_t);
5920c794b3Sgavinm 	void (*cmi_faulted_exit)(cmi_hdl_t);
6020c794b3Sgavinm 	void (*cmi_mca_init)(cmi_hdl_t);
6120c794b3Sgavinm 	uint64_t (*cmi_mca_trap)(cmi_hdl_t, struct regs *);
62e3d60c9bSAdrian Frost 	void (*cmi_cmci_trap)();
6320c794b3Sgavinm 	cmi_errno_t (*cmi_msrinject)(cmi_hdl_t, cmi_mca_regs_t *, uint_t, int);
6420c794b3Sgavinm 	void (*cmi_hdl_poke)(cmi_hdl_t);
6520c794b3Sgavinm 	void (*cmi_fini)(cmi_hdl_t);
66*e4b86885SCheng Sean Ye 	void (*cmi_panic_callback)(void);
677aec1d6eScindi } cmi_ops_t;
687aec1d6eScindi 
6920c794b3Sgavinm /*
7020c794b3Sgavinm  * Utility functions provided by the cpu module interface for the sole
7120c794b3Sgavinm  * use of cpu module implementations.
7220c794b3Sgavinm  */
7320c794b3Sgavinm extern int cmi_mce_response(struct regs *, uint64_t);
747aec1d6eScindi 
7520c794b3Sgavinm /*
7620c794b3Sgavinm  * Terminal dispositions to be returned by cmi_mca_trap entry point
7720c794b3Sgavinm  */
7820c794b3Sgavinm #define	CMI_ERRDISP_CURCTXBAD		0x00000001ULL
7920c794b3Sgavinm #define	CMI_ERRDISP_RIPV_INVALID	0x00000002ULL
8020c794b3Sgavinm #define	CMI_ERRDISP_UC_UNCONSTRAINED	0x00000004ULL
8120c794b3Sgavinm #define	CMI_ERRDISP_FORCEFATAL		0x00000008ULL
8220c794b3Sgavinm 
8320c794b3Sgavinm /*
8420c794b3Sgavinm  * Non-terminal errors dispositions that can be returned by cmi_mca_trap
8520c794b3Sgavinm  */
8620c794b3Sgavinm #define	CMI_ERRDISP_IGNORED		0x00010000ULL
8720c794b3Sgavinm #define	CMI_ERRDISP_PCC_CLEARED		0x00020000ULL
8820c794b3Sgavinm #define	CMI_ERRDISP_UC_CLEARED		0x00040000ULL
8920c794b3Sgavinm #define	CMI_ERRDISP_POISONED		0x00080000ULL
9020c794b3Sgavinm #define	CMI_ERRDISP_INCONSISTENT	0x00100000ULL
917aec1d6eScindi 
927aec1d6eScindi #ifdef __cplusplus
937aec1d6eScindi }
947aec1d6eScindi #endif
957aec1d6eScindi 
967aec1d6eScindi #endif /* _SYS_CPU_MODULE_IMPL_H */
97