xref: /titanic_53/usr/src/uts/common/sys/pm.h (revision 2df1fe9ca32bb227b9158c67f5c00b54c20b10fd)
17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * CDDL HEADER START
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5c42872d4Smh27603  * Common Development and Distribution License (the "License").
6c42872d4Smh27603  * You may not use this file except in compliance with the License.
77c478bd9Sstevel@tonic-gate  *
87c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
97c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
107c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
117c478bd9Sstevel@tonic-gate  * and limitations under the License.
127c478bd9Sstevel@tonic-gate  *
137c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
147c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
157c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
167c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
177c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
187c478bd9Sstevel@tonic-gate  *
197c478bd9Sstevel@tonic-gate  * CDDL HEADER END
207c478bd9Sstevel@tonic-gate  */
217c478bd9Sstevel@tonic-gate /*
22*2df1fe9cSrandyf  * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
237c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
247c478bd9Sstevel@tonic-gate  */
257c478bd9Sstevel@tonic-gate 
267c478bd9Sstevel@tonic-gate #ifndef	_SYS_PM_H
277c478bd9Sstevel@tonic-gate #define	_SYS_PM_H
287c478bd9Sstevel@tonic-gate 
297c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
307c478bd9Sstevel@tonic-gate 
317c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
327c478bd9Sstevel@tonic-gate extern "C" {
337c478bd9Sstevel@tonic-gate #endif
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #include <sys/types.h>
367c478bd9Sstevel@tonic-gate 
377c478bd9Sstevel@tonic-gate /*
387c478bd9Sstevel@tonic-gate  *	The following ioctls may not exist or may have a different
397c478bd9Sstevel@tonic-gate  *	interpretation in a future release.
407c478bd9Sstevel@tonic-gate  */
417c478bd9Sstevel@tonic-gate 
427c478bd9Sstevel@tonic-gate typedef enum {
437c478bd9Sstevel@tonic-gate 	PM_SCHEDULE,		/* obsolete, not supported */
447c478bd9Sstevel@tonic-gate 	PM_GET_IDLE_TIME,	/* obsolete, not supported  */
457c478bd9Sstevel@tonic-gate 	PM_GET_NUM_CMPTS,	/* obsolete, not supported */
467c478bd9Sstevel@tonic-gate 	PM_GET_THRESHOLD,	/* obsolete, not supported  */
477c478bd9Sstevel@tonic-gate 	PM_SET_THRESHOLD,	/* obsolete */
487c478bd9Sstevel@tonic-gate 	PM_GET_NORM_PWR,	/* obsolete */
497c478bd9Sstevel@tonic-gate 	PM_SET_CUR_PWR,		/* obsolete */
507c478bd9Sstevel@tonic-gate 	PM_GET_CUR_PWR,		/* obsolete */
517c478bd9Sstevel@tonic-gate 	PM_GET_NUM_DEPS,	/* obsolete, not supported */
527c478bd9Sstevel@tonic-gate 	PM_GET_DEP,		/* obsolete, not supported */
537c478bd9Sstevel@tonic-gate 	PM_ADD_DEP,		/* obsolete */
547c478bd9Sstevel@tonic-gate 	PM_REM_DEP,		/* obsolete, not supported */
557c478bd9Sstevel@tonic-gate 	PM_REM_DEVICE,		/* obsolete, not supported */
567c478bd9Sstevel@tonic-gate 	PM_REM_DEVICES,		/* obsolete */
577c478bd9Sstevel@tonic-gate 	PM_REPARSE_PM_PROPS,	/* used only by ddivs pm tests */
587c478bd9Sstevel@tonic-gate 	PM_DISABLE_AUTOPM,	/* obsolete */
597c478bd9Sstevel@tonic-gate 	PM_REENABLE_AUTOPM,	/* obsolete */
607c478bd9Sstevel@tonic-gate 	PM_SET_NORM_PWR,	/* obsolete, not supported */
617c478bd9Sstevel@tonic-gate 	PM_SET_DEVICE_THRESHOLD,
627c478bd9Sstevel@tonic-gate 	PM_GET_SYSTEM_THRESHOLD,
637c478bd9Sstevel@tonic-gate 	PM_SET_SYSTEM_THRESHOLD,
647c478bd9Sstevel@tonic-gate 	PM_START_PM,
657c478bd9Sstevel@tonic-gate 	PM_STOP_PM,
667c478bd9Sstevel@tonic-gate 	PM_RESET_PM,
677c478bd9Sstevel@tonic-gate 	PM_GET_STATS,
687c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD,
697c478bd9Sstevel@tonic-gate 	PM_GET_POWER_NAME,
707c478bd9Sstevel@tonic-gate 	PM_GET_POWER_LEVELS,
717c478bd9Sstevel@tonic-gate 	PM_GET_NUM_COMPONENTS,
727c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_NAME,
737c478bd9Sstevel@tonic-gate 	PM_GET_NUM_POWER_LEVELS,
747c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE,
757c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE_WAIT,
767c478bd9Sstevel@tonic-gate 	PM_DIRECT_PM,
777c478bd9Sstevel@tonic-gate 	PM_RELEASE_DIRECT_PM,
787c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY,
797c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY_WAIT,
807c478bd9Sstevel@tonic-gate 	PM_RESET_DEVICE_THRESHOLD,
817c478bd9Sstevel@tonic-gate 	PM_GET_PM_STATE,
827c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_TYPE,
837c478bd9Sstevel@tonic-gate 	PM_SET_COMPONENT_THRESHOLDS,
847c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_THRESHOLDS,
857c478bd9Sstevel@tonic-gate 	PM_IDLE_DOWN,
867c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD_BASIS,
877c478bd9Sstevel@tonic-gate 	PM_SET_CURRENT_POWER,	/* replaces PM_SET_CUR_PWR */
887c478bd9Sstevel@tonic-gate 	PM_GET_CURRENT_POWER,	/* replaces PM_GET_CUR_PWR */
897c478bd9Sstevel@tonic-gate 	PM_GET_FULL_POWER,	/* replaces PM_GET_NORM_PWR */
907c478bd9Sstevel@tonic-gate 	PM_ADD_DEPENDENT,	/* replaces PM_ADD_DEP */
917c478bd9Sstevel@tonic-gate 	PM_GET_TIME_IDLE,	/* replaces PM_IDLE_TIME */
927c478bd9Sstevel@tonic-gate 	PM_GET_DEFAULT_SYSTEM_THRESHOLD,
93c42872d4Smh27603 	PM_ADD_DEPENDENT_PROPERTY,
94c42872d4Smh27603 	PM_START_CPUPM,
95c42872d4Smh27603 	PM_STOP_CPUPM,
96c42872d4Smh27603 	PM_GET_CPU_THRESHOLD,
97c42872d4Smh27603 	PM_SET_CPU_THRESHOLD,
98*2df1fe9cSrandyf 	PM_GET_CPUPM_STATE,
99*2df1fe9cSrandyf 	PM_ENABLE_S3,		/* allow pm to go to S3 state */
100*2df1fe9cSrandyf 	PM_DISABLE_S3,		/* do not allow pm to go to S3 state */
101*2df1fe9cSrandyf 	PM_ENTER_S3,		/* obsolete, not supported */
102*2df1fe9cSrandyf 	PM_START_AUTOS3,
103*2df1fe9cSrandyf 	PM_STOP_AUTOS3,
104*2df1fe9cSrandyf 	PM_SEARCH_LIST,		/* search S3 enable/disable list */
105*2df1fe9cSrandyf 	PM_GET_AUTOS3_STATE,
106*2df1fe9cSrandyf 	PM_GET_S3_SUPPORT_STATE,
107*2df1fe9cSrandyf 	PM_GET_CMD_NAME
1087c478bd9Sstevel@tonic-gate } pm_cmds;
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate /*
1117c478bd9Sstevel@tonic-gate  * Old name for these ioctls.
1127c478bd9Sstevel@tonic-gate  */
1137c478bd9Sstevel@tonic-gate #define	PM_GET_POWER		PM_GET_NORM_PWR
1147c478bd9Sstevel@tonic-gate #define	PM_SET_POWER		PM_SET_CUR_PWR
1157c478bd9Sstevel@tonic-gate 
1167c478bd9Sstevel@tonic-gate /*
1177c478bd9Sstevel@tonic-gate  * This structure is obsolete and will be removed in a later release
1187c478bd9Sstevel@tonic-gate  */
1197c478bd9Sstevel@tonic-gate typedef struct {
1207c478bd9Sstevel@tonic-gate 	caddr_t	who;		/* Device to configure */
1217c478bd9Sstevel@tonic-gate 	int	select;		/* Selects the component or dependent */
1227c478bd9Sstevel@tonic-gate 				/* of the device */
1237c478bd9Sstevel@tonic-gate 	int	level;		/* Power or threshold level */
1247c478bd9Sstevel@tonic-gate 	caddr_t dependent;	/* Buffer to hold name of dependent */
1257c478bd9Sstevel@tonic-gate 	int	size;		/* Size of dependent buffer */
1267c478bd9Sstevel@tonic-gate } pm_request;
1277c478bd9Sstevel@tonic-gate 
1287c478bd9Sstevel@tonic-gate /*
1297c478bd9Sstevel@tonic-gate  * This is the new struct that replaces pm_request
1307c478bd9Sstevel@tonic-gate  */
1317c478bd9Sstevel@tonic-gate typedef struct pm_req {
1327c478bd9Sstevel@tonic-gate 	char	*physpath;	/* physical path of device to configure */
1337c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
1347c478bd9Sstevel@tonic-gate 	int	component;	/* Selects the component of the device */
1357c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
1367c478bd9Sstevel@tonic-gate 	void	*data;		/* command-dependent variable sized data */
1377c478bd9Sstevel@tonic-gate 	size_t	datasize;	/* Size of data buffer */
1387c478bd9Sstevel@tonic-gate } pm_req_t;
1397c478bd9Sstevel@tonic-gate 
1407c478bd9Sstevel@tonic-gate /*
141*2df1fe9cSrandyf  * PM_SEARCH_LIST requires a list name, manufacturer and product name
142*2df1fe9cSrandyf  * Searches the named list for a matching tuple.
143*2df1fe9cSrandyf  * NOTE: This structure may be removed in a later release.
144*2df1fe9cSrandyf  */
145*2df1fe9cSrandyf typedef struct pm_searchargs {
146*2df1fe9cSrandyf 	char	*pms_listname;		/* name of list to search */
147*2df1fe9cSrandyf 	char	*pms_manufacturer;	/* 1st elment of tuple */
148*2df1fe9cSrandyf 	char	*pms_product;		/* 2nd elment of tuple */
149*2df1fe9cSrandyf } pm_searchargs_t;
150*2df1fe9cSrandyf 
151*2df1fe9cSrandyf /*
1527c478bd9Sstevel@tonic-gate  * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY
1537c478bd9Sstevel@tonic-gate  */
1547c478bd9Sstevel@tonic-gate #define	pmreq_keeper	physpath	/* keeper in the physpath field */
1557c478bd9Sstevel@tonic-gate #define	pmreq_kept	data		/* kept in the data field */
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /*
1587c478bd9Sstevel@tonic-gate  * Possible values for the event field of pm_state_change below
1597c478bd9Sstevel@tonic-gate  */
1607c478bd9Sstevel@tonic-gate typedef enum {
1617c478bd9Sstevel@tonic-gate 	PSC_PENDING_CHANGE,	/* device needs to change, is blocked */
1627c478bd9Sstevel@tonic-gate 	PSC_HAS_CHANGED		/* device level has changed */
1637c478bd9Sstevel@tonic-gate } psc_events;
1647c478bd9Sstevel@tonic-gate 
1657c478bd9Sstevel@tonic-gate #define	PSC_EVENT_LOST	0x4000	/* buffer overrun */
1667c478bd9Sstevel@tonic-gate #define	PSC_ALL_LOWEST	0x8000	/* all devices at lowest power */
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate /*
1697c478bd9Sstevel@tonic-gate  * Special value for power level fields in pm_state_change below
1707c478bd9Sstevel@tonic-gate  */
1717c478bd9Sstevel@tonic-gate #define	PM_LEVEL_UNKNOWN	-1	/* power level is unknown */
1727c478bd9Sstevel@tonic-gate 
1737c478bd9Sstevel@tonic-gate typedef struct pm_state_change {
1747c478bd9Sstevel@tonic-gate 	caddr_t	physpath;	/* Device which has changed state */
1757c478bd9Sstevel@tonic-gate 	int	component;	/* which component changed state */
1767c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
1777c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1787c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1797c478bd9Sstevel@tonic-gate #else
1807c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1817c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1827c478bd9Sstevel@tonic-gate #endif
1837c478bd9Sstevel@tonic-gate 	time_t	timestamp;	/* time of state change */
1847c478bd9Sstevel@tonic-gate 	int	old_level;	/* power level changing from */
1857c478bd9Sstevel@tonic-gate 	int	new_level;	/* power level changing to */
1867c478bd9Sstevel@tonic-gate 	size_t	size;		/* size of buffer physpath points to */
1877c478bd9Sstevel@tonic-gate } pm_state_change_t;
1887c478bd9Sstevel@tonic-gate 
1897c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
1907c478bd9Sstevel@tonic-gate 
1917c478bd9Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */
1927c478bd9Sstevel@tonic-gate 
1937c478bd9Sstevel@tonic-gate /*
1947c478bd9Sstevel@tonic-gate  * This struct is obsolete and will be removed in a later release
1957c478bd9Sstevel@tonic-gate  */
1967c478bd9Sstevel@tonic-gate typedef struct {
1977c478bd9Sstevel@tonic-gate 	caddr32_t	who;	/* Device to configure */
1987c478bd9Sstevel@tonic-gate 	int		select;	/* Selects the component or dependent */
1997c478bd9Sstevel@tonic-gate 				/* of the device */
2007c478bd9Sstevel@tonic-gate 	int		level;	/* Power or threshold level */
2017c478bd9Sstevel@tonic-gate 	caddr32_t	dependent;	/* Buffer to hold name of */
2027c478bd9Sstevel@tonic-gate 					/* dependent */
2037c478bd9Sstevel@tonic-gate 	size32_t	size;	/* Size of dependent buffer */
2047c478bd9Sstevel@tonic-gate } pm_request32;
2057c478bd9Sstevel@tonic-gate 
2067c478bd9Sstevel@tonic-gate typedef struct pm_req32 {
2077c478bd9Sstevel@tonic-gate 	caddr32_t physpath;	/* physical path of device to configure */
2087c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
2097c478bd9Sstevel@tonic-gate 	int	component;	/* selects the component of the device */
2107c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
2117c478bd9Sstevel@tonic-gate 	caddr32_t data;		/* command-dependent variable sized data */
2127c478bd9Sstevel@tonic-gate 	size32_t datasize;	/* Size of data buffer */
2137c478bd9Sstevel@tonic-gate } pm_req32_t;
2147c478bd9Sstevel@tonic-gate 
2157c478bd9Sstevel@tonic-gate typedef struct pm_state_change32 {
2167c478bd9Sstevel@tonic-gate 	caddr32_t	physpath;	/* Device which has changed state */
2177c478bd9Sstevel@tonic-gate 	int		component;	/* which component changed state */
2187c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
2197c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2207c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2217c478bd9Sstevel@tonic-gate #else
2227c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2237c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2247c478bd9Sstevel@tonic-gate #endif
2257c478bd9Sstevel@tonic-gate 	time32_t	timestamp;	/* time of state change */
2267c478bd9Sstevel@tonic-gate 	int		old_level;	/* power level changing from */
2277c478bd9Sstevel@tonic-gate 	int		new_level;	/* power level changing to */
2287c478bd9Sstevel@tonic-gate 	size32_t	size;		/* size of buffer physpath points to */
2297c478bd9Sstevel@tonic-gate } pm_state_change32_t;
2307c478bd9Sstevel@tonic-gate 
231*2df1fe9cSrandyf typedef	struct pm_searchargs32_t {
232*2df1fe9cSrandyf 	caddr32_t	pms_listname;
233*2df1fe9cSrandyf 	caddr32_t	pms_manufacturer;
234*2df1fe9cSrandyf 	caddr32_t	pms_product;
235*2df1fe9cSrandyf } pm_searchargs32_t;
236*2df1fe9cSrandyf 
237*2df1fe9cSrandyf 
2387c478bd9Sstevel@tonic-gate #endif
2397c478bd9Sstevel@tonic-gate 
2407c478bd9Sstevel@tonic-gate /*
2417c478bd9Sstevel@tonic-gate  * Return values from ioctl commands that return pm state info.
2427c478bd9Sstevel@tonic-gate  */
2437c478bd9Sstevel@tonic-gate 
2447c478bd9Sstevel@tonic-gate typedef enum {
2457c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_ENABLED,
2467c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_DISABLED,
2477c478bd9Sstevel@tonic-gate 	PM_NO_PM_COMPONENTS,
2487c478bd9Sstevel@tonic-gate 	PM_CREATE_COMPONENTS,
2497c478bd9Sstevel@tonic-gate 	PM_AUTOPM,
2507c478bd9Sstevel@tonic-gate 	PM_DEFAULT_THRESHOLD,
2517c478bd9Sstevel@tonic-gate 	PM_DEVICE_THRESHOLD,
2527c478bd9Sstevel@tonic-gate 	PM_COMPONENT_THRESHOLD,
2537c478bd9Sstevel@tonic-gate 	PM_OLD_THRESHOLD,
254c42872d4Smh27603 	PM_DIRECTLY_MANAGED,
255c42872d4Smh27603 	PM_CPU_THRESHOLD,
256c42872d4Smh27603 	PM_CPU_PM_ENABLED,
257c42872d4Smh27603 	PM_CPU_PM_DISABLED,
258*2df1fe9cSrandyf 	PM_CPU_PM_NOTSET,
259*2df1fe9cSrandyf 	PM_AUTOS3_ENABLED,
260*2df1fe9cSrandyf 	PM_AUTOS3_DISABLED,
261*2df1fe9cSrandyf 	PM_S3_SUPPORT_ENABLED,
262*2df1fe9cSrandyf 	PM_S3_SUPPORT_DISABLED
2637c478bd9Sstevel@tonic-gate } pm_states;
2647c478bd9Sstevel@tonic-gate 
2657c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2667c478bd9Sstevel@tonic-gate }
2677c478bd9Sstevel@tonic-gate #endif
2687c478bd9Sstevel@tonic-gate 
2697c478bd9Sstevel@tonic-gate #endif	/* _SYS_PM_H */
270