cpu_idle.h revision 9283:2ee48b3d20ef
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
35#ifdef __cplusplus
36extern "C" {
37#endif
38#define	CPU_MAX_CSTATES	8
39
40#define	CPU_ACPI_C0	0
41#define	CPU_ACPI_C1	1
42#define	CPU_ACPI_C2	2
43#define	CPU_ACPI_C3	3
44
45#define	BM_CTL		0x1
46#define	BM_RLD		0x2
47#define	BM_ARB_DIS	0x4
48
49#define	CPUID_TSC_INVARIANCE	0x100
50
51#define	CPU_IDLE_DEEP_CFG	(0x1)	/* Deep Idle disabled by user */
52#define	CPU_IDLE_CPR_CFG	(0x2)	/* In CPR */
53
54typedef struct cpu_idle_kstat_s {
55	struct kstat_named	addr_space_id;	/* register address space id */
56	struct kstat_named	cs_latency;	/* worst latency */
57	struct kstat_named	cs_power;	/* average power consumption */
58} cpu_idle_kstat_t;
59
60extern cpupm_state_ops_t cpu_idle_ops;
61
62extern void cpu_acpi_idle(void);
63extern void cstate_wakeup(cpu_t *, int);
64extern boolean_t cpu_deep_cstates_supported(void);
65extern void cpu_wakeup(cpu_t *, int);
66extern void cpu_wakeup_mwait(cpu_t *, int);
67extern void cpu_dtrace_idle_probe(uint_t);
68extern void cpuidle_manage_cstates(void *);
69extern boolean_t cstate_timer_callback(int code);
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif	/* _CPUIDLE_H */
76