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