diff mbox series

[032/110] doc: Add example to OPAL_CEC_POWER_DOWN

Message ID 20190531061351.22973-33-stewart@linux.ibm.com
State Accepted
Headers show
Series Big documentation cleanup/expansion | expand

Commit Message

Stewart Smith May 31, 2019, 6:12 a.m. UTC
Signed-off-by: Stewart Smith <stewart@linux.ibm.com>
---
 doc/opal-api/opal-cec-power-down-5.rst | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/doc/opal-api/opal-cec-power-down-5.rst b/doc/opal-api/opal-cec-power-down-5.rst
index b4b236e2467c..7a84fce891f9 100644
--- a/doc/opal-api/opal-cec-power-down-5.rst
+++ b/doc/opal-api/opal-cec-power-down-5.rst
@@ -9,6 +9,24 @@  OPAL_CEC_POWER_DOWN
 
    int64 opal_cec_power_down(uint64 request)
 
+As powering down the system is likely an asynchronous operation that we
+have to wait for a service processor to do, :ref:`OPAL_CEC_POWER_DOWN`
+should be called like the example code below:
+
+.. code-block:: c
+
+   int rc = OPAL_BUSY;
+
+   do {
+     rc = opal_cec_power_down(0);
+     if (rc == OPAL_BUSY_EVENT)
+       opal_poll_events(NULL);
+   } while (rc == OPAL_BUSY || rc == OPAL_BUSY_EVENT);
+
+   for (;;)
+     opal_poll_events(NULL);
+
+
 Arguments
 ---------