aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2015-02-05 13:40:03 +1030
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-02-09 14:06:05 +1100
commitda0d0f92ae3c401f47c1e0107d0628a70f0542b3 (patch)
treeaf8dbfebb1c973ace53d9451440d300a9f03d12a
parent6e42e6364ed2b1e976d7ddace2e28f27c0b46ba4 (diff)
downloadskiboot-da0d0f92ae3c401f47c1e0107d0628a70f0542b3.zip
skiboot-da0d0f92ae3c401f47c1e0107d0628a70f0542b3.tar.gz
skiboot-da0d0f92ae3c401f47c1e0107d0628a70f0542b3.tar.bz2
ipmi: Set BMC Global Enables to enable notifications
For OEM events including graceful power down and BMC PNOR access we want to receive notification whenever a message is ready to be read from the BMC. This requires the Event Message Buffer flag to be enabled. This is the equivalent of doing mc setenables event_msg=on with ipmitool, except the message must come from the BT interface in order to have permission to modify the flags. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--include/ipmi.h2
-rw-r--r--platforms/astbmc/common.c48
2 files changed, 50 insertions, 0 deletions
diff --git a/include/ipmi.h b/include/ipmi.h
index 9f9cfbb..68bf5a7 100644
--- a/include/ipmi.h
+++ b/include/ipmi.h
@@ -101,6 +101,8 @@
#define IPMI_CHASSIS_CONTROL IPMI_CODE(IPMI_NETFN_CHASSIS, 0x02)
#define IPMI_SET_POWER_STATE IPMI_CODE(IPMI_NETFN_APP, 0x06)
#define IPMI_GET_POWER_STATE IPMI_CODE(IPMI_NETFN_APP, 0x07)
+#define IPMI_SET_ENABLES IPMI_CODE(IPMI_NETFN_APP, 0x2E)
+#define IPMI_GET_ENABLES IPMI_CODE(IPMI_NETFN_APP, 0x2F)
#define IPMI_CLEAR_MESSAGE_FLAGS IPMI_CODE(IPMI_NETFN_APP, 0x30)
#define IPMI_GET_MESSAGE_FLAGS IPMI_CODE(IPMI_NETFN_APP, 0x31)
#define IPMI_GET_MESSAGE IPMI_CODE(IPMI_NETFN_APP, 0x33)
diff --git a/platforms/astbmc/common.c b/platforms/astbmc/common.c
index f9c988d..fc4c776 100644
--- a/platforms/astbmc/common.c
+++ b/platforms/astbmc/common.c
@@ -44,6 +44,51 @@ void astbmc_ext_irq(unsigned int chip_id __unused)
bt_irq();
}
+static void astbmc_ipmi_error(struct ipmi_msg *msg)
+{
+ prlog(PR_DEBUG, "ASTBMC: error sending msg. cc = %02x\n", msg->cc);
+
+ ipmi_free_msg(msg);
+}
+
+static void astbmc_ipmi_setenables(void)
+{
+ struct ipmi_msg *msg;
+
+ struct {
+ uint8_t oem2_en : 1;
+ uint8_t oem1_en : 1;
+ uint8_t oem0_en : 1;
+ uint8_t reserved : 1;
+ uint8_t sel_en : 1;
+ uint8_t msgbuf_en : 1;
+ uint8_t msgbuf_full_int_en : 1;
+ uint8_t rxmsg_queue_int_en : 1;
+ } data;
+
+ memset(&data, 0, sizeof(data));
+
+ /* The spec says we need to read-modify-write to not clobber
+ * the state of the other flags. These are set on by the bmc */
+ data.rxmsg_queue_int_en = 1;
+ data.sel_en = 1;
+
+ /* These are the ones we want to set on */
+ data.msgbuf_en = 1;
+
+ msg = ipmi_mkmsg_simple(IPMI_SET_ENABLES, &data, sizeof(data));
+ if (!msg) {
+ prlog(PR_ERR, "ASTBMC: failed to set enables\n");
+ return;
+ }
+
+ msg->error = astbmc_ipmi_error;
+
+ ipmi_queue_msg(msg);
+
+}
+
+
void astbmc_init(void)
{
/* Initialize PNOR/NVRAM */
@@ -59,6 +104,9 @@ void astbmc_init(void)
/* As soon as IPMI is up, inform BMC we are in "S0" */
ipmi_set_power_state(IPMI_PWR_SYS_S0_WORKING, IPMI_PWR_NOCHANGE);
+ /* Enable IPMI OEM message interrupts */
+ astbmc_ipmi_setenables();
+
/* Setup UART console for use by Linux via OPAL API */
if (!dummy_console_enabled())
uart_setup_opal_console();