aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/mpt3sas/mpt3sas_ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/mpt3sas/mpt3sas_ctl.c')
-rw-r--r--drivers/scsi/mpt3sas/mpt3sas_ctl.c49
1 files changed, 19 insertions, 30 deletions
diff --git a/drivers/scsi/mpt3sas/mpt3sas_ctl.c b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
index 7d00f09666b6..26cdc127ac89 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_ctl.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_ctl.c
@@ -518,7 +518,7 @@ mpt3sas_ctl_reset_handler(struct MPT3SAS_ADAPTER *ioc, int reset_phase)
518 * 518 *
519 * Called when application request fasyn callback handler. 519 * Called when application request fasyn callback handler.
520 */ 520 */
521int 521static int
522_ctl_fasync(int fd, struct file *filep, int mode) 522_ctl_fasync(int fd, struct file *filep, int mode)
523{ 523{
524 return fasync_helper(fd, filep, mode, &async_queue); 524 return fasync_helper(fd, filep, mode, &async_queue);
@@ -530,7 +530,7 @@ _ctl_fasync(int fd, struct file *filep, int mode)
530 * @wait - 530 * @wait -
531 * 531 *
532 */ 532 */
533unsigned int 533static unsigned int
534_ctl_poll(struct file *filep, poll_table *wait) 534_ctl_poll(struct file *filep, poll_table *wait)
535{ 535{
536 struct MPT3SAS_ADAPTER *ioc; 536 struct MPT3SAS_ADAPTER *ioc;
@@ -641,9 +641,8 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
641 MPI2RequestHeader_t *mpi_request = NULL, *request; 641 MPI2RequestHeader_t *mpi_request = NULL, *request;
642 MPI2DefaultReply_t *mpi_reply; 642 MPI2DefaultReply_t *mpi_reply;
643 u32 ioc_state; 643 u32 ioc_state;
644 u16 ioc_status;
645 u16 smid; 644 u16 smid;
646 unsigned long timeout, timeleft; 645 unsigned long timeout;
647 u8 issue_reset; 646 u8 issue_reset;
648 u32 sz; 647 u32 sz;
649 void *psge; 648 void *psge;
@@ -914,8 +913,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
914 timeout = MPT3_IOCTL_DEFAULT_TIMEOUT; 913 timeout = MPT3_IOCTL_DEFAULT_TIMEOUT;
915 else 914 else
916 timeout = karg.timeout; 915 timeout = karg.timeout;
917 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 916 wait_for_completion_timeout(&ioc->ctl_cmds.done, timeout*HZ);
918 timeout*HZ);
919 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) { 917 if (mpi_request->Function == MPI2_FUNCTION_SCSI_TASK_MGMT) {
920 Mpi2SCSITaskManagementRequest_t *tm_request = 918 Mpi2SCSITaskManagementRequest_t *tm_request =
921 (Mpi2SCSITaskManagementRequest_t *)mpi_request; 919 (Mpi2SCSITaskManagementRequest_t *)mpi_request;
@@ -938,7 +936,6 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
938 } 936 }
939 937
940 mpi_reply = ioc->ctl_cmds.reply; 938 mpi_reply = ioc->ctl_cmds.reply;
941 ioc_status = le16_to_cpu(mpi_reply->IOCStatus) & MPI2_IOCSTATUS_MASK;
942 939
943 if (mpi_reply->Function == MPI2_FUNCTION_SCSI_TASK_MGMT && 940 if (mpi_reply->Function == MPI2_FUNCTION_SCSI_TASK_MGMT &&
944 (ioc->logging_level & MPT_DEBUG_TM)) { 941 (ioc->logging_level & MPT_DEBUG_TM)) {
@@ -1001,13 +998,11 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,
1001 ioc->name, 998 ioc->name,
1002 le16_to_cpu(mpi_request->FunctionDependent1)); 999 le16_to_cpu(mpi_request->FunctionDependent1));
1003 mpt3sas_halt_firmware(ioc); 1000 mpt3sas_halt_firmware(ioc);
1004 mpt3sas_scsih_issue_tm(ioc, 1001 mpt3sas_scsih_issue_locked_tm(ioc,
1005 le16_to_cpu(mpi_request->FunctionDependent1), 0, 0, 1002 le16_to_cpu(mpi_request->FunctionDependent1), 0, 0,
1006 0, MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 0, 30, 1003 0, MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET, 0, 30);
1007 TM_MUTEX_ON);
1008 } else 1004 } else
1009 mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, 1005 mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1010 FORCE_BIG_HAMMER);
1011 } 1006 }
1012 1007
1013 out: 1008 out:
@@ -1220,8 +1215,7 @@ _ctl_do_reset(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
1220 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name, 1215 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s: enter\n", ioc->name,
1221 __func__)); 1216 __func__));
1222 1217
1223 retval = mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, 1218 retval = mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1224 FORCE_BIG_HAMMER);
1225 pr_info(MPT3SAS_FMT "host reset: %s\n", 1219 pr_info(MPT3SAS_FMT "host reset: %s\n",
1226 ioc->name, ((!retval) ? "SUCCESS" : "FAILED")); 1220 ioc->name, ((!retval) ? "SUCCESS" : "FAILED"));
1227 return 0; 1221 return 0;
@@ -1381,7 +1375,6 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
1381 Mpi2DiagBufferPostRequest_t *mpi_request; 1375 Mpi2DiagBufferPostRequest_t *mpi_request;
1382 Mpi2DiagBufferPostReply_t *mpi_reply; 1376 Mpi2DiagBufferPostReply_t *mpi_reply;
1383 u8 buffer_type; 1377 u8 buffer_type;
1384 unsigned long timeleft;
1385 u16 smid; 1378 u16 smid;
1386 u16 ioc_status; 1379 u16 ioc_status;
1387 u32 ioc_state; 1380 u32 ioc_state;
@@ -1499,7 +1492,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
1499 1492
1500 init_completion(&ioc->ctl_cmds.done); 1493 init_completion(&ioc->ctl_cmds.done);
1501 mpt3sas_base_put_smid_default(ioc, smid); 1494 mpt3sas_base_put_smid_default(ioc, smid);
1502 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 1495 wait_for_completion_timeout(&ioc->ctl_cmds.done,
1503 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); 1496 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
1504 1497
1505 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { 1498 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -1538,8 +1531,7 @@ _ctl_diag_register_2(struct MPT3SAS_ADAPTER *ioc,
1538 1531
1539 issue_host_reset: 1532 issue_host_reset:
1540 if (issue_reset) 1533 if (issue_reset)
1541 mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, 1534 mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1542 FORCE_BIG_HAMMER);
1543 1535
1544 out: 1536 out:
1545 1537
@@ -1800,7 +1792,6 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
1800 u16 ioc_status; 1792 u16 ioc_status;
1801 u32 ioc_state; 1793 u32 ioc_state;
1802 int rc; 1794 int rc;
1803 unsigned long timeleft;
1804 1795
1805 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name, 1796 dctlprintk(ioc, pr_info(MPT3SAS_FMT "%s\n", ioc->name,
1806 __func__)); 1797 __func__));
@@ -1848,7 +1839,7 @@ mpt3sas_send_diag_release(struct MPT3SAS_ADAPTER *ioc, u8 buffer_type,
1848 1839
1849 init_completion(&ioc->ctl_cmds.done); 1840 init_completion(&ioc->ctl_cmds.done);
1850 mpt3sas_base_put_smid_default(ioc, smid); 1841 mpt3sas_base_put_smid_default(ioc, smid);
1851 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 1842 wait_for_completion_timeout(&ioc->ctl_cmds.done,
1852 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); 1843 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
1853 1844
1854 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { 1845 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -1974,8 +1965,7 @@ _ctl_diag_release(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
1974 rc = mpt3sas_send_diag_release(ioc, buffer_type, &issue_reset); 1965 rc = mpt3sas_send_diag_release(ioc, buffer_type, &issue_reset);
1975 1966
1976 if (issue_reset) 1967 if (issue_reset)
1977 mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, 1968 mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
1978 FORCE_BIG_HAMMER);
1979 1969
1980 return rc; 1970 return rc;
1981} 1971}
@@ -1995,7 +1985,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
1995 Mpi2DiagBufferPostReply_t *mpi_reply; 1985 Mpi2DiagBufferPostReply_t *mpi_reply;
1996 int rc, i; 1986 int rc, i;
1997 u8 buffer_type; 1987 u8 buffer_type;
1998 unsigned long timeleft, request_size, copy_size; 1988 unsigned long request_size, copy_size;
1999 u16 smid; 1989 u16 smid;
2000 u16 ioc_status; 1990 u16 ioc_status;
2001 u8 issue_reset = 0; 1991 u8 issue_reset = 0;
@@ -2116,7 +2106,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
2116 2106
2117 init_completion(&ioc->ctl_cmds.done); 2107 init_completion(&ioc->ctl_cmds.done);
2118 mpt3sas_base_put_smid_default(ioc, smid); 2108 mpt3sas_base_put_smid_default(ioc, smid);
2119 timeleft = wait_for_completion_timeout(&ioc->ctl_cmds.done, 2109 wait_for_completion_timeout(&ioc->ctl_cmds.done,
2120 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ); 2110 MPT3_IOCTL_DEFAULT_TIMEOUT*HZ);
2121 2111
2122 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) { 2112 if (!(ioc->ctl_cmds.status & MPT3_CMD_COMPLETE)) {
@@ -2155,8 +2145,7 @@ _ctl_diag_read_buffer(struct MPT3SAS_ADAPTER *ioc, void __user *arg)
2155 2145
2156 issue_host_reset: 2146 issue_host_reset:
2157 if (issue_reset) 2147 if (issue_reset)
2158 mpt3sas_base_hard_reset_handler(ioc, CAN_SLEEP, 2148 mpt3sas_base_hard_reset_handler(ioc, FORCE_BIG_HAMMER);
2159 FORCE_BIG_HAMMER);
2160 2149
2161 out: 2150 out:
2162 2151
@@ -2352,7 +2341,7 @@ out_unlock_pciaccess:
2352 * @cmd - ioctl opcode 2341 * @cmd - ioctl opcode
2353 * @arg - 2342 * @arg -
2354 */ 2343 */
2355long 2344static long
2356_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2345_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2357{ 2346{
2358 long ret; 2347 long ret;
@@ -2372,7 +2361,7 @@ _ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2372 * @cmd - ioctl opcode 2361 * @cmd - ioctl opcode
2373 * @arg - 2362 * @arg -
2374 */ 2363 */
2375long 2364static long
2376_ctl_mpt2_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 2365_ctl_mpt2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2377{ 2366{
2378 long ret; 2367 long ret;
@@ -2392,7 +2381,7 @@ _ctl_mpt2_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
2392 * 2381 *
2393 * This routine handles 32 bit applications in 64bit os. 2382 * This routine handles 32 bit applications in 64bit os.
2394 */ 2383 */
2395long 2384static long
2396_ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) 2385_ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
2397{ 2386{
2398 long ret; 2387 long ret;
@@ -2410,7 +2399,7 @@ _ctl_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
2410 * 2399 *
2411 * This routine handles 32 bit applications in 64bit os. 2400 * This routine handles 32 bit applications in 64bit os.
2412 */ 2401 */
2413long 2402static long
2414_ctl_mpt2_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg) 2403_ctl_mpt2_ioctl_compat(struct file *file, unsigned cmd, unsigned long arg)
2415{ 2404{
2416 long ret; 2405 long ret;