OpenBIC
OpenSource Bridge-IC
plat_hook.c File Reference
#include <stdio.h>
#include <string.h>
#include "sensor.h"
#include "plat_i2c.h"
#include "plat_gpio.h"
#include "plat_hook.h"
#include "plat_sensor_table.h"
#include "i2c-mux-tca9548.h"
#include "logging/log.h"
#include "libipmi.h"
#include "ipmi.h"
#include "plat_apml.h"
#include "power_status.h"
Include dependency graph for plat_hook.c:

Macros

#define ADJUST_ADM1278_CURRENT(x)   (x * 0.94)
 
#define ADJUST_ADM1278_POWER(x)   (x * 0.95)
 
#define ADJUST_LTC4282_CURRENT(x)   ((x * 0.96) - 0.04)
 
#define ADJUST_LTC4282_POWER(x)   ((x * 0.96) - 0.6)
 
#define ADJUST_MP5990_CURRENT(x)   ((x * 1.0029) + 0.0542)
 
#define ADJUST_MP5990_POWER(x)   ((x * 1.0081) + 1.8285)
 
#define DIMM_HIGH_TEMP_THRESHOLD   80
 
#define DRAM_THROTTLE_PERCENT   50
 

Functions

 LOG_MODULE_REGISTER (plat_hook)
 
bool pre_nvme_read (sensor_cfg *cfg, void *args)
 
bool pre_vr_read (sensor_cfg *cfg, void *args)
 
bool pre_vol_bat3v_read (sensor_cfg *cfg, void *args)
 
bool post_vol_bat3v_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_adm1278_cur_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_adm1278_pwr_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_ltc4282_cur_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_ltc4282_pwr_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_mp5990_cur_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_mp5990_pwr_read (sensor_cfg *cfg, void *args, int *reading)
 
void apml_report_fail_cb (apml_msg *msg)
 
void apml_report_result_check (apml_msg *msg)
 
bool post_ddr5_pwr_read (sensor_cfg *cfg, void *args, int *reading)
 
void set_dram_throttle_fail_cb (apml_msg *msg)
 
void set_dram_throttle_cb (apml_msg *msg)
 
void set_dram_throttle_value (uint8_t throttle_percent)
 
void check_dram_throttle (uint8_t sensor_num, int *const reading)
 
bool post_ddr5_temp_read (sensor_cfg *cfg, void *args, int *const reading)
 
bool post_amd_tsi_read (sensor_cfg *cfg, void *args, int *const reading)
 

Variables

adc_asd_init_arg ast_adc_init_args []
 
adm1278_init_arg adm1278_init_args []
 
ltc4282_init_arg ltc4282_init_args [] = { [0] = { .r_sense_mohm = 0.5 } }
 
mp5990_init_arg mp5990_init_args []
 
nct7718w_init_arg nct7718w_init_args []
 
g788p81u_init_arg g788p81u_init_args []
 
struct tca9548 mux_conf_addr_0xe2 []
 
vr_pre_proc_arg vr_pre_read_args []
 
apml_mailbox_init_arg apml_mailbox_init_args [] = { [0] = { .data = 0x00000000, .retry = 0 } }
 
ddr5_init_temp_arg ddr5_init_temp_args []
 
ddr5_init_power_arg ddr5_init_power_args []
 

Macro Definition Documentation

◆ ADJUST_ADM1278_CURRENT

#define ADJUST_ADM1278_CURRENT (   x)    (x * 0.94)

◆ ADJUST_ADM1278_POWER

#define ADJUST_ADM1278_POWER (   x)    (x * 0.95)

◆ ADJUST_LTC4282_CURRENT

#define ADJUST_LTC4282_CURRENT (   x)    ((x * 0.96) - 0.04)

◆ ADJUST_LTC4282_POWER

#define ADJUST_LTC4282_POWER (   x)    ((x * 0.96) - 0.6)

◆ ADJUST_MP5990_CURRENT

#define ADJUST_MP5990_CURRENT (   x)    ((x * 1.0029) + 0.0542)

◆ ADJUST_MP5990_POWER

#define ADJUST_MP5990_POWER (   x)    ((x * 1.0081) + 1.8285)

◆ DIMM_HIGH_TEMP_THRESHOLD

#define DIMM_HIGH_TEMP_THRESHOLD   80

◆ DRAM_THROTTLE_PERCENT

#define DRAM_THROTTLE_PERCENT   50

Function Documentation

◆ apml_report_fail_cb()

void apml_report_fail_cb ( apml_msg msg)

◆ apml_report_result_check()

void apml_report_result_check ( apml_msg msg)

◆ check_dram_throttle()

void check_dram_throttle ( uint8_t  sensor_num,
int *const  reading 
)
Here is the call graph for this function:

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_hook  )

◆ post_adm1278_cur_read()

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

◆ post_adm1278_pwr_read()

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

◆ post_amd_tsi_read()

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

◆ post_ddr5_pwr_read()

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

◆ post_ddr5_temp_read()

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

◆ post_ltc4282_cur_read()

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

◆ post_ltc4282_pwr_read()

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

◆ post_mp5990_cur_read()

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

◆ post_mp5990_pwr_read()

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

◆ post_vol_bat3v_read()

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

◆ pre_nvme_read()

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

◆ pre_vol_bat3v_read()

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

◆ pre_vr_read()

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

◆ set_dram_throttle_cb()

void set_dram_throttle_cb ( apml_msg msg)

◆ set_dram_throttle_fail_cb()

void set_dram_throttle_fail_cb ( apml_msg msg)

◆ set_dram_throttle_value()

void set_dram_throttle_value ( uint8_t  throttle_percent)
Here is the call graph for this function:

Variable Documentation

◆ adm1278_init_args

adm1278_init_arg adm1278_init_args[]
Initial value:
= {
[0] = { .is_init = false, .config = { 0x3F1C }, .r_sense = 0.3 }
}

◆ apml_mailbox_init_args

apml_mailbox_init_arg apml_mailbox_init_args[] = { [0] = { .data = 0x00000000, .retry = 0 } }

◆ ast_adc_init_args

adc_asd_init_arg ast_adc_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.deglitch[0] = { .deglitch_en = true, .upper_bound = 0x333 },
.deglitch[1] = { .deglitch_en = true, .upper_bound = 0x303 },
.deglitch[2] = { .deglitch_en = true, .upper_bound = 0x2C7 },
.deglitch[3] = { .deglitch_en = true, .upper_bound = 0x1DC },
.deglitch[4] = { .deglitch_en = true, .upper_bound = 0x1E0 },
.deglitch[5] = { .deglitch_en = true, .upper_bound = 0x2C7 },
},
[1] = {
.is_init = false,
.deglitch[0] = { .deglitch_en = true, .upper_bound = 0x30B },
.deglitch[1] = { .deglitch_en = true, .upper_bound = 0x2EE },
.deglitch[2] = { .deglitch_en = true, .upper_bound = 0x209 },
.deglitch[4] = { .deglitch_en = true, .upper_bound = 0x333 },
.deglitch[5] = { .deglitch_en = true, .upper_bound = 0x333 },
.deglitch[6] = { .deglitch_en = true, .upper_bound = 0x25F },
}
}

◆ ddr5_init_power_args

ddr5_init_power_arg ddr5_init_power_args[]
Initial value:
= {
[0] = { .HID_code = 0x00, .port_number = 0 }, [1] = { .HID_code = 0x02, .port_number = 0 },
[2] = { .HID_code = 0x01, .port_number = 0 }, [3] = { .HID_code = 0x03, .port_number = 0 },
[4] = { .HID_code = 0x00, .port_number = 1 }, [5] = { .HID_code = 0x02, .port_number = 1 },
[6] = { .HID_code = 0x01, .port_number = 1 }, [7] = { .HID_code = 0x03, .port_number = 1 },
}

◆ ddr5_init_temp_args

ddr5_init_temp_arg ddr5_init_temp_args[]
Initial value:
= {
[0] = { .HID_code = 0x00, .port_number = 0 }, [1] = { .HID_code = 0x02, .port_number = 0 },
[2] = { .HID_code = 0x01, .port_number = 0 }, [3] = { .HID_code = 0x03, .port_number = 0 },
[4] = { .HID_code = 0x00, .port_number = 1 }, [5] = { .HID_code = 0x02, .port_number = 1 },
[6] = { .HID_code = 0x01, .port_number = 1 }, [7] = { .HID_code = 0x03, .port_number = 1 },
}

◆ g788p81u_init_args

g788p81u_init_arg g788p81u_init_args[]
Initial value:
= { [0] = { .is_init = false,
.remote_T_high_limit = 0x50,
.alert_mode = 0x01,
.alert_mask = 0x8B,
.configuration = 0x07,
.remote_temp_therm_limit = 0x64,
.local_temp_therm_limit = 0x64 } }

◆ ltc4282_init_args

ltc4282_init_arg ltc4282_init_args[] = { [0] = { .r_sense_mohm = 0.5 } }

◆ mp5990_init_args

mp5990_init_arg mp5990_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.iout_cal_gain = 0x0140,
.iout_oc_fault_limit = 0x0032,
.ocw_sc_ref = 0x0FDA },
}

◆ mux_conf_addr_0xe2

struct tca9548 mux_conf_addr_0xe2[]
Initial value:
= {
[0] = { .addr = 0xe2, .chan = 0 }, [1] = { .addr = 0xe2, .chan = 1 },
[2] = { .addr = 0xe2, .chan = 2 }, [3] = { .addr = 0xe2, .chan = 3 },
[4] = { .addr = 0xe2, .chan = 4 }, [5] = { .addr = 0xe2, .chan = 5 },
[6] = { .addr = 0xe2, .chan = 6 }, [7] = { .addr = 0xe2, .chan = 7 },
}

◆ nct7718w_init_args

nct7718w_init_arg nct7718w_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.rt1_high_alert_temp = 0x50,
.rt_filter_alert_mode = 0x01,
.alert_mask = 0x8B,
.configuration = 0x07,
.rt1_critical_temperature = 0x64,
.lt_critical_temperature = 0x64 },
}

◆ vr_pre_read_args

vr_pre_proc_arg vr_pre_read_args[]
Initial value:
= {
[0] = { 0x0 },
[1] = { 0x1 },
}