diff options
author | Dean Nelson <dcn@sgi.com> | 2008-05-12 17:02:02 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-05-13 11:02:23 -0400 |
commit | 65c17b801e03e40acdca0cd34e8eb1b8a347b539 (patch) | |
tree | fe5c5ccb73604d6cbd88525f930b50b8435a71a7 /drivers/misc/sgi-xp/xp.h | |
parent | 0cf942d75a6acfa11a41f63330d8780901eda4af (diff) |
drivers/misc/sgi-xp: clean up return values
Make XP return values more generic to XP and not so tied to XPC by changing
enum xpc_retval to xp_retval, along with changing return value prefixes from
xpc to xp. Also, cleanup a comment block that referenced some of these return
values as well as the handling of BTE related return values.
Signed-off-by: Dean Nelson <dcn@sgi.com>
Acked-by: Robin Holt <holt@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/misc/sgi-xp/xp.h')
-rw-r--r-- | drivers/misc/sgi-xp/xp.h | 291 |
1 files changed, 106 insertions, 185 deletions
diff --git a/drivers/misc/sgi-xp/xp.h b/drivers/misc/sgi-xp/xp.h index 5515234be86a..a258fa6705c7 100644 --- a/drivers/misc/sgi-xp/xp.h +++ b/drivers/misc/sgi-xp/xp.h | |||
@@ -157,215 +157,136 @@ struct xpc_msg { | |||
157 | /* | 157 | /* |
158 | * Define the return values and values passed to user's callout functions. | 158 | * Define the return values and values passed to user's callout functions. |
159 | * (It is important to add new value codes at the end just preceding | 159 | * (It is important to add new value codes at the end just preceding |
160 | * xpcUnknownReason, which must have the highest numerical value.) | 160 | * xpUnknownReason, which must have the highest numerical value.) |
161 | */ | 161 | */ |
162 | enum xpc_retval { | 162 | enum xp_retval { |
163 | xpcSuccess = 0, | 163 | xpSuccess = 0, |
164 | 164 | ||
165 | xpcNotConnected, /* 1: channel is not connected */ | 165 | xpNotConnected, /* 1: channel is not connected */ |
166 | xpcConnected, /* 2: channel connected (opened) */ | 166 | xpConnected, /* 2: channel connected (opened) */ |
167 | xpcRETIRED1, /* 3: (formerly xpcDisconnected) */ | 167 | xpRETIRED1, /* 3: (formerly xpDisconnected) */ |
168 | 168 | ||
169 | xpcMsgReceived, /* 4: message received */ | 169 | xpMsgReceived, /* 4: message received */ |
170 | xpcMsgDelivered, /* 5: message delivered and acknowledged */ | 170 | xpMsgDelivered, /* 5: message delivered and acknowledged */ |
171 | 171 | ||
172 | xpcRETIRED2, /* 6: (formerly xpcTransferFailed) */ | 172 | xpRETIRED2, /* 6: (formerly xpTransferFailed) */ |
173 | 173 | ||
174 | xpcNoWait, /* 7: operation would require wait */ | 174 | xpNoWait, /* 7: operation would require wait */ |
175 | xpcRetry, /* 8: retry operation */ | 175 | xpRetry, /* 8: retry operation */ |
176 | xpcTimeout, /* 9: timeout in xpc_allocate_msg_wait() */ | 176 | xpTimeout, /* 9: timeout in xpc_allocate_msg_wait() */ |
177 | xpcInterrupted, /* 10: interrupted wait */ | 177 | xpInterrupted, /* 10: interrupted wait */ |
178 | 178 | ||
179 | xpcUnequalMsgSizes, /* 11: message size disparity between sides */ | 179 | xpUnequalMsgSizes, /* 11: message size disparity between sides */ |
180 | xpcInvalidAddress, /* 12: invalid address */ | 180 | xpInvalidAddress, /* 12: invalid address */ |
181 | 181 | ||
182 | xpcNoMemory, /* 13: no memory available for XPC structures */ | 182 | xpNoMemory, /* 13: no memory available for XPC structures */ |
183 | xpcLackOfResources, /* 14: insufficient resources for operation */ | 183 | xpLackOfResources, /* 14: insufficient resources for operation */ |
184 | xpcUnregistered, /* 15: channel is not registered */ | 184 | xpUnregistered, /* 15: channel is not registered */ |
185 | xpcAlreadyRegistered, /* 16: channel is already registered */ | 185 | xpAlreadyRegistered, /* 16: channel is already registered */ |
186 | 186 | ||
187 | xpcPartitionDown, /* 17: remote partition is down */ | 187 | xpPartitionDown, /* 17: remote partition is down */ |
188 | xpcNotLoaded, /* 18: XPC module is not loaded */ | 188 | xpNotLoaded, /* 18: XPC module is not loaded */ |
189 | xpcUnloading, /* 19: this side is unloading XPC module */ | 189 | xpUnloading, /* 19: this side is unloading XPC module */ |
190 | 190 | ||
191 | xpcBadMagic, /* 20: XPC MAGIC string not found */ | 191 | xpBadMagic, /* 20: XPC MAGIC string not found */ |
192 | 192 | ||
193 | xpcReactivating, /* 21: remote partition was reactivated */ | 193 | xpReactivating, /* 21: remote partition was reactivated */ |
194 | 194 | ||
195 | xpcUnregistering, /* 22: this side is unregistering channel */ | 195 | xpUnregistering, /* 22: this side is unregistering channel */ |
196 | xpcOtherUnregistering, /* 23: other side is unregistering channel */ | 196 | xpOtherUnregistering, /* 23: other side is unregistering channel */ |
197 | 197 | ||
198 | xpcCloneKThread, /* 24: cloning kernel thread */ | 198 | xpCloneKThread, /* 24: cloning kernel thread */ |
199 | xpcCloneKThreadFailed, /* 25: cloning kernel thread failed */ | 199 | xpCloneKThreadFailed, /* 25: cloning kernel thread failed */ |
200 | 200 | ||
201 | xpcNoHeartbeat, /* 26: remote partition has no heartbeat */ | 201 | xpNoHeartbeat, /* 26: remote partition has no heartbeat */ |
202 | 202 | ||
203 | xpcPioReadError, /* 27: PIO read error */ | 203 | xpPioReadError, /* 27: PIO read error */ |
204 | xpcPhysAddrRegFailed, /* 28: registration of phys addr range failed */ | 204 | xpPhysAddrRegFailed, /* 28: registration of phys addr range failed */ |
205 | 205 | ||
206 | xpcBteDirectoryError, /* 29: maps to BTEFAIL_DIR */ | 206 | xpRETIRED3, /* 29: (formerly xpBteDirectoryError) */ |
207 | xpcBtePoisonError, /* 30: maps to BTEFAIL_POISON */ | 207 | xpRETIRED4, /* 30: (formerly xpBtePoisonError) */ |
208 | xpcBteWriteError, /* 31: maps to BTEFAIL_WERR */ | 208 | xpRETIRED5, /* 31: (formerly xpBteWriteError) */ |
209 | xpcBteAccessError, /* 32: maps to BTEFAIL_ACCESS */ | 209 | xpRETIRED6, /* 32: (formerly xpBteAccessError) */ |
210 | xpcBtePWriteError, /* 33: maps to BTEFAIL_PWERR */ | 210 | xpRETIRED7, /* 33: (formerly xpBtePWriteError) */ |
211 | xpcBtePReadError, /* 34: maps to BTEFAIL_PRERR */ | 211 | xpRETIRED8, /* 34: (formerly xpBtePReadError) */ |
212 | xpcBteTimeOutError, /* 35: maps to BTEFAIL_TOUT */ | 212 | xpRETIRED9, /* 35: (formerly xpBteTimeOutError) */ |
213 | xpcBteXtalkError, /* 36: maps to BTEFAIL_XTERR */ | 213 | xpRETIRED10, /* 36: (formerly xpBteXtalkError) */ |
214 | xpcBteNotAvailable, /* 37: maps to BTEFAIL_NOTAVAIL */ | 214 | xpRETIRED11, /* 37: (formerly xpBteNotAvailable) */ |
215 | xpcBteUnmappedError, /* 38: unmapped BTEFAIL_ error */ | 215 | xpRETIRED12, /* 38: (formerly xpBteUnmappedError) */ |
216 | 216 | ||
217 | xpcBadVersion, /* 39: bad version number */ | 217 | xpBadVersion, /* 39: bad version number */ |
218 | xpcVarsNotSet, /* 40: the XPC variables are not set up */ | 218 | xpVarsNotSet, /* 40: the XPC variables are not set up */ |
219 | xpcNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */ | 219 | xpNoRsvdPageAddr, /* 41: unable to get rsvd page's phys addr */ |
220 | xpcInvalidPartid, /* 42: invalid partition ID */ | 220 | xpInvalidPartid, /* 42: invalid partition ID */ |
221 | xpcLocalPartid, /* 43: local partition ID */ | 221 | xpLocalPartid, /* 43: local partition ID */ |
222 | 222 | ||
223 | xpcOtherGoingDown, /* 44: other side going down, reason unknown */ | 223 | xpOtherGoingDown, /* 44: other side going down, reason unknown */ |
224 | xpcSystemGoingDown, /* 45: system is going down, reason unknown */ | 224 | xpSystemGoingDown, /* 45: system is going down, reason unknown */ |
225 | xpcSystemHalt, /* 46: system is being halted */ | 225 | xpSystemHalt, /* 46: system is being halted */ |
226 | xpcSystemReboot, /* 47: system is being rebooted */ | 226 | xpSystemReboot, /* 47: system is being rebooted */ |
227 | xpcSystemPoweroff, /* 48: system is being powered off */ | 227 | xpSystemPoweroff, /* 48: system is being powered off */ |
228 | 228 | ||
229 | xpcDisconnecting, /* 49: channel disconnecting (closing) */ | 229 | xpDisconnecting, /* 49: channel disconnecting (closing) */ |
230 | 230 | ||
231 | xpcOpenCloseError, /* 50: channel open/close protocol error */ | 231 | xpOpenCloseError, /* 50: channel open/close protocol error */ |
232 | 232 | ||
233 | xpcDisconnected, /* 51: channel disconnected (closed) */ | 233 | xpDisconnected, /* 51: channel disconnected (closed) */ |
234 | 234 | ||
235 | xpcBteSh2Start, /* 52: BTE CRB timeout */ | 235 | xpBteCopyError, /* 52: bte_copy() returned error */ |
236 | 236 | ||
237 | /* 53: 0x1 BTE Error Response Short */ | 237 | xpUnknownReason /* 53: unknown reason - must be last in enum */ |
238 | xpcBteSh2RspShort = xpcBteSh2Start + BTEFAIL_SH2_RESP_SHORT, | ||
239 | |||
240 | /* 54: 0x2 BTE Error Response Long */ | ||
241 | xpcBteSh2RspLong = xpcBteSh2Start + BTEFAIL_SH2_RESP_LONG, | ||
242 | |||
243 | /* 56: 0x4 BTE Error Response DSB */ | ||
244 | xpcBteSh2RspDSB = xpcBteSh2Start + BTEFAIL_SH2_RESP_DSP, | ||
245 | |||
246 | /* 60: 0x8 BTE Error Response Access */ | ||
247 | xpcBteSh2RspAccess = xpcBteSh2Start + BTEFAIL_SH2_RESP_ACCESS, | ||
248 | |||
249 | /* 68: 0x10 BTE Error CRB timeout */ | ||
250 | xpcBteSh2CRBTO = xpcBteSh2Start + BTEFAIL_SH2_CRB_TO, | ||
251 | |||
252 | /* 84: 0x20 BTE Error NACK limit */ | ||
253 | xpcBteSh2NACKLimit = xpcBteSh2Start + BTEFAIL_SH2_NACK_LIMIT, | ||
254 | |||
255 | /* 115: BTE end */ | ||
256 | xpcBteSh2End = xpcBteSh2Start + BTEFAIL_SH2_ALL, | ||
257 | |||
258 | xpcUnknownReason /* 116: unknown reason - must be last in enum */ | ||
259 | }; | 238 | }; |
260 | 239 | ||
261 | /* | 240 | /* |
262 | * Define the callout function types used by XPC to update the user on | 241 | * Define the callout function type used by XPC to update the user on |
263 | * connection activity and state changes (via the user function registered by | 242 | * connection activity and state changes via the user function registered |
264 | * xpc_connect()) and to notify them of messages received and delivered (via | 243 | * by xpc_connect(). |
265 | * the user function registered by xpc_send_notify()). | ||
266 | * | ||
267 | * The two function types are xpc_channel_func and xpc_notify_func and | ||
268 | * both share the following arguments, with the exception of "data", which | ||
269 | * only xpc_channel_func has. | ||
270 | * | 244 | * |
271 | * Arguments: | 245 | * Arguments: |
272 | * | 246 | * |
273 | * reason - reason code. (See following table.) | 247 | * reason - reason code. |
274 | * partid - partition ID associated with condition. | 248 | * partid - partition ID associated with condition. |
275 | * ch_number - channel # associated with condition. | 249 | * ch_number - channel # associated with condition. |
276 | * data - pointer to optional data. (See following table.) | 250 | * data - pointer to optional data. |
277 | * key - pointer to optional user-defined value provided as the "key" | 251 | * key - pointer to optional user-defined value provided as the "key" |
278 | * argument to xpc_connect() or xpc_send_notify(). | 252 | * argument to xpc_connect(). |
279 | * | 253 | * |
280 | * In the following table the "Optional Data" column applies to callouts made | 254 | * A reason code of xpConnected indicates that a connection has been |
281 | * to functions registered by xpc_connect(). A "NA" in that column indicates | 255 | * established to the specified partition on the specified channel. The data |
282 | * that this reason code can be passed to functions registered by | 256 | * argument indicates the max number of entries allowed in the message queue. |
283 | * xpc_send_notify() (i.e. they don't have data arguments). | ||
284 | * | 257 | * |
285 | * Also, the first three reason codes in the following table indicate | 258 | * A reason code of xpMsgReceived indicates that a XPC message arrived from |
286 | * success, whereas the others indicate failure. When a failure reason code | 259 | * the specified partition on the specified channel. The data argument |
287 | * is received, one can assume that the channel is not connected. | 260 | * specifies the address of the message's payload. The user must call |
261 | * xpc_received() when finished with the payload. | ||
288 | * | 262 | * |
289 | * | 263 | * All other reason codes indicate failure. The data argmument is NULL. |
290 | * Reason Code | Cause | Optional Data | 264 | * When a failure reason code is received, one can assume that the channel |
291 | * =====================+================================+===================== | 265 | * is not connected. |
292 | * xpcConnected | connection has been established| max #of entries | ||
293 | * | to the specified partition on | allowed in message | ||
294 | * | the specified channel | queue | ||
295 | * ---------------------+--------------------------------+--------------------- | ||
296 | * xpcMsgReceived | an XPC message arrived from | address of payload | ||
297 | * | the specified partition on the | | ||
298 | * | specified channel | [the user must call | ||
299 | * | | xpc_received() when | ||
300 | * | | finished with the | ||
301 | * | | payload] | ||
302 | * ---------------------+--------------------------------+--------------------- | ||
303 | * xpcMsgDelivered | notification that the message | NA | ||
304 | * | was delivered to the intended | | ||
305 | * | recipient and that they have | | ||
306 | * | acknowledged its receipt by | | ||
307 | * | calling xpc_received() | | ||
308 | * =====================+================================+===================== | ||
309 | * xpcUnequalMsgSizes | can't connect to the specified | NULL | ||
310 | * | partition on the specified | | ||
311 | * | channel because of mismatched | | ||
312 | * | message sizes | | ||
313 | * ---------------------+--------------------------------+--------------------- | ||
314 | * xpcNoMemory | insufficient memory avaiable | NULL | ||
315 | * | to allocate message queue | | ||
316 | * ---------------------+--------------------------------+--------------------- | ||
317 | * xpcLackOfResources | lack of resources to create | NULL | ||
318 | * | the necessary kthreads to | | ||
319 | * | support the channel | | ||
320 | * ---------------------+--------------------------------+--------------------- | ||
321 | * xpcUnregistering | this side's user has | NULL or NA | ||
322 | * | unregistered by calling | | ||
323 | * | xpc_disconnect() | | ||
324 | * ---------------------+--------------------------------+--------------------- | ||
325 | * xpcOtherUnregistering| the other side's user has | NULL or NA | ||
326 | * | unregistered by calling | | ||
327 | * | xpc_disconnect() | | ||
328 | * ---------------------+--------------------------------+--------------------- | ||
329 | * xpcNoHeartbeat | the other side's XPC is no | NULL or NA | ||
330 | * | longer heartbeating | | ||
331 | * | | | ||
332 | * ---------------------+--------------------------------+--------------------- | ||
333 | * xpcUnloading | this side's XPC module is | NULL or NA | ||
334 | * | being unloaded | | ||
335 | * | | | ||
336 | * ---------------------+--------------------------------+--------------------- | ||
337 | * xpcOtherUnloading | the other side's XPC module is | NULL or NA | ||
338 | * | is being unloaded | | ||
339 | * | | | ||
340 | * ---------------------+--------------------------------+--------------------- | ||
341 | * xpcPioReadError | xp_nofault_PIOR() returned an | NULL or NA | ||
342 | * | error while sending an IPI | | ||
343 | * | | | ||
344 | * ---------------------+--------------------------------+--------------------- | ||
345 | * xpcInvalidAddress | the address either received or | NULL or NA | ||
346 | * | sent by the specified partition| | ||
347 | * | is invalid | | ||
348 | * ---------------------+--------------------------------+--------------------- | ||
349 | * xpcBteNotAvailable | attempt to pull data from the | NULL or NA | ||
350 | * xpcBtePoisonError | specified partition over the | | ||
351 | * xpcBteWriteError | specified channel via a | | ||
352 | * xpcBteAccessError | bte_copy() failed | | ||
353 | * xpcBteTimeOutError | | | ||
354 | * xpcBteXtalkError | | | ||
355 | * xpcBteDirectoryError | | | ||
356 | * xpcBteGenericError | | | ||
357 | * xpcBteUnmappedError | | | ||
358 | * ---------------------+--------------------------------+--------------------- | ||
359 | * xpcUnknownReason | the specified channel to the | NULL or NA | ||
360 | * | specified partition was | | ||
361 | * | unavailable for unknown reasons| | ||
362 | * =====================+================================+===================== | ||
363 | */ | 266 | */ |
364 | 267 | typedef void (*xpc_channel_func) (enum xp_retval reason, partid_t partid, | |
365 | typedef void (*xpc_channel_func) (enum xpc_retval reason, partid_t partid, | ||
366 | int ch_number, void *data, void *key); | 268 | int ch_number, void *data, void *key); |
367 | 269 | ||
368 | typedef void (*xpc_notify_func) (enum xpc_retval reason, partid_t partid, | 270 | /* |
271 | * Define the callout function type used by XPC to notify the user of | ||
272 | * messages received and delivered via the user function registered by | ||
273 | * xpc_send_notify(). | ||
274 | * | ||
275 | * Arguments: | ||
276 | * | ||
277 | * reason - reason code. | ||
278 | * partid - partition ID associated with condition. | ||
279 | * ch_number - channel # associated with condition. | ||
280 | * key - pointer to optional user-defined value provided as the "key" | ||
281 | * argument to xpc_send_notify(). | ||
282 | * | ||
283 | * A reason code of xpMsgDelivered indicates that the message was delivered | ||
284 | * to the intended recipient and that they have acknowledged its receipt by | ||
285 | * calling xpc_received(). | ||
286 | * | ||
287 | * All other reason codes indicate failure. | ||
288 | */ | ||
289 | typedef void (*xpc_notify_func) (enum xp_retval reason, partid_t partid, | ||
369 | int ch_number, void *key); | 290 | int ch_number, void *key); |
370 | 291 | ||
371 | /* | 292 | /* |
@@ -401,43 +322,43 @@ struct xpc_registration { | |||
401 | struct xpc_interface { | 322 | struct xpc_interface { |
402 | void (*connect) (int); | 323 | void (*connect) (int); |
403 | void (*disconnect) (int); | 324 | void (*disconnect) (int); |
404 | enum xpc_retval (*allocate) (partid_t, int, u32, void **); | 325 | enum xp_retval (*allocate) (partid_t, int, u32, void **); |
405 | enum xpc_retval (*send) (partid_t, int, void *); | 326 | enum xp_retval (*send) (partid_t, int, void *); |
406 | enum xpc_retval (*send_notify) (partid_t, int, void *, | 327 | enum xp_retval (*send_notify) (partid_t, int, void *, |
407 | xpc_notify_func, void *); | 328 | xpc_notify_func, void *); |
408 | void (*received) (partid_t, int, void *); | 329 | void (*received) (partid_t, int, void *); |
409 | enum xpc_retval (*partid_to_nasids) (partid_t, void *); | 330 | enum xp_retval (*partid_to_nasids) (partid_t, void *); |
410 | }; | 331 | }; |
411 | 332 | ||
412 | extern struct xpc_interface xpc_interface; | 333 | extern struct xpc_interface xpc_interface; |
413 | 334 | ||
414 | extern void xpc_set_interface(void (*)(int), | 335 | extern void xpc_set_interface(void (*)(int), |
415 | void (*)(int), | 336 | void (*)(int), |
416 | enum xpc_retval (*)(partid_t, int, u32, void **), | 337 | enum xp_retval (*)(partid_t, int, u32, void **), |
417 | enum xpc_retval (*)(partid_t, int, void *), | 338 | enum xp_retval (*)(partid_t, int, void *), |
418 | enum xpc_retval (*)(partid_t, int, void *, | 339 | enum xp_retval (*)(partid_t, int, void *, |
419 | xpc_notify_func, void *), | 340 | xpc_notify_func, void *), |
420 | void (*)(partid_t, int, void *), | 341 | void (*)(partid_t, int, void *), |
421 | enum xpc_retval (*)(partid_t, void *)); | 342 | enum xp_retval (*)(partid_t, void *)); |
422 | extern void xpc_clear_interface(void); | 343 | extern void xpc_clear_interface(void); |
423 | 344 | ||
424 | extern enum xpc_retval xpc_connect(int, xpc_channel_func, void *, u16, | 345 | extern enum xp_retval xpc_connect(int, xpc_channel_func, void *, u16, |
425 | u16, u32, u32); | 346 | u16, u32, u32); |
426 | extern void xpc_disconnect(int); | 347 | extern void xpc_disconnect(int); |
427 | 348 | ||
428 | static inline enum xpc_retval | 349 | static inline enum xp_retval |
429 | xpc_allocate(partid_t partid, int ch_number, u32 flags, void **payload) | 350 | xpc_allocate(partid_t partid, int ch_number, u32 flags, void **payload) |
430 | { | 351 | { |
431 | return xpc_interface.allocate(partid, ch_number, flags, payload); | 352 | return xpc_interface.allocate(partid, ch_number, flags, payload); |
432 | } | 353 | } |
433 | 354 | ||
434 | static inline enum xpc_retval | 355 | static inline enum xp_retval |
435 | xpc_send(partid_t partid, int ch_number, void *payload) | 356 | xpc_send(partid_t partid, int ch_number, void *payload) |
436 | { | 357 | { |
437 | return xpc_interface.send(partid, ch_number, payload); | 358 | return xpc_interface.send(partid, ch_number, payload); |
438 | } | 359 | } |
439 | 360 | ||
440 | static inline enum xpc_retval | 361 | static inline enum xp_retval |
441 | xpc_send_notify(partid_t partid, int ch_number, void *payload, | 362 | xpc_send_notify(partid_t partid, int ch_number, void *payload, |
442 | xpc_notify_func func, void *key) | 363 | xpc_notify_func func, void *key) |
443 | { | 364 | { |
@@ -450,7 +371,7 @@ xpc_received(partid_t partid, int ch_number, void *payload) | |||
450 | return xpc_interface.received(partid, ch_number, payload); | 371 | return xpc_interface.received(partid, ch_number, payload); |
451 | } | 372 | } |
452 | 373 | ||
453 | static inline enum xpc_retval | 374 | static inline enum xp_retval |
454 | xpc_partid_to_nasids(partid_t partid, void *nasids) | 375 | xpc_partid_to_nasids(partid_t partid, void *nasids) |
455 | { | 376 | { |
456 | return xpc_interface.partid_to_nasids(partid, nasids); | 377 | return xpc_interface.partid_to_nasids(partid, nasids); |