powerpc/powernv: convert codes returned by OPAL calls

OPAL has its own list of return codes. The patch provides a translation
of such codes in errnos for the opal_sensor_read call, and possibly
others if needed.

Signed-off-by: Cédric Le Goater <clg@fr.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:
Cédric Le Goater
2015-03-30 12:06:09 +02:00
committed by Michael Ellerman
parent acdb66857f
commit e3c5c2e0bc
3 changed files with 25 additions and 2 deletions

View File

@ -46,8 +46,10 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
mutex_lock(&opal_sensor_mutex);
ret = opal_sensor_read(sensor_hndl, token, &data);
if (ret != OPAL_ASYNC_COMPLETION)
if (ret != OPAL_ASYNC_COMPLETION) {
ret = opal_error_code(ret);
goto out_token;
}
ret = opal_async_wait_response(token, &msg);
if (ret) {
@ -57,7 +59,7 @@ int opal_get_sensor_data(u32 sensor_hndl, u32 *sensor_data)
}
*sensor_data = be32_to_cpu(data);
ret = be64_to_cpu(msg.params[1]);
ret = opal_error_code(be64_to_cpu(msg.params[1]));
out_token:
mutex_unlock(&opal_sensor_mutex);