xref: /titanic_53/usr/src/uts/common/sys/pm.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_PM_H
28*7c478bd9Sstevel@tonic-gate #define	_SYS_PM_H
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
31*7c478bd9Sstevel@tonic-gate 
32*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
33*7c478bd9Sstevel@tonic-gate extern "C" {
34*7c478bd9Sstevel@tonic-gate #endif
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #include <sys/types.h>
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate /*
39*7c478bd9Sstevel@tonic-gate  *	The following ioctls may not exist or may have a different
40*7c478bd9Sstevel@tonic-gate  *	interpretation in a future release.
41*7c478bd9Sstevel@tonic-gate  */
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate typedef enum {
44*7c478bd9Sstevel@tonic-gate 	PM_SCHEDULE,		/* obsolete, not supported */
45*7c478bd9Sstevel@tonic-gate 	PM_GET_IDLE_TIME,	/* obsolete, not supported  */
46*7c478bd9Sstevel@tonic-gate 	PM_GET_NUM_CMPTS,	/* obsolete, not supported */
47*7c478bd9Sstevel@tonic-gate 	PM_GET_THRESHOLD,	/* obsolete, not supported  */
48*7c478bd9Sstevel@tonic-gate 	PM_SET_THRESHOLD,	/* obsolete */
49*7c478bd9Sstevel@tonic-gate 	PM_GET_NORM_PWR,	/* obsolete */
50*7c478bd9Sstevel@tonic-gate 	PM_SET_CUR_PWR,		/* obsolete */
51*7c478bd9Sstevel@tonic-gate 	PM_GET_CUR_PWR,		/* obsolete */
52*7c478bd9Sstevel@tonic-gate 	PM_GET_NUM_DEPS,	/* obsolete, not supported */
53*7c478bd9Sstevel@tonic-gate 	PM_GET_DEP,		/* obsolete, not supported */
54*7c478bd9Sstevel@tonic-gate 	PM_ADD_DEP,		/* obsolete */
55*7c478bd9Sstevel@tonic-gate 	PM_REM_DEP,		/* obsolete, not supported */
56*7c478bd9Sstevel@tonic-gate 	PM_REM_DEVICE,		/* obsolete, not supported */
57*7c478bd9Sstevel@tonic-gate 	PM_REM_DEVICES,		/* obsolete */
58*7c478bd9Sstevel@tonic-gate 	PM_REPARSE_PM_PROPS,	/* used only by ddivs pm tests */
59*7c478bd9Sstevel@tonic-gate 	PM_DISABLE_AUTOPM,	/* obsolete */
60*7c478bd9Sstevel@tonic-gate 	PM_REENABLE_AUTOPM,	/* obsolete */
61*7c478bd9Sstevel@tonic-gate 	PM_SET_NORM_PWR,	/* obsolete, not supported */
62*7c478bd9Sstevel@tonic-gate 	PM_SET_DEVICE_THRESHOLD,
63*7c478bd9Sstevel@tonic-gate 	PM_GET_SYSTEM_THRESHOLD,
64*7c478bd9Sstevel@tonic-gate 	PM_SET_SYSTEM_THRESHOLD,
65*7c478bd9Sstevel@tonic-gate 	PM_START_PM,
66*7c478bd9Sstevel@tonic-gate 	PM_STOP_PM,
67*7c478bd9Sstevel@tonic-gate 	PM_RESET_PM,
68*7c478bd9Sstevel@tonic-gate 	PM_GET_STATS,
69*7c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD,
70*7c478bd9Sstevel@tonic-gate 	PM_GET_POWER_NAME,
71*7c478bd9Sstevel@tonic-gate 	PM_GET_POWER_LEVELS,
72*7c478bd9Sstevel@tonic-gate 	PM_GET_NUM_COMPONENTS,
73*7c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_NAME,
74*7c478bd9Sstevel@tonic-gate 	PM_GET_NUM_POWER_LEVELS,
75*7c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE,
76*7c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE_WAIT,
77*7c478bd9Sstevel@tonic-gate 	PM_DIRECT_PM,
78*7c478bd9Sstevel@tonic-gate 	PM_RELEASE_DIRECT_PM,
79*7c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY,
80*7c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY_WAIT,
81*7c478bd9Sstevel@tonic-gate 	PM_RESET_DEVICE_THRESHOLD,
82*7c478bd9Sstevel@tonic-gate 	PM_GET_PM_STATE,
83*7c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_TYPE,
84*7c478bd9Sstevel@tonic-gate 	PM_SET_COMPONENT_THRESHOLDS,
85*7c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_THRESHOLDS,
86*7c478bd9Sstevel@tonic-gate 	PM_IDLE_DOWN,
87*7c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD_BASIS,
88*7c478bd9Sstevel@tonic-gate 	PM_SET_CURRENT_POWER,	/* replaces PM_SET_CUR_PWR */
89*7c478bd9Sstevel@tonic-gate 	PM_GET_CURRENT_POWER,	/* replaces PM_GET_CUR_PWR */
90*7c478bd9Sstevel@tonic-gate 	PM_GET_FULL_POWER,	/* replaces PM_GET_NORM_PWR */
91*7c478bd9Sstevel@tonic-gate 	PM_ADD_DEPENDENT,	/* replaces PM_ADD_DEP */
92*7c478bd9Sstevel@tonic-gate 	PM_GET_TIME_IDLE,	/* replaces PM_IDLE_TIME */
93*7c478bd9Sstevel@tonic-gate 	PM_GET_DEFAULT_SYSTEM_THRESHOLD,
94*7c478bd9Sstevel@tonic-gate 	PM_ADD_DEPENDENT_PROPERTY
95*7c478bd9Sstevel@tonic-gate } pm_cmds;
96*7c478bd9Sstevel@tonic-gate 
97*7c478bd9Sstevel@tonic-gate /*
98*7c478bd9Sstevel@tonic-gate  * Old name for these ioctls.
99*7c478bd9Sstevel@tonic-gate  */
100*7c478bd9Sstevel@tonic-gate #define	PM_GET_POWER		PM_GET_NORM_PWR
101*7c478bd9Sstevel@tonic-gate #define	PM_SET_POWER		PM_SET_CUR_PWR
102*7c478bd9Sstevel@tonic-gate 
103*7c478bd9Sstevel@tonic-gate /*
104*7c478bd9Sstevel@tonic-gate  * This structure is obsolete and will be removed in a later release
105*7c478bd9Sstevel@tonic-gate  */
106*7c478bd9Sstevel@tonic-gate typedef struct {
107*7c478bd9Sstevel@tonic-gate 	caddr_t	who;		/* Device to configure */
108*7c478bd9Sstevel@tonic-gate 	int	select;		/* Selects the component or dependent */
109*7c478bd9Sstevel@tonic-gate 				/* of the device */
110*7c478bd9Sstevel@tonic-gate 	int	level;		/* Power or threshold level */
111*7c478bd9Sstevel@tonic-gate 	caddr_t dependent;	/* Buffer to hold name of dependent */
112*7c478bd9Sstevel@tonic-gate 	int	size;		/* Size of dependent buffer */
113*7c478bd9Sstevel@tonic-gate } pm_request;
114*7c478bd9Sstevel@tonic-gate 
115*7c478bd9Sstevel@tonic-gate /*
116*7c478bd9Sstevel@tonic-gate  * This is the new struct that replaces pm_request
117*7c478bd9Sstevel@tonic-gate  */
118*7c478bd9Sstevel@tonic-gate typedef struct pm_req {
119*7c478bd9Sstevel@tonic-gate 	char	*physpath;	/* physical path of device to configure */
120*7c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
121*7c478bd9Sstevel@tonic-gate 	int	component;	/* Selects the component of the device */
122*7c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
123*7c478bd9Sstevel@tonic-gate 	void	*data;		/* command-dependent variable sized data */
124*7c478bd9Sstevel@tonic-gate 	size_t	datasize;	/* Size of data buffer */
125*7c478bd9Sstevel@tonic-gate } pm_req_t;
126*7c478bd9Sstevel@tonic-gate 
127*7c478bd9Sstevel@tonic-gate /*
128*7c478bd9Sstevel@tonic-gate  * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY
129*7c478bd9Sstevel@tonic-gate  */
130*7c478bd9Sstevel@tonic-gate #define	pmreq_keeper	physpath	/* keeper in the physpath field */
131*7c478bd9Sstevel@tonic-gate #define	pmreq_kept	data		/* kept in the data field */
132*7c478bd9Sstevel@tonic-gate 
133*7c478bd9Sstevel@tonic-gate /*
134*7c478bd9Sstevel@tonic-gate  * Possible values for the event field of pm_state_change below
135*7c478bd9Sstevel@tonic-gate  */
136*7c478bd9Sstevel@tonic-gate typedef enum {
137*7c478bd9Sstevel@tonic-gate 	PSC_PENDING_CHANGE,	/* device needs to change, is blocked */
138*7c478bd9Sstevel@tonic-gate 	PSC_HAS_CHANGED		/* device level has changed */
139*7c478bd9Sstevel@tonic-gate } psc_events;
140*7c478bd9Sstevel@tonic-gate 
141*7c478bd9Sstevel@tonic-gate #define	PSC_EVENT_LOST	0x4000	/* buffer overrun */
142*7c478bd9Sstevel@tonic-gate #define	PSC_ALL_LOWEST	0x8000	/* all devices at lowest power */
143*7c478bd9Sstevel@tonic-gate 
144*7c478bd9Sstevel@tonic-gate /*
145*7c478bd9Sstevel@tonic-gate  * Special value for power level fields in pm_state_change below
146*7c478bd9Sstevel@tonic-gate  */
147*7c478bd9Sstevel@tonic-gate #define	PM_LEVEL_UNKNOWN	-1	/* power level is unknown */
148*7c478bd9Sstevel@tonic-gate 
149*7c478bd9Sstevel@tonic-gate typedef struct pm_state_change {
150*7c478bd9Sstevel@tonic-gate 	caddr_t	physpath;	/* Device which has changed state */
151*7c478bd9Sstevel@tonic-gate 	int	component;	/* which component changed state */
152*7c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
153*7c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
154*7c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
155*7c478bd9Sstevel@tonic-gate #else
156*7c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
157*7c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
158*7c478bd9Sstevel@tonic-gate #endif
159*7c478bd9Sstevel@tonic-gate 	time_t	timestamp;	/* time of state change */
160*7c478bd9Sstevel@tonic-gate 	int	old_level;	/* power level changing from */
161*7c478bd9Sstevel@tonic-gate 	int	new_level;	/* power level changing to */
162*7c478bd9Sstevel@tonic-gate 	size_t	size;		/* size of buffer physpath points to */
163*7c478bd9Sstevel@tonic-gate } pm_state_change_t;
164*7c478bd9Sstevel@tonic-gate 
165*7c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */
168*7c478bd9Sstevel@tonic-gate 
169*7c478bd9Sstevel@tonic-gate /*
170*7c478bd9Sstevel@tonic-gate  * This struct is obsolete and will be removed in a later release
171*7c478bd9Sstevel@tonic-gate  */
172*7c478bd9Sstevel@tonic-gate typedef struct {
173*7c478bd9Sstevel@tonic-gate 	caddr32_t	who;	/* Device to configure */
174*7c478bd9Sstevel@tonic-gate 	int		select;	/* Selects the component or dependent */
175*7c478bd9Sstevel@tonic-gate 				/* of the device */
176*7c478bd9Sstevel@tonic-gate 	int		level;	/* Power or threshold level */
177*7c478bd9Sstevel@tonic-gate 	caddr32_t	dependent;	/* Buffer to hold name of */
178*7c478bd9Sstevel@tonic-gate 					/* dependent */
179*7c478bd9Sstevel@tonic-gate 	size32_t	size;	/* Size of dependent buffer */
180*7c478bd9Sstevel@tonic-gate } pm_request32;
181*7c478bd9Sstevel@tonic-gate 
182*7c478bd9Sstevel@tonic-gate typedef struct pm_req32 {
183*7c478bd9Sstevel@tonic-gate 	caddr32_t physpath;	/* physical path of device to configure */
184*7c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
185*7c478bd9Sstevel@tonic-gate 	int	component;	/* selects the component of the device */
186*7c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
187*7c478bd9Sstevel@tonic-gate 	caddr32_t data;		/* command-dependent variable sized data */
188*7c478bd9Sstevel@tonic-gate 	size32_t datasize;	/* Size of data buffer */
189*7c478bd9Sstevel@tonic-gate } pm_req32_t;
190*7c478bd9Sstevel@tonic-gate 
191*7c478bd9Sstevel@tonic-gate typedef struct pm_state_change32 {
192*7c478bd9Sstevel@tonic-gate 	caddr32_t	physpath;	/* Device which has changed state */
193*7c478bd9Sstevel@tonic-gate 	int		component;	/* which component changed state */
194*7c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
195*7c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
196*7c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
197*7c478bd9Sstevel@tonic-gate #else
198*7c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
199*7c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
200*7c478bd9Sstevel@tonic-gate #endif
201*7c478bd9Sstevel@tonic-gate 	time32_t	timestamp;	/* time of state change */
202*7c478bd9Sstevel@tonic-gate 	int		old_level;	/* power level changing from */
203*7c478bd9Sstevel@tonic-gate 	int		new_level;	/* power level changing to */
204*7c478bd9Sstevel@tonic-gate 	size32_t	size;		/* size of buffer physpath points to */
205*7c478bd9Sstevel@tonic-gate } pm_state_change32_t;
206*7c478bd9Sstevel@tonic-gate 
207*7c478bd9Sstevel@tonic-gate #endif
208*7c478bd9Sstevel@tonic-gate 
209*7c478bd9Sstevel@tonic-gate /*
210*7c478bd9Sstevel@tonic-gate  * Return values from ioctl commands that return pm state info.
211*7c478bd9Sstevel@tonic-gate  */
212*7c478bd9Sstevel@tonic-gate 
213*7c478bd9Sstevel@tonic-gate typedef enum {
214*7c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_ENABLED,
215*7c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_DISABLED,
216*7c478bd9Sstevel@tonic-gate 	PM_NO_PM_COMPONENTS,
217*7c478bd9Sstevel@tonic-gate 	PM_CREATE_COMPONENTS,
218*7c478bd9Sstevel@tonic-gate 	PM_AUTOPM,
219*7c478bd9Sstevel@tonic-gate 	PM_DEFAULT_THRESHOLD,
220*7c478bd9Sstevel@tonic-gate 	PM_DEVICE_THRESHOLD,
221*7c478bd9Sstevel@tonic-gate 	PM_COMPONENT_THRESHOLD,
222*7c478bd9Sstevel@tonic-gate 	PM_OLD_THRESHOLD,
223*7c478bd9Sstevel@tonic-gate 	PM_DIRECTLY_MANAGED
224*7c478bd9Sstevel@tonic-gate } pm_states;
225*7c478bd9Sstevel@tonic-gate 
226*7c478bd9Sstevel@tonic-gate 
227*7c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
228*7c478bd9Sstevel@tonic-gate }
229*7c478bd9Sstevel@tonic-gate #endif
230*7c478bd9Sstevel@tonic-gate 
231*7c478bd9Sstevel@tonic-gate #endif	/* _SYS_PM_H */
232