xref: /titanic_41/usr/src/uts/intel/sys/cpu.h (revision a3c4695861e3f0a8d3706f77ccd53683cca48d67)
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  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _SYS_CPU_H
27 #define	_SYS_CPU_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 /*
32  * WARNING:
33  *	This header file is Obsolete and may be deleted in a
34  *	future release of Solaris.
35  */
36 
37 /*
38  * Include generic bustype cookies.
39  */
40 #include <sys/bustypes.h>
41 #include <sys/inttypes.h>
42 
43 #if defined(_KERNEL)
44 #if defined(__xpv)
45 #include <sys/hypervisor.h>
46 #endif
47 #if defined(__GNUC__) && defined(_ASM_INLINES)
48 #include <asm/cpu.h>
49 #endif
50 #endif	/* _KERNEL */
51 
52 #ifdef	__cplusplus
53 extern "C" {
54 #endif
55 
56 #if defined(_KERNEL)
57 extern void ht_pause(void);
58 extern void cli(void);
59 extern void sti(void);
60 extern void i86_halt(void);
61 extern void i86_monitor(volatile uint32_t *addr, uint32_t extensions,
62     uint32_t hints);
63 extern void i86_mwait(uint32_t data, uint32_t extensions);
64 
65 /*
66  * Used to insert cpu-dependent instructions into spin loops
67  */
68 #if defined(__xpv)
69 extern int xpv_panicking;
70 #define	SMT_PAUSE()				\
71 	{					\
72 		if (IN_XPV_PANIC())		\
73 			ht_pause();		\
74 		else 				\
75 			(void) HYPERVISOR_yield();	\
76 	}
77 
78 #else
79 #define	SMT_PAUSE()		ht_pause()
80 #endif
81 
82 /*
83  *
84  * C-state defines for the idle_state_transition DTrace probe
85  *
86  * The probe fires when the CPU undergoes an idle state change (e.g. C-state)
87  * The agument passed is the C-state to which the CPU is transitioning.
88  *
89  * The states are defined here.
90  */
91 #define	IDLE_STATE_C0 0
92 #define	IDLE_STATE_C1 1
93 
94 #endif	/* _KERNEL */
95 
96 #ifdef	__cplusplus
97 }
98 #endif
99 
100 #endif	/* _SYS_CPU_H */
101