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_ISL69260_ADDR (0xC0 >> 1)
45
46#define P0V85_PVDD_MP2891_ADDR (0x4C >> 1)
47#define P0V85_PVDD_RAA228238_ADDR (0xE4 >> 1)
48
49#define P0V75_PVDD_CH_N_MP2971_ADDR (0xE0 >> 1)
50#define P0V75_PVDD_CH_N_ISL69260_ADDR (0xC0 >> 1)
51
52#define P0V75_MAX_PHY_N_MP2971_ADDR (0xE0 >> 1)
53#define P0V75_MAX_PHY_N_ISL69260_ADDR (0xC0 >> 1)
54
55#define P0V75_PVDD_CH_S_MP2971_ADDR (0xE2 >> 1)
56#define P0V75_PVDD_CH_S_ISL69260_ADDR (0xC2 >> 1)
57
58#define P0V75_MAX_PHY_S_MP2971_ADDR (0xE2 >> 1)
59#define P0V75_MAX_PHY_S_ISL69260_ADDR (0xC2 >> 1)
60
61#define P0V75_TRVDD_ZONEA_MP2971_ADDR (0xE6 >> 1)
62#define P0V75_TRVDD_ZONEA_ISL69260_ADDR (0xC4 >> 1)
63
64#define P1V8_VPP_HBM0_HBM2_HBM4_MP2971_ADDR (0xE6 >> 1)
65#define P1V8_VPP_HBM0_HBM2_HBM4_ISL69260_ADDR (0xC4 >> 1)
66
67#define P0V75_TRVDD_ZONEB_MP2971_ADDR (0xEC >> 1)
68#define P0V75_TRVDD_ZONEB_ISL69260_ADDR (0xC6 >> 1)
69
70#define P0V4_VDDQL_HBM0_HBM2_HBM4_MP2971_ADDR (0xEC >> 1)
71#define P0V4_VDDQL_HBM0_HBM2_HBM4_ISL69260_ADDR (0xC6 >> 1)
72
73#define P1V1_VDDC_HBM0_HBM2_HBM4_MP2971_ADDR (0xEA >> 1)
74#define P1V1_VDDC_HBM0_HBM2_HBM4_ISL69260_ADDR (0xE8 >> 1)
75
76#define P0V75_VDDPHY_HBM0_HBM2_HBM4_MP2971_ADDR (0xEA >> 1)
77#define P0V75_VDDPHY_HBM0_HBM2_HBM4_ISL69260_ADDR (0xE8 >> 1)
78
79#define P0V9_TRVDD_ZONEA_MP2971_ADDR (0xE4 >> 1)
80#define P0V9_TRVDD_ZONEA_ISL69260_ADDR (0xC0 >> 1)
81
82#define P1V8_VPP_HBM1_HBM3_HBM5_MP2971_ADDR (0xE4 >> 1)
83#define P1V8_VPP_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC0 >> 1)
84
85#define P0V9_TRVDD_ZONEB_MP2971_ADDR (0xE8 >> 1)
86#define P0V9_TRVDD_ZONEB_ISL69260_ADDR (0xC2 >> 1)
87
88#define P0V4_VDDQL_HBM1_HBM3_HBM5_MP2971_ADDR (0xE8 >> 1)
89#define P0V4_VDDQL_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC2 >> 1)
90
91#define P1V1_VDDC_HBM1_HBM3_HBM5_MP2971_ADDR (0xEE >> 1)
92#define P1V1_VDDC_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC4 >> 1)
93
94#define P0V75_VDDPHY_HBM1_HBM3_HBM5_MP2971_ADDR (0xEE >> 1)
95#define P0V75_VDDPHY_HBM1_HBM3_HBM5_ISL69260_ADDR (0xC4 >> 1)
96
97#define P0V8_VDDA_PCIE_MP2971_ADDR (0xF2 >> 1)
98#define P0V8_VDDA_PCIE_ISL69260_ADDR (0xC6 >> 1)
99
100#define P1V2_VDDHTX_PCIE_MP2971_ADDR (0xF2 >> 1)
101#define P1V2_VDDHTX_PCIE_ISL69260_ADDR (0xC6 >> 1)
102
103/* Define the sensor numbers used in this platform */
104#define SENSOR_NUM_UBC_1_TEMP_C 0x01
105#define SENSOR_NUM_UBC_1_P50V_VIN_VOLT_V 0x02
106#define SENSOR_NUM_UBC_1_P12V_VOUT_VOLT_V 0x03
107#define SENSOR_NUM_UBC_1_P12V_CURR_A 0x04
108#define SENSOR_NUM_UBC_1_P12V_PWR_W 0x05
109
110#define SENSOR_NUM_UBC_2_TEMP_C 0x06
111#define SENSOR_NUM_UBC_2_P50V_VIN_VOLT_V 0x07
112#define SENSOR_NUM_UBC_2_P12V_VOUT_VOLT_V 0x08
113#define SENSOR_NUM_UBC_2_P12V_CURR_A 0x09
114#define SENSOR_NUM_UBC_2_P12V_PWR_W 0x0A
115
116#define SENSOR_NUM_TOP_INLET_TEMP_C 0x0B
117#define SENSOR_NUM_TOP_OUTLET_TEMP_C 0x0C
118#define SENSOR_NUM_BOT_INLET_TEMP_C 0x0D
119#define SENSOR_NUM_BOT_OUTLET_TEMP_C 0x0E
120#define SENSOR_NUM_ON_DIE_1_TEMP_C 0x0F
121#define SENSOR_NUM_ON_DIE_2_TEMP_C 0x10
122#define SENSOR_NUM_ON_DIE_3_TEMP_C 0x11
123#define SENSOR_NUM_ON_DIE_4_TEMP_C 0x12
124
125#define SENSOR_NUM_OSFP_P3V3_TEMP_C 0x13
126#define SENSOR_NUM_OSFP_P3V3_VOLT_V 0x14
127#define SENSOR_NUM_OSFP_P3V3_CURR_A 0x15
128#define SENSOR_NUM_OSFP_P3V3_PWR_W 0x16
129
130#define SENSOR_NUM_CPU_P0V85_PVDD_TEMP_C 0x17
131#define SENSOR_NUM_CPU_P0V85_PVDD_VOLT_V 0x18
132#define SENSOR_NUM_CPU_P0V85_PVDD_CURR_A 0x19
133#define SENSOR_NUM_CPU_P0V85_PVDD_PWR_W 0x1A
134
135#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_TEMP_C 0x1B
136#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_VOLT_V 0x1C
137#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_CURR_A 0x1D
138#define SENSOR_NUM_CPU_P0V75_PVDD_CH_N_PWR_W 0x1E
139#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_TEMP_C 0x1F
140#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_VOLT_V 0x20
141#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_CURR_A 0x21
142#define SENSOR_NUM_CPU_P0V75_MAX_PHY_N_PWR_W 0x22
143
144#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_TEMP_C 0x23
145#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_VOLT_V 0x24
146#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_CURR_A 0x25
147#define SENSOR_NUM_CPU_P0V75_PVDD_CH_S_PWR_W 0x26
148#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_TEMP_C 0x27
149#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_VOLT_V 0x28
150#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_CURR_A 0x29
151#define SENSOR_NUM_CPU_P0V75_MAX_PHY_S_PWR_W 0x2A
152
153#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_TEMP_C 0x2B
154#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_VOLT_V 0x2C
155#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_CURR_A 0x2D
156#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEA_PWR_W 0x2E
157#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_TEMP_C 0x2F
158#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_VOLT_V 0x30
159#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_CURR_A 0x31
160#define SENSOR_NUM_CPU_P1V8_VPP_HBM0_2_4_PWR_W 0x32
161
162#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_TEMP_C 0x33
163#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_VOLT_V 0x34
164#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_CURR_A 0x35
165#define SENSOR_NUM_CPU_P0V75_TRVDD_ZONEB_PWR_W 0x36
166#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_TEMP_C 0x37
167#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_VOLT_V 0x38
168#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_CURR_A 0x39
169#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM0_2_4_PWR_W 0x3A
170
171#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_TEMP_C 0x3B
172#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_VOLT_V 0x3C
173#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_CURR_A 0x3D
174#define SENSOR_NUM_CPU_P1V1_VDDC_HBM0_2_4_PWR_W 0x3E
175#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_TEMP_C 0x3F
176#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_VOLT_V 0x40
177#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_CURR_A 0x41
178#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM0_2_4_PWR_W 0x42
179
180#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_TEMP_C 0x43
181#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_VOLT_V 0x44
182#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_CURR_A 0x45
183#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEA_PWR_W 0x46
184#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_TEMP_C 0x47
185#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_VOLT_V 0x48
186#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_CURR_A 0x49
187#define SENSOR_NUM_CPU_P1V8_VPP_HBM1_3_5_PWR_W 0x4A
188
189#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_TEMP_C 0x4B
190#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_VOLT_V 0x4C
191#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_CURR_A 0x4D
192#define SENSOR_NUM_CPU_P0V9_TRVDD_ZONEB_PWR_W 0x4E
193#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_TEMP_C 0x4F
194#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_VOLT_V 0x50
195#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_CURR_A 0x51
196#define SENSOR_NUM_CPU_P0V4_VDDQL_HBM1_3_5_PWR_W 0x52
197
198#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_TEMP_C 0x53
199#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_VOLT_V 0x54
200#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_CURR_A 0x55
201#define SENSOR_NUM_CPU_P1V1_VDDC_HBM1_3_5_PWR_W 0x56
202#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_TEMP_C 0x57
203#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_VOLT_V 0x58
204#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_CURR_A 0x59
205#define SENSOR_NUM_CPU_P0V75_VDDPHY_HBM1_3_5_PWR_W 0x5A
206
207#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_TEMP_C 0x5B
208#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_VOLT_V 0x5C
209#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_CURR_A 0x5D
210#define SENSOR_NUM_CPU_P0V8_VDDA_PCIE_PWR_W 0x5E
211#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_TEMP_C 0x5F
212#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_VOLT_V 0x60
213#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_CURR_A 0x61
214#define SENSOR_NUM_CPU_P1V2_VDDHTX_PCIE_PWR_W 0x62
215
216#define TMP75_TEMP_OFFSET 0x00
217#define UPDATE_INTERVAL_1S 1
218#define UPDATE_INTERVAL_5S 5
219#define UPDATE_INTERVAL_60S 60
220
226};
227
231};
232
233int plat_pldm_sensor_get_sensor_count(int thread_id);
237uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev);
241bool is_dc_access(uint8_t sensor_num);
250bool is_ubc_access(uint8_t sensor_num);
251bool is_temp_access(uint8_t cfg_idx);
252bool is_vr_access(uint8_t sensor_num);
253bool get_sensor_info_by_sensor_id(uint8_t sensor_id, uint8_t *vr_bus, uint8_t *vr_addr,
254 uint8_t *sensor_dev);
255bool is_osfp_3v3_access(uint8_t sensor_num);
256size_t char16_strlen(const char16_t *str);
257char16_t *char16_strcpy(char16_t *dest, const char16_t *src);
259
260#endif
uint_least16_t char16_t
Definition: libutil.h:86
GET_VR_DEV_STATUS
Definition: plat_pldm_sensor.h:228
@ GET_VR_DEV_FAILED
Definition: plat_pldm_sensor.h:230
@ GET_VR_DEV_SUCCESS
Definition: plat_pldm_sensor.h:229
bool get_plat_sensor_vr_polling_enable_flag()
Definition: plat_pldm_sensor.c:9464
int plat_pldm_sensor_get_sensor_count(int thread_id)
Definition: plat_pldm_sensor.c:9074
bool is_vr_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9481
bool is_osfp_3v3_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9570
char16_t * char16_strcat_char(char16_t *dest)
Definition: plat_pldm_sensor.c:9164
bool is_ubc_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9469
SENSOR_THREAD_LIST
Definition: plat_pldm_sensor.h:221
@ UBC_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:222
@ MAX_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:225
@ TEMP_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:224
@ VR_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:223
size_t char16_strlen(const char16_t *str)
Definition: plat_pldm_sensor.c:9146
bool get_plat_sensor_ubc_polling_enable_flag()
Definition: plat_pldm_sensor.c:9454
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:9097
void plat_pldm_sensor_change_cpu_bus()
Definition: plat_pldm_sensor.c:6718
void set_plat_sensor_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9429
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:9487
bool get_plat_sensor_temp_polling_enable_flag()
Definition: plat_pldm_sensor.c:9459
void plat_pldm_sensor_change_retimer_dev()
Definition: plat_pldm_sensor.c:6762
bool is_temp_access(uint8_t cfg_idx)
Definition: plat_pldm_sensor.c:9475
void plat_pldm_sensor_change_vr_dev()
Definition: plat_pldm_sensor.c:9301
sensor_cfg * get_sensor_cfg_by_sensor_id(uint8_t sensor_id)
Definition: plat_pldm_sensor.c:9538
void set_plat_sensor_ubc_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9434
char16_t * char16_strcpy(char16_t *dest, const char16_t *src)
Definition: plat_pldm_sensor.c:9155
void set_plat_sensor_temp_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9439
void set_plat_sensor_vr_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9444
uint8_t plat_pldm_sensor_get_vr_dev(uint8_t *vr_dev)
Definition: plat_pldm_sensor.c:6884
bool get_plat_sensor_polling_enable_flag()
Definition: plat_pldm_sensor.c:9449
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:255