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// sensor addr
25#define TOP_INLET_ADDR (0x92 >> 1)
26#define BOT_INLET_ADDR (0x94 >> 1)
27#define BOT_OUTLET_ADDR (0X96 >> 1)
28
29#define ASIC_MEDHA0_SENSOR0_ADDR (0x98 >> 1)
30#define ASIC_MEDHA0_SENSOR1_ADDR (0x98 >> 1)
31#define ASIC_OWL_W_ADDR (0x9A >> 1)
32#define ASIC_OWL_E_ADDR (0x9A >> 1)
33#define ASIC_HAMSA_CRM_ADDR (0x98 >> 1)
34#define ASIC_HAMSA_LS_ADDR (0x98 >> 1)
35#define ASIC_MEDHA1_SENSOR0_ADDR (0x9A >> 1)
36#define ASIC_MEDHA1_SENSOR1_ADDR (0x9A >> 1)
37
38#define ASIC_P0V85_MEDHA0_VDD_ADDR (0x50 >> 1)
39#define ASIC_P0V85_MEDHA1_VDD_ADDR (0x4C >> 1)
40#define ASIC_P0V9_OWL_E_TRVDD_ADDR (0xEE >> 1)
41#define ASIC_P0V75_OWL_E_TRVDD_ADDR (0xEE >> 1)
42#define ASIC_P0V75_MAX_M_VDD_ADDR (0xEA >> 1)
43#define ASIC_P0V75_VDDPHY_HBM1357_ADDR (0xEA >> 1)
44#define ASIC_P0V75_OWL_E_VDD_ADDR (0xE2 >> 1)
45#define ASIC_P0V4_VDDQL_HBM1357_ADDR (0xE2 >> 1)
46#define ASIC_P1V1_VDDQC_HBM1357_ADDR (0xEC >> 1)
47#define ASIC_P1V8_VPP_HBM1357_ADDR (0xEC >> 1)
48
49#define ASIC_P0V75_MAX_N_VDD_ADDR (0xF6 >> 1)
50#define ASIC_P0V8_HAMSA_AVDD_PCIE_ADDR (0xF6 >> 1)
51#define ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_ADDR (0xF2 >> 1)
52#define ASIC_P0V85_HAMSA_VDD_ADDR (0xF2 >> 1)
53#define ASIC_P1V1_VDDQC_HBM0246_ADDR (0xE0 >> 1)
54#define ASIC_P1V8_VPP_HBM0246_ADDR (0xE0 >> 1)
55#define ASIC_P0V4_VDDQL_HBM0246_ADDR (0xE4 >> 1)
56#define ASIC_P0V75_VDDPHY_HBM0246_ADDR (0xE4 >> 1)
57#define ASIC_P0V75_OWL_W_VDD_ADDR (0xE6 >> 1)
58#define ASIC_P0V75_MAX_S_VDD_ADDR (0xE6 >> 1)
59#define ASIC_P0V9_OWL_W_TRVDD_ADDR (0xF8 >> 1)
60#define ASIC_P0V75_OWL_W_TRVDD_ADDR (0xF8 >> 1)
61
62// VR_MODULE_RNS module addr
63#define ASIC_P0V85_MEDHA0_VDD_RNS_ADDR (0xEC >> 1)
64#define ASIC_P0V85_MEDHA1_VDD_RNS_ADDR (0xE4 >> 1)
65#define ASIC_P0V9_OWL_E_TRVDD_RNS_ADDR (0xC4 >> 1)
66#define ASIC_P0V75_OWL_E_TRVDD_RNS_ADDR (0xC4 >> 1)
67#define ASIC_P0V75_MAX_M_VDD_RNS_ADDR (0xE8 >> 1)
68#define ASIC_P0V75_VDDPHY_HBM1357_RNS_ADDR (0xE8 >> 1)
69#define ASIC_P0V75_OWL_E_VDD_RNS_ADDR (0xC2 >> 1)
70#define ASIC_P0V4_VDDQL_HBM1357_RNS_ADDR (0xC2 >> 1)
71#define ASIC_P1V1_VDDQC_HBM1357_RNS_ADDR (0xC6 >> 1)
72#define ASIC_P1V8_VPP_HBM1357_RNS_ADDR (0xC6 >> 1)
73
74#define ASIC_P0V75_MAX_N_VDD_RNS_ADDR (0xC2 >> 1)
75#define ASIC_P0V8_HAMSA_AVDD_PCIE_RNS_ADDR (0xC2 >> 1)
76#define ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_RNS_ADDR (0xC6 >> 1)
77#define ASIC_P0V85_HAMSA_VDD_RNS_ADDR (0xC6 >> 1)
78#define ASIC_P1V1_VDDQC_HBM0246_RNS_ADDR (0xC0 >> 1)
79#define ASIC_P1V8_VPP_HBM0246_RNS_ADDR (0xC0 >> 1)
80#define ASIC_P0V4_VDDQL_HBM0246_RNS_ADDR (0xE8 >> 1)
81#define ASIC_P0V75_VDDPHY_HBM0246_RNS_ADDR (0xE8 >> 1)
82#define ASIC_P0V75_OWL_W_VDD_RNS_ADDR (0xC4 >> 1)
83#define ASIC_P0V75_MAX_S_VDD_RNS_ADDR (0xC4 >> 1)
84#define ASIC_P0V9_OWL_W_TRVDD_RNS_ADDR (0xEA >> 1)
85#define ASIC_P0V75_OWL_W_TRVDD_RNS_ADDR (0xEA >> 1)
86
87#define UBC1_ADDR (0x28 >> 1)
88#define UBC2_ADDR (0x34 >> 1)
89
90// sensor number
91/* Define sensors address(7 bit) */
92#define SENSOR_NUM_TOP_INLET_TEMP_C 0x01
93#define SENSOR_NUM_BOT_INLET_TEMP_C 0x02
94#define SENSOR_NUM_BOT_OUTLET_TEMP_C 0x03
95#define SENSOR_NUM_ASIC_MEDHA0_SENSOR0_TEMP_C 0x04
96#define SENSOR_NUM_ASIC_MEDHA0_SENSOR1_TEMP_C 0x05
97#define SENSOR_NUM_ASIC_OWL_W_TEMP_C 0x06
98#define SENSOR_NUM_ASIC_OWL_E_TEMP_C 0x07
99#define SENSOR_NUM_ASIC_MEDHA1_SENSOR0_TEMP_C 0x08
100#define SENSOR_NUM_ASIC_MEDHA1_SENSOR1_TEMP_C 0x09
101#define SENSOR_NUM_ASIC_HAMSA_CRM_TEMP_C 0x0A
102#define SENSOR_NUM_ASIC_HAMSA_LS_TEMP_C 0x0B
103
104#define SENSOR_NUM_ASIC_P0V85_MEDHA0_VDD_TEMP_C 0x0C
105#define SENSOR_NUM_ASIC_P0V85_MEDHA0_VDD_VOLT_V 0x0D
106#define SENSOR_NUM_ASIC_P0V85_MEDHA0_VDD_CURR_A 0x0E
107#define SENSOR_NUM_ASIC_P0V85_MEDHA0_VDD_PWR_W 0x0F
108
109#define SENSOR_NUM_ASIC_P0V85_MEDHA1_VDD_TEMP_C 0x10
110#define SENSOR_NUM_ASIC_P0V85_MEDHA1_VDD_VOLT_V 0x11
111#define SENSOR_NUM_ASIC_P0V85_MEDHA1_VDD_CURR_A 0x12
112#define SENSOR_NUM_ASIC_P0V85_MEDHA1_VDD_PWR_W 0x13
113
114#define SENSOR_NUM_ASIC_P0V9_OWL_E_TRVDD_TEMP_C 0x14
115#define SENSOR_NUM_ASIC_P0V9_OWL_E_TRVDD_VOLT_V 0x15
116#define SENSOR_NUM_ASIC_P0V9_OWL_E_TRVDD_CURR_A 0x16
117#define SENSOR_NUM_ASIC_P0V9_OWL_E_TRVDD_PWR_W 0x17
118
119#define SENSOR_NUM_ASIC_P0V75_OWL_E_TRVDD_TEMP_C 0x18
120#define SENSOR_NUM_ASIC_P0V75_OWL_E_TRVDD_VOLT_V 0x19
121#define SENSOR_NUM_ASIC_P0V75_OWL_E_TRVDD_CURR_A 0x1A
122#define SENSOR_NUM_ASIC_P0V75_OWL_E_TRVDD_PWR_W 0x1B
123
124#define SENSOR_NUM_ASIC_P0V75_OWL_E_VDD_TEMP_C 0x1C
125#define SENSOR_NUM_ASIC_P0V75_OWL_E_VDD_VOLT_V 0x1D
126#define SENSOR_NUM_ASIC_P0V75_OWL_E_VDD_CURR_A 0x1E
127#define SENSOR_NUM_ASIC_P0V75_OWL_E_VDD_PWR_W 0x1F
128
129#define SENSOR_NUM_ASIC_P0V9_OWL_W_TRVDD_TEMP_C 0x20
130#define SENSOR_NUM_ASIC_P0V9_OWL_W_TRVDD_VOLT_V 0x21
131#define SENSOR_NUM_ASIC_P0V9_OWL_W_TRVDD_CURR_A 0x22
132#define SENSOR_NUM_ASIC_P0V9_OWL_W_TRVDD_PWR_W 0x23
133
134#define SENSOR_NUM_ASIC_P0V75_OWL_W_TRVDD_TEMP_C 0x24
135#define SENSOR_NUM_ASIC_P0V75_OWL_W_TRVDD_VOLT_V 0x25
136#define SENSOR_NUM_ASIC_P0V75_OWL_W_TRVDD_CURR_A 0x26
137#define SENSOR_NUM_ASIC_P0V75_OWL_W_TRVDD_PWR_W 0x27
138
139#define SENSOR_NUM_ASIC_P0V75_OWL_W_VDD_TEMP_C 0x28
140#define SENSOR_NUM_ASIC_P0V75_OWL_W_VDD_VOLT_V 0x29
141#define SENSOR_NUM_ASIC_P0V75_OWL_W_VDD_CURR_A 0x2A
142#define SENSOR_NUM_ASIC_P0V75_OWL_W_VDD_PWR_W 0x2B
143
144#define SENSOR_NUM_ASIC_P0V75_MAX_M_VDD_TEMP_C 0x2C
145#define SENSOR_NUM_ASIC_P0V75_MAX_M_VDD_VOLT_V 0x2D
146#define SENSOR_NUM_ASIC_P0V75_MAX_M_VDD_CURR_A 0x2E
147#define SENSOR_NUM_ASIC_P0V75_MAX_M_VDD_PWR_W 0x2F
148
149#define SENSOR_NUM_ASIC_P0V75_MAX_N_VDD_TEMP_C 0x30
150#define SENSOR_NUM_ASIC_P0V75_MAX_N_VDD_VOLT_V 0x31
151#define SENSOR_NUM_ASIC_P0V75_MAX_N_VDD_CURR_A 0x32
152#define SENSOR_NUM_ASIC_P0V75_MAX_N_VDD_PWR_W 0x33
153
154#define SENSOR_NUM_ASIC_P0V75_MAX_S_VDD_TEMP_C 0x34
155#define SENSOR_NUM_ASIC_P0V75_MAX_S_VDD_VOLT_V 0x35
156#define SENSOR_NUM_ASIC_P0V75_MAX_S_VDD_CURR_A 0x36
157#define SENSOR_NUM_ASIC_P0V75_MAX_S_VDD_PWR_W 0x37
158
159#define SENSOR_NUM_ASIC_P0V8_HAMSA_AVDD_PCIE_TEMP_C 0x38
160#define SENSOR_NUM_ASIC_P0V8_HAMSA_AVDD_PCIE_VOLT_V 0x39
161#define SENSOR_NUM_ASIC_P0V8_HAMSA_AVDD_PCIE_CURR_A 0x3A
162#define SENSOR_NUM_ASIC_P0V8_HAMSA_AVDD_PCIE_PWR_W 0x3B
163
164#define SENSOR_NUM_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_TEMP_C 0x3C
165#define SENSOR_NUM_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_VOLT_V 0x3D
166#define SENSOR_NUM_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_CURR_A 0x3E
167#define SENSOR_NUM_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_PWR_W 0x3F
168
169#define SENSOR_NUM_ASIC_P0V85_HAMSA_VDD_TEMP_C 0x40
170#define SENSOR_NUM_ASIC_P0V85_HAMSA_VDD_VOLT_V 0x41
171#define SENSOR_NUM_ASIC_P0V85_HAMSA_VDD_CURR_A 0x42
172#define SENSOR_NUM_ASIC_P0V85_HAMSA_VDD_PWR_W 0x43
173
174#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM0246_TEMP_C 0x44
175#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM0246_VOLT_V 0x45
176#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM0246_CURR_A 0x46
177#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM0246_PWR_W 0x47
178
179#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM0246_TEMP_C 0x48
180#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM0246_VOLT_V 0x49
181#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM0246_CURR_A 0x4A
182#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM0246_PWR_W 0x4B
183
184#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_TEMP_C 0x4C
185#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_VOLT_V 0x4D
186#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_CURR_A 0x4E
187#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_PWR_W 0x4F
188
189#define SENSOR_NUM_ASIC_P1V8_VPP_HBM0246_TEMP_C 0x50
190#define SENSOR_NUM_ASIC_P1V8_VPP_HBM0246_VOLT_V 0x51
191#define SENSOR_NUM_ASIC_P1V8_VPP_HBM0246_CURR_A 0x52
192#define SENSOR_NUM_ASIC_P1V8_VPP_HBM0246_PWR_W 0x53
193
194#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM1357_TEMP_C 0x54
195#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM1357_VOLT_V 0x55
196#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM1357_CURR_A 0x56
197#define SENSOR_NUM_ASIC_P0V75_VDDPHY_HBM1357_PWR_W 0x57
198
199#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM1357_TEMP_C 0x58
200#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM1357_VOLT_V 0x59
201#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM1357_CURR_A 0x5A
202#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM1357_PWR_W 0x5B
203
204#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_TEMP_C 0x5C
205#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_VOLT_V 0x5D
206#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_CURR_A 0x5E
207#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_PWR_W 0x5F
208
209#define SENSOR_NUM_ASIC_P1V8_VPP_HBM1357_TEMP_C 0x60
210#define SENSOR_NUM_ASIC_P1V8_VPP_HBM1357_VOLT_V 0x61
211#define SENSOR_NUM_ASIC_P1V8_VPP_HBM1357_CURR_A 0x62
212#define SENSOR_NUM_ASIC_P1V8_VPP_HBM1357_PWR_W 0x63
213
214#define SENSOR_NUM_UBC1_P12V_TEMP_C 0x64
215#define SENSOR_NUM_UBC1_P12V_VOLT_V 0x65
216#define SENSOR_NUM_UBC1_P12V_CURR_A 0x66
217#define SENSOR_NUM_UBC1_P12V_PWR_W 0x67
218#define SENSOR_NUM_UBC1_P52V_INPUT_VOLT_V 0x68
219
220#define SENSOR_NUM_UBC2_P12V_TEMP_C 0x69
221#define SENSOR_NUM_UBC2_P12V_VOLT_V 0x6A
222#define SENSOR_NUM_UBC2_P12V_CURR_A 0x6B
223#define SENSOR_NUM_UBC2_P12V_PWR_W 0x6C
224#define SENSOR_NUM_UBC2_P52V_INPUT_VOLT_V 0x6D
225
226#define SENSOR_NUM_NUMBERS 0x6E
227
228#define TMP75_TEMP_OFFSET 0x00
229#define UPDATE_INTERVAL_1S 1
230#define UPDATE_INTERVAL_5S 5
231#define UPDATE_INTERVAL_60S 60
232
239};
240
241int plat_pldm_sensor_get_sensor_count(int thread_id);
245bool is_dc_access(uint8_t sensor_num);
254bool is_ubc_access(uint8_t sensor_num);
255bool is_temp_access(uint8_t cfg_idx);
256bool is_vr_access(uint8_t sensor_num);
257size_t char16_strlen(const char16_t *str);
258char16_t *char16_strcpy(char16_t *dest, const char16_t *src);
260
261bool get_raw_data_from_sensor_id(uint8_t sensor_id, uint8_t offset, uint8_t *val, uint8_t len);
262void change_sensor_cfg(uint8_t vr_module);
263uint8_t convert_addr_to_rns(uint8_t addr);
264#endif
uint32_t val
Definition: plat_util.c:43
uint8_t addr
Definition: isl69259.c:0
uint_least16_t char16_t
Definition: libutil.h:86
bool get_plat_sensor_vr_polling_enable_flag()
Definition: plat_pldm_sensor.c:9800
int plat_pldm_sensor_get_sensor_count(int thread_id)
Definition: plat_pldm_sensor.c:9214
bool is_vr_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9819
char16_t * char16_strcat_char(char16_t *dest)
Definition: plat_pldm_sensor.c:9323
bool is_ubc_access(uint8_t sensor_num)
Definition: plat_pldm_sensor.c:9805
SENSOR_THREAD_LIST
Definition: plat_pldm_sensor.h:226
@ UBC_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:227
@ MAX_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:231
@ TEMP_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:230
@ VR_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:229
size_t char16_strlen(const char16_t *str)
Definition: plat_pldm_sensor.c:9305
bool get_plat_sensor_ubc_polling_enable_flag()
Definition: plat_pldm_sensor.c:9790
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:9243
void set_plat_sensor_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9765
bool get_plat_sensor_temp_polling_enable_flag()
Definition: plat_pldm_sensor.c:9795
bool is_temp_access(uint8_t cfg_idx)
Definition: plat_pldm_sensor.c:9813
sensor_cfg * get_sensor_cfg_by_sensor_id(uint8_t sensor_id)
Definition: plat_pldm_sensor.c:9889
void set_plat_sensor_ubc_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9770
char16_t * char16_strcpy(char16_t *dest, const char16_t *src)
Definition: plat_pldm_sensor.c:9314
void set_plat_sensor_temp_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9775
void set_plat_sensor_vr_polling_enable_flag(bool value)
Definition: plat_pldm_sensor.c:9780
bool get_plat_sensor_polling_enable_flag()
Definition: plat_pldm_sensor.c:9785
PDR_numeric_sensor * numeric_sensor_table
Definition: pdr.c:16
PDR_numeric_sensor
Definition: pdr.h:118
uint32_t offset
Definition: pldm_firmware_update.h:0
uint16_t sensor_id
Definition: pldm_monitor.h:0
bool get_raw_data_from_sensor_id(uint8_t sensor_id, uint8_t offset, uint8_t *val, uint8_t len)
Definition: plat_pldm_sensor.c:9765
@ QUICK_VR_SENSOR_THREAD_ID
Definition: plat_pldm_sensor.h:236
void change_sensor_cfg(uint8_t vr_module)
Definition: plat_pldm_sensor.c:9800
uint8_t convert_addr_to_rns(uint8_t addr)
Definition: plat_pldm_sensor.c:90
uint8_t sensor_num
Definition: storage_handler.h:6
Definition: sensor.h:261