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 "sensor.h"
#include "cci.h"
#include "plat_ipmb.h"
#include "plat_power_seq.h"
#include "plat_pldm_sensor.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_BUS_CXL1   0x01
 
#define I2C_BUS_CXL2   0x03
 
#define I2C_ADDR_BIC   0x40
 
#define I2C_ADDR_CXL1   0x64
 
#define I2C_ADDR_CXL2   0x64
 
#define I3C_BUS_SD_BIC   0
 
#define I3C_ADDR_SD_BIC   0x8
 
#define MCTP_EID_BMC   0x08
 
#define MCTP_EID_SD_BIC   0
 
#define MCTP_EID_CXL1   0
 
#define MCTP_EID_CXL2   0
 
#define UNKNOWN_CXL_EID   0xFF
 

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)
 
int pal_get_medium_type (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)
 
int pal_get_cci_timeout_ms ()
 
bool pal_is_need_mctp_interval (mctp *mctp_inst)
 
int pal_get_mctp_interval_ms (mctp *mctp_inst)
 

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_CXL1

#define I2C_ADDR_CXL1   0x64

◆ I2C_ADDR_CXL2

#define I2C_ADDR_CXL2   0x64

◆ I2C_BUS_CXL1

#define I2C_BUS_CXL1   0x01

◆ I2C_BUS_CXL2

#define I2C_BUS_CXL2   0x03

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

#define MCTP_EID_CXL1   0

◆ MCTP_EID_CXL2

#define MCTP_EID_CXL2   0

◆ MCTP_EID_SD_BIC

#define MCTP_EID_SD_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

◆ UNKNOWN_CXL_EID

#define UNKNOWN_CXL_EID   0xFF

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  )

◆ pal_get_cci_timeout_ms()

int pal_get_cci_timeout_ms ( )

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

int pal_get_mctp_interval_ms ( mctp mctp_inst)

◆ pal_get_medium_type()

int pal_get_medium_type ( uint8_t  interface)

◆ pal_is_need_mctp_interval()

bool pal_is_need_mctp_interval ( mctp mctp_inst)

◆ 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)
Here is the call graph for this function:

◆ 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_SD_BIC, I3C_BUS_SD_BIC, I3C_ADDR_SD_BIC, .set_endpoint = false },
{ MCTP_EID_CXL1, I2C_BUS_CXL1, I2C_ADDR_CXL1, .set_endpoint = true },
{ MCTP_EID_CXL2, I2C_BUS_CXL2, I2C_ADDR_CXL2, .set_endpoint = true },
}
#define I3C_BUS_SD_BIC
Definition: plat_mctp.c:44
#define MCTP_EID_SD_BIC
Definition: plat_mctp.c:53
#define MCTP_EID_CXL1
Definition: plat_mctp.c:54
#define I2C_ADDR_CXL1
Definition: plat_mctp.c:40
#define I2C_BUS_CXL1
Definition: plat_mctp.c:35
#define I2C_BUS_CXL2
Definition: plat_mctp.c:36
#define I3C_ADDR_SD_BIC
Definition: plat_mctp.c:47
#define I2C_ADDR_CXL2
Definition: plat_mctp.c:41
#define MCTP_EID_BMC
Definition: plat_mctp.c:50
#define MCTP_EID_CXL2
Definition: plat_mctp.c:55