OpenBIC
OpenSource Bridge-IC
plat_hook.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_HOOK_H
18#define PLAT_HOOK_H
19
20#include "sensor.h"
21
22#define VR_MAX_NUM 11
23#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
24
25#include "plat_pldm_sensor.h"
26
40};
41
64};
65
75};
76
85};
86
97
107
117};
118
119typedef struct vr_mapping_sensor {
120 uint8_t index;
121 uint8_t sensor_id;
122 uint8_t *sensor_name;
125
126typedef struct vr_vout_user_settings {
129
131
132typedef struct vr_mapping_status {
133 uint8_t index;
134 uint16_t pmbus_reg;
137
139
140typedef struct _vr_pre_proc_arg {
141 void *mutex;
142 uint8_t vr_page;
144
145typedef struct temp_mapping_sensor {
146 uint8_t index;
147 uint8_t sensor_id;
148 uint8_t *sensor_name;
150
154
158
160
162 uint8_t temp_index_threshold_type; //PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
164 uint8_t sensor_id;
167
169
170bool plat_get_vout_min(uint8_t rail, uint16_t *millivolt);
171bool plat_get_vout_max(uint8_t rail, uint16_t *millivolt);
172bool plat_set_vout_min(uint8_t rail, uint16_t *millivolt);
173bool plat_set_vout_max(uint8_t rail, uint16_t *millivolt);
174bool temp_sensor_rail_name_get(uint8_t rail, uint8_t **name);
175bool temp_sensor_rail_enum_get(uint8_t *name, uint8_t *num);
176bool plat_get_temp_status(uint8_t rail, uint8_t *temp_status);
177bool plat_clear_temp_status(uint8_t rail);
178bool pre_vr_read(sensor_cfg *cfg, void *args);
179bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading);
180bool perm_config_clear();
181bool is_mb_dc_on();
182void *vr_mutex_get(enum VR_INDEX_E vr_index);
183void vr_mutex_init(void);
184bool vr_rail_name_get(uint8_t rail, uint8_t **name);
185bool vr_rail_enum_get(uint8_t *name, uint8_t *num);
186int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current);
187bool post_ubc_read(sensor_cfg *cfg, void *args, int *reading);
188void set_uart_power_event_is_enable(bool is_enable);
189void pwr_level_mutex_init(void);
190void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting);
193int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value);
194bool vr_rail_voltage_peak_get(uint8_t *name, int *peak_value);
195bool vr_rail_voltage_peak_clear(uint8_t rail_index);
197void user_settings_init(void);
198bool temp_index_threshold_type_name_get(uint8_t type, uint8_t **name);
199bool temp_threshold_type_enum_get(uint8_t *name, uint8_t *num);
200bool plat_get_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius);
201bool plat_set_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius,
202 bool is_default, bool is_perm);
203bool plat_get_vout_command(uint8_t rail, uint16_t *millivolt);
204bool plat_set_vout_command(uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm);
205bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status);
206bool plat_clear_vr_status(uint8_t rail);
207bool vr_status_name_get(uint8_t rail, uint8_t **name);
208bool vr_status_enum_get(uint8_t *name, uint8_t *num);
209
210#endif
vr_pre_proc_arg vr_pre_read_args[]
Definition: plat_hook.c:962
bool is_mb_dc_on()
Definition: plat_hook.c:1249
struct _vr_pre_proc_arg vr_pre_proc_arg
bool pre_vr_read(sensor_cfg *cfg, void *args)
Definition: plat_hook.c:988
struct vr_mapping_status vr_mapping_status
struct temp_mapping_sensor temp_mapping_sensor
vr_mapping_sensor vr_rail_table[]
Definition: plat_hook.c:347
void set_uart_power_event_is_enable(bool is_enable)
Definition: plat_hook.c:752
bool plat_get_vout_max(uint8_t rail, uint16_t *millivolt)
bool plat_get_vout_command(uint8_t rail, uint16_t *millivolt)
Definition: plat_hook.c:988
struct vr_vout_user_settings vr_vout_user_settings
bool temp_sensor_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:173
void vr_mutex_init(void)
Definition: plat_hook.c:332
bool post_ubc_read(sensor_cfg *cfg, void *args, int *reading)
Definition: plat_hook.c:72
int get_user_settings_alert_level_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:536
struct vr_mapping_sensor vr_mapping_sensor
PLAT_TEMP_INDEX_E
Definition: plat_hook.h:77
@ TEMP_INDEX_ON_DIE_3_4
Definition: plat_hook.h:79
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_hook.h:83
@ TEMP_INDEX_MAX
Definition: plat_hook.h:84
@ TEMP_INDEX_ON_DIE_1_2
Definition: plat_hook.h:78
@ TEMP_INDEX_BOT_INLET
Definition: plat_hook.h:82
@ TEMP_INDEX_TOP_OUTLET
Definition: plat_hook.h:81
@ TEMP_INDEX_TOP_INLET
Definition: plat_hook.h:80
PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
Definition: plat_hook.h:87
@ ON_DIE_3_4_REMOTE_1_THERM_LIMIT
Definition: plat_hook.h:105
@ ON_DIE_3_4_LOCAL_LOW_LIMIT
Definition: plat_hook.h:99
@ BOT_INLET_LOW_LIMIT
Definition: plat_hook.h:112
@ ON_DIE_1_2_REMOTE_1_LOW_LIMIT
Definition: plat_hook.h:91
@ ON_DIE_3_4_LOCAL_HIGH_LIMIT
Definition: plat_hook.h:98
@ ON_DIE_1_2_REMOTE_2_HIGH_LIMIT
Definition: plat_hook.h:92
@ ON_DIE_1_2_REMOTE_1_THERM_LIMIT
Definition: plat_hook.h:95
@ PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX
Definition: plat_hook.h:116
@ TOP_OUTLET_HIGH_LIMIT
Definition: plat_hook.h:111
@ ON_DIE_3_4_REMOTE_2_LOW_LIMIT
Definition: plat_hook.h:103
@ ON_DIE_1_2_LOCAL_THERM_LIMIT
Definition: plat_hook.h:94
@ BOT_OUTLET_HIGH_LIMIT
Definition: plat_hook.h:115
@ BOT_OUTLET_LOW_LIMIT
Definition: plat_hook.h:114
@ ON_DIE_3_4_REMOTE_1_LOW_LIMIT
Definition: plat_hook.h:101
@ TOP_INLET_HIGH_LIMIT
Definition: plat_hook.h:109
@ ON_DIE_1_2_REMOTE_2_LOW_LIMIT
Definition: plat_hook.h:93
@ TOP_OUTLET_LOW_LIMIT
Definition: plat_hook.h:110
@ TOP_INLET_LOW_LIMIT
Definition: plat_hook.h:108
@ ON_DIE_3_4_LOCAL_THERM_LIMIT
Definition: plat_hook.h:104
@ ON_DIE_1_2_REMOTE_2_THERM_LIMIT
Definition: plat_hook.h:96
@ ON_DIE_3_4_REMOTE_1_HIGH_LIMIT
Definition: plat_hook.h:100
@ ON_DIE_1_2_LOCAL_LOW_LIMIT
Definition: plat_hook.h:89
@ ON_DIE_3_4_REMOTE_2_THERM_LIMIT
Definition: plat_hook.h:106
@ ON_DIE_3_4_REMOTE_2_HIGH_LIMIT
Definition: plat_hook.h:102
@ ON_DIE_1_2_REMOTE_1_HIGH_LIMIT
Definition: plat_hook.h:90
@ ON_DIE_1_2_LOCAL_HIGH_LIMIT
Definition: plat_hook.h:88
@ BOT_INLET_HIGH_LIMIT
Definition: plat_hook.h:113
bool temp_sensor_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:186
struct temp_threshold_mapping_sensor temp_threshold_mapping_sensor
bool vr_rail_voltage_peak_get(uint8_t *name, int *peak_value)
Definition: plat_hook.c:802
bool plat_set_vout_max(uint8_t rail, uint16_t *millivolt)
bool vr_vout_user_settings_get(void *user_settings)
Definition: plat_hook.c:462
VR_RAIL_E
Definition: plat_hook.h:42
@ VR_RAIL_E_P0V8_VDDA_PCIE
Definition: plat_hook.h:61
@ VR_RAIL_E_P0V75_VDDPHY_HBM1_3_5
Definition: plat_hook.h:60
@ VR_RAIL_E_P0V75_TRVDD_ZONEA
Definition: plat_hook.h:49
@ VR_RAIL_E_P0V75_VDDPHY_HBM0_2_4
Definition: plat_hook.h:54
@ VR_RAIL_E_P0V75_TRVDD_ZONEB
Definition: plat_hook.h:51
@ VR_RAIL_E_OSFP_P3V3
Definition: plat_hook.h:43
@ VR_RAIL_E_P1V1_VDDC_HBM1_3_5
Definition: plat_hook.h:59
@ VR_RAIL_E_P1V8_VPP_HBM1_3_5
Definition: plat_hook.h:56
@ VR_RAIL_E_P0V85
Definition: plat_hook.h:44
@ VR_RAIL_E_P0V75_PVDD_CH_S
Definition: plat_hook.h:47
@ VR_RAIL_E_P1V8_VPP_HBM0_2_4
Definition: plat_hook.h:50
@ VR_RAIL_E_P0V75_PVDD_CH_N
Definition: plat_hook.h:45
@ VR_RAIL_E_P0V75_MAX_PHY_S
Definition: plat_hook.h:48
@ VR_RAIL_E_P0V9_TRVDD_ZONEB
Definition: plat_hook.h:57
@ VR_RAIL_E_MAX
Definition: plat_hook.h:63
@ VR_RAIL_E_P1V1_VDDC_HBM0_2_4
Definition: plat_hook.h:53
@ VR_RAIL_E_P1V2_VDDHTX_PCIE
Definition: plat_hook.h:62
@ VR_RAIL_E_P0V9_TRVDD_ZONEA
Definition: plat_hook.h:55
@ VR_RAIL_E_P0V4_VDDQL_HBM1_3_5
Definition: plat_hook.h:58
@ VR_RAIL_E_P0V4_VDDQL_HBM0_2_4
Definition: plat_hook.h:52
@ VR_RAIL_E_P0V75_MAX_PHY_N
Definition: plat_hook.h:46
bool plat_get_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius)
Definition: plat_hook.c:1325
bool vr_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:398
VR_INDEX_E
Definition: plat_hook.h:27
@ VR_INDEX_E_P1V1_VDDC_HBM0_HBM2_HBM4
Definition: plat_hook.h:34
@ VR_INDEX_E_P0V85
Definition: plat_hook.h:29
@ VR_INDEX_E_P0V75_CH_S
Definition: plat_hook.h:31
@ VR_INDEX_E_P0V9_TRVDD_ZONEA
Definition: plat_hook.h:35
@ VR_INDEX_E_P0V75_TRVDD_ZONEA
Definition: plat_hook.h:32
@ VR_INDEX_E_P0V75_CH_N
Definition: plat_hook.h:30
@ VR_INDEX_E_P0V9_TRVDD_ZONEB
Definition: plat_hook.h:36
@ VR_INDEX_E_P0V75_TRVDD_ZONEB
Definition: plat_hook.h:33
@ VR_INDEX_E_P1V1_VDDC_HBM1_HBM3_HBM5
Definition: plat_hook.h:37
@ VR_INDEX_E_OSFP_P3V3
Definition: plat_hook.h:28
@ VR_INDEX_E_VDDA_PCIE
Definition: plat_hook.h:38
@ VR_INDEX_MAX
Definition: plat_hook.h:39
bool plat_get_vout_min(uint8_t rail, uint16_t *millivolt)
bool plat_set_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius, bool is_default, bool is_perm)
Definition: plat_hook.c:1373
bool vr_rail_voltage_peak_clear(uint8_t rail_index)
Definition: plat_hook.c:817
struct temp_threshold_user_settings_struct temp_threshold_user_settings_struct
bool vr_status_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:446
bool plat_clear_temp_status(uint8_t rail)
Definition: plat_hook.c:1184
bool plat_set_vout_command(uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm)
Definition: plat_hook.c:1050
bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading)
Definition: plat_hook.c:244
bool vr_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:430
bool temp_index_threshold_type_name_get(uint8_t type, uint8_t **name)
Definition: plat_hook.c:621
bool plat_set_vout_min(uint8_t rail, uint16_t *millivolt)
int set_user_settings_alert_level_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:513
bool temp_threshold_type_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:634
bool perm_config_clear()
Definition: plat_hook.c:954
void user_settings_init(void)
Definition: plat_hook.c:743
bool plat_clear_vr_status(uint8_t rail)
Definition: plat_hook.c:893
temp_threshold_user_settings_struct temp_threshold_user_settings
Definition: plat_hook.c:320
temp_threshold_mapping_sensor temp_threshold_table[]
void * vr_mutex_get(enum VR_INDEX_E vr_index)
Definition: plat_hook.c:202
bool plat_get_vr_status(uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
Definition: plat_hook.c:828
int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value)
Definition: plat_hook.c:785
VR_STAUS_E
Definition: plat_hook.h:66
@ VR_STAUS_E_STATUS_INPUT
Definition: plat_hook.h:71
@ VR_STAUS_E_STATUS_IOUT
Definition: plat_hook.h:70
@ VR_STAUS_E_STATUS_CML
Definition: plat_hook.h:73
@ VR_STAUS_E_MAX
Definition: plat_hook.h:74
@ VR_STAUS_E_STATUS_BYTE
Definition: plat_hook.h:67
@ VR_STAUS_E_STATUS_TEMPERATURE
Definition: plat_hook.h:72
@ VR_STAUS_E_STATUS_VOUT
Definition: plat_hook.h:69
@ VR_STAUS_E_STATUS_WORD
Definition: plat_hook.h:68
bool vr_status_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:411
void pwr_level_mutex_init(void)
Definition: plat_hook.c:763
bool plat_get_temp_status(uint8_t rail, uint8_t *temp_status)
Definition: plat_hook.c:1123
vr_vout_user_settings user_settings
Definition: plat_hook.c:427
int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current)
Definition: plat_hook.c:53
void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting)
Definition: plat_hook.c:770
uint8_t type
Definition: pldm_base.h:0
uint8_t reading[1]
Definition: pldm_monitor.h:3
uint32_t data_length
Definition: pldm_oem.h:1
Definition: sensor.h:256
Definition: plat_hook.h:22
void * mutex
Definition: plat_hook.h:141
uint8_t vr_page
Definition: plat_hook.h:25
Definition: sensor.h:779
Definition: sensor.h:775
Definition: plat_hook.h:145
uint8_t * sensor_name
Definition: plat_hook.h:148
uint8_t index
Definition: plat_hook.h:146
uint8_t sensor_id
Definition: plat_hook.h:147
Definition: plat_hook.h:161
uint8_t sensor_id
Definition: plat_hook.h:164
uint8_t * temp_threshold_name
Definition: plat_hook.h:165
uint8_t temp_threshold_type
Definition: plat_hook.h:163
uint8_t temp_index_threshold_type
Definition: plat_hook.h:162
Definition: plat_hook.h:155
uint32_t temperature_reg_val[PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX]
Definition: plat_hook.h:156
Definition: plat_hook.h:119
uint8_t * sensor_name
Definition: plat_hook.h:122
int peak_value
Definition: plat_hook.h:123
uint8_t sensor_id
Definition: plat_hook.h:121
uint8_t index
Definition: plat_hook.h:120
Definition: plat_hook.h:132
uint8_t * vr_status_name
Definition: plat_hook.h:135
uint16_t pmbus_reg
Definition: plat_hook.h:134
uint8_t index
Definition: plat_hook.h:133
Definition: plat_hook.h:126
uint16_t vout[VR_RAIL_E_MAX]
Definition: plat_hook.h:127
name
Definition: plat_i2c.h:24