aboutsummaryrefslogtreecommitdiff
path: root/hw/ipmi
diff options
context:
space:
mode:
authorJoel Stanley <joel@jms.id.au>2014-09-11 15:43:52 +0930
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-10-01 14:23:06 +1000
commitd3c3e88c3111ffc10eed29fbf8cc524b7a465cb2 (patch)
treead8e6ccc73c0059faa9b201f513a5fc2c22e86a4 /hw/ipmi
parent1e487eb0dd97963298a5b67b0899b36c36eb8747 (diff)
downloadskiboot-d3c3e88c3111ffc10eed29fbf8cc524b7a465cb2.zip
skiboot-d3c3e88c3111ffc10eed29fbf8cc524b7a465cb2.tar.gz
skiboot-d3c3e88c3111ffc10eed29fbf8cc524b7a465cb2.tar.bz2
ipmi: Add ipmi_present API
Similar to the use of fsp_present, this is so code can safely call functions which may not work on the platform they are running on, or as protection against calling before the device is initialised. Signed-off-by: Joel Stanley <joel@jms.id.au> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'hw/ipmi')
-rw-r--r--hw/ipmi/ipmi-power.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/ipmi/ipmi-power.c b/hw/ipmi/ipmi-power.c
index ae3c577..05c0e4c 100644
--- a/hw/ipmi/ipmi-power.c
+++ b/hw/ipmi/ipmi-power.c
@@ -22,6 +22,9 @@ int ipmi_chassis_control(uint8_t request)
{
struct ipmi_msg *msg;
+ if (!ipmi_present())
+ return OPAL_CLOSED;
+
if (request > IPMI_CHASSIS_SOFT_SHUTDOWN)
return OPAL_PARAMETER;
@@ -44,6 +47,9 @@ int ipmi_set_power_state(uint8_t system, uint8_t device)
uint8_t device;
} power_state;
+ if (!ipmi_present())
+ return OPAL_CLOSED;
+
power_state.system = system;
power_state.device = device;