OpenBIC
OpenSource Bridge-IC
util_sys.c File Reference
#include <zephyr.h>
#include <logging/log.h>
#include <sys/reboot.h>
#include <stdio.h>
#include <stdlib.h>
#include "cmsis_os.h"
#include "hal_gpio.h"
#include "util_sys.h"
#include "ipmi.h"
#include "libutil.h"
#include "sensor.h"
Include dependency graph for util_sys.c:

Macros

#define SYS_RST_EVT_LOG_REG   0x7e6e2074
 
#define MAX_RETRY   10
 
#define CHECK_READY_FLAG_DELAY_MS   500
 
#define bic_warm_reset_delay   2000
 
#define bic_cold_reset_delay   100
 

Enumerations

enum  GET_SELF_TEST_RESULT_RESPONSE { NO_ERROR = 0x55 , FIRMWARE_ENTERED_RECOVERY_MODE = 0x81 }
 
enum  RECOVERY_MODE_CAUSE {
  RECOVERY_MODE_CAUSE_RECOVERY_JUMPER = 0 , RECOVERY_MODE_CAUSE_SECURITY_STRAP_OVERRIDE_JUMPER , RECOVERY_MODE_CAUSE_IPMI_COMMAND , RECOVERY_MODE_CAUSE_INVALID_FLASH_CONFIG ,
  RECOVERY_MODE_CAUSE_INTERNAL_ERROR
}
 

Functions

 LOG_MODULE_REGISTER (util_sys)
 
void check_ac_lost ()
 
bool is_ac_lost ()
 
void bic_warm_reset ()
 
 K_WORK_DEFINE (bic_warm_reset_work, bic_warm_reset)
 
void submit_bic_warm_reset ()
 
void bic_cold_reset ()
 
 K_WORK_DEFINE (bic_cold_reset_work, bic_cold_reset)
 
void submit_bic_cold_reset ()
 
__weak void pal_warm_reset_prepare ()
 
__weak void pal_cold_reset_prepare ()
 
__weak int pal_submit_bmc_cold_reset ()
 
__weak int pal_host_power_control (power_ctl_t ctl_type)
 
__weak bool pal_is_bmc_present ()
 
__weak bool pal_is_bmc_ready ()
 
__weak int pal_submit_12v_cycle_slot ()
 
__weak int pal_clear_cmos ()
 
__weak uint8_t get_system_class ()
 
__weak int pal_get_set_add_debug_sel_mode_status (uint8_t options, uint8_t *status)
 
__weak uint8_t pal_get_bmc_interface ()
 
int set_me_firmware_mode (uint8_t me_fw_mode)
 
void init_me_firmware ()
 
uint8_t get_me_mode ()
 
void set_sys_ready_pin (uint8_t ready_gpio_name)
 

Variables

uint8_t ISL69254_DEVICE_ID [5] = { 0x04, 0x00, 0x67, 0xD2, 0x49 }
 
uint8_t XDPE12284C_DEVICE_ID [3] = { 0x02, 0x79, 0x02 }
 
uint8_t ISL69259_DEVICE_ID [5] = { 0x04, 0x00, 0x46, 0xD2, 0x49 }
 

Macro Definition Documentation

◆ bic_cold_reset_delay

#define bic_cold_reset_delay   100

◆ bic_warm_reset_delay

#define bic_warm_reset_delay   2000

◆ CHECK_READY_FLAG_DELAY_MS

#define CHECK_READY_FLAG_DELAY_MS   500

◆ MAX_RETRY

#define MAX_RETRY   10

◆ SYS_RST_EVT_LOG_REG

#define SYS_RST_EVT_LOG_REG   0x7e6e2074

Enumeration Type Documentation

◆ GET_SELF_TEST_RESULT_RESPONSE

Enumerator
NO_ERROR 
FIRMWARE_ENTERED_RECOVERY_MODE 

◆ RECOVERY_MODE_CAUSE

Enumerator
RECOVERY_MODE_CAUSE_RECOVERY_JUMPER 
RECOVERY_MODE_CAUSE_SECURITY_STRAP_OVERRIDE_JUMPER 
RECOVERY_MODE_CAUSE_IPMI_COMMAND 
RECOVERY_MODE_CAUSE_INVALID_FLASH_CONFIG 
RECOVERY_MODE_CAUSE_INTERNAL_ERROR 

Function Documentation

◆ bic_cold_reset()

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

◆ bic_warm_reset()

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

◆ check_ac_lost()

void check_ac_lost ( )

◆ get_me_mode()

uint8_t get_me_mode ( )

◆ get_system_class()

__weak uint8_t get_system_class ( )

◆ init_me_firmware()

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

◆ is_ac_lost()

bool is_ac_lost ( )

◆ K_WORK_DEFINE() [1/2]

K_WORK_DEFINE ( bic_cold_reset_work  ,
bic_cold_reset   
)

◆ K_WORK_DEFINE() [2/2]

K_WORK_DEFINE ( bic_warm_reset_work  ,
bic_warm_reset   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( util_sys  )

◆ pal_clear_cmos()

__weak int pal_clear_cmos ( )

◆ pal_cold_reset_prepare()

__weak void pal_cold_reset_prepare ( )

◆ pal_get_bmc_interface()

__weak uint8_t pal_get_bmc_interface ( )

◆ pal_get_set_add_debug_sel_mode_status()

__weak int pal_get_set_add_debug_sel_mode_status ( uint8_t  options,
uint8_t *  status 
)

◆ pal_host_power_control()

__weak int pal_host_power_control ( power_ctl_t  ctl_type)

◆ pal_is_bmc_present()

__weak bool pal_is_bmc_present ( )

◆ pal_is_bmc_ready()

__weak bool pal_is_bmc_ready ( )

◆ pal_submit_12v_cycle_slot()

__weak int pal_submit_12v_cycle_slot ( )

◆ pal_submit_bmc_cold_reset()

int pal_submit_bmc_cold_reset ( )

◆ pal_warm_reset_prepare()

__weak void pal_warm_reset_prepare ( )

◆ set_me_firmware_mode()

int set_me_firmware_mode ( uint8_t  me_fw_mode)
Here is the call graph for this function:

◆ set_sys_ready_pin()

void set_sys_ready_pin ( uint8_t  ready_gpio_name)
Here is the call graph for this function:

◆ submit_bic_cold_reset()

void submit_bic_cold_reset ( )

◆ submit_bic_warm_reset()

void submit_bic_warm_reset ( )

Variable Documentation

◆ ISL69254_DEVICE_ID

uint8_t ISL69254_DEVICE_ID[5] = { 0x04, 0x00, 0x67, 0xD2, 0x49 }

◆ ISL69259_DEVICE_ID

uint8_t ISL69259_DEVICE_ID[5] = { 0x04, 0x00, 0x46, 0xD2, 0x49 }

◆ XDPE12284C_DEVICE_ID

uint8_t XDPE12284C_DEVICE_ID[3] = { 0x02, 0x79, 0x02 }