OpenBIC
OpenSource Bridge-IC
plat_mctp.c File Reference
#include "plat_mctp.h"
#include <zephyr.h>
#include <sys/printk.h>
#include <logging/log.h>
#include <logging/log_ctrl.h>
#include <stdlib.h>
#include <stdio.h>
#include "mctp.h"
#include "mctp_ctrl.h"
#include "pldm.h"
#include "ipmi.h"
#include "cci.h"
#include "sensor.h"
#include "plat_ipmb.h"
#include "hal_i2c.h"
Include dependency graph for plat_mctp.c:

Macros

#define MCTP_MSG_TYPE_SHIFT   0
 
#define MCTP_MSG_TYPE_MASK   0x7F
 
#define MCTP_IC_SHIFT   7
 
#define MCTP_IC_MASK   0x80
 
#define I2C_ADDR_BIC   0x40
 
#define I2C_ADDR_BMC   0x20
 
#define I2C_ADDR_CXL   0x64
 
#define I3C_ADDR_SD_BIC   0x8
 
#define I2C_BUS_BMC   0x02
 
#define I2C_BUS_CXL   0x07
 
#define I3C_BUS_SD_BIC   0
 
#define MCTP_EID_BMC   0x08
 
#define MCTP_EID_MB_BIC   0
 
#define MCTP_EID_CXL   0
 

Functions

 LOG_MODULE_REGISTER (plat_mctp)
 
 K_TIMER_DEFINE (send_cmd_timer, send_cmd_to_dev, NULL)
 
 K_WORK_DEFINE (send_cmd_work, send_cmd_to_dev_handler)
 
uint8_t get_mctp_info (uint8_t dest_endpoint, mctp **mctp_inst, mctp_ext_params *ext_params)
 
void send_cmd_to_dev_handler (struct k_work *work)
 
void send_cmd_to_dev (struct k_timer *timer)
 
bool mctp_add_sel_to_ipmi (common_addsel_msg_t *sel_msg)
 
int pal_get_medium_type (uint8_t interface)
 
int pal_get_target (uint8_t interface)
 
mctppal_get_mctp (uint8_t mctp_medium_type, uint8_t bus)
 
void plat_mctp_init (void)
 
uint8_t plat_get_mctp_port_count ()
 
mctp_portplat_get_mctp_port (uint8_t index)
 
void plat_update_mctp_routing_table (uint8_t eid)
 
int load_mctp_support_types (uint8_t *type_len, uint8_t *types)
 
uint8_t plat_get_eid ()
 
uint8_t plat_get_cxl_eid (uint8_t cxl_id)
 

Variables

uint8_t plat_eid = MCTP_DEFAULT_ENDPOINT
 
mctp_route_entry plat_mctp_route_tbl []
 
uint8_t MCTP_SUPPORTED_MESSAGES_TYPES []
 

Macro Definition Documentation

◆ I2C_ADDR_BIC

#define I2C_ADDR_BIC   0x40

◆ I2C_ADDR_BMC

#define I2C_ADDR_BMC   0x20

◆ I2C_ADDR_CXL

#define I2C_ADDR_CXL   0x64

◆ I2C_BUS_BMC

#define I2C_BUS_BMC   0x02

◆ I2C_BUS_CXL

#define I2C_BUS_CXL   0x07

◆ I3C_ADDR_SD_BIC

#define I3C_ADDR_SD_BIC   0x8

◆ I3C_BUS_SD_BIC

#define I3C_BUS_SD_BIC   0

◆ MCTP_EID_BMC

#define MCTP_EID_BMC   0x08

◆ MCTP_EID_CXL

#define MCTP_EID_CXL   0

◆ MCTP_EID_MB_BIC

#define MCTP_EID_MB_BIC   0

◆ MCTP_IC_MASK

#define MCTP_IC_MASK   0x80

◆ MCTP_IC_SHIFT

#define MCTP_IC_SHIFT   7

