uts: make emu10k non-verbose
[unleashed.git] / include / sys / cpu_pm.h
blob124722f82cdcc6a4899882e0655a24275519698e
1 /*
2 * CDDL HEADER START
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.
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.
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]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #ifndef _CPU_PM_H
27 #define _CPU_PM_H
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
33 #if (defined(_KERNEL) || defined(_KMEMUSER))
34 #include <sys/cpuvar.h>
35 #include <sys/processor.h>
36 #include <sys/types.h>
37 #include <sys/kstat.h>
38 #include <sys/cmt.h>
41 * CPU Power Manager Policies
43 typedef enum cpupm_policy {
44 CPUPM_POLICY_ELASTIC,
45 CPUPM_POLICY_DISABLED,
46 CPUPM_NUM_POLICIES
47 } cpupm_policy_t;
50 * Power Managable CPU Domain Types
52 typedef enum cpupm_dtype {
53 CPUPM_DTYPE_ACTIVE, /* Active Power Domain */
54 CPUPM_DTYPE_IDLE /* Idle Power Domain */
55 } cpupm_dtype_t;
58 * CPUPM state names for policy implementation.
59 * The last element is used to size the enumeration.
61 typedef enum cpupm_state_name {
62 CPUPM_STATE_LOW_POWER,
63 CPUPM_STATE_MAX_PERF,
64 CPUPM_STATE_NAMES
65 } cpupm_state_name_t;
68 * Possible states for the domain's transience governor
70 typedef enum cpupm_gov_state_t {
71 CPUPM_GOV_DISENGAGED,
72 CPUPM_GOV_TRANS_IDLE, /* Transient idleness, lowerings disabled */
73 CPUPM_GOV_TRANS_WORK /* Transient work, raises disabled */
74 } cpupm_gov_state_t;
77 * Utilization events delivered by the dispatcher.
79 typedef enum cpupm_util_event {
80 CPUPM_DOM_BUSY_FROM_IDLE,
81 CPUPM_DOM_IDLE_FROM_BUSY,
82 CPUPM_DOM_REMAIN_BUSY
83 } cpupm_util_event_t;
85 typedef uintptr_t cpupm_handle_t; /* Platform handle */
88 * CPU Power Domain State
90 typedef struct cpupm_state {
91 uint32_t cps_speed;
92 cpupm_handle_t cps_handle;
93 } cpupm_state_t;
96 * CPU Power Domain
98 typedef struct cpupm_domain {
99 id_t cpd_id; /* Domain ID */
100 cpupm_dtype_t cpd_type; /* Active or Idle */
101 cpupm_state_t *cpd_states; /* Available Power States */
102 cpupm_state_t *cpd_state; /* Current State */
103 uint_t cpd_nstates; /* Number of States */
104 cpupm_state_t *cpd_named_states[CPUPM_STATE_NAMES];
105 hrtime_t cpd_last_raise; /* Last raise request time */
106 hrtime_t cpd_last_lower; /* last lower request time */
107 int cpd_ti; /* transient idle history */
108 int cpd_tw; /* transient work history */
109 cpupm_gov_state_t cpd_governor; /* transience governor */
110 struct cpupm_domain *cpd_next;
111 } cpupm_domain_t;
113 #define CPUPM_NO_DOMAIN ((id_t)-1)
116 * CPU power manager domain management interfaces
118 cpupm_domain_t *cpupm_domain_init(struct cpu *, cpupm_dtype_t);
119 id_t cpupm_domain_id(struct cpu *, cpupm_dtype_t);
120 int cpupm_change_state(struct cpu *, cpupm_domain_t *,
121 cpupm_state_t *);
122 extern void cpupm_redefine_max_activepwr_state(struct cpu *, int);
125 * CPU power manager policy engine interfaces
127 int cpupm_set_policy(cpupm_policy_t);
128 cpupm_policy_t cpupm_get_policy(void);
129 void cpupm_utilization_event(struct cpu *, hrtime_t,
130 cpupm_domain_t *, cpupm_util_event_t);
133 * CPU power platform driver interfaces
135 id_t cpupm_plat_domain_id(struct cpu *, cpupm_dtype_t);
136 uint_t cpupm_plat_state_enumerate(struct cpu *, cpupm_dtype_t,
137 cpupm_state_t *);
138 int cpupm_plat_change_state(struct cpu *, cpupm_state_t *);
141 #endif /* !_KERNEL && !_KMEMUSER */
143 #ifdef __cplusplus
145 #endif
147 #endif /* _CPU_PM_H */