OpenBIC
OpenSource Bridge-IC
plat_user_setting.c File Reference
#include <stdio.h>
#include <string.h>
#include "libutil.h"
#include <logging/log.h>
#include "plat_hook.h"
#include "pmbus.h"
#include "plat_gpio.h"
#include "plat_pldm_sensor.h"
#include "plat_cpld.h"
#include "plat_i2c.h"
#include "plat_fru.h"
#include "plat_user_setting.h"
#include "sensor.h"
#include "tmp75.h"
#include "tmp431.h"
#include "plat_class.h"
#include "shell_plat_average_power.h"
#include "shell_plat_throttle_switch.h"
#include "pldm_monitor.h"
#include "pldm_sensor.h"
Include dependency graph for plat_user_setting.c:

Macros

#define EEPROM_MAX_WRITE_TIME   5
 
#define TMP75_ALERT_CPLD_OFFSET   0x2F
 

Functions

 LOG_MODULE_REGISTER (plat_user_setting)
 
void pwr_level_mutex_init (void)
 
bool set_user_settings_thermaltrip_to_eeprom (void *thermaltrip_user_settings, uint8_t data_length)
 
bool get_user_settings_thermaltrip_from_eeprom (void *thermaltrip_user_settings, uint8_t data_length)
 
bool set_thermaltrip_user_settings (bool thermaltrip_enable, bool is_perm)
 
bool get_temp_sensor_rail_enum (uint8_t *name, uint8_t *num)
 
bool plat_get_temp_status (uint8_t rail, uint8_t *temp_status)
 
bool get_temp_sensor_rail_name (uint8_t rail, uint8_t **name)
 
bool set_temp_threshold_user_settings (void *temp_threshold_user_settings)
 
bool set_plat_temp_threshold (uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius, bool is_default, bool is_perm)
 
bool get_plat_temp_threshold (uint8_t temp_index_threshold_type, int32_t *millidegree_celsius)
 
bool get_temp_threshold_type_enum (uint8_t *name, uint8_t *num)
 
bool get_temp_index_threshold_type_name (uint8_t type, uint8_t **name)
 
bool plat_clear_temp_status (uint8_t rail)
 
bool plat_set_temp_threshold (uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius, bool is_default, bool is_perm)
 
bool temp_threshold_default_settings_init (void)
 
bool temp_threshold_user_settings_init (void)
 
bool plat_get_temp_threshold (uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius)
 
void set_alert_level_to_default_or_user_setting (bool is_default, int32_t user_setting)
 
void set_uart_power_event_is_enable (bool is_enable)
 
int power_level_send_event (bool is_assert, int ubc1_current, int ubc2_current)
 
int set_user_settings_alert_level_to_eeprom (void *user_settings, uint8_t data_length)
 
int get_alert_level_info (bool *is_assert, int32_t *default_value, int32_t *setting_value)
 
bool get_user_settings_throttle_from_eeprom (void *user_settings, uint8_t data_length)
 
int get_user_settings_alert_level_from_eeprom (void *user_settings, uint8_t data_length)
 
bool get_user_settings_delay_pcie_perst_from_eeprom (void *user_settings, uint8_t data_length)
 
bool set_user_settings_delay_pcie_perst_to_eeprom (void *user_settings, uint8_t data_length, uint8_t user_settings_offset)
 
bool get_user_settings_delay_asic_rst_from_eeprom (void *user_settings, uint8_t data_length)
 
bool set_user_settings_delay_asic_rst_to_eeprom (void *user_settings, uint8_t data_length)
 
bool get_user_settings_delay_module_pg_from_eeprom (void *user_settings, uint8_t data_length)
 
bool set_user_settings_delay_module_pg_to_eeprom (void *user_settings, uint8_t data_length)
 
bool perm_config_clear (void)
 
bool ubc_vr_rail_name_get (uint8_t rail, uint8_t **name)
 
bool ubc_vr_rail_enum_get (uint8_t *name, uint8_t *num)
 
bool post_ubc_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_vr_read (sensor_cfg *cfg, void *args, int *const reading)
 
bool get_average_power (uint8_t rail, uint32_t *milliwatt)
 
void user_settings_init (void)
 

Variables

int32_t alert_level_mA_default = 180000
 
int32_t alert_level_mA_user_setting = 180000
 
bool alert_level_is_assert = false
 
thermaltrip_user_settings_struct thermaltrip_user_settings = { 0xFF }
 
temp_mapping_sensor temp_index_table []
 
temp_threshold_mapping_sensor temp_index_threshold_type_table []
 
temp_threshold_user_settings_struct temp_threshold_user_settings = { 0 }
 
struct temp_threshold_user_settings_struct temp_threshold_default_settings = { 0 }
 
ubc_vr_power_mapping_sensor ubc_vr_power_table []
 

Macro Definition Documentation

◆ EEPROM_MAX_WRITE_TIME

#define EEPROM_MAX_WRITE_TIME   5

◆ TMP75_ALERT_CPLD_OFFSET

