OpenBIC
OpenSource Bridge-IC
plat_pldm_fw_update.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <logging/log.h>
#include <sys/crc.h>
#include "pldm_firmware_update.h"
#include "plat_pldm_fw_update.h"
#include "plat_pldm_sensor.h"
#include "plat_class.h"
#include "plat_hook.h"
#include "mp2971.h"
#include "mp29816a.h"
#include "raa228249.h"
#include "drivers/i2c_npcm4xx.h"
#include "util_spi.h"
#include "plat_gpio.h"
#include "plat_cpld.h"
#include "plat_iris_smbus.h"
#include "plat_util.h"
#include "plat_i2c.h"
Include dependency graph for plat_pldm_fw_update.c:

Classes

struct  compnt_mapping_sensor
 

Macros

#define RESET_CPLD_ON   0x3F
 
#define RESET_CPLD_OFF   0x00
 
#define IRIS_BOOT0_IMG_SIZE   0x1FFFFB
 
#define ASIC_VERSION_BYTE   0x68
 
#define I2C_MAX_RETRY   3
 
#define VR_COMPONENT_DEF(comp_id)
 

Functions

 LOG_MODULE_REGISTER (plat_fwupdate)
 
void spi_node_disable ()
 
void change_spi_node_to_hamsa ()
 
void change_spi_node_to_medha0 ()
 
void change_spi_node_to_medha1 ()
 
void set_cpld_reset_reg (uint8_t value)
 
uint8_t pldm_mtia_flash_update (void *fw_update_param)
 
uint32_t plat_get_image_crc_checksum (uint8_t index)
 
uint32_t plat_get_image_version (uint8_t index)
 
bool plat_get_image_crc_checksum_from_flash (uint8_t index, uint8_t data_type, uint32_t *data)
 
int sb_write_byte (uint8_t cmd, uint8_t data)
 
int smbus_read_byte (uint8_t cmd, uint8_t *data)
 
int sb_write_block (uint8_t slv_id, uint8_t cmd, uint8_t *data, uint32_t len)
 
int sb_read_byte (uint8_t cmd, uint8_t *data)
 
uint32_t smbus_mode_query (void)
 
int sb_write_fwblock (uint32_t addr, uint32_t *data, uint32_t data_len)
 
uint8_t pldm_pre_iris_boot_update (void *fw_update_param)
 
int iris_data_write (uint8_t *data, uint32_t data_size)
 
uint8_t pldm_iris_boot_update (void *fw_update_param)
 
uint8_t pldm_post_iris_boot_update (void *fw_update_param)
 
bool get_fw_version_from_asic (uint8_t *data)
 
uint8_t plat_pldm_query_device_identifiers (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len)
 
void load_pldmupdate_comp_config (void)
 
bool find_sensor_id_and_name_by_firmware_comp_id (uint8_t comp_identifier, uint8_t *sensor_id, char *sensor_name)
 
void plat_reset_prepare ()
 
void pal_warm_reset_prepare ()
 

Variables

const struct device * i2c_dev
 
uint8_t slave_id = HAMSA_BOOT1_ADDR
 
bool update_flag = 0
 
compnt_mapping_sensor vr_compnt_mapping_sensor_table []
 
pldm_fw_update_info_t PLDMUPDATE_FW_CONFIG_TABLE []
 

Macro Definition Documentation

◆ ASIC_VERSION_BYTE

#define ASIC_VERSION_BYTE   0x68

◆ I2C_MAX_RETRY

#define I2C_MAX_RETRY   3

◆ IRIS_BOOT0_IMG_SIZE

#define IRIS_BOOT0_IMG_SIZE   0x1FFFFB

◆ RESET_CPLD_OFF

#define RESET_CPLD_OFF   0x00

◆ RESET_CPLD_ON

#define RESET_CPLD_ON   0x3F

◆ VR_COMPONENT_DEF

#define VR_COMPONENT_DEF (   comp_id)
Value:
{ \
.enable = true, .comp_classification = COMP_CLASS_TYPE_DOWNSTREAM, \
.comp_identifier = comp_id, .comp_classification_index = 0x00, \
.pre_update_func = pldm_pre_vr_update, .update_func = pldm_vr_update, \
.pos_update_func = pldm_post_vr_update, .inf = COMP_UPDATE_VIA_I2C, \
.activate_method = COMP_ACT_AC_PWR_CYCLE, .self_act_func = NULL, \
.get_fw_version_fn = get_vr_fw_version, .self_apply_work_func = NULL, \
.comp_version_str = NULL, \
}
uint8_t pldm_vr_update(void *fw_update_param)
Definition: pldm_firmware_update.c:207
@ COMP_ACT_AC_PWR_CYCLE
Definition: pldm_firmware_update.h:314
@ COMP_CLASS_TYPE_DOWNSTREAM
Definition: pldm_firmware_update.h:192
@ COMP_UPDATE_VIA_I2C
Definition: pldm_firmware_update.h:321

Function Documentation

◆ change_spi_node_to_hamsa()

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

◆ change_spi_node_to_medha0()

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

◆ change_spi_node_to_medha1()

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

◆ find_sensor_id_and_name_by_firmware_comp_id()

bool find_sensor_id_and_name_by_firmware_comp_id ( uint8_t  comp_identifier,
uint8_t *  sensor_id,
char *  sensor_name 
)

◆ get_fw_version_from_asic()

bool get_fw_version_from_asic ( uint8_t *  data)
Here is the call graph for this function:

◆ iris_data_write()

int iris_data_write ( uint8_t *  data,
uint32_t  data_size 
)
Here is the call graph for this function:

◆ load_pldmupdate_comp_config()

void load_pldmupdate_comp_config ( void  )

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_fwupdate  )

◆ pal_warm_reset_prepare()

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

◆ plat_get_image_crc_checksum()

uint32_t plat_get_image_crc_checksum ( uint8_t  index)

◆ plat_get_image_crc_checksum_from_flash()

bool plat_get_image_crc_checksum_from_flash ( uint8_t  index,
uint8_t  data_type,
uint32_t *  data 
)
Here is the call graph for this function:

◆ plat_get_image_version()

uint32_t plat_get_image_version ( uint8_t  index)

◆ plat_pldm_query_device_identifiers()

uint8_t plat_pldm_query_device_identifiers ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len 
)
Here is the call graph for this function:

◆ plat_reset_prepare()

void plat_reset_prepare ( )

◆ pldm_iris_boot_update()

uint8_t pldm_iris_boot_update ( void *  fw_update_param)
Here is the call graph for this function:

◆ pldm_mtia_flash_update()

uint8_t pldm_mtia_flash_update ( void *  fw_update_param)
Here is the call graph for this function:

◆ pldm_post_iris_boot_update()

uint8_t pldm_post_iris_boot_update ( void *  fw_update_param)
Here is the call graph for this function:

◆ pldm_pre_iris_boot_update()

uint8_t pldm_pre_iris_boot_update ( void *  fw_update_param)

◆ sb_read_byte()

int sb_read_byte ( uint8_t  cmd,
uint8_t *  data 
)

◆ sb_write_block()

int sb_write_block ( uint8_t  slv_id,
uint8_t  cmd,
uint8_t *  data,
uint32_t  len 
)
Here is the call graph for this function:

◆ sb_write_byte()

int sb_write_byte ( uint8_t  cmd,
uint8_t  data 
)

◆ sb_write_fwblock()

int sb_write_fwblock ( uint32_t  addr,
uint32_t *  data,
uint32_t  data_len 
)

◆ set_cpld_reset_reg()

void set_cpld_reset_reg ( uint8_t  value)
Here is the call graph for this function:

◆ smbus_mode_query()

uint32_t smbus_mode_query ( void  )

◆ smbus_read_byte()

