xref: /titanic_50/usr/src/uts/common/sys/pm.h (revision 0e7515250c8395f368aa45fb9acae7c4f8f8b786)
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*0e751525SEric Saxe  * Copyright 2009 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 #ifdef	__cplusplus
307c478bd9Sstevel@tonic-gate extern "C" {
317c478bd9Sstevel@tonic-gate #endif
327c478bd9Sstevel@tonic-gate 
337c478bd9Sstevel@tonic-gate #include <sys/types.h>
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  *	The following ioctls may not exist or may have a different
377c478bd9Sstevel@tonic-gate  *	interpretation in a future release.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate typedef enum {
417c478bd9Sstevel@tonic-gate 	PM_SCHEDULE,		/* obsolete, not supported */
427c478bd9Sstevel@tonic-gate 	PM_GET_IDLE_TIME,	/* obsolete, not supported  */
437c478bd9Sstevel@tonic-gate 	PM_GET_NUM_CMPTS,	/* obsolete, not supported */
447c478bd9Sstevel@tonic-gate 	PM_GET_THRESHOLD,	/* obsolete, not supported  */
457c478bd9Sstevel@tonic-gate 	PM_SET_THRESHOLD,	/* obsolete */
467c478bd9Sstevel@tonic-gate 	PM_GET_NORM_PWR,	/* obsolete */
477c478bd9Sstevel@tonic-gate 	PM_SET_CUR_PWR,		/* obsolete */
487c478bd9Sstevel@tonic-gate 	PM_GET_CUR_PWR,		/* obsolete */
497c478bd9Sstevel@tonic-gate 	PM_GET_NUM_DEPS,	/* obsolete, not supported */
507c478bd9Sstevel@tonic-gate 	PM_GET_DEP,		/* obsolete, not supported */
517c478bd9Sstevel@tonic-gate 	PM_ADD_DEP,		/* obsolete */
527c478bd9Sstevel@tonic-gate 	PM_REM_DEP,		/* obsolete, not supported */
537c478bd9Sstevel@tonic-gate 	PM_REM_DEVICE,		/* obsolete, not supported */
547c478bd9Sstevel@tonic-gate 	PM_REM_DEVICES,		/* obsolete */
557c478bd9Sstevel@tonic-gate 	PM_REPARSE_PM_PROPS,	/* used only by ddivs pm tests */
567c478bd9Sstevel@tonic-gate 	PM_DISABLE_AUTOPM,	/* obsolete */
577c478bd9Sstevel@tonic-gate 	PM_REENABLE_AUTOPM,	/* obsolete */
587c478bd9Sstevel@tonic-gate 	PM_SET_NORM_PWR,	/* obsolete, not supported */
597c478bd9Sstevel@tonic-gate 	PM_SET_DEVICE_THRESHOLD,
607c478bd9Sstevel@tonic-gate 	PM_GET_SYSTEM_THRESHOLD,
617c478bd9Sstevel@tonic-gate 	PM_SET_SYSTEM_THRESHOLD,
627c478bd9Sstevel@tonic-gate 	PM_START_PM,
637c478bd9Sstevel@tonic-gate 	PM_STOP_PM,
647c478bd9Sstevel@tonic-gate 	PM_RESET_PM,
657c478bd9Sstevel@tonic-gate 	PM_GET_STATS,
667c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD,
677c478bd9Sstevel@tonic-gate 	PM_GET_POWER_NAME,
687c478bd9Sstevel@tonic-gate 	PM_GET_POWER_LEVELS,
697c478bd9Sstevel@tonic-gate 	PM_GET_NUM_COMPONENTS,
707c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_NAME,
717c478bd9Sstevel@tonic-gate 	PM_GET_NUM_POWER_LEVELS,
727c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE,
737c478bd9Sstevel@tonic-gate 	PM_GET_STATE_CHANGE_WAIT,
747c478bd9Sstevel@tonic-gate 	PM_DIRECT_PM,
757c478bd9Sstevel@tonic-gate 	PM_RELEASE_DIRECT_PM,
767c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY,
777c478bd9Sstevel@tonic-gate 	PM_DIRECT_NOTIFY_WAIT,
787c478bd9Sstevel@tonic-gate 	PM_RESET_DEVICE_THRESHOLD,
797c478bd9Sstevel@tonic-gate 	PM_GET_PM_STATE,
807c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_TYPE,
817c478bd9Sstevel@tonic-gate 	PM_SET_COMPONENT_THRESHOLDS,
827c478bd9Sstevel@tonic-gate 	PM_GET_COMPONENT_THRESHOLDS,
837c478bd9Sstevel@tonic-gate 	PM_IDLE_DOWN,
847c478bd9Sstevel@tonic-gate 	PM_GET_DEVICE_THRESHOLD_BASIS,
857c478bd9Sstevel@tonic-gate 	PM_SET_CURRENT_POWER,	/* replaces PM_SET_CUR_PWR */
867c478bd9Sstevel@tonic-gate 	PM_GET_CURRENT_POWER,	/* replaces PM_GET_CUR_PWR */
877c478bd9Sstevel@tonic-gate 	PM_GET_FULL_POWER,	/* replaces PM_GET_NORM_PWR */
887c478bd9Sstevel@tonic-gate 	PM_ADD_DEPENDENT,	/* replaces PM_ADD_DEP */
897c478bd9Sstevel@tonic-gate 	PM_GET_TIME_IDLE,	/* replaces PM_IDLE_TIME */
907c478bd9Sstevel@tonic-gate 	PM_GET_DEFAULT_SYSTEM_THRESHOLD,
91c42872d4Smh27603 	PM_ADD_DEPENDENT_PROPERTY,
92c42872d4Smh27603 	PM_START_CPUPM,
93*0e751525SEric Saxe 	PM_START_CPUPM_EV,
94*0e751525SEric Saxe 	PM_START_CPUPM_POLL,
95c42872d4Smh27603 	PM_STOP_CPUPM,
96c42872d4Smh27603 	PM_GET_CPU_THRESHOLD,
97c42872d4Smh27603 	PM_SET_CPU_THRESHOLD,
982df1fe9cSrandyf 	PM_GET_CPUPM_STATE,
992df1fe9cSrandyf 	PM_ENABLE_S3,		/* allow pm to go to S3 state */
1002df1fe9cSrandyf 	PM_DISABLE_S3,		/* do not allow pm to go to S3 state */
1012df1fe9cSrandyf 	PM_ENTER_S3,		/* obsolete, not supported */
1022df1fe9cSrandyf 	PM_START_AUTOS3,
1032df1fe9cSrandyf 	PM_STOP_AUTOS3,
1042df1fe9cSrandyf 	PM_SEARCH_LIST,		/* search S3 enable/disable list */
1052df1fe9cSrandyf 	PM_GET_AUTOS3_STATE,
1062df1fe9cSrandyf 	PM_GET_S3_SUPPORT_STATE,
107*0e751525SEric Saxe 	PM_GET_CMD_NAME,
108*0e751525SEric Saxe 	PM_DISABLE_CPU_DEEP_IDLE,
109*0e751525SEric Saxe 	PM_ENABLE_CPU_DEEP_IDLE,
110*0e751525SEric Saxe 	PM_DEFAULT_CPU_DEEP_IDLE
1117c478bd9Sstevel@tonic-gate } pm_cmds;
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate /*
1147c478bd9Sstevel@tonic-gate  * Old name for these ioctls.
1157c478bd9Sstevel@tonic-gate  */
1167c478bd9Sstevel@tonic-gate #define	PM_GET_POWER		PM_GET_NORM_PWR
1177c478bd9Sstevel@tonic-gate #define	PM_SET_POWER		PM_SET_CUR_PWR
1187c478bd9Sstevel@tonic-gate 
1197c478bd9Sstevel@tonic-gate /*
1207c478bd9Sstevel@tonic-gate  * This structure is obsolete and will be removed in a later release
1217c478bd9Sstevel@tonic-gate  */
1227c478bd9Sstevel@tonic-gate typedef struct {
1237c478bd9Sstevel@tonic-gate 	caddr_t	who;		/* Device to configure */
1247c478bd9Sstevel@tonic-gate 	int	select;		/* Selects the component or dependent */
1257c478bd9Sstevel@tonic-gate 				/* of the device */
1267c478bd9Sstevel@tonic-gate 	int	level;		/* Power or threshold level */
1277c478bd9Sstevel@tonic-gate 	caddr_t dependent;	/* Buffer to hold name of dependent */
1287c478bd9Sstevel@tonic-gate 	int	size;		/* Size of dependent buffer */
1297c478bd9Sstevel@tonic-gate } pm_request;
1307c478bd9Sstevel@tonic-gate 
1317c478bd9Sstevel@tonic-gate /*
1327c478bd9Sstevel@tonic-gate  * This is the new struct that replaces pm_request
1337c478bd9Sstevel@tonic-gate  */
1347c478bd9Sstevel@tonic-gate typedef struct pm_req {
1357c478bd9Sstevel@tonic-gate 	char	*physpath;	/* physical path of device to configure */
1367c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
1377c478bd9Sstevel@tonic-gate 	int	component;	/* Selects the component of the device */
1387c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
1397c478bd9Sstevel@tonic-gate 	void	*data;		/* command-dependent variable sized data */
1407c478bd9Sstevel@tonic-gate 	size_t	datasize;	/* Size of data buffer */
1417c478bd9Sstevel@tonic-gate } pm_req_t;
1427c478bd9Sstevel@tonic-gate 
1437c478bd9Sstevel@tonic-gate /*
1442df1fe9cSrandyf  * PM_SEARCH_LIST requires a list name, manufacturer and product name
1452df1fe9cSrandyf  * Searches the named list for a matching tuple.
1462df1fe9cSrandyf  * NOTE: This structure may be removed in a later release.
1472df1fe9cSrandyf  */
1482df1fe9cSrandyf typedef struct pm_searchargs {
1492df1fe9cSrandyf 	char	*pms_listname;		/* name of list to search */
1502df1fe9cSrandyf 	char	*pms_manufacturer;	/* 1st elment of tuple */
1512df1fe9cSrandyf 	char	*pms_product;		/* 2nd elment of tuple */
1522df1fe9cSrandyf } pm_searchargs_t;
1532df1fe9cSrandyf 
1542df1fe9cSrandyf /*
1557c478bd9Sstevel@tonic-gate  * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY
1567c478bd9Sstevel@tonic-gate  */
1577c478bd9Sstevel@tonic-gate #define	pmreq_keeper	physpath	/* keeper in the physpath field */
1587c478bd9Sstevel@tonic-gate #define	pmreq_kept	data		/* kept in the data field */
1597c478bd9Sstevel@tonic-gate 
1607c478bd9Sstevel@tonic-gate /*
1617c478bd9Sstevel@tonic-gate  * Possible values for the event field of pm_state_change below
1627c478bd9Sstevel@tonic-gate  */
1637c478bd9Sstevel@tonic-gate typedef enum {
1647c478bd9Sstevel@tonic-gate 	PSC_PENDING_CHANGE,	/* device needs to change, is blocked */
1657c478bd9Sstevel@tonic-gate 	PSC_HAS_CHANGED		/* device level has changed */
1667c478bd9Sstevel@tonic-gate } psc_events;
1677c478bd9Sstevel@tonic-gate 
1687c478bd9Sstevel@tonic-gate #define	PSC_EVENT_LOST	0x4000	/* buffer overrun */
1697c478bd9Sstevel@tonic-gate #define	PSC_ALL_LOWEST	0x8000	/* all devices at lowest power */
1707c478bd9Sstevel@tonic-gate 
1717c478bd9Sstevel@tonic-gate /*
1727c478bd9Sstevel@tonic-gate  * Special value for power level fields in pm_state_change below
1737c478bd9Sstevel@tonic-gate  */
1747c478bd9Sstevel@tonic-gate #define	PM_LEVEL_UNKNOWN	-1	/* power level is unknown */
1757c478bd9Sstevel@tonic-gate 
1767c478bd9Sstevel@tonic-gate typedef struct pm_state_change {
1777c478bd9Sstevel@tonic-gate 	caddr_t	physpath;	/* Device which has changed state */
1787c478bd9Sstevel@tonic-gate 	int	component;	/* which component changed state */
1797c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
1807c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1817c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1827c478bd9Sstevel@tonic-gate #else
1837c478bd9Sstevel@tonic-gate 	ushort_t event;		/* type of event */
1847c478bd9Sstevel@tonic-gate 	ushort_t flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
1857c478bd9Sstevel@tonic-gate #endif
1867c478bd9Sstevel@tonic-gate 	time_t	timestamp;	/* time of state change */
1877c478bd9Sstevel@tonic-gate 	int	old_level;	/* power level changing from */
1887c478bd9Sstevel@tonic-gate 	int	new_level;	/* power level changing to */
1897c478bd9Sstevel@tonic-gate 	size_t	size;		/* size of buffer physpath points to */
1907c478bd9Sstevel@tonic-gate } pm_state_change_t;
1917c478bd9Sstevel@tonic-gate 
1927c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32
1937c478bd9Sstevel@tonic-gate 
1947c478bd9Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */
1957c478bd9Sstevel@tonic-gate 
1967c478bd9Sstevel@tonic-gate /*
1977c478bd9Sstevel@tonic-gate  * This struct is obsolete and will be removed in a later release
1987c478bd9Sstevel@tonic-gate  */
1997c478bd9Sstevel@tonic-gate typedef struct {
2007c478bd9Sstevel@tonic-gate 	caddr32_t	who;	/* Device to configure */
2017c478bd9Sstevel@tonic-gate 	int		select;	/* Selects the component or dependent */
2027c478bd9Sstevel@tonic-gate 				/* of the device */
2037c478bd9Sstevel@tonic-gate 	int		level;	/* Power or threshold level */
2047c478bd9Sstevel@tonic-gate 	caddr32_t	dependent;	/* Buffer to hold name of */
2057c478bd9Sstevel@tonic-gate 					/* dependent */
2067c478bd9Sstevel@tonic-gate 	size32_t	size;	/* Size of dependent buffer */
2077c478bd9Sstevel@tonic-gate } pm_request32;
2087c478bd9Sstevel@tonic-gate 
2097c478bd9Sstevel@tonic-gate typedef struct pm_req32 {
2107c478bd9Sstevel@tonic-gate 	caddr32_t physpath;	/* physical path of device to configure */
2117c478bd9Sstevel@tonic-gate 				/* see libdevinfo(3) */
2127c478bd9Sstevel@tonic-gate 	int	component;	/* selects the component of the device */
2137c478bd9Sstevel@tonic-gate 	int	value;		/* power level, threshold value, or count */
2147c478bd9Sstevel@tonic-gate 	caddr32_t data;		/* command-dependent variable sized data */
2157c478bd9Sstevel@tonic-gate 	size32_t datasize;	/* Size of data buffer */
2167c478bd9Sstevel@tonic-gate } pm_req32_t;
2177c478bd9Sstevel@tonic-gate 
2187c478bd9Sstevel@tonic-gate typedef struct pm_state_change32 {
2197c478bd9Sstevel@tonic-gate 	caddr32_t	physpath;	/* Device which has changed state */
2207c478bd9Sstevel@tonic-gate 	int		component;	/* which component changed state */
2217c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN)
2227c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2237c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2247c478bd9Sstevel@tonic-gate #else
2257c478bd9Sstevel@tonic-gate 	ushort_t	event;		/* type of event */
2267c478bd9Sstevel@tonic-gate 	ushort_t	flags;		/* PSC_EVENT_LOST, PSC_ALL_LOWEST */
2277c478bd9Sstevel@tonic-gate #endif
2287c478bd9Sstevel@tonic-gate 	time32_t	timestamp;	/* time of state change */
2297c478bd9Sstevel@tonic-gate 	int		old_level;	/* power level changing from */
2307c478bd9Sstevel@tonic-gate 	int		new_level;	/* power level changing to */
2317c478bd9Sstevel@tonic-gate 	size32_t	size;		/* size of buffer physpath points to */
2327c478bd9Sstevel@tonic-gate } pm_state_change32_t;
2337c478bd9Sstevel@tonic-gate 
2342df1fe9cSrandyf typedef	struct pm_searchargs32_t {
2352df1fe9cSrandyf 	caddr32_t	pms_listname;
2362df1fe9cSrandyf 	caddr32_t	pms_manufacturer;
2372df1fe9cSrandyf 	caddr32_t	pms_product;
2382df1fe9cSrandyf } pm_searchargs32_t;
2392df1fe9cSrandyf 
2402df1fe9cSrandyf 
2417c478bd9Sstevel@tonic-gate #endif
2427c478bd9Sstevel@tonic-gate 
2437c478bd9Sstevel@tonic-gate /*
2447c478bd9Sstevel@tonic-gate  * Return values from ioctl commands that return pm state info.
2457c478bd9Sstevel@tonic-gate  */
2467c478bd9Sstevel@tonic-gate 
2477c478bd9Sstevel@tonic-gate typedef enum {
2487c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_ENABLED,
2497c478bd9Sstevel@tonic-gate 	PM_SYSTEM_PM_DISABLED,
2507c478bd9Sstevel@tonic-gate 	PM_NO_PM_COMPONENTS,
2517c478bd9Sstevel@tonic-gate 	PM_CREATE_COMPONENTS,
2527c478bd9Sstevel@tonic-gate 	PM_AUTOPM,
2537c478bd9Sstevel@tonic-gate 	PM_DEFAULT_THRESHOLD,
2547c478bd9Sstevel@tonic-gate 	PM_DEVICE_THRESHOLD,
2557c478bd9Sstevel@tonic-gate 	PM_COMPONENT_THRESHOLD,
2567c478bd9Sstevel@tonic-gate 	PM_OLD_THRESHOLD,
257c42872d4Smh27603 	PM_DIRECTLY_MANAGED,
258c42872d4Smh27603 	PM_CPU_THRESHOLD,
259c42872d4Smh27603 	PM_CPU_PM_ENABLED,
260c42872d4Smh27603 	PM_CPU_PM_DISABLED,
2612df1fe9cSrandyf 	PM_CPU_PM_NOTSET,
2622df1fe9cSrandyf 	PM_AUTOS3_ENABLED,
2632df1fe9cSrandyf 	PM_AUTOS3_DISABLED,
2642df1fe9cSrandyf 	PM_S3_SUPPORT_ENABLED,
2652df1fe9cSrandyf 	PM_S3_SUPPORT_DISABLED
2667c478bd9Sstevel@tonic-gate } pm_states;
2677c478bd9Sstevel@tonic-gate 
2687c478bd9Sstevel@tonic-gate #ifdef	__cplusplus
2697c478bd9Sstevel@tonic-gate }
2707c478bd9Sstevel@tonic-gate #endif
2717c478bd9Sstevel@tonic-gate 
2727c478bd9Sstevel@tonic-gate #endif	/* _SYS_PM_H */
273