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 5*c42872d4Smh27603 * Common Development and Distribution License (the "License"). 6*c42872d4Smh27603 * 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*c42872d4Smh27603 * Copyright 2006 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, 93*c42872d4Smh27603 PM_ADD_DEPENDENT_PROPERTY, 94*c42872d4Smh27603 PM_START_CPUPM, 95*c42872d4Smh27603 PM_STOP_CPUPM, 96*c42872d4Smh27603 PM_GET_CPU_THRESHOLD, 97*c42872d4Smh27603 PM_SET_CPU_THRESHOLD, 98*c42872d4Smh27603 PM_GET_CPUPM_STATE 997c478bd9Sstevel@tonic-gate } pm_cmds; 1007c478bd9Sstevel@tonic-gate 1017c478bd9Sstevel@tonic-gate /* 1027c478bd9Sstevel@tonic-gate * Old name for these ioctls. 1037c478bd9Sstevel@tonic-gate */ 1047c478bd9Sstevel@tonic-gate #define PM_GET_POWER PM_GET_NORM_PWR 1057c478bd9Sstevel@tonic-gate #define PM_SET_POWER PM_SET_CUR_PWR 1067c478bd9Sstevel@tonic-gate 1077c478bd9Sstevel@tonic-gate /* 1087c478bd9Sstevel@tonic-gate * This structure is obsolete and will be removed in a later release 1097c478bd9Sstevel@tonic-gate */ 1107c478bd9Sstevel@tonic-gate typedef struct { 1117c478bd9Sstevel@tonic-gate caddr_t who; /* Device to configure */ 1127c478bd9Sstevel@tonic-gate int select; /* Selects the component or dependent */ 1137c478bd9Sstevel@tonic-gate /* of the device */ 1147c478bd9Sstevel@tonic-gate int level; /* Power or threshold level */ 1157c478bd9Sstevel@tonic-gate caddr_t dependent; /* Buffer to hold name of dependent */ 1167c478bd9Sstevel@tonic-gate int size; /* Size of dependent buffer */ 1177c478bd9Sstevel@tonic-gate } pm_request; 1187c478bd9Sstevel@tonic-gate 1197c478bd9Sstevel@tonic-gate /* 1207c478bd9Sstevel@tonic-gate * This is the new struct that replaces pm_request 1217c478bd9Sstevel@tonic-gate */ 1227c478bd9Sstevel@tonic-gate typedef struct pm_req { 1237c478bd9Sstevel@tonic-gate char *physpath; /* physical path of device to configure */ 1247c478bd9Sstevel@tonic-gate /* see libdevinfo(3) */ 1257c478bd9Sstevel@tonic-gate int component; /* Selects the component of the device */ 1267c478bd9Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 1277c478bd9Sstevel@tonic-gate void *data; /* command-dependent variable sized data */ 1287c478bd9Sstevel@tonic-gate size_t datasize; /* Size of data buffer */ 1297c478bd9Sstevel@tonic-gate } pm_req_t; 1307c478bd9Sstevel@tonic-gate 1317c478bd9Sstevel@tonic-gate /* 1327c478bd9Sstevel@tonic-gate * Use these for PM_ADD_DEPENDENT and PM_ADD_DEPENDENT_PROPERTY 1337c478bd9Sstevel@tonic-gate */ 1347c478bd9Sstevel@tonic-gate #define pmreq_keeper physpath /* keeper in the physpath field */ 1357c478bd9Sstevel@tonic-gate #define pmreq_kept data /* kept in the data field */ 1367c478bd9Sstevel@tonic-gate 1377c478bd9Sstevel@tonic-gate /* 1387c478bd9Sstevel@tonic-gate * Possible values for the event field of pm_state_change below 1397c478bd9Sstevel@tonic-gate */ 1407c478bd9Sstevel@tonic-gate typedef enum { 1417c478bd9Sstevel@tonic-gate PSC_PENDING_CHANGE, /* device needs to change, is blocked */ 1427c478bd9Sstevel@tonic-gate PSC_HAS_CHANGED /* device level has changed */ 1437c478bd9Sstevel@tonic-gate } psc_events; 1447c478bd9Sstevel@tonic-gate 1457c478bd9Sstevel@tonic-gate #define PSC_EVENT_LOST 0x4000 /* buffer overrun */ 1467c478bd9Sstevel@tonic-gate #define PSC_ALL_LOWEST 0x8000 /* all devices at lowest power */ 1477c478bd9Sstevel@tonic-gate 1487c478bd9Sstevel@tonic-gate /* 1497c478bd9Sstevel@tonic-gate * Special value for power level fields in pm_state_change below 1507c478bd9Sstevel@tonic-gate */ 1517c478bd9Sstevel@tonic-gate #define PM_LEVEL_UNKNOWN -1 /* power level is unknown */ 1527c478bd9Sstevel@tonic-gate 1537c478bd9Sstevel@tonic-gate typedef struct pm_state_change { 1547c478bd9Sstevel@tonic-gate caddr_t physpath; /* Device which has changed state */ 1557c478bd9Sstevel@tonic-gate int component; /* which component changed state */ 1567c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 1577c478bd9Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1587c478bd9Sstevel@tonic-gate ushort_t event; /* type of event */ 1597c478bd9Sstevel@tonic-gate #else 1607c478bd9Sstevel@tonic-gate ushort_t event; /* type of event */ 1617c478bd9Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 1627c478bd9Sstevel@tonic-gate #endif 1637c478bd9Sstevel@tonic-gate time_t timestamp; /* time of state change */ 1647c478bd9Sstevel@tonic-gate int old_level; /* power level changing from */ 1657c478bd9Sstevel@tonic-gate int new_level; /* power level changing to */ 1667c478bd9Sstevel@tonic-gate size_t size; /* size of buffer physpath points to */ 1677c478bd9Sstevel@tonic-gate } pm_state_change_t; 1687c478bd9Sstevel@tonic-gate 1697c478bd9Sstevel@tonic-gate #ifdef _SYSCALL32 1707c478bd9Sstevel@tonic-gate 1717c478bd9Sstevel@tonic-gate /* Kernel's view of ILP32 structure version. */ 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * This struct is obsolete and will be removed in a later release 1757c478bd9Sstevel@tonic-gate */ 1767c478bd9Sstevel@tonic-gate typedef struct { 1777c478bd9Sstevel@tonic-gate caddr32_t who; /* Device to configure */ 1787c478bd9Sstevel@tonic-gate int select; /* Selects the component or dependent */ 1797c478bd9Sstevel@tonic-gate /* of the device */ 1807c478bd9Sstevel@tonic-gate int level; /* Power or threshold level */ 1817c478bd9Sstevel@tonic-gate caddr32_t dependent; /* Buffer to hold name of */ 1827c478bd9Sstevel@tonic-gate /* dependent */ 1837c478bd9Sstevel@tonic-gate size32_t size; /* Size of dependent buffer */ 1847c478bd9Sstevel@tonic-gate } pm_request32; 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate typedef struct pm_req32 { 1877c478bd9Sstevel@tonic-gate caddr32_t physpath; /* physical path of device to configure */ 1887c478bd9Sstevel@tonic-gate /* see libdevinfo(3) */ 1897c478bd9Sstevel@tonic-gate int component; /* selects the component of the device */ 1907c478bd9Sstevel@tonic-gate int value; /* power level, threshold value, or count */ 1917c478bd9Sstevel@tonic-gate caddr32_t data; /* command-dependent variable sized data */ 1927c478bd9Sstevel@tonic-gate size32_t datasize; /* Size of data buffer */ 1937c478bd9Sstevel@tonic-gate } pm_req32_t; 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate typedef struct pm_state_change32 { 1967c478bd9Sstevel@tonic-gate caddr32_t physpath; /* Device which has changed state */ 1977c478bd9Sstevel@tonic-gate int component; /* which component changed state */ 1987c478bd9Sstevel@tonic-gate #if defined(_BIG_ENDIAN) 1997c478bd9Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2007c478bd9Sstevel@tonic-gate ushort_t event; /* type of event */ 2017c478bd9Sstevel@tonic-gate #else 2027c478bd9Sstevel@tonic-gate ushort_t event; /* type of event */ 2037c478bd9Sstevel@tonic-gate ushort_t flags; /* PSC_EVENT_LOST, PSC_ALL_LOWEST */ 2047c478bd9Sstevel@tonic-gate #endif 2057c478bd9Sstevel@tonic-gate time32_t timestamp; /* time of state change */ 2067c478bd9Sstevel@tonic-gate int old_level; /* power level changing from */ 2077c478bd9Sstevel@tonic-gate int new_level; /* power level changing to */ 2087c478bd9Sstevel@tonic-gate size32_t size; /* size of buffer physpath points to */ 2097c478bd9Sstevel@tonic-gate } pm_state_change32_t; 2107c478bd9Sstevel@tonic-gate 2117c478bd9Sstevel@tonic-gate #endif 2127c478bd9Sstevel@tonic-gate 2137c478bd9Sstevel@tonic-gate /* 2147c478bd9Sstevel@tonic-gate * Return values from ioctl commands that return pm state info. 2157c478bd9Sstevel@tonic-gate */ 2167c478bd9Sstevel@tonic-gate 2177c478bd9Sstevel@tonic-gate typedef enum { 2187c478bd9Sstevel@tonic-gate PM_SYSTEM_PM_ENABLED, 2197c478bd9Sstevel@tonic-gate PM_SYSTEM_PM_DISABLED, 2207c478bd9Sstevel@tonic-gate PM_NO_PM_COMPONENTS, 2217c478bd9Sstevel@tonic-gate PM_CREATE_COMPONENTS, 2227c478bd9Sstevel@tonic-gate PM_AUTOPM, 2237c478bd9Sstevel@tonic-gate PM_DEFAULT_THRESHOLD, 2247c478bd9Sstevel@tonic-gate PM_DEVICE_THRESHOLD, 2257c478bd9Sstevel@tonic-gate PM_COMPONENT_THRESHOLD, 2267c478bd9Sstevel@tonic-gate PM_OLD_THRESHOLD, 227*c42872d4Smh27603 PM_DIRECTLY_MANAGED, 228*c42872d4Smh27603 PM_CPU_THRESHOLD, 229*c42872d4Smh27603 PM_CPU_PM_ENABLED, 230*c42872d4Smh27603 PM_CPU_PM_DISABLED, 231*c42872d4Smh27603 PM_CPU_PM_NOTSET 2327c478bd9Sstevel@tonic-gate } pm_states; 2337c478bd9Sstevel@tonic-gate 2347c478bd9Sstevel@tonic-gate 2357c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2367c478bd9Sstevel@tonic-gate } 2377c478bd9Sstevel@tonic-gate #endif 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate #endif /* _SYS_PM_H */ 240