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 53028Smh27603 * Common Development and Distribution License (the "License"). 63028Smh27603 * 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*5295Srandyf * Copyright 2007 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, 933028Smh27603 PM_ADD_DEPENDENT_PROPERTY, 943028Smh27603 PM_START_CPUPM, 953028Smh27603 PM_STOP_CPUPM, 963028Smh27603 PM_GET_CPU_THRESHOLD, 973028Smh27603 PM_SET_CPU_THRESHOLD, 98*5295Srandyf PM_GET_CPUPM_STATE, 99*5295Srandyf PM_ENABLE_S3, /* allow pm to go to S3 state */ 100*5295Srandyf PM_DISABLE_S3, /* do not allow pm to go to S3 state */ 101*5295Srandyf PM_ENTER_S3, /* obsolete, not supported */ 102*5295Srandyf PM_START_AUTOS3, 103*5295Srandyf PM_STOP_AUTOS3, 104*5295Srandyf PM_SEARCH_LIST, /* search S3 enable/disable list */ 105*5295Srandyf PM_GET_AUTOS3_STATE, 106*5295Srandyf PM_GET_S3_SUPPORT_STATE, 107*5295Srandyf PM_GET_CMD_NAME 1080Sstevel@tonic-gate } pm_cmds; 1090Sstevel@tonic-gate 1100Sstevel@tonic-gate /* 1110Sstevel@tonic-gate * Old name for these ioctls. 1120Sstevel@tonic-gate */ 1130Sstevel@tonic-gate #define PM_GET_POWER PM_GET_NORM_PWR 1140Sstevel@tonic-gate #define PM_SET_POWER PM_SET_CUR_PWR 1150Sstevel@tonic-gate 1160Sstevel@tonic-gate /* 1170Sstevel@tonic-gate * This structure is obsolete and will be removed in a later release 1180Sstevel@tonic-gate */ 1190Sstevel@tonic-gate typedef struct { 1200Sstevel@tonic-gate caddr_t who; /* Device to configure */ 1210Sstevel@tonic-gate int select; /* Selects the component or dependent */ 1220Sstevel@tonic-gate /* of the device */ 1230Sstevel@tonic-gate int level; /* Power or threshold level */ 1240Sstevel@tonic-gate caddr_t dependent; /* Buffer to hold name of dependent */ 1250Sstevel@tonic-gate int size; /* Size of dependent buffer */ 1260Sstevel@tonic-gate } pm_request; 1270Sstevel@tonic-gate 1280Sstevel@tonic-gate /* 1290Sstevel@tonic-gate * This is the new struct that replaces pm_request 1300Sstevel@tonic-gate */ 1310Sstevel@tonic-gate typedef struct pm_req { 1320Sstevel@tonic-gate char *physpath; /* physical path of device to configure */ 1330Sstevel@tonic-gate /* see libdevinfo(3) */ 1340Sstevel@tonic-gate int component; /* Selects the component of the device */ 1350Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 1360Sstevel@tonic-gate void *data; /* command-dependent variable sized data */ 1370Sstevel@tonic-gate size_t datasize; /* Size of data buffer */ 1380Sstevel@tonic-gate } pm_req_t; 1390Sstevel@tonic-gate 1400Sstevel@tonic-gate /* 141*5295Srandyf * PM_SEARCH_LIST requires a list name, manufacturer and product name 142*5295Srandyf * Searches the named list for a matching tuple. 143*5295Srandyf * NOTE: This structure may be removed in a later release. 144*5295Srandyf */ 145*5295Srandyf typedef struct pm_searchargs { 146*5295Srandyf char *pms_listname; /* name of list to search */ 147*5295Srandyf char *pms_manufacturer; /* 1st elment of tuple */ 148*5295Srandyf char *pms_product; /* 2nd elment of tuple */ 149*5295Srandyf } pm_searchargs_t; 150*5295Srandyf 151*5295Srandyf /* 1520Sstevel@tonic-gate * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY 1530Sstevel@tonic-gate */ 1540Sstevel@tonic-gate #define pmreq_keeper physpath /* keeper in the physpath field */ 1550Sstevel@tonic-gate #define pmreq_kept data /* kept in the data field */ 1560Sstevel@tonic-gate 1570Sstevel@tonic-gate /* 1580Sstevel@tonic-gate * Possible values for the event field of pm_state_change below 1590Sstevel@tonic-gate */ 1600Sstevel@tonic-gate typedef enum { 1610Sstevel@tonic-gate PSC_PENDING_CHANGE, /* device needs to change, is blocked */ 1620Sstevel@tonic-gate PSC_HAS_CHANGED /* device level has changed */ 1630Sstevel@tonic-gate } psc_events; 1640Sstevel@tonic-gate 1650Sstevel@tonic-gate #define PSC_EVENT_LOST 0x4000 /* buffer overrun */ 1660Sstevel@tonic-gate #define PSC_ALL_LOWEST 0x8000 /* all devices at lowest power */ 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate /* 1690Sstevel@tonic-gate * Special value for power level fields in pm_state_change below 1700Sstevel@tonic-gate */ 1710Sstevel@tonic-gate #define PM_LEVEL_UNKNOWN -1 /* power level is unknown */ 1720Sstevel@tonic-gate 1730Sstevel@tonic-gate typedef struct pm_state_change { 1740Sstevel@tonic-gate caddr_t physpath; /* Device which has changed state */ 1750Sstevel@tonic-gate int component; /* which component changed state */ 1760Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 1770Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1780Sstevel@tonic-gate ushort_t event; /* type of event */ 1790Sstevel@tonic-gate #else 1800Sstevel@tonic-gate ushort_t event; /* type of event */ 1810Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1820Sstevel@tonic-gate #endif 1830Sstevel@tonic-gate time_t timestamp; /* time of state change */ 1840Sstevel@tonic-gate int old_level; /* power level changing from */ 1850Sstevel@tonic-gate int new_level; /* power level changing to */ 1860Sstevel@tonic-gate size_t size; /* size of buffer physpath points to */ 1870Sstevel@tonic-gate } pm_state_change_t; 1880Sstevel@tonic-gate 1890Sstevel@tonic-gate #ifdef _SYSCALL32 1900Sstevel@tonic-gate 1910Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */ 1920Sstevel@tonic-gate 1930Sstevel@tonic-gate /* 1940Sstevel@tonic-gate * This struct is obsolete and will be removed in a later release 1950Sstevel@tonic-gate */ 1960Sstevel@tonic-gate typedef struct { 1970Sstevel@tonic-gate caddr32_t who; /* Device to configure */ 1980Sstevel@tonic-gate int select; /* Selects the component or dependent */ 1990Sstevel@tonic-gate /* of the device */ 2000Sstevel@tonic-gate int level; /* Power or threshold level */ 2010Sstevel@tonic-gate caddr32_t dependent; /* Buffer to hold name of */ 2020Sstevel@tonic-gate /* dependent */ 2030Sstevel@tonic-gate size32_t size; /* Size of dependent buffer */ 2040Sstevel@tonic-gate } pm_request32; 2050Sstevel@tonic-gate 2060Sstevel@tonic-gate typedef struct pm_req32 { 2070Sstevel@tonic-gate caddr32_t physpath; /* physical path of device to configure */ 2080Sstevel@tonic-gate /* see libdevinfo(3) */ 2090Sstevel@tonic-gate int component; /* selects the component of the device */ 2100Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 2110Sstevel@tonic-gate caddr32_t data; /* command-dependent variable sized data */ 2120Sstevel@tonic-gate size32_t datasize; /* Size of data buffer */ 2130Sstevel@tonic-gate } pm_req32_t; 2140Sstevel@tonic-gate 2150Sstevel@tonic-gate typedef struct pm_state_change32 { 2160Sstevel@tonic-gate caddr32_t physpath; /* Device which has changed state */ 2170Sstevel@tonic-gate int component; /* which component changed state */ 2180Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 2190Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2200Sstevel@tonic-gate ushort_t event; /* type of event */ 2210Sstevel@tonic-gate #else 2220Sstevel@tonic-gate ushort_t event; /* type of event */ 2230Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2240Sstevel@tonic-gate #endif 2250Sstevel@tonic-gate time32_t timestamp; /* time of state change */ 2260Sstevel@tonic-gate int old_level; /* power level changing from */ 2270Sstevel@tonic-gate int new_level; /* power level changing to */ 2280Sstevel@tonic-gate size32_t size; /* size of buffer physpath points to */ 2290Sstevel@tonic-gate } pm_state_change32_t; 2300Sstevel@tonic-gate 231*5295Srandyf typedef struct pm_searchargs32_t { 232*5295Srandyf caddr32_t pms_listname; 233*5295Srandyf caddr32_t pms_manufacturer; 234*5295Srandyf caddr32_t pms_product; 235*5295Srandyf } pm_searchargs32_t; 236*5295Srandyf 237*5295Srandyf 2380Sstevel@tonic-gate #endif 2390Sstevel@tonic-gate 2400Sstevel@tonic-gate /* 2410Sstevel@tonic-gate * Return values from ioctl commands that return pm state info. 2420Sstevel@tonic-gate */ 2430Sstevel@tonic-gate 2440Sstevel@tonic-gate typedef enum { 2450Sstevel@tonic-gate PM_SYSTEM_PM_ENABLED, 2460Sstevel@tonic-gate PM_SYSTEM_PM_DISABLED, 2470Sstevel@tonic-gate PM_NO_PM_COMPONENTS, 2480Sstevel@tonic-gate PM_CREATE_COMPONENTS, 2490Sstevel@tonic-gate PM_AUTOPM, 2500Sstevel@tonic-gate PM_DEFAULT_THRESHOLD, 2510Sstevel@tonic-gate PM_DEVICE_THRESHOLD, 2520Sstevel@tonic-gate PM_COMPONENT_THRESHOLD, 2530Sstevel@tonic-gate PM_OLD_THRESHOLD, 2543028Smh27603 PM_DIRECTLY_MANAGED, 2553028Smh27603 PM_CPU_THRESHOLD, 2563028Smh27603 PM_CPU_PM_ENABLED, 2573028Smh27603 PM_CPU_PM_DISABLED, 258*5295Srandyf PM_CPU_PM_NOTSET, 259*5295Srandyf PM_AUTOS3_ENABLED, 260*5295Srandyf PM_AUTOS3_DISABLED, 261*5295Srandyf PM_S3_SUPPORT_ENABLED, 262*5295Srandyf PM_S3_SUPPORT_DISABLED 2630Sstevel@tonic-gate } pm_states; 2640Sstevel@tonic-gate 2650Sstevel@tonic-gate #ifdef __cplusplus 2660Sstevel@tonic-gate } 2670Sstevel@tonic-gate #endif 2680Sstevel@tonic-gate 2690Sstevel@tonic-gate #endif /* _SYS_PM_H */ 270