OpenBIC
OpenSource Bridge-IC
ipmb.h File Reference
#include <devicetree.h>
#include <stdio.h>
Include dependency graph for ipmb.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  IPMB_config
 
struct  ipmi_msg
 
struct  ipmi_msg_cfg
 

Macros

#define DEBUG_IPMB   0
 
#define SEQ_NUM   64
 
#define MAX_SEQ_QUENE   15
 
#define MEM_ALLOCATE_RETRY_TIME   2
 
#define IPMI_DATA_MAX_LENGTH   520
 
#define IPMB_REQ_HEADER_LENGTH   6
 
#define IPMB_RESP_HEADER_LENGTH   7
 
#define IPMI_MSG_MAX_LENGTH   (IPMI_DATA_MAX_LENGTH + IPMB_RESP_HEADER_LENGTH)
 
#define IPMB_TX_RETRY_TIME   5
 
#define IPMB_TXQUEUE_LEN   1
 
#define IPMB_RXQUEUE_LEN   2
 
#define IPMB_TX_STACK_SIZE   3072
 
#define IPMB_RX_STACK_SIZE   3072
 
#define IPMI_HEADER_CHECKSUM_POSITION   2
 
#define IPMB_NETFN_MASK   0xFC
 
#define IPMB_DEST_LUN_MASK   0x03
 
#define IPMB_SEQ_MASK   0xFC
 
#define IPMB_SRC_LUN_MASK   0x03
 
#define IPMB_RETRY_DELAY_MS   500
 
#define IPMB_POLLING_TIME_MS   1
 
#define IPMB_SEQ_TIMEOUT_MS   3000
 
#define IPMB_SEQ_TIMEOUT_STACK_SIZE   512
 
#define I2C_RETRY_TIME   5
 
#define RESERVED_IDX   0xFF
 
#define RESERVED_BUS   0xFF
 
#define RESERVED_ADDRESS   0xFF
 
#define ENABLE   1
 
#define DISABLE   0
 
#define IS_RESPONSE(msg)   (msg.netfn & 0x01)
 

Typedefs

typedef struct IPMB_config IPMB_config
 
typedef enum ipmb_error ipmb_error
 

Enumerations

enum  Channel_Target {
  SELF = 0x0 , ME_IPMB = 0x01 , BMC_IPMB = 0x02 , SERVER_IPMB = 0x04 ,
  EXP1_IPMB = 0x05 , SLOT1_BIC = 0x07 , SLOT3_BIC = 0x08 , BB_IPMB = 0x10 ,
  EXP2_IPMB = 0x15 , CL_BIC_IPMB = 0x16 , HD_BIC_IPMB = 0x17 , GL_BIC_IPMB = 0x18 ,
  EXP3_IPMB = 0x25 , EXP4_IPMB = 0x30 , PEER_BMC_IPMB = 0x1A , BMC_USB = 0x20 ,
  PLDM = 0x40 , MCTP = 0x41 , MPRO_PLDM = 0x42 , SATMC_PLDM = 0x43 ,
  HOST_KCS_1 = 0x50 , HOST_KCS_2 = 0x51 , HOST_KCS_3 = 0x52 , HOST_KCS_4 = 0x53 ,
  HOST_SSIF_1 = 0x60 , RESERVED
}
 
enum  Interface { I2C_IF , I3C_IF , RESERVED_IF }
 
enum  ipmb_error {
  IPMB_ERROR_SUCCESS = 0 , IPMB_ERROR_UNKNOWN , IPMB_ERROR_FAILURE , IPMB_ERROR_TIMEOUT ,
  IPMB_ERROR_INVALID_REQ , IPMB_ERROR_HDR_CHECKSUM , IPMB_ERROR_MSG_CHECKSUM , IPMB_ERROR_QUEUE_CREATION ,
  IPMB_ERROR_GET_MESSAGE_QUEUE , IPMB_ERROR_MUTEX_LOCK
}
 

Functions

struct ipmi_msg __attribute__ ((packed, aligned(4))) ipmi_msg
 
bool pal_load_ipmb_config (void)
 
bool pal_is_interface_use_ipmb (uint8_t interface_index)
 
void ipmb_init (void)
 
ipmb_error ipmb_send_request (ipmi_msg *req, uint8_t index)
 
ipmb_error ipmb_send_response (ipmi_msg *resp, uint8_t index)
 
ipmb_error ipmb_read (ipmi_msg *msg, uint8_t bus)
 
