OpenBIC
OpenSource Bridge-IC
plat_event.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <logging/log.h>
#include "libutil.h"
#include "plat_i2c.h"
#include "plat_class.h"
#include "plat_pldm_sensor.h"
#include "plat_gpio.h"
#include "plat_log.h"
#include "plat_event.h"
#include "plat_hook.h"
#include "plat_isr.h"
#include <pmbus.h>
#include "pldm_oem.h"
Include dependency graph for plat_event.c:

Classes

struct  _vr_error_callback_info_
 
struct  _vr_fault_info
 

Macros

#define CPLD_POLLING_INTERVAL_MS   1000
 
#define CHECK_ALL_BITS   0xFF
 
#define CHECK_BIT_7_ONLY   0x80
 
#define CHECK_BIT_6_ONLY   0x40
 
#define AEGIS_CPLD_ADDR   (0x4C >> 1)
 

Typedefs

typedef struct _vr_error_callback_info_ vr_error_callback_info
 
typedef struct _vr_fault_info vr_fault_info
 

Functions

 LOG_MODULE_REGISTER (plat_event)
 
void check_cpld_handler ()
 
 K_WORK_DELAYABLE_DEFINE (check_cpld_work, check_cpld_handler)
 
 K_TIMER_DEFINE (init_ubc_delayed_timer, check_ubc_delayed_timer_handler, NULL)
 
 K_WORK_DEFINE (check_ubc_delayed_work, check_ubc_delayed)
 
void check_ubc_delayed_timer_handler (struct k_timer *timer)
 
 K_THREAD_STACK_DEFINE (cpld_polling_stack, POLLING_CPLD_STACK_SIZE)
 
void get_vr_vout_handler (struct k_work *work)
 
 K_WORK_DEFINE (vr_vout_work, get_vr_vout_handler)
 
bool vr_error_callback (aegis_cpld_info *cpld_info, uint8_t *current_cpld_value)
 
void process_mtia_vr_power_fault_sel (aegis_cpld_info *cpld_info, uint8_t *current_cpld_value)
 
const char * get_cpld_reg_name (uint8_t cpld_offset)
 
const char * get_cpld_bit_name (uint8_t cpld_offset, uint8_t bit_pos)
 
void check_cpld_polling_alert_status (void)
 
void set_cpld_polling_enable_flag (bool status)
 
bool get_cpld_polling_enable_flag (void)
 
void check_ubc_delayed (struct k_work *work)
 
void plat_set_ac_on_log ()
 
void plat_set_dc_on_log (bool is_assert)
 
bool is_ubc_enabled_delayed_enabled (void)
 
void reset_error_log_states (uint8_t err_type)
 
void poll_cpld_registers ()
 
void init_cpld_polling (void)
 

Variables

struct k_thread cpld_polling_thread
 
k_tid_t cpld_polling_tid
 
aegis_cpld_info aegis_cpld_info_table []
 
const cpld_bit_name_table_t cpld_bit_name_table []
 
bool cpld_polling_alert_status = false
 
bool cpld_polling_enable_flag = true
 
bool ubc_enabled_delayed_status = false
 
const vr_fault_info vr_fault_table []
 
const vr_mapping_status vr_status_rail_list []
 

Macro Definition Documentation

◆ AEGIS_CPLD_ADDR

#define AEGIS_CPLD_ADDR   (0x4C >> 1)

◆ CHECK_ALL_BITS

#define CHECK_ALL_BITS   0xFF

◆ CHECK_BIT_6_ONLY

#define CHECK_BIT_6_ONLY   0x40

◆ CHECK_BIT_7_ONLY

#define CHECK_BIT_7_ONLY   0x80

◆ CPLD_POLLING_INTERVAL_MS

#define CPLD_POLLING_INTERVAL_MS   1000

Typedef Documentation

◆ vr_error_callback_info

◆ vr_fault_info

