OpenBIC
OpenSource Bridge-IC
plat_cpld.c File Reference
#include "plat_cpld.h"
#include "libutil.h"
#include "plat_i2c.h"
#include "plat_util.h"
#include "plat_gpio.h"
#include "plat_log.h"
#include "plat_hook.h"
#include "plat_event.h"
#include <logging/log.h>
#include "plat_led.h"
#include "plat_class.h"
#include "plat_ioexp.h"
#include "shell_plat_power_sequence.h"
#include "kernel.h"
Include dependency graph for plat_cpld.c:

Classes

struct  _vr_error_callback_info_
 

Macros

#define POLLING_CPLD_STACK_SIZE   2048
 
#define CPLD_POLLING_INTERVAL_MS   1000
 
#define CHECK_ALL_BITS   0xFF
 
#define CHECK_BITS_8   0x80
 
#define CHECK_BITS_78   0xC0
 
#define CHECK_BITS_678   0xE0
 
#define CHECK_BITS_6   0x40
 

Typedefs

typedef struct _vr_error_callback_info_ vr_error_callback_info
 

Functions

 LOG_MODULE_REGISTER (plat_cpld)
 
bool plat_read_cpld (uint8_t offset, uint8_t *data, uint8_t len)
 
bool plat_write_cpld (uint8_t offset, uint8_t *data)
 
 K_TIMER_DEFINE (check_ubc_delayed_timer, check_ubc_delayed_timer_handler, NULL)
 
void check_cpld_handler ()
 
 K_WORK_DELAYABLE_DEFINE (check_cpld_work, check_cpld_handler)
 
void check_ubc_delayed (struct k_work *work)
 
 K_WORK_DEFINE (check_ubc_delayed_work, check_ubc_delayed)
 
void check_ubc_delayed_timer_handler (struct k_timer *timer)
 
struct k_timer * get_ubc_delaytimer ()
 
 K_THREAD_STACK_DEFINE (cpld_polling_stack, POLLING_CPLD_STACK_SIZE)
 
void ragular_cpld_polling_sem_handler (struct k_timer *timer)
 
 K_TIMER_DEFINE (ragular_cpld_polling_sem_timer, ragular_cpld_polling_sem_handler, NULL)
 
bool vr_error_callback (cpld_info *cpld_info, uint8_t *current_cpld_value)
 
void get_cpld_polling_power_info (int *reading)
 
void check_cpld_polling_alert_status (void)
 
void set_cpld_polling_enable_flag (bool status)
 
bool get_cpld_polling_enable_flag (void)
 
bool is_ubc_enabled_delayed_enabled (void)
 
void reset_error_log_states (uint8_t err_type)
 
void give_all_vr_pm_alert_sem ()
 
void poll_cpld_registers ()
 
bool set_cpld_bit (uint8_t cpld_offset, uint8_t bit, uint8_t value)
 
void init_cpld_polling (void)
 

Variables

struct k_thread cpld_polling_thread
 
k_tid_t cpld_polling_tid
 
cpld_info cpld_info_table []
 
int power_info = 0
 
bool cpld_polling_alert_status = false
 
bool cpld_polling_enable_flag = true
 
bool ubc_enabled_delayed_status = false
 

Macro Definition Documentation

◆ CHECK_ALL_BITS

#define CHECK_ALL_BITS   0xFF

◆ CHECK_BITS_6

#define CHECK_BITS_6   0x40

◆ CHECK_BITS_678

#define CHECK_BITS_678   0xE0

◆ CHECK_BITS_78

#define CHECK_BITS_78   0xC0

◆ CHECK_BITS_8

#define CHECK_BITS_8   0x80

◆ CPLD_POLLING_INTERVAL_MS

#define CPLD_POLLING_INTERVAL_MS   1000

◆ POLLING_CPLD_STACK_SIZE

#define POLLING_CPLD_STACK_SIZE   2048

Typedef Documentation

◆ vr_error_callback_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_polling_enable_flag()

bool get_cpld_polling_enable_flag ( void  )

◆ get_cpld_polling_power_info()

void get_cpld_polling_power_info ( int *  reading)

◆ get_ubc_delaytimer()

struct k_timer * get_ubc_delaytimer ( )

◆ give_all_vr_pm_alert_sem()

void give_all_vr_pm_alert_sem ( )

◆ 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() [1/2]

K_TIMER_DEFINE ( check_ubc_delayed_timer  ,
check_ubc_delayed_timer_handler  ,
NULL   
)

◆ K_TIMER_DEFINE() [2/2]

K_TIMER_DEFINE ( ragular_cpld_polling_sem_timer  ,
ragular_cpld_polling_sem_handler  ,
NULL   
)

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( check_ubc_delayed_work  ,
check_ubc_delayed   
)

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( check_cpld_work  ,
check_cpld_handler   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_cpld  )

◆ plat_read_cpld()

bool plat_read_cpld ( uint8_t  offset,
uint8_t *  data,
uint8_t  len 
)
Here is the call graph for this function:

◆ plat_write_cpld()

bool plat_write_cpld ( uint8_t  offset,
uint8_t *  data 
)
Here is the call graph for this function:

◆ poll_cpld_registers()

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

◆ ragular_cpld_polling_sem_handler()

void ragular_cpld_polling_sem_handler ( struct k_timer *  timer)

◆ reset_error_log_states()

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

◆ set_cpld_bit()

bool set_cpld_bit ( uint8_t  cpld_offset,
uint8_t  bit,
uint8_t  value 
)
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 ( cpld_info cpld_info,
uint8_t *  current_cpld_value 
)
Here is the call graph for this function:

Variable Documentation

◆ cpld_info_table

cpld_info cpld_info_table[]
Initial value:
= {
{ VR_POWER_FAULT_1_REG, 0x00, 0x00, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_2_REG, 0x00, 0x00, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_3_REG, 0x00, 0x00, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_4_REG, 0x00, 0x00, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_POWER_FAULT_5_REG, 0x00, 0x00, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ VR_SMBUS_ALERT_EVENT_LOG_REG, 0xFF, 0xFF, true, 0x00, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_ALL_BITS },
{ LEAK_DETECT_REG, 0xFF, 0xFF, true, 0x00, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BITS_6 },
{ HBM_CATTRIP_REG, 0xFF, 0xFF, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BITS_78 },
{ SYSTEM_ALERT_FAULT_REG, 0xFF, 0xFF, true, 0x00, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BITS_8 },
{ ASIC_TEMP_OVER_REG, 0xFF, 0xFF, true, 0x00, true, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BITS_8 },
{ TEMP_IC_OVER_FAULT_REG, 0xFF, 0xFF, true, 0x00, false, 0x00, .status_changed_cb = vr_error_callback, .bit_check_mask = CHECK_BITS_678 },
}
#define VR_POWER_FAULT_5_REG
Definition: plat_event.h:122
#define VR_POWER_FAULT_4_REG
Definition: plat_event.h:121
#define VR_POWER_FAULT_1_REG
Definition: plat_event.h:118
#define VR_POWER_FAULT_2_REG
Definition: plat_event.h:119
#define SYSTEM_ALERT_FAULT_REG
Definition: plat_event.h:145
#define VR_POWER_FAULT_3_REG
Definition: plat_event.h:120
#define CHECK_BITS_78
Definition: plat_cpld.c:37
#define CHECK_BITS_678
Definition: plat_cpld.c:38
#define CHECK_BITS_8
Definition: plat_cpld.c:36
#define CHECK_BITS_6
Definition: plat_cpld.c:39
bool vr_error_callback(cpld_info *cpld_info, uint8_t *current_cpld_value)
Definition: plat_cpld.c:163
#define CHECK_ALL_BITS
Definition: plat_cpld.c:35
#define VR_SMBUS_ALERT_EVENT_LOG_REG
Definition: plat_cpld.h:50
#define TEMP_IC_OVER_FAULT_REG
Definition: plat_log.h:40
#define HBM_CATTRIP_REG
Definition: plat_log.h:37
#define ASIC_TEMP_OVER_REG
Definition: plat_log.h:39
#define LEAK_DETECT_REG
Definition: plat_log.h:36

◆ 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

◆ power_info

int power_info = 0

◆ ubc_enabled_delayed_status

bool ubc_enabled_delayed_status = false