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
39};
40
54};
55/*
56SENSOR_NUM_ASIC_MEDHA0_SENSOR0_TEMP_C 0x04
57SENSOR_NUM_ASIC_MEDHA0_SENSOR1_TEMP_C 0x05
58SENSOR_NUM_ASIC_OWL_W_TEMP_C 0x06
59SENSOR_NUM_ASIC_OWL_E_TEMP_C 0x07
60SENSOR_NUM_ASIC_MEDHA1_SENSOR0_TEMP_C 0x08
61SENSOR_NUM_ASIC_MEDHA1_SENSOR1_TEMP_C 0x09
62SENSOR_NUM_ASIC_HAMSA_CRM_TEMP_C 0x0A
63SENSOR_NUM_ASIC_HAMSA_LS_TEMP_C 0x0B
64*/
65
90};
91
92typedef struct temp_mapping_sensor {
93 uint8_t index;
94 uint8_t sensor_id;
95 uint8_t *sensor_name;
97
99
100typedef struct temp_threshold_mapping_sensor {
101 uint8_t temp_index_threshold_type; //PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
102 uint8_t temp_threshold_type;
103 uint8_t sensor_id;
104 uint8_t *temp_threshold_name;
106
110
114
116
117bool set_thermaltrip_user_settings(bool thermaltrip_enable, bool is_perm);
118bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name);
119bool get_temp_sensor_rail_enum(uint8_t *name, uint8_t *num);
120bool plat_get_temp_status(uint8_t rail, uint8_t *temp_status);
121bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name);
122bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num);
123bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name);
124bool get_plat_temp_threshold(uint8_t temp_index_threshold_type, int32_t *millidegree_celsius);
125bool set_plat_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius,
126 bool is_default, bool is_perm);
127bool plat_clear_temp_status(uint8_t rail);
128void user_settings_init(void);
131void set_uart_power_event_is_enable(bool is_enable);
132int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current);
133void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting);
135int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value);
142bool perm_config_clear();
143bool get_average_power(uint8_t rail, uint32_t *milliwatt);
144bool post_vr_read(sensor_cfg *cfg, void *args, int *const reading);
145bool ubc_vr_rail_name_get(uint8_t rail, uint8_t **name);
146bool ubc_vr_rail_enum_get(uint8_t *name, uint8_t *num);
147void pwr_level_mutex_init(void);
148bool set_user_settings_delay_pcie_perst_to_eeprom(void *user_settings, uint8_t data_length, uint8_t user_settings_offset);
151#endif
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:37
@ THERMALTRIP
Definition: plat_user_setting.h:38
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:88
bool get_user_settings_thermaltrip_from_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:1452
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:290
bool get_plat_temp_threshold(uint8_t temp_index_threshold_type, int32_t *millidegree_celsius)
Definition: plat_user_setting.c:347
bool set_user_settings_delay_asic_rst_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:849
bool get_temp_sensor_rail_name(uint8_t rail, uint8_t **name)
Definition: plat_user_setting.c:212
bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num)
Definition: plat_user_setting.c:388
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:815
@ TEMP_INDEX_ASIC_HAMSA_CRM
Definition: plat_user_setting.h:51
@ TEMP_INDEX_ASIC_OWL_E
Definition: plat_user_setting.h:48
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_user_setting.h:44
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR1
Definition: plat_user_setting.h:46
@ TEMP_INDEX_ASIC_HAMSA_LS
Definition: plat_user_setting.h:52
@ TEMP_INDEX_MAX
Definition: plat_user_setting.h:53
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR1
Definition: plat_user_setting.h:50
@ TEMP_INDEX_ASIC_OWL_W
Definition: plat_user_setting.h:47
@ TEMP_INDEX_BOT_INLET
Definition: plat_user_setting.h:43
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR0
Definition: plat_user_setting.h:49
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR0
Definition: plat_user_setting.h:45
@ TEMP_INDEX_TOP_INLET
Definition: plat_user_setting.h:42
@ ASIC_HAMSA_LS_LOW_LIMIT
Definition: plat_user_setting.h:87
@ ASIC_OWL_W_LOW_LIMIT
Definition: plat_user_setting.h:77
@ ASIC_MEDHA0_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:75
@ BOT_INLET_LOW_LIMIT
Definition: plat_user_setting.h:69
@ ASIC_MEDHA0_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:76
@ PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX
Definition: plat_user_setting.h:89
@ ASIC_MEDHA1_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:82
@ ASIC_MEDHA1_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:84
@ ASIC_MEDHA0_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:74
@ BOT_OUTLET_HIGH_LIMIT
Definition: plat_user_setting.h:72
@ ASIC_MEDHA0_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:73
@ BOT_OUTLET_LOW_LIMIT
Definition: plat_user_setting.h:71
@ ASIC_OWL_W_HIGH_LIMIT
Definition: plat_user_setting.h:78
@ ASIC_HAMSA_CRM_HIGH_LIMIT
Definition: plat_user_setting.h:86
@ TOP_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:68
@ ASIC_MEDHA1_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:83
@ ASIC_MEDHA1_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:81
@ ASIC_HAMSA_LS_HIGH_LIMIT
Definition: plat_user_setting.h:88
@ TOP_INLET_LOW_LIMIT
Definition: plat_user_setting.h:67
@ ASIC_OWL_E_LOW_LIMIT
Definition: plat_user_setting.h:79
@ ASIC_HAMSA_CRM_LOW_LIMIT
Definition: plat_user_setting.h:85
@ BOT_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:70
@ ASIC_OWL_E_HIGH_LIMIT
Definition: plat_user_setting.h:80
struct temp_threshold_mapping_sensor temp_threshold_mapping_sensor
bool temp_threshold_default_settings_init(void)
Definition: plat_user_setting.c:503
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
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:839
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:861
bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name)
Definition: plat_user_setting.c:404
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:539
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:825
bool get_temp_sensor_rail_enum(uint8_t *name, uint8_t *num)
Definition: plat_user_setting.c:144
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:871
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:263
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