![]() |
|
|||
0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 0002 /* 0003 * 0004 * envctrl.h: Definitions for access to the i2c environment 0005 * monitoring on Ultrasparc systems. 0006 * 0007 * Copyright (C) 1998 Eddie C. Dost (ecd@skynet.be) 0008 * Copyright (C) 2000 Vinh Truong (vinh.truong@eng.sun.com) 0009 * VT - Add all ioctl commands and environment status definitions 0010 * VT - Add application note 0011 */ 0012 #ifndef _SPARC64_ENVCTRL_H 0013 #define _SPARC64_ENVCTRL_H 1 0014 0015 #include <linux/ioctl.h> 0016 0017 /* Application note: 0018 * 0019 * The driver supports 4 operations: open(), close(), ioctl(), read() 0020 * The device name is /dev/envctrl. 0021 * Below is sample usage: 0022 * 0023 * fd = open("/dev/envtrl", O_RDONLY); 0024 * if (ioctl(fd, ENVCTRL_READ_SHUTDOWN_TEMPERATURE, 0) < 0) 0025 * printf("error\n"); 0026 * ret = read(fd, buf, 10); 0027 * close(fd); 0028 * 0029 * Notice in the case of cpu voltage and temperature, the default is 0030 * cpu0. If we need to know the info of cpu1, cpu2, cpu3, we need to 0031 * pass in cpu number in ioctl() last parameter. For example, to 0032 * get the voltage of cpu2: 0033 * 0034 * ioctlbuf[0] = 2; 0035 * if (ioctl(fd, ENVCTRL_READ_CPU_VOLTAGE, ioctlbuf) < 0) 0036 * printf("error\n"); 0037 * ret = read(fd, buf, 10); 0038 * 0039 * All the return values are in ascii. So check read return value 0040 * and do appropriate conversions in your application. 0041 */ 0042 0043 /* IOCTL commands */ 0044 0045 /* Note: these commands reflect possible monitor features. 0046 * Some boards choose to support some of the features only. 0047 */ 0048 #define ENVCTRL_RD_CPU_TEMPERATURE _IOR('p', 0x40, int) 0049 #define ENVCTRL_RD_CPU_VOLTAGE _IOR('p', 0x41, int) 0050 #define ENVCTRL_RD_FAN_STATUS _IOR('p', 0x42, int) 0051 #define ENVCTRL_RD_WARNING_TEMPERATURE _IOR('p', 0x43, int) 0052 #define ENVCTRL_RD_SHUTDOWN_TEMPERATURE _IOR('p', 0x44, int) 0053 #define ENVCTRL_RD_VOLTAGE_STATUS _IOR('p', 0x45, int) 0054 #define ENVCTRL_RD_SCSI_TEMPERATURE _IOR('p', 0x46, int) 0055 #define ENVCTRL_RD_ETHERNET_TEMPERATURE _IOR('p', 0x47, int) 0056 #define ENVCTRL_RD_MTHRBD_TEMPERATURE _IOR('p', 0x48, int) 0057 0058 #define ENVCTRL_RD_GLOBALADDRESS _IOR('p', 0x49, int) 0059 0060 /* Read return values for a voltage status request. */ 0061 #define ENVCTRL_VOLTAGE_POWERSUPPLY_GOOD 0x01 0062 #define ENVCTRL_VOLTAGE_BAD 0x02 0063 #define ENVCTRL_POWERSUPPLY_BAD 0x03 0064 #define ENVCTRL_VOLTAGE_POWERSUPPLY_BAD 0x04 0065 0066 /* Read return values for a fan status request. 0067 * A failure match means either the fan fails or 0068 * the fan is not connected. Some boards have optional 0069 * connectors to connect extra fans. 0070 * 0071 * There are maximum 8 monitor fans. Some are cpu fans 0072 * some are system fans. The mask below only indicates 0073 * fan by order number. 0074 * Below is a sample application: 0075 * 0076 * if (ioctl(fd, ENVCTRL_READ_FAN_STATUS, 0) < 0) { 0077 * printf("ioctl fan failed\n"); 0078 * } 0079 * if (read(fd, rslt, 1) <= 0) { 0080 * printf("error or fan not monitored\n"); 0081 * } else { 0082 * if (rslt[0] == ENVCTRL_ALL_FANS_GOOD) { 0083 * printf("all fans good\n"); 0084 * } else if (rslt[0] == ENVCTRL_ALL_FANS_BAD) { 0085 * printf("all fans bad\n"); 0086 * } else { 0087 * if (rslt[0] & ENVCTRL_FAN0_FAILURE_MASK) { 0088 * printf("fan 0 failed or not connected\n"); 0089 * } 0090 * ...... 0091 */ 0092 0093 #define ENVCTRL_ALL_FANS_GOOD 0x00 0094 #define ENVCTRL_FAN0_FAILURE_MASK 0x01 0095 #define ENVCTRL_FAN1_FAILURE_MASK 0x02 0096 #define ENVCTRL_FAN2_FAILURE_MASK 0x04 0097 #define ENVCTRL_FAN3_FAILURE_MASK 0x08 0098 #define ENVCTRL_FAN4_FAILURE_MASK 0x10 0099 #define ENVCTRL_FAN5_FAILURE_MASK 0x20 0100 #define ENVCTRL_FAN6_FAILURE_MASK 0x40 0101 #define ENVCTRL_FAN7_FAILURE_MASK 0x80 0102 #define ENVCTRL_ALL_FANS_BAD 0xFF 0103 0104 #endif /* !(_SPARC64_ENVCTRL_H) */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |