Path: blob/master/arch/sparc/include/uapi/asm/envctrl.h
26496 views
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */1/*2*3* envctrl.h: Definitions for access to the i2c environment4* monitoring on Ultrasparc systems.5*6* Copyright (C) 1998 Eddie C. Dost ([email protected])7* Copyright (C) 2000 Vinh Truong ([email protected])8* VT - Add all ioctl commands and environment status definitions9* VT - Add application note10*/11#ifndef _SPARC64_ENVCTRL_H12#define _SPARC64_ENVCTRL_H 11314#include <linux/ioctl.h>1516/* Application note:17*18* The driver supports 4 operations: open(), close(), ioctl(), read()19* The device name is /dev/envctrl.20* Below is sample usage:21*22* fd = open("/dev/envtrl", O_RDONLY);23* if (ioctl(fd, ENVCTRL_READ_SHUTDOWN_TEMPERATURE, 0) < 0)24* printf("error\n");25* ret = read(fd, buf, 10);26* close(fd);27*28* Notice in the case of cpu voltage and temperature, the default is29* cpu0. If we need to know the info of cpu1, cpu2, cpu3, we need to30* pass in cpu number in ioctl() last parameter. For example, to31* get the voltage of cpu2:32*33* ioctlbuf[0] = 2;34* if (ioctl(fd, ENVCTRL_READ_CPU_VOLTAGE, ioctlbuf) < 0)35* printf("error\n");36* ret = read(fd, buf, 10);37*38* All the return values are in ascii. So check read return value39* and do appropriate conversions in your application.40*/4142/* IOCTL commands */4344/* Note: these commands reflect possible monitor features.45* Some boards choose to support some of the features only.46*/47#define ENVCTRL_RD_CPU_TEMPERATURE _IOR('p', 0x40, int)48#define ENVCTRL_RD_CPU_VOLTAGE _IOR('p', 0x41, int)49#define ENVCTRL_RD_FAN_STATUS _IOR('p', 0x42, int)50#define ENVCTRL_RD_WARNING_TEMPERATURE _IOR('p', 0x43, int)51#define ENVCTRL_RD_SHUTDOWN_TEMPERATURE _IOR('p', 0x44, int)52#define ENVCTRL_RD_VOLTAGE_STATUS _IOR('p', 0x45, int)53#define ENVCTRL_RD_SCSI_TEMPERATURE _IOR('p', 0x46, int)54#define ENVCTRL_RD_ETHERNET_TEMPERATURE _IOR('p', 0x47, int)55#define ENVCTRL_RD_MTHRBD_TEMPERATURE _IOR('p', 0x48, int)5657#define ENVCTRL_RD_GLOBALADDRESS _IOR('p', 0x49, int)5859/* Read return values for a voltage status request. */60#define ENVCTRL_VOLTAGE_POWERSUPPLY_GOOD 0x0161#define ENVCTRL_VOLTAGE_BAD 0x0262#define ENVCTRL_POWERSUPPLY_BAD 0x0363#define ENVCTRL_VOLTAGE_POWERSUPPLY_BAD 0x046465/* Read return values for a fan status request.66* A failure match means either the fan fails or67* the fan is not connected. Some boards have optional68* connectors to connect extra fans.69*70* There are maximum 8 monitor fans. Some are cpu fans71* some are system fans. The mask below only indicates72* fan by order number.73* Below is a sample application:74*75* if (ioctl(fd, ENVCTRL_READ_FAN_STATUS, 0) < 0) {76* printf("ioctl fan failed\n");77* }78* if (read(fd, rslt, 1) <= 0) {79* printf("error or fan not monitored\n");80* } else {81* if (rslt[0] == ENVCTRL_ALL_FANS_GOOD) {82* printf("all fans good\n");83* } else if (rslt[0] == ENVCTRL_ALL_FANS_BAD) {84* printf("all fans bad\n");85* } else {86* if (rslt[0] & ENVCTRL_FAN0_FAILURE_MASK) {87* printf("fan 0 failed or not connected\n");88* }89* ......90*/9192#define ENVCTRL_ALL_FANS_GOOD 0x0093#define ENVCTRL_FAN0_FAILURE_MASK 0x0194#define ENVCTRL_FAN1_FAILURE_MASK 0x0295#define ENVCTRL_FAN2_FAILURE_MASK 0x0496#define ENVCTRL_FAN3_FAILURE_MASK 0x0897#define ENVCTRL_FAN4_FAILURE_MASK 0x1098#define ENVCTRL_FAN5_FAILURE_MASK 0x2099#define ENVCTRL_FAN6_FAILURE_MASK 0x40100#define ENVCTRL_FAN7_FAILURE_MASK 0x80101#define ENVCTRL_ALL_FANS_BAD 0xFF102103#endif /* !(_SPARC64_ENVCTRL_H) */104105106