envmon_ebusreg.h revision 1.1 1 /* $NetBSD: envmon_ebusreg.h,v 1.1 2026/09/07 07:35:14 jdc Exp $ */
2
3 /*-
4 * Copyright (c) 2026 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Julian Coleman.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32 /*
33 * Register definitions for "env-monitor":
34 * "SUNW,ebus-pic16f747-env" on U45/U25
35 * "epic" on V245/V215
36 * Registers are indirectly accessed through a address and data register.
37 *
38 * Register contents are mostly copies of registers from other chips on
39 * the i2c bus. On V245/V215, they appear to be only from the chip at
40 * i2c addr 0x5a, and on the U45, from the adt7462 and lm95221.
41 * However, some registers contain sensor data not available elsewhere,
42 * e.g. front panel temperature on U45.
43 */
44
45 #include <sys/cdefs.h>
46 __KERNEL_RCSID(0, "$NetBSD: envmon_ebusreg.h,v 1.1 2026/09/07 07:35:14 jdc Exp $");
47
48 #define ENVMON_COMPAT_PIC "SUNW,ebus-pic16f747-env"
49 #define ENVMON_COMPAT_EPIC "epic"
50
51 /* env-monitor registers */
52 #define ENVMON_DATA 0x40 /* Read/write register data */
53 #define ENVMON_ADDR 0x41 /* Register address to access */
54 #define ENVMON_EPC_LED_MASK 0x80 /* LED write mask */
55
56 /* Indirect registers: U45/U25 */
57 #define ENVMON_PIC_FAN0 0x00 /* Fan 0 speed */
58 #define ENVMON_PIC_FAN1 0x01 /* Fan 1 speed */
59 #define ENVMON_PIC_FAN2 0x02 /* Fan 2 speed */
60 #define ENVMON_PIC_FAN3 0x03 /* Fan 3 speed */
61 #define ENVMON_PIC_FAN4 0x04 /* Fan 4 speed */
62
63 #define ENVMON_PIC_TEMP_ADT 0x06 /* ADT7462 temperature */
64 #define ENVMON_PIC_TEMP_CPU0 0x07 /* CPU 0 temperature */
65 #define ENVMON_PIC_TEMP_CPU1 0x08 /* CPU 1 temperature */
66 #define ENVMON_PIC_TEMP_MB 0x09 /* Motherboard temperature */
67 #define ENVMON_PIC_TEMP_LM 0x0a /* LM95221 temperature */
68 #define ENVMON_PIC_TEMP_FIRE 0x0b /* FireASIC temperature */
69 #define ENVMON_PIC_TEMP_LSI 0x0c /* LSI1064 temperature */
70 #define ENVMON_PIC_TEMP_FP 0x0d /* Front Panel temperature */
71
72 #define ENVMON_PIC_VOLT_15_1 0x0f /* 1.5v #1 */
73 #define ENVMON_PIC_VOLT_15_2 0x10 /* 1.5v #2 */
74
75 #define ENVMON_PIC_TEMP_PSU 0x13 /* Power Supply temperature */
76
77 /* 0x0f/0x10: Voltage scale for 1.5v registers */
78 #define ENVMON_PIC_SCALE_1_5V 7800
79
80 /* Indirect registers: V245/V215 */
81 #define ENVMON_EPC_KEYSW 0x04 /* Virtual keyswitch */
82 #define ENVMON_EPC_FW 0x05 /* Firmware version */
83 #define ENVMON_EPC_LED6 0x06 /* Locator / power LED's */
84 #define ENVMON_EPC_LED7 0x07 /* PSU / temperature LED's */
85 #define ENVMON_EPC_FAN_FT0_F0 0x0e /* Fan tray 0 fan 0 */
86 #define ENVMON_EPC_FAN_FT1_F0 0x0f /* Fan tray 1 fan 0 */
87 #define ENVMON_EPC_FAN_FT2_F0 0x10 /* Fan tray 2 fan 0 */
88 #define ENVMON_EPC_FAN_FT3_F0 0x11 /* Fan tray 3 fan 0 */
89 #define ENVMON_EPC_FAN_FT4_F0 0x12 /* Fan tray 4 fan 0 */
90 #define ENVMON_EPC_FAN_FT5_F0 0x13 /* Fan tray 5 fan 0 */
91 #define ENVMON_EPC_FAN_FT0_F1 0x14 /* Fan tray 0 fan 1 (V215 only) */
92 #define ENVMON_EPC_FAN_FT1_F1 0x15 /* Fan tray 1 fan 1 (V215 only) */
93 #define ENVMON_EPC_FAN_FT2_F1 0x16 /* Fan tray 2 fan 1 (V215 only) */
94 #define ENVMON_EPC_FAN_FT3_F1 0x17 /* Fan tray 3 fan 1 (V215 only) */
95 #define ENVMON_EPC_FAN_FT4_F1 0x18 /* Fan tray 4 fan 1 (V215 only) */
96 #define ENVMON_EPC_FAN_FT5_F1 0x19 /* Fan tray 5 fan 1 (V215 only) */
97 #define ENVMON_EPC_TEMP_FP 0x22 /* Front Panel temperature */
98 #define ENVMON_EPC_FAN_FLT 0x30 /* Fan fault LED's */
99
100 /* 0x04: Virtual keyswitch */
101 #define ENVMON_EPC_KEYSW_NORM 0x00 /* Normal or Diag */
102 #define ENVMON_EPC_KEYSW_OFF 0x02 /* Power off */
103 #define ENVMON_EPC_KEYSW_LOCK 0x04 /* Locked */
104
105 /* 0x06: Front panel LED's */
106 #define ENVMON_EPC_LED6_LOC 0x01 /* Locator */
107 #define ENVMON_EPC_LED6_LOC2 0x02 /* Locator too */
108 #define ENVMON_EPC_LED6_SRV 0x04 /* Service */
109 #define ENVMON_EPC_LED6_SRV_FSH 0x08 /* Service flashing */
110 #define ENVMON_EPC_LED6_PWR 0x10 /* Power */
111 #define ENVMON_EPC_LED6_TF_FLT 0x40 /* Top fan fault */
112 #define ENVMON_EPC_LED6_TF_FLT_FSH 0x80 /* Top fan fault flashing */
113
114 /* 0x07: Front panel LED's */
115 #define ENVMON_EPC_LED7_PSU 0x01 /* PSU fault */
116 #define ENVMON_EPC_LED7_PSU_FSH 0x02 /* PSU fault. flashing */
117 #define ENVMON_EPC_LED7_CTEMP 0x04 /* CPU Overtemperature */
118 #define ENVMON_EPC_LED7_CTEMP_FSH 0x08 /* CPU Overtemp. flashing */
119
120 /* 0x30: Fan fault */
121 #define ENVMON_EPC_NUM_FAN_FLTS 6
122 #define ENVMON_EPC_FAN_FLT_NONE 0x3f
123
124 /* For LED's with flash: both LED and LED_flashing set = LED fast flash. */
125
126 /* Front panel temperature base */
127 #define ENVMON_TEMP_BASE 209150000 /* -64'C */
128