From ae5fb8512e8ecfc1f1b24f5f89ef373dc4502844 Mon Sep 17 00:00:00 2001 From: Joel Stanley Date: Thu, 11 Sep 2014 15:43:50 +0930 Subject: ipmi/power: Update chassis control command Linux sends us a 0 when shutting down. This means we don't need to pass the u64 to the IPMI driver. Add a check that the value is what we expect in case Linux changes it's behaviour in the future. When rebooting, we should send the BMC a HARD_RESET command (0x03), not POWER_CYCLE (0x02). While we are here, trim some whitespace and drop opal from the IPMI function name for readability. Signed-off-by: Joel Stanley Signed-off-by: Benjamin Herrenschmidt --- hw/ipmi/ipmi-power.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'hw/ipmi') diff --git a/hw/ipmi/ipmi-power.c b/hw/ipmi/ipmi-power.c index c8589c1..32e66d2 100644 --- a/hw/ipmi/ipmi-power.c +++ b/hw/ipmi/ipmi-power.c @@ -18,17 +18,15 @@ #include #include -int64_t ipmi_opal_chassis_control(uint64_t request) +int ipmi_chassis_control(uint8_t request) { struct ipmi_msg *msg; - uint8_t chassis_control = request; - if (chassis_control > IPMI_CHASSIS_SOFT_SHUTDOWN) + if (request > IPMI_CHASSIS_SOFT_SHUTDOWN) return OPAL_PARAMETER; - - msg = ipmi_mkmsg_simple(IPMI_CHASSIS_CONTROL, &chassis_control, - sizeof(chassis_control)); + msg = ipmi_mkmsg_simple(IPMI_CHASSIS_CONTROL, &request, + sizeof(request)); if (!msg) return OPAL_HARDWARE; -- cgit v1.1