diff options
author | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2019-02-18 15:06:26 +0530 |
---|---|---|
committer | Vasant Hegde <hegdevasant@linux.vnet.ibm.com> | 2019-03-04 19:41:47 +0530 |
commit | 2e2bf87b42f704d40ac5855aace858b320184a20 (patch) | |
tree | a766990c72e6af52c9cc95eb10fe26e76ff728d8 /hw | |
parent | 428cb852e3a0c99673bf9cfe9291cf117a40cb69 (diff) | |
download | skiboot-2e2bf87b42f704d40ac5855aace858b320184a20.zip skiboot-2e2bf87b42f704d40ac5855aace858b320184a20.tar.gz skiboot-2e2bf87b42f704d40ac5855aace858b320184a20.tar.bz2 |
ipmi/power: Fix system reboot issue
[ Upstream commit b1d421875b4c6282cef349f27964f7e8885f06ee ]
Kernel makes reboot/shudown OPAL call for reboot/shutdown. Once kernel
gets response from OPAL it runs opal_poll_events() until firmware
handles the request.
On BMC based system, OPAL makes IPMI call (IPMI_CHASSIS_CONTROL) to
initiate system reboot/shutdown. At present OPAL queues IPMI messages
and return SUCESS to Host. If BMC is not ready to accept command (like
BMC reboot), then these message will fail. We have to manually
reboot/shutdown the system using BMC interface.
This patch adds logic to validate message return value. If message failed,
then it will resend the message. At some stage BMC will be ready to accept
message and handles IPMI message.
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/ipmi/ipmi-power.c | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/hw/ipmi/ipmi-power.c b/hw/ipmi/ipmi-power.c index f14a0c9..40e1351 100644 --- a/hw/ipmi/ipmi-power.c +++ b/hw/ipmi/ipmi-power.c @@ -18,6 +18,25 @@ #include <stdlib.h> #include <ipmi.h> #include <opal.h> +#include <timebase.h> + +static void ipmi_chassis_control_complete(struct ipmi_msg *msg) +{ + uint8_t request = msg->data[0]; + uint8_t cc = msg->cc; + + ipmi_free_msg(msg); + if (cc == IPMI_CC_NO_ERROR) + return; + + prlog(PR_INFO, "IPMI: Chassis control request failed. " + "request=0x%02x, rc=0x%02x\n", request, cc); + + if (ipmi_chassis_control(request)) { + prlog(PR_INFO, "IPMI: Failed to resend chassis control " + "request [0x%02x]\n", request); + } +} int ipmi_chassis_control(uint8_t request) { @@ -29,10 +48,13 @@ int ipmi_chassis_control(uint8_t request) if (request > IPMI_CHASSIS_SOFT_SHUTDOWN) return OPAL_PARAMETER; - msg = ipmi_mkmsg_simple(IPMI_CHASSIS_CONTROL, &request, - sizeof(request)); + msg = ipmi_mkmsg(IPMI_DEFAULT_INTERFACE, IPMI_CHASSIS_CONTROL, + ipmi_chassis_control_complete, NULL, + &request, sizeof(request), 0); if (!msg) return OPAL_HARDWARE; + /* Set msg->error callback function */ + msg->error = ipmi_chassis_control_complete; prlog(PR_INFO, "IPMI: sending chassis control request 0x%02x\n", request); |