OpenBIC
OpenSource Bridge-IC
pldm_monitor.c File Reference
#include <logging/log.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <drivers/spi_nor.h>
#include <drivers/flash.h>
#include "sensor.h"
#include "plat_def.h"
#include "pldm.h"
#include "pdr.h"
#include "hal_gpio.h"
Include dependency graph for pldm_monitor.c:

Classes

struct  pldm_event_pkt
 
struct  pldm_event_receiver_info
 

Macros

#define PLDM_MONITOR_EVENT_QUEUE_MSG_NUM_MAX   PLDM_MONITOR_EVENT_QUEUE_MSG_NUM_MAX_DEFAULT
 

Functions

 LOG_MODULE_DECLARE (pldm)
 
 K_FIFO_DEFINE (send_event_pkt_fifo)
 
float pldm_sensor_cal (uint8_t *buf, uint8_t len, pldm_sensor_readings_data_type_t data_type, pldm_sensor_pdr_parm parm)
 
uint8_t pldm_get_sensor_reading (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
uint16_t pldm_platform_monitor_read (void *mctp_inst, mctp_ext_params ext_params, pldm_platform_monitor_commands_t cmd, uint8_t *req, uint16_t req_len, uint8_t *rbuf, uint16_t rbuf_len)
 
uint8_t pldm_platform_event_message_req (void *mctp_inst, mctp_ext_params ext_params, uint8_t event_class, const uint8_t *event_data, uint8_t event_data_length)
 
__weak void plat_send_event_pre_work ()
 
 K_WORK_DELAYABLE_DEFINE (send_event_pkt_work, process_event_message_queue)
 
uint8_t pldm_send_platform_event (uint8_t event_class, uint16_t id, uint8_t ext_class, const uint8_t *event_data, uint8_t event_data_length)
 
uint8_t pldm_set_event_receiver (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
uint8_t pldm_event_len_check (uint8_t *buf, uint16_t len)
 PLDM event length check function. More...
 
__weak uint8_t pldm_platform_event_message (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
void set_effecter_state_gpio_handler (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len, uint8_t gpio_pin)
 
void pldm_spi_reinit (const char *spi_dev_str, const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len)
 
__weak uint8_t plat_pldm_set_state_effecter_state_handler (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len, struct pldm_state_effecter_info *info_p)
 
__weak uint8_t plat_pldm_get_state_effecter_state_handler (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len, struct pldm_state_effecter_info *info_p)
 
uint8_t pldm_set_state_effecter_states (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
void get_effecter_state_gpio_handler (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len, uint8_t gpio_pin)
 
uint8_t pldm_get_state_effecter_states (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
uint8_t pldm_get_pdr_info (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
uint8_t pldm_get_pdr (void *mctp_inst, uint8_t *buf, uint16_t len, uint8_t instance_id, uint8_t *resp, uint16_t *resp_len, void *ext_params)
 
uint8_t pldm_monitor_handler_query (uint8_t code, void **ret_fn)
 
__weak void plat_pldm_set_effecter_state_host_power_control (const uint8_t *buf, uint16_t len, uint8_t *resp, uint16_t *resp_len)
 
void pldm_assign_gpio_effecter_id (int plat_effecter_id_gpio_high_byte)
 
void pldm_load_state_effecter_table (uint16_t state_effecter_index)
 
__weak void plat_pldm_load_state_effecter_table (void)
 
struct pldm_state_effecter_infofind_state_effecter_info (uint16_t effecter_id)
 
uint8_t pldm_fill_addsel_req (struct pldm_set_state_effecter_states_req *req, uint16_t effecter_id, uint8_t device_type, uint8_t board_info, uint8_t event_type)
 
uint8_t pldm_send_set_state_effecter_states_req (struct pldm_set_state_effecter_states_req *req, void *mctp_inst, mctp_ext_params ext_params)
 

Variables

struct pldm_state_effecter_infostate_effecter_table
 
uint16_t pldm_state_effecter_index = 0
 

Macro Definition Documentation

◆ PLDM_MONITOR_EVENT_QUEUE_MSG_NUM_MAX

#define PLDM_MONITOR_EVENT_QUEUE_MSG_NUM_MAX   PLDM_MONITOR_EVENT_QUEUE_MSG_NUM_MAX_DEFAULT

Function Documentation

◆ find_state_effecter_info()

struct pldm_state_effecter_info * find_state_effecter_info ( uint16_t  effecter_id)

◆ get_effecter_state_gpio_handler()

void get_effecter_state_gpio_handler ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len,
uint8_t  gpio_pin 
)
Here is the call graph for this function:

◆ K_FIFO_DEFINE()

K_FIFO_DEFINE ( send_event_pkt_fifo  )

◆ K_WORK_DELAYABLE_DEFINE()

K_WORK_DELAYABLE_DEFINE ( send_event_pkt_work  ,
process_event_message_queue   
)

◆ LOG_MODULE_DECLARE()

LOG_MODULE_DECLARE ( pldm  )

◆ plat_pldm_get_state_effecter_state_handler()

__weak uint8_t plat_pldm_get_state_effecter_state_handler ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len,
struct pldm_state_effecter_info info_p 
)

◆ plat_pldm_load_state_effecter_table()

__weak void plat_pldm_load_state_effecter_table ( void  )

◆ plat_pldm_set_effecter_state_host_power_control()

__weak void plat_pldm_set_effecter_state_host_power_control ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len 
)

◆ plat_pldm_set_state_effecter_state_handler()

__weak uint8_t plat_pldm_set_state_effecter_state_handler ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len,
struct pldm_state_effecter_info info_p 
)

◆ plat_send_event_pre_work()

__weak void plat_send_event_pre_work ( )

◆ pldm_assign_gpio_effecter_id()

void pldm_assign_gpio_effecter_id ( int  plat_effecter_id_gpio_high_byte)

◆ pldm_event_len_check()

uint8_t pldm_event_len_check ( uint8_t *  buf,
uint16_t  len 
)

PLDM event length check function.

Check given event data length meet with spec.

Parameters
bufmessage data start from event class type
lenLength of buf in bytes
Returns
PLDM_BASE return value

◆ pldm_fill_addsel_req()

uint8_t pldm_fill_addsel_req ( struct pldm_set_state_effecter_states_req req,
uint16_t  effecter_id,
uint8_t  device_type,
uint8_t  board_info,
uint8_t  event_type 
)

◆ pldm_get_pdr()

uint8_t pldm_get_pdr ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)
Here is the call graph for this function:

◆ pldm_get_pdr_info()

uint8_t pldm_get_pdr_info ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)
Here is the call graph for this function:

◆ pldm_get_sensor_reading()

uint8_t pldm_get_sensor_reading ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)
Here is the call graph for this function:

◆ pldm_get_state_effecter_states()

uint8_t pldm_get_state_effecter_states ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)
Here is the call graph for this function:

◆ pldm_load_state_effecter_table()

void pldm_load_state_effecter_table ( uint16_t  state_effecter_index)
Here is the call graph for this function:

◆ pldm_monitor_handler_query()

uint8_t pldm_monitor_handler_query ( uint8_t  code,
void **  ret_fn 
)

◆ pldm_platform_event_message()

__weak uint8_t pldm_platform_event_message ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)

◆ pldm_platform_event_message_req()

uint8_t pldm_platform_event_message_req ( void *  mctp_inst,
mctp_ext_params  ext_params,
uint8_t  event_class,
const uint8_t *  event_data,
uint8_t  event_data_length 
)
Here is the call graph for this function:

◆ pldm_platform_monitor_read()

uint16_t pldm_platform_monitor_read ( void *  mctp_inst,
mctp_ext_params  ext_params,
pldm_platform_monitor_commands_t  cmd,
uint8_t *  req,
uint16_t  req_len,
uint8_t *  rbuf,
uint16_t  rbuf_len 
)
Here is the call graph for this function:

◆ pldm_send_platform_event()

uint8_t pldm_send_platform_event ( uint8_t  event_class,
uint16_t  id,
uint8_t  ext_class,
const uint8_t *  event_data,
uint8_t  event_data_length 
)

◆ pldm_send_set_state_effecter_states_req()

uint8_t pldm_send_set_state_effecter_states_req ( struct pldm_set_state_effecter_states_req req,
void *  mctp_inst,
mctp_ext_params  ext_params 
)
Here is the call graph for this function:

◆ pldm_sensor_cal()

float pldm_sensor_cal ( uint8_t *  buf,
uint8_t  len,
pldm_sensor_readings_data_type_t  data_type,
pldm_sensor_pdr_parm  parm 
)
Here is the call graph for this function:

◆ pldm_set_event_receiver()

uint8_t pldm_set_event_receiver ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)

◆ pldm_set_state_effecter_states()

uint8_t pldm_set_state_effecter_states ( void *  mctp_inst,
uint8_t *  buf,
uint16_t  len,
uint8_t  instance_id,
uint8_t *  resp,
uint16_t *  resp_len,
void *  ext_params 
)
Here is the call graph for this function:

◆ pldm_spi_reinit()

void pldm_spi_reinit ( const char *  spi_dev_str,
const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len 
)

◆ set_effecter_state_gpio_handler()

void set_effecter_state_gpio_handler ( const uint8_t *  buf,
uint16_t  len,
uint8_t *  resp,
uint16_t *  resp_len,
uint8_t  gpio_pin 
)
Here is the call graph for this function:

Variable Documentation

◆ pldm_state_effecter_index

uint16_t pldm_state_effecter_index = 0

◆ state_effecter_table

struct pldm_state_effecter_info* state_effecter_table