diff options
author | Joel Stanley <joel@jms.id.au> | 2014-08-12 17:59:41 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-13 16:15:42 +1000 |
commit | 50d2e37faf5bb2fd154d4a1eeac465f8016e1f65 (patch) | |
tree | 1a275d39c8b74e6f0ec397942763e68e9e29c8f0 /core | |
parent | 7f43755ba160e160554c8eb537efc5f691e99bc6 (diff) | |
download | skiboot-50d2e37faf5bb2fd154d4a1eeac465f8016e1f65.zip skiboot-50d2e37faf5bb2fd154d4a1eeac465f8016e1f65.tar.gz skiboot-50d2e37faf5bb2fd154d4a1eeac465f8016e1f65.tar.bz2 |
plat/palmetto: Add shutdown and reboot
Rebooting and power down for the Palmetto is done by the BMC, which we
speak to over the BT interface using IPMI. Implement the IPMI chassis
commands which are used for power control, and hook them up to the
palmetto platform callbacks for shutdown and reboot.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/ipmi.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/core/ipmi.c b/core/ipmi.c index b21a0f3..6cf435d 100644 --- a/core/ipmi.c +++ b/core/ipmi.c @@ -17,17 +17,43 @@ #include <stdio.h> #include <bt.h> #include <ipmi.h> +#include <opal.h> static void ipmi_cmd_done(struct ipmi_msg *msg) { if (msg->cc != IPMI_CC_NO_ERROR) { prerror("IPMI: Got error response 0x%02x\n", msg->cc); + goto out; } switch (msg->netfn) { + case IPMI_NETFN_CHASSIS_RESPONSE: + break; default: prerror("IPMI: Invalid IPMI function code in response\n"); } + +out: + free(msg); +} + +int64_t ipmi_opal_chassis_request(uint64_t request) +{ + struct ipmi_msg *msg = zalloc(sizeof(struct ipmi_msg)); + + if (!msg) + return OPAL_HARDWARE; + + msg->cmd = request; + msg->netfn = IPMI_NETFN_CHASSIS_REQUEST; + msg->req_data = NULL; + msg->req_data_len = 0; + msg->resp_data = NULL; + msg->resp_data_len = 0; + + prlog(PR_INFO, "IPMI: sending chassis request %llu\n", request); + + return bt_add_ipmi_msg_wait(msg); } void ipmi_init(void) |