xref: /titanic_51/usr/src/uts/i86pc/sys/cpu_idle.h (revision cbdcbd056f15c9c9fd82d5543b3a502677c4d391)
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  * Copyright (c) 2009, Intel Corporation.
27  * All rights reserved.
28  */
29 
30 #ifndef	_CPUIDLE_H
31 #define	_CPUIDLE_H
32 
33 #include <sys/cpupm.h>
34 #include <sys/cpu.h>
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 #define	CPU_MAX_CSTATES	8
40 
41 #define	CPU_ACPI_C0	IDLE_STATE_C0
42 #define	CPU_ACPI_C1	IDLE_STATE_C1
43 #define	CPU_ACPI_C2	IDLE_STATE_C2
44 #define	CPU_ACPI_C3	IDLE_STATE_C3
45 
46 #define	BM_CTL		0x1
47 #define	BM_RLD		0x2
48 #define	BM_ARB_DIS	0x4
49 
50 #define	CPUID_TSC_INVARIANCE	0x100
51 
52 #define	CPU_IDLE_DEEP_CFG	(0x1)	/* Deep Idle disabled by user */
53 #define	CPU_IDLE_CPR_CFG	(0x2)	/* In CPR */
54 
55 typedef struct cpu_idle_kstat_s {
56 	struct kstat_named	addr_space_id;	/* register address space id */
57 	struct kstat_named	cs_latency;	/* worst latency */
58 	struct kstat_named	cs_power;	/* average power consumption */
59 } cpu_idle_kstat_t;
60 
61 extern cpupm_state_ops_t cpu_idle_ops;
62 
63 extern void cpu_acpi_idle(void);
64 extern void cstate_wakeup(cpu_t *, int);
65 extern boolean_t cpu_deep_cstates_supported(void);
66 extern void cpu_wakeup(cpu_t *, int);
67 extern void cpu_wakeup_mwait(cpu_t *, int);
68 extern void cpuidle_manage_cstates(void *);
69 extern boolean_t cstate_timer_callback(int code);
70 
71 #ifdef __cplusplus
72 }
73 #endif
74 
75 #endif	/* _CPUIDLE_H */
76