OpenBIC
OpenSource Bridge-IC
plat_pldm_sensor.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef PLAT_PLDM_SENSOR_H
18#define PLAT_PLDM_SENSOR_H
19
20#include "pdr.h"
21#include "sensor.h"
22#define ADDR_UNKNOWN (0xFF >> 1)
23
24/* Define sensors address(7 bit) */
25#define DC_BRICK_1_ADDR (0x28 >> 1)
26#define DC_BRICK_2_ADDR (0x34 >> 1)
27
28#define TOP_INLET_TEMP_ADDR (0x92 >> 1)
29#define TOP_OUTLET_TEMP_ADDR (0x9E >> 1)
30#define BOT_INLET_TEMP_ADDR (0x94 >> 1)
31#define BOT_OUTLET_TEMP_ADDR (0X96 >> 1)
32
33#define ON_DIE_1_TEMP_TMP432_ADDR (0X98 >> 1)
34#define ON_DIE_2_TEMP_TMP432_ADDR (0X98 >> 1)
35#define ON_DIE_3_TEMP_TMP432_ADDR (0X9A >> 1)
36#define ON_DIE_4_TEMP_TMP432_ADDR (0X9A >> 1)
37
38#define ON_DIE_1_TEMP_EMC1413_ADDR (0XB8 >> 1)
39#define ON_DIE_2_TEMP_EMC1413_ADDR (0XB8 >> 1)
40#define ON_DIE_3_TEMP_EMC1413_ADDR (0X38 >> 1)
41#define ON_DIE_4_TEMP_EMC1413_ADDR (0X38 >> 1)
42
43#define P3V3_MP2971_ADDR (0xF6 >> 1)
44#define P3V3_MP2971_FAB3_ADDR (0xD6 >> 1) // Change to 0xD6 at FAB3 board
45#define P3V3_ISL69260_ADDR (0xC0 >> 1)
46
47#define P0V85_PVDD_MP2891_ADDR (0x4C >> 1)
48#define P0V85_PVDD_RAA228238_ADDR (0xE4 >> 1)
49
50#define P0V75_PVDD_CH_N_MP2971_ADDR (0xE0 >> 1)
51#define P0V75_PVDD_CH_N_ISL69260_ADDR (0xC0 >> 1)
52
53#define P0V75_MAX_PHY_N_MP2971_ADDR (0xE0 >> 1)
54#define P0V75_MAX_PHY_N_ISL69260_ADDR (0xC0 >> 1)
55
56#define P0V75_PVDD_CH_S_MP2971_ADDR (0xE2 >> 1)
57#define P0V75_PVDD_CH_S_ISL69260_ADDR (0xC2 >> 1)
58
59#define P0V75_MAX_PHY_S_MP2971_ADDR (0xE2 >> 1)
60#define P0V75_MAX_PHY_S_ISL69260_ADDR (0xC2 >> 1)
61
62#define P0V75_TRVDD_ZONEA_MP2971_ADDR (0xE6 >> 1)
63#define P0V75_TRVDD_ZONEA_ISL69260_ADDR (0xC4 >> 1)
64
65#define P1V8_VPP_HBM0_HBM2_HBM4_MP2971_ADDR (0xE6 >> 1)
66#define P1V8_VPP_HBM0_HBM2_HBM4_ISL69260_ADDR (0xC4 >> 1)
67
68#define P0V75_TRVDD_ZONEB_MP2971_ADDR (0xEC >> 1)
69#define P0V75_TRVDD_ZONEB_ISL69260_ADDR (0xC6 >> 1)
70
71#define P0V4_VDDQL_HBM0_HBM2_HBM4_MP2971_ADDR (0xEC >> 1)
72#define P0V4_VDDQL_HBM0_HBM2_HBM4_ISL69260_ADDR (0xC6 >> 1)
73
74#define P1V1_VDDC_HBM0_HBM2_HBM4_MP2971_ADDR (0xEA >> 1)
75#define P1V1_VDDC_HBM0_HBM2_HBM4_ISL69260_ADDR (0xE8 >> 1)
76
77#define P0V75_VDDPHY_HBM0_HBM2_HBM4_MP2971_ADDR (0xEA >> 1)
78#define P0V75_VDDPHY_HBM0_HBM2_HBM4_ISL69260_ADDR (0xE8 >> 1)
79
80#define P0V9_TRVDD_ZONEA_MP2971_ADDR (0xE4 >> 1)
81#define P0V9_TRVDD_ZONEA_ISL69260_ADDR (0xC0 >> 1)
82
83#define P1V8_VPP_HBM1_HBM3_HBM5_MP2971_ADDR (0xE4 >> 1)
84#define P1V8_VPP_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC0 >> 1)
85
86#define P0V9_TRVDD_ZONEB_MP2971_ADDR (0xE8 >> 1)
87#define P0V9_TRVDD_ZONEB_ISL69260_ADDR (0xC2 >> 1)
88
89#define P0V4_VDDQL_HBM1_HBM3_HBM5_MP2971_ADDR (0xE8 >> 1)
90#define P0V4_VDDQL_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC2 >> 1)
91
92#define P1V1_VDDC_HBM1_HBM3_HBM5_MP2971_ADDR (0xEE >> 1)
93#define P1V1_VDDC_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC4 >> 1)
94
95#define P0V75_VDDPHY_HBM1_HBM3_HBM5_MP2971_ADDR (0xEE >> 1)
96#define P0V75_VDDPHY_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC4 >> 1)
97
98#define P0V8_VDDA_PCIE_MP2971_ADDR (0xF2 >> 1)
99#define P0V8_VDDA_PCIE_MP2971_FAB3_ADDR (0xD2 >> 1) // Change to 0xD2 at FAB3 board
100#define P0V8_VDDA_PCIE_ISL69260_ADDR (0xC6 >> 1)
101
102#define P1V2_VDDHTX_PCIE_MP2971_ADDR (0xF2 >> 1)
103#define P1V2_VDDHTX_PCIE_MP2971_FAB3_ADDR (0xD2 >> 1) // Change to 0xD2 at FAB3 board
104#define P1V2_VDDHTX_PCIE_ISL69260_ADDR (0xC6 >> 1)
105
106/* Define the sensor numbers used in this platform */
107#define SENSOR_NUM_UBC_1_TEMP_C 0x01
108#define SENSOR_NUM_UBC_1_P50V_VIN_VOLT_V 0x02
109#define SENSOR_NUM_UBC_1_P12V_VOUT_VOLT_V 0x03
110#define SENSOR_NUM_UBC_1_P12V_CURR_A 0x04
111#define SENSOR_NUM_UBC_1_P12V_PWR_W 0x05
112
113#define SENSOR_NUM_UBC_2_TEMP_C 0x06
114#define SENSOR_NUM_UBC_2_P50V_VIN_VOLT_V 0x07
115#define SENSOR_NUM_UBC_2_P12V_VOUT_VOLT_V 0x08
116#define SENSOR_NUM_UBC_2_P12V_CURR_A 0x09
117#define SENSOR_NUM_UBC_2_P12V_PWR_W 0x0A
118
119#define SENSOR_NUM_TOP_INLET_TEMP_C 0x0B
120#define SENSOR_NUM_TOP_OUTLET_TEMP_C 0x0C
121#define SENSOR_NUM_BOT_INLET_TEMP_C 0x0D
122#define SENSOR_NUM_BOT_OUTLET_TEMP_C 0x0E
123#define SENSOR_NUM_ON_DIE_1_TEMP_C 0x0F
124#define SENSOR_NUM_ON_DIE_2_TEMP_C 0x10
125#define SENSOR_NUM_ON_DIE_3_TEMP_C 0x11
126#define SENSOR_NUM_ON_DIE_4_TEMP_C 0x12
127
128#define SENSOR_NUM_OSFP_P3V3_TEMP_C 0x13
129#define SENSOR_NUM_OSFP_P3V3_VOLT_V 0x14
130#define SENSOR_NUM_OSFP_P3V3_CURR_A 0x15
131#define SENSOR_NUM_OSFP_P3V3_PWR_W 0x16
132
133#define SENSOR_NUM_CPU_P0V85_PVDD_TEMP_C 0x17
134#define SENSOR_NUM_CPU_P0V85_PVDD_VOLT_V 0x18
135#define SENSOR_NUM_CPU_P0V85_PVDD_CURR_A 0x19
136#define SENSOR_NUM_CPU_P0V85_PVDD_PWR_W 0x1A
137
138#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_TEMP_C 0x1B
139#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_VOLT_V 0x1C
140#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_CURR_A 0x1D
141#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_PWR_W 0x1E
142#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_TEMP_C 0x1F
143#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_VOLT_V 0x20
144#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_CURR_A 0x21
145#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_PWR_W 0x22
146
147#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_TEMP_C 0x23
148#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_VOLT_V 0x24
149#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_CURR_A 0x25
150#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_PWR_W 0x26
151#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_TEMP_C 0x27
152#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_VOLT_V 0x28
153#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_CURR_A 0x29
154#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_PWR_W 0x2A
155
156#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_TEMP_C 0x2B
157#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_VOLT_V 0x2C
158#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_CURR_A 0x2D
159#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_PWR_W 0x2E
160#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_TEMP_C 0x2F
161#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_VOLT_V 0x30
162#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_CURR_A 0x31
163#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_PWR_W 0x32
164
165#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_TEMP_C 0x33
166#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_VOLT_V 0x34
167#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_CURR_A 0x35
168#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_PWR_W 0x36
169#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_TEMP_C 0x37
170#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_VOLT_V 0x38
171#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_CURR_A 0x39
172#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_PWR_W 0x3A
173
174#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_TEMP_C 0x3B
175#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_VOLT_V 0x3C
176#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_CURR_A 0x3D
177#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_PWR_W 0x3E
178#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_TEMP_C 0x3F
179#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_VOLT_V 0x40
180#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_CURR_A 0x41
181#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_PWR_W 0x42
182
183#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_TEMP_C 0x43
184#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_VOLT_V 0x44
185#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_CURR_A 0x45
186#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_PWR_W 0x46
187#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_TEMP_C 0x47
188#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_VOLT_V 0x48
189#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_CURR_A 0x49
190#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_PWR_W 0x4A
191
192#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_TEMP_C 0x4B
193#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_VOLT_V 0x4C
194#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_CURR_A 0x4D
195#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_PWR_W 0x4E
196#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_TEMP_C 0x4F
197#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_VOLT_V 0x50
198#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_CURR_A 0x51
199#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_PWR_W 0x52
200
201#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_TEMP_C 0x53
202#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_VOLT_V 0x54
203#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_CURR_A 0x55
204#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_PWR_W 0x56
205#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_TEMP_C 0x57
206#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_VOLT_V 0x58
207#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_CURR_A 0x59
208#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_PWR_W 0x5A
209
210#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_TEMP_C 0x5B
211#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_VOLT_V 0x5C
212#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_CURR_A 0x5D
213#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_PWR_W 0x5E
214#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_TEMP_C 0x5F
215#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_VOLT_V 0x60
216#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_CURR_A 0x61
217#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_PWR_W 0x62
218
219#define TMP75_TEMP_OFFSET 0x00
220#define UPDATE_INTERVAL_1S 1
221#define UPDATE_INTERVAL_5S 5
222#define UPDATE_INTERVAL_60S 60
223
229};
230
234};
235
236int plat_pldm_sensor_get_sensor_count(int thread_id);
240uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev);
244bool is_dc_access(uint8_t sensor_num);
253bool is_ubc_access(uint8_t sensor_num);
254bool is_temp_access(uint8_t cfg_idx);
255bool is_vr_access(uint8_t sensor_num);
256bool get_sensor_info_by_sensor_id(uint8_t sensor_id, uint8_t *vr_bus, uint8_t *vr_addr,
257 uint8_t *sensor_dev);
258bool is_osfp_3v3_access(uint8_t sensor_num);
259size_t char16_strlen(const char16_t *str);
260char16_t *char16_strcpy(char16_t *dest, const char16_t *src);
262
263#endif
uint_least16_t char16_t
Definition: libutil.h:86
GET_VR_DEV_STATUS
Definition: plat_pldm_sensor.h:231
@ GET_VR_DEV_FAILED
Definition: plat_pldm_sensor.h:233
@ GET_VR_DEV_SUCCESS
Definition: plat_pldm_sensor.h:232
bool get_plat_sensor_vr_polling_enable_flag()
Definition: plat_pldm_sensor.c:9577
int plat_pldm_sensor_get_sensor_count(int thread_id)
Definition: plat_pldm_sensor.c:9149
bool is_vr_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9594
bool is_osfp_3v3_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9683
char16_t * char16_strcat_char(char16_t *dest)
Definition: plat_pldm_sensor.c:9239
bool is_ubc_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9582
SENSOR_THREAD_LIST
Definition: plat_pldm_sensor.h:224
@ UBC_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:225
@ MAX_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:228
@ TEMP_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:227
@ VR_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:226
size_t char16_strlen(const char16_t *str)
Definition: plat_pldm_sensor.c:9221
bool get_plat_sensor_ubc_polling_enable_flag()
Definition: plat_pldm_sensor.c:9567
bool is_dc_access(uint8_t sensor_num)
Definition: plat_sensor_table.c:1564
void plat_pldm_sensor_get_pdr_numeric_sensor(int thread_id, int sensor_num, PDR_numeric_sensor *numeric_sensor_table)
Definition: plat_pldm_sensor.c:9172
void plat_pldm_sensor_change_cpu_bus()
Definition: plat_pldm_sensor.c:6719
void set_plat_sensor_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9542
bool get_sensor_info_by_sensor_id(uint8_t sensor_id, uint8_t *vr_bus, uint8_t *vr_addr, uint8_t *sensor_dev)
Definition: plat_pldm_sensor.c:9600
bool get_plat_sensor_temp_polling_enable_flag()
Definition: plat_pldm_sensor.c:9572
void plat_pldm_sensor_change_retimer_dev()
Definition: plat_pldm_sensor.c:6763
bool is_temp_access(uint8_t cfg_idx)
Definition: plat_pldm_sensor.c:9588
void plat_pldm_sensor_change_vr_dev()
Definition: plat_pldm_sensor.c:9414
sensor_cfg * get_sensor_cfg_by_sensor_id(uint8_t sensor_id)
Definition: plat_pldm_sensor.c:9651
void set_plat_sensor_ubc_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9547
char16_t * char16_strcpy(char16_t *dest, const char16_t *src)
Definition: plat_pldm_sensor.c:9230
void set_plat_sensor_temp_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9552
void set_plat_sensor_vr_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9557
uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev)
Definition: plat_pldm_sensor.c:6889
bool get_plat_sensor_polling_enable_flag()
Definition: plat_pldm_sensor.c:9562
PDR_numeric_sensor * numeric_sensor_table
Definition: pdr.c:16
PDR_numeric_sensor
Definition: pdr.h:115
uint16_t sensor_id
Definition: pldm_monitor.h:0
uint8_t sensor_num
Definition: storage_handler.h:6
Definition: sensor.h:256