#define TMP75_ALERT_CPLD_OFFSET   0x2F

Function Documentation

◆ get_alert_level_info()

int get_alert_level_info ( bool *  is_assert,
int32_t *  default_value,
int32_t *  setting_value 
)

◆ get_average_power()

bool get_average_power ( uint8_t  rail,
uint32_t *  milliwatt 
)

◆ get_plat_temp_threshold()

bool get_plat_temp_threshold ( uint8_t  temp_index_threshold_type,
int32_t *  millidegree_celsius 
)
Here is the call graph for this function:

◆ get_temp_index_threshold_type_name()

bool get_temp_index_threshold_type_name ( uint8_t  type,
uint8_t **  name 
)

◆ get_temp_sensor_rail_enum()

bool get_temp_sensor_rail_enum ( uint8_t *  name,
uint8_t *  num 
)

◆ get_temp_sensor_rail_name()

bool get_temp_sensor_rail_name ( uint8_t  rail,
uint8_t **  name 
)

◆ get_temp_threshold_type_enum()

bool get_temp_threshold_type_enum ( uint8_t *  name,
uint8_t *  num 
)

◆ get_user_settings_alert_level_from_eeprom()

int get_user_settings_alert_level_from_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ get_user_settings_delay_asic_rst_from_eeprom()

bool get_user_settings_delay_asic_rst_from_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ get_user_settings_delay_module_pg_from_eeprom()

bool get_user_settings_delay_module_pg_from_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ get_user_settings_delay_pcie_perst_from_eeprom()

bool get_user_settings_delay_pcie_perst_from_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ get_user_settings_thermaltrip_from_eeprom()

bool get_user_settings_thermaltrip_from_eeprom ( void *  thermaltrip_user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ get_user_settings_throttle_from_eeprom()

bool get_user_settings_throttle_from_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_user_setting  )

◆ perm_config_clear()

bool perm_config_clear ( void  )
Here is the call graph for this function:

◆ plat_clear_temp_status()

bool plat_clear_temp_status ( uint8_t  rail)
Here is the call graph for this function:

◆ plat_get_temp_status()

bool plat_get_temp_status ( uint8_t  rail,
uint8_t *  temp_status 
)
Here is the call graph for this function:

◆ plat_get_temp_threshold()

bool plat_get_temp_threshold ( uint8_t  temp_index_threshold_type,
uint32_t *  millidegree_celsius 
)
Here is the call graph for this function:

◆ plat_set_temp_threshold()

bool plat_set_temp_threshold ( uint8_t  temp_index_threshold_type,
uint32_t *  millidegree_celsius,
bool  is_default,
bool  is_perm 
)
Here is the call graph for this function:

◆ post_ubc_read()

bool post_ubc_read ( sensor_cfg cfg,
void *  args,
int *  reading 
)
Here is the call graph for this function:

◆ post_vr_read()

bool post_vr_read ( sensor_cfg cfg,
void *  args,
int *const  reading 
)
Here is the call graph for this function:

◆ power_level_send_event()

int power_level_send_event ( bool  is_assert,
int  ubc1_current,
int  ubc2_current 
)

◆ pwr_level_mutex_init()

void pwr_level_mutex_init ( void  )

◆ set_alert_level_to_default_or_user_setting()

void set_alert_level_to_default_or_user_setting ( bool  is_default,
int32_t  user_setting 
)

◆ set_plat_temp_threshold()

bool set_plat_temp_threshold ( uint8_t  temp_index_threshold_type,
uint32_t *  millidegree_celsius,
bool  is_default,
bool  is_perm 
)
Here is the call graph for this function:

◆ set_temp_threshold_user_settings()

bool set_temp_threshold_user_settings ( void *  temp_threshold_user_settings)
Here is the call graph for this function:

◆ set_thermaltrip_user_settings()

bool set_thermaltrip_user_settings ( bool  thermaltrip_enable,
bool  is_perm 
)
Here is the call graph for this function:

◆ set_uart_power_event_is_enable()

void set_uart_power_event_is_enable ( bool  is_enable)

◆ set_user_settings_alert_level_to_eeprom()

int set_user_settings_alert_level_to_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ set_user_settings_delay_asic_rst_to_eeprom()

bool set_user_settings_delay_asic_rst_to_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ set_user_settings_delay_module_pg_to_eeprom()

