xref: /onnv-gate/usr/src/uts/common/sys/pm.h (revision 3028:ecc075a2fc74)
10Sstevel@tonic-gate /*
20Sstevel@tonic-gate  * CDDL HEADER START
30Sstevel@tonic-gate  *
40Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*3028Smh27603  * Common Development and Distribution License (the "License").
6*3028Smh27603  * You may not use this file except in compliance with the License.
70Sstevel@tonic-gate  *
80Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
90Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
100Sstevel@tonic-gate  * See the License for the specific language governing permissions
110Sstevel@tonic-gate  * and limitations under the License.
120Sstevel@tonic-gate  *
130Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
140Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
150Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
160Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
170Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
180Sstevel@tonic-gate  *
190Sstevel@tonic-gate  * CDDL HEADER END
200Sstevel@tonic-gate  */
210Sstevel@tonic-gate /*
22*3028Smh27603  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
230Sstevel@tonic-gate  * Use is subject to license terms.
240Sstevel@tonic-gate  */
250Sstevel@tonic-gate 
260Sstevel@tonic-gate #ifndef	_SYS_PM_H
270Sstevel@tonic-gate #define	_SYS_PM_H
280Sstevel@tonic-gate 
290Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
300Sstevel@tonic-gate 
310Sstevel@tonic-gate #ifdef	__cplusplus
320Sstevel@tonic-gate extern "C" {
330Sstevel@tonic-gate #endif
340Sstevel@tonic-gate 
350Sstevel@tonic-gate #include <sys/types.h>
360Sstevel@tonic-gate 
370Sstevel@tonic-gate /*
380Sstevel@tonic-gate  *	The following ioctls may not exist or may have a different
390Sstevel@tonic-gate  *	interpretation in a future release.
400Sstevel@tonic-gate  */
410Sstevel@tonic-gate 
420Sstevel@tonic-gate typedef enum {
430Sstevel@tonic-gate 	PM_SCHEDULE,		/* obsolete, not supported */
440Sstevel@tonic-gate 	PM_GET_IDLE_TIME,	/* obsolete, not supported  */
450Sstevel@tonic-gate 	PM_GET_NUM_CMPTS,	/* obsolete, not supported */
460Sstevel@tonic-gate 	PM_GET_THRESHOLD,	/* obsolete, not supported  */
470Sstevel@tonic-gate 	PM_SET_THRESHOLD,	/* obsolete */
480Sstevel@tonic-gate 	PM_GET_NORM_PWR,	/* obsolete */
490Sstevel@tonic-gate 	PM_SET_CUR_PWR,		/* obsolete */
500Sstevel@tonic-gate 	PM_GET_CUR_PWR,		/* obsolete */
510Sstevel@tonic-gate 	PM_GET_NUM_DEPS,	/* obsolete, not supported */
520Sstevel@tonic-gate 	PM_GET_DEP,		/* obsolete, not supported */
530Sstevel@tonic-gate 	PM_ADD_DEP,		/* obsolete */
540Sstevel@tonic-gate 	PM_REM_DEP,		/* obsolete, not supported */
550Sstevel@tonic-gate 	PM_REM_DEVICE,		/* obsolete, not supported */
560Sstevel@tonic-gate 	PM_REM_DEVICES,		/* obsolete */
570Sstevel@tonic-gate 	PM_REPARSE_PM_PROPS,	/* used only by ddivs pm tests */
580Sstevel@tonic-gate 	PM_DISABLE_AUTOPM,	/* obsolete */
590Sstevel@tonic-gate 	PM_REENABLE_AUTOPM,	/* obsolete */
600Sstevel@tonic-gate 	PM_SET_NORM_PWR,	/* obsolete, not supported */
610Sstevel@tonic-gate 	PM_SET_DEVICE_THRESHOLD,
620Sstevel@tonic-gate 	PM_GET_SYSTEM_THRESHOLD,
630Sstevel@tonic-gate 	PM_SET_SYSTEM_THRESHOLD,
640Sstevel@tonic-gate 	PM_START_PM,
650Sstevel@tonic-gate 	PM_STOP_PM,
660Sstevel@tonic-gate 	PM_RESET_PM,
670Sstevel@tonic-gate 	PM_GET_STATS,
680Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD,
690Sstevel@tonic-gate 	PM_GET_POWER_NAME,
700Sstevel@tonic-gate 	PM_GET_POWER_LEVELS,
710Sstevel@tonic-gate 	PM_GET_NUM_COMPONENTS,
720Sstevel@tonic-gate 	PM_GET_COMPONENT_NAME,
730Sstevel@tonic-gate 	PM_GET_NUM_POWER_LEVELS,
740Sstevel@tonic-gate 	PM_GET_STATE_CHANGE,
750Sstevel@tonic-gate 	PM_GET_STATE_CHANGE_WAIT,
760Sstevel@tonic-gate 	PM_DIRECT_PM,
770Sstevel@tonic-gate 	PM_RELEASE_DIRECT_PM,
780Sstevel@tonic-gate 	PM_DIRECT_NOTIFY,
790Sstevel@tonic-gate 	PM_DIRECT_NOTIFY_WAIT,
800Sstevel@tonic-gate 	PM_RESET_DEVICE_THRESHOLD,
810Sstevel@tonic-gate 	PM_GET_PM_STATE,
820Sstevel@tonic-gate 	PM_GET_DEVICE_TYPE,
830Sstevel@tonic-gate 	PM_SET_COMPONENT_THRESHOLDS,
840Sstevel@tonic-gate 	PM_GET_COMPONENT_THRESHOLDS,
850Sstevel@tonic-gate 	PM_IDLE_DOWN,
860Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD_BASIS,
870Sstevel@tonic-gate 	PM_SET_CURRENT_POWER,	/* replaces PM_SET_CUR_PWR */
880Sstevel@tonic-gate 	PM_GET_CURRENT_POWER,	/* replaces PM_GET_CUR_PWR */
890Sstevel@tonic-gate 	PM_GET_FULL_POWER,	/* replaces PM_GET_NORM_PWR */
900Sstevel@tonic-gate 	PM_ADD_DEPENDENT,	/* replaces PM_ADD_DEP */
910Sstevel@tonic-gate 	PM_GET_TIME_IDLE,	/* replaces PM_IDLE_TIME */
920Sstevel@tonic-gate 	PM_GET_DEFAULT_SYSTEM_THRESHOLD,
93*3028Smh27603 	PM_ADD_DEPENDENT_PROPERTY,
94*3028Smh27603 	PM_START_CPUPM,
95*3028Smh27603 	PM_STOP_CPUPM,
96*3028Smh27603 	PM_GET_CPU_THRESHOLD,
97*3028Smh27603 	PM_SET_CPU_THRESHOLD,
98*3028Smh27603 	PM_GET_CPUPM_STATE
990Sstevel@tonic-gate } pm_cmds;
1000Sstevel@tonic-gate 
1010Sstevel@tonic-gate /*
1020Sstevel@tonic-gate  * Old name for these ioctls.
1030Sstevel@tonic-gate  */
1040Sstevel@tonic-gate #define	PM_GET_POWER		PM_GET_NORM_PWR
1050Sstevel@tonic-gate #define	PM_SET_POWER		PM_SET_CUR_PWR
1060Sstevel@tonic-gate 
1070Sstevel@tonic-gate /*
1080Sstevel@tonic-gate  * This structure is obsolete and will be removed in a later release
1090Sstevel@tonic-gate  */
1100Sstevel@tonic-gate typedef struct {
1110Sstevel@tonic-gate 	caddr_t	who;		/* Device to configure */
1120Sstevel@tonic-gate 	int	select;		/* Selects the component or dependent */
1130Sstevel@tonic-gate 				/* of the device */
1140Sstevel@tonic-gate 	int	level;		/* Power or threshold level */
1150Sstevel@tonic-gate 	caddr_t dependent;	/* Buffer to hold name of dependent */
1160Sstevel@tonic-gate 	int	size;		/* Size of dependent buffer */
1170Sstevel@tonic-gate } pm_request;
1180Sstevel@tonic-gate 
1190Sstevel@tonic-gate /*
1200Sstevel@tonic-gate  * This is the new struct that replaces pm_request
1210Sstevel@tonic-gate  */
1220Sstevel@tonic-gate typedef struct pm_req {
1230Sstevel@tonic-gate 	char	*physpath;	/* physical path of device to configure */
1240Sstevel@tonic-gate 				/* see libdevinfo(3) */
1250Sstevel@tonic-gate 	int	component;	/* Selects the component of the device */
1260Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
1270Sstevel@tonic-gate 	void	*data;		/* command-dependent variable sized data */
1280Sstevel@tonic-gate 	size_t	datasize;	/* Size of data buffer */
1290Sstevel@tonic-gate } pm_req_t;
1300Sstevel@tonic-gate 
1310Sstevel@tonic-gate /*
1320Sstevel@tonic-gate  * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY
1330Sstevel@tonic-gate  */
1340Sstevel@tonic-gate #define	pmreq_keeper	physpath	/* keeper in the physpath field */
1350Sstevel@tonic-gate #define	pmreq_kept	data		/* kept in the data field */
1360Sstevel@tonic-gate 
1370Sstevel@tonic-gate /*
1380Sstevel@tonic-gate  * Possible values for the event field of pm_state_change below
1390Sstevel@tonic-gate  */
1400Sstevel@tonic-gate typedef enum {
1410Sstevel@tonic-gate 	PSC_PENDING_CHANGE,	/* device needs to change, is blocked */
1420Sstevel@tonic-gate 	PSC_HAS_CHANGED		/* device level has changed */
1430Sstevel@tonic-gate } psc_events;
1440Sstevel@tonic-gate 
1450Sstevel@tonic-gate #define	PSC_EVENT_LOST	0x4000	/* buffer overrun */
1460Sstevel@tonic-gate #define	PSC_ALL_LOWEST	0x8000	/* all devices at lowest power */
1470Sstevel@tonic-gate 
1480Sstevel@tonic-gate /*
1490Sstevel@tonic-gate  * Special value for power level fields in pm_state_change below
1500Sstevel@tonic-gate  */
1510Sstevel@tonic-gate #define	PM_LEVEL_UNKNOWN	-1	/* power level is unknown */
1520Sstevel@tonic-gate 
1530Sstevel@tonic-gate typedef struct pm_state_change {
1540Sstevel@tonic-gate 	caddr_t	physpath;	/* Device which has changed state */
1550Sstevel@tonic-gate 	int	component;	/* which component changed state */
1560Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
1570Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1580Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1590Sstevel@tonic-gate #else
1600Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1610Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1620Sstevel@tonic-gate #endif
1630Sstevel@tonic-gate 	time_t	timestamp;	/* time of state change */
1640Sstevel@tonic-gate 	int	old_level;	/* power level changing from */
1650Sstevel@tonic-gate 	int	new_level;	/* power level changing to */
1660Sstevel@tonic-gate 	size_t	size;		/* size of buffer physpath points to */
1670Sstevel@tonic-gate } pm_state_change_t;
1680Sstevel@tonic-gate 
1690Sstevel@tonic-gate #ifdef _SYSCALL32
1700Sstevel@tonic-gate 
1710Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */
1720Sstevel@tonic-gate 
1730Sstevel@tonic-gate /*
1740Sstevel@tonic-gate  * This struct is obsolete and will be removed in a later release
1750Sstevel@tonic-gate  */
1760Sstevel@tonic-gate typedef struct {
1770Sstevel@tonic-gate 	caddr32_t	who;	/* Device to configure */
1780Sstevel@tonic-gate 	int		select;	/* Selects the component or dependent */
1790Sstevel@tonic-gate 				/* of the device */
1800Sstevel@tonic-gate 	int		level;	/* Power or threshold level */
1810Sstevel@tonic-gate 	caddr32_t	dependent;	/* Buffer to hold name of */
1820Sstevel@tonic-gate 					/* dependent */
1830Sstevel@tonic-gate 	size32_t	size;	/* Size of dependent buffer */
1840Sstevel@tonic-gate } pm_request32;
1850Sstevel@tonic-gate 
1860Sstevel@tonic-gate typedef struct pm_req32 {
1870Sstevel@tonic-gate 	caddr32_t physpath;	/* physical path of device to configure */
1880Sstevel@tonic-gate 				/* see libdevinfo(3) */
1890Sstevel@tonic-gate 	int	component;	/* selects the component of the device */
1900Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
1910Sstevel@tonic-gate 	caddr32_t data;		/* command-dependent variable sized data */
1920Sstevel@tonic-gate 	size32_t datasize;	/* Size of data buffer */
1930Sstevel@tonic-gate } pm_req32_t;
1940Sstevel@tonic-gate 
1950Sstevel@tonic-gate typedef struct pm_state_change32 {
1960Sstevel@tonic-gate 	caddr32_t	physpath;	/* Device which has changed state */
1970Sstevel@tonic-gate 	int		component;	/* which component changed state */
1980Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
1990Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2000Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2010Sstevel@tonic-gate #else
2020Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2030Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2040Sstevel@tonic-gate #endif
2050Sstevel@tonic-gate 	time32_t	timestamp;	/* time of state change */
2060Sstevel@tonic-gate 	int		old_level;	/* power level changing from */
2070Sstevel@tonic-gate 	int		new_level;	/* power level changing to */
2080Sstevel@tonic-gate 	size32_t	size;		/* size of buffer physpath points to */
2090Sstevel@tonic-gate } pm_state_change32_t;
2100Sstevel@tonic-gate 
2110Sstevel@tonic-gate #endif
2120Sstevel@tonic-gate 
2130Sstevel@tonic-gate /*
2140Sstevel@tonic-gate  * Return values from ioctl commands that return pm state info.
2150Sstevel@tonic-gate  */
2160Sstevel@tonic-gate 
2170Sstevel@tonic-gate typedef enum {
2180Sstevel@tonic-gate 	PM_SYSTEM_PM_ENABLED,
2190Sstevel@tonic-gate 	PM_SYSTEM_PM_DISABLED,
2200Sstevel@tonic-gate 	PM_NO_PM_COMPONENTS,
2210Sstevel@tonic-gate 	PM_CREATE_COMPONENTS,
2220Sstevel@tonic-gate 	PM_AUTOPM,
2230Sstevel@tonic-gate 	PM_DEFAULT_THRESHOLD,
2240Sstevel@tonic-gate 	PM_DEVICE_THRESHOLD,
2250Sstevel@tonic-gate 	PM_COMPONENT_THRESHOLD,
2260Sstevel@tonic-gate 	PM_OLD_THRESHOLD,
227*3028Smh27603 	PM_DIRECTLY_MANAGED,
228*3028Smh27603 	PM_CPU_THRESHOLD,
229*3028Smh27603 	PM_CPU_PM_ENABLED,
230*3028Smh27603 	PM_CPU_PM_DISABLED,
231*3028Smh27603 	PM_CPU_PM_NOTSET
2320Sstevel@tonic-gate } pm_states;
2330Sstevel@tonic-gate 
2340Sstevel@tonic-gate 
2350Sstevel@tonic-gate #ifdef	__cplusplus
2360Sstevel@tonic-gate }
2370Sstevel@tonic-gate #endif
2380Sstevel@tonic-gate 
2390Sstevel@tonic-gate #endif	/* _SYS_PM_H */
240