typedef struct _vr_fault_info vr_fault_info

Function Documentation

◆ check_cpld_handler()

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

◆ check_cpld_polling_alert_status()

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

◆ check_ubc_delayed()

void check_ubc_delayed ( struct k_work *  work)
Here is the call graph for this function:

◆ check_ubc_delayed_timer_handler()

void check_ubc_delayed_timer_handler ( struct k_timer *  timer)

◆ get_cpld_bit_name()

const char * get_cpld_bit_name ( uint8_t  cpld_offset,
uint8_t  bit_pos 
)

◆ get_cpld_polling_enable_flag()

bool get_cpld_polling_enable_flag ( void  )

◆ get_cpld_reg_name()

const char * get_cpld_reg_name ( uint8_t  cpld_offset)

◆ get_vr_vout_handler()

void get_vr_vout_handler ( struct k_work *  work)
Here is the call graph for this function:

◆ init_cpld_polling()

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

◆ is_ubc_enabled_delayed_enabled()

bool is_ubc_enabled_delayed_enabled ( void  )

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( cpld_polling_stack  ,
POLLING_CPLD_STACK_SIZE   
)

◆ K_TIMER_DEFINE()

K_TIMER_DEFINE ( init_ubc_delayed_timer  ,
check_ubc_delayed_timer_handler  ,
NULL   
)

◆ K_WORK_DEFINE() [1/2]

K_WORK_DEFINE ( check_ubc_delayed_work  ,
check_ubc_delayed   
)

◆ K_WORK_DEFINE() [2/2]

K_WORK_DEFINE ( vr_vout_work  ,
get_vr_vout_handler   
)

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( check_cpld_work  ,
check_cpld_handler   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_event  )

◆ plat_set_ac_on_log()

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

◆ plat_set_dc_on_log()

void plat_set_dc_on_log ( bool  is_assert)
Here is the call graph for this function:

◆ poll_cpld_registers()

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

◆ process_mtia_vr_power_fault_sel()

void process_mtia_vr_power_fault_sel ( aegis_cpld_info cpld_info,
uint8_t *  current_cpld_value 
)
Here is the call graph for this function:

◆ reset_error_log_states()

void reset_error_log_states ( uint8_t  err_type)
Here is the call graph for this function:

◆ set_cpld_polling_enable_flag()

void set_cpld_polling_enable_flag ( bool  status)

◆ vr_error_callback()

bool vr_error_callback ( aegis_cpld_info cpld_info,
uint8_t *  current_cpld_value 
)
Here is the call graph for this function:

Variable Documentation

◆ aegis_cpld_info_table

aegis_cpld_info aegis_cpld_info_table[]
Initial value:
= {
{ VR_POWER_FAULT_1_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS, .event_type = VR_POWER_FAULT },
{ VR_POWER_FAULT_2_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS, .event_type = VR_POWER_FAULT },
{ VR_POWER_FAULT_3_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS, .event_type = VR_POWER_FAULT },
{ VR_POWER_FAULT_4_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS, .event_type = VR_POWER_FAULT },
{ VR_POWER_FAULT_5_REG, 0x00, 0x00, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS, .event_type = VR_POWER_FAULT },
{ VR_SMBUS_ALERT_1_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_SMBUS_ALERT_2_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ ASIC_OC_WARN_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ SYSTEM_ALERT_FAULT_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BIT_7_ONLY },
{ TEMPERATURE_IC_OVERT_FAULT_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ LEAK_DETCTION_REG, 0xDF, 0xDF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BIT_6_ONLY},
{ TEMPERATURE_IC_OVERT_FAULT_2_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ ASIC_OC_WARN_2_REG, 0x1F, 0x1F, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ SYSTEM_ALERT_FAULT_2_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BIT_7_ONLY },
{ VR_SMBUS_ALERT_3_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_SMBUS_ALERT_4_REG, 0xFF, 0xFF, true, 0x00, false, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
}
bool vr_error_callback(aegis_cpld_info *cpld_info, uint8_t *current_cpld_value)
Definition: plat_event.c:426
#define CHECK_BIT_6_ONLY
Definition: plat_event.c:39
#define CHECK_BIT_7_ONLY
Definition: plat_event.c:38
#define CHECK_ALL_BITS
Definition: plat_event.c:37
#define VR_POWER_FAULT_5_REG
Definition: plat_event.h:122
#define VR_POWER_FAULT_4_REG
Definition: plat_event.h:121
#define TEMPERATURE_IC_OVERT_FAULT_2_REG
Definition: plat_event.h:177
#define VR_SMBUS_ALERT_3_REG
Definition: plat_event.h:180
@ VR_POWER_FAULT
Definition: plat_event.h:216
#define VR_POWER_FAULT_1_REG
Definition: plat_event.h:118
#define VR_SMBUS_ALERT_2_REG
Definition: plat_event.h:142
#define VR_POWER_FAULT_2_REG
Definition: plat_event.h:119
#define ASIC_OC_WARN_2_REG
Definition: plat_event.h:178
#define VR_SMBUS_ALERT_1_REG
Definition: plat_event.h:141
#define SYSTEM_ALERT_FAULT_REG
Definition: plat_event.h:145
#define ASIC_OC_WARN_REG
Definition: plat_event.h:144
#define VR_POWER_FAULT_3_REG
Definition: plat_event.h:120
#define LEAK_DETCTION_REG
Definition: plat_event.h:151
#define SYSTEM_ALERT_FAULT_2_REG
Definition: plat_event.h:179
#define VR_SMBUS_ALERT_4_REG
Definition: plat_event.h:181
#define TEMPERATURE_IC_OVERT_FAULT_REG
Definition: plat_event.h:148

◆ cpld_bit_name_table

const cpld_bit_name_table_t cpld_bit_name_table[]

◆ cpld_polling_alert_status

bool cpld_polling_alert_status = false

◆ cpld_polling_enable_flag

bool cpld_polling_enable_flag = true

◆ cpld_polling_thread

struct k_thread cpld_polling_thread

◆ cpld_polling_tid

k_tid_t cpld_polling_tid

◆ ubc_enabled_delayed_status

bool ubc_enabled_delayed_status = false

◆ vr_fault_table

const vr_fault_info vr_fault_table[]

◆ vr_status_rail_list

const vr_mapping_status vr_status_rail_list[]
Initial value:
= {
{ .index = VR_STAUS_E_STATUS_BYTE, .pmbus_reg = PMBUS_STATUS_BYTE },
{ .index = VR_STAUS_E_STATUS_WORD, .pmbus_reg = PMBUS_STATUS_WORD },
{ .index = VR_STAUS_E_STATUS_VOUT, .pmbus_reg = PMBUS_STATUS_VOUT },
{ .index = VR_STAUS_E_STATUS_IOUT, .pmbus_reg = PMBUS_STATUS_IOUT },
{ .index = VR_STAUS_E_STATUS_INPUT, .pmbus_reg = PMBUS_STATUS_INPUT },
{ .index = VR_STAUS_E_STATUS_CML, .pmbus_reg = PMBUS_STATUS_CML },
}
@ VR_STAUS_E_STATUS_INPUT
Definition: plat_hook.h:72
@ VR_STAUS_E_STATUS_IOUT
Definition: plat_hook.h:71
@ VR_STAUS_E_STATUS_CML
Definition: plat_hook.h:74
@ VR_STAUS_E_STATUS_BYTE
Definition: plat_hook.h:68
@ VR_STAUS_E_STATUS_TEMPERATURE
Definition: plat_hook.h:73
@ VR_STAUS_E_STATUS_VOUT
Definition: plat_hook.h:70
@ VR_STAUS_E_STATUS_WORD
Definition: plat_hook.h:69
@ 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