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*06e46062Sjbeloro * Common Development and Distribution License (the "License"). 6*06e46062Sjbeloro * 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 */ 21*06e46062Sjbeloro 227c478bd9Sstevel@tonic-gate /* 23*06e46062Sjbeloro * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate #ifndef _SYS_ENVMON_H 287c478bd9Sstevel@tonic-gate #define _SYS_ENVMON_H 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 317c478bd9Sstevel@tonic-gate 327c478bd9Sstevel@tonic-gate #ifdef __cplusplus 337c478bd9Sstevel@tonic-gate extern "C" { 347c478bd9Sstevel@tonic-gate #endif 357c478bd9Sstevel@tonic-gate 367c478bd9Sstevel@tonic-gate #include <sys/ioccom.h> 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate /* 397c478bd9Sstevel@tonic-gate * environmental monitoring ioctls 407c478bd9Sstevel@tonic-gate * 417c478bd9Sstevel@tonic-gate * there are two types of environmental monitor: 427c478bd9Sstevel@tonic-gate * sensors - these provide a value for the environmental property 437c478bd9Sstevel@tonic-gate * indicators - these provide a status of "within range" or "out of range" 447c478bd9Sstevel@tonic-gate * 457c478bd9Sstevel@tonic-gate * for any given environmental property, a particular platform is likely 467c478bd9Sstevel@tonic-gate * to support either a sensor or an indicator 477c478bd9Sstevel@tonic-gate * 487c478bd9Sstevel@tonic-gate * a reserved value is used to signify that a particular sensor value is 497c478bd9Sstevel@tonic-gate * not available 507c478bd9Sstevel@tonic-gate */ 517c478bd9Sstevel@tonic-gate 527c478bd9Sstevel@tonic-gate /* reserved values to signify "value unavailable" */ 537c478bd9Sstevel@tonic-gate #define ENVMON_VAL_UNAVAILABLE ((int16_t)(-32768)) 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /* 567c478bd9Sstevel@tonic-gate * The ability of a sensor or indicator to deliver a value is encapsulated 577c478bd9Sstevel@tonic-gate * in the sensor_status field. 587c478bd9Sstevel@tonic-gate * The following sensor_status bit fields are defined 597c478bd9Sstevel@tonic-gate */ 607c478bd9Sstevel@tonic-gate #define ENVMON_SENSOR_OK 0 /* this one's a value */ 617c478bd9Sstevel@tonic-gate #define ENVMON_NOT_PRESENT 1 627c478bd9Sstevel@tonic-gate #define ENVMON_INACCESSIBLE 2 /* e.g. i2c bus problem */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate /* 657c478bd9Sstevel@tonic-gate * Some drivers may implement the older lomv interface in addition to 667c478bd9Sstevel@tonic-gate * the ioctls defined here. To avoid a clash with values from older 677c478bd9Sstevel@tonic-gate * interfaces, ioctls defined here start high in the available range. 687c478bd9Sstevel@tonic-gate */ 697c478bd9Sstevel@tonic-gate #define ENVMON_BASE 200 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #define ENVMONIOCSYSINFO _IOR('a', ENVMON_BASE + 0, envmon_sysinfo_t) 727c478bd9Sstevel@tonic-gate #define ENVMONIOCVOLTSENSOR _IOWR('a', ENVMON_BASE + 1, envmon_sensor_t) 737c478bd9Sstevel@tonic-gate #define ENVMONIOCAMPSENSOR _IOWR('a', ENVMON_BASE + 2, envmon_sensor_t) 747c478bd9Sstevel@tonic-gate #define ENVMONIOCTEMPSENSOR _IOWR('a', ENVMON_BASE + 3, envmon_sensor_t) 757c478bd9Sstevel@tonic-gate #define ENVMONIOCFAN _IOWR('a', ENVMON_BASE + 4, envmon_fan_t) 767c478bd9Sstevel@tonic-gate #define ENVMONIOCVOLTIND _IOWR('a', ENVMON_BASE + 5, envmon_indicator_t) 777c478bd9Sstevel@tonic-gate #define ENVMONIOCAMPIND _IOWR('a', ENVMON_BASE + 6, envmon_indicator_t) 787c478bd9Sstevel@tonic-gate #define ENVMONIOCTEMPIND _IOWR('a', ENVMON_BASE + 7, envmon_indicator_t) 797c478bd9Sstevel@tonic-gate #define ENVMONIOCFANIND _IOWR('a', ENVMON_BASE + 8, envmon_indicator_t) 807c478bd9Sstevel@tonic-gate #define ENVMONIOCGETLED _IOWR('a', ENVMON_BASE + 9, envmon_led_info_t) 817c478bd9Sstevel@tonic-gate #define ENVMONIOCSETLED _IOW('a', ENVMON_BASE + 10, envmon_led_ctl_t) 827c478bd9Sstevel@tonic-gate #define ENVMONIOCHPU _IOWR('a', ENVMON_BASE + 11, envmon_hpu_t) 837c478bd9Sstevel@tonic-gate #define ENVMONIOCGETKEYSW _IOR('a', ENVMON_BASE + 12, envmon_keysw_pos_t) 847c478bd9Sstevel@tonic-gate #define ENVMONIOCGETALARM \ 857c478bd9Sstevel@tonic-gate _IOWR('a', ENVMON_BASE + 13, envmon_alarm_info_t) 867c478bd9Sstevel@tonic-gate #define ENVMONIOCSETALARM _IOWR('a', ENVMON_BASE + 14, envmon_alarm_ctl_t) 87*06e46062Sjbeloro #define ENVMONIOCCHASSISSERIALNUM \ 88*06e46062Sjbeloro _IOR('a', ENVMON_BASE + 15, envmon_chassis_t) 897c478bd9Sstevel@tonic-gate 907c478bd9Sstevel@tonic-gate /* field length for text identifiers */ 917c478bd9Sstevel@tonic-gate #define ENVMON_MAXNAMELEN 32 927c478bd9Sstevel@tonic-gate 937c478bd9Sstevel@tonic-gate typedef struct { 947c478bd9Sstevel@tonic-gate char name[ENVMON_MAXNAMELEN]; 957c478bd9Sstevel@tonic-gate } envmon_handle_t; 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* 987c478bd9Sstevel@tonic-gate * Some structures include threshold fields. 997c478bd9Sstevel@tonic-gate * Where a particular threshold is not defined for a given sensor, 1007c478bd9Sstevel@tonic-gate * the reserved value ENVMON_VAL_UNAVAILABLE is returned. 1017c478bd9Sstevel@tonic-gate */ 1027c478bd9Sstevel@tonic-gate typedef struct { 1037c478bd9Sstevel@tonic-gate int16_t warning; 1047c478bd9Sstevel@tonic-gate int16_t shutdown; 1057c478bd9Sstevel@tonic-gate int16_t poweroff; 1067c478bd9Sstevel@tonic-gate } envmon_thresholds_t; 1077c478bd9Sstevel@tonic-gate 1087c478bd9Sstevel@tonic-gate /* 1097c478bd9Sstevel@tonic-gate * id identifies the fru to be accessed. 1107c478bd9Sstevel@tonic-gate * next_id returns the id for the next component of the type implied by 1117c478bd9Sstevel@tonic-gate * the ioctl command. If there are no more frus in this sequence, 1127c478bd9Sstevel@tonic-gate * next_id is set to an empty string. 1137c478bd9Sstevel@tonic-gate * If id is set to an empty string on entry, next_id returns the first id. 1147c478bd9Sstevel@tonic-gate * In this case, sensor_status will be returned as ENVMON_NOT_PRESENT. 1157c478bd9Sstevel@tonic-gate */ 1167c478bd9Sstevel@tonic-gate typedef struct { 1177c478bd9Sstevel@tonic-gate envmon_handle_t id; 1187c478bd9Sstevel@tonic-gate uint16_t sensor_status; 1197c478bd9Sstevel@tonic-gate int16_t value; /* sensor reading */ 1207c478bd9Sstevel@tonic-gate envmon_thresholds_t lowthresholds; 1217c478bd9Sstevel@tonic-gate envmon_thresholds_t highthresholds; 1227c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 1237c478bd9Sstevel@tonic-gate } envmon_sensor_t; 1247c478bd9Sstevel@tonic-gate 1257c478bd9Sstevel@tonic-gate typedef struct { 1267c478bd9Sstevel@tonic-gate envmon_handle_t id; 1277c478bd9Sstevel@tonic-gate uint16_t sensor_status; 1287c478bd9Sstevel@tonic-gate uint16_t condition; /* 0 = within limits */ 1297c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 1307c478bd9Sstevel@tonic-gate } envmon_indicator_t; 1317c478bd9Sstevel@tonic-gate 1327c478bd9Sstevel@tonic-gate typedef struct { 1337c478bd9Sstevel@tonic-gate envmon_handle_t id; 1347c478bd9Sstevel@tonic-gate uint16_t sensor_status; 1357c478bd9Sstevel@tonic-gate uint16_t speed; 1367c478bd9Sstevel@tonic-gate char units[ENVMON_MAXNAMELEN]; 1377c478bd9Sstevel@tonic-gate envmon_thresholds_t lowthresholds; 1387c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 1397c478bd9Sstevel@tonic-gate } envmon_fan_t; 1407c478bd9Sstevel@tonic-gate 1417c478bd9Sstevel@tonic-gate /* 1427c478bd9Sstevel@tonic-gate * Values for led_state 1437c478bd9Sstevel@tonic-gate */ 1447c478bd9Sstevel@tonic-gate #define ENVMON_LED_OFF 0 1457c478bd9Sstevel@tonic-gate #define ENVMON_LED_ON 1 1467c478bd9Sstevel@tonic-gate #define ENVMON_LED_BLINKING 2 1477c478bd9Sstevel@tonic-gate #define ENVMON_LED_FLASHING 3 1487c478bd9Sstevel@tonic-gate 1497c478bd9Sstevel@tonic-gate /* 1507c478bd9Sstevel@tonic-gate * Values for the hue of the leds 1517c478bd9Sstevel@tonic-gate */ 1527c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_NONE ((int8_t)(-1)) 1537c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_ANY 0 1547c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_WHITE 1 1557c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_BLUE 2 1567c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_GREEN 3 1577c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_AMBER 4 1587c478bd9Sstevel@tonic-gate #define ENVMON_LED_CLR_RED 5 1597c478bd9Sstevel@tonic-gate 1607c478bd9Sstevel@tonic-gate typedef struct { 1617c478bd9Sstevel@tonic-gate envmon_handle_t id; 1627c478bd9Sstevel@tonic-gate uint16_t sensor_status; 1637c478bd9Sstevel@tonic-gate int8_t led_state; 1647c478bd9Sstevel@tonic-gate int8_t led_color; 1657c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 1667c478bd9Sstevel@tonic-gate } envmon_led_info_t; 1677c478bd9Sstevel@tonic-gate 1687c478bd9Sstevel@tonic-gate typedef struct { 1697c478bd9Sstevel@tonic-gate envmon_handle_t id; 1707c478bd9Sstevel@tonic-gate int8_t led_state; 1717c478bd9Sstevel@tonic-gate } envmon_led_ctl_t; 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate /* 1747c478bd9Sstevel@tonic-gate * Values for alarm_state 1757c478bd9Sstevel@tonic-gate */ 1767c478bd9Sstevel@tonic-gate #define ENVMON_ALARM_OFF 0 1777c478bd9Sstevel@tonic-gate #define ENVMON_ALARM_ON 1 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate typedef struct { 1807c478bd9Sstevel@tonic-gate envmon_handle_t id; 1817c478bd9Sstevel@tonic-gate uint16_t sensor_status; 1827c478bd9Sstevel@tonic-gate int8_t alarm_state; 1837c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 1847c478bd9Sstevel@tonic-gate } envmon_alarm_info_t; 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate typedef struct { 1877c478bd9Sstevel@tonic-gate envmon_handle_t id; 1887c478bd9Sstevel@tonic-gate int8_t alarm_state; 1897c478bd9Sstevel@tonic-gate } envmon_alarm_ctl_t; 1907c478bd9Sstevel@tonic-gate 1917c478bd9Sstevel@tonic-gate /* 1927c478bd9Sstevel@tonic-gate * Values for fru_status 1937c478bd9Sstevel@tonic-gate */ 1947c478bd9Sstevel@tonic-gate #define ENVMON_FRU_NOT_PRESENT 0 1957c478bd9Sstevel@tonic-gate #define ENVMON_FRU_PRESENT 1 1967c478bd9Sstevel@tonic-gate #define ENVMON_FRU_FAULT 2 1977c478bd9Sstevel@tonic-gate #define ENVMON_FRU_DOWNLOAD 3 /* flash update or download active */ 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate typedef struct { 2007c478bd9Sstevel@tonic-gate envmon_handle_t id; 2017c478bd9Sstevel@tonic-gate uint8_t sensor_status; 2027c478bd9Sstevel@tonic-gate uint8_t fru_status; 2037c478bd9Sstevel@tonic-gate envmon_handle_t next_id; 2047c478bd9Sstevel@tonic-gate } envmon_hpu_t; 2057c478bd9Sstevel@tonic-gate 2067c478bd9Sstevel@tonic-gate /* 2077c478bd9Sstevel@tonic-gate * env_sysinto_t is used to return limits on various item types 2087c478bd9Sstevel@tonic-gate */ 2097c478bd9Sstevel@tonic-gate typedef struct { 2107c478bd9Sstevel@tonic-gate uint16_t maxVoltSens; /* max number of voltage sensors */ 2117c478bd9Sstevel@tonic-gate uint16_t maxVoltInd; /* max number of voltage indicators */ 2127c478bd9Sstevel@tonic-gate uint16_t maxAmpSens; /* max number of current sensors */ 2137c478bd9Sstevel@tonic-gate uint16_t maxAmpInd; /* max number of circuit breakers */ 2147c478bd9Sstevel@tonic-gate uint16_t maxTempSens; /* max number of temperature sensors */ 2157c478bd9Sstevel@tonic-gate uint16_t maxTempInd; /* max number of temp'r indicators */ 2167c478bd9Sstevel@tonic-gate uint16_t maxFanSens; /* max number of fan speed sensors */ 2177c478bd9Sstevel@tonic-gate uint16_t maxFanInd; /* max number of fan indicators */ 2187c478bd9Sstevel@tonic-gate uint16_t maxLED; /* max number of LEDs */ 2197c478bd9Sstevel@tonic-gate uint16_t maxHPU; /* max number of Hot Pluggable Units */ 2207c478bd9Sstevel@tonic-gate } envmon_sysinfo_t; 2217c478bd9Sstevel@tonic-gate 2227c478bd9Sstevel@tonic-gate /* 2237c478bd9Sstevel@tonic-gate * envmon_keysw_t is used to return the current value of the 2247c478bd9Sstevel@tonic-gate * keyswitch (if fitted) 2257c478bd9Sstevel@tonic-gate */ 2267c478bd9Sstevel@tonic-gate typedef enum envmon_keysw_pos { 2277c478bd9Sstevel@tonic-gate ENVMON_KEYSW_POS_UNKNOWN = 0, 2287c478bd9Sstevel@tonic-gate ENVMON_KEYSW_POS_NORMAL, 2297c478bd9Sstevel@tonic-gate ENVMON_KEYSW_POS_DIAG, 2307c478bd9Sstevel@tonic-gate ENVMON_KEYSW_POS_LOCKED, 2317c478bd9Sstevel@tonic-gate ENVMON_KEYSW_POS_OFF 2327c478bd9Sstevel@tonic-gate } envmon_keysw_pos_t; 2337c478bd9Sstevel@tonic-gate 234*06e46062Sjbeloro /* 235*06e46062Sjbeloro * envmon_chassis_t is used to retuen the chassis serial number 236*06e46062Sjbeloro */ 237*06e46062Sjbeloro typedef struct { 238*06e46062Sjbeloro char serial_number[ENVMON_MAXNAMELEN]; 239*06e46062Sjbeloro } envmon_chassis_t; 240*06e46062Sjbeloro 2417c478bd9Sstevel@tonic-gate #ifdef __cplusplus 2427c478bd9Sstevel@tonic-gate } 2437c478bd9Sstevel@tonic-gate #endif 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate #endif /* _SYS_ENVMON_H */ 246