OPAL Timed Power On and Delayed Power Off

#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:

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

If the “has-tpo” proprety is NOT present then OPAL does NOT support TPO.

OPAL_READ_TPO

#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

#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

#define OPAL_GET_DPO_STATUS                  105

static int64_t opal_get_dpo_status(int64_t *dpo_timeout);

A 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 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

OPAL_SUCCESS

dpo_timeout is set to the number of seconds remaining before power is cut.

OPAL_WRONG_STATE

A Delayed Power Off is not pending, dpo_timeout is set to zero.