25#include <sys/printk.h>
33#define MCTP_RESPONSE 0
36#define MCTP_TX_QUEUE_SIZE 16
38#define MSG_ASSEMBLY_BUF_SIZE 1024
40#define MCTP_RX_TASK_STACK_SIZE 4096
41#define MCTP_TX_TASK_STACK_SIZE 2048
42#define MCTP_TASK_NAME_LEN 32
44#define MCTP_DEFAULT_ENDPOINT 0x0A
45#define MCTP_NULL_EID 0x00
47#define MCTP_DEFAULT_MSG_MAX_SIZE 64
48#define MCTP_TRANSPORT_HEADER_SIZE 4
49#define MCTP_MEDIUM_META_SIZE_SMBUS 3
50#define MCTP_PEC_SIZE 1
51#define MCTP_META_INFO_SIZE (MCTP_TRANSPORT_HEADER_SIZE + MCTP_PEC_SIZE)
53#define MCTP_MAX_MSG_TAG_NUM 8
55#define MCTP_HDR_HDR_VER 0x01
56#define MCTP_HDR_SEQ_MASK 0x03
57#define MCTP_HDR_TAG_MASK 0x07
59#define MCTP_POLL_TIME_MS 1
61#define MCTP_MSG_TYPE_SHIFT 0
62#define MCTP_MSG_TYPE_MASK 0x7F
64#define MCTP_IC_SHIFT 7
65#define MCTP_IC_MASK 0x80
118typedef uint16_t (*
medium_rx)(
void *mctp_p, uint8_t *buf, uint32_t len,
145 uint8_t is_bridge_packet;
149 struct k_msgq *evt_msgq;
bool get_mctp_info_by_eid(uint8_t port, mctp **mctp_inst, mctp_ext_params *ext_params)
Definition: mctp.c:648
uint8_t plat_get_eid()
Definition: mctp.c:419
struct _mctp_msg_handler mctp_msg_handler
uint8_t mctp_stop(mctp *mctp_inst)
Definition: mctp.c:489
uint8_t mctp_reg_endpoint_resolve_func(mctp *mctp_inst, endpoint_resolve resolve_fn)
Definition: mctp.c:625
mctp_port * pal_find_mctp_port_by_channel_target(uint8_t target)
Definition: mctp.c:699
mctp_tx_msg
Definition: mctp.h:150
uint8_t mctp_start(mctp *mctp_inst)
Definition: mctp.c:512
int pal_get_medium_type(uint8_t interface)
Definition: plat_mctp.c:85
uint8_t(* endpoint_resolve)(uint8_t dest_endpoint, void **mctp_inst, mctp_ext_params *ext_params)
Definition: mctp.h:122
struct _mctp_smbus_port mctp_port
uint16_t(* medium_tx)(void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)
Definition: mctp.h:117
uint8_t mctp_reg_msg_rx_func(mctp *mctp_inst, mctp_fn_cb rx_cb)
Definition: mctp.c:634
MCTP_MEDIUM_TYPE
Definition: mctp.h:78
@ MCTP_MEDIUM_TYPE_TARGET_I3C
Definition: mctp.h:82
@ MCTP_MEDIUM_TYPE_MAX
Definition: mctp.h:83
@ MCTP_MEDIUM_TYPE_CONTROLLER_I3C
Definition: mctp.h:81
@ MCTP_MEDIUM_TYPE_UNKNOWN
Definition: mctp.h:79
@ MCTP_MEDIUM_TYPE_SMBUS
Definition: mctp.h:80
uint16_t(* medium_rx)(void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params *ext_params)
Definition: mctp.h:118
#define MCTP_MAX_MSG_TAG_NUM
Definition: mctp.h:53
uint8_t mctp_get_medium_configure(mctp *mctp_inst, MCTP_MEDIUM_TYPE *medium_type, mctp_medium_conf *medium_conf)
Definition: mctp.c:477
uint8_t plat_get_mctp_port_count()
Definition: mctp.c:675
MCTP_MSG_TYPE
Definition: mctp.h:67
@ MCTP_MSG_TYPE_PLDM
Definition: mctp.h:69
@ MCTP_MSG_TYPE_ETH
Definition: mctp.h:71
@ MCTP_MSG_TYPE_NVME
Definition: mctp.h:72
@ MCTP_MSG_TYPE_CCI
Definition: mctp.h:73
@ MCTP_MSG_TYPE_NCSI
Definition: mctp.h:70
@ MCTP_MSG_TYPE_CTRL
Definition: mctp.h:68
@ MCTP_MSG_TYPE_VEN_DEF_PCI
Definition: mctp.h:74
@ MCTP_MSG_TYPE_VEN_DEF_IANA
Definition: mctp.h:75
uint8_t mctp_i3c_deinit(mctp *mctp_instance)
uint8_t mctp_send_msg(mctp *mctp_inst, uint8_t *buf, uint16_t len, mctp_ext_params ext_params)
Definition: mctp.c:616
#define MCTP_TASK_NAME_LEN
Definition: mctp.h:42
struct _mctp_smbus_ext_params mctp_smbus_ext_params
int pal_get_target(uint8_t interface)
Definition: plat_mctp.c:103
uint8_t mctp_deinit(mctp *mctp_inst)
Definition: mctp.c:442
mctp_port * plat_get_mctp_port(uint8_t index)
Definition: mctp.c:680
mctp * pal_get_mctp(uint8_t mctp_medium_type, uint8_t bus)
Definition: plat_mctp.c:121
uint8_t get_mctp_info(uint8_t dest_endpoint, mctp **mctp_inst, mctp_ext_params *ext_params)
Definition: mctp.c:643
mctp * mctp_init(void)
Definition: mctp.c:425
struct _mctp_smbus_conf mctp_smbus_conf
#define MCTP_TX_TASK_STACK_SIZE
Definition: mctp.h:41
struct _mctp_route_entry mctp_route_entry
uint8_t mctp_smbus_deinit(mctp *mctp_inst)
Definition: mctp_smbus.c:243
uint8_t mctp_bridge_msg(mctp *mctp_inst, uint8_t *buf, uint16_t len, mctp_ext_params ext_params)
Definition: mctp.c:607
struct _mctp_ext_params mctp_ext_params
uint8_t mctp_i3c_controller_init(mctp *mctp_instance, mctp_medium_conf medium_conf)
#define MCTP_RX_TASK_STACK_SIZE
Definition: mctp.h:40
bool pal_is_need_mctp_interval(mctp *mctp_inst)
Definition: mctp.c:46
mctp * pal_find_mctp_by_bus(uint8_t bus)
Definition: mctp.c:685
uint8_t mctp_set_medium_configure(mctp *mctp_inst, MCTP_MEDIUM_TYPE medium_type, mctp_medium_conf medium_conf)
Definition: mctp.c:457
uint8_t mctp_smbus_init(mctp *mctp_inst, mctp_medium_conf medium_conf)
Definition: mctp_smbus.c:232
struct _mctp_i3c_conf mctp_i3c_conf
struct _mctp_i3c_ext_params mctp_i3c_ext_params
uint8_t(* mctp_fn_cb)(void *mctp_p, uint8_t *buf, uint32_t len, mctp_ext_params ext_params)
Definition: mctp.h:114
int pal_get_mctp_interval_ms(mctp *mctp_inst)
Definition: mctp.c:51
int pal_find_bus_in_mctp_port(mctp_port *p)
Definition: mctp.c:656
uint8_t mctp_i3c_target_init(mctp *mctp_instance, mctp_medium_conf medium_conf)
Definition: pldm_smbios.h:61
MCTP_MEDIUM_TYPE type
Definition: mctp.h:105
mctp_smbus_ext_params smbus_ext_params
Definition: mctp.h:107
uint8_t tag_owner
Definition: mctp.h:100
mctp_i3c_ext_params i3c_ext_params
Definition: mctp.h:108
uint8_t ep
Definition: mctp.h:102
uint8_t msg_tag
Definition: mctp.h:101
uint8_t bus
Definition: mctp.h:127
uint8_t addr
Definition: mctp.h:128
uint8_t addr
Definition: mctp.h:88
uint32_t dummy
Definition: mctp.h:89
mctp_fn_cb msg_handler_cb
Definition: mctp.h:222
MCTP_MSG_TYPE type
Definition: mctp.h:221
bool set_endpoint
Definition: mctp.h:217
uint8_t dev_present_pin
Definition: mctp.h:216
uint8_t addr
Definition: mctp.h:215
uint8_t bus
Definition: mctp.h:214
uint8_t endpoint
Definition: mctp.h:213
uint8_t bus
Definition: mctp.h:133
uint8_t addr
Definition: mctp.h:134
uint8_t addr
Definition: mctp.h:94
mctp * mctp_inst
Definition: mctp.h:205
MCTP_MEDIUM_TYPE medium_type
Definition: mctp.h:207
uint8_t channel_target
Definition: mctp.h:206
mctp_medium_conf conf
Definition: mctp.h:208
uint8_t mctp_tx_task_name[MCTP_TASK_NAME_LEN]
Definition: mctp.h:175
k_tid_t mctp_tx_task_tid
Definition: mctp.h:169
mctp_fn_cb rx_cb
Definition: mctp.h:187
struct k_msgq mctp_tx_queue
Definition: mctp.h:178
medium_tx write_data
Definition: mctp.h:162
uint8_t cci_msg_tag
Definition: mctp.h:194
struct _mctp::@71 temp_msg_buf[MCTP_MAX_MSG_TAG_NUM][2]
uint8_t endpoint
Definition: mctp.h:156
medium_rx read_data
Definition: mctp.h:161
uint8_t msg_tag
Definition: mctp.h:201
uint32_t ncsi_inst_table[8]
Definition: mctp.h:198
struct k_thread tx_task_thread_data
Definition: mctp.h:171
struct k_thread rx_task_thread_data
Definition: mctp.h:170
k_tid_t mctp_rx_task_tid
Definition: mctp.h:168
uint8_t * buf
Definition: mctp.h:182
mctp_medium_conf medium_conf
Definition: mctp.h:160
endpoint_resolve ep_resolve
Definition: mctp.h:165
K_KERNEL_STACK_MEMBER(tx_task_stack_area, MCTP_TX_TASK_STACK_SIZE)
K_KERNEL_STACK_MEMBER(rx_task_stack_area, MCTP_RX_TASK_STACK_SIZE)
uint32_t pldm_inst_table
Definition: mctp.h:191
MCTP_MEDIUM_TYPE medium_type
Definition: mctp.h:155
uint8_t pldm_inst_id
Definition: mctp.h:190
uint8_t is_servcie_start
Definition: mctp.h:154
uint16_t offset
Definition: mctp.h:183
uint8_t ncsi_inst_id
Definition: mctp.h:197
uint8_t mctp_rx_task_name[MCTP_TASK_NAME_LEN]
Definition: mctp.h:174
uint16_t max_msg_size
Definition: mctp.h:157
mctp_i3c_conf i3c_conf
Definition: mctp.h:140
mctp_smbus_conf smbus_conf
Definition: mctp.h:139