int smbus_read_byte ( uint8_t  cmd,
uint8_t *  data 
)

◆ spi_node_disable()

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

Variable Documentation

◆ i2c_dev

const struct device* i2c_dev

◆ PLDMUPDATE_FW_CONFIG_TABLE

pldm_fw_update_info_t PLDMUPDATE_FW_CONFIG_TABLE[]

◆ slave_id

uint8_t slave_id = HAMSA_BOOT1_ADDR

◆ update_flag

bool update_flag = 0

◆ vr_compnt_mapping_sensor_table

compnt_mapping_sensor vr_compnt_mapping_sensor_table[]
Initial value:
= {
{ COMPNT_VR_6, SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_TEMP_C, "ASIC_P1V1_VDDQC_HBM1357" },
"ASIC_P1V2_HAMSA_VDDHRXTX_PCIE" },
{ COMPNT_VR_9, SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_TEMP_C, "ASIC_P1V1_VDDQC_HBM0246" },
}
@ COMPNT_VR_3V3
Definition: plat_pldm_fw_update.h:60
@ COMPNT_VR_7
Definition: plat_pldm_fw_update.h:51
@ COMPNT_VR_3
Definition: plat_pldm_fw_update.h:47
@ COMPNT_VR_12
Definition: plat_pldm_fw_update.h:56
@ COMPNT_VR_1
Definition: plat_pldm_fw_update.h:45
@ COMPNT_VR_2
Definition: plat_pldm_fw_update.h:46
@ COMPNT_VR_8
Definition: plat_pldm_fw_update.h:52
@ COMPNT_VR_4
Definition: plat_pldm_fw_update.h:48
@ COMPNT_VR_5
Definition: plat_pldm_fw_update.h:49
@ COMPNT_VR_6
Definition: plat_pldm_fw_update.h:50
@ COMPNT_VR_11
Definition: plat_pldm_fw_update.h:55
@ COMPNT_VR_10
Definition: plat_pldm_fw_update.h:54
@ COMPNT_VR_9
Definition: plat_pldm_fw_update.h:53
#define SENSOR_NUM_ASIC_P0V75_OWL_E_VDD_TEMP_C
Definition: plat_pldm_sensor.h:176
#define SENSOR_NUM_ASIC_P0V75_MAX_M_VDD_TEMP_C
Definition: plat_pldm_sensor.h:196
#define SENSOR_NUM_ASIC_P0V9_OWL_E_TRVDD_TEMP_C
Definition: plat_pldm_sensor.h:166
#define SENSOR_NUM_P3V3_OSFP_TEMP_C
Definition: plat_pldm_sensor.h:278
#define SENSOR_NUM_ASIC_P0V9_OWL_W_TRVDD_TEMP_C
Definition: plat_pldm_sensor.h:181
#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM1357_TEMP_C
Definition: plat_pldm_sensor.h:256
#define SENSOR_NUM_ASIC_P1V1_VDDQC_HBM0246_TEMP_C
Definition: plat_pldm_sensor.h:236
#define SENSOR_NUM_ASIC_P0V85_MEDHA0_VDD_TEMP_C
Definition: plat_pldm_sensor.h:156
#define SENSOR_NUM_ASIC_P0V85_MEDHA1_VDD_TEMP_C
Definition: plat_pldm_sensor.h:161
#define SENSOR_NUM_ASIC_P0V4_VDDQL_HBM0246_TEMP_C
Definition: plat_pldm_sensor.h:231
#define SENSOR_NUM_ASIC_P0V75_MAX_N_VDD_TEMP_C
Definition: plat_pldm_sensor.h:201
#define SENSOR_NUM_ASIC_P0V75_OWL_W_VDD_TEMP_C
Definition: plat_pldm_sensor.h:191
#define SENSOR_NUM_ASIC_P1V2_HAMSA_VDDHRXTX_PCIE_TEMP_C
Definition: plat_pldm_sensor.h:216