powerpc/opal: Add inline function to get rc from an ASYNC_COMP opal_msg

An opal_msg of type OPAL_MSG_ASYNC_COMP contains the return code in the
params[1] struct member. However this isn't intuitive or obvious when
reading the code and requires that a user look at the skiboot
documentation or opal-api.h to verify this.

Add an inline function to get the return code from an opal_msg and update
call sites accordingly.

Signed-off-by: Suraj Jitindar Singh <sjitindarsingh@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Suraj Jitindar Singh
2016-06-29 13:38:38 +10:00
committed by Michael Ellerman
parent 1ae88fd54c
commit d0226d315d
7 changed files with 16 additions and 8 deletions

View File

@@ -282,6 +282,14 @@ extern int opal_error_code(int rc);
ssize_t opal_msglog_copy(char *to, loff_t pos, size_t count);
static inline int opal_get_async_rc(struct opal_msg msg)
{
if (msg.msg_type != OPAL_MSG_ASYNC_COMP)
return OPAL_PARAMETER;
else
return be64_to_cpu(msg.params[1]);
}
#endif /* __ASSEMBLY__ */
#endif /* _ASM_POWERPC_OPAL_H */