/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2010 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_CPU_MODULE_H
#define _SYS_CPU_MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
#ifdef _KERNEL
typedef enum cmi_errno {
CMI_SUCCESS = 0,
/*
* CPU Module Interface API error return values/
*/
/*
* Memory-controller related errors
*/
} cmi_errno_t;
/*
* All access to cpu information is made via a handle, in order to get
* the desired info even when running non-natively.
*
* A CMI_HDL_NATIVE handle is used when we believe we are running on
* bare-metal. If we *are* on bare metal then this handle type will
* get us through to the real hardware, and there will be a 1:1 correspondence
* between handles and cpu_t structures; if not, say we are a domU to
* some unknown/undetected/unannounced hypervisor then chances are the
* hypervisor is not exposing much hardware detail to us so we should
* be prepared for some operations that "cannot fail" to fail or return
* odd data.
*
* A CMI_HDL_SOLARIS_xVM_MCA handle is used when we are running
* in i86xpv architecture - dom0 to a Solaris xVM hypervisor - and want to
* use a handle on each real execution core (as opposed to vcpu)
* to perform MCA related activities. The model for this handle type
* is that the hypervisor continues to own the real hardware and
* includes a polling service and #MC handler which forward error
* telemetry to dom0 for logging and diagnosis. As such, the operations
* such as RDMSR and WRMSR for this handle type do *not* read and write
* real MSRs via hypercalls- instead they should provide the values from
* already-read MCA bank telemetry, and writes are discarded.
*
* If some application requires real MSR read and write access another
* handle class should be introduced.
*/
enum cmi_hdl_class {
};
struct regs;
typedef struct cmi_mc_ops {
uint64_t *);
} cmi_mc_ops_t;
extern void cmi_post_startup(void);
extern void cmi_post_mpstartup(void);
extern void cmi_hdl_hold(cmi_hdl_t);
extern void cmi_hdl_rele(cmi_hdl_t);
extern void *cmi_hdl_getcmidata(cmi_hdl_t);
extern void cmi_hdl_setspecific(cmi_hdl_t, void *);
extern void *cmi_hdl_getspecific(cmi_hdl_t);
extern void *cmi_hdl_getmcdata(cmi_hdl_t);
extern cmi_hdl_t cmi_hdl_any(void);
#define CMI_HDL_WALK_NEXT 0
extern void cmi_hdl_walk(int (*)(cmi_hdl_t, void *, void *, void *),
void *, void *, void *);
extern void cmi_hdlconf_rdmsr_nohw(cmi_hdl_t);
extern void cmi_hdlconf_wrmsr_nohw(cmi_hdl_t);
extern void cmi_hdl_enable_mce(cmi_hdl_t);
extern const char *cmi_hdl_vendorstr(cmi_hdl_t);
extern const char *cmi_hdl_chiprevstr(cmi_hdl_t);
extern const char *cmi_hdl_getsocketstr(cmi_hdl_t);
extern int cmi_hdl_online(cmi_hdl_t, int, int *);
#ifndef __xpv
extern void cmi_ntv_hwdisable_mce(cmi_hdl_t);
#endif /* __xpv */
typedef struct cmi_mca_regs {
int);
extern boolean_t cmi_inj_tainted(void);
extern void cmi_faulted_enter(cmi_hdl_t);
extern void cmi_faulted_exit(cmi_hdl_t);
extern void cmi_pcird_nohw(void);
extern void cmi_pciwr_nohw(void);
extern void cmi_pci_interposeb(int, int, int, int, uint8_t);
extern void cmi_pci_interposew(int, int, int, int, uint16_t);
extern void cmi_pci_interposel(int, int, int, int, uint32_t);
extern void cmi_mca_init(cmi_hdl_t);
extern void cmi_hdl_poke(cmi_hdl_t);
extern void cmi_hdl_int(cmi_hdl_t, int);
extern void cmi_mca_trap(struct regs *);
extern boolean_t cmi_panic_on_ue(void);
extern void cmi_mc_sw_memscrub_disable(void);
mc_unum_t *);
extern void cmi_panic_callback(void);
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_CPU_MODULE_H */