void ipmb_tx_suspend (uint8_t index)
 
void ipmb_tx_resume (uint8_t index)
 
void pal_encode_response_bridge_cmd (ipmi_msg *bridge_msg, ipmi_msg_cfg *current_msg_rx, IPMB_config *ipmb_cfg, IPMB_config *IPMB_config_tables)
 

Variables

IPMB_configIPMB_config_table
 
uint8_t dest_addr
 
uint8_t netfn
 
uint8_t dest_LUN
 
uint8_t hdr_chksum
 
uint8_t src_addr
 
uint8_t seq_source
 
uint8_t seq_target
 
uint8_t seq
 
uint8_t pldm_inst_id
 
uint8_t InF_source
 
uint8_t InF_target
 
uint8_t src_LUN
 
uint8_t cmd
 
uint8_t completion_code
 
uint16_t data_len
 
uint8_t data [IPMI_MSG_MAX_LENGTH]
 
uint32_t timestamp
 
uint8_t msg_chksum
 
ipmi_msg buffer
 
uint8_t retries
 
struct ipmi_msg_cfgnext
 

Macro Definition Documentation

◆ DEBUG_IPMB

#define DEBUG_IPMB   0

◆ DISABLE

#define DISABLE   0

◆ ENABLE

#define ENABLE   1

◆ I2C_RETRY_TIME

#define I2C_RETRY_TIME   5

◆ IPMB_DEST_LUN_MASK

#define IPMB_DEST_LUN_MASK   0x03

◆ IPMB_NETFN_MASK

#define IPMB_NETFN_MASK   0xFC

◆ IPMB_POLLING_TIME_MS

#define IPMB_POLLING_TIME_MS   1

◆ IPMB_REQ_HEADER_LENGTH

#define IPMB_REQ_HEADER_LENGTH   6

◆ IPMB_RESP_HEADER_LENGTH

#define IPMB_RESP_HEADER_LENGTH   7

◆ IPMB_RETRY_DELAY_MS

#define IPMB_RETRY_DELAY_MS   500

◆ IPMB_RX_STACK_SIZE

#define IPMB_RX_STACK_SIZE   3072

◆ IPMB_RXQUEUE_LEN

#define IPMB_RXQUEUE_LEN   2

◆ IPMB_SEQ_MASK

#define IPMB_SEQ_MASK   0xFC

◆ IPMB_SEQ_TIMEOUT_MS

#define IPMB_SEQ_TIMEOUT_MS   3000

◆ IPMB_SEQ_TIMEOUT_STACK_SIZE

#define IPMB_SEQ_TIMEOUT_STACK_SIZE   512

◆ IPMB_SRC_LUN_MASK

#define IPMB_SRC_LUN_MASK   0x03

◆ IPMB_TX_RETRY_TIME

#define IPMB_TX_RETRY_TIME   5

◆ IPMB_TX_STACK_SIZE

#define IPMB_TX_STACK_SIZE   3072

◆ IPMB_TXQUEUE_LEN

#define IPMB_TXQUEUE_LEN   1

◆ IPMI_DATA_MAX_LENGTH

#define IPMI_DATA_MAX_LENGTH   520

◆ IPMI_HEADER_CHECKSUM_POSITION

#define IPMI_HEADER_CHECKSUM_POSITION   2

◆ IPMI_MSG_MAX_LENGTH

#define IPMI_MSG_MAX_LENGTH   (IPMI_DATA_MAX_LENGTH + IPMB_RESP_HEADER_LENGTH)

◆ IS_RESPONSE

#define IS_RESPONSE (   msg)    (msg.netfn & 0x01)

◆ MAX_SEQ_QUENE

#define MAX_SEQ_QUENE   15

◆ MEM_ALLOCATE_RETRY_TIME

#define MEM_ALLOCATE_RETRY_TIME   2

◆ RESERVED_ADDRESS

#define RESERVED_ADDRESS   0xFF

◆ RESERVED_BUS

#define RESERVED_BUS   0xFF

◆ RESERVED_IDX

#define RESERVED_IDX   0xFF

◆ SEQ_NUM

#define SEQ_NUM   64

Typedef Documentation

◆ IPMB_config

typedef struct IPMB_config IPMB_config

◆ ipmb_error

typedef enum ipmb_error ipmb_error

Enumeration Type Documentation

◆ Channel_Target

Enumerator
SELF 
ME_IPMB 
BMC_IPMB 
SERVER_IPMB 
EXP1_IPMB 
SLOT1_BIC 
SLOT3_BIC 
BB_IPMB 
EXP2_IPMB 
CL_BIC_IPMB 
HD_BIC_IPMB 
GL_BIC_IPMB 
EXP3_IPMB 
EXP4_IPMB 
PEER_BMC_IPMB 
BMC_USB 
PLDM 
MCTP 
MPRO_PLDM 
SATMC_PLDM 
HOST_KCS_1 
HOST_KCS_2 
HOST_KCS_3 
HOST_KCS_4 
HOST_SSIF_1 
RESERVED 

◆ Interface

enum Interface
Enumerator
I2C_IF 
I3C_IF 
RESERVED_IF 

◆ ipmb_error

enum ipmb_error
Enumerator
IPMB_ERROR_SUCCESS 

Generic no-error flag

IPMB_ERROR_UNKNOWN 

Unknown error

IPMB_ERROR_FAILURE 

Generic failure on IPMB

IPMB_ERROR_TIMEOUT 

Error raised when a message takes too long to be responded

IPMB_ERROR_INVALID_REQ 

A invalid request was received

IPMB_ERROR_HDR_CHECKSUM 

Invalid header checksum from incoming message

IPMB_ERROR_MSG_CHECKSUM 

Invalid message checksum from incoming message

IPMB_ERROR_QUEUE_CREATION 

Client queue couldn't be created. Invalid pointer to handler was given

IPMB_ERROR_GET_MESSAGE_QUEUE 

Failure on getting queue message

IPMB_ERROR_MUTEX_LOCK 

Fail to lock mutex in time

Function Documentation

◆ __attribute__()

struct ipmi_msg __attribute__ ( (packed, aligned(4))  )

◆ ipmb_init()

void ipmb_init ( void  )

◆ ipmb_read()

ipmb_error ipmb_read ( ipmi_msg msg,
uint8_t  bus 
)

◆ ipmb_send_request()

ipmb_error ipmb_send_request ( ipmi_msg req,
uint8_t  index 
)

◆ ipmb_send_response()

ipmb_error ipmb_send_response ( ipmi_msg resp,
uint8_t  index 
)

◆ ipmb_tx_resume()

void ipmb_tx_resume ( uint8_t  index)

◆ ipmb_tx_suspend()

void ipmb_tx_suspend ( uint8_t  index)

◆ pal_encode_response_bridge_cmd()

void pal_encode_response_bridge_cmd ( ipmi_msg bridge_msg,
ipmi_msg_cfg current_msg_rx,
IPMB_config ipmb_cfg,
IPMB_config IPMB_config_tables 
)

◆ pal_is_interface_use_ipmb()

bool pal_is_interface_use_ipmb ( uint8_t  interface_index)

◆ pal_load_ipmb_config()

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

Variable Documentation

◆ buffer

ipmi_msg buffer

IPMI Message

◆ cmd

uint8_t cmd

Command

◆ completion_code

uint8_t completion_code

Completion Code

◆ data

uint8_t data[IPMI_MSG_MAX_LENGTH]

Data buffer > Data field has 24 bytes: 32 (Max IPMI msg len) - 7 header bytes - 1 final chksum byte

◆ data_len

uint16_t data_len

Amount of valid bytes in data buffer

◆ dest_addr

uint8_t dest_addr

Destination target address

◆ dest_LUN

uint8_t dest_LUN

Destination LUN (Logical Unit Number)

◆ hdr_chksum

uint8_t hdr_chksum

Connection Header Checksum

◆ InF_source

uint8_t InF_source

Source bridge interface

◆ InF_target

uint8_t InF_target

Target bridge interface

◆ IPMB_config_table

IPMB_config* IPMB_config_table
extern

◆ msg_chksum

uint8_t msg_chksum

Message checksum

◆ netfn

uint8_t netfn

Net Function

◆ next

struct ipmi_msg_cfg* next

◆ pldm_inst_id

uint8_t pldm_inst_id

Sequence Number

◆ retries

uint8_t retries

Current retry counter

◆ seq

uint8_t seq

Sequence Number

◆ seq_source

uint8_t seq_source

Source sequence Number

◆ seq_target

uint8_t seq_target

Target sequence Number

◆ src_addr

uint8_t src_addr

Source target address

◆ src_LUN

uint8_t src_LUN

Source LUN (Logical Unit Number)

◆ timestamp

uint32_t timestamp

Tick count at the beginning of the process