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