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*8906SEric.Saxe@Sun.COM * Copyright 2009 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 #ifdef __cplusplus 300Sstevel@tonic-gate extern "C" { 310Sstevel@tonic-gate #endif 320Sstevel@tonic-gate 330Sstevel@tonic-gate #include <sys/types.h> 340Sstevel@tonic-gate 350Sstevel@tonic-gate /* 360Sstevel@tonic-gate * The following ioctls may not exist or may have a different 370Sstevel@tonic-gate * interpretation in a future release. 380Sstevel@tonic-gate */ 390Sstevel@tonic-gate 400Sstevel@tonic-gate typedef enum { 410Sstevel@tonic-gate PM_SCHEDULE, /* obsolete, not supported */ 420Sstevel@tonic-gate PM_GET_IDLE_TIME, /* obsolete, not supported */ 430Sstevel@tonic-gate PM_GET_NUM_CMPTS, /* obsolete, not supported */ 440Sstevel@tonic-gate PM_GET_THRESHOLD, /* obsolete, not supported */ 450Sstevel@tonic-gate PM_SET_THRESHOLD, /* obsolete */ 460Sstevel@tonic-gate PM_GET_NORM_PWR, /* obsolete */ 470Sstevel@tonic-gate PM_SET_CUR_PWR, /* obsolete */ 480Sstevel@tonic-gate PM_GET_CUR_PWR, /* obsolete */ 490Sstevel@tonic-gate PM_GET_NUM_DEPS, /* obsolete, not supported */ 500Sstevel@tonic-gate PM_GET_DEP, /* obsolete, not supported */ 510Sstevel@tonic-gate PM_ADD_DEP, /* obsolete */ 520Sstevel@tonic-gate PM_REM_DEP, /* obsolete, not supported */ 530Sstevel@tonic-gate PM_REM_DEVICE, /* obsolete, not supported */ 540Sstevel@tonic-gate PM_REM_DEVICES, /* obsolete */ 550Sstevel@tonic-gate PM_REPARSE_PM_PROPS, /* used only by ddivs pm tests */ 560Sstevel@tonic-gate PM_DISABLE_AUTOPM, /* obsolete */ 570Sstevel@tonic-gate PM_REENABLE_AUTOPM, /* obsolete */ 580Sstevel@tonic-gate PM_SET_NORM_PWR, /* obsolete, not supported */ 590Sstevel@tonic-gate PM_SET_DEVICE_THRESHOLD, 600Sstevel@tonic-gate PM_GET_SYSTEM_THRESHOLD, 610Sstevel@tonic-gate PM_SET_SYSTEM_THRESHOLD, 620Sstevel@tonic-gate PM_START_PM, 630Sstevel@tonic-gate PM_STOP_PM, 640Sstevel@tonic-gate PM_RESET_PM, 650Sstevel@tonic-gate PM_GET_STATS, 660Sstevel@tonic-gate PM_GET_DEVICE_THRESHOLD, 670Sstevel@tonic-gate PM_GET_POWER_NAME, 680Sstevel@tonic-gate PM_GET_POWER_LEVELS, 690Sstevel@tonic-gate PM_GET_NUM_COMPONENTS, 700Sstevel@tonic-gate PM_GET_COMPONENT_NAME, 710Sstevel@tonic-gate PM_GET_NUM_POWER_LEVELS, 720Sstevel@tonic-gate PM_GET_STATE_CHANGE, 730Sstevel@tonic-gate PM_GET_STATE_CHANGE_WAIT, 740Sstevel@tonic-gate PM_DIRECT_PM, 750Sstevel@tonic-gate PM_RELEASE_DIRECT_PM, 760Sstevel@tonic-gate PM_DIRECT_NOTIFY, 770Sstevel@tonic-gate PM_DIRECT_NOTIFY_WAIT, 780Sstevel@tonic-gate PM_RESET_DEVICE_THRESHOLD, 790Sstevel@tonic-gate PM_GET_PM_STATE, 800Sstevel@tonic-gate PM_GET_DEVICE_TYPE, 810Sstevel@tonic-gate PM_SET_COMPONENT_THRESHOLDS, 820Sstevel@tonic-gate PM_GET_COMPONENT_THRESHOLDS, 830Sstevel@tonic-gate PM_IDLE_DOWN, 840Sstevel@tonic-gate PM_GET_DEVICE_THRESHOLD_BASIS, 850Sstevel@tonic-gate PM_SET_CURRENT_POWER, /* replaces PM_SET_CUR_PWR */ 860Sstevel@tonic-gate PM_GET_CURRENT_POWER, /* replaces PM_GET_CUR_PWR */ 870Sstevel@tonic-gate PM_GET_FULL_POWER, /* replaces PM_GET_NORM_PWR */ 880Sstevel@tonic-gate PM_ADD_DEPENDENT, /* replaces PM_ADD_DEP */ 890Sstevel@tonic-gate PM_GET_TIME_IDLE, /* replaces PM_IDLE_TIME */ 900Sstevel@tonic-gate PM_GET_DEFAULT_SYSTEM_THRESHOLD, 913028Smh27603 PM_ADD_DEPENDENT_PROPERTY, 923028Smh27603 PM_START_CPUPM, 93*8906SEric.Saxe@Sun.COM PM_START_CPUPM_EV, 94*8906SEric.Saxe@Sun.COM PM_START_CPUPM_POLL, 953028Smh27603 PM_STOP_CPUPM, 963028Smh27603 PM_GET_CPU_THRESHOLD, 973028Smh27603 PM_SET_CPU_THRESHOLD, 985295Srandyf PM_GET_CPUPM_STATE, 995295Srandyf PM_ENABLE_S3, /* allow pm to go to S3 state */ 1005295Srandyf PM_DISABLE_S3, /* do not allow pm to go to S3 state */ 1015295Srandyf PM_ENTER_S3, /* obsolete, not supported */ 1025295Srandyf PM_START_AUTOS3, 1035295Srandyf PM_STOP_AUTOS3, 1045295Srandyf PM_SEARCH_LIST, /* search S3 enable/disable list */ 1055295Srandyf PM_GET_AUTOS3_STATE, 1065295Srandyf PM_GET_S3_SUPPORT_STATE, 107*8906SEric.Saxe@Sun.COM PM_GET_CMD_NAME, 108*8906SEric.Saxe@Sun.COM PM_DISABLE_CPU_DEEP_IDLE, 109*8906SEric.Saxe@Sun.COM PM_ENABLE_CPU_DEEP_IDLE, 110*8906SEric.Saxe@Sun.COM PM_DEFAULT_CPU_DEEP_IDLE 1110Sstevel@tonic-gate } pm_cmds; 1120Sstevel@tonic-gate 1130Sstevel@tonic-gate /* 1140Sstevel@tonic-gate * Old name for these ioctls. 1150Sstevel@tonic-gate */ 1160Sstevel@tonic-gate #define PM_GET_POWER PM_GET_NORM_PWR 1170Sstevel@tonic-gate #define PM_SET_POWER PM_SET_CUR_PWR 1180Sstevel@tonic-gate 1190Sstevel@tonic-gate /* 1200Sstevel@tonic-gate * This structure is obsolete and will be removed in a later release 1210Sstevel@tonic-gate */ 1220Sstevel@tonic-gate typedef struct { 1230Sstevel@tonic-gate caddr_t who; /* Device to configure */ 1240Sstevel@tonic-gate int select; /* Selects the component or dependent */ 1250Sstevel@tonic-gate /* of the device */ 1260Sstevel@tonic-gate int level; /* Power or threshold level */ 1270Sstevel@tonic-gate caddr_t dependent; /* Buffer to hold name of dependent */ 1280Sstevel@tonic-gate int size; /* Size of dependent buffer */ 1290Sstevel@tonic-gate } pm_request; 1300Sstevel@tonic-gate 1310Sstevel@tonic-gate /* 1320Sstevel@tonic-gate * This is the new struct that replaces pm_request 1330Sstevel@tonic-gate */ 1340Sstevel@tonic-gate typedef struct pm_req { 1350Sstevel@tonic-gate char *physpath; /* physical path of device to configure */ 1360Sstevel@tonic-gate /* see libdevinfo(3) */ 1370Sstevel@tonic-gate int component; /* Selects the component of the device */ 1380Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 1390Sstevel@tonic-gate void *data; /* command-dependent variable sized data */ 1400Sstevel@tonic-gate size_t datasize; /* Size of data buffer */ 1410Sstevel@tonic-gate } pm_req_t; 1420Sstevel@tonic-gate 1430Sstevel@tonic-gate /* 1445295Srandyf * PM_SEARCH_LIST requires a list name, manufacturer and product name 1455295Srandyf * Searches the named list for a matching tuple. 1465295Srandyf * NOTE: This structure may be removed in a later release. 1475295Srandyf */ 1485295Srandyf typedef struct pm_searchargs { 1495295Srandyf char *pms_listname; /* name of list to search */ 1505295Srandyf char *pms_manufacturer; /* 1st elment of tuple */ 1515295Srandyf char *pms_product; /* 2nd elment of tuple */ 1525295Srandyf } pm_searchargs_t; 1535295Srandyf 1545295Srandyf /* 1550Sstevel@tonic-gate * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY 1560Sstevel@tonic-gate */ 1570Sstevel@tonic-gate #define pmreq_keeper physpath /* keeper in the physpath field */ 1580Sstevel@tonic-gate #define pmreq_kept data /* kept in the data field */ 1590Sstevel@tonic-gate 1600Sstevel@tonic-gate /* 1610Sstevel@tonic-gate * Possible values for the event field of pm_state_change below 1620Sstevel@tonic-gate */ 1630Sstevel@tonic-gate typedef enum { 1640Sstevel@tonic-gate PSC_PENDING_CHANGE, /* device needs to change, is blocked */ 1650Sstevel@tonic-gate PSC_HAS_CHANGED /* device level has changed */ 1660Sstevel@tonic-gate } psc_events; 1670Sstevel@tonic-gate 1680Sstevel@tonic-gate #define PSC_EVENT_LOST 0x4000 /* buffer overrun */ 1690Sstevel@tonic-gate #define PSC_ALL_LOWEST 0x8000 /* all devices at lowest power */ 1700Sstevel@tonic-gate 1710Sstevel@tonic-gate /* 1720Sstevel@tonic-gate * Special value for power level fields in pm_state_change below 1730Sstevel@tonic-gate */ 1740Sstevel@tonic-gate #define PM_LEVEL_UNKNOWN -1 /* power level is unknown */ 1750Sstevel@tonic-gate 1760Sstevel@tonic-gate typedef struct pm_state_change { 1770Sstevel@tonic-gate caddr_t physpath; /* Device which has changed state */ 1780Sstevel@tonic-gate int component; /* which component changed state */ 1790Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 1800Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1810Sstevel@tonic-gate ushort_t event; /* type of event */ 1820Sstevel@tonic-gate #else 1830Sstevel@tonic-gate ushort_t event; /* type of event */ 1840Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1850Sstevel@tonic-gate #endif 1860Sstevel@tonic-gate time_t timestamp; /* time of state change */ 1870Sstevel@tonic-gate int old_level; /* power level changing from */ 1880Sstevel@tonic-gate int new_level; /* power level changing to */ 1890Sstevel@tonic-gate size_t size; /* size of buffer physpath points to */ 1900Sstevel@tonic-gate } pm_state_change_t; 1910Sstevel@tonic-gate 1920Sstevel@tonic-gate #ifdef _SYSCALL32 1930Sstevel@tonic-gate 1940Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */ 1950Sstevel@tonic-gate 1960Sstevel@tonic-gate /* 1970Sstevel@tonic-gate * This struct is obsolete and will be removed in a later release 1980Sstevel@tonic-gate */ 1990Sstevel@tonic-gate typedef struct { 2000Sstevel@tonic-gate caddr32_t who; /* Device to configure */ 2010Sstevel@tonic-gate int select; /* Selects the component or dependent */ 2020Sstevel@tonic-gate /* of the device */ 2030Sstevel@tonic-gate int level; /* Power or threshold level */ 2040Sstevel@tonic-gate caddr32_t dependent; /* Buffer to hold name of */ 2050Sstevel@tonic-gate /* dependent */ 2060Sstevel@tonic-gate size32_t size; /* Size of dependent buffer */ 2070Sstevel@tonic-gate } pm_request32; 2080Sstevel@tonic-gate 2090Sstevel@tonic-gate typedef struct pm_req32 { 2100Sstevel@tonic-gate caddr32_t physpath; /* physical path of device to configure */ 2110Sstevel@tonic-gate /* see libdevinfo(3) */ 2120Sstevel@tonic-gate int component; /* selects the component of the device */ 2130Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 2140Sstevel@tonic-gate caddr32_t data; /* command-dependent variable sized data */ 2150Sstevel@tonic-gate size32_t datasize; /* Size of data buffer */ 2160Sstevel@tonic-gate } pm_req32_t; 2170Sstevel@tonic-gate 2180Sstevel@tonic-gate typedef struct pm_state_change32 { 2190Sstevel@tonic-gate caddr32_t physpath; /* Device which has changed state */ 2200Sstevel@tonic-gate int component; /* which component changed state */ 2210Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 2220Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2230Sstevel@tonic-gate ushort_t event; /* type of event */ 2240Sstevel@tonic-gate #else 2250Sstevel@tonic-gate ushort_t event; /* type of event */ 2260Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2270Sstevel@tonic-gate #endif 2280Sstevel@tonic-gate time32_t timestamp; /* time of state change */ 2290Sstevel@tonic-gate int old_level; /* power level changing from */ 2300Sstevel@tonic-gate int new_level; /* power level changing to */ 2310Sstevel@tonic-gate size32_t size; /* size of buffer physpath points to */ 2320Sstevel@tonic-gate } pm_state_change32_t; 2330Sstevel@tonic-gate 2345295Srandyf typedef struct pm_searchargs32_t { 2355295Srandyf caddr32_t pms_listname; 2365295Srandyf caddr32_t pms_manufacturer; 2375295Srandyf caddr32_t pms_product; 2385295Srandyf } pm_searchargs32_t; 2395295Srandyf 2405295Srandyf 2410Sstevel@tonic-gate #endif 2420Sstevel@tonic-gate 2430Sstevel@tonic-gate /* 2440Sstevel@tonic-gate * Return values from ioctl commands that return pm state info. 2450Sstevel@tonic-gate */ 2460Sstevel@tonic-gate 2470Sstevel@tonic-gate typedef enum { 2480Sstevel@tonic-gate PM_SYSTEM_PM_ENABLED, 2490Sstevel@tonic-gate PM_SYSTEM_PM_DISABLED, 2500Sstevel@tonic-gate PM_NO_PM_COMPONENTS, 2510Sstevel@tonic-gate PM_CREATE_COMPONENTS, 2520Sstevel@tonic-gate PM_AUTOPM, 2530Sstevel@tonic-gate PM_DEFAULT_THRESHOLD, 2540Sstevel@tonic-gate PM_DEVICE_THRESHOLD, 2550Sstevel@tonic-gate PM_COMPONENT_THRESHOLD, 2560Sstevel@tonic-gate PM_OLD_THRESHOLD, 2573028Smh27603 PM_DIRECTLY_MANAGED, 2583028Smh27603 PM_CPU_THRESHOLD, 2593028Smh27603 PM_CPU_PM_ENABLED, 2603028Smh27603 PM_CPU_PM_DISABLED, 2615295Srandyf PM_CPU_PM_NOTSET, 2625295Srandyf PM_AUTOS3_ENABLED, 2635295Srandyf PM_AUTOS3_DISABLED, 2645295Srandyf PM_S3_SUPPORT_ENABLED, 2655295Srandyf PM_S3_SUPPORT_DISABLED 2660Sstevel@tonic-gate } pm_states; 2670Sstevel@tonic-gate 2680Sstevel@tonic-gate #ifdef __cplusplus 2690Sstevel@tonic-gate } 2700Sstevel@tonic-gate #endif 2710Sstevel@tonic-gate 2720Sstevel@tonic-gate #endif /* _SYS_PM_H */ 273