0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe/*
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * CDDL HEADER START
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe *
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * The contents of this file are subject to the terms of the
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * Common Development and Distribution License (the "License").
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * You may not use this file except in compliance with the License.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe *
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * or http://www.opensolaris.org/os/licensing.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * See the License for the specific language governing permissions
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * and limitations under the License.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe *
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * When distributing Covered Code, include this CDDL HEADER in each
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * If applicable, add the following below this CDDL HEADER, with the
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * fields enclosed by brackets "[]" replaced with your own identifying
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * information: Portions Copyright [yyyy] [name of copyright owner]
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe *
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * CDDL HEADER END
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe/*
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe * Use is subject to license terms.
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe */
cef70d2c52b5ed31a487790e4584f648812210a9Bill Holler/*
cef70d2c52b5ed31a487790e4584f648812210a9Bill Holler * Copyright (c) 2009, Intel Corporation.
cef70d2c52b5ed31a487790e4584f648812210a9Bill Holler * All rights reserved.
cef70d2c52b5ed31a487790e4584f648812210a9Bill Holler */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#ifndef _CPUIDLE_H
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define _CPUIDLE_H
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#include <sys/cpupm.h>
fb2caebe9e38ee2e6e469d5136fb247faaa7299bRandy Fishel#include <sys/cpu.h>
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#ifdef __cplusplus
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern "C" {
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#endif
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define CPU_MAX_CSTATES 8
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
fb2caebe9e38ee2e6e469d5136fb247faaa7299bRandy Fishel#define CPU_ACPI_C0 IDLE_STATE_C0
fb2caebe9e38ee2e6e469d5136fb247faaa7299bRandy Fishel#define CPU_ACPI_C1 IDLE_STATE_C1
fb2caebe9e38ee2e6e469d5136fb247faaa7299bRandy Fishel#define CPU_ACPI_C2 IDLE_STATE_C2
fb2caebe9e38ee2e6e469d5136fb247faaa7299bRandy Fishel#define CPU_ACPI_C3 IDLE_STATE_C3
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define BM_CTL 0x1
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define BM_RLD 0x2
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define BM_ARB_DIS 0x4
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define CPUID_TSC_INVARIANCE 0x100
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define CPU_IDLE_DEEP_CFG (0x1) /* Deep Idle disabled by user */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#define CPU_IDLE_CPR_CFG (0x2) /* In CPR */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxetypedef struct cpu_idle_kstat_s {
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe struct kstat_named addr_space_id; /* register address space id */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe struct kstat_named cs_latency; /* worst latency */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe struct kstat_named cs_power; /* average power consumption */
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe} cpu_idle_kstat_t;
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern cpupm_state_ops_t cpu_idle_ops;
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern void cpu_acpi_idle(void);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern void cstate_wakeup(cpu_t *, int);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern boolean_t cpu_deep_cstates_supported(void);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern void cpu_wakeup(cpu_t *, int);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern void cpu_wakeup_mwait(cpu_t *, int);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxeextern void cpuidle_manage_cstates(void *);
cef70d2c52b5ed31a487790e4584f648812210a9Bill Hollerextern boolean_t cstate_timer_callback(int code);
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#ifdef __cplusplus
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe}
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#endif
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe
0e7515250c8395f368aa45fb9acae7c4f8f8b786Eric Saxe#endif /* _CPUIDLE_H */