coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
ipmi_kcs.c File Reference
#include <console/console.h>
#include <device/device.h>
#include <arch/io.h>
#include <timer.h>
#include "ipmi_kcs.h"
Include dependency graph for ipmi_kcs.c:

Go to the source code of this file.

Macros

#define IPMI_KCS_STATE(_x)   ((_x) >> 6)
 
#define IPMI_KCS_GET_STATUS_ABORT   0x60
 
#define IPMI_KCS_START_WRITE   0x61
 
#define IPMI_KCS_END_WRITE   0x62
 
#define IPMI_KCS_READ_BYTE   0x68
 
#define IPMI_KCS_OBF   0x01
 
#define IPMI_KCS_IBF   0x02
 
#define IPMI_KCS_ATN   0x04
 
#define IPMI_KCS_STATE_IDLE   0x00
 
#define IPMI_KCS_STATE_READ   0x01
 
#define IPMI_KCS_STATE_WRITE   0x02
 
#define IPMI_KCS_STATE_ERROR   0x03
 
#define IPMI_CMD(_x)   ((_x) + CONFIG_IPMI_KCS_REGISTER_SPACING)
 
#define IPMI_DATA(_x)   ((_x))
 
#define IPMI_STAT(_x)   ((_x) + CONFIG_IPMI_KCS_REGISTER_SPACING)
 

Functions

static unsigned char ipmi_kcs_status (int port)
 
static int wait_ibf_timeout (int port)
 
static int wait_obf_timeout (int port)
 
static int ipmi_kcs_send_data_byte (int port, const unsigned char byte)
 
static int ipmi_kcs_send_last_data_byte (int port, const unsigned char byte)
 
static int ipmi_kcs_send_cmd_byte (int port, const unsigned char byte)
 
static int ipmi_kcs_send_message (int port, int netfn, int lun, int cmd, const unsigned char *msg, int len)
 
static int ipmi_kcs_read_message (int port, unsigned char *msg, int len)
 
int ipmi_kcs_message (int port, int netfn, int lun, int cmd, const unsigned char *inmsg, int inlen, unsigned char *outmsg, int outlen)
 

Macro Definition Documentation

◆ IPMI_CMD

#define IPMI_CMD (   _x)    ((_x) + CONFIG_IPMI_KCS_REGISTER_SPACING)

Definition at line 25 of file ipmi_kcs.c.

◆ IPMI_DATA

#define IPMI_DATA (   _x)    ((_x))

Definition at line 26 of file ipmi_kcs.c.

◆ IPMI_KCS_ATN

#define IPMI_KCS_ATN   0x04

Definition at line 18 of file ipmi_kcs.c.

◆ IPMI_KCS_END_WRITE

#define IPMI_KCS_END_WRITE   0x62

Definition at line 13 of file ipmi_kcs.c.

◆ IPMI_KCS_GET_STATUS_ABORT

#define IPMI_KCS_GET_STATUS_ABORT   0x60

Definition at line 11 of file ipmi_kcs.c.

◆ IPMI_KCS_IBF

#define IPMI_KCS_IBF   0x02

Definition at line 17 of file ipmi_kcs.c.

◆ IPMI_KCS_OBF

#define IPMI_KCS_OBF   0x01

Definition at line 16 of file ipmi_kcs.c.

◆ IPMI_KCS_READ_BYTE

#define IPMI_KCS_READ_BYTE   0x68

Definition at line 14 of file ipmi_kcs.c.

◆ IPMI_KCS_START_WRITE

#define IPMI_KCS_START_WRITE   0x61

Definition at line 12 of file ipmi_kcs.c.

◆ IPMI_KCS_STATE

#define IPMI_KCS_STATE (   _x)    ((_x) >> 6)

Definition at line 9 of file ipmi_kcs.c.

◆ IPMI_KCS_STATE_ERROR

#define IPMI_KCS_STATE_ERROR   0x03

Definition at line 23 of file ipmi_kcs.c.

◆ IPMI_KCS_STATE_IDLE

#define IPMI_KCS_STATE_IDLE   0x00

Definition at line 20 of file ipmi_kcs.c.

◆ IPMI_KCS_STATE_READ

#define IPMI_KCS_STATE_READ   0x01

Definition at line 21 of file ipmi_kcs.c.

◆ IPMI_KCS_STATE_WRITE

#define IPMI_KCS_STATE_WRITE   0x02

Definition at line 22 of file ipmi_kcs.c.

◆ IPMI_STAT

#define IPMI_STAT (   _x)    ((_x) + CONFIG_IPMI_KCS_REGISTER_SPACING)

Definition at line 27 of file ipmi_kcs.c.

Function Documentation

◆ ipmi_kcs_message()

int ipmi_kcs_message ( int  port,
int  netfn,
int  lun,
int  cmd,
const unsigned char *  inmsg,
int  inlen,
unsigned char *  outmsg,
int  outlen 
)

Definition at line 222 of file ipmi_kcs.c.

References BIOS_ERR, ipmi_kcs_read_message(), ipmi_kcs_send_message(), and printk.

Referenced by ipmi_add_sel(), ipmi_get_bmc_self_test_result(), ipmi_get_device_id(), ipmi_get_pcie_config(), ipmi_set_cmos_clear(), ipmi_set_ppin(), set_coreboot_date(), and set_coreboot_ver().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_read_message()

static int ipmi_kcs_read_message ( int  port,
unsigned char *  msg,
int  len 
)
static

Definition at line 187 of file ipmi_kcs.c.

References BIOS_ERR, inb(), IPMI_DATA, IPMI_KCS_READ_BYTE, IPMI_KCS_STATE, IPMI_KCS_STATE_IDLE, IPMI_KCS_STATE_READ, ipmi_kcs_status(), outb(), printk, wait_ibf_timeout(), and wait_obf_timeout().

Referenced by ipmi_kcs_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_send_cmd_byte()

static int ipmi_kcs_send_cmd_byte ( int  port,
const unsigned char  byte 
)
static

Definition at line 105 of file ipmi_kcs.c.

References BIOS_SPEW, CONFIG, inb(), IPMI_CMD, IPMI_DATA, IPMI_KCS_OBF, ipmi_kcs_status(), outb(), printk, and wait_ibf_timeout().

Referenced by ipmi_kcs_send_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_send_data_byte()

static int ipmi_kcs_send_data_byte ( int  port,
const unsigned char  byte 
)
static

Definition at line 57 of file ipmi_kcs.c.

References BIOS_ERR, BIOS_SPEW, CONFIG, inb(), IPMI_DATA, IPMI_KCS_OBF, IPMI_KCS_STATE, IPMI_KCS_STATE_WRITE, ipmi_kcs_status(), outb(), printk, and wait_ibf_timeout().

Referenced by ipmi_kcs_send_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_send_last_data_byte()

static int ipmi_kcs_send_last_data_byte ( int  port,
const unsigned char  byte 
)
static

Definition at line 81 of file ipmi_kcs.c.

References BIOS_ERR, BIOS_SPEW, CONFIG, inb(), IPMI_DATA, IPMI_KCS_OBF, IPMI_KCS_STATE, IPMI_KCS_STATE_WRITE, ipmi_kcs_status(), outb(), printk, and wait_ibf_timeout().

Referenced by ipmi_kcs_send_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_send_message()

static int ipmi_kcs_send_message ( int  port,
int  netfn,
int  lun,
int  cmd,
const unsigned char *  msg,
int  len 
)
static

Definition at line 126 of file ipmi_kcs.c.

References BIOS_ERR, IPMI_KCS_END_WRITE, ipmi_kcs_send_cmd_byte(), ipmi_kcs_send_data_byte(), ipmi_kcs_send_last_data_byte(), IPMI_KCS_START_WRITE, and printk.

Referenced by ipmi_kcs_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ipmi_kcs_status()

static unsigned char ipmi_kcs_status ( int  port)
static

Definition at line 29 of file ipmi_kcs.c.

References BIOS_SPEW, CONFIG, inb(), IPMI_STAT, and printk.

Referenced by ipmi_kcs_read_message(), ipmi_kcs_send_cmd_byte(), ipmi_kcs_send_data_byte(), ipmi_kcs_send_last_data_byte(), wait_ibf_timeout(), and wait_obf_timeout().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_ibf_timeout()

static int wait_ibf_timeout ( int  port)
static

Definition at line 37 of file ipmi_kcs.c.

References BIOS_ERR, IPMI_KCS_IBF, ipmi_kcs_status(), printk, and wait_ms.

Referenced by ipmi_kcs_read_message(), ipmi_kcs_send_cmd_byte(), ipmi_kcs_send_data_byte(), and ipmi_kcs_send_last_data_byte().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ wait_obf_timeout()

static int wait_obf_timeout ( int  port)
static

Definition at line 47 of file ipmi_kcs.c.

References BIOS_ERR, IPMI_KCS_OBF, ipmi_kcs_status(), printk, and wait_ms.

Referenced by ipmi_kcs_read_message().

Here is the call graph for this function:
Here is the caller graph for this function: