OpenBIC
OpenSource Bridge-IC
plat_threshold.c File Reference
#include "sensor.h"
#include "plat_sensor_table.h"
#include "plat_isr.h"
#include "plat_gpio.h"
#include "plat_pwm.h"
#include "plat_hwmon.h"
#include "plat_led.h"
#include "plat_log.h"
#include <logging/log.h>
#include "plat_threshold.h"
#include "plat_fsc.h"
#include <hal_i2c.h>
#include <nct7363.h>
#include <plat_hook.h>
#include "libutil.h"
#include "plat_status.h"
#include "adm1272.h"
#include "plat_class.h"
Include dependency graph for plat_threshold.c:

Classes

struct  pump_threshold_mapping
 
struct  fb_sen_entry
 

Macros

#define THRESHOLD_POLL_STACK_SIZE   2048
 
#define FAN_PUMP_PWRGD_STACK_SIZE   2048
 
#define ENABLE_REDUNDANCY   1
 
#define DISABLE_REDUNDANCY   0
 
#define READ_ERROR   -1
 
#define FAN_BOARD_FAULT_PWM_OFFSET   0xA2
 
#define FAN_BOARD_FAULT_PWM_OFFSET_DVT   0x9E
 
#define FAN_BOARD_FAULT_PWM_DUTY_1   0x00
 
#define FAN_BOARD_FAULT_PWM_DUTY_50   0x7F
 
#define FAN_BOARD_FAULT_PWM_DUTY_100   0xFF
 
#define EVT_FAN_BOARD_FAULT_BIT_LOCATION   1
 
#define EVT_FAN_BOARD_PWRGD_BIT_LOCATION   0
 
#define DVT_FAN_BOARD_FAULT_BIT_LOCATION   7
 
#define DVT_FAN_BOARD_PWRGD_BIT_LOCATION   3
 
#define DVT_FAN_BOARD_FAULT_BLINK_ENABLE   0x0C
 
#define DVT_FAN_BOARD_FAULT_BLINK_DISABLE   0
 
#define EVT_PUMP_BOARD_FAULT_BIT_LOCATION   1
 
#define EVT_PUMP_BOARD_PWRGD_BIT_LOCATION   0
 
#define DVT_PUMP_BOARD_FAULT_BIT_LOCATION   3
 
#define DVT_PUMP_BOARD_PWRGD_BIT_LOCATION   7
 
#define THRESHOLD_ARG0_TABLE_INDEX   0xFFFFFFFF
 
#define HEX_FAN_NUM   14
 
#define SENSOR_NUM(type, index)   SENSOR_NUM_FB_##index##_##type
 
#define FB_SEN_ENTRY(index)
 
#define FB_REINIT_SEN_COUNT   3
 

Enumerations

enum  THRESHOLD_TYPE {
  THRESHOLD_DISABLE , THRESHOLD_ENABLE_LCR , THRESHOLD_ENABLE_UCR , THRESHOLD_ENABLE_BOTH ,
  THRESHOLD_ENABLE_DISCRETE
}
 

Functions

void pump_failure_do (uint32_t thres_tbl_idx, uint32_t status)
 
void abnormal_flow_do (uint32_t thres_tbl_idx, uint32_t status)
 
 K_KERNEL_STACK_MEMBER (threshold_poll_stack, THRESHOLD_POLL_STACK_SIZE)
 
 K_KERNEL_STACK_MEMBER (fan_pump_pwrgd_stack, FAN_PUMP_PWRGD_STACK_SIZE)
 
 LOG_MODULE_REGISTER (plat_threshold)
 
bool pump_fail_check ()
 
bool hex_fan_fail_check ()
 
bool hsc_communicate_check ()
 
bool system_failure_recovery ()
 
bool rpu_ready_recovery ()
 
void fan_board_tach_status_handler (uint8_t sensor_num, uint8_t status)
 
void hex_fan_failure_do (uint32_t sensor_num, uint32_t status)
 
 K_WORK_DELAYABLE_DEFINE (flow_rate_ready_worker, flow_rate_ready)
 
void pump_board_tach_status_handler (uint8_t sensor_num, uint8_t status)
 
void rpu_internal_fan_failure_do (uint32_t sensor_num, uint32_t status)
 
void abnormal_press_do (uint32_t unused, uint32_t status)
 
void abnormal_temp_do (uint32_t sensor_num, uint32_t status)
 
void level_sensor_do (uint32_t unused, uint32_t status)
 
void rpu_level_sensor_do (uint32_t unused, uint32_t status)
 
void sensor_log (uint32_t sensor_num, uint32_t status)
 
sensor_thresholdfind_threshold_tbl_entry (uint8_t sensor_num)
 
uint8_t fb_hsc_status (uint8_t idx)
 
void set_threshold_poll_enable_flag (bool flag)
 
bool get_threshold_poll_enable_flag ()
 
uint32_t get_threshold_status (uint8_t sensor_num)
 
void threshold_poll_init ()
 
void pump_change_threshold (uint8_t sensor_num, uint8_t duty)
 
void plat_sensor_poll_post ()
 
void fan_pump_pwrgd_handler (void *arug0, void *arug1, void *arug2)
 
void fan_pump_pwrgd ()
 

Variables

struct k_thread threshold_poll
 
struct k_thread fan_pump_pwrgd_thread
 
uint8_t fan_pump_sensor_array []
 
uint8_t fan_sensor_array []
 
uint8_t pump_sensor_array []
 
uint8_t hsc_communicate_sensor_array []
 
pump_threshold_mapping pump_threshold_tbl []
 
sensor_threshold threshold_tbl []
 
struct fb_sen_entry fb_sen_tbl []
 

Macro Definition Documentation

◆ DISABLE_REDUNDANCY

#define DISABLE_REDUNDANCY   0

◆ DVT_FAN_BOARD_FAULT_BIT_LOCATION

#define DVT_FAN_BOARD_FAULT_BIT_LOCATION   7

◆ DVT_FAN_BOARD_FAULT_BLINK_DISABLE

#define DVT_FAN_BOARD_FAULT_BLINK_DISABLE   0

◆ DVT_FAN_BOARD_FAULT_BLINK_ENABLE

#define DVT_FAN_BOARD_FAULT_BLINK_ENABLE   0x0C

◆ DVT_FAN_BOARD_PWRGD_BIT_LOCATION

#define DVT_FAN_BOARD_PWRGD_BIT_LOCATION   3

◆ DVT_PUMP_BOARD_FAULT_BIT_LOCATION

#define DVT_PUMP_BOARD_FAULT_BIT_LOCATION   3

◆ DVT_PUMP_BOARD_PWRGD_BIT_LOCATION

#define DVT_PUMP_BOARD_PWRGD_BIT_LOCATION   7

◆ ENABLE_REDUNDANCY

#define ENABLE_REDUNDANCY   1

◆ EVT_FAN_BOARD_FAULT_BIT_LOCATION

#define EVT_FAN_BOARD_FAULT_BIT_LOCATION   1

◆ EVT_FAN_BOARD_PWRGD_BIT_LOCATION

#define EVT_FAN_BOARD_PWRGD_BIT_LOCATION   0

◆ EVT_PUMP_BOARD_FAULT_BIT_LOCATION

#define EVT_PUMP_BOARD_FAULT_BIT_LOCATION   1

◆ EVT_PUMP_BOARD_PWRGD_BIT_LOCATION

#define EVT_PUMP_BOARD_PWRGD_BIT_LOCATION   0

◆ FAN_BOARD_FAULT_PWM_DUTY_1

#define FAN_BOARD_FAULT_PWM_DUTY_1   0x00

◆ FAN_BOARD_FAULT_PWM_DUTY_100

#define FAN_BOARD_FAULT_PWM_DUTY_100   0xFF

◆ FAN_BOARD_FAULT_PWM_DUTY_50

#define FAN_BOARD_FAULT_PWM_DUTY_50   0x7F

◆ FAN_BOARD_FAULT_PWM_OFFSET

#define FAN_BOARD_FAULT_PWM_OFFSET   0xA2

◆ FAN_BOARD_FAULT_PWM_OFFSET_DVT

#define FAN_BOARD_FAULT_PWM_OFFSET_DVT   0x9E

◆ FAN_PUMP_PWRGD_STACK_SIZE

#define FAN_PUMP_PWRGD_STACK_SIZE   2048

◆ FB_REINIT_SEN_COUNT

#define FB_REINIT_SEN_COUNT   3

◆ FB_SEN_ENTRY

#define FB_SEN_ENTRY (   index)
Value:
{ \
{ \
SENSOR_NUM(FAN_TACH_RPM, index), SENSOR_NUM(HSC_TEMP_C, index), \
SENSOR_NUM(HEX_OUTLET_TEMP_C, index) \
} \
}
#define SENSOR_NUM(type, index)
Definition: plat_threshold.c:842

◆ HEX_FAN_NUM

#define HEX_FAN_NUM   14

◆ READ_ERROR

#define READ_ERROR   -1

◆ SENSOR_NUM

#define SENSOR_NUM (   type,
  index 
)    SENSOR_NUM_FB_##index##_##type

◆ THRESHOLD_ARG0_TABLE_INDEX

#define THRESHOLD_ARG0_TABLE_INDEX   0xFFFFFFFF

◆ THRESHOLD_POLL_STACK_SIZE

#define THRESHOLD_POLL_STACK_SIZE   2048

Enumeration Type Documentation

◆ THRESHOLD_TYPE

Enumerator
THRESHOLD_DISABLE 
THRESHOLD_ENABLE_LCR 
THRESHOLD_ENABLE_UCR 
THRESHOLD_ENABLE_BOTH 
THRESHOLD_ENABLE_DISCRETE 

Function Documentation

◆ abnormal_flow_do()

void abnormal_flow_do ( uint32_t  thres_tbl_idx,
uint32_t  status 
)

◆ abnormal_press_do()

void abnormal_press_do ( uint32_t  unused,
uint32_t  status 
)
Here is the call graph for this function:

◆ abnormal_temp_do()

void abnormal_temp_do ( uint32_t  sensor_num,
uint32_t  status 
)
Here is the call graph for this function:

◆ fan_board_tach_status_handler()

void fan_board_tach_status_handler ( uint8_t  sensor_num,
uint8_t  status 
)
Here is the call graph for this function:

◆ fan_pump_pwrgd()

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

◆ fan_pump_pwrgd_handler()

void fan_pump_pwrgd_handler ( void *  arug0,
void *  arug1,
void *  arug2 
)
Here is the call graph for this function:

◆ fb_hsc_status()

uint8_t fb_hsc_status ( uint8_t  idx)
Here is the call graph for this function:

◆ find_threshold_tbl_entry()

sensor_threshold * find_threshold_tbl_entry ( uint8_t  sensor_num)

◆ get_threshold_poll_enable_flag()

bool get_threshold_poll_enable_flag ( )

◆ get_threshold_status()

uint32_t get_threshold_status ( uint8_t  sensor_num)

◆ hex_fan_fail_check()

bool hex_fan_fail_check ( )
Here is the call graph for this function:

◆ hex_fan_failure_do()

void hex_fan_failure_do ( uint32_t  sensor_num,
uint32_t  status 
)
Here is the call graph for this function:

◆ hsc_communicate_check()

bool hsc_communicate_check ( )
Here is the call graph for this function:

◆ K_KERNEL_STACK_MEMBER() [1/2]

K_KERNEL_STACK_MEMBER ( fan_pump_pwrgd_stack  ,
FAN_PUMP_PWRGD_STACK_SIZE   
)

◆ K_KERNEL_STACK_MEMBER() [2/2]

K_KERNEL_STACK_MEMBER ( threshold_poll_stack  ,
THRESHOLD_POLL_STACK_SIZE   
)

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( flow_rate_ready_worker  ,
flow_rate_ready   
)

◆ level_sensor_do()

void level_sensor_do ( uint32_t  unused,
uint32_t  status 
)
Here is the call graph for this function:

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_threshold  )

◆ plat_sensor_poll_post()

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

◆ pump_board_tach_status_handler()

void pump_board_tach_status_handler ( uint8_t  sensor_num,
uint8_t  status 
)
Here is the call graph for this function:

◆ pump_change_threshold()

void pump_change_threshold ( uint8_t  sensor_num,
uint8_t  duty 
)
Here is the call graph for this function:

◆ pump_fail_check()

bool pump_fail_check ( )
Here is the call graph for this function:

◆ pump_failure_do()

void pump_failure_do ( uint32_t  thres_tbl_idx,
uint32_t  status 
)
Here is the call graph for this function:

◆ rpu_internal_fan_failure_do()

void rpu_internal_fan_failure_do ( uint32_t  sensor_num,
uint32_t  status 
)
Here is the call graph for this function:

◆ rpu_level_sensor_do()

void rpu_level_sensor_do ( uint32_t  unused,
uint32_t  status 
)
Here is the call graph for this function:

◆ rpu_ready_recovery()

bool rpu_ready_recovery ( )
Here is the call graph for this function:

◆ sensor_log()

void sensor_log ( uint32_t  sensor_num,
uint32_t  status 
)
Here is the call graph for this function:

◆ set_threshold_poll_enable_flag()

void set_threshold_poll_enable_flag ( bool  flag)

◆ system_failure_recovery()

bool system_failure_recovery ( )
Here is the call graph for this function:

◆ threshold_poll_init()

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

Variable Documentation

◆ fan_pump_pwrgd_thread

struct k_thread fan_pump_pwrgd_thread

◆ fan_pump_sensor_array

uint8_t fan_pump_sensor_array[]
Initial value:
= {
}
#define SENSOR_NUM_PB_1_PUMP_TACH_RPM
Definition: plat_sensor_table.h:162
#define SENSOR_NUM_FB_10_FAN_TACH_RPM
Definition: plat_sensor_table.h:157
#define SENSOR_NUM_PB_3_PUMP_TACH_RPM
Definition: plat_sensor_table.h:168
#define SENSOR_NUM_FB_9_FAN_TACH_RPM
Definition: plat_sensor_table.h:156
#define SENSOR_NUM_FB_14_FAN_TACH_RPM
Definition: plat_sensor_table.h:161
#define SENSOR_NUM_FB_5_FAN_TACH_RPM
Definition: plat_sensor_table.h:152
#define SENSOR_NUM_PB_2_PUMP_TACH_RPM
Definition: plat_sensor_table.h:165
#define SENSOR_NUM_FB_12_FAN_TACH_RPM
Definition: plat_sensor_table.h:159
#define SENSOR_NUM_FB_3_FAN_TACH_RPM
Definition: plat_sensor_table.h:150
#define SENSOR_NUM_FB_11_FAN_TACH_RPM
Definition: plat_sensor_table.h:158
#define SENSOR_NUM_FB_13_FAN_TACH_RPM
Definition: plat_sensor_table.h:160
#define SENSOR_NUM_FB_6_FAN_TACH_RPM
Definition: plat_sensor_table.h:153
#define SENSOR_NUM_FB_1_FAN_TACH_RPM
Definition: plat_sensor_table.h:148
#define SENSOR_NUM_FB_4_FAN_TACH_RPM
Definition: plat_sensor_table.h:151
#define SENSOR_NUM_FB_2_FAN_TACH_RPM
Definition: plat_sensor_table.h:149
#define SENSOR_NUM_FB_8_FAN_TACH_RPM
Definition: plat_sensor_table.h:155
#define SENSOR_NUM_FB_7_FAN_TACH_RPM
Definition: plat_sensor_table.h:154

◆ fan_sensor_array

◆ fb_sen_tbl

struct fb_sen_entry fb_sen_tbl[]
Initial value:
#define FB_SEN_ENTRY(index)
Definition: plat_threshold.c:843

◆ hsc_communicate_sensor_array

uint8_t hsc_communicate_sensor_array[]
Initial value:
= {
}
#define SENSOR_NUM_PB_2_HSC_P48V_TEMP_C
Definition: plat_sensor_table.h:132
#define SENSOR_NUM_BB_HSC_P48V_TEMP_C
Definition: plat_sensor_table.h:140
#define SENSOR_NUM_PB_3_HSC_P48V_TEMP_C
Definition: plat_sensor_table.h:136
#define SENSOR_NUM_BPB_HSC_P48V_TEMP_C
Definition: plat_sensor_table.h:144
#define SENSOR_NUM_PB_1_HSC_P48V_TEMP_C
Definition: plat_sensor_table.h:128

◆ pump_sensor_array

◆ pump_threshold_tbl

pump_threshold_mapping pump_threshold_tbl[]
Initial value:
= {
{ 8, 0 }, { 10, 300 }, { 20, 1800 }, { 30, 3250 },
{ 40, 4450 }, { 50, 5450 }, { 60, 6050 }, { 70, 6450 },
}

◆ threshold_poll

struct k_thread threshold_poll

◆ threshold_tbl

sensor_threshold threshold_tbl[]