xref: /titanic_51/usr/src/uts/i86pc/sys/cpu_idle.h (revision 6b5764c36d253d178caa447fa2a6d7e0c7dfd6e6)
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 #define	CPU_CSTATE_LATENCY_UNDEF	(1000000)	/* ACPI info missing */
51 
52 typedef struct cpu_idle_kstat_s {
53 	struct kstat_named	addr_space_id;	/* register address space id */
54 	struct kstat_named	cs_latency;	/* worst latency */
55 	struct kstat_named	cs_power;	/* average power consumption */
56 } cpu_idle_kstat_t;
57 
58 extern cpupm_state_ops_t cpu_idle_ops;
59 
60 extern void cpu_acpi_idle(void);
61 extern void cstate_wakeup(cpu_t *, int);
62 extern boolean_t cpu_deep_cstates_supported(void);
63 extern void cpu_wakeup(cpu_t *, int);
64 extern void cpu_wakeup_mwait(cpu_t *, int);
65 extern void cpu_dtrace_idle_probe(uint_t);
66 extern void cpuidle_manage_cstates(void *);
67 
68 #ifdef __cplusplus
69 }
70 #endif
71 
72 #endif	/* _CPUIDLE_H */
73