◆ MCTP_MSG_TYPE_MASK

#define MCTP_MSG_TYPE_MASK   0x7F

◆ MCTP_MSG_TYPE_SHIFT

#define MCTP_MSG_TYPE_SHIFT   0

Function Documentation

◆ get_mctp_info()

uint8_t get_mctp_info ( uint8_t  dest_endpoint,
mctp **  mctp_inst,
mctp_ext_params ext_params 
)
Here is the call graph for this function:

◆ K_TIMER_DEFINE()

K_TIMER_DEFINE ( send_cmd_timer  ,
send_cmd_to_dev  ,
NULL   
)

◆ K_WORK_DEFINE()

K_WORK_DEFINE ( send_cmd_work  ,
send_cmd_to_dev_handler   
)

◆ load_mctp_support_types()

int load_mctp_support_types ( uint8_t *  type_len,
uint8_t *  types 
)

◆ LOG_MODULE_REGISTER()

LOG_MODULE_REGISTER ( plat_mctp  )

◆ mctp_add_sel_to_ipmi()

bool mctp_add_sel_to_ipmi ( common_addsel_msg_t sel_msg)
Here is the call graph for this function:

◆ pal_get_mctp()

mctp * pal_get_mctp ( uint8_t  mctp_medium_type,
uint8_t  bus 
)
Here is the call graph for this function:

◆ pal_get_medium_type()

int pal_get_medium_type ( uint8_t  interface)

◆ pal_get_target()

int pal_get_target ( uint8_t  interface)

◆ plat_get_cxl_eid()

uint8_t plat_get_cxl_eid ( uint8_t  cxl_id)

◆ plat_get_eid()

uint8_t plat_get_eid ( )

◆ plat_get_mctp_port()

mctp_port * plat_get_mctp_port ( uint8_t  index)

◆ plat_get_mctp_port_count()

uint8_t plat_get_mctp_port_count ( )

◆ plat_mctp_init()

void plat_mctp_init ( void  )

BIC will not initialize mctp instance if CXL is not present

init mctp for bmc bus

Here is the call graph for this function:

◆ plat_update_mctp_routing_table()

void plat_update_mctp_routing_table ( uint8_t  eid)

◆ send_cmd_to_dev()

void send_cmd_to_dev ( struct k_timer *  timer)

◆ send_cmd_to_dev_handler()

void send_cmd_to_dev_handler ( struct k_work *  work)

Variable Documentation

◆ MCTP_SUPPORTED_MESSAGES_TYPES

uint8_t MCTP_SUPPORTED_MESSAGES_TYPES[]
Initial value:
= {
}
@ TYPE_PLDM
Definition: mctp_ctrl.h:89
@ TYPE_MCTP_CONTROL
Definition: mctp_ctrl.h:88

◆ plat_eid

uint8_t plat_eid = MCTP_DEFAULT_ENDPOINT

◆ plat_mctp_route_tbl

mctp_route_entry plat_mctp_route_tbl[]
Initial value:
= {
{ MCTP_EID_BMC, I3C_BUS_SD_BIC, I3C_ADDR_SD_BIC, .set_endpoint = false },
{ MCTP_EID_MB_BIC, I3C_BUS_SD_BIC, I3C_ADDR_SD_BIC, .set_endpoint = false },
{ MCTP_EID_CXL, I2C_BUS_CXL, I2C_ADDR_CXL, .set_endpoint = true },
}
#define I3C_BUS_SD_BIC
Definition: plat_mctp.c:43
#define MCTP_EID_CXL
Definition: plat_mctp.c:50
#define MCTP_EID_MB_BIC
Definition: plat_mctp.c:49
#define I3C_ADDR_SD_BIC
Definition: plat_mctp.c:37
#define I2C_BUS_CXL
Definition: plat_mctp.c:42
#define I2C_ADDR_CXL
Definition: plat_mctp.c:36
#define MCTP_EID_BMC
Definition: plat_mctp.c:46