OpenBIC
OpenSource Bridge-IC
plat_dev.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "sensor.h"
#include "pmbus.h"
#include "libutil.h"
#include "hal_i2c.h"
#include "plat_dev.h"
#include "util_pmbus.h"
#include "plat_isr.h"
#include "plat_fru.h"
#include "ioexp_tca9555.h"
#include "common_i2c_mux.h"
#include "plat_sensor_table.h"
#include <logging/log.h>
#include "plat_def.h"
#include "pm8702.h"
#include "cci.h"
#include "plat_mctp.h"
#include "plat_hook.h"
#include "plat_class.h"
#include "hal_gpio.h"
#include "plat_gpio.h"
#include "power_status.h"
#include "plat_pldm_monitor.h"
#include "pldm_state_set.h"
Include dependency graph for plat_dev.c:

Macros

#define CXL_IOEXP_CONFIG_REG_DEFAULT_VAL   0xFF
 
#define CXL_IOEXP_U14_OUTPUT_0_REG_VAL   0xFF
 
#define CXL_IOEXP_U14_OUTPUT_1_REG_VAL   0xFF
 
#define CXL_IOEXP_U14_CONFIG_0_REG_VAL   0xFF
 
#define CXL_IOEXP_U14_CONFIG_1_REG_VAL   0xFF
 
#define CXL_IOEXP_U15_OUTPUT_0_REG_VAL   0x3B
 
#define CXL_IOEXP_U15_OUTPUT_1_REG_VAL   0xFF
 
#define CXL_IOEXP_U15_CONFIG_0_REG_VAL   0x21
 
#define CXL_IOEXP_U15_CONFIG_1_REG_VAL   0xFE
 
#define CXL_IOEXP_U16_OUTPUT_0_REG_VAL   0xFF
 
#define CXL_IOEXP_U16_OUTPUT_1_REG_VAL   0xFF
 
#define CXL_IOEXP_U16_CONFIG_0_REG_VAL   0x00
 
#define CXL_IOEXP_U16_CONFIG_1_REG_VAL   0x00
 
#define CXL_IOEXP_U17_OUTPUT_0_REG_VAL   0xFF
 
#define CXL_IOEXP_U17_OUTPUT_1_REG_VAL   0xFF
 
#define CXL_IOEXP_U17_CONFIG_0_REG_VAL   0xFF
 
#define CXL_IOEXP_U17_CONFIG_1_REG_VAL   0xFF
 
#define PM8702_DEFAULT_SENSOR_NUM   SENSOR_NUM_TEMP_CXL_DIMMA
 
#define CXL_CARD_VR_COUNT   3
 
#define MONITOR_SSD_POWER_FAULT_STACK_SIZE   1536
 
#define MONITOR_SSD_POWER_FAULT_DELAY_MS   2000
 

Functions

 LOG_MODULE_REGISTER (plat_dev)
 
 K_THREAD_STACK_DEFINE (monitor_ssd_power_fault_thread, MONITOR_SSD_POWER_FAULT_STACK_SIZE)
 
void clear_ssd_power_fault_flag ()
 
void clear_cxl_card_cache_value (uint8_t cxl_id)
 
void cxl_mb_status_init (uint8_t cxl_id)
 
bool cxl_single_ioexp_alert_reset (uint8_t ioexp_name, bool is_mutex)
 
bool cxl_single_ioexp_config_init (uint8_t ioexp_name)
 
int cxl_ioexp_init (uint8_t cxl_channel)
 
void init_cxl_card_ioexp (uint8_t cxl_id)
 
uint8_t pal_pm8702_read (uint8_t card_id, sensor_cfg *cfg, int *reading)
 
bool pal_init_pm8702_info (uint8_t cxl_id)
 
bool pal_get_pm8702_hbo_status (uint8_t cxl_id, uint8_t *resp_buf, uint8_t *resp_len)
 
bool pal_pm8702_transfer_fw (uint8_t cxl_id, uint8_t *req_buf, int req_len)
 
bool pal_set_pm8702_active_slot (uint8_t cxl_id, uint8_t *req_buf, int req_len)
 
bool pal_pm8702_command_handler (uint8_t cxl_id, uint16_t opcode, uint8_t *data_buf, int data_len, uint8_t *response, uint8_t *response_len)
 
void monitor_ssd_power_fault ()
 
void init_ssd_power_fault_thread ()
 
void abort_ssd_power_fault_thread ()
 
void init_ssd_power_fault_work ()
 

Variables

struct k_thread ssd_power_fault_thread_handler
 
k_tid_t ssd_power_fault_tid
 
pm8702_dev_info pm8702_table []
 
cxl_vr_fw_info cxl_vr_info_table []
 

Macro Definition Documentation

◆ CXL_CARD_VR_COUNT

#define CXL_CARD_VR_COUNT   3

◆ CXL_IOEXP_CONFIG_REG_DEFAULT_VAL

#define CXL_IOEXP_CONFIG_REG_DEFAULT_VAL   0xFF

◆ CXL_IOEXP_U14_CONFIG_0_REG_VAL

#define CXL_IOEXP_U14_CONFIG_0_REG_VAL   0xFF

◆ CXL_IOEXP_U14_CONFIG_1_REG_VAL

#define CXL_IOEXP_U14_CONFIG_1_REG_VAL   0xFF

◆ CXL_IOEXP_U14_OUTPUT_0_REG_VAL

#define CXL_IOEXP_U14_OUTPUT_0_REG_VAL   0xFF

◆ CXL_IOEXP_U14_OUTPUT_1_REG_VAL

#define CXL_IOEXP_U14_OUTPUT_1_REG_VAL   0xFF

◆ CXL_IOEXP_U15_CONFIG_0_REG_VAL

#define CXL_IOEXP_U15_CONFIG_0_REG_VAL   0x21

◆ CXL_IOEXP_U15_CONFIG_1_REG_VAL

#define CXL_IOEXP_U15_CONFIG_1_REG_VAL   0xFE

◆ CXL_IOEXP_U15_OUTPUT_0_REG_VAL

#define CXL_IOEXP_U15_OUTPUT_0_REG_VAL   0x3B

◆ CXL_IOEXP_U15_OUTPUT_1_REG_VAL

#define CXL_IOEXP_U15_OUTPUT_1_REG_VAL   0xFF

◆ CXL_IOEXP_U16_CONFIG_0_REG_VAL

#define CXL_IOEXP_U16_CONFIG_0_REG_VAL   0x00

◆ CXL_IOEXP_U16_CONFIG_1_REG_VAL

#define CXL_IOEXP_U16_CONFIG_1_REG_VAL   0x00

◆ CXL_IOEXP_U16_OUTPUT_0_REG_VAL

#define CXL_IOEXP_U16_OUTPUT_0_REG_VAL   0xFF

◆ CXL_IOEXP_U16_OUTPUT_1_REG_VAL

#define CXL_IOEXP_U16_OUTPUT_1_REG_VAL   0xFF

◆ CXL_IOEXP_U17_CONFIG_0_REG_VAL

#define CXL_IOEXP_U17_CONFIG_0_REG_VAL   0xFF

◆ CXL_IOEXP_U17_CONFIG_1_REG_VAL

#define CXL_IOEXP_U17_CONFIG_1_REG_VAL   0xFF

◆ CXL_IOEXP_U17_OUTPUT_0_REG_VAL

#define CXL_IOEXP_U17_OUTPUT_0_REG_VAL   0xFF

◆ CXL_IOEXP_U17_OUTPUT_1_REG_VAL

#define CXL_IOEXP_U17_OUTPUT_1_REG_VAL   0xFF

◆ MONITOR_SSD_POWER_FAULT_DELAY_MS

#define MONITOR_SSD_POWER_FAULT_DELAY_MS   2000

◆ MONITOR_SSD_POWER_FAULT_STACK_SIZE

#define MONITOR_SSD_POWER_FAULT_STACK_SIZE   1536

◆ PM8702_DEFAULT_SENSOR_NUM

#define PM8702_DEFAULT_SENSOR_NUM   SENSOR_NUM_TEMP_CXL_DIMMA

Function Documentation

◆ abort_ssd_power_fault_thread()

void abort_ssd_power_fault_thread ( )

◆ clear_cxl_card_cache_value()

void clear_cxl_card_cache_value ( uint8_t  cxl_id)

◆ clear_ssd_power_fault_flag()

void clear_ssd_power_fault_flag ( )

◆ cxl_ioexp_init()

int cxl_ioexp_init ( uint8_t  cxl_channel)

MEB mux for cxl channels

CXL mux for sensor channels

Mutex lock bus

Enable mux channel

ALL ioexp config register initial

ALL ioexp initial

mutex unlock bus

Here is the call graph for this function:

◆ cxl_mb_status_init()

void cxl_mb_status_init ( uint8_t  cxl_id)

Initial mb reset pin status by checking the IO expander on CXL module

MEB mux for cxl channels

CXL mux for sensor channels

Mutex lock bus

Enable mux channel

Read cxl U15 ioexp input port0 status

CXL mux for cxl channels

Here is the call graph for this function:

◆ cxl_single_ioexp_alert_reset()

bool cxl_single_ioexp_alert_reset ( uint8_t  ioexp_name,
bool  is_mutex 
)

Read cxl ioexp input port 0 status

Read cxl ioexp input port 1 status

Here is the call graph for this function:

◆ cxl_single_ioexp_config_init()

bool cxl_single_ioexp_config_init ( uint8_t  ioexp_name)

Write cxl ioexp output 0 register

Write cxl ioexp output 1 register

Write cxl ioexp config 0 register

Write cxl ioexp config 1 register

Here is the call graph for this function:

◆ init_cxl_card_ioexp()

void init_cxl_card_ioexp ( uint8_t  cxl_id)
Here is the call graph for this function:

◆ init_ssd_power_fault_thread()

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

◆ init_ssd_power_fault_work()

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

◆ K_THREAD_STACK_DEFINE()

K_THREAD_STACK_DEFINE ( monitor_ssd_power_fault_thread  ,
MONITOR_SSD_POWER_FAULT_STACK_SIZE   
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_dev  )

◆ monitor_ssd_power_fault()

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

◆ pal_get_pm8702_hbo_status()

bool pal_get_pm8702_hbo_status ( uint8_t  cxl_id,
uint8_t *  resp_buf,
uint8_t *  resp_len 
)
Here is the call graph for this function:

◆ pal_init_pm8702_info()

bool pal_init_pm8702_info ( uint8_t  cxl_id)
Here is the call graph for this function:

◆ pal_pm8702_command_handler()

bool pal_pm8702_command_handler ( uint8_t  cxl_id,
uint16_t  opcode,
uint8_t *  data_buf,
int  data_len,
uint8_t *  response,
uint8_t *  response_len 
)
Here is the call graph for this function:

◆ pal_pm8702_read()

uint8_t pal_pm8702_read ( uint8_t  card_id,
sensor_cfg cfg,
int *  reading 
)
Here is the call graph for this function:

◆ pal_pm8702_transfer_fw()

bool pal_pm8702_transfer_fw ( uint8_t  cxl_id,
uint8_t *  req_buf,
int  req_len 
)
Here is the call graph for this function:

◆ pal_set_pm8702_active_slot()

bool pal_set_pm8702_active_slot ( uint8_t  cxl_id,
uint8_t *  req_buf,
int  req_len 
)
Here is the call graph for this function:

Variable Documentation

◆ cxl_vr_info_table

cxl_vr_fw_info cxl_vr_info_table[]
Initial value:
= {
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
}

◆ pm8702_table

pm8702_dev_info pm8702_table[]
Initial value:
= {
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
{ .is_init = false }, { .is_init = false }, { .is_init = false }, { .is_init = false },
}

◆ ssd_power_fault_thread_handler

struct k_thread ssd_power_fault_thread_handler

◆ ssd_power_fault_tid

k_tid_t ssd_power_fault_tid