diff options
-rw-r--r-- | hw/ipmi/ipmi-power.c | 10 | ||||
-rw-r--r-- | include/ipmi.h | 4 | ||||
-rw-r--r-- | platforms/bmc/palmetto.c | 18 |
3 files changed, 14 insertions, 18 deletions
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 <ipmi.h> #include <opal.h> -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; diff --git a/include/ipmi.h b/include/ipmi.h index 643dbf4..3bf343f 100644 --- a/include/ipmi.h +++ b/include/ipmi.h @@ -135,8 +135,8 @@ int ipmi_queue_msg(struct ipmi_msg *msg); /* Process a completed message */ void ipmi_cmd_done(struct ipmi_msg *msg); -/* Change the power state of the P8 */ -int64_t ipmi_opal_chassis_control(uint64_t request); +/* 28.3 Chassis Control Command. Changes the power state of the P8. */ +int ipmi_chassis_control(uint8_t request); /* Register a backend with the ipmi core. Currently we only support one. */ void ipmi_register_backend(struct ipmi_backend *backend); diff --git a/platforms/bmc/palmetto.c b/platforms/bmc/palmetto.c index 217e542..cd21726 100644 --- a/platforms/bmc/palmetto.c +++ b/platforms/bmc/palmetto.c @@ -211,21 +211,19 @@ static bool palmetto_probe(void) return true; } -static int64_t palmetto_ipmi_power_down(uint64_t request __unused) +static int64_t palmetto_ipmi_power_down(uint64_t request) { - /* Request is: - * 0 = normal - * 1 = immediate - * When doing "shutdown -h now" from linux, we get a 0. - * However, I believe at that point we are ready to shut down, - * so unconditionally tell the BMC to immediately power us down. - */ - return ipmi_opal_chassis_control(IPMI_CHASSIS_PWR_DOWN); + if (request != IPMI_CHASSIS_PWR_DOWN) { + prlog(PR_WARNING, "PLAT: unexpected shutdown request %llx\n", + request); + } + + return ipmi_chassis_control(request); } static int64_t palmetto_ipmi_reboot(void) { - return ipmi_opal_chassis_control(IPMI_CHASSIS_PWR_CYCLE); + return ipmi_chassis_control(IPMI_CHASSIS_HARD_RESET); } DECLARE_PLATFORM(palmetto) = { |