xref: /illumos-gate/usr/src/uts/i86pc/sys/cpu_idle.h (revision b1593d50e783f7d66722dde093752b74ffa95176)
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 2009 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_CPUIDLE_H
27 #define	_CPUIDLE_H
28 
29 #include <sys/cpupm.h>
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 #define	CPU_MAX_CSTATES	8
35 
36 #define	CPU_ACPI_C0	0
37 #define	CPU_ACPI_C1	1
38 #define	CPU_ACPI_C2	2
39 #define	CPU_ACPI_C3	3
40 
41 #define	BM_CTL		0x1
42 #define	BM_RLD		0x2
43 #define	BM_ARB_DIS	0x4
44 
45 #define	CPUID_TSC_INVARIANCE	0x100
46 
47 #define	CPU_IDLE_DEEP_CFG	(0x1)	/* Deep Idle disabled by user */
48 #define	CPU_IDLE_CPR_CFG	(0x2)	/* In CPR */
49 
50 typedef struct cpu_idle_kstat_s {
51 	struct kstat_named	addr_space_id;	/* register address space id */
52 	struct kstat_named	cs_latency;	/* worst latency */
53 	struct kstat_named	cs_power;	/* average power consumption */
54 } cpu_idle_kstat_t;
55 
56 extern cpupm_state_ops_t cpu_idle_ops;
57 
58 extern void cpu_acpi_idle(void);
59 extern void cstate_wakeup(cpu_t *, int);
60 extern boolean_t cpu_deep_cstates_supported(void);
61 extern void cpu_wakeup(cpu_t *, int);
62 extern void cpu_wakeup_mwait(cpu_t *, int);
63 extern void cpu_dtrace_idle_probe(uint_t);
64 extern void cpuidle_manage_cstates(void *);
65 
66 #ifdef __cplusplus
67 }
68 #endif
69 
70 #endif	/* _CPUIDLE_H */
71