OpenBIC
OpenSource Bridge-IC
plat_mctp.c File Reference
#include <zephyr.h>
#include <sys/printk.h>
#include <logging/log.h>
#include <logging/log_ctrl.h>
#include <stdlib.h>
#include "mctp.h"
#include "mctp_ctrl.h"
#include "pldm.h"
#include "ncsi.h"
#include "ipmi.h"
#include "sensor.h"
#include "plat_hook.h"
#include "plat_mctp.h"
#include "plat_gpio.h"
#include "plat_ncsi.h"
#include "plat_fru.h"
Include dependency graph for plat_mctp.c:

Macros

#define I2C_ADDR_BIC   0x40
 
#define I2C_ADDR_BMC   0x20
 
#define I2C_ADDR_NIC   0x64
 
#define I2C_BUS_BMC   0x06
 
#define I2C_BUS_NIC_0   0x00
 
#define I2C_BUS_NIC_1   0x01
 
#define I2C_BUS_NIC_2   0x02
 
#define I2C_BUS_NIC_3   0x03
 
#define I2C_BUS_NIC_4   0x0A
 
#define I2C_BUS_NIC_5   0x0B
 
#define I2C_BUS_NIC_6   0x0C
 
#define I2C_BUS_NIC_7   0x0D
 
#define MCTP_EID_BMC   0x08
 
#define MCTP_EID_NIC_0   0x10
 
#define MCTP_EID_NIC_1   0x11
 
#define MCTP_EID_NIC_2   0x12
 
#define MCTP_EID_NIC_3   0x13
 
#define MCTP_EID_NIC_4   0x14
 
#define MCTP_EID_NIC_5   0x15
 
#define MCTP_EID_NIC_6   0x16
 
#define MCTP_EID_NIC_7   0x17
 

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)
 
bool mctp_add_sel_to_ipmi (common_addsel_msg_t *sel_msg)
 
uint8_t mellanox_cx7_ncsi_get_link_type (void)
 
bool is_broadcom_thor2_nic_type ()
 
void check_nic_config_by_ncsi (void)
 
uint8_t get_nic_config (void)
 
void send_cmd_to_dev_handler (struct k_work *work)
 
void send_cmd_to_dev (struct k_timer *timer)
 
void plat_mctp_init (void)
 

Variables

mctp_route_entry mctp_route_tbl []
 
struct pldm_variable_field nic_vesion [8]
 

Macro Definition Documentation

◆ I2C_ADDR_BIC

#define I2C_ADDR_BIC   0x40

◆ I2C_ADDR_BMC

#define I2C_ADDR_BMC   0x20

◆ I2C_ADDR_NIC

#define I2C_ADDR_NIC   0x64

◆ I2C_BUS_BMC

#define I2C_BUS_BMC   0x06

◆ I2C_BUS_NIC_0

#define I2C_BUS_NIC_0   0x00

◆ I2C_BUS_NIC_1

#define I2C_BUS_NIC_1   0x01

◆ I2C_BUS_NIC_2

#define I2C_BUS_NIC_2   0x02

◆ I2C_BUS_NIC_3

#define I2C_BUS_NIC_3   0x03

◆ I2C_BUS_NIC_4

#define I2C_BUS_NIC_4   0x0A

◆ I2C_BUS_NIC_5

#define I2C_BUS_NIC_5   0x0B

◆ I2C_BUS_NIC_6

#define I2C_BUS_NIC_6   0x0C

◆ I2C_BUS_NIC_7

#define I2C_BUS_NIC_7   0x0D

◆ MCTP_EID_BMC

#define MCTP_EID_BMC   0x08

◆ MCTP_EID_NIC_0

#define MCTP_EID_NIC_0   0x10

◆ MCTP_EID_NIC_1

#define MCTP_EID_NIC_1   0x11

◆ MCTP_EID_NIC_2

#define MCTP_EID_NIC_2   0x12

◆ MCTP_EID_NIC_3

#define MCTP_EID_NIC_3   0x13

◆ MCTP_EID_NIC_4

#define MCTP_EID_NIC_4   0x14

◆ MCTP_EID_NIC_5

#define MCTP_EID_NIC_5   0x15

◆ MCTP_EID_NIC_6

#define MCTP_EID_NIC_6   0x16

◆ MCTP_EID_NIC_7

#define MCTP_EID_NIC_7   0x17

Function Documentation

◆ check_nic_config_by_ncsi()

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

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

◆ get_nic_config()

uint8_t get_nic_config ( void  )

◆ is_broadcom_thor2_nic_type()

bool is_broadcom_thor2_nic_type ( )
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   
)

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

◆ mellanox_cx7_ncsi_get_link_type()

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

◆ plat_mctp_init()

void plat_mctp_init ( void  )

BIC will not initialize mctp instance if CXL is not present

init mctp for bmc bus

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

mctp_route_entry mctp_route_tbl[]
Initial value:
= {
{ MCTP_EID_NIC_0, I2C_BUS_NIC_0, I2C_ADDR_NIC, PRSNT_NIC0_R_N },
{ MCTP_EID_NIC_1, I2C_BUS_NIC_1, I2C_ADDR_NIC, PRSNT_NIC1_R_N },
{ MCTP_EID_NIC_2, I2C_BUS_NIC_2, I2C_ADDR_NIC, PRSNT_NIC2_R_N },
{ MCTP_EID_NIC_3, I2C_BUS_NIC_3, I2C_ADDR_NIC, PRSNT_NIC3_R_N },
{ MCTP_EID_NIC_4, I2C_BUS_NIC_4, I2C_ADDR_NIC, PRSNT_NIC4_R_N },
{ MCTP_EID_NIC_5, I2C_BUS_NIC_5, I2C_ADDR_NIC, PRSNT_NIC5_R_N },
{ MCTP_EID_NIC_6, I2C_BUS_NIC_6, I2C_ADDR_NIC, PRSNT_NIC6_R_N },
{ MCTP_EID_NIC_7, I2C_BUS_NIC_7, I2C_ADDR_NIC, PRSNT_NIC7_R_N },
}
#define MCTP_EID_NIC_4
Definition: plat_mctp.c:63
#define I2C_BUS_NIC_5
Definition: plat_mctp.c:54
#define I2C_BUS_NIC_6
Definition: plat_mctp.c:55
#define I2C_BUS_NIC_2
Definition: plat_mctp.c:51
#define I2C_BUS_NIC_1
Definition: plat_mctp.c:50
#define MCTP_EID_NIC_5
Definition: plat_mctp.c:64
#define I2C_BUS_NIC_4
Definition: plat_mctp.c:53
#define MCTP_EID_NIC_7
Definition: plat_mctp.c:66
#define I2C_BUS_NIC_3
Definition: plat_mctp.c:52
#define MCTP_EID_NIC_3
Definition: plat_mctp.c:62
#define MCTP_EID_NIC_2
Definition: plat_mctp.c:61
#define MCTP_EID_NIC_6
Definition: plat_mctp.c:65
#define I2C_BUS_NIC_0
Definition: plat_mctp.c:49
#define MCTP_EID_NIC_0
Definition: plat_mctp.c:59
#define I2C_BUS_BMC
Definition: plat_mctp.c:48
#define MCTP_EID_NIC_1
Definition: plat_mctp.c:60
#define I2C_BUS_NIC_7
Definition: plat_mctp.c:56
#define I2C_ADDR_BMC
Definition: plat_mctp.c:44
#define I2C_ADDR_NIC
Definition: plat_mctp.c:45
#define MCTP_EID_BMC
Definition: plat_mctp.c:58

◆ nic_vesion

struct pldm_variable_field nic_vesion[8]