aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx
diff options
context:
space:
mode:
authorSeokmann Ju <seokmann.ju@qlogic.com>2008-07-10 19:55:55 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-07-26 15:14:40 -0400
commit246de42cfc0abc4e25585f2dca53f8226f62391c (patch)
treeb0450362acf42eaeb504a4a901d9de27250833a3 /drivers/scsi/qla2xxx
parent436a7b11234ccccd91e3000aacdbdd25bd7847a8 (diff)
[SCSI] qla2xxx: Always aquire the parent's hardware_lock.
While issuing a marker, manipulating the request/response queues and modifying the outstanding command array. Signed-off-by: Seokmann Ju <seokmann.ju@qlogic.com> Signed-off-by: Andrew Vasquez <andrew.vasquez@qlogic.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/qla2xxx')
-rw-r--r--drivers/scsi/qla2xxx/qla_init.c2
-rw-r--r--drivers/scsi/qla2xxx/qla_iocb.c23
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c10
3 files changed, 20 insertions, 15 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c
index 80f4f9de8182..4c83ff81d79b 100644
--- a/drivers/scsi/qla2xxx/qla_init.c
+++ b/drivers/scsi/qla2xxx/qla_init.c
@@ -4052,7 +4052,7 @@ qla24xx_configure_vhba(scsi_qla_host_t *ha)
4052 rval = qla2x00_fw_ready(ha->parent); 4052 rval = qla2x00_fw_ready(ha->parent);
4053 if (rval == QLA_SUCCESS) { 4053 if (rval == QLA_SUCCESS) {
4054 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags); 4054 clear_bit(RESET_MARKER_NEEDED, &ha->dpc_flags);
4055 qla2x00_marker(ha->parent, 0, 0, MK_SYNC_ALL); 4055 qla2x00_marker(ha, 0, 0, MK_SYNC_ALL);
4056 } 4056 }
4057 4057
4058 ha->flags.management_server_logged_in = 0; 4058 ha->flags.management_server_logged_in = 0;
diff --git a/drivers/scsi/qla2xxx/qla_iocb.c b/drivers/scsi/qla2xxx/qla_iocb.c
index 5489d5024673..6e14c8eaca82 100644
--- a/drivers/scsi/qla2xxx/qla_iocb.c
+++ b/drivers/scsi/qla2xxx/qla_iocb.c
@@ -269,7 +269,7 @@ qla2x00_start_scsi(srb_t *sp)
269{ 269{
270 int ret, nseg; 270 int ret, nseg;
271 unsigned long flags; 271 unsigned long flags;
272 scsi_qla_host_t *ha; 272 scsi_qla_host_t *ha, *pha;
273 struct scsi_cmnd *cmd; 273 struct scsi_cmnd *cmd;
274 uint32_t *clr_ptr; 274 uint32_t *clr_ptr;
275 uint32_t index; 275 uint32_t index;
@@ -283,6 +283,7 @@ qla2x00_start_scsi(srb_t *sp)
283 /* Setup device pointers. */ 283 /* Setup device pointers. */
284 ret = 0; 284 ret = 0;
285 ha = sp->ha; 285 ha = sp->ha;
286 pha = to_qla_parent(ha);
286 reg = &ha->iobase->isp; 287 reg = &ha->iobase->isp;
287 cmd = sp->cmd; 288 cmd = sp->cmd;
288 /* So we know we haven't pci_map'ed anything yet */ 289 /* So we know we haven't pci_map'ed anything yet */
@@ -297,7 +298,7 @@ qla2x00_start_scsi(srb_t *sp)
297 } 298 }
298 299
299 /* Acquire ring specific lock */ 300 /* Acquire ring specific lock */
300 spin_lock_irqsave(&ha->hardware_lock, flags); 301 spin_lock_irqsave(&pha->hardware_lock, flags);
301 302
302 /* Check for room in outstanding command list. */ 303 /* Check for room in outstanding command list. */
303 handle = ha->current_outstanding_cmd; 304 handle = ha->current_outstanding_cmd;
@@ -386,14 +387,14 @@ qla2x00_start_scsi(srb_t *sp)
386 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 387 ha->response_ring_ptr->signature != RESPONSE_PROCESSED)
387 qla2x00_process_response_queue(ha); 388 qla2x00_process_response_queue(ha);
388 389
389 spin_unlock_irqrestore(&ha->hardware_lock, flags); 390 spin_unlock_irqrestore(&pha->hardware_lock, flags);
390 return (QLA_SUCCESS); 391 return (QLA_SUCCESS);
391 392
392queuing_error: 393queuing_error:
393 if (tot_dsds) 394 if (tot_dsds)
394 scsi_dma_unmap(cmd); 395 scsi_dma_unmap(cmd);
395 396
396 spin_unlock_irqrestore(&ha->hardware_lock, flags); 397 spin_unlock_irqrestore(&pha->hardware_lock, flags);
397 398
398 return (QLA_FUNCTION_FAILED); 399 return (QLA_FUNCTION_FAILED);
399} 400}
@@ -454,10 +455,11 @@ qla2x00_marker(scsi_qla_host_t *ha, uint16_t loop_id, uint16_t lun,
454{ 455{
455 int ret; 456 int ret;
456 unsigned long flags = 0; 457 unsigned long flags = 0;
458 scsi_qla_host_t *pha = to_qla_parent(ha);
457 459
458 spin_lock_irqsave(&ha->hardware_lock, flags); 460 spin_lock_irqsave(&pha->hardware_lock, flags);
459 ret = __qla2x00_marker(ha, loop_id, lun, type); 461 ret = __qla2x00_marker(ha, loop_id, lun, type);
460 spin_unlock_irqrestore(&ha->hardware_lock, flags); 462 spin_unlock_irqrestore(&pha->hardware_lock, flags);
461 463
462 return (ret); 464 return (ret);
463} 465}
@@ -672,7 +674,7 @@ qla24xx_start_scsi(srb_t *sp)
672{ 674{
673 int ret, nseg; 675 int ret, nseg;
674 unsigned long flags; 676 unsigned long flags;
675 scsi_qla_host_t *ha; 677 scsi_qla_host_t *ha, *pha;
676 struct scsi_cmnd *cmd; 678 struct scsi_cmnd *cmd;
677 uint32_t *clr_ptr; 679 uint32_t *clr_ptr;
678 uint32_t index; 680 uint32_t index;
@@ -686,6 +688,7 @@ qla24xx_start_scsi(srb_t *sp)
686 /* Setup device pointers. */ 688 /* Setup device pointers. */
687 ret = 0; 689 ret = 0;
688 ha = sp->ha; 690 ha = sp->ha;
691 pha = to_qla_parent(ha);
689 reg = &ha->iobase->isp24; 692 reg = &ha->iobase->isp24;
690 cmd = sp->cmd; 693 cmd = sp->cmd;
691 /* So we know we haven't pci_map'ed anything yet */ 694 /* So we know we haven't pci_map'ed anything yet */
@@ -700,7 +703,7 @@ qla24xx_start_scsi(srb_t *sp)
700 } 703 }
701 704
702 /* Acquire ring specific lock */ 705 /* Acquire ring specific lock */
703 spin_lock_irqsave(&ha->hardware_lock, flags); 706 spin_lock_irqsave(&pha->hardware_lock, flags);
704 707
705 /* Check for room in outstanding command list. */ 708 /* Check for room in outstanding command list. */
706 handle = ha->current_outstanding_cmd; 709 handle = ha->current_outstanding_cmd;
@@ -795,14 +798,14 @@ qla24xx_start_scsi(srb_t *sp)
795 ha->response_ring_ptr->signature != RESPONSE_PROCESSED) 798 ha->response_ring_ptr->signature != RESPONSE_PROCESSED)
796 qla24xx_process_response_queue(ha); 799 qla24xx_process_response_queue(ha);
797 800
798 spin_unlock_irqrestore(&ha->hardware_lock, flags); 801 spin_unlock_irqrestore(&pha->hardware_lock, flags);
799 return QLA_SUCCESS; 802 return QLA_SUCCESS;
800 803
801queuing_error: 804queuing_error:
802 if (tot_dsds) 805 if (tot_dsds)
803 scsi_dma_unmap(cmd); 806 scsi_dma_unmap(cmd);
804 807
805 spin_unlock_irqrestore(&ha->hardware_lock, flags); 808 spin_unlock_irqrestore(&pha->hardware_lock, flags);
806 809
807 return QLA_FUNCTION_FAILED; 810 return QLA_FUNCTION_FAILED;
808} 811}
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index 250d2f604397..dc5788bbc549 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -749,17 +749,18 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp)
749 uint32_t handle; 749 uint32_t handle;
750 mbx_cmd_t mc; 750 mbx_cmd_t mc;
751 mbx_cmd_t *mcp = &mc; 751 mbx_cmd_t *mcp = &mc;
752 scsi_qla_host_t *pha = to_qla_parent(ha);
752 753
753 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no)); 754 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no));
754 755
755 fcport = sp->fcport; 756 fcport = sp->fcport;
756 757
757 spin_lock_irqsave(&ha->hardware_lock, flags); 758 spin_lock_irqsave(&pha->hardware_lock, flags);
758 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 759 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
759 if (ha->outstanding_cmds[handle] == sp) 760 if (ha->outstanding_cmds[handle] == sp)
760 break; 761 break;
761 } 762 }
762 spin_unlock_irqrestore(&ha->hardware_lock, flags); 763 spin_unlock_irqrestore(&pha->hardware_lock, flags);
763 764
764 if (handle == MAX_OUTSTANDING_COMMANDS) { 765 if (handle == MAX_OUTSTANDING_COMMANDS) {
765 /* command not found */ 766 /* command not found */
@@ -2161,17 +2162,18 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
2161 struct abort_entry_24xx *abt; 2162 struct abort_entry_24xx *abt;
2162 dma_addr_t abt_dma; 2163 dma_addr_t abt_dma;
2163 uint32_t handle; 2164 uint32_t handle;
2165 scsi_qla_host_t *pha = to_qla_parent(ha);
2164 2166
2165 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no)); 2167 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2166 2168
2167 fcport = sp->fcport; 2169 fcport = sp->fcport;
2168 2170
2169 spin_lock_irqsave(&ha->hardware_lock, flags); 2171 spin_lock_irqsave(&pha->hardware_lock, flags);
2170 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) { 2172 for (handle = 1; handle < MAX_OUTSTANDING_COMMANDS; handle++) {
2171 if (ha->outstanding_cmds[handle] == sp) 2173 if (ha->outstanding_cmds[handle] == sp)
2172 break; 2174 break;
2173 } 2175 }
2174 spin_unlock_irqrestore(&ha->hardware_lock, flags); 2176 spin_unlock_irqrestore(&pha->hardware_lock, flags);
2175 if (handle == MAX_OUTSTANDING_COMMANDS) { 2177 if (handle == MAX_OUTSTANDING_COMMANDS) {
2176 /* Command not found. */ 2178 /* Command not found. */
2177 return QLA_FUNCTION_FAILED; 2179 return QLA_FUNCTION_FAILED;