Commit 14aae78f authored by Cédric Le Goater's avatar Cédric Le Goater Committed by Michael Ellerman

powerpc/powernv: convert OPAL codes returned by sysparam calls

The opal_{get,set}_param calls return internal error codes which need
to be translated in errnos in Linux.
Signed-off-by: default avatarCédric Le Goater <clg@fr.ibm.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
parent 6f7f0b3d
...@@ -55,8 +55,10 @@ static ssize_t opal_get_sys_param(u32 param_id, u32 length, void *buffer) ...@@ -55,8 +55,10 @@ static ssize_t opal_get_sys_param(u32 param_id, u32 length, void *buffer)
} }
ret = opal_get_param(token, param_id, (u64)buffer, length); ret = opal_get_param(token, param_id, (u64)buffer, length);
if (ret != OPAL_ASYNC_COMPLETION) if (ret != OPAL_ASYNC_COMPLETION) {
ret = opal_error_code(ret);
goto out_token; goto out_token;
}
ret = opal_async_wait_response(token, &msg); ret = opal_async_wait_response(token, &msg);
if (ret) { if (ret) {
...@@ -65,7 +67,7 @@ static ssize_t opal_get_sys_param(u32 param_id, u32 length, void *buffer) ...@@ -65,7 +67,7 @@ static ssize_t opal_get_sys_param(u32 param_id, u32 length, void *buffer)
goto out_token; goto out_token;
} }
ret = be64_to_cpu(msg.params[1]); ret = opal_error_code(be64_to_cpu(msg.params[1]));
out_token: out_token:
opal_async_release_token(token); opal_async_release_token(token);
...@@ -89,8 +91,10 @@ static int opal_set_sys_param(u32 param_id, u32 length, void *buffer) ...@@ -89,8 +91,10 @@ static int opal_set_sys_param(u32 param_id, u32 length, void *buffer)
ret = opal_set_param(token, param_id, (u64)buffer, length); ret = opal_set_param(token, param_id, (u64)buffer, length);
if (ret != OPAL_ASYNC_COMPLETION) if (ret != OPAL_ASYNC_COMPLETION) {
ret = opal_error_code(ret);
goto out_token; goto out_token;
}
ret = opal_async_wait_response(token, &msg); ret = opal_async_wait_response(token, &msg);
if (ret) { if (ret) {
...@@ -99,7 +103,7 @@ static int opal_set_sys_param(u32 param_id, u32 length, void *buffer) ...@@ -99,7 +103,7 @@ static int opal_set_sys_param(u32 param_id, u32 length, void *buffer)
goto out_token; goto out_token;
} }
ret = be64_to_cpu(msg.params[1]); ret = opal_error_code(be64_to_cpu(msg.params[1]));
out_token: out_token:
opal_async_release_token(token); opal_async_release_token(token);
......
...@@ -830,6 +830,7 @@ int opal_error_code(int rc) ...@@ -830,6 +830,7 @@ int opal_error_code(int rc)
case OPAL_ASYNC_COMPLETION: return -EINPROGRESS; case OPAL_ASYNC_COMPLETION: return -EINPROGRESS;
case OPAL_BUSY_EVENT: return -EBUSY; case OPAL_BUSY_EVENT: return -EBUSY;
case OPAL_NO_MEM: return -ENOMEM; case OPAL_NO_MEM: return -ENOMEM;
case OPAL_PERMISSION: return -EPERM;
case OPAL_UNSUPPORTED: return -EIO; case OPAL_UNSUPPORTED: return -EIO;
case OPAL_HARDWARE: return -EIO; case OPAL_HARDWARE: return -EIO;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment