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 "plat_kernel_obj.h"
#include "plat_led.h"
#include <logging/log.h>
Include dependency graph for plat_cpld.c:

Classes

struct  _vr_error_callback_info_
 

Macros

#define CPLD_ADDR   (0x4C >> 1)
 
#define I2C_BUS_CPLD   I2C_BUS11
 
#define POLLING_CPLD_STACK_SIZE   2048
 
#define CHECK_ALL_BITS   0xFF
 
#define CHECK_BITS_6   0x40
 
#define CHECK_BITS_678   0xE0
 
#define CHECK_BITS_78   0xC0
 
#define CHECK_BITS_8   0x80
 

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)
 
bool set_cpld_bit (uint8_t cpld_offset, uint8_t bit, uint8_t value)
 
void check_cpld_handler ()
 
 K_WORK_DELAYABLE_DEFINE (check_cpld_work, check_cpld_handler)
 
 K_THREAD_STACK_DEFINE (cpld_polling_stack, POLLING_CPLD_STACK_SIZE)
 
bool vr_error_callback (cpld_info *cpld_info, uint8_t *current_cpld_value)
 
void set_cpld_polling_enable_flag (bool status)
 
bool get_cpld_polling_enable_flag (void)
 
void reset_error_log_states (uint8_t err_type)
 
void get_cpld_polling_power_info (int *reading)
 
void plat_get_pdb1_pwr_from_bmc (void)
 
void plat_poll_cpld_info_table (void)
 
void plat_poll_cpld_registers ()
 
void init_cpld_polling (void)
 

Variables

struct k_thread cpld_polling_thread
 
k_tid_t cpld_polling_tid
 
cpld_info cpld_info_table []
 
bool cpld_polling_enable_flag = true
 
uint16_t power_info = 0
 

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_ADDR

#define CPLD_ADDR   (0x4C >> 1)

◆ I2C_BUS_CPLD

#define I2C_BUS_CPLD   I2C_BUS11

◆ 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:

◆ 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)

◆ init_cpld_polling()

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

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( cpld_polling_stack  ,
POLLING_CPLD_STACK_SIZE   
)

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( check_cpld_work  ,
check_cpld_handler   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_cpld  )

◆ plat_get_pdb1_pwr_from_bmc()

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

◆ plat_poll_cpld_info_table()

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

◆ plat_poll_cpld_registers()

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

◆ 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:

◆ 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:21
#define CHECK_BITS_678
Definition: plat_cpld.c:20
#define CHECK_BITS_8
Definition: plat_cpld.c:22
#define CHECK_BITS_6
Definition: plat_cpld.c:19
bool vr_error_callback(cpld_info *cpld_info, uint8_t *current_cpld_value)
Definition: plat_cpld.c:148
#define CHECK_ALL_BITS
Definition: plat_cpld.c:18
#define TEMP_IC_OVER_FAULT_REG
Definition: plat_cpld.h:22
#define HBM_CATTRIP_REG
Definition: plat_cpld.h:19
#define ASIC_TEMP_OVER_REG
Definition: plat_cpld.h:21
#define VR_SMBUS_ALERT_EVENT_LOG_REG
Definition: plat_cpld.h:18
#define LEAK_DETECT_REG
Definition: plat_cpld.h:17

◆ 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

uint16_t power_info = 0