bool set_user_settings_delay_module_pg_to_eeprom ( void *  user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ set_user_settings_delay_pcie_perst_to_eeprom()

bool set_user_settings_delay_pcie_perst_to_eeprom ( void *  user_settings,
uint8_t  data_length,
uint8_t  user_settings_offset 
)
Here is the call graph for this function:

◆ set_user_settings_thermaltrip_to_eeprom()

bool set_user_settings_thermaltrip_to_eeprom ( void *  thermaltrip_user_settings,
uint8_t  data_length 
)
Here is the call graph for this function:

◆ temp_threshold_default_settings_init()

bool temp_threshold_default_settings_init ( void  )
Here is the call graph for this function:

◆ temp_threshold_user_settings_init()

bool temp_threshold_user_settings_init ( void  )
Here is the call graph for this function:

◆ ubc_vr_rail_enum_get()

bool ubc_vr_rail_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ ubc_vr_rail_name_get()

bool ubc_vr_rail_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ user_settings_init()

void user_settings_init ( void  )
Here is the call graph for this function:

Variable Documentation

◆ alert_level_is_assert

bool alert_level_is_assert = false

◆ alert_level_mA_default

int32_t alert_level_mA_default = 180000

◆ alert_level_mA_user_setting

int32_t alert_level_mA_user_setting = 180000

◆ temp_index_table

temp_mapping_sensor temp_index_table[]
Initial value:
= {
{ TEMP_INDEX_TOP_INLET, SENSOR_NUM_TOP_INLET_TEMP_C, "SB_RB_TOP_INLET_TEMP" },
{ TEMP_INDEX_BOT_INLET, SENSOR_NUM_BOT_INLET_TEMP_C, "SB_RB_BOT_INLET_TEMP" },
{ TEMP_INDEX_BOT_OUTLET, SENSOR_NUM_BOT_OUTLET_TEMP_C, "SB_RB_BOT_OUTLET_TEMP" },
"SB_RB_ASIC_MEDHA0_SENSOR0_TEMP" },
"SB_RB_ASIC_MEDHA0_SENSOR1_TEMP" },
{ TEMP_INDEX_ASIC_OWL_W, SENSOR_NUM_ASIC_OWL_W_TEMP_C, "SB_RB_ASIC_OWL_W_TEMP" },
{ TEMP_INDEX_ASIC_OWL_E, SENSOR_NUM_ASIC_OWL_E_TEMP_C, "SB_RB_ASIC_OWL_E_TEMP" },
"SB_RB_ASIC_MEDHA1_SENSOR0_TEMP" },
"SB_RB_ASIC_MEDHA1_SENSOR1_TEMP" },
"SB_RB_ASIC_HAMSA_CRM_TEMP" },
}
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_hook.h:93
@ TEMP_INDEX_BOT_INLET
Definition: plat_hook.h:92
@ TEMP_INDEX_TOP_INLET
Definition: plat_hook.h:90
@ TEMP_INDEX_ASIC_HAMSA_CRM
Definition: plat_user_setting.h:51
@ TEMP_INDEX_ASIC_OWL_E
Definition: plat_user_setting.h:48
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR1
Definition: plat_user_setting.h:46
@ TEMP_INDEX_ASIC_HAMSA_LS
Definition: plat_user_setting.h:52
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR1
Definition: plat_user_setting.h:50
@ TEMP_INDEX_ASIC_OWL_W
Definition: plat_user_setting.h:47
@ TEMP_INDEX_ASIC_MEDHA1_SENSOR0
Definition: plat_user_setting.h:49
@ TEMP_INDEX_ASIC_MEDHA0_SENSOR0
Definition: plat_user_setting.h:45
#define SENSOR_NUM_ASIC_OWL_E_TEMP_C
Definition: plat_pldm_sensor.h:150
#define SENSOR_NUM_BOT_INLET_TEMP_C
Definition: plat_pldm_sensor.h:145
#define SENSOR_NUM_ASIC_MEDHA0_SENSOR0_TEMP_C
Definition: plat_pldm_sensor.h:147
#define SENSOR_NUM_ASIC_MEDHA0_SENSOR1_TEMP_C
Definition: plat_pldm_sensor.h:148
#define SENSOR_NUM_ASIC_MEDHA1_SENSOR0_TEMP_C
Definition: plat_pldm_sensor.h:151
#define SENSOR_NUM_TOP_INLET_TEMP_C
Definition: plat_pldm_sensor.h:144
#define SENSOR_NUM_BOT_OUTLET_TEMP_C
Definition: plat_pldm_sensor.h:146
#define SENSOR_NUM_ASIC_HAMSA_CRM_TEMP_C
Definition: plat_pldm_sensor.h:153
#define SENSOR_NUM_ASIC_HAMSA_LS_TEMP_C
Definition: plat_pldm_sensor.h:154
#define SENSOR_NUM_ASIC_OWL_W_TEMP_C
Definition: plat_pldm_sensor.h:149
#define SENSOR_NUM_ASIC_MEDHA1_SENSOR1_TEMP_C
Definition: plat_pldm_sensor.h:152

◆ temp_index_threshold_type_table

temp_threshold_mapping_sensor temp_index_threshold_type_table[]

◆ temp_threshold_default_settings

struct temp_threshold_user_settings_struct temp_threshold_default_settings = { 0 }

◆ temp_threshold_user_settings

temp_threshold_user_settings_struct temp_threshold_user_settings = { 0 }

◆ thermaltrip_user_settings

thermaltrip_user_settings_struct thermaltrip_user_settings = { 0xFF }

◆ ubc_vr_power_table

ubc_vr_power_mapping_sensor ubc_vr_power_table[]