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