1*29949e86Sstevel /* 2*29949e86Sstevel * CDDL HEADER START 3*29949e86Sstevel * 4*29949e86Sstevel * The contents of this file are subject to the terms of the 5*29949e86Sstevel * Common Development and Distribution License (the "License"). 6*29949e86Sstevel * You may not use this file except in compliance with the License. 7*29949e86Sstevel * 8*29949e86Sstevel * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9*29949e86Sstevel * or http://www.opensolaris.org/os/licensing. 10*29949e86Sstevel * See the License for the specific language governing permissions 11*29949e86Sstevel * and limitations under the License. 12*29949e86Sstevel * 13*29949e86Sstevel * When distributing Covered Code, include this CDDL HEADER in each 14*29949e86Sstevel * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15*29949e86Sstevel * If applicable, add the following below this CDDL HEADER, with the 16*29949e86Sstevel * fields enclosed by brackets "[]" replaced with your own identifying 17*29949e86Sstevel * information: Portions Copyright [yyyy] [name of copyright owner] 18*29949e86Sstevel * 19*29949e86Sstevel * CDDL HEADER END 20*29949e86Sstevel */ 21*29949e86Sstevel 22*29949e86Sstevel /* 23*29949e86Sstevel * Copyright 1998 Sun Microsystems, Inc. All rights reserved. 24*29949e86Sstevel * Use is subject to license terms. 25*29949e86Sstevel */ 26*29949e86Sstevel 27*29949e86Sstevel #ifndef _SYS_ENVCTRL_H 28*29949e86Sstevel #define _SYS_ENVCTRL_H 29*29949e86Sstevel 30*29949e86Sstevel #pragma ident "%Z%%M% %I% %E% SMI" 31*29949e86Sstevel 32*29949e86Sstevel #ifdef __cplusplus 33*29949e86Sstevel extern "C" { 34*29949e86Sstevel #endif 35*29949e86Sstevel 36*29949e86Sstevel 37*29949e86Sstevel 38*29949e86Sstevel 39*29949e86Sstevel #define OVERTEMP_TIMEOUT_USEC 60 * MICROSEC 40*29949e86Sstevel #define BLINK_TIMEOUT_USEC 500 * (MICROSEC / MILLISEC) 41*29949e86Sstevel 42*29949e86Sstevel #define ENVCTRL_NORMAL_MODE 0x01 43*29949e86Sstevel #define ENVCTRL_DIAG_MODE 0x02 44*29949e86Sstevel #define MAX_TAZ_CONTROLLERS 0x02 45*29949e86Sstevel #define ENVCTRL_CHAR_ZERO 0x00 46*29949e86Sstevel #define ENVCTRL_PS_550 550 47*29949e86Sstevel #define ENVCTRL_PS_650 650 48*29949e86Sstevel #define ENVCTRL_INIT_TEMPR 20 49*29949e86Sstevel #define ENVCTRL_TAZCPU_STRING "SUNW,UltraSPARC" 50*29949e86Sstevel #define ENVCTRL_TAZBLKBRDCPU_STRING "SUNW,UltraSPARC-II" 51*29949e86Sstevel #define ENVCTRL_MAX_CPUS 8 52*29949e86Sstevel 53*29949e86Sstevel /* 54*29949e86Sstevel * MACROS 55*29949e86Sstevel */ 56*29949e86Sstevel 57*29949e86Sstevel #define S1 &unitp->bus_ctl_regs->s1 58*29949e86Sstevel #define S0 &unitp->bus_ctl_regs->s0 59*29949e86Sstevel 60*29949e86Sstevel /* 61*29949e86Sstevel * I2c Sensor Types 62*29949e86Sstevel */ 63*29949e86Sstevel 64*29949e86Sstevel #define PCD8584 0x00 /* Bus Controller Master */ 65*29949e86Sstevel #define PCF8591 0x01 /* Temp Sensor 8bit A/D, D/A */ 66*29949e86Sstevel #define PCF8574 0x02 /* PS, FAN, LED, Fail and Control */ 67*29949e86Sstevel #define TDA8444T 0x03 /* Fan Speed Control, 8 bit D/A */ 68*29949e86Sstevel #define PCF8574A 0x04 /* 8574A chip */ 69*29949e86Sstevel #define PCF8583 0x05 /* PCF8583 clock chip */ 70*29949e86Sstevel 71*29949e86Sstevel /* 72*29949e86Sstevel * Max number of a particular 73*29949e86Sstevel * device on 1 bus. 74*29949e86Sstevel */ 75*29949e86Sstevel #define MAX_DEVS 0x10 76*29949e86Sstevel #define I2C_NODEV 0xFF 77*29949e86Sstevel #define MIN_FAN_BANKS 0x02 78*29949e86Sstevel #define INSTANCE_0 0x00 79*29949e86Sstevel 80*29949e86Sstevel /* 81*29949e86Sstevel * Defines for the PCF8583 Clock Calendar Chip 82*29949e86Sstevel * We use this chip as a watchdog timer for the fans 83*29949e86Sstevel * should the kernel thread controling the fans get 84*29949e86Sstevel * wedged. If it does, the alarm wil go off and 85*29949e86Sstevel * set the fans to max speed. 86*29949e86Sstevel * Valid addresses for this chip are A0, A2. 87*29949e86Sstevel * We use the address at A0. 88*29949e86Sstevel * To address this chip the format is as folows (write mode) 89*29949e86Sstevel * | SLaveaddress |MEMORY LOCATION| DATA| 90*29949e86Sstevel * Wgere memory location is the internal location from 91*29949e86Sstevel * 0x00 - 0x0F. 0x00 is the CSR and MUST be addressed 92*29949e86Sstevel * directly. 93*29949e86Sstevel */ 94*29949e86Sstevel 95*29949e86Sstevel #define PCF8583_BASE_ADDR 0xA0 96*29949e86Sstevel #define PCF8583_READ_BIT 0x01 97*29949e86Sstevel 98*29949e86Sstevel #define CLOCK_CSR_REG 0x00 99*29949e86Sstevel 100*29949e86Sstevel #define ALARM_CTRL_REG 0x07 101*29949e86Sstevel #define EGG_TIMER_VAL 0x96 102*29949e86Sstevel #define DIAG_MAX_TIMER_VAL 0x00 103*29949e86Sstevel #define MAX_CL_VAL 59 104*29949e86Sstevel #define MIN_DIAG_TEMPR 0x00 105*29949e86Sstevel #define MAX_DIAG_TEMPR 70 106*29949e86Sstevel #define MAX_AMB_TEMP 50 107*29949e86Sstevel #define MAX_CPU_TEMP 80 108*29949e86Sstevel #define MAX_PS_TEMP 100 109*29949e86Sstevel #define MAX_PS_ADVAL 0xfd 110*29949e86Sstevel #define PS_DEFAULT_VAL 17 /* corresponds to 90 C in lookup table */ 111*29949e86Sstevel #define PS_TEMP_WARN 95 112*29949e86Sstevel #define CPU_AMB_RISE 20 /* cpu runs avg of 20 above amb */ 113*29949e86Sstevel #define PS_AMB_RISE 30 /* cpu runs avg of 30 above amb */ 114*29949e86Sstevel 115*29949e86Sstevel #define CLOCK_ALARM_REG_A 0x08 116*29949e86Sstevel #define CLOCK_ENABLE_TIMER 0xCB 117*29949e86Sstevel #define CLOCK_ENABLE_TIMER_S 0xCA 118*29949e86Sstevel 119*29949e86Sstevel #define CLOCK_DISABLE 0xA0 120*29949e86Sstevel #define CLOCK_ENABLE 0x04 121*29949e86Sstevel 122*29949e86Sstevel /* Keyswitch Definitions */ 123*29949e86Sstevel #define ENVCTRL_FSP_KEYMASK 0xC0 124*29949e86Sstevel #define ENVCTRL_FSP_POMASK 0x20 125*29949e86Sstevel #define ENVCTRL_FSP_KEYLOCKED 0x00 126*29949e86Sstevel #define ENVCTRL_FSP_KEYOFF 0x40 127*29949e86Sstevel #define ENVCTRL_FSP_KEYDIAG 0x80 128*29949e86Sstevel #define ENVCTRL_FSP_KEYON 0xC0 129*29949e86Sstevel 130*29949e86Sstevel /* Disk Fault bit fields */ 131*29949e86Sstevel #define ENVCTRL_DISK_0 0x01 132*29949e86Sstevel #define ENVCTRL_DISK_1 0x02 133*29949e86Sstevel #define ENVCTRL_DISK_2 0x04 134*29949e86Sstevel #define ENVCTRL_DISK_3 0x08 135*29949e86Sstevel #define ENVCTRL_DISK_4 0x10 136*29949e86Sstevel #define ENVCTRL_DISK_5 0x20 137*29949e86Sstevel #define ENVCTRL_DISK_6 0x40 138*29949e86Sstevel #define ENVCTRL_DISK_7 0x80 139*29949e86Sstevel 140*29949e86Sstevel #define ENVCTRL_4SLOT_BACKPLANE 0x0F 141*29949e86Sstevel #define ENVCTRL_8SLOT_BACKPLANE 0xFF 142*29949e86Sstevel 143*29949e86Sstevel 144*29949e86Sstevel /* Front Status Panel Definitions */ 145*29949e86Sstevel #define ENVCTRL_FSP_DISK_ERR 0x01 146*29949e86Sstevel #define ENVCTRL_FSP_PS_ERR 0x02 147*29949e86Sstevel #define ENVCTRL_FSP_TEMP_ERR 0x04 148*29949e86Sstevel #define ENVCTRL_FSP_GEN_ERR 0x08 149*29949e86Sstevel #define ENVCTRL_FSP_ACTIVE 0x10 150*29949e86Sstevel #define ENVCTRL_FSP_POWER 0x20 151*29949e86Sstevel #define ENVCTRL_FSP_USRMASK (ENVCTRL_FSP_DISK_ERR | ENVCTRL_FSP_GEN_ERR) 152*29949e86Sstevel 153*29949e86Sstevel #define ENVCTRL_ENCL_FSP 0x00 154*29949e86Sstevel #define ENVCTRL_ENCL_AMBTEMPR 0x01 155*29949e86Sstevel #define ENVCTRL_ENCL_CPUTEMPR 0x02 156*29949e86Sstevel #define ENVCTRL_ENCL_BACKPLANE4 0x03 157*29949e86Sstevel #define ENVCTRL_ENCL_BACKPLANE8 0x04 158*29949e86Sstevel 159*29949e86Sstevel #define ENVCTRL_FSP_OFF 0x4F 160*29949e86Sstevel #define ENVCTRL_DISK4LED_ALLOFF 0xF0 161*29949e86Sstevel #define ENVCTRL_DISK8LED_ALLOFF 0xFF 162*29949e86Sstevel 163*29949e86Sstevel /* Kstat Structures and defines */ 164*29949e86Sstevel #define ENVCTRL_FAN_TYPE_CPU 0x00 165*29949e86Sstevel #define ENVCTRL_FAN_TYPE_PS 0x01 166*29949e86Sstevel #define ENVCTRL_FAN_TYPE_AFB 0x02 167*29949e86Sstevel 168*29949e86Sstevel #define ENVCTRL_MODULE_NAME "envctrl" 169*29949e86Sstevel #define ENVCTRL_KSTAT_NUMPS "envctrl_numps" 170*29949e86Sstevel #define ENVCTRL_KSTAT_PSNAME "envctrl_pwrsupply" 171*29949e86Sstevel #define ENVCTRL_KSTAT_NUMFANS "envctrl_numfans" 172*29949e86Sstevel #define ENVCTRL_KSTAT_FANSTAT "envctrl_fanstat" 173*29949e86Sstevel #define ENVCTRL_KSTAT_NUMENCLS "envctrl_numencls" 174*29949e86Sstevel #define ENVCTRL_KSTAT_ENCL "envctrl_enclosure" 175*29949e86Sstevel 176*29949e86Sstevel typedef struct envctrl_ps { 177*29949e86Sstevel int instance; /* instance of this type */ 178*29949e86Sstevel ushort_t ps_tempr; /* temperature */ 179*29949e86Sstevel int ps_rating; /* type in watts */ 180*29949e86Sstevel boolean_t ps_ok; /* normal state or not. */ 181*29949e86Sstevel boolean_t curr_share_ok; /* current share imbalance */ 182*29949e86Sstevel boolean_t limit_ok; /* overlimit warning */ 183*29949e86Sstevel } envctrl_ps_t; 184*29949e86Sstevel 185*29949e86Sstevel typedef struct envctrl_fan { 186*29949e86Sstevel int instance; /* instance of this type */ 187*29949e86Sstevel int type; /* CPU, PS or AMBIENT fan */ 188*29949e86Sstevel boolean_t fans_ok; /* are the fans okay */ 189*29949e86Sstevel int fanflt_num; /* if not okay, which fan faulted */ 190*29949e86Sstevel uint_t fanspeed; /* chip to set speed of fans */ 191*29949e86Sstevel } envctrl_fan_t; 192*29949e86Sstevel 193*29949e86Sstevel typedef struct envctrl_encl { 194*29949e86Sstevel int instance; 195*29949e86Sstevel int type; 196*29949e86Sstevel uint_t value; 197*29949e86Sstevel } envctrl_encl_t; 198*29949e86Sstevel 199*29949e86Sstevel /* 200*29949e86Sstevel * configuration registers 201*29949e86Sstevel * Register S1 Looks like the following: 202*29949e86Sstevel * WRITE MODE ONLY 203*29949e86Sstevel * 204*29949e86Sstevel * MSB -------------------------------------> LSB 205*29949e86Sstevel * ---------------------------------------------- 206*29949e86Sstevel * | X | ESO | ES1 | ES2 | ENI | STA | STO | ACK | 207*29949e86Sstevel * ---------------------------------------------- 208*29949e86Sstevel * Low order bits 209*29949e86Sstevel */ 210*29949e86Sstevel 211*29949e86Sstevel #define CSRS1_ENI 0x08 /* Enable interrupts */ 212*29949e86Sstevel #define CSRS1_STA 0x04 /* Packet Start */ 213*29949e86Sstevel #define CSRS1_STO 0x02 /* Packet Stop */ 214*29949e86Sstevel #define CSRS1_ACK 0x01 /* Packet ACK */ 215*29949e86Sstevel 216*29949e86Sstevel /* Hight order bits */ 217*29949e86Sstevel #define CSRS1_PIN 0x80 /* READ and WRITE mode Enable Serial Output */ 218*29949e86Sstevel #define CSRS1_ESO 0x40 /* Enable Serial Output */ 219*29949e86Sstevel #define CSRS1_ES1 0x20 220*29949e86Sstevel #define CSRS1_ES2 0x10 221*29949e86Sstevel 222*29949e86Sstevel /* 223*29949e86Sstevel * configuration registers 224*29949e86Sstevel * Register S1 Looks like the following: 225*29949e86Sstevel * READ MODE ONLY 226*29949e86Sstevel * 227*29949e86Sstevel * MSB -------------------------------------> LSB 228*29949e86Sstevel * ---------------------------------------------- 229*29949e86Sstevel * | PIN | 0 | STS | BER | AD0/LRB | AAS | LAB | BB| 230*29949e86Sstevel * ---------------------------------------------- 231*29949e86Sstevel */ 232*29949e86Sstevel 233*29949e86Sstevel #define CSRS1_STS 0x20 /* For Slave receiv mode stop */ 234*29949e86Sstevel #define CSRS1_BER 0x10 /* Bus Error */ 235*29949e86Sstevel 236*29949e86Sstevel #define CSRS1_LRB 0x08 /* Last Received Bit */ 237*29949e86Sstevel #define CSRS1_AAS 0x04 /* Addressed as Slave */ 238*29949e86Sstevel #define CSRS1_LAB 0x02 /* Lost Arbitration Bit */ 239*29949e86Sstevel #define CSRS1_BB 0x01 /* Bus Busy */ 240*29949e86Sstevel 241*29949e86Sstevel #define START CSRS1_PIN | CSRS1_ESO | CSRS1_STA | CSRS1_ACK 242*29949e86Sstevel #define STOP CSRS1_PIN | CSRS1_ESO | CSRS1_STO | CSRS1_ACK 243*29949e86Sstevel /* 244*29949e86Sstevel * A read wants to have an NACK on the bus to stop 245*29949e86Sstevel * transmitting data from the slave. If you don't 246*29949e86Sstevel * NACK the SDA line will get stuck low. After this you 247*29949e86Sstevel * can send the stop with the ack. 248*29949e86Sstevel */ 249*29949e86Sstevel #define NACK CSRS1_PIN | CSRS1_ESO 250*29949e86Sstevel 251*29949e86Sstevel /* 252*29949e86Sstevel * ESO = Enable Serial output 253*29949e86Sstevel * ES1 and ES2 have different meanings based upon ES0. 254*29949e86Sstevel * The following table explains this association. 255*29949e86Sstevel * 256*29949e86Sstevel * ES0 = 0 = serial interface off. 257*29949e86Sstevel * --------------------------------------------------------- 258*29949e86Sstevel * | A0 | ES1 | ES1 | iACK | OPERATION 259*29949e86Sstevel * --------------------------------------------------------- 260*29949e86Sstevel * | H | X | X | X | Read/write CSR1 (S1) Status n/a 261*29949e86Sstevel * | | | | | 262*29949e86Sstevel * | L | 0 | 0 | X | R/W Own Address S0' 263*29949e86Sstevel * | | | | | 264*29949e86Sstevel * | L | 0 | 1 | X | R/W Intr Vector S3 265*29949e86Sstevel * | | | | | 266*29949e86Sstevel * | L | 1 | 0 | X | R/W Clock Register S2 267*29949e86Sstevel * --------------------------------------------------------- 268*29949e86Sstevel * 269*29949e86Sstevel * ES0 = 1 = serial interface ON. 270*29949e86Sstevel * --------------------------------------------------------- 271*29949e86Sstevel * | A0 | ES1 | ES1 | iACK | OPERATION 272*29949e86Sstevel * --------------------------------------------------------- 273*29949e86Sstevel * | H | X | X | H | Write Control Register (S1) 274*29949e86Sstevel * | | | | | 275*29949e86Sstevel * | H | X | X | H | Read Status Register (S1) 276*29949e86Sstevel * | | | | | 277*29949e86Sstevel * | L | X | 0 | H | R/W Data Register (S0) 278*29949e86Sstevel * | | | | | 279*29949e86Sstevel * | L | X | 1 | H | R/W Interrupt Vector (S3) 280*29949e86Sstevel * | | | | | 281*29949e86Sstevel * | X | 0 | X | L | R Interrupt Vector (S3) ack cycle 282*29949e86Sstevel * | | | | | 283*29949e86Sstevel * | X | 1 | X | L | long distance mode 284*29949e86Sstevel * --------------------------------------------------------- 285*29949e86Sstevel * 286*29949e86Sstevel */ 287*29949e86Sstevel 288*29949e86Sstevel #ifdef TESTBED 289*29949e86Sstevel struct envctrl_pcd8584_regs { 290*29949e86Sstevel uchar_t s0; /* Own Address S0' */ 291*29949e86Sstevel uchar_t pad[3]; /* Padding XXX Will go away in FCS */ 292*29949e86Sstevel uchar_t s1; /* Control Status register */ 293*29949e86Sstevel uchar_t pad1[3]; 294*29949e86Sstevel uchar_t clock_s2; /* Clock programming register */ 295*29949e86Sstevel }; 296*29949e86Sstevel #else 297*29949e86Sstevel struct envctrl_pcd8584_regs { 298*29949e86Sstevel uchar_t s0; /* Own Address S0' */ 299*29949e86Sstevel uchar_t s1; /* Control Status register */ 300*29949e86Sstevel uchar_t clock_s2; /* Clock programming register */ 301*29949e86Sstevel }; 302*29949e86Sstevel #endif 303*29949e86Sstevel #define ENVCTRL_BUS_INIT0 0x80 304*29949e86Sstevel #define ENVCTRL_BUS_INIT1 0x55 305*29949e86Sstevel #define ENVCTRL_BUS_CLOCK0 0xA0 306*29949e86Sstevel #define ENVCTRL_BUS_CLOCK1 0x1C 307*29949e86Sstevel #define ENVCTRL_BUS_ESI 0xC1 308*29949e86Sstevel 309*29949e86Sstevel 310*29949e86Sstevel /* 311*29949e86Sstevel * PCF8591 Chip Used for temperature sensors 312*29949e86Sstevel * 313*29949e86Sstevel * Check with bob to see if singled ended inputs are true 314*29949e86Sstevel * for the pcf8591 temp sensors.. 315*29949e86Sstevel * 316*29949e86Sstevel * Addressing Register definition. 317*29949e86Sstevel * A0-A2 valid range is 0-7 318*29949e86Sstevel * 319*29949e86Sstevel * 7 6 5 4 3 2 1 0 320*29949e86Sstevel * ------------------------------------------------ 321*29949e86Sstevel * | 1 | 0 | 0 | 1 | A2 | A1 | A0 | R/W | 322*29949e86Sstevel * ------------------------------------------------ 323*29949e86Sstevel */ 324*29949e86Sstevel 325*29949e86Sstevel 326*29949e86Sstevel #define PCF8591_BASE_ADDR 0x90 327*29949e86Sstevel #define PCF8501_MAX_DEVS 0x08 328*29949e86Sstevel 329*29949e86Sstevel #define MAXPS 0x02 /* 0 based array */ 330*29949e86Sstevel 331*29949e86Sstevel #define PSTEMP0 0x00 /* DUMMY PS */ 332*29949e86Sstevel #define PSTEMP1 0x94 333*29949e86Sstevel #define PSTEMP2 0x92 334*29949e86Sstevel #define PSTEMP3 0x90 335*29949e86Sstevel #define ENVCTRL_CPU_PCF8591_ADDR (PCF8591_BASE_ADDR | PCF8591_DEV7) 336*29949e86Sstevel 337*29949e86Sstevel #define PCF8591_DEV0 0x00 338*29949e86Sstevel #define PCF8591_DEV1 0x02 339*29949e86Sstevel #define PCF8591_DEV2 0x04 340*29949e86Sstevel #define PCF8591_DEV3 0x06 341*29949e86Sstevel #define PCF8591_DEV4 0x08 342*29949e86Sstevel #define PCF8591_DEV5 0x0A 343*29949e86Sstevel #define PCF8591_DEV6 0x0C 344*29949e86Sstevel #define PCF8591_DEV7 0x0E 345*29949e86Sstevel 346*29949e86Sstevel 347*29949e86Sstevel /* 348*29949e86Sstevel * For the LM75 thermal watchdog chip by TI 349*29949e86Sstevel */ 350*29949e86Sstevel 351*29949e86Sstevel #define LM75_BASE_ADDR 0x9A 352*29949e86Sstevel #define LM75_READ_BIT 0x01 353*29949e86Sstevel #define LM75_CONFIG_ADDR2 0x02 354*29949e86Sstevel #define LM75_CONFIG_ADDR4 0x04 355*29949e86Sstevel #define LM75_CONFIG_ADDR6 0x06 356*29949e86Sstevel #define LM75_CONFIG_ADDR8 0x08 357*29949e86Sstevel #define LM75_CONFIG_ADDRA 0x0A 358*29949e86Sstevel #define LM75_CONFIG_ADDRC 0x0C 359*29949e86Sstevel #define LM75_CONFIG_ADDRE 0x0E 360*29949e86Sstevel #define LM75_COMP_MASK 0x100 361*29949e86Sstevel #define LM75_COMP_MASK_UPPER 0xFF 362*29949e86Sstevel 363*29949e86Sstevel /* 364*29949e86Sstevel * CONTROL OF CHIP 365*29949e86Sstevel * PCF8591 Temp sensing control register definitions 366*29949e86Sstevel * 367*29949e86Sstevel * 7 6 5 4 3 2 1 0 368*29949e86Sstevel * --------------------------------------------- 369*29949e86Sstevel * | 0 | AOE | X | X | 0 | AIF | X | X | 370*29949e86Sstevel * --------------------------------------------- 371*29949e86Sstevel * AOE = Analog out enable.. not used on out implementation 372*29949e86Sstevel * 5 & 4 = Analog Input Programming.. see data sheet for bits.. 373*29949e86Sstevel * 374*29949e86Sstevel * AIF = Auto increment flag 375*29949e86Sstevel * bits 1 & 0 are for the Chennel number. 376*29949e86Sstevel */ 377*29949e86Sstevel 378*29949e86Sstevel #define PCF8591_ANALOG_OUTPUT_EN 0x40 379*29949e86Sstevel #define PCF8591_ANALOG_INPUT_EN 0x00 380*29949e86Sstevel #define PCF8591_READ_BIT 0x01 381*29949e86Sstevel 382*29949e86Sstevel 383*29949e86Sstevel #define PCF8591_AUTO_INCR 0x04 384*29949e86Sstevel #define PCF8591_OSCILATOR 0x40 385*29949e86Sstevel 386*29949e86Sstevel #define PCF8591_MAX_PORTS 0x04 387*29949e86Sstevel 388*29949e86Sstevel #define PCF8591_CH_0 0x00 389*29949e86Sstevel #define PCF8591_CH_1 0x01 390*29949e86Sstevel #define PCF8591_CH_2 0x02 391*29949e86Sstevel #define PCF8591_CH_3 0x03 392*29949e86Sstevel 393*29949e86Sstevel struct envctrl_pcf8591_chip { 394*29949e86Sstevel uchar_t chip_num; /* valid values are 0-7 */ 395*29949e86Sstevel int type; /* type is PCF8591 */ 396*29949e86Sstevel uchar_t sensor_num; /* AIN0, AIN1, AIN2 AIN3 */ 397*29949e86Sstevel uchar_t temp_val; /* value of temp probe */ 398*29949e86Sstevel }; 399*29949e86Sstevel 400*29949e86Sstevel 401*29949e86Sstevel /* 402*29949e86Sstevel * PCF8574 Fan Fail, Power Supply Fail Detector 403*29949e86Sstevel * This device is driven by interrupts. Each time it interrupts 404*29949e86Sstevel * you must look at the CSR to see which ports caused the interrupt 405*29949e86Sstevel * they are indicated by a 1. 406*29949e86Sstevel * 407*29949e86Sstevel * Address map of this chip 408*29949e86Sstevel * 409*29949e86Sstevel * ------------------------------------------- 410*29949e86Sstevel * | 0 | 1 | 1 | 1 | A2 | A1 | A0 | 0 | 411*29949e86Sstevel * ------------------------------------------- 412*29949e86Sstevel * 413*29949e86Sstevel */ 414*29949e86Sstevel 415*29949e86Sstevel #define PCF8574A_BASE_ADDR 0x70 416*29949e86Sstevel #define PCF8574_BASE_ADDR 0x40 417*29949e86Sstevel 418*29949e86Sstevel #define PCF8574_READ_BIT 0x01 419*29949e86Sstevel 420*29949e86Sstevel #define ENVCTRL_PCF8574_DEV0 0x00 421*29949e86Sstevel #define ENVCTRL_PCF8574_DEV1 0x02 422*29949e86Sstevel #define ENVCTRL_PCF8574_DEV2 0x04 423*29949e86Sstevel #define ENVCTRL_PCF8574_DEV3 0x06 424*29949e86Sstevel #define ENVCTRL_PCF8574_DEV4 0x08 425*29949e86Sstevel #define ENVCTRL_PCF8574_DEV5 0x0A 426*29949e86Sstevel #define ENVCTRL_PCF8574_DEV6 0x0C 427*29949e86Sstevel #define ENVCTRL_PCF8574_DEV7 0x0E 428*29949e86Sstevel #define ENVCTRL_INTR_CHIP PCF8574_DEV7 429*29949e86Sstevel 430*29949e86Sstevel #define PS1 PCF8574A_BASE_ADDR | ENVCTRL_PCF8574_DEV3 431*29949e86Sstevel #define PS2 PCF8574A_BASE_ADDR | ENVCTRL_PCF8574_DEV2 432*29949e86Sstevel #define PS3 PCF8574A_BASE_ADDR | ENVCTRL_PCF8574_DEV1 433*29949e86Sstevel 434*29949e86Sstevel #define ENVCTRL_PCF8574_PORT0 0x01 435*29949e86Sstevel #define ENVCTRL_PCF8574_PORT1 0x02 436*29949e86Sstevel #define ENVCTRL_PCF8574_PORT2 0x04 437*29949e86Sstevel #define ENVCTRL_PCF8574_PORT3 0x08 438*29949e86Sstevel #define ENVCTRL_PCF8574_PORT4 0x10 439*29949e86Sstevel #define ENVCTRL_PCF8574_PORT5 0x20 440*29949e86Sstevel #define ENVCTRL_PCF8574_PORT6 0x40 441*29949e86Sstevel #define ENVCTRL_PCF8574_PORT7 0x80 442*29949e86Sstevel 443*29949e86Sstevel #define ENVCTRL_DFLOP_INIT0 0x77 444*29949e86Sstevel #define ENVCTRL_DFLOP_INIT1 0x7F 445*29949e86Sstevel 446*29949e86Sstevel #define ENVCTRL_DEVINTR_INTI0 0xF7 447*29949e86Sstevel #define ENVCTRL_DEVINTR_INTI1 0xFF 448*29949e86Sstevel 449*29949e86Sstevel #define CPU_FAN_1 0x01 450*29949e86Sstevel #define CPU_FAN_2 0x02 451*29949e86Sstevel #define CPU_FAN_3 0x03 452*29949e86Sstevel 453*29949e86Sstevel #define PS_FAN_1 CPU_FAN_1 454*29949e86Sstevel #define PS_FAN_2 CPU_FAN_2 455*29949e86Sstevel #define PS_FAN_3 CPU_FAN_3 456*29949e86Sstevel 457*29949e86Sstevel #define AFB_FAN_1 0x00 458*29949e86Sstevel 459*29949e86Sstevel struct envctrl_pcf8574_chip { 460*29949e86Sstevel uchar_t chip_num; /* valid values are 0-7 */ 461*29949e86Sstevel int type; /* type is PCF8574 */ 462*29949e86Sstevel uint_t val; 463*29949e86Sstevel }; 464*29949e86Sstevel 465*29949e86Sstevel 466*29949e86Sstevel /* 467*29949e86Sstevel * TDA8444T chip structure 468*29949e86Sstevel * FAN Speed Control 469*29949e86Sstevel */ 470*29949e86Sstevel 471*29949e86Sstevel /* ADDRESSING */ 472*29949e86Sstevel 473*29949e86Sstevel #define TDA8444T_BASE_ADDR 0x40 474*29949e86Sstevel 475*29949e86Sstevel 476*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV0 0x00 477*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV1 0x02 478*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV2 0x04 479*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV3 0x06 480*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV4 0x08 481*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV5 0x0A 482*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV6 0x0C 483*29949e86Sstevel #define ENVCTRL_TDA8444T_DEV7 0x0E 484*29949e86Sstevel 485*29949e86Sstevel #define ENVCTRL_FAN_ADDR_MIN ENVCTRL_TDA8444T_DEV0 486*29949e86Sstevel #define ENVCTRL_FAN_ADDR_MAX ENVCTRL_TDA8444T_DEV7 487*29949e86Sstevel 488*29949e86Sstevel /* Control information and port addressing */ 489*29949e86Sstevel 490*29949e86Sstevel #define NO_AUTO_PORT_INCR 0xF0 491*29949e86Sstevel #define AUTO_PORT_INCR 0x00 492*29949e86Sstevel #define TDA8444T_READ_BIT 0x01 493*29949e86Sstevel 494*29949e86Sstevel #define ENVCTRL_CPU_FANS 0x00 495*29949e86Sstevel #define ENVCTRL_PS_FANS 0x01 496*29949e86Sstevel #define ENVCTRL_AFB_FANS 0x02 497*29949e86Sstevel #define ENVCTRL_PORT3 0x03 498*29949e86Sstevel #define ENVCTRL_PORT4 0x04 499*29949e86Sstevel #define ENVCTRL_PORT5 0x05 500*29949e86Sstevel #define ENVCTRL_PORT6 0x06 501*29949e86Sstevel #define ENVCTRL_PORT7 0x07 502*29949e86Sstevel 503*29949e86Sstevel #define MAX_FAN_SPEED 0x3f 504*29949e86Sstevel #define MIN_FAN_VAL 0x00 505*29949e86Sstevel #define MAX_FAN_VAL 0x3f 506*29949e86Sstevel #define AFB_MAX 0x3f 507*29949e86Sstevel #define AFB_MIN 0x1d 508*29949e86Sstevel 509*29949e86Sstevel struct envctrl_tda8444t_chip { 510*29949e86Sstevel uchar_t chip_num; /* valid values are 0-7 */ 511*29949e86Sstevel int type; /* type is TDA8444T */ 512*29949e86Sstevel uchar_t fan_num; /* Ao0-Ao7 */ 513*29949e86Sstevel uchar_t val; /* for fan speed */ 514*29949e86Sstevel }; 515*29949e86Sstevel 516*29949e86Sstevel /* 517*29949e86Sstevel * This table converts an A/D value from the cpu thermistor to a 518*29949e86Sstevel * temperature in degrees C. Usable range is typically 35-135. 519*29949e86Sstevel */ 520*29949e86Sstevel 521*29949e86Sstevel static short cpu_temps[] = { 522*29949e86Sstevel 150, 150, 150, 150, 150, 150, 150, 150, /* 0-7 */ 523*29949e86Sstevel 150, 150, 150, 150, 150, 150, 150, 150, /* 8-15 */ 524*29949e86Sstevel 150, 150, 150, 150, 150, 150, 150, 150, /* 16-23 */ 525*29949e86Sstevel 150, 150, 150, 148, 146, 144, 143, 142, /* 24-31 */ 526*29949e86Sstevel 141, 140, 138, 136, 135, 134, 133, 132, /* 32-39 */ 527*29949e86Sstevel 131, 130, 129, 128, 127, 126, 125, 124, /* 40-47 */ 528*29949e86Sstevel 123, 122, 121, 121, 120, 120, 119, 118, /* 48-55 */ 529*29949e86Sstevel 117, 116, 115, 114, 113, 112, 112, 111, /* 56-63 */ 530*29949e86Sstevel 111, 110, 110, 110, 109, 109, 108, 107, /* 64-71 */ 531*29949e86Sstevel 106, 106, 105, 105, 104, 103, 102, 101, /* 72-79 */ 532*29949e86Sstevel 101, 100, 100, 100, 99, 99, 98, 98, /* 80-87 */ 533*29949e86Sstevel 97, 97, 96, 96, 95, 95, 94, 94, /* 88-95 */ 534*29949e86Sstevel 93, 93, 92, 92, 91, 91, 91, 90, /* 96-103 */ 535*29949e86Sstevel 90, 90, 89, 89, 88, 88, 87, 87, /* 104-111 */ 536*29949e86Sstevel 86, 86, 85, 85, 84, 84, 83, 83, /* 112-119 */ 537*29949e86Sstevel 82, 82, 82, 81, 81, 80, 80, 80, /* 120-127 */ 538*29949e86Sstevel 80, 79, 79, 79, 78, 78, 78, 77, /* 128-135 */ 539*29949e86Sstevel 77, 77, 76, 76, 76, 75, 75, 75, /* 136-143 */ 540*29949e86Sstevel 74, 74, 74, 73, 73, 73, 72, 72, /* 144-151 */ 541*29949e86Sstevel 72, 71, 71, 71, 70, 70, 70, 70, /* 142-159 */ 542*29949e86Sstevel 69, 69, 69, 68, 68, 68, 68, 67, /* 160-167 */ 543*29949e86Sstevel 67, 67, 67, 66, 66, 66, 66, 65, /* 168-175 */ 544*29949e86Sstevel 65, 65, 64, 64, 64, 63, 63, 63, /* 176-183 */ 545*29949e86Sstevel 62, 62, 62, 61, 61, 61, 61, 60, /* 184-191 */ 546*29949e86Sstevel 60, 60, 60, 59, 59, 59, 58, 58, /* 192-199 */ 547*29949e86Sstevel 58, 57, 57, 57, 56, 56, 56, 56, /* 200-207 */ 548*29949e86Sstevel 55, 55, 55, 55, 54, 54, 54, 53, /* 208-215 */ 549*29949e86Sstevel 53, 53, 52, 52, 52, 51, 51, 51, /* 216-223 */ 550*29949e86Sstevel 51, 50, 50, 50, 49, 49, 49, 48, /* 224-231 */ 551*29949e86Sstevel 48, 48, 47, 47, 47, 46, 46, 46, /* 232-239 */ 552*29949e86Sstevel 45, 45, 45, 44, 44, 44, 43, 43, /* 240-247 */ 553*29949e86Sstevel 43, 42, 42, 42, 41, 41, 41, 40, /* 248-255 */ 554*29949e86Sstevel 40, /* 256 */ 555*29949e86Sstevel }; 556*29949e86Sstevel 557*29949e86Sstevel static short ps_temps[] = { 558*29949e86Sstevel 160, 155, 154, 150, 130, 125, 120, 115, /* 0-7 */ 559*29949e86Sstevel 110, 110, 106, 103, 101, 100, 97, 94, /* 8-15 */ 560*29949e86Sstevel 92, 90, 88, 86, 84, 83, 82, 81, /* 16-23 */ 561*29949e86Sstevel 80, 79, 78, 77, 76, 74, 72, 71, /* 24-31 */ 562*29949e86Sstevel 70, 69, 68, 67, 66, 65, 64, 63, /* 32-39 */ 563*29949e86Sstevel 62, 62, 61, 61, 60, 60, 60, 59, /* 40-47 */ 564*29949e86Sstevel 59, 58, 58, 57, 56, 56, 55, 55, /* 48-55 */ 565*29949e86Sstevel 54, 54, 53, 53, 52, 52, 51, 51, /* 56-63 */ 566*29949e86Sstevel 50, 50, 50, 49, 49, 49, 49, 48, /* 64-71 */ 567*29949e86Sstevel 48, 48, 48, 47, 47, 47, 47, 46, /* 72-79 */ 568*29949e86Sstevel 46, 46, 45, 44, 43, 42, 41, 41, /* 80-87 */ 569*29949e86Sstevel 40, 40, 40, 40, 39, 39, 39, 38, /* 88-95 */ 570*29949e86Sstevel 38, 38, 37, 37, 36, 36, 36, 35, /* 96-103 */ 571*29949e86Sstevel 35, 35, 35, 34, 34, 34, 33, 33, /* 104-111 */ 572*29949e86Sstevel 32, 32, 32, 32, 32, 32, 31, 31, /* 112-119 */ 573*29949e86Sstevel 31, 31, 31, 30, 30, 30, 29, 29, /* 120-127 */ 574*29949e86Sstevel 29, 29, 29, 29, 28, 28, 28, 28, /* 128-135 */ 575*29949e86Sstevel 28, 28, 27, 27, 27, 27, 27, 26, /* 136-143 */ 576*29949e86Sstevel 26, 26, 26, 26, 26, 26, 26, 26, /* 144-151 */ 577*29949e86Sstevel 25, 25, 25, 25, 24, 24, 23, 23, /* 142-159 */ 578*29949e86Sstevel 22, 22, 21, 21, 21, 21, 21, 21, /* 160-167 */ 579*29949e86Sstevel 20, 20, 20, 20, 19, 19, 19, 19, /* 168-175 */ 580*29949e86Sstevel 19, 18, 18, 18, 18, 18, 17, 17, /* 176-183 */ 581*29949e86Sstevel 17, 17, 17, 16, 16, 16, 16, 15, /* 184-191 */ 582*29949e86Sstevel 15, 15, 15, 15, 15, 14, 14, 14, /* 192-199 */ 583*29949e86Sstevel 14, 14, 13, 13, 13, 13, 12, 12, /* 200-207 */ 584*29949e86Sstevel 12, 12, 12, 11, 11, 11, 11, 11, /* 208-215 */ 585*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 216-223 */ 586*29949e86Sstevel 9, 9, 9, 9, 9, 9, 8, 8, /* 224-231 */ 587*29949e86Sstevel 8, 8, 8, 7, 7, 7, 7, 7, /* 232-239 */ 588*29949e86Sstevel 7, 6, 6, 6, 6, 6, 6, 6, /* 240-247 */ 589*29949e86Sstevel 5, 5, 5, 5, 5, 5, 5, 4, /* 248-255 */ 590*29949e86Sstevel 4, /* 256 */ 591*29949e86Sstevel }; 592*29949e86Sstevel 593*29949e86Sstevel /* 594*29949e86Sstevel * This is the lookup table used for P1 and FCS systems to convert a temperature 595*29949e86Sstevel * to a fanspeed for the CPU side of the machine. 596*29949e86Sstevel */ 597*29949e86Sstevel 598*29949e86Sstevel static short acme_cpu_fanspd[] = { 599*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 0-7 */ 600*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 8-15 */ 601*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 16-23 */ 602*29949e86Sstevel 31, 31, 31, 31, 32, 33, 34, 35, /* 24-31 */ 603*29949e86Sstevel 36, 37, 38, 39, 40, 42, 43, 45, /* 32-39 */ 604*29949e86Sstevel 48, 49, 50, 51, 52, 53, 54, 55, /* 40-47 */ 605*29949e86Sstevel 56, 57, 58, 59, 60, 61, 62, 63, /* 48-55 */ 606*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 56-63 */ 607*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 64-71 */ 608*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 72-79 */ 609*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 80-87 */ 610*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 88-95 */ 611*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 96-103 */ 612*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 104-111 */ 613*29949e86Sstevel }; 614*29949e86Sstevel 615*29949e86Sstevel /* 616*29949e86Sstevel * This is the lookup table used for P1 and FCS systems to convert a temperature 617*29949e86Sstevel * to a fanspeed for the CPU side of the machine. 618*29949e86Sstevel */ 619*29949e86Sstevel 620*29949e86Sstevel static short acme_ps_fanspd[] = { 621*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 0-7 */ 622*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 8-15 */ 623*29949e86Sstevel 31, 31, 31, 31, 31, 31, 31, 31, /* 16-23 */ 624*29949e86Sstevel 31, 31, 31, 31, 31, 33, 34, 35, /* 24-31 */ 625*29949e86Sstevel 36, 37, 38, 38, 39, 40, 41, 42, /* 32-39 */ 626*29949e86Sstevel 43, 45, 46, 47, 48, 48, 48, 48, /* 40-47 */ 627*29949e86Sstevel 48, 48, 49, 50, 51, 52, 53, 54, /* 48-55 */ 628*29949e86Sstevel 55, 56, 57, 58, 59, 60, 61, 62, /* 56-63 */ 629*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 64-71 */ 630*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 72-79 */ 631*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 80-87 */ 632*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 88-95 */ 633*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 96-103 */ 634*29949e86Sstevel 63, 63, 63, 63, 63, 63, 63, 63, /* 104-111 */ 635*29949e86Sstevel }; 636*29949e86Sstevel 637*29949e86Sstevel static short ps_fans[] = { 638*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 0-7 */ 639*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 8-15 */ 640*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 16-23 */ 641*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 24-31 */ 642*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 32-39 */ 643*29949e86Sstevel 11, 12, 13, 14, 15, 16, 17, 18, /* 24-31 */ 644*29949e86Sstevel 19, 20, 21, 22, 23, 24, 25, 26, /* 32-39 */ 645*29949e86Sstevel 27, 28, 29, 30, 31, 32, 33, 34, /* 40-47 */ 646*29949e86Sstevel 35, 36, 37, 38, 39, 40, 41, 42, /* 48-55 */ 647*29949e86Sstevel 43, 44, 45, 46, 47, 48, 49, 50, /* 56-63 */ 648*29949e86Sstevel 50, 50, 50, 50, 50, 50, 50, 50, /* 56-63 */ 649*29949e86Sstevel 13, 12, 11, 10, 10, 10, 10, 10, /* 64-71 */ 650*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 651*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 652*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 653*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 654*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 655*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 656*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 657*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 658*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 659*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 660*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 661*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 662*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 663*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 664*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 665*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 666*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 667*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 668*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 669*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 670*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 671*29949e86Sstevel 10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */ 672*29949e86Sstevel 10, 673*29949e86Sstevel }; 674*29949e86Sstevel 675*29949e86Sstevel /* 676*29949e86Sstevel * Get a fan speed setting based upon a temperature value 677*29949e86Sstevel * from the above lookup tables. 678*29949e86Sstevel * Less than zero ia a special case and greater than 70 is a 679*29949e86Sstevel * the operating range of the powersupply. The system operating 680*29949e86Sstevel * range is 5 - 40 Degrees C. 681*29949e86Sstevel * This may need some tuning. 682*29949e86Sstevel * The MAX_CPU_TEMP is set to 80 now, this table is used to set their 683*29949e86Sstevel * fans. 684*29949e86Sstevel */ 685*29949e86Sstevel static short fan_speed[] = { 686*29949e86Sstevel 30, 29, 28, 27, 26, 25, 24, 23, /* 0-7 */ 687*29949e86Sstevel 23, 23, 23, 23, 22, 21, 20, 20, /* 8-15 */ 688*29949e86Sstevel 20, 20, 20, 20, 20, 20, 20, 20, /* 16-23 */ 689*29949e86Sstevel 19, 18, 17, 16, 15, 14, 13, 12, /* 24-31 */ 690*29949e86Sstevel 11, 11, 11, 11, 11, 11, 11, 11, /* 32-39 */ 691*29949e86Sstevel 11, 11, 11, 10, 10, 10, 9, 8, /* 40-47 */ 692*29949e86Sstevel 7, 6, 5, 4, 3, 2, 1, 1, /* 48-55 */ 693*29949e86Sstevel 1, 1, 1, 1, 1, 1, 1, 1, /* 56-63 */ 694*29949e86Sstevel 1, 1, 1, 1, 1, 1, 1, 1, /* 64-71 */ 695*29949e86Sstevel 1, 1, 1, 1, 1, 1, 1, 1, /* 72-79 */ 696*29949e86Sstevel 1, 1, 1, 1, 1, 1, 1, 1, /* 80-87 */ 697*29949e86Sstevel }; 698*29949e86Sstevel 699*29949e86Sstevel 700*29949e86Sstevel #define ENVCTRL_PANEL_LEDS_PR "panel-leds-present" 701*29949e86Sstevel #define ENVCTRL_PANEL_LEDS_STA "panel-leds-state" 702*29949e86Sstevel #define ENVCTRL_DISK_LEDS_PR "disk-leds-present" 703*29949e86Sstevel #define ENVCTRL_DISK_LEDS_STA "disk-leds-state" 704*29949e86Sstevel #define ENVCTRL_LED_BLINK "activity-led-blink?" 705*29949e86Sstevel 706*29949e86Sstevel #define ENVCTRL_IOC_RESETTMPR (int)(_IOW('p', 76, uchar_t)) 707*29949e86Sstevel #define ENVCTRL_IOC_SETMODE (int)(_IOW('p', 77, uchar_t)) 708*29949e86Sstevel #define ENVCTRL_IOC_SETTEMP (int)(_IOW('p', 79, uchar_t)) 709*29949e86Sstevel #define ENVCTRL_IOC_SETFAN (int)(_IOW('p', 80, struct envctrl_tda8444t_chip)) 710*29949e86Sstevel #define ENVCTRL_IOC_SETWDT (int)(_IOW('p', 81, uchar_t)) 711*29949e86Sstevel #define ENVCTRL_IOC_GETFAN (int)(_IOR('p', 81, struct envctrl_tda8444t_chip)) 712*29949e86Sstevel #define ENVCTRL_IOC_GETTEMP (int)(_IOR('p', 82, struct envctrl_pcf8591_chip)) 713*29949e86Sstevel #define ENVCTRL_IOC_GETFANFAIL (int)(_IOR('p', 83, struct envctrl_pcf8574_chip)) 714*29949e86Sstevel #define ENVCTRL_IOC_SETFSP (int)(_IOW('p', 84, uchar_t)) 715*29949e86Sstevel #define ENVCTRL_IOC_SETDSKLED (int)(_IOW('p', 85, struct envctrl_pcf8574_chip)) 716*29949e86Sstevel #define ENVCTRL_IOC_GETDSKLED (int)(_IOR('p', 86, struct envctrl_pcf8574_chip)) 717*29949e86Sstevel #define ENVCTRL_IOC_GETMODE (int)(_IOR('p', 87, uchar_t)) 718*29949e86Sstevel 719*29949e86Sstevel #if defined(_KERNEL) 720*29949e86Sstevel 721*29949e86Sstevel struct envctrlunit { 722*29949e86Sstevel struct envctrl_pcd8584_regs *bus_ctl_regs; 723*29949e86Sstevel ddi_acc_handle_t ctlr_handle; 724*29949e86Sstevel kmutex_t umutex; /* lock for this structure */ 725*29949e86Sstevel int instance; 726*29949e86Sstevel dev_info_t *dip; /* device information */ 727*29949e86Sstevel struct envctrl_ps ps_kstats[MAX_DEVS]; /* kstats for powersupplies */ 728*29949e86Sstevel struct envctrl_fan fan_kstats[MAX_DEVS]; /* kstats for fans */ 729*29949e86Sstevel struct envctrl_encl encl_kstats[MAX_DEVS]; /* kstats for enclosure */ 730*29949e86Sstevel int cpu_pr_location[ENVCTRL_MAX_CPUS]; /* slot true if cpu present */ 731*29949e86Sstevel uint_t num_fans_present; 732*29949e86Sstevel uint_t num_ps_present; 733*29949e86Sstevel uint_t num_encl_present; 734*29949e86Sstevel uint_t num_cpus_present; 735*29949e86Sstevel kstat_t *psksp; 736*29949e86Sstevel kstat_t *fanksp; 737*29949e86Sstevel kstat_t *enclksp; 738*29949e86Sstevel ddi_iblock_cookie_t ic_trap_cookie; /* interrupt cookie */ 739*29949e86Sstevel queue_t *readq; /* pointer to readq */ 740*29949e86Sstevel queue_t *writeq; /* pointer to writeq */ 741*29949e86Sstevel mblk_t *msg; /* current message block */ 742*29949e86Sstevel /* CPR support */ 743*29949e86Sstevel boolean_t suspended; /* TRUE if driver suspended */ 744*29949e86Sstevel boolean_t oflag; /* already open */ 745*29949e86Sstevel int current_mode; /* NORMAL or DIAG_MODE */ 746*29949e86Sstevel int AFB_present; /* is the AFB present */ 747*29949e86Sstevel timeout_id_t timeout_id; /* timeout id */ 748*29949e86Sstevel timeout_id_t pshotplug_id; /* ps poll id */ 749*29949e86Sstevel int ps_present[MAXPS+1]; /* PS present t/f 0 not used */ 750*29949e86Sstevel int num_fans_failed; /* don't change fan speed if > 0 */ 751*29949e86Sstevel int activity_led_blink; 752*29949e86Sstevel int present_led_state; /* is it on or off?? */ 753*29949e86Sstevel timeout_id_t blink_timeout_id; 754*29949e86Sstevel int initting; /* 1 is TRUE , 0 is FALSE , used to mask intrs */ 755*29949e86Sstevel boolean_t shutdown; /* TRUE = power off in error event */ 756*29949e86Sstevel 757*29949e86Sstevel }; 758*29949e86Sstevel 759*29949e86Sstevel #endif /* _KERNEL */ 760*29949e86Sstevel 761*29949e86Sstevel #ifdef __cplusplus 762*29949e86Sstevel } 763*29949e86Sstevel #endif 764*29949e86Sstevel 765*29949e86Sstevel #endif /* _SYS_ENVCTRL_H */ 766