aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi/ipmi-sel.c
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2015-01-29 14:47:54 +1030
committerJeremy Kerr <jk@ozlabs.org>2015-03-04 16:01:23 +0800
commitd6fb45e3b29df30e30ac400cfb8b030719207213 (patch)
treed3072e29af542d8815d7a7fa33e179ac5d207bbc /hw/ipmi/ipmi-sel.c
parentf51aeaa4fa5074f747684643bf6ebff3e0884f67 (diff)
downloadskiboot-d6fb45e3b29df30e30ac400cfb8b030719207213.zip
skiboot-d6fb45e3b29df30e30ac400cfb8b030719207213.tar.gz
skiboot-d6fb45e3b29df30e30ac400cfb8b030719207213.tar.bz2
hw/ipmi: Disable flash access when requested
BMC based systems contain a PNOR to provide flash storage. The host normally has exclusive access to the PNOR, however the BMC may use IPMI to request access to perform functions such as update the firmware. Indicate to users of the flash that the device is busy by taking the lock, and setting a per-flash busy flag, which causes flash operations to return OPAL_BUSY. Minor changes from Jeremy Kerr Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Diffstat (limited to 'hw/ipmi/ipmi-sel.c')
-rw-r--r--hw/ipmi/ipmi-sel.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/hw/ipmi/ipmi-sel.c b/hw/ipmi/ipmi-sel.c
index 173b7be..c86c2c9 100644
--- a/hw/ipmi/ipmi-sel.c
+++ b/hw/ipmi/ipmi-sel.c
@@ -41,6 +41,9 @@
#define SOFT_OFF 0x00
#define SOFT_REBOOT 0x01
+#define RELEASE_PNOR 0x00
+#define REQUEST_PNOR 0x01
+
struct oem_sel {
/* SEL header */
uint8_t id[2];
@@ -180,6 +183,33 @@ int ipmi_elog_commit(struct errorlog *elog_buf)
return 0;
}
+#define ACCESS_DENIED 0x00
+#define ACCESS_GRANTED 0x01
+
+static void sel_pnor(uint8_t access)
+{
+ struct ipmi_msg *msg;
+ uint8_t granted = ACCESS_GRANTED;
+
+ switch (access) {
+ case REQUEST_PNOR:
+ prlog(PR_NOTICE, "IPMI: PNOR access requested\n");
+ granted = flash_reserve();
+
+ /* Ack the request */
+ msg = ipmi_mkmsg_simple(IPMI_PNOR_ACCESS_STATUS, &granted, 1);
+ ipmi_queue_msg(msg);
+ break;
+ case RELEASE_PNOR:
+ prlog(PR_NOTICE, "IPMI: PNOR access released\n");
+ flash_release();
+ break;
+ default:
+ prlog(PR_ERR, "IPMI: invalid PNOR access requested: %02x\n",
+ access);
+ }
+}
+
static void sel_power(uint8_t power)
{
switch (power) {
@@ -271,9 +301,11 @@ void ipmi_parse_sel(struct ipmi_msg *msg)
sel_occ_reset(sel.data[0]);
break;
case CMD_AMI_PNOR_ACCESS:
+ sel_pnor(sel.data[0]);
break;
default:
- printf("IPMI: unknown OEM SEL command %02x received\n",
- sel.cmd);
+ prlog(PR_WARNING,
+ "IPMI: unknown OEM SEL command %02x received\n",
+ sel.cmd);
}
}