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 /* 23*20c794b3Sgavinm * Copyright 2007 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 #pragma ident "%Z%%M% %I% %E% SMI" 317aec1d6eScindi 327aec1d6eScindi #include <sys/cpu_module.h> 337aec1d6eScindi #include <sys/cpuvar.h> 347aec1d6eScindi #include <sys/types.h> 357aec1d6eScindi 367aec1d6eScindi #ifdef __cplusplus 377aec1d6eScindi extern "C" { 387aec1d6eScindi #endif 397aec1d6eScindi 40*20c794b3Sgavinm typedef uint32_t cmi_api_ver_t; 41*20c794b3Sgavinm 42*20c794b3Sgavinm #define _CMI_API_VERSION_MAGIC 0xa5100000 43*20c794b3Sgavinm #define _CMI_API_VERSION(n) (_CMI_API_VERSION_MAGIC | (n)) 44*20c794b3Sgavinm 45*20c794b3Sgavinm #define CMI_API_VERSION_CHKMAGIC(v) \ 46*20c794b3Sgavinm (((v) & 0xfff00000) == _CMI_API_VERSION_MAGIC) 47*20c794b3Sgavinm #define CMI_API_VERSION_TOPRINT(v) ((v) & 0x000fffff) 48*20c794b3Sgavinm 49*20c794b3Sgavinm #define CMI_API_VERSION_0 _CMI_API_VERSION(0) 50*20c794b3Sgavinm #define CMI_API_VERSION_1 _CMI_API_VERSION(1) 51*20c794b3Sgavinm 52*20c794b3Sgavinm #define CMI_API_VERSION CMI_API_VERSION_1 53*20c794b3Sgavinm 547aec1d6eScindi typedef struct cmi_mc_ops { 55*20c794b3Sgavinm cmi_errno_t (*cmi_mc_patounum)(void *, uint64_t, uint8_t, uint8_t, 56*20c794b3Sgavinm uint32_t, int, mc_unum_t *); 57*20c794b3Sgavinm cmi_errno_t (*cmi_mc_unumtopa)(void *, mc_unum_t *, nvlist_t *, 58*20c794b3Sgavinm uint64_t *); 59*20c794b3Sgavinm void (*cmi_mc_logout)(cmi_hdl_t, boolean_t, boolean_t); 607aec1d6eScindi } cmi_mc_ops_t; 617aec1d6eScindi 627aec1d6eScindi typedef struct cmi_ops { 63*20c794b3Sgavinm int (*cmi_init)(cmi_hdl_t, void **); 64*20c794b3Sgavinm void (*cmi_post_startup)(cmi_hdl_t); 65*20c794b3Sgavinm void (*cmi_post_mpstartup)(cmi_hdl_t); 66*20c794b3Sgavinm void (*cmi_faulted_enter)(cmi_hdl_t); 67*20c794b3Sgavinm void (*cmi_faulted_exit)(cmi_hdl_t); 68*20c794b3Sgavinm void (*cmi_mca_init)(cmi_hdl_t); 69*20c794b3Sgavinm uint64_t (*cmi_mca_trap)(cmi_hdl_t, struct regs *); 70*20c794b3Sgavinm cmi_errno_t (*cmi_msrinject)(cmi_hdl_t, cmi_mca_regs_t *, uint_t, int); 71*20c794b3Sgavinm void (*cmi_hdl_poke)(cmi_hdl_t); 72*20c794b3Sgavinm void (*cmi_fini)(cmi_hdl_t); 737aec1d6eScindi } cmi_ops_t; 747aec1d6eScindi 75*20c794b3Sgavinm /* 76*20c794b3Sgavinm * Utility functions provided by the cpu module interface for the sole 77*20c794b3Sgavinm * use of cpu module implementations. 78*20c794b3Sgavinm */ 79*20c794b3Sgavinm extern int cmi_mce_response(struct regs *, uint64_t); 80*20c794b3Sgavinm 81*20c794b3Sgavinm /* 82*20c794b3Sgavinm * Terminal dispositions to be returned by cmi_mca_trap entry point 83*20c794b3Sgavinm */ 84*20c794b3Sgavinm #define CMI_ERRDISP_CURCTXBAD 0x00000001ULL 85*20c794b3Sgavinm #define CMI_ERRDISP_RIPV_INVALID 0x00000002ULL 86*20c794b3Sgavinm #define CMI_ERRDISP_UC_UNCONSTRAINED 0x00000004ULL 87*20c794b3Sgavinm #define CMI_ERRDISP_FORCEFATAL 0x00000008ULL 887aec1d6eScindi 89*20c794b3Sgavinm /* 90*20c794b3Sgavinm * Non-terminal errors dispositions that can be returned by cmi_mca_trap 91*20c794b3Sgavinm */ 92*20c794b3Sgavinm #define CMI_ERRDISP_IGNORED 0x00010000ULL 93*20c794b3Sgavinm #define CMI_ERRDISP_PCC_CLEARED 0x00020000ULL 94*20c794b3Sgavinm #define CMI_ERRDISP_UC_CLEARED 0x00040000ULL 95*20c794b3Sgavinm #define CMI_ERRDISP_POISONED 0x00080000ULL 96*20c794b3Sgavinm #define CMI_ERRDISP_INCONSISTENT 0x00100000ULL 977aec1d6eScindi 987aec1d6eScindi #ifdef __cplusplus 997aec1d6eScindi } 1007aec1d6eScindi #endif 1017aec1d6eScindi 1027aec1d6eScindi #endif /* _SYS_CPU_MODULE_IMPL_H */ 103