OpenBIC
OpenSource Bridge-IC
mctp.h File Reference
#include <stdint.h>
#include <sys/printk.h>
#include <zephyr.h>
Include dependency graph for mctp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _mctp_i3c_ext_params
 
struct  _mctp_smbus_ext_params
 
struct  _mctp_ext_params
 
struct  _mctp_i3c_conf
 
struct  _mctp_smbus_conf
 
union  mctp_medium_conf
 
struct  _mctp
 
struct  _mctp_smbus_port
 
struct  _mctp_route_entry
 
struct  _mctp_msg_handler
 

Macros

#define MCTP_DEBUG   1
 
#define MCTP_SUCCESS   0
 
#define MCTP_ERROR   1
 
#define MCTP_RESPONSE   0
 
#define MCTP_REQUEST   1
 
#define MCTP_TX_QUEUE_SIZE   16
 
#define MSG_ASSEMBLY_BUF_SIZE   1024
 
#define MCTP_RX_TASK_STACK_SIZE   4096
 
#define MCTP_TX_TASK_STACK_SIZE   2048
 
#define MCTP_TASK_NAME_LEN   32
 
#define MCTP_DEFAULT_ENDPOINT   0x0A
 
#define MCTP_NULL_EID   0x00
 
#define MCTP_DEFAULT_MSG_MAX_SIZE   64
 
#define MCTP_TRANSPORT_HEADER_SIZE   4
 
#define MCTP_MEDIUM_META_SIZE_SMBUS   3
 
#define MCTP_PEC_SIZE   1 /* SMBUS/I3C */
 
#define MCTP_META_INFO_SIZE   (MCTP_TRANSPORT_HEADER_SIZE + MCTP_PEC_SIZE)
 
#define MCTP_MAX_MSG_TAG_NUM   8
 
#define MCTP_HDR_HDR_VER   0x01
 
#define MCTP_HDR_SEQ_MASK   0x03
 
#define MCTP_HDR_TAG_MASK   0x07
 
#define MCTP_POLL_TIME_MS   1
 
#define MCTP_MSG_TYPE_SHIFT   0
 
#define MCTP_MSG_TYPE_MASK   0x7F
 
#define MCTP_IC_SHIFT   7
 
#define MCTP_IC_MASK   0x80
 

Typedefs

typedef struct _mctp_i3c_ext_params mctp_i3c_ext_params
 
typedef struct _mctp_smbus_ext_params mctp_smbus_ext_params
 
typedef struct _mctp_ext_params mctp_ext_params
 
typedef uint8_t(* mctp_fn_cb) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)
 
typedef uint16_t(* medium_tx) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)
 
typedef uint16_t(* medium_rx) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params *ext_params)
 
typedef uint8_t(* endpoint_resolve) (uint8_t dest_endpoint, void **mctp_inst, mctp_ext_params *ext_params)
 
typedef struct _mctp_i3c_conf mctp_i3c_conf
 
typedef struct _mctp_smbus_conf mctp_smbus_conf
 
typedef struct _mctp mctp
 
typedef struct _mctp_smbus_port mctp_port
 
typedef struct _mctp_route_entry mctp_route_entry
 
typedef struct _mctp_msg_handler mctp_msg_handler
 

Enumerations

enum  MCTP_MSG_TYPE {
  MCTP_MSG_TYPE_CTRL = 0x00 , MCTP_MSG_TYPE_PLDM , MCTP_MSG_TYPE_NCSI , MCTP_MSG_TYPE_ETH ,
  MCTP_MSG_TYPE_NVME , MCTP_MSG_TYPE_CCI = 0x08 , MCTP_MSG_TYPE_VEN_DEF_PCI = 0x7E , MCTP_MSG_TYPE_VEN_DEF_IANA = 0x7F
}
 
enum  MCTP_MEDIUM_TYPE {
  MCTP_MEDIUM_TYPE_UNKNOWN = 0 , MCTP_MEDIUM_TYPE_SMBUS , MCTP_MEDIUM_TYPE_CONTROLLER_I3C , MCTP_MEDIUM_TYPE_TARGET_I3C ,
  MCTP_MEDIUM_TYPE_MAX
}
 

Functions

struct __attribute__ ((aligned(4)))
 
uint8_t plat_get_mctp_port_count ()
 
mctp_portplat_get_mctp_port (uint8_t index)
 
mctpmctp_init (void)
 
uint8_t mctp_deinit (mctp *mctp_inst)
 
uint8_t mctp_set_medium_configure (mctp *mctp_inst, MCTP_MEDIUM_TYPE medium_type, mctp_medium_conf medium_conf)
 
uint8_t mctp_get_medium_configure (mctp *mctp_inst, MCTP_MEDIUM_TYPE *medium_type, mctp_medium_conf *medium_conf)
 
uint8_t mctp_start (mctp *mctp_inst)
 
uint8_t mctp_stop (mctp *mctp_inst)
 
uint8_t mctp_send_msg (mctp *mctp_inst, uint8_t *buf, uint16_t len, mctp_ext_params ext_params)
 
uint8_t mctp_bridge_msg (mctp *mctp_inst, uint8_t *buf, uint16_t len, mctp_ext_params ext_params)
 
uint8_t mctp_smbus_init (mctp *mctp_inst, mctp_medium_conf medium_conf)
 
uint8_t mctp_smbus_deinit (mctp *mctp_inst)
 
uint8_t mctp_i3c_controller_init (mctp *mctp_instance, mctp_medium_conf medium_conf)
 
uint8_t mctp_i3c_target_init (mctp *mctp_instance, mctp_medium_conf medium_conf)
 
uint8_t mctp_i3c_deinit (mctp *mctp_instance)
 
uint8_t mctp_reg_endpoint_resolve_func (mctp *mctp_inst, endpoint_resolve resolve_fn)
 
bool get_mctp_info_by_eid (uint8_t port, mctp **mctp_inst, mctp_ext_params *ext_params)
 
uint8_t get_mctp_info (uint8_t dest_endpoint, mctp **mctp_inst, mctp_ext_params *ext_params)
 
uint8_t mctp_reg_msg_rx_func (mctp *mctp_inst, mctp_fn_cb rx_cb)
 
mctppal_get_mctp (uint8_t mctp_medium_type, uint8_t bus)
 
int pal_get_target (uint8_t interface)
 
int pal_get_medium_type (uint8_t interface)
 
uint8_t plat_get_eid ()
 
int pal_find_bus_in_mctp_port (mctp_port *p)
 
mctppal_find_mctp_by_bus (uint8_t bus)
 
mctp_portpal_find_mctp_port_by_channel_target (uint8_t target)
 
bool pal_is_need_mctp_interval (mctp *mctp_inst)
 
int pal_get_mctp_interval_ms (mctp *mctp_inst)
 

Variables

 mctp_tx_msg
 

Macro Definition Documentation

◆ MCTP_DEBUG

#define MCTP_DEBUG   1

◆ MCTP_DEFAULT_ENDPOINT

#define MCTP_DEFAULT_ENDPOINT   0x0A

◆ MCTP_DEFAULT_MSG_MAX_SIZE

#define MCTP_DEFAULT_MSG_MAX_SIZE   64

◆ MCTP_ERROR

#define MCTP_ERROR   1

◆ MCTP_HDR_HDR_VER

#define MCTP_HDR_HDR_VER   0x01

◆ MCTP_HDR_SEQ_MASK

#define MCTP_HDR_SEQ_MASK   0x03

◆ MCTP_HDR_TAG_MASK

#define MCTP_HDR_TAG_MASK   0x07

◆ MCTP_IC_MASK

#define MCTP_IC_MASK   0x80

◆ MCTP_IC_SHIFT

#define MCTP_IC_SHIFT   7

◆ MCTP_MAX_MSG_TAG_NUM

#define MCTP_MAX_MSG_TAG_NUM   8

◆ MCTP_MEDIUM_META_SIZE_SMBUS

#define MCTP_MEDIUM_META_SIZE_SMBUS   3

◆ MCTP_META_INFO_SIZE

#define MCTP_META_INFO_SIZE   (MCTP_TRANSPORT_HEADER_SIZE + MCTP_PEC_SIZE)

◆ MCTP_MSG_TYPE_MASK

#define MCTP_MSG_TYPE_MASK   0x7F

◆ MCTP_MSG_TYPE_SHIFT

#define MCTP_MSG_TYPE_SHIFT   0

◆ MCTP_NULL_EID

#define MCTP_NULL_EID   0x00

◆ MCTP_PEC_SIZE

#define MCTP_PEC_SIZE   1 /* SMBUS/I3C */

◆ MCTP_POLL_TIME_MS

#define MCTP_POLL_TIME_MS   1

◆ MCTP_REQUEST

#define MCTP_REQUEST   1

◆ MCTP_RESPONSE

#define MCTP_RESPONSE   0

◆ MCTP_RX_TASK_STACK_SIZE

#define MCTP_RX_TASK_STACK_SIZE   4096

◆ MCTP_SUCCESS

#define MCTP_SUCCESS   0

◆ MCTP_TASK_NAME_LEN

#define MCTP_TASK_NAME_LEN   32

◆ MCTP_TRANSPORT_HEADER_SIZE

#define MCTP_TRANSPORT_HEADER_SIZE   4

◆ MCTP_TX_QUEUE_SIZE

#define MCTP_TX_QUEUE_SIZE   16

◆ MCTP_TX_TASK_STACK_SIZE

#define MCTP_TX_TASK_STACK_SIZE   2048

◆ MSG_ASSEMBLY_BUF_SIZE

#define MSG_ASSEMBLY_BUF_SIZE   1024

Typedef Documentation

◆ endpoint_resolve

typedef uint8_t(* endpoint_resolve) (uint8_t dest_endpoint, void **mctp_inst, mctp_ext_params *ext_params)

◆ mctp

typedef struct _mctp mctp

◆ mctp_ext_params

◆ mctp_fn_cb

typedef uint8_t(* mctp_fn_cb) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)

◆ mctp_i3c_conf

typedef struct _mctp_i3c_conf mctp_i3c_conf

◆ mctp_i3c_ext_params

◆ mctp_msg_handler

◆ mctp_port

typedef struct _mctp_smbus_port mctp_port

◆ mctp_route_entry

◆ mctp_smbus_conf

◆ mctp_smbus_ext_params

◆ medium_rx

typedef uint16_t(* medium_rx) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params *ext_params)

◆ medium_tx

typedef uint16_t(* medium_tx) (void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)

Enumeration Type Documentation

◆ MCTP_MEDIUM_TYPE

Enumerator
MCTP_MEDIUM_TYPE_UNKNOWN 
MCTP_MEDIUM_TYPE_SMBUS 
MCTP_MEDIUM_TYPE_CONTROLLER_I3C 
MCTP_MEDIUM_TYPE_TARGET_I3C 
MCTP_MEDIUM_TYPE_MAX 

◆ MCTP_MSG_TYPE

Enumerator
MCTP_MSG_TYPE_CTRL 
MCTP_MSG_TYPE_PLDM 
MCTP_MSG_TYPE_NCSI 
MCTP_MSG_TYPE_ETH 
MCTP_MSG_TYPE_NVME 
MCTP_MSG_TYPE_CCI 
MCTP_MSG_TYPE_VEN_DEF_PCI 
MCTP_MSG_TYPE_VEN_DEF_IANA 

Function Documentation

◆ __attribute__()

struct __attribute__ ( (aligned(4))  )

◆ get_mctp_info()

uint8_t get_mctp_info ( uint8_t  dest_endpoint,
mctp **  mctp_inst,
mctp_ext_params ext_params 
)

◆ get_mctp_info_by_eid()

bool get_mctp_info_by_eid ( uint8_t  port,
mctp **  mctp_inst,
mctp_ext_params ext_params 
)
Here is the call graph for this function:

◆ mctp_bridge_msg()

uint8_t mctp_bridge_msg ( mctp mctp_inst,
uint8_t *  buf,
uint16_t  len,
mctp_ext_params  ext_params 
)

◆ mctp_deinit()

uint8_t mctp_deinit ( mctp mctp_inst)
Here is the call graph for this function:

◆ mctp_get_medium_configure()

uint8_t mctp_get_medium_configure ( mctp mctp_inst,
MCTP_MEDIUM_TYPE medium_type,
mctp_medium_conf medium_conf 
)

◆ mctp_i3c_controller_init()

uint8_t mctp_i3c_controller_init ( mctp mctp_instance,
mctp_medium_conf  medium_conf 
)

◆ mctp_i3c_deinit()

uint8_t mctp_i3c_deinit ( mctp mctp_instance)

◆ mctp_i3c_target_init()

uint8_t mctp_i3c_target_init ( mctp mctp_instance,
mctp_medium_conf  medium_conf 
)

◆ mctp_init()

mctp * mctp_init ( void  )
Here is the call graph for this function:

◆ mctp_reg_endpoint_resolve_func()

uint8_t mctp_reg_endpoint_resolve_func ( mctp mctp_inst,
endpoint_resolve  resolve_fn 
)

◆ mctp_reg_msg_rx_func()

uint8_t mctp_reg_msg_rx_func ( mctp mctp_inst,
mctp_fn_cb  rx_cb 
)

◆ mctp_send_msg()

uint8_t mctp_send_msg ( mctp mctp_inst,
uint8_t *  buf,
uint16_t  len,
mctp_ext_params  ext_params 
)

◆ mctp_set_medium_configure()

uint8_t mctp_set_medium_configure ( mctp mctp_inst,
MCTP_MEDIUM_TYPE  medium_type,
mctp_medium_conf  medium_conf 
)

◆ mctp_smbus_deinit()

uint8_t mctp_smbus_deinit ( mctp mctp_inst)

◆ mctp_smbus_init()

uint8_t mctp_smbus_init ( mctp mctp_inst,
mctp_medium_conf  medium_conf 
)

◆ mctp_start()

uint8_t mctp_start ( mctp mctp_inst)

◆ mctp_stop()

uint8_t mctp_stop ( mctp mctp_inst)

◆ pal_find_bus_in_mctp_port()

int pal_find_bus_in_mctp_port ( mctp_port p)

◆ pal_find_mctp_by_bus()

mctp * pal_find_mctp_by_bus ( uint8_t  bus)
Here is the call graph for this function:

◆ pal_find_mctp_port_by_channel_target()

mctp_port * pal_find_mctp_port_by_channel_target ( uint8_t  target)
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_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_get_target()

int pal_get_target ( uint8_t  interface)

◆ pal_is_need_mctp_interval()

bool pal_is_need_mctp_interval ( mctp mctp_inst)

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

Variable Documentation

◆ mctp_tx_msg

mctp_tx_msg