Commit 3adc7a06 authored by Mark Goodwin's avatar Mark Goodwin Committed by Tony Luck

[IA64] fix SN2 hwperf error handling

Fix the error handling for the SN2 hardware perf ioctl interface.
Signed-off-by: default avatarMark Goodwin <markgw@sgi.com>
Signed-off-by: default avatarTony Luck <tony.luck@intel.com>
parent 2fc9a15b
......@@ -3,7 +3,7 @@
* License. See the file "COPYING" in the main directory of this archive
* for more details.
*
* Copyright (C) 2004 Silicon Graphics, Inc. All rights reserved.
* Copyright (C) 2004-2005 Silicon Graphics, Inc. All rights reserved.
*
* SGI Altix topology and hardware performance monitoring API.
* Mark Goodwin <markgw@sgi.com>.
......@@ -374,6 +374,42 @@ static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
return r;
}
/* map SAL hwperf error code to system error code */
static int sn_hwperf_map_err(int hwperf_err)
{
int e;
switch(hwperf_err) {
case SN_HWPERF_OP_OK:
e = 0;
break;
case SN_HWPERF_OP_NOMEM:
e = -ENOMEM;
break;
case SN_HWPERF_OP_NO_PERM:
e = -EPERM;
break;
case SN_HWPERF_OP_IO_ERROR:
e = -EIO;
break;
case SN_HWPERF_OP_BUSY:
case SN_HWPERF_OP_RECONFIGURE:
e = -EAGAIN;
break;
case SN_HWPERF_OP_INVAL:
default:
e = -EINVAL;
break;
}
return e;
}
/*
* ioctl for "sn_hwperf" misc device
*/
......@@ -511,12 +547,20 @@ sn_hwperf_ioctl(struct inode *in, struct file *fp, u32 op, u64 arg)
op_info.v0 = &v0;
op_info.op = op;
r = sn_hwperf_op_cpu(&op_info);
if (r) {
r = sn_hwperf_map_err(r);
goto error;
}
break;
default:
/* all other ops are a direct SAL call */
r = ia64_sn_hwperf_op(sn_hwperf_master_nasid, op,
a.arg, a.sz, (u64) p, 0, 0, &v0);
if (r) {
r = sn_hwperf_map_err(r);
goto error;
}
a.v0 = v0;
break;
}
......
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