/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1998 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#ifndef _SYS_ENVCTRL_H
#define _SYS_ENVCTRL_H
#pragma ident "%Z%%M% %I% %E% SMI"
#ifdef __cplusplus
extern "C" {
#endif
/*
* MACROS
*/
/*
* I2c Sensor Types
*/
/*
* Max number of a particular
* device on 1 bus.
*/
/*
* Defines for the PCF8583 Clock Calendar Chip
* We use this chip as a watchdog timer for the fans
* should the kernel thread controling the fans get
* wedged. If it does, the alarm wil go off and
* set the fans to max speed.
* Valid addresses for this chip are A0, A2.
* We use the address at A0.
* To address this chip the format is as folows (write mode)
* | SLaveaddress |MEMORY LOCATION| DATA|
* Wgere memory location is the internal location from
* 0x00 - 0x0F. 0x00 is the CSR and MUST be addressed
* directly.
*/
/* Keyswitch Definitions */
/* Disk Fault bit fields */
/* Front Status Panel Definitions */
/* Kstat Structures and defines */
typedef struct envctrl_ps {
} envctrl_ps_t;
typedef struct envctrl_fan {
typedef struct envctrl_encl {
int instance;
int type;
/*
* configuration registers
* Register S1 Looks like the following:
* WRITE MODE ONLY
*
* MSB -------------------------------------> LSB
* ----------------------------------------------
* | X | ESO | ES1 | ES2 | ENI | STA | STO | ACK |
* ----------------------------------------------
* Low order bits
*/
/* Hight order bits */
/*
* configuration registers
* Register S1 Looks like the following:
* READ MODE ONLY
*
* MSB -------------------------------------> LSB
* ----------------------------------------------
* ----------------------------------------------
*/
/*
* A read wants to have an NACK on the bus to stop
* transmitting data from the slave. If you don't
* NACK the SDA line will get stuck low. After this you
* can send the stop with the ack.
*/
/*
* ESO = Enable Serial output
* ES1 and ES2 have different meanings based upon ES0.
* The following table explains this association.
*
* ES0 = 0 = serial interface off.
* ---------------------------------------------------------
* | A0 | ES1 | ES1 | iACK | OPERATION
* ---------------------------------------------------------
* | | | | |
* | L | 0 | 0 | X | R/W Own Address S0'
* | | | | |
* | L | 0 | 1 | X | R/W Intr Vector S3
* | | | | |
* | L | 1 | 0 | X | R/W Clock Register S2
* ---------------------------------------------------------
*
* ES0 = 1 = serial interface ON.
* ---------------------------------------------------------
* | A0 | ES1 | ES1 | iACK | OPERATION
* ---------------------------------------------------------
* | H | X | X | H | Write Control Register (S1)
* | | | | |
* | H | X | X | H | Read Status Register (S1)
* | | | | |
* | L | X | 0 | H | R/W Data Register (S0)
* | | | | |
* | L | X | 1 | H | R/W Interrupt Vector (S3)
* | | | | |
* | X | 0 | X | L | R Interrupt Vector (S3) ack cycle
* | | | | |
* | X | 1 | X | L | long distance mode
* ---------------------------------------------------------
*
*/
#ifdef TESTBED
struct envctrl_pcd8584_regs {
};
#else
struct envctrl_pcd8584_regs {
};
#endif
/*
* PCF8591 Chip Used for temperature sensors
*
* Check with bob to see if singled ended inputs are true
* for the pcf8591 temp sensors..
*
* Addressing Register definition.
* A0-A2 valid range is 0-7
*
* 7 6 5 4 3 2 1 0
* ------------------------------------------------
* | 1 | 0 | 0 | 1 | A2 | A1 | A0 | R/W |
* ------------------------------------------------
*/
/*
* For the LM75 thermal watchdog chip by TI
*/
/*
* CONTROL OF CHIP
* PCF8591 Temp sensing control register definitions
*
* 7 6 5 4 3 2 1 0
* ---------------------------------------------
* | 0 | AOE | X | X | 0 | AIF | X | X |
* ---------------------------------------------
* AOE = Analog out enable.. not used on out implementation
* 5 & 4 = Analog Input Programming.. see data sheet for bits..
*
* AIF = Auto increment flag
* bits 1 & 0 are for the Chennel number.
*/
struct envctrl_pcf8591_chip {
};
/*
* PCF8574 Fan Fail, Power Supply Fail Detector
* This device is driven by interrupts. Each time it interrupts
* you must look at the CSR to see which ports caused the interrupt
* they are indicated by a 1.
*
* Address map of this chip
*
* -------------------------------------------
* | 0 | 1 | 1 | 1 | A2 | A1 | A0 | 0 |
* -------------------------------------------
*
*/
struct envctrl_pcf8574_chip {
};
/*
* TDA8444T chip structure
* FAN Speed Control
*/
/* ADDRESSING */
/* Control information and port addressing */
struct envctrl_tda8444t_chip {
};
/*
* This table converts an A/D value from the cpu thermistor to a
* temperature in degrees C. Usable range is typically 35-135.
*/
static short cpu_temps[] = {
150, 150, 150, 150, 150, 150, 150, 150, /* 0-7 */
150, 150, 150, 150, 150, 150, 150, 150, /* 8-15 */
150, 150, 150, 150, 150, 150, 150, 150, /* 16-23 */
150, 150, 150, 148, 146, 144, 143, 142, /* 24-31 */
141, 140, 138, 136, 135, 134, 133, 132, /* 32-39 */
131, 130, 129, 128, 127, 126, 125, 124, /* 40-47 */
123, 122, 121, 121, 120, 120, 119, 118, /* 48-55 */
117, 116, 115, 114, 113, 112, 112, 111, /* 56-63 */
111, 110, 110, 110, 109, 109, 108, 107, /* 64-71 */
106, 106, 105, 105, 104, 103, 102, 101, /* 72-79 */
101, 100, 100, 100, 99, 99, 98, 98, /* 80-87 */
97, 97, 96, 96, 95, 95, 94, 94, /* 88-95 */
93, 93, 92, 92, 91, 91, 91, 90, /* 96-103 */
90, 90, 89, 89, 88, 88, 87, 87, /* 104-111 */
86, 86, 85, 85, 84, 84, 83, 83, /* 112-119 */
82, 82, 82, 81, 81, 80, 80, 80, /* 120-127 */
80, 79, 79, 79, 78, 78, 78, 77, /* 128-135 */
77, 77, 76, 76, 76, 75, 75, 75, /* 136-143 */
74, 74, 74, 73, 73, 73, 72, 72, /* 144-151 */
72, 71, 71, 71, 70, 70, 70, 70, /* 142-159 */
69, 69, 69, 68, 68, 68, 68, 67, /* 160-167 */
67, 67, 67, 66, 66, 66, 66, 65, /* 168-175 */
65, 65, 64, 64, 64, 63, 63, 63, /* 176-183 */
62, 62, 62, 61, 61, 61, 61, 60, /* 184-191 */
60, 60, 60, 59, 59, 59, 58, 58, /* 192-199 */
58, 57, 57, 57, 56, 56, 56, 56, /* 200-207 */
55, 55, 55, 55, 54, 54, 54, 53, /* 208-215 */
53, 53, 52, 52, 52, 51, 51, 51, /* 216-223 */
51, 50, 50, 50, 49, 49, 49, 48, /* 224-231 */
48, 48, 47, 47, 47, 46, 46, 46, /* 232-239 */
45, 45, 45, 44, 44, 44, 43, 43, /* 240-247 */
43, 42, 42, 42, 41, 41, 41, 40, /* 248-255 */
40, /* 256 */
};
static short ps_temps[] = {
160, 155, 154, 150, 130, 125, 120, 115, /* 0-7 */
110, 110, 106, 103, 101, 100, 97, 94, /* 8-15 */
92, 90, 88, 86, 84, 83, 82, 81, /* 16-23 */
80, 79, 78, 77, 76, 74, 72, 71, /* 24-31 */
70, 69, 68, 67, 66, 65, 64, 63, /* 32-39 */
62, 62, 61, 61, 60, 60, 60, 59, /* 40-47 */
59, 58, 58, 57, 56, 56, 55, 55, /* 48-55 */
54, 54, 53, 53, 52, 52, 51, 51, /* 56-63 */
50, 50, 50, 49, 49, 49, 49, 48, /* 64-71 */
48, 48, 48, 47, 47, 47, 47, 46, /* 72-79 */
46, 46, 45, 44, 43, 42, 41, 41, /* 80-87 */
40, 40, 40, 40, 39, 39, 39, 38, /* 88-95 */
38, 38, 37, 37, 36, 36, 36, 35, /* 96-103 */
35, 35, 35, 34, 34, 34, 33, 33, /* 104-111 */
32, 32, 32, 32, 32, 32, 31, 31, /* 112-119 */
31, 31, 31, 30, 30, 30, 29, 29, /* 120-127 */
29, 29, 29, 29, 28, 28, 28, 28, /* 128-135 */
28, 28, 27, 27, 27, 27, 27, 26, /* 136-143 */
26, 26, 26, 26, 26, 26, 26, 26, /* 144-151 */
25, 25, 25, 25, 24, 24, 23, 23, /* 142-159 */
22, 22, 21, 21, 21, 21, 21, 21, /* 160-167 */
20, 20, 20, 20, 19, 19, 19, 19, /* 168-175 */
19, 18, 18, 18, 18, 18, 17, 17, /* 176-183 */
17, 17, 17, 16, 16, 16, 16, 15, /* 184-191 */
15, 15, 15, 15, 15, 14, 14, 14, /* 192-199 */
14, 14, 13, 13, 13, 13, 12, 12, /* 200-207 */
12, 12, 12, 11, 11, 11, 11, 11, /* 208-215 */
10, 10, 10, 10, 10, 10, 10, 10, /* 216-223 */
9, 9, 9, 9, 9, 9, 8, 8, /* 224-231 */
8, 8, 8, 7, 7, 7, 7, 7, /* 232-239 */
7, 6, 6, 6, 6, 6, 6, 6, /* 240-247 */
5, 5, 5, 5, 5, 5, 5, 4, /* 248-255 */
4, /* 256 */
};
/*
* This is the lookup table used for P1 and FCS systems to convert a temperature
* to a fanspeed for the CPU side of the machine.
*/
static short acme_cpu_fanspd[] = {
31, 31, 31, 31, 31, 31, 31, 31, /* 0-7 */
31, 31, 31, 31, 31, 31, 31, 31, /* 8-15 */
31, 31, 31, 31, 31, 31, 31, 31, /* 16-23 */
31, 31, 31, 31, 32, 33, 34, 35, /* 24-31 */
36, 37, 38, 39, 40, 42, 43, 45, /* 32-39 */
48, 49, 50, 51, 52, 53, 54, 55, /* 40-47 */
56, 57, 58, 59, 60, 61, 62, 63, /* 48-55 */
63, 63, 63, 63, 63, 63, 63, 63, /* 56-63 */
63, 63, 63, 63, 63, 63, 63, 63, /* 64-71 */
63, 63, 63, 63, 63, 63, 63, 63, /* 72-79 */
63, 63, 63, 63, 63, 63, 63, 63, /* 80-87 */
63, 63, 63, 63, 63, 63, 63, 63, /* 88-95 */
63, 63, 63, 63, 63, 63, 63, 63, /* 96-103 */
63, 63, 63, 63, 63, 63, 63, 63, /* 104-111 */
};
/*
* This is the lookup table used for P1 and FCS systems to convert a temperature
* to a fanspeed for the CPU side of the machine.
*/
static short acme_ps_fanspd[] = {
31, 31, 31, 31, 31, 31, 31, 31, /* 0-7 */
31, 31, 31, 31, 31, 31, 31, 31, /* 8-15 */
31, 31, 31, 31, 31, 31, 31, 31, /* 16-23 */
31, 31, 31, 31, 31, 33, 34, 35, /* 24-31 */
36, 37, 38, 38, 39, 40, 41, 42, /* 32-39 */
43, 45, 46, 47, 48, 48, 48, 48, /* 40-47 */
48, 48, 49, 50, 51, 52, 53, 54, /* 48-55 */
55, 56, 57, 58, 59, 60, 61, 62, /* 56-63 */
63, 63, 63, 63, 63, 63, 63, 63, /* 64-71 */
63, 63, 63, 63, 63, 63, 63, 63, /* 72-79 */
63, 63, 63, 63, 63, 63, 63, 63, /* 80-87 */
63, 63, 63, 63, 63, 63, 63, 63, /* 88-95 */
63, 63, 63, 63, 63, 63, 63, 63, /* 96-103 */
63, 63, 63, 63, 63, 63, 63, 63, /* 104-111 */
};
static short ps_fans[] = {
10, 10, 10, 10, 10, 10, 10, 10, /* 0-7 */
10, 10, 10, 10, 10, 10, 10, 10, /* 8-15 */
10, 10, 10, 10, 10, 10, 10, 10, /* 16-23 */
10, 10, 10, 10, 10, 10, 10, 10, /* 24-31 */
10, 10, 10, 10, 10, 10, 10, 10, /* 32-39 */
11, 12, 13, 14, 15, 16, 17, 18, /* 24-31 */
19, 20, 21, 22, 23, 24, 25, 26, /* 32-39 */
27, 28, 29, 30, 31, 32, 33, 34, /* 40-47 */
35, 36, 37, 38, 39, 40, 41, 42, /* 48-55 */
43, 44, 45, 46, 47, 48, 49, 50, /* 56-63 */
50, 50, 50, 50, 50, 50, 50, 50, /* 56-63 */
13, 12, 11, 10, 10, 10, 10, 10, /* 64-71 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10, 10, 10, 10, 10, 10, 10, 10, /* 72-79 */
10,
};
/*
* Get a fan speed setting based upon a temperature value
* from the above lookup tables.
* Less than zero ia a special case and greater than 70 is a
* the operating range of the powersupply. The system operating
* range is 5 - 40 Degrees C.
* This may need some tuning.
* The MAX_CPU_TEMP is set to 80 now, this table is used to set their
* fans.
*/
static short fan_speed[] = {
30, 29, 28, 27, 26, 25, 24, 23, /* 0-7 */
23, 23, 23, 23, 22, 21, 20, 20, /* 8-15 */
20, 20, 20, 20, 20, 20, 20, 20, /* 16-23 */
19, 18, 17, 16, 15, 14, 13, 12, /* 24-31 */
11, 11, 11, 11, 11, 11, 11, 11, /* 32-39 */
11, 11, 11, 10, 10, 10, 9, 8, /* 40-47 */
7, 6, 5, 4, 3, 2, 1, 1, /* 48-55 */
1, 1, 1, 1, 1, 1, 1, 1, /* 56-63 */
1, 1, 1, 1, 1, 1, 1, 1, /* 64-71 */
1, 1, 1, 1, 1, 1, 1, 1, /* 72-79 */
1, 1, 1, 1, 1, 1, 1, 1, /* 80-87 */
};
#if defined(_KERNEL)
struct envctrlunit {
int instance;
/* CPR support */
int activity_led_blink;
};
#endif /* _KERNEL */
#ifdef __cplusplus
}
#endif
#endif /* _SYS_ENVCTRL_H */