cpupm_mach.h revision f34a71784df3fbc5d1227a7b6201fd318ad1667e
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _CPUPM_MACH_H
#define _CPUPM_MACH_H
#ifdef __cplusplus
extern "C" {
#endif
/*
* CPU power domains
*/
typedef struct cpupm_state_domains {
struct cpupm_state_domains *pm_next;
/*
* Different processor families have their own technologies for supporting
* CPU power management (i.e., Intel has Enhanced SpeedStep for some of its
* processors and AMD has PowerNow! for some of its processors). We support
* these different technologies via modules that export the interfaces
* described below.
*
* If a module implements the technology that should be used to manage
* the current CPU device, then the cpus_init() module should return
* succesfully (i.e., return code of 0) and perform any initialization
* such that future power transistions can be performed by calling
* the cpus_change() interface. And the cpups_fini() interface can be
* used to free any resources allocated by cpus_init().
*/
typedef struct cpupm_state_ops {
char *cpups_label;
/*
* Data kept for each C-state power-domain.
*/
typedef struct cma_c_state {
typedef union cma_state {
} cma_state_t;
typedef struct cpupm_mach_acpi_state {
typedef struct cpupm_mach_state {
void *ms_acpi_handle;
void *ms_vendor;
struct cpupm_notification *ms_handlers;
/*
* Constants used by the Processor Device Notification handler
* that identify what kind of change has occurred.
*/
#define CPUPM_PPC_CHANGE_NOTIFICATION 0x80
#define CPUPM_CST_CHANGE_NOTIFICATION 0x81
#define CPUPM_TPC_CHANGE_NOTIFICATION 0x82
void *ctx);
typedef struct cpupm_notification {
struct cpupm_notification *nq_next;
void *nq_ctx;
/*
* If any states are added, then make sure to add them to
* CPUPM_ALL_STATES.
*/
#define CPUPM_NO_STATES 0x00
#define CPUPM_P_STATES 0x01
#define CPUPM_T_STATES 0x02
#define CPUPM_C_STATES 0x04
#define CPUPM_ALL_STATES (CPUPM_P_STATES \
| CPUPM_T_STATES \
/*
* An error in initializing any of the CPU PM results in disabling
* CPU power management.
*/
/*
* Callbacks used for CPU power management.
*/
extern void (*cpupm_rebuild_cpu_domains)(void);
extern void (*cpupm_init_topspeed)(void);
extern void (*cpupm_redefine_topspeed)(void *);
extern int (*cpupm_get_topspeed_callb)(void *);
extern void (*cpupm_set_topspeed_callb)(void *, int);
extern void cpupm_init(cpu_t *);
extern void cpupm_free(cpu_t *);
extern boolean_t cpupm_is_ready();
extern void cpupm_disable(uint32_t);
extern void cpupm_post_startup();
extern void cpupm_alloc_domains(cpu_t *, int);
extern void cpupm_free_domains(cpupm_state_domains_t **);
extern void cpupm_state_change(cpu_t *, int, int);
cpupm_state_t *);
extern void cpupm_free_speeds(int *, uint_t);
extern boolean_t cpupm_power_ready(void);
extern boolean_t cpupm_throttle_ready(void);
extern boolean_t cpupm_cstate_ready(void);
extern int cpupm_get_top_speed(cpu_t *);
extern void cpupm_idle_cstate_data(cma_c_state_t *, int);
#ifdef __cplusplus
}
#endif
#endif /* _CPUPM_MACH_H */