summaryrefslogtreecommitdiffstats
path: root/doc/opal-api/return-codes.rst
blob: 8378ee1b6b0cbac91f1696c6345e7e8ea040abd1 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
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.h.


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.

I2C Calls
---------
Added for I2C, only applicable to I2C calls: ::

  #define OPAL_I2C_TIMEOUT	-17
  #define OPAL_I2C_INVALID_CMD	-18
  #define OPAL_I2C_LBUS_PARITY	-19
  #define OPAL_I2C_BKEND_OVERRUN	-20
  #define OPAL_I2C_BKEND_ACCESS	-21
  #define OPAL_I2C_ARBT_LOST	-22
  #define OPAL_I2C_NACK_RCVD	-23
  #define OPAL_I2C_STOP_ERR	-24


OpenPOWER on IntegriCloud