aboutsummaryrefslogtreecommitdiff
path: root/doc/opal-api/opal-read-write-tpo-dpo-103-104-105.rst
blob: 52bb67e3870a168daedaae034352f46c8ef698b9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

=========================================
OPAL Timed Power On and Delayed Power Off
=========================================

.. code-block:: c

   #define OPAL_WRITE_TPO			103
   #define OPAL_READ_TPO			104
   #define OPAL_GET_DPO_STATUS			105

TPO is a Timed Power On facility, and DPO is Delayed Power Off.

It is an OPTIONAL part of the OPAL spec.

If a platform supports Timed Power On (TPO), the RTC node in the device tree
(itself under the "ibm,opal" node will have the has-tpo property:

.. code-block:: dts

  rtc {
     compatible = "ibm,opal-rtc";
     has-tpo;
  };

If the "has-tpo" proprety is *NOT* present then OPAL does *NOT* support TPO.

.. _OPAL_READ_TPO:

OPAL_READ_TPO
=============

.. code-block:: c

   #define OPAL_READ_TPO			104

   static int64_t opal_read_tpo(uint64_t async_token, uint32_t *y_m_d, uint32_t *hr_min);


.. _OPAL_WRITE_TPO:

OPAL_WRITE_TPO
==============

.. code-block:: c

   #define OPAL_WRITE_TPO			103

   int64_t fsp_opal_tpo_write(uint64_t async_token, uint32_t y_m_d, uint32_t hr_min);


.. _OPAL_GET_DPO_STATUS:

OPAL_GET_DPO_STATUS
===================

.. code-block:: c

   #define OPAL_GET_DPO_STATUS			105

   static int64_t opal_get_dpo_status(int64_t *dpo_timeout);

A :ref:`OPAL_MSG_DPO` message may be sent to indicate that there will shortly
be a forced system shutdown. In this case, an OS can call
:ref:`OPAL_GET_DPO_STATUS` to find out how many seconds it has before power
is cut to the system.

This call could be present on systems where the service processor is integrated
with a UPS or similar.

Returns zero if Delayed Power Off is not active, positive value indicating
number of seconds remaining for a forced system shutdown. This will enable
the host to schedule for shutdown voluntarily before timeout occurs.

Returns
-------

:ref:`OPAL_SUCCESS`
     ``dpo_timeout`` is set to the number of seconds remaining before power is
     cut.
:ref:`OPAL_WRONG_STATE`
     A Delayed Power Off is not pending, ``dpo_timeout`` is set to zero.