OPAL API Return Codes

All OPAL calls return an integer relaying the success/failure of the OPAL call.

Success is typically indicated by OPAL_SUCCESS. Failure is always indicated by a negative return code.

Conforming host Operating Systems MUST handle return codes other than those listed here. In future OPAL versions, additional return codes may be added.

In the reference implementation (skiboot) these are all in include/opal-api.h

There have been additions to the return codes from OPAL over time. A conforming host OS should gracefully handle receiving a new error code for existing calls.

An OS running on a POWER8 system only has to know about error codes that existed when POWER8 with OPAL was introduced (indicated by YES in the POWER8 column below). Additional OPAL error codes may be returned on POWER8 systems and as such OSs need to gracefully handle unknown error codes.

An OS running on POWER9 or above must handle all error codes as they were when POWER9 was introduced. We use the placeholder “v1.0” version for “since the dawn of time” even though there never was a skiboot v1.0

Name

Return Code

POWER8 GA

POWER9 GA

skiboot version where introduced

OPAL_SUCCESS

0

YES

YES

v1.0 (initial release)

OPAL_PARAMETER

-1

YES

YES

v1.0 (initial release)

OPAL_BUSY

-2

YES

YES

v1.0 (initial release)

OPAL_PARTIAL

-3

YES

YES

v1.0 (initial release)

OPAL_CONSTRAINED

-4

YES

YES

v1.0 (initial release)

OPAL_CLOSED

-5

YES

YES

v1.0 (initial release)

OPAL_HARDWARE

-6

YES

YES

v1.0 (initial release)

OPAL_UNSUPPORTED

-7

YES

YES

v1.0 (initial release)

OPAL_PERMISSION

-8

YES

YES

v1.0 (initial release)

OPAL_NO_MEM

-9

YES

YES

v1.0 (initial release)

OPAL_RESOURCE

-10

YES

YES

v1.0 (initial release)

OPAL_INTERNAL_ERROR

-11

YES

YES

v1.0 (initial release)

OPAL_BUSY_EVENT

-12

YES

YES

v1.0 (initial release)

OPAL_HARDWARE_FROZEN

-13

YES

YES

v1.0 (initial release)

OPAL_WRONG_STATE

-14

YES

YES

v1.0 (initial release)

OPAL_ASYNC_COMPLETION

-15

YES

YES

v1.0 (initial release)

OPAL_EMPTY

-16

NO

YES

v4.0

OPAL_I2C_TIMEOUT

-17

NO

YES

skiboot-5.1.0

OPAL_I2C_INVALID

-18

NO

YES

skiboot-5.1.0

OPAL_I2C_LBUS_PARITY

-19

NO

YES

skiboot-5.1.0

OPAL_I2C_BKEND_OVERRUN

-20

NO

YES

skiboot-5.1.0

OPAL_I2C_BKEND_ACCESS

-21

NO

YES

skiboot-5.1.0

OPAL_I2C_ARBT_LOST

-22

NO

YES

skiboot-5.1.0

OPAL_I2C_NACK_RCVD

-23

NO

YES

skiboot-5.1.0

OPAL_I2C_STOP_ERR

-24

NO

YES

skiboot-5.1.0

OPAL_XSCOM_BUSY

OPAL_BUSY

NO

YES

skiboot-5.4.0

OPAL_XSCOM_CHIPLET_OFF

OPAL_WRONG_STATE

NO

YES

skiboot-5.4.0

OPAL_XSCOM_PARTIAL_GOOD

-25

NO

YES

skiboot-5.4.0

OPAL_XSCOM_ADDR_ERROR

-26

NO

YES

skiboot-5.4.0

OPAL_XSCOM_CLOCK_ERROR

-27

NO

YES

skiboot-5.4.0

OPAL_XSCOM_PARITY_ERROR

-28

NO

YES

skiboot-5.4.0

OPAL_XSCOM_TIMEOUT

-29

NO

YES

skiboot-5.4.0

OPAL_XSCOM_CTR_OFFLINED

-30

NO

YES

skiboot-5.4.0

OPAL_XIVE_PROVISIONING

-31

NO

YES

skiboot-5.5.0

OPAL_XIVE_FREE_ACTIVE

-32

NO

YES

skiboot-5.5.0

OPAL_TIMEOUT

-33

NO

YES

skiboot-5.8

The core set of return codes are:

OPAL_SUCCESS

#define OPAL_SUCCESS           0

Success!

OPAL_PARAMETER

#define OPAL_PARAMETER         -1

A parameter was invalid. This will also be returned if you call an invalid OPAL call. To determine if a specific OPAL call is supported or not, OPAL_CHECK_TOKEN should be called rather than relying on OPAL_PARAMETER being returned for an invalid token.

OPAL_BUSY

#define OPAL_BUSY            -2

Try again later. Related to OPAL_BUSY_EVENT, but OPAL_BUSY indicates that the caller need not call OPAL_POLL_EVENTS itself. TODO Clarify current situation.

OPAL_PARTIAL

#define OPAL_PARTIAL         -3

The operation partially succeeded.

OPAL_CONSTRAINED

#define OPAL_CONSTRAINED     -4

FIXME

OPAL_CLOSED

#define OPAL_CLOSED          -5

FIXME document these

OPAL_HARDWARE

#define OPAL_HARDWARE                -6

FIXME document these

OPAL_UNSUPPORTED

#define OPAL_UNSUPPORTED     -7

Unsupported operation. Non-fatal.

OPAL_PERMISSION

#define OPAL_PERMISSION              -8

Inadequate permission to perform the operation.

OPAL_NO_MEM

#define OPAL_NO_MEM          -9

Indicates a temporary or permanent lack of adequate memory to perform the operation. Ideally, this should never happen. Skiboot reserves a small amount of memory for its heap and some operations (such as I2C requests) are allocated from this heap.

If this is ever hit, you should likely file a bug.

OPAL_RESOURCE

#define OPAL_RESOURCE                -10

When trying to use a limited resource, OPAL found that there were none free. While OPAL_BUSY indicates that OPAL may soon be able to proces the requent, OPAL_RESOURCE is a more permanent error and while the resource may become available again in the future, it is not certain that it will.

OPAL_INTERNAL_ERROR

#define OPAL_INTERNAL_ERROR  -11

Something has gone wrong inside OPAL. This is likely a bug somewhere and we return OPAL_INTERNAL_ERROR for safety.

OPAL_BUSY_EVENT

#define OPAL_BUSY_EVENT              -12

The same as OPAL_BUSY but signals that the OS should call OPAL_POLL_EVENTS as that may be required to get into a state where the call will succeed.

OPAL_HARDWARE_FROZEN

#define OPAL_HARDWARE_FROZEN -13

OPAL_WRONG_STATE

#define OPAL_WRONG_STATE     -14

The requested operation requires a (hardware or software) component to be in a different state. For example, you cannot call OPAL_START_CPU on a CPU that is not currently in OPAL.

OPAL_ASYNC_COMPLETION

#define OPAL_ASYNC_COMPLETION        -15

For asynchronous calls, successfully queueing/starting executing the command is indicated by the OPAL_ASYNC_COMPLETION return code. pseudo-code for an async call:

token = opal_async_get_token();
rc = opal_async_example(foo, token);
if (rc != OPAL_ASYNC_COMPLETION)
    handle_error(rc);
rc = opal_async_wait(token);
// handle result here

OPAL_EMPTY

#define OPAL_EMPTY           -16

The call was successful and the correct result is empty. For example, the OPAL_IPMI_RECV call can succeed and return that there is no waiting IPMI message.

OPAL_I2C_TIMEOUT

#define OPAL_I2C_TIMEOUT      -17

OPAL_I2C_INVALID

#define OPAL_I2C_INVALID_CMD  -18

OPAL_I2C_LBUS_PARITY

#define OPAL_I2C_LBUS_PARITY  -19

OPAL_I2C_BKEND_OVERRUN

#define OPAL_I2C_BKEND_OVERRUN        -20

OPAL_I2C_BKEND_ACCESS

#define OPAL_I2C_BKEND_ACCESS -21

OPAL_I2C_ARBT_LOST

#define OPAL_I2C_ARBT_LOST    -22

OPAL_I2C_NACK_RCVD

#define OPAL_I2C_NACK_RCVD    -23

OPAL_I2C_STOP_ERR

#define OPAL_I2C_STOP_ERR     -24

OPAL_XSCOM_BUSY

An alias for OPAL_BUSY

OPAL_XSCOM_CHIPLET_OFF

An alias for OPAL_WRONG_STATE

OPAL_XSCOM_PARTIAL_GOOD

#define OPAL_XSCOM_PARTIAL_GOOD -25

OPAL_XSCOM_ADDR_ERROR

#define OPAL_XSCOM_ADDR_ERROR -26

OPAL_XSCOM_CLOCK_ERROR

#define OPAL_XSCOM_CLOCK_ERROR       -27

OPAL_XSCOM_PARITY_ERROR

#define OPAL_XSCOM_PARITY_ERROR      -28

OPAL_XSCOM_TIMEOUT

#define OPAL_XSCOM_TIMEOUT   -29

OPAL_XSCOM_CTR_OFFLINED

#define OPAL_XSCOM_CTR_OFFLINED      -30

OPAL_XIVE_PROVISIONING

#define OPAL_XIVE_PROVISIONING       -31

OPAL_XIVE_FREE_ACTIVE

#define OPAL_XIVE_FREE_ACTIVE        -32

OPAL_TIMEOUT

#define OPAL_TIMEOUT         -33