OpenBIC
OpenSource Bridge-IC
plat_user_setting.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_USER_SETTING_H
18#define PLAT_USER_SETTING_H
19
20#include "sensor.h"
21#include "plat_pldm_sensor.h"
22#include "plat_cpld.h"
23
24#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
25#define TEMP_THRESHOLD_USER_SETTINGS_OFFSET 0x8100
26#define VR_VOUT_USER_SETTINGS_OFFSET 0x8000
27#define ALERT_LEVEL_USER_SETTINGS_OFFSET 0x8200
28#define DELAY_PCIE_PERST_USER_SETTINGS_OFFSET 0x8300
29#define BOOTSTRAP_USER_SETTINGS_OFFSET 0x8400
30#define THERMALTRIP_USER_SETTINGS_OFFSET 0x8500
31#define THROTTLE_USER_SETTINGS_OFFSET 0x8600
32#define DELAY_ASIC_RST_USER_SETTINGS_OFFSET 0x8700
33#define DELAY_MODULE_PG_USER_SETTINGS_OFFSET 0x8800
34
35#define CPLD_THROTTLE_SWITCH_ADDR 0x25
36#define CPLD_THERMALTRIP_SWITCH_ADDR 0x3A
37
38#define CLK_BUF_U87_ADDR (0xD8 >> 1)
39#define CLK_BUF_U88_ADDR (0xDE >> 1)
40
43};
44
58};
59/*
60SENSOR_NUM_ASIC_MEDHA0_SENSOR0_TEMP_C 0x04
61SENSOR_NUM_ASIC_MEDHA0_SENSOR1_TEMP_C 0x05
62SENSOR_NUM_ASIC_OWL_W_TEMP_C 0x06
63SENSOR_NUM_ASIC_OWL_E_TEMP_C 0x07
64SENSOR_NUM_ASIC_MEDHA1_SENSOR0_TEMP_C 0x08
65SENSOR_NUM_ASIC_MEDHA1_SENSOR1_TEMP_C 0x09
66SENSOR_NUM_ASIC_HAMSA_CRM_TEMP_C 0x0A
67SENSOR_NUM_ASIC_HAMSA_LS_TEMP_C 0x0B
68*/
69
94};
95
97
98typedef struct clock_compnt_mapping {
99 uint8_t clock_name_index;
100 uint8_t addr;
101 uint8_t bus;
103
104typedef struct temp_mapping_sensor {
105 uint8_t index;
106 uint8_t sensor_id;
107 uint8_t *sensor_name;
109
111
112typedef struct temp_threshold_mapping_sensor {
113 uint8_t temp_index_threshold_type; //PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
114 uint8_t temp_threshold_type;
115 uint8_t sensor_id;
116 uint8_t *temp_threshold_name;
118
122
126
128
129bool set_thermaltrip_user_settings(bool thermaltrip_enable, bool is_perm);
130bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name);
131bool get_temp_sensor_rail_enum(uint8_t *name, uint8_t *num);
132bool plat_get_temp_status(uint8_t rail, uint8_t *temp_status);
133bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name);
134bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num);
135bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name);
136bool get_plat_temp_threshold(uint8_t temp_index_threshold_type, int32_t *millidegree_celsius);
137bool set_plat_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius,
138 bool is_default, bool is_perm);
139bool plat_clear_temp_status(uint8_t rail);
140void user_settings_init(void);
143void set_uart_power_event_is_enable(bool is_enable);
144int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current);
145void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting);
147int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value);
153 uint8_t data_length);
155bool perm_config_clear();
156bool get_average_power(uint8_t rail, uint32_t *milliwatt);
157bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading);
158bool ubc_vr_rail_name_get(uint8_t rail, uint8_t **name);
159bool ubc_vr_rail_enum_get(uint8_t *name, uint8_t *num);
160void pwr_level_mutex_init(void);
162 uint8_t user_settings_offset);
166#endif
thermaltrip_user_settings_struct thermaltrip_user_settings
Definition: plat_hook.c:1449
vr_vout_user_settings user_settings
Definition: plat_hook.c:910
PLAT_TEMP_INDEX_E
Definition: plat_hook.h:87
PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
Definition: plat_hook.h:97
struct temp_mapping_sensor temp_mapping_sensor
USER_SETTING_OFFSET_E
Definition: plat_user_setting.h:41
@ THERMALTRIP
Definition: plat_user_setting.h:42
void set_uart_power_event_is_enable(bool is_enable)
Definition: plat_hook.c:1938
bool set_thermaltrip_user_settings(bool thermaltrip_enable, bool is_perm)
Definition: plat_user_setting.c:89
struct clock_compnt_mapping clock_compnt_mapping
bool set_plat_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius, bool is_default, bool is_perm)
Definition: plat_user_setting.c:291
bool get_plat_temp_threshold(uint8_t temp_index_threshold_type, int32_t *millidegree_celsius)
Definition: plat_user_setting.c:348
bool set_user_settings_delay_asic_rst_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:850
bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name)
Definition: plat_user_setting.c:213
bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num)
Definition: plat_user_setting.c:389
int get_user_settings_alert_level_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:1145
struct thermaltrip_user_settings_struct thermaltrip_user_settings_struct
bool get_user_settings_delay_pcie_perst_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:816
@ TEMP_INDEX_ASIC_HAMSA_CRM
Definition: plat_user_setting.h:55
@ TEMP_INDEX_ASIC_OWL_E
Definition: plat_user_setting.h:52
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_user_setting.h:48
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR1
Definition: plat_user_setting.h:50
@ TEMP_INDEX_ASIC_HAMSA_LS
Definition: plat_user_setting.h:56
@ TEMP_INDEX_MAX
Definition: plat_user_setting.h:57
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR1
Definition: plat_user_setting.h:54
@ TEMP_INDEX_ASIC_OWL_W
Definition: plat_user_setting.h:51
@ TEMP_INDEX_BOT_INLET
Definition: plat_user_setting.h:47
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR0
Definition: plat_user_setting.h:53
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR0
Definition: plat_user_setting.h:49
@ TEMP_INDEX_TOP_INLET
Definition: plat_user_setting.h:46
@ ASIC_HAMSA_LS_LOW_LIMIT
Definition: plat_user_setting.h:91
@ ASIC_OWL_W_LOW_LIMIT
Definition: plat_user_setting.h:81
@ ASIC_MEDHA0_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:79
@ BOT_INLET_LOW_LIMIT
Definition: plat_user_setting.h:73
@ ASIC_MEDHA0_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:80
@ PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX
Definition: plat_user_setting.h:93
@ ASIC_MEDHA1_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:86
@ ASIC_MEDHA1_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:88
@ ASIC_MEDHA0_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:78
@ BOT_OUTLET_HIGH_LIMIT
Definition: plat_user_setting.h:76
@ ASIC_MEDHA0_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:77
@ BOT_OUTLET_LOW_LIMIT
Definition: plat_user_setting.h:75
@ ASIC_OWL_W_HIGH_LIMIT
Definition: plat_user_setting.h:82
@ ASIC_HAMSA_CRM_HIGH_LIMIT
Definition: plat_user_setting.h:90
@ TOP_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:72
@ ASIC_MEDHA1_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:87
@ ASIC_MEDHA1_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:85
@ ASIC_HAMSA_LS_HIGH_LIMIT
Definition: plat_user_setting.h:92
@ TOP_INLET_LOW_LIMIT
Definition: plat_user_setting.h:71
@ ASIC_OWL_E_LOW_LIMIT
Definition: plat_user_setting.h:83
@ ASIC_HAMSA_CRM_LOW_LIMIT
Definition: plat_user_setting.h:89
@ BOT_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:74
@ ASIC_OWL_E_HIGH_LIMIT
Definition: plat_user_setting.h:84
struct temp_threshold_mapping_sensor temp_threshold_mapping_sensor
bool temp_threshold_default_settings_init(void)
Definition: plat_user_setting.c:504
bool get_user_settings_thermaltrip_from_eeprom(void *thermaltrip_user_settings, uint8_t data_length)
Definition: plat_hook.c:1452
void set_clock_u87_u88_lphcsl_amp_ctrl_to_1v()
Definition: plat_user_setting.c:1369
bool get_user_settings_throttle_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:1620
struct temp_threshold_user_settings_struct temp_threshold_user_settings_struct
CLOCK_BUFF_COMPONENT
Definition: plat_user_setting.h:96
@ CLOCK_BUFF_COMPONENT_MAX
Definition: plat_user_setting.h:96
@ CLK_BUF_U87
Definition: plat_user_setting.h:96
@ CLK_BUF_U88
Definition: plat_user_setting.h:96
bool plat_clear_temp_status(uint8_t rail)
Definition: plat_hook.c:2411
bool get_user_settings_delay_asic_rst_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:840
bool ubc_vr_rail_enum_get(uint8_t *name, uint8_t *num)
Definition: plat_hook.c:114
bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading)
Definition: plat_hook.c:563
bool get_user_settings_delay_module_pg_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:862
bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name)
Definition: plat_user_setting.c:405
int set_user_settings_alert_level_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:1122
bool perm_config_clear()
Definition: plat_hook.c:3132
void user_settings_init(void)
Definition: plat_hook.c:3208
temp_threshold_user_settings_struct temp_threshold_user_settings
Definition: plat_hook.c:752
bool temp_threshold_user_settings_init(void)
Definition: plat_user_setting.c:540
bool get_average_power(uint8_t rail, uint32_t *milliwatt)
Definition: plat_hook.c:675
bool set_user_settings_delay_pcie_perst_to_eeprom(void *user_settings, uint8_t data_length, uint8_t user_settings_offset)
Definition: plat_user_setting.c:826
bool get_temp_sensor_rail_enum(uint8_t *name, uint8_t *num)
Definition: plat_user_setting.c:145
bool ubc_vr_rail_name_get(uint8_t rail, uint8_t **name)
Definition: plat_hook.c:101
int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value)
Definition: plat_hook.c:1971
temp_mapping_sensor temp_index_table[TEMP_INDEX_MAX]
Definition: plat_hook.c:311
void pwr_level_mutex_init(void)
Definition: plat_hook.c:1949
bool set_user_settings_delay_module_pg_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:872
bool plat_get_temp_status(uint8_t rail, uint8_t *temp_status)
Definition: plat_hook.c:2350
int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current)
Definition: plat_hook.c:144
void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting)
Definition: plat_hook.c:1956
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:264
Definition: clock_shell.h:30
uint8_t clock_name_index
Definition: clock_shell.h:31
uint8_t addr
Definition: clock_shell.h:32
uint8_t bus
Definition: clock_shell.h:33
Definition: plat_hook.h:252
uint8_t index
Definition: plat_hook.h:253
uint8_t * sensor_name
Definition: plat_hook.h:255
uint8_t sensor_id
Definition: plat_hook.h:254
Definition: plat_hook.h:281
uint8_t sensor_id
Definition: plat_hook.h:284
uint8_t temp_threshold_type
Definition: plat_hook.h:283
uint8_t temp_index_threshold_type
Definition: plat_hook.h:282
uint8_t * temp_threshold_name
Definition: plat_hook.h:285
Definition: plat_hook.h:275
uint32_t temperature_reg_val[PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX]
Definition: plat_hook.h:276
Definition: plat_hook.h:208
uint8_t thermaltrip_user_setting_value
Definition: plat_hook.h:209
name
Definition: plat_i2c.h:24