Commit 059747c2 authored by Corey Minyard's avatar Corey Minyard Committed by Corey Minyard

ipmi: Add support for IPMB direct messages

An application has come up that has a device sitting right on the IPMB
that would like to communicate with the BMC on the IPMB using normal
IPMI commands.

Sending these commands and handling the responses is easy enough, no
modifications are needed to the IPMI infrastructure.  But if this is an
application that also needs to receive IPMB commands and respond, some
way is needed to handle these incoming commands and send the responses.

Currently, the IPMI message handler only sends commands to the interface
and only receives responses from interface.  This change extends the
interface to receive commands/responses and send commands/responses.
These are formatted differently in support of receiving/sending IPMB
messages directly.
Signed-off-by: default avatarCorey Minyard <minyard@acm.org>
Tested-by: default avatarAndrew Manley <andrew.manley@sealingtech.com>
Reviewed-by: default avatarAndrew Manley <andrew.manley@sealingtech.com>
parent 1e4071f6
This diff is collapsed.
......@@ -38,6 +38,59 @@ struct ipmi_smi;
#define IPMI_WATCH_MASK_CHECK_WATCHDOG (1 << 1)
#define IPMI_WATCH_MASK_CHECK_COMMANDS (1 << 2)
/*
* SMI messages
*
* When communicating with an SMI, messages come in two formats:
*
* * Normal (to a BMC over a BMC interface)
*
* * IPMB (over a IPMB to another MC)
*
* When normal, commands are sent using the format defined by a
* standard message over KCS (NetFn must be even):
*
* +-----------+-----+------+
* | NetFn/LUN | Cmd | Data |
* +-----------+-----+------+
*
* And responses, similarly, with an completion code added (NetFn must
* be odd):
*
* +-----------+-----+------+------+
* | NetFn/LUN | Cmd | CC | Data |
* +-----------+-----+------+------+
*
* With normal messages, only commands are sent and only responses are
* received.
*
* In IPMB mode, we are acting as an IPMB device. Commands will be in
* the following format (NetFn must be even):
*
* +-------------+------+-------------+-----+------+
* | NetFn/rsLUN | Addr | rqSeq/rqLUN | Cmd | Data |
* +-------------+------+-------------+-----+------+
*
* Responses will using the following format:
*
* +-------------+------+-------------+-----+------+------+
* | NetFn/rqLUN | Addr | rqSeq/rsLUN | Cmd | CC | Data |
* +-------------+------+-------------+-----+------+------+
*
* This is similar to the format defined in the IPMB manual section
* 2.11.1 with the checksums and the first address removed. Also, the
* address is always the remote address.
*
* IPMB messages can be commands and responses in both directions.
* Received commands are handled as received commands from the message
* queue.
*/
enum ipmi_smi_msg_type {
IPMI_SMI_MSG_TYPE_NORMAL = 0,
IPMI_SMI_MSG_TYPE_IPMB_DIRECT
};
/*
* Messages to/from the lower layer. The smi interface will take one
* of these to send. After the send has occurred and a response has
......@@ -54,6 +107,8 @@ struct ipmi_smi;
struct ipmi_smi_msg {
struct list_head link;
enum ipmi_smi_msg_type type;
long msgid;
void *user_data;
......@@ -73,6 +128,10 @@ struct ipmi_smi_msg {
struct ipmi_smi_handlers {
struct module *owner;
/* Capabilities of the SMI. */
#define IPMI_SMI_CAN_HANDLE_IPMB_DIRECT (1 << 0)
unsigned int flags;
/*
* The low-level interface cannot start sending messages to
* the upper layer until this function is called. This may
......
......@@ -80,6 +80,20 @@ struct ipmi_ipmb_addr {
unsigned char lun;
};
/*
* Used for messages received directly from an IPMB that have not gone
* through a MC. This is for systems that sit right on an IPMB so
* they can receive commands and respond to them.
*/
#define IPMI_IPMB_DIRECT_ADDR_TYPE 0x81
struct ipmi_ipmb_direct_addr {
int addr_type;
short channel;
unsigned char slave_addr;
unsigned char rs_lun;
unsigned char rq_lun;
};
/*
* A LAN Address. This is an address to/from a LAN interface bridged
* by the BMC, not an address actually out on the LAN.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment