xref: /onnv-gate/usr/src/uts/intel/sys/cpu.h (revision 5864)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
54481Sbholler  * Common Development and Distribution License (the "License").
64481Sbholler  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*5864Sesaxe  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef _SYS_CPU_H
270Sstevel@tonic-gate #define	_SYS_CPU_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate /*
320Sstevel@tonic-gate  * WARNING:
330Sstevel@tonic-gate  *	This header file is Obsolete and may be deleted in a
340Sstevel@tonic-gate  *	future release of Solaris.
350Sstevel@tonic-gate  */
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  * Include generic bustype cookies.
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate #include <sys/bustypes.h>
414481Sbholler #include <sys/inttypes.h>
425084Sjohnlev 
435084Sjohnlev #if defined(_KERNEL)
445084Sjohnlev #if defined(__xpv)
455084Sjohnlev #include <sys/hypervisor.h>
465084Sjohnlev #endif
475084Sjohnlev #if defined(__GNUC__) && defined(_ASM_INLINES)
480Sstevel@tonic-gate #include <asm/cpu.h>
490Sstevel@tonic-gate #endif
505084Sjohnlev #endif	/* _KERNEL */
510Sstevel@tonic-gate 
520Sstevel@tonic-gate #ifdef	__cplusplus
530Sstevel@tonic-gate extern "C" {
540Sstevel@tonic-gate #endif
550Sstevel@tonic-gate 
560Sstevel@tonic-gate #if defined(_KERNEL)
570Sstevel@tonic-gate extern void ht_pause(void);
580Sstevel@tonic-gate extern void cli(void);
590Sstevel@tonic-gate extern void sti(void);
600Sstevel@tonic-gate extern void i86_halt(void);
614481Sbholler extern void i86_monitor(volatile uint32_t *addr, uint32_t extensions,
624481Sbholler     uint32_t hints);
634481Sbholler extern void i86_mwait(uint32_t data, uint32_t extensions);
640Sstevel@tonic-gate 
650Sstevel@tonic-gate /*
660Sstevel@tonic-gate  * Used to insert cpu-dependent instructions into spin loops
670Sstevel@tonic-gate  */
685084Sjohnlev #if defined(__xpv)
695084Sjohnlev extern int xpv_panicking;
705084Sjohnlev #define	SMT_PAUSE()				\
715084Sjohnlev 	{					\
725084Sjohnlev 		if (IN_XPV_PANIC())		\
735084Sjohnlev 			ht_pause();		\
745084Sjohnlev 		else 				\
755084Sjohnlev 			(void) HYPERVISOR_yield();	\
765084Sjohnlev 	}
775084Sjohnlev 
785084Sjohnlev #else
790Sstevel@tonic-gate #define	SMT_PAUSE()		ht_pause()
805084Sjohnlev #endif
810Sstevel@tonic-gate 
82*5864Sesaxe /*
83*5864Sesaxe  *
84*5864Sesaxe  * C-state defines for the idle_state_transition DTrace probe
85*5864Sesaxe  *
86*5864Sesaxe  * The probe fires when the CPU undergoes an idle state change (e.g. C-state)
87*5864Sesaxe  * The agument passed is the C-state to which the CPU is transitioning.
88*5864Sesaxe  *
89*5864Sesaxe  * The states are defined here.
90*5864Sesaxe  */
91*5864Sesaxe #define	IDLE_STATE_C0 0
92*5864Sesaxe #define	IDLE_STATE_C1 1
93*5864Sesaxe 
940Sstevel@tonic-gate #endif	/* _KERNEL */
950Sstevel@tonic-gate 
960Sstevel@tonic-gate #ifdef	__cplusplus
970Sstevel@tonic-gate }
980Sstevel@tonic-gate #endif
990Sstevel@tonic-gate 
1000Sstevel@tonic-gate #endif	/* _SYS_CPU_H */
101