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 "plat_cpld.h"
21#include "plat_pldm_sensor.h"
22
23#define MMC_SLOT_USER_SETTING_OFFSET 0x0000
24
25#define VR_MUTEX_LOCK_TIMEOUT_MS 1000
26#define TEMP_THRESHOLD_USER_SETTINGS_OFFSET 0x8100
27#define VR_VOUT_USER_SETTINGS_OFFSET 0x8000
28#define ALERT_LEVEL_USER_SETTINGS_OFFSET 0x8200
29#define DELAY_PCIE_PERST_USER_SETTINGS_OFFSET 0x8300
30#define BOOTSTRAP_USER_SETTINGS_OFFSET 0x8400
31#define THERMALTRIP_USER_SETTINGS_OFFSET 0x8500
32#define THROTTLE_USER_SETTINGS_OFFSET 0x8600
33#define DELAY_ASIC_RST_USER_SETTINGS_OFFSET 0x8700
34#define DELAY_MODULE_PG_USER_SETTINGS_OFFSET 0x8800
35
36#define CPLD_THROTTLE_SWITCH_ADDR 0x25
37#define CPLD_THERMALTRIP_SWITCH_ADDR 0x3A
38
52};
53
78};
79typedef struct temp_threshold_mapping_sensor {
80 uint8_t temp_index_threshold_type; //PLAT_TEMP_INDEX_THRESHOLD_TYPE_E
81 uint8_t temp_threshold_type;
82 uint8_t sensor_id;
83 uint8_t *temp_threshold_name;
85
89
91
95
96typedef struct throttle_user_settings_struct {
99
100// temp
101bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name);
102bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num);
103bool plat_get_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius);
105bool plat_set_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius,
106 bool is_default, bool is_perm);
108
109// pwrlevel
110void set_alert_level_to_default_or_user_setting(bool is_default, int32_t user_setting);
111int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value);
115int power_level_send_event(bool is_assert, int ubc1_current, int ubc2_current);
116
117// thermaltrip
118bool set_thermaltrip_user_settings(bool thermaltrip_enable, bool is_perm);
120 uint8_t data_length);
121
122// throttle
123bool set_throttle_user_settings(uint8_t *throttle_status_reg, bool is_perm);
125
126// delay pcie perst
129 uint8_t user_settings_offset);
130
131// delay asic rst
133
134// delay module pg
136
137// other
138void user_settings_init(void);
139bool perm_config_clear(void);
140void set_uart_power_event_is_enable(bool is_enable);
141
142#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
uint8_t type
Definition: pldm_base.h:0
uint32_t data_length
Definition: pldm_oem.h:1
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:465
int32_t plat_get_alert_level_mA_user_setting(void)
Definition: plat_user_setting.c:316
bool set_user_settings_delay_asic_rst_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:652
bool get_temp_threshold_type_enum(uint8_t *name, uint8_t *num)
Definition: plat_user_setting.c:235
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:577
@ TEMP_INDEX_ASIC_NUWA0_SENSOR0
Definition: plat_user_setting.h:43
@ TEMP_INDEX_ASIC_HAMSA_CRM
Definition: plat_user_setting.h:49
@ TEMP_INDEX_ASIC_OWL_E
Definition: plat_user_setting.h:46
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_user_setting.h:42
@ TEMP_INDEX_ASIC_HAMSA_LS
Definition: plat_user_setting.h:50
@ TEMP_INDEX_MAX
Definition: plat_user_setting.h:51
@ TEMP_INDEX_ASIC_OWL_W
Definition: plat_user_setting.h:45
@ TEMP_INDEX_BOT_INLET
Definition: plat_user_setting.h:41
@ TEMP_INDEX_ASIC_NUWA1_SENSOR1
Definition: plat_user_setting.h:48
@ TEMP_INDEX_ASIC_NUWA1_SENSOR0
Definition: plat_user_setting.h:47
@ TEMP_INDEX_ASIC_NUWA0_SENSOR1
Definition: plat_user_setting.h:44
@ TEMP_INDEX_TOP_INLET
Definition: plat_user_setting.h:40
@ ASIC_HAMSA_LS_LOW_LIMIT
Definition: plat_user_setting.h:75
@ ASIC_OWL_W_LOW_LIMIT
Definition: plat_user_setting.h:65
@ BOT_INLET_LOW_LIMIT
Definition: plat_user_setting.h:57
@ ASIC_NUWA0_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:61
@ PLAT_TEMP_INDEX_THRESHOLD_TYPE_MAX
Definition: plat_user_setting.h:77
@ ASIC_NUWA1_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:72
@ BOT_OUTLET_HIGH_LIMIT
Definition: plat_user_setting.h:60
@ ASIC_NUWA1_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:70
@ BOT_OUTLET_LOW_LIMIT
Definition: plat_user_setting.h:59
@ ASIC_OWL_W_HIGH_LIMIT
Definition: plat_user_setting.h:66
@ ASIC_HAMSA_CRM_HIGH_LIMIT
Definition: plat_user_setting.h:74
@ ASIC_NUWA1_SENSOR0_LOW_LIMIT
Definition: plat_user_setting.h:69
@ TOP_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:56
@ ASIC_NUWA0_SENSOR0_HIGH_LIMIT
Definition: plat_user_setting.h:62
@ ASIC_NUWA1_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:71
@ ASIC_HAMSA_LS_HIGH_LIMIT
Definition: plat_user_setting.h:76
@ TOP_INLET_LOW_LIMIT
Definition: plat_user_setting.h:55
@ ASIC_NUWA0_SENSOR1_LOW_LIMIT
Definition: plat_user_setting.h:63
@ ASIC_OWL_E_LOW_LIMIT
Definition: plat_user_setting.h:67
@ ASIC_HAMSA_CRM_LOW_LIMIT
Definition: plat_user_setting.h:73
@ ASIC_NUWA0_SENSOR1_HIGH_LIMIT
Definition: plat_user_setting.h:64
@ BOT_INLET_HIGH_LIMIT
Definition: plat_user_setting.h:58
@ ASIC_OWL_E_HIGH_LIMIT
Definition: plat_user_setting.h:68
struct temp_threshold_mapping_sensor temp_threshold_mapping_sensor
bool plat_get_temp_threshold(uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius)
Definition: plat_hook.c:2448
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:2496
bool temp_threshold_default_settings_init(void)
Definition: plat_user_setting.c:111
bool get_user_settings_thermaltrip_from_eeprom(void *thermaltrip_user_settings, uint8_t data_length)
Definition: plat_hook.c:1452
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
struct throttle_user_settings_struct throttle_user_settings_struct
bool get_temp_index_threshold_type_name(uint8_t type, uint8_t **name)
Definition: plat_user_setting.c:222
int set_user_settings_alert_level_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_hook.c:1122
bool set_throttle_user_settings(uint8_t *throttle_status_reg, bool is_perm)
Definition: plat_hook.c:1672
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:148
bool perm_config_clear(void)
Definition: plat_hook.c:3132
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:588
int get_alert_level_info(bool *is_assert, int32_t *default_value, int32_t *setting_value)
Definition: plat_hook.c:1971
bool set_user_settings_delay_module_pg_to_eeprom(void *user_settings, uint8_t data_length)
Definition: plat_user_setting.c:677
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
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
Definition: plat_hook.h:214
uint8_t throttle_user_setting_value
Definition: plat_hook.h:215
name
Definition: plat_i2c.h:24