OpenBIC
OpenSource Bridge-IC
plat_hook.c File Reference
#include <stdio.h>
#include <string.h>
#include "libutil.h"
#include "ast_adc.h"
#include "sensor.h"
#include "hal_i2c.h"
#include "plat_i2c.h"
#include "plat_gpio.h"
#include "plat_sensor_table.h"
#include "plat_hook.h"
#include "plat_isr.h"
#include <logging/log.h>
#include "mp2971.h"
#include "isl69259.h"
#include "raa228249.h"
#include "tmp75.h"
#include "tmp431.h"
#include "emc1413.h"
#include "mp29816a.h"
#include "plat_pldm_sensor.h"
#include "plat_class.h"
#include "pmbus.h"
Include dependency graph for plat_hook.c:

Macros

#define ALERT_LEVEL_USER_SETTINGS_OFFSET   0x8200
 
#define EEPROM_MAX_WRITE_TIME   5
 
#define AEGIS_CPLD_ADDR   (0x4C >> 1)
 
#define VR_PRE_READ_ARG(idx)
 
#define TEMP_THRESHOLD_USER_SETTINGS_OFFSET   0x8100
 
#define VR_VOUT_USER_SETTINGS_OFFSET   0x8000
 
#define PLAT_VOUT_GET_SET_HANDLER(get_set, min_max)
 

Functions

 LOG_MODULE_REGISTER (plat_hook)
 
int power_level_send_event (bool is_assert, int ubc1_current, int ubc2_current)
 
bool post_ubc_read (sensor_cfg *cfg, void *args, int *reading)
 
bool temp_sensor_rail_name_get (uint8_t rail, uint8_t **name)
 
bool temp_sensor_rail_enum_get (uint8_t *name, uint8_t *num)
 
void * vr_mutex_get (enum VR_INDEX_E vr_index)
 
bool pre_vr_read (sensor_cfg *cfg, void *args)
 
bool post_vr_read (sensor_cfg *cfg, void *args, int *const reading)
 
bool is_mb_dc_on ()
 
void vr_mutex_init (void)
 
bool vr_rail_name_get (uint8_t rail, uint8_t **name)
 
bool vr_status_name_get (uint8_t rail, uint8_t **name)
 
bool vr_rail_enum_get (uint8_t *name, uint8_t *num)
 
bool vr_status_enum_get (uint8_t *name, uint8_t *num)
 
bool vr_vout_user_settings_get (void *user_settings)
 
bool vr_vout_user_settings_set (void *user_settings)
 
int set_user_settings_alert_level_to_eeprom (void *user_settings, uint8_t data_length)
 
int get_user_settings_alert_level_from_eeprom (void *user_settings, uint8_t data_length)
 
bool temp_index_threshold_type_name_get (uint8_t type, uint8_t **name)
 
bool temp_threshold_type_enum_get (uint8_t *name, uint8_t *num)
 
bool temp_threshold_user_settings_get (void *temp_threshold_user_settings)
 
bool temp_threshold_user_settings_set (void *temp_threshold_user_settings)
 
void user_settings_init (void)
 
void set_uart_power_event_is_enable (bool is_enable)
 
void pwr_level_mutex_init (void)
 
void set_alert_level_to_default_or_user_setting (bool is_default, int32_t user_setting)
 
int get_alert_level_info (bool *is_assert, int32_t *default_value, int32_t *setting_value)
 
bool vr_rail_voltage_peak_get (uint8_t *name, int *peak_value)
 
bool vr_rail_voltage_peak_clear (uint8_t rail_index)
 
bool plat_get_vr_status (uint8_t rail, uint8_t vr_status_rail, uint16_t *vr_status)
 
bool plat_clear_vr_status (uint8_t rail)
 
bool perm_config_clear (void)
 
bool plat_get_vout_command (uint8_t rail, uint16_t *millivolt)
 
bool plat_set_vout_command (uint8_t rail, uint16_t *millivolt, bool is_default, bool is_perm)
 
bool plat_get_temp_status (uint8_t rail, uint8_t *temp_status)
 
bool plat_clear_temp_status (uint8_t rail)
 
 PLAT_VOUT_GET_SET_HANDLER (get, min)
 
 PLAT_VOUT_GET_SET_HANDLER (get, max)
 
 PLAT_VOUT_GET_SET_HANDLER (set, min)
 
 PLAT_VOUT_GET_SET_HANDLER (set, max)
 
bool plat_get_temp_threshold (uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius)
 
bool plat_set_temp_threshold (uint8_t temp_index_threshold_type, uint32_t *millidegree_celsius, bool is_default, bool is_perm)
 

Variables

int32_t alert_level_mA_default = 110000
 
int32_t alert_level_mA_user_setting = 110000
 
bool alert_level_is_assert = false
 
vr_pre_proc_arg vr_pre_read_args []
 
mp2971_init_arg mp2971_init_args []
 
isl69259_init_arg isl69259_init_args []
 
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 }
 
vr_mapping_sensor vr_rail_table []
 
vr_mapping_status vr_status_table []
 
vr_vout_user_settings user_settings = { 0 }
 
struct vr_vout_user_settings default_settings = { 0 }
 

Macro Definition Documentation

◆ AEGIS_CPLD_ADDR

#define AEGIS_CPLD_ADDR   (0x4C >> 1)

◆ ALERT_LEVEL_USER_SETTINGS_OFFSET

#define ALERT_LEVEL_USER_SETTINGS_OFFSET   0x8200

◆ EEPROM_MAX_WRITE_TIME

#define EEPROM_MAX_WRITE_TIME   5

◆ PLAT_VOUT_GET_SET_HANDLER

#define PLAT_VOUT_GET_SET_HANDLER (   get_set,
  min_max 
)

◆ TEMP_THRESHOLD_USER_SETTINGS_OFFSET

#define TEMP_THRESHOLD_USER_SETTINGS_OFFSET   0x8100

◆ VR_PRE_READ_ARG

#define VR_PRE_READ_ARG (   idx)
Value:
{ .mutex = vr_mutex + idx, .vr_page = 0x0 }, \
{ \
.mutex = vr_mutex + idx, .vr_page = 0x1 \
}
uint8_t idx
Definition: plat_util.c:39

◆ VR_VOUT_USER_SETTINGS_OFFSET

#define VR_VOUT_USER_SETTINGS_OFFSET   0x8000

Function Documentation

◆ get_alert_level_info()

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

◆ 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:

◆ is_mb_dc_on()

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

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_hook  )

◆ 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_clear_vr_status()

bool plat_clear_vr_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_get_vout_command()

bool plat_get_vout_command ( uint8_t  rail,
uint16_t *  millivolt 
)
Here is the call graph for this function:

◆ plat_get_vr_status()

bool plat_get_vr_status ( uint8_t  rail,
uint8_t  vr_status_rail,
uint16_t *  vr_status 
)
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:

◆ plat_set_vout_command()

bool plat_set_vout_command ( uint8_t  rail,
uint16_t *  millivolt,
bool  is_default,
bool  is_perm 
)
Here is the call graph for this function:

◆ PLAT_VOUT_GET_SET_HANDLER() [1/4]

PLAT_VOUT_GET_SET_HANDLER ( get  ,
max   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [2/4]

PLAT_VOUT_GET_SET_HANDLER ( get  ,
min   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [3/4]

PLAT_VOUT_GET_SET_HANDLER ( set  ,
max   
)

◆ PLAT_VOUT_GET_SET_HANDLER() [4/4]

PLAT_VOUT_GET_SET_HANDLER ( set  ,
min   
)

◆ post_ubc_read()

bool post_ubc_read ( sensor_cfg cfg,
void *  args,
int *  reading 
)

◆ 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 
)

◆ pre_vr_read()

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

◆ 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_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:

◆ temp_index_threshold_type_name_get()

bool temp_index_threshold_type_name_get ( uint8_t  type,
uint8_t **  name 
)

◆ temp_sensor_rail_enum_get()

bool temp_sensor_rail_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ temp_sensor_rail_name_get()

bool temp_sensor_rail_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ temp_threshold_type_enum_get()

bool temp_threshold_type_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ temp_threshold_user_settings_get()

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

◆ temp_threshold_user_settings_set()

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

◆ user_settings_init()

void user_settings_init ( void  )

◆ vr_mutex_get()

void * vr_mutex_get ( enum VR_INDEX_E  vr_index)

◆ vr_mutex_init()

void vr_mutex_init ( void  )

◆ vr_rail_enum_get()

bool vr_rail_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ vr_rail_name_get()

bool vr_rail_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ vr_rail_voltage_peak_clear()

bool vr_rail_voltage_peak_clear ( uint8_t  rail_index)

◆ vr_rail_voltage_peak_get()

bool vr_rail_voltage_peak_get ( uint8_t *  name,
int *  peak_value 
)

◆ vr_status_enum_get()

bool vr_status_enum_get ( uint8_t *  name,
uint8_t *  num 
)

◆ vr_status_name_get()

bool vr_status_name_get ( uint8_t  rail,
uint8_t **  name 
)

◆ vr_vout_user_settings_get()

bool vr_vout_user_settings_get ( void *  user_settings)
Here is the call graph for this function:

◆ vr_vout_user_settings_set()

bool vr_vout_user_settings_set ( void *  user_settings)
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 = 110000

◆ alert_level_mA_user_setting

int32_t alert_level_mA_user_setting = 110000

◆ default_settings

struct vr_vout_user_settings default_settings = { 0 }

◆ isl69259_init_args

Initial value:
= {
[0] = { .vout_scale_enable = true, .vout_scale = (499 / 798.8) },
[1] = { .vout_scale_enable = true, .vout_scale = (499 / 709.0) },
}

◆ mp2971_init_args

Initial value:
= {
[0] = { .vout_scale_enable = true },
}

◆ temp_index_table

temp_mapping_sensor temp_index_table[]
Initial value:
= {
}
@ TEMP_INDEX_ON_DIE_3_4
Definition: plat_hook.h:79
@ TEMP_INDEX_BOT_OUTLET
Definition: plat_hook.h:83
@ 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
#define SENSOR_NUM_BOT_INLET_TEMP_C
Definition: plat_pldm_sensor.h:121
#define SENSOR_NUM_ON_DIE_3_TEMP_C
Definition: plat_pldm_sensor.h:125
#define SENSOR_NUM_TOP_OUTLET_TEMP_C
Definition: plat_pldm_sensor.h:120
#define SENSOR_NUM_TOP_INLET_TEMP_C
Definition: plat_pldm_sensor.h:119
#define SENSOR_NUM_BOT_OUTLET_TEMP_C
Definition: plat_pldm_sensor.h:122
#define SENSOR_NUM_ON_DIE_1_TEMP_C
Definition: plat_pldm_sensor.h:123

◆ 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 }

◆ user_settings

vr_vout_user_settings user_settings = { 0 }

◆ vr_pre_read_args

vr_pre_proc_arg vr_pre_read_args[]
Initial value:
= {
{ .mutex = vr_mutex + 0, .vr_page = 0x0 }, { .mutex = vr_mutex + 0, .vr_page = 0x1 },
{ .mutex = vr_mutex + 1, .vr_page = 0x0 }, { .mutex = vr_mutex + 1, .vr_page = 0x1 },
{ .mutex = vr_mutex + 2, .vr_page = 0x0 }, { .mutex = vr_mutex + 2, .vr_page = 0x1 },
{ .mutex = vr_mutex + 3, .vr_page = 0x0 }, { .mutex = vr_mutex + 3, .vr_page = 0x1 },
{ .mutex = vr_mutex + 4, .vr_page = 0x0 }, { .mutex = vr_mutex + 4, .vr_page = 0x1 },
{ .mutex = vr_mutex + 5, .vr_page = 0x0 }, { .mutex = vr_mutex + 5, .vr_page = 0x1 },
{ .mutex = vr_mutex + 6, .vr_page = 0x0 }, { .mutex = vr_mutex + 6, .vr_page = 0x1 },
{ .mutex = vr_mutex + 7, .vr_page = 0x0 }, { .mutex = vr_mutex + 7, .vr_page = 0x1 },
{ .mutex = vr_mutex + 8, .vr_page = 0x0 }, { .mutex = vr_mutex + 8, .vr_page = 0x1 },
{ .mutex = vr_mutex + 9, .vr_page = 0x0 }, { .mutex = vr_mutex + 9, .vr_page = 0x1 },
{ .mutex = vr_mutex + 10, .vr_page = 0x0 }, { .mutex = vr_mutex + 10, .vr_page = 0x1 }
}

◆ vr_rail_table

vr_mapping_sensor vr_rail_table[]

◆ vr_status_table

vr_mapping_status vr_status_table[]
Initial value:
= {
{ VR_STAUS_E_STATUS_CML, PMBUS_STATUS_CML, "STATUS_CML_PMBUS" },
}
@ 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_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
@ PMBUS_STATUS_WORD
Definition: pmbus.h:102
@ PMBUS_STATUS_IOUT
Definition: pmbus.h:104
@ PMBUS_STATUS_BYTE
Definition: pmbus.h:101
@ PMBUS_STATUS_CML
Definition: pmbus.h:107
@ PMBUS_STATUS_TEMPERATURE
Definition: pmbus.h:106
@ PMBUS_STATUS_VOUT
Definition: pmbus.h:103
@ PMBUS_STATUS_INPUT
Definition: pmbus.h:105