OpenBIC
OpenSource Bridge-IC
README

Implement MCTP and PLDM

## Introduction

Add common code of the Management Component Transport Protocol (MCTP) and the Platform Level Data Model (PLDM) in OpenBIC project.

The currently supported feature are the following:

  • PLDM over MCTP over SMBus
  • Asynchronous command response function invoke
  • Initiative send MCTP request command
  • MCTP service
    • Bridge command to other device by endpoint ID
    • Control command (message type 0x00)
      • Get Endpoint ID (common code 0x02)
  • PLDM service (message type 0x01)
    • Base command
      • GetTid (common code 0x02)
    • OEM command
      • Echo command for testing
      • Support IPMI command

## Core API

Usage

Include MCTP and PLDM related header file in the platform code

#include "mctp.h"
#include "mctp_ctrl.h"
#include "pldm.h"

Add source and include path in CMakeLists.txt

FILE(GLOB common_sources ${common_path}/mctp/*.c ${common_path}/pldm/*.c)
target_include_directories(app PRIVATE ${common_path}/mctp ${common_path/pldm})

Initial the MCTP instance, mctp_init() also allocate the memory for the MCTP instance.

mctp *p = mctp_init();
mctp * mctp_init(void)
Definition: mctp.c:425
Definition: mctp.h:153

Configure mctp handle with specific medium type

uint8_t ret = mctp_set_medium_configure(p, MCTP_MEDIUM_TYPE_SMBUS, medium_configuration)
uint8_t mctp_set_medium_configure(mctp *mctp_inst, MCTP_MEDIUM_TYPE medium_type, mctp_medium_conf medium_conf)
Definition: mctp.c:457
@ MCTP_MEDIUM_TYPE_SMBUS
Definition: mctp.h:80

Assign a function use the MCTP instance as one parameter to find a suitable instance by endpoint ID for routing the MCTP message

static uint8_t get_mctp_route_info(uint8_t dest_endpoint, void **mctp_inst, mctp_ext_params *ext_params);
uint8_t get_mctp_route_info(uint8_t dest_endpoint, void **mctp_inst, mctp_ext_params *ext_params)
Definition: plat_mctp.c:131
uint8_t mctp_reg_endpoint_resolve_func(mctp *mctp_inst, endpoint_resolve resolve_fn)
Definition: mctp.c:625
Definition: mctp.h:98

Assign a function to handle when the MCTP message receive

static uint8_t mctp_msg_recv(void *mctp_p, uint8_t *buf, uin32_t len, mctp_ext_params ext_params);
mctp_reg_msg_rx_func(p, mctp_msg_recv);
uint8_t mctp_reg_msg_rx_func(mctp *mctp_inst, mctp_fn_cb rx_cb)
Definition: mctp.c:634

Call the mctp_start() to start the MCTP service on the specific interface

uint8_t mctp_start(mctp *mctp_inst)
Definition: mctp.c:512

## Endpoint ID

Endpoint ID use for identifying which controller to receive the MCTP package. To prevent EID conflicts, define below table for reference:

Platform Code Device EID Remark
All Platform BIC 0x00 BIC common reserve
All Platform BMC 0x08 BMC common default
Cascade Creek BIC 0x0A BIC common default
Moose Creek BIC 0x0B
Colter Bay BIC 0x0C
Cascade Creek NIC0 0x10
Cascade Creek NIC1 0x11
Cascade Creek NIC2 0x12
Cascade Creek NIC3 0x13
Cascade Creek NIC4 0x14
Cascade Creek NIC5 0x15
Cascade Creek NIC6 0x16
Cascade Creek NIC7 0x17
Crafter Lake BIC 0x20
Y35 Baseboard BIC 0x21
Great Lake BIC 0x22
Halfdome BIC 0x23
Rainball Falls BIC 0x24
Delta Lake BIC 0x2A
Vernal Falls BIC 0x2B
Rainball Falls CXL 0x2E
Moose Creek CXL 0x2F
Olmsted Point A BIC 0x30
Olmsted Point B BIC 0x31
Waimea Canyon MB BIC 0x38

## Acknowledgments