OpenBIC
OpenSource Bridge-IC
plat_hook.c File Reference
#include "plat_hook.h"
#include <stdio.h>
#include <string.h>
#include <logging/log.h>
#include "sensor.h"
#include "pmbus.h"
#include "libutil.h"
#include "plat_i2c.h"
#include "power_status.h"
#include "common_i2c_mux.h"
#include "i2c-mux-tca9543a.h"
#include "i2c-mux-pi4msd5v9542.h"
#include "plat_sensor_table.h"
#include "i2c-mux-pca954x.h"
#include "plat_class.h"
#include "plat_dev.h"
#include "nvme.h"
#include "plat_ipmi.h"
#include "util_sys.h"
#include "plat_fru.h"
#include "xdpe15284.h"
#include "mp2985.h"
#include "sq52205.h"
#include "plat_pldm_monitor.h"
Include dependency graph for plat_hook.c:

Macros

#define PEX_SWITCH_INIT_RETRY_COUNT   20
 
#define ACCL_SENSOR_COUNT   6
 
#define NVME_ERROR_RETRY_COUNT   3
 

Functions

 LOG_MODULE_REGISTER (plat_hook)
 
bool pre_ina233_read (sensor_cfg *cfg, void *args)
 
bool post_ina233_read (sensor_cfg *cfg, void *args, int *reading)
 
bool pre_xdpe15284_read (sensor_cfg *cfg, void *args)
 
bool post_xdpe15284_read (sensor_cfg *cfg, void *args, int *reading)
 
bool pre_pex89000_read (sensor_cfg *cfg, void *args)
 
bool pre_accl_nvme_read (sensor_cfg *cfg, void *args)
 
bool post_accl_nvme_read (sensor_cfg *cfg, void *args, int *reading)
 
bool post_adm1272_read (sensor_cfg *cfg, void *args, int *reading)
 

Variables

struct k_mutex xdpe15284_mutex
 
adc_asd_init_arg adc_asd_init_args []
 
adm1272_init_arg adm1272_init_args []
 
ltc4286_init_arg ltc4286_init_args []
 
ina233_init_arg accl_pwr_monitor_ina233_init_args []
 
sq52205_init_arg accl_pwr_monitor_sq52205_init_args []
 
pex89000_init_arg pex_sensor_init_args []
 
sq52205_init_arg u178_179_sq52205_init_args []
 
ina230_init_arg u178_179_ina230_init_args []
 
mp2985_init_arg mp2985_init_args [] = { [0] = { .is_init = false } }
 
mux_config tca9543_configs []
 
mux_config ina233_configs []
 
pwr_monitor_pre_proc_arg pwr_monitor_pre_dvt_args []
 
pwr_monitor_pre_proc_arg pwr_monitor_args []
 
vr_page_cfg xdpe15284_page []
 
mux_config pca9548_configs []
 
mux_config pca9546_configs []
 
accl_card_info accl_card_info_args []
 
accl_card_sensor_info accl_sensor_info_args []
 
uint8_t plat_monitor_table_arg []
 

Macro Definition Documentation

◆ ACCL_SENSOR_COUNT

#define ACCL_SENSOR_COUNT   6

◆ NVME_ERROR_RETRY_COUNT

#define NVME_ERROR_RETRY_COUNT   3

◆ PEX_SWITCH_INIT_RETRY_COUNT

#define PEX_SWITCH_INIT_RETRY_COUNT   20

Function Documentation

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_hook  )

◆ post_accl_nvme_read()

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

◆ post_adm1272_read()

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

◆ post_ina233_read()

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

◆ post_xdpe15284_read()

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

◆ pre_accl_nvme_read()

bool pre_accl_nvme_read ( sensor_cfg cfg,
void *  args 
)

Check whether Freya is accessible

Check ACCL card power status

Here is the call graph for this function:

◆ pre_ina233_read()

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

◆ pre_pex89000_read()

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

◆ pre_xdpe15284_read()

bool pre_xdpe15284_read ( sensor_cfg cfg,
void *  args 
)

Variable Documentation

◆ accl_card_info_args

accl_card_info accl_card_info_args[]
Initial value:
= {
[0] = { .card_id = 0, .freya_info_ptr = &accl_freya_info[0] },
[1] = { .card_id = 1, .freya_info_ptr = &accl_freya_info[1] },
[2] = { .card_id = 2, .freya_info_ptr = &accl_freya_info[2] },
[3] = { .card_id = 3, .freya_info_ptr = &accl_freya_info[3] },
[4] = { .card_id = 4, .freya_info_ptr = &accl_freya_info[4] },
[5] = { .card_id = 5, .freya_info_ptr = &accl_freya_info[5] },
[6] = { .card_id = 6, .freya_info_ptr = &accl_freya_info[6] },
[7] = { .card_id = 7, .freya_info_ptr = &accl_freya_info[7] },
[8] = { .card_id = 8, .freya_info_ptr = &accl_freya_info[8] },
[9] = { .card_id = 9, .freya_info_ptr = &accl_freya_info[9] },
[10] = { .card_id = 10, .freya_info_ptr = &accl_freya_info[10] },
[11] = { .card_id = 11, .freya_info_ptr = &accl_freya_info[11] },
}
freya_info accl_freya_info[]
Definition: plat_dev.c:206

◆ accl_pwr_monitor_ina233_init_args

ina233_init_arg accl_pwr_monitor_ina233_init_args[]

◆ accl_pwr_monitor_sq52205_init_args

sq52205_init_arg accl_pwr_monitor_sq52205_init_args[]

◆ accl_sensor_info_args

accl_card_sensor_info accl_sensor_info_args[]
Initial value:
= {
[0] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_1_FREYA_1 },
[1] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_2_FREYA_1 },
[2] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_3_FREYA_1 },
[3] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_4_FREYA_1 },
[4] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_5_FREYA_1 },
[5] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_6_FREYA_1 },
[6] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_7_FREYA_1 },
[7] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_8_FREYA_1 },
[8] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_9_FREYA_1 },
[9] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_10_FREYA_1 },
[10] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_11_FREYA_1 },
[11] = { .is_sensor_init = false, .start_sensor_num = SENSOR_NUM_TEMP_ACCL_12_FREYA_1 },
}
#define SENSOR_NUM_TEMP_ACCL_10_FREYA_1
Definition: plat_sensor_table.h:243
#define SENSOR_NUM_TEMP_ACCL_11_FREYA_1
Definition: plat_sensor_table.h:253
#define SENSOR_NUM_TEMP_ACCL_2_FREYA_1
Definition: plat_sensor_table.h:163
#define SENSOR_NUM_TEMP_ACCL_4_FREYA_1
Definition: plat_sensor_table.h:183
#define SENSOR_NUM_TEMP_ACCL_9_FREYA_1
Definition: plat_sensor_table.h:233
#define SENSOR_NUM_TEMP_ACCL_1_FREYA_1
Definition: plat_sensor_table.h:153
#define SENSOR_NUM_TEMP_ACCL_5_FREYA_1
Definition: plat_sensor_table.h:193
#define SENSOR_NUM_TEMP_ACCL_6_FREYA_1
Definition: plat_sensor_table.h:203
#define SENSOR_NUM_TEMP_ACCL_3_FREYA_1
Definition: plat_sensor_table.h:173
#define SENSOR_NUM_TEMP_ACCL_8_FREYA_1
Definition: plat_sensor_table.h:223
#define SENSOR_NUM_TEMP_ACCL_12_FREYA_1
Definition: plat_sensor_table.h:263
#define SENSOR_NUM_TEMP_ACCL_7_FREYA_1
Definition: plat_sensor_table.h:213

◆ adc_asd_init_args

adc_asd_init_arg adc_asd_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.deglitch[3] = { .deglitch_en = true, .upper_bound = 0x2D3 },
.deglitch[4] = { .deglitch_en = true, .upper_bound = 0x306 },
.deglitch[5] = { .deglitch_en = true, .upper_bound = 0x20D },
.deglitch[7] = { .deglitch_en = true, .upper_bound = 0x25C },
},
[1] = {
.is_init = false,
.deglitch[2] = { .deglitch_en = true, .upper_bound = 0x306 },
.deglitch[3] = { .deglitch_en = true, .upper_bound = 0x306 },
.deglitch[4] = { .deglitch_en = true, .upper_bound = 0x219 },
.deglitch[5] = { .deglitch_en = true, .upper_bound = 0x219 },
}
}

◆ adm1272_init_args

adm1272_init_arg adm1272_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.is_need_set_pwr_cfg = true,
.pwr_monitor_cfg.value = 0x3F3F,
.r_sense_mohm = 0.3,
.is_record_ein = false,
.last_energy = 0,
.last_rollover = 0,
.last_sample = 0,
},
[1] = { .is_init = false,
.is_need_set_pwr_cfg = true,
.pwr_monitor_cfg.value = 0x3F3F,
.r_sense_mohm = 0.3,
.is_record_ein = false,
.last_energy = 0,
.last_rollover = 0,
.last_sample = 0,
},
}

◆ ina233_configs

mux_config ina233_configs[]
Initial value:
= {
[0] = { .target_addr = 0x70, .channel = TCA9543A_CHANNEL_0 },
[1] = { .target_addr = 0x70, .channel = TCA9543A_CHANNEL_1 },
}
@ TCA9543A_CHANNEL_1
Definition: i2c-mux-tca9543a.h:24
@ TCA9543A_CHANNEL_0
Definition: i2c-mux-tca9543a.h:23

◆ ltc4286_init_args

ltc4286_init_arg ltc4286_init_args[]
Initial value:
= {
[0] = { .is_init = false, .r_sense_mohm = 0.3, .mfr_config_1 = { 0xFFFF } },
[1] = { .is_init = false, .r_sense_mohm = 0.3, .mfr_config_1 = { 0xFFFF } }
}

◆ mp2985_init_args

mp2985_init_arg mp2985_init_args[] = { [0] = { .is_init = false } }

◆ pca9546_configs

mux_config pca9546_configs[]
Initial value:
= {
[0] = { .target_addr = 0x72, .channel = PCA9546A_CHANNEL_0 },
[1] = { .target_addr = 0x72, .channel = PCA9546A_CHANNEL_1 },
[2] = { .target_addr = 0x72, .channel = PCA9546A_CHANNEL_2 },
[3] = { .target_addr = 0x72, .channel = PCA9546A_CHANNEL_3 },
}
@ PCA9546A_CHANNEL_0
Definition: i2c-mux-pca954x.h:34
@ PCA9546A_CHANNEL_3
Definition: i2c-mux-pca954x.h:37
@ PCA9546A_CHANNEL_2
Definition: i2c-mux-pca954x.h:36
@ PCA9546A_CHANNEL_1
Definition: i2c-mux-pca954x.h:35

◆ pca9548_configs

mux_config pca9548_configs[]
Initial value:
= {
[0] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_5 },
[1] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_4 },
[2] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_3 },
[3] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_2 },
[4] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_1 },
[5] = { .bus = I2C_BUS8, .target_addr = 0x74, .channel = PCA9548A_CHANNEL_0 },
[6] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_5 },
[7] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_4 },
[8] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_3 },
[9] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_2 },
[10] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_1 },
[11] = { .bus = I2C_BUS7, .target_addr = 0x70, .channel = PCA9548A_CHANNEL_0 },
}
#define I2C_BUS7
Definition: plat_i2c.h:30
#define I2C_BUS8
Definition: plat_i2c.h:31
@ PCA9548A_CHANNEL_0
Definition: i2c-mux-pca954x.h:22
@ PCA9548A_CHANNEL_1
Definition: i2c-mux-pca954x.h:23
@ PCA9548A_CHANNEL_2
Definition: i2c-mux-pca954x.h:24
@ PCA9548A_CHANNEL_3
Definition: i2c-mux-pca954x.h:25
@ PCA9548A_CHANNEL_4
Definition: i2c-mux-pca954x.h:26
@ PCA9548A_CHANNEL_5
Definition: i2c-mux-pca954x.h:27

◆ pex_sensor_init_args

pex89000_init_arg pex_sensor_init_args[]
Initial value:
= {
[0] = { .idx = 0, .is_init = false },
[1] = { .idx = 1, .is_init = false },
}

◆ plat_monitor_table_arg

uint8_t plat_monitor_table_arg[]
Initial value:
@ PCIE_CARD_6
Definition: plat_class.h:144
@ PCIE_CARD_3
Definition: plat_class.h:141
@ PCIE_CARD_7
Definition: plat_class.h:145
@ PCIE_CARD_4
Definition: plat_class.h:142
@ PCIE_CARD_1
Definition: plat_class.h:139
@ PCIE_CARD_10
Definition: plat_class.h:148
@ PCIE_CARD_11
Definition: plat_class.h:149
@ PCIE_CARD_9
Definition: plat_class.h:147
@ PCIE_CARD_12
Definition: plat_class.h:150
@ PCIE_CARD_8
Definition: plat_class.h:146
@ PCIE_CARD_2
Definition: plat_class.h:140
@ PCIE_CARD_5
Definition: plat_class.h:143

◆ pwr_monitor_args

pwr_monitor_pre_proc_arg pwr_monitor_args[]
Initial value:
= {
[0] = { .mux_configs = NULL, .card_id = 0 },
[1] = { .mux_configs = NULL, .card_id = 1 },
[2] = { .mux_configs = NULL, .card_id = 2 },
[3] = { .mux_configs = NULL, .card_id = 3 },
[4] = { .mux_configs = NULL, .card_id = 4 },
[5] = { .mux_configs = NULL, .card_id = 5 },
[6] = { .mux_configs = NULL, .card_id = 6 },
[7] = { .mux_configs = NULL, .card_id = 7 },
[8] = { .mux_configs = NULL, .card_id = 8 },
[9] = { .mux_configs = NULL, .card_id = 9 },
[10] = { .mux_configs = NULL, .card_id = 10 },
[11] = { .mux_configs = NULL, .card_id = 11 },
}

◆ pwr_monitor_pre_dvt_args

pwr_monitor_pre_proc_arg pwr_monitor_pre_dvt_args[]
Initial value:
= {
[0] = { .mux_configs = &ina233_configs[1], .card_id = 0 },
[1] = { .mux_configs = &ina233_configs[1], .card_id = 1 },
[2] = { .mux_configs = &ina233_configs[1], .card_id = 2 },
[3] = { .mux_configs = &ina233_configs[1], .card_id = 3 },
[4] = { .mux_configs = &ina233_configs[1], .card_id = 4 },
[5] = { .mux_configs = &ina233_configs[1], .card_id = 5 },
[6] = { .mux_configs = &ina233_configs[0], .card_id = 6 },
[7] = { .mux_configs = &ina233_configs[0], .card_id = 7 },
[8] = { .mux_configs = &ina233_configs[0], .card_id = 8 },
[9] = { .mux_configs = &ina233_configs[0], .card_id = 9 },
[10] = { .mux_configs = &ina233_configs[0], .card_id = 10 },
[11] = { .mux_configs = &ina233_configs[0], .card_id = 11 },
}
mux_config ina233_configs[]
Definition: plat_hook.c:608

◆ tca9543_configs

mux_config tca9543_configs[]
Initial value:
= {
[0] = { .target_addr = PEX89144_0_MUX_ADDR, .channel = TCA9543A_CHANNEL_1 },
[1] = { .target_addr = PEX89144_1_MUX_ADDR, .channel = TCA9543A_CHANNEL_1 },
}
#define PEX89144_1_MUX_ADDR
Definition: plat_sensor_table.h:48
#define PEX89144_0_MUX_ADDR
Definition: plat_sensor_table.h:47

◆ u178_179_ina230_init_args

ina230_init_arg u178_179_ina230_init_args[]
Initial value:
= {
[0] = { .is_init = false,
.config = {
.MODE = 0b111,
.VSH_CT = 0b100,
.VBUS_CT = 0b100,
.AVG = 0b111,
},
.alt_cfg.POL = 1,
.alert_value = 32.736,
.r_shunt = 0.001,
.i_max = 32.768,
},
[1] = { .is_init = false,
.config = {
.MODE = 0b111,
.VSH_CT = 0b100,
.VBUS_CT = 0b100,
.AVG = 0b111,
},
.alt_cfg.POL = 1,
.alert_value = 32.736,
.r_shunt = 0.001,
.i_max = 32.768,
},
}

◆ u178_179_sq52205_init_args

sq52205_init_arg u178_179_sq52205_init_args[]

◆ xdpe15284_mutex

struct k_mutex xdpe15284_mutex

◆ xdpe15284_page

vr_page_cfg xdpe15284_page[]
Initial value:
= {
[0] = { .vr_page = PMBUS_PAGE_0 },
[1] = { .vr_page = PMBUS_PAGE_1 },
}
@ PMBUS_PAGE_0
Definition: pmbus.h:23
@ PMBUS_PAGE_1
Definition: pmbus.h:24