aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_mbx.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_mbx.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_mbx.c280
1 files changed, 180 insertions, 100 deletions
diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c
index d6cb3bd1a29a..879f281e2ea2 100644
--- a/drivers/scsi/qla2xxx/qla_mbx.c
+++ b/drivers/scsi/qla2xxx/qla_mbx.c
@@ -13,13 +13,13 @@ qla2x00_mbx_sem_timeout(unsigned long data)
13{ 13{
14 struct semaphore *sem_ptr = (struct semaphore *)data; 14 struct semaphore *sem_ptr = (struct semaphore *)data;
15 15
16 DEBUG11(printk("qla2x00_sem_timeout: entered.\n");) 16 DEBUG11(printk("qla2x00_sem_timeout: entered.\n"));
17 17
18 if (sem_ptr != NULL) { 18 if (sem_ptr != NULL) {
19 up(sem_ptr); 19 up(sem_ptr);
20 } 20 }
21 21
22 DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n");) 22 DEBUG11(printk("qla2x00_mbx_sem_timeout: exiting.\n"));
23} 23}
24 24
25/* 25/*
@@ -61,7 +61,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
61 rval = QLA_SUCCESS; 61 rval = QLA_SUCCESS;
62 abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); 62 abort_active = test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
63 63
64 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 64 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
65 65
66 /* 66 /*
67 * Wait for active mailbox commands to finish by waiting at most tov 67 * Wait for active mailbox commands to finish by waiting at most tov
@@ -72,7 +72,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
72 if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) { 72 if (qla2x00_down_timeout(&ha->mbx_cmd_sem, mcp->tov * HZ)) {
73 /* Timeout occurred. Return error. */ 73 /* Timeout occurred. Return error. */
74 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. " 74 DEBUG2_3_11(printk("%s(%ld): cmd access timeout. "
75 "Exiting.\n", __func__, ha->host_no);) 75 "Exiting.\n", __func__, ha->host_no));
76 return QLA_FUNCTION_TIMEOUT; 76 return QLA_FUNCTION_TIMEOUT;
77 } 77 }
78 } 78 }
@@ -86,7 +86,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
86 spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags); 86 spin_lock_irqsave(&ha->mbx_reg_lock, mbx_flags);
87 87
88 DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n", 88 DEBUG11(printk("scsi(%ld): prepare to issue mbox cmd=0x%x.\n",
89 ha->host_no, mcp->mb[0]);) 89 ha->host_no, mcp->mb[0]));
90 90
91 spin_lock_irqsave(&ha->hardware_lock, flags); 91 spin_lock_irqsave(&ha->hardware_lock, flags);
92 92
@@ -131,14 +131,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
131 131
132 /* Unlock mbx registers and wait for interrupt */ 132 /* Unlock mbx registers and wait for interrupt */
133 DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. " 133 DEBUG11(printk("%s(%ld): going to unlock irq & waiting for interrupt. "
134 "jiffies=%lx.\n", __func__, ha->host_no, jiffies);) 134 "jiffies=%lx.\n", __func__, ha->host_no, jiffies));
135 135
136 /* Wait for mbx cmd completion until timeout */ 136 /* Wait for mbx cmd completion until timeout */
137 137
138 if (!abort_active && io_lock_on) { 138 if (!abort_active && io_lock_on) {
139 /* sleep on completion semaphore */ 139 /* sleep on completion semaphore */
140 DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n", 140 DEBUG11(printk("%s(%ld): INTERRUPT MODE. Initializing timer.\n",
141 __func__, ha->host_no);) 141 __func__, ha->host_no));
142 142
143 init_timer(&tmp_intr_timer); 143 init_timer(&tmp_intr_timer);
144 tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem; 144 tmp_intr_timer.data = (unsigned long)&ha->mbx_intr_sem;
@@ -147,11 +147,11 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
147 (void (*)(unsigned long))qla2x00_mbx_sem_timeout; 147 (void (*)(unsigned long))qla2x00_mbx_sem_timeout;
148 148
149 DEBUG11(printk("%s(%ld): Adding timer.\n", __func__, 149 DEBUG11(printk("%s(%ld): Adding timer.\n", __func__,
150 ha->host_no);) 150 ha->host_no));
151 add_timer(&tmp_intr_timer); 151 add_timer(&tmp_intr_timer);
152 152
153 DEBUG11(printk("%s(%ld): going to unlock & sleep. " 153 DEBUG11(printk("%s(%ld): going to unlock & sleep. "
154 "time=0x%lx.\n", __func__, ha->host_no, jiffies);) 154 "time=0x%lx.\n", __func__, ha->host_no, jiffies));
155 155
156 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 156 set_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
157 157
@@ -170,14 +170,14 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
170 down(&ha->mbx_intr_sem); 170 down(&ha->mbx_intr_sem);
171 171
172 DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__, 172 DEBUG11(printk("%s(%ld): waking up. time=0x%lx\n", __func__,
173 ha->host_no, jiffies);) 173 ha->host_no, jiffies));
174 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags); 174 clear_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags);
175 175
176 /* delete the timer */ 176 /* delete the timer */
177 del_timer(&tmp_intr_timer); 177 del_timer(&tmp_intr_timer);
178 } else { 178 } else {
179 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__, 179 DEBUG3_11(printk("%s(%ld): cmd=%x POLLING MODE.\n", __func__,
180 ha->host_no, command);) 180 ha->host_no, command));
181 181
182 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) 182 if (IS_QLA24XX(ha) || IS_QLA54XX(ha))
183 WRT_REG_DWORD(&reg->isp24.hccr, HCCRX_SET_HOST_INT); 183 WRT_REG_DWORD(&reg->isp24.hccr, HCCRX_SET_HOST_INT);
@@ -209,7 +209,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
209 uint16_t *iptr2; 209 uint16_t *iptr2;
210 210
211 DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__, 211 DEBUG3_11(printk("%s(%ld): cmd %x completed.\n", __func__,
212 ha->host_no, command);) 212 ha->host_no, command));
213 213
214 /* Got interrupt. Clear the flag. */ 214 /* Got interrupt. Clear the flag. */
215 ha->flags.mbox_int = 0; 215 ha->flags.mbox_int = 0;
@@ -266,7 +266,7 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
266 266
267 if (!abort_active) { 267 if (!abort_active) {
268 DEBUG11(printk("%s(%ld): checking for additional resp " 268 DEBUG11(printk("%s(%ld): checking for additional resp "
269 "interrupt.\n", __func__, ha->host_no);) 269 "interrupt.\n", __func__, ha->host_no));
270 270
271 /* polling mode for non isp_abort commands. */ 271 /* polling mode for non isp_abort commands. */
272 qla2x00_poll(ha); 272 qla2x00_poll(ha);
@@ -277,9 +277,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
277 if (!io_lock_on || (mcp->flags & IOCTL_CMD)) { 277 if (!io_lock_on || (mcp->flags & IOCTL_CMD)) {
278 /* not in dpc. schedule it for dpc to take over. */ 278 /* not in dpc. schedule it for dpc to take over. */
279 DEBUG(printk("%s(%ld): timeout schedule " 279 DEBUG(printk("%s(%ld): timeout schedule "
280 "isp_abort_needed.\n", __func__, ha->host_no);) 280 "isp_abort_needed.\n", __func__, ha->host_no));
281 DEBUG2_3_11(printk("%s(%ld): timeout schedule " 281 DEBUG2_3_11(printk("%s(%ld): timeout schedule "
282 "isp_abort_needed.\n", __func__, ha->host_no);) 282 "isp_abort_needed.\n", __func__, ha->host_no));
283 qla_printk(KERN_WARNING, ha, 283 qla_printk(KERN_WARNING, ha,
284 "Mailbox command timeout occured. Scheduling ISP " 284 "Mailbox command timeout occured. Scheduling ISP "
285 "abort.\n"); 285 "abort.\n");
@@ -288,9 +288,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
288 } else if (!abort_active) { 288 } else if (!abort_active) {
289 /* call abort directly since we are in the DPC thread */ 289 /* call abort directly since we are in the DPC thread */
290 DEBUG(printk("%s(%ld): timeout calling abort_isp\n", 290 DEBUG(printk("%s(%ld): timeout calling abort_isp\n",
291 __func__, ha->host_no);) 291 __func__, ha->host_no));
292 DEBUG2_3_11(printk("%s(%ld): timeout calling " 292 DEBUG2_3_11(printk("%s(%ld): timeout calling "
293 "abort_isp\n", __func__, ha->host_no);) 293 "abort_isp\n", __func__, ha->host_no));
294 qla_printk(KERN_WARNING, ha, 294 qla_printk(KERN_WARNING, ha,
295 "Mailbox command timeout occured. Issuing ISP " 295 "Mailbox command timeout occured. Issuing ISP "
296 "abort.\n"); 296 "abort.\n");
@@ -303,9 +303,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
303 } 303 }
304 clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags); 304 clear_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags);
305 DEBUG(printk("%s(%ld): finished abort_isp\n", __func__, 305 DEBUG(printk("%s(%ld): finished abort_isp\n", __func__,
306 ha->host_no);) 306 ha->host_no));
307 DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n", 307 DEBUG2_3_11(printk("%s(%ld): finished abort_isp\n",
308 __func__, ha->host_no);) 308 __func__, ha->host_no));
309 } 309 }
310 } 310 }
311 311
@@ -316,9 +316,9 @@ qla2x00_mailbox_command(scsi_qla_host_t *ha, mbx_cmd_t *mcp)
316 if (rval) { 316 if (rval) {
317 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, " 317 DEBUG2_3_11(printk("%s(%ld): **** FAILED. mbx0=%x, mbx1=%x, "
318 "mbx2=%x, cmd=%x ****\n", __func__, ha->host_no, 318 "mbx2=%x, cmd=%x ****\n", __func__, ha->host_no,
319 mcp->mb[0], mcp->mb[1], mcp->mb[2], command);) 319 mcp->mb[0], mcp->mb[1], mcp->mb[2], command));
320 } else { 320 } else {
321 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 321 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
322 } 322 }
323 323
324 return rval; 324 return rval;
@@ -394,7 +394,7 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr)
394 mbx_cmd_t mc; 394 mbx_cmd_t mc;
395 mbx_cmd_t *mcp = &mc; 395 mbx_cmd_t *mcp = &mc;
396 396
397 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 397 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
398 398
399 mcp->mb[0] = MBC_EXECUTE_FIRMWARE; 399 mcp->mb[0] = MBC_EXECUTE_FIRMWARE;
400 mcp->out_mb = MBX_0; 400 mcp->out_mb = MBX_0;
@@ -424,10 +424,10 @@ qla2x00_execute_fw(scsi_qla_host_t *ha, uint32_t risc_addr)
424 } else { 424 } else {
425 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { 425 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
426 DEBUG11(printk("%s(%ld): done exchanges=%x.\n", 426 DEBUG11(printk("%s(%ld): done exchanges=%x.\n",
427 __func__, ha->host_no, mcp->mb[1]);) 427 __func__, ha->host_no, mcp->mb[1]));
428 } else { 428 } else {
429 DEBUG11(printk("%s(%ld): done.\n", __func__, 429 DEBUG11(printk("%s(%ld): done.\n", __func__,
430 ha->host_no);) 430 ha->host_no));
431 } 431 }
432 } 432 }
433 433
@@ -611,7 +611,7 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha)
611 mbx_cmd_t mc; 611 mbx_cmd_t mc;
612 mbx_cmd_t *mcp = &mc; 612 mbx_cmd_t *mcp = &mc;
613 613
614 DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", ha->host_no);) 614 DEBUG11(printk("qla2x00_mbx_reg_test(%ld): entered.\n", ha->host_no));
615 615
616 mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST; 616 mcp->mb[0] = MBC_MAILBOX_REGISTER_TEST;
617 mcp->mb[1] = 0xAAAA; 617 mcp->mb[1] = 0xAAAA;
@@ -639,11 +639,11 @@ qla2x00_mbx_reg_test(scsi_qla_host_t *ha)
639 if (rval != QLA_SUCCESS) { 639 if (rval != QLA_SUCCESS) {
640 /*EMPTY*/ 640 /*EMPTY*/
641 DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n", 641 DEBUG2_3_11(printk("qla2x00_mbx_reg_test(%ld): failed=%x.\n",
642 ha->host_no, rval);) 642 ha->host_no, rval));
643 } else { 643 } else {
644 /*EMPTY*/ 644 /*EMPTY*/
645 DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n", 645 DEBUG11(printk("qla2x00_mbx_reg_test(%ld): done.\n",
646 ha->host_no);) 646 ha->host_no));
647 } 647 }
648 648
649 return rval; 649 return rval;
@@ -671,7 +671,7 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr)
671 mbx_cmd_t mc; 671 mbx_cmd_t mc;
672 mbx_cmd_t *mcp = &mc; 672 mbx_cmd_t *mcp = &mc;
673 673
674 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 674 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
675 675
676 mcp->mb[0] = MBC_VERIFY_CHECKSUM; 676 mcp->mb[0] = MBC_VERIFY_CHECKSUM;
677 mcp->out_mb = MBX_0; 677 mcp->out_mb = MBX_0;
@@ -694,9 +694,9 @@ qla2x00_verify_checksum(scsi_qla_host_t *ha, uint32_t risc_addr)
694 if (rval != QLA_SUCCESS) { 694 if (rval != QLA_SUCCESS) {
695 DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__, 695 DEBUG2_3_11(printk("%s(%ld): failed=%x chk sum=%x.\n", __func__,
696 ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA54XX(ha) ? 696 ha->host_no, rval, (IS_QLA24XX(ha) || IS_QLA54XX(ha) ?
697 (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1]));) 697 (mcp->mb[2] << 16) | mcp->mb[1]: mcp->mb[1])));
698 } else { 698 } else {
699 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 699 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
700 } 700 }
701 701
702 return rval; 702 return rval;
@@ -743,9 +743,9 @@ qla2x00_issue_iocb(scsi_qla_host_t *ha, void* buffer, dma_addr_t phys_addr,
743 if (rval != QLA_SUCCESS) { 743 if (rval != QLA_SUCCESS) {
744 /*EMPTY*/ 744 /*EMPTY*/
745 DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", 745 DEBUG(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n",
746 ha->host_no, rval);) 746 ha->host_no, rval));
747 DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n", 747 DEBUG2(printk("qla2x00_issue_iocb(%ld): failed rval 0x%x\n",
748 ha->host_no, rval);) 748 ha->host_no, rval));
749 } else { 749 } else {
750 sts_entry_t *sts_entry = (sts_entry_t *) buffer; 750 sts_entry_t *sts_entry = (sts_entry_t *) buffer;
751 751
@@ -781,7 +781,7 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp)
781 mbx_cmd_t mc; 781 mbx_cmd_t mc;
782 mbx_cmd_t *mcp = &mc; 782 mbx_cmd_t *mcp = &mc;
783 783
784 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no);) 784 DEBUG11(printk("qla2x00_abort_command(%ld): entered.\n", ha->host_no));
785 785
786 fcport = sp->fcport; 786 fcport = sp->fcport;
787 787
@@ -813,11 +813,11 @@ qla2x00_abort_command(scsi_qla_host_t *ha, srb_t *sp)
813 813
814 if (rval != QLA_SUCCESS) { 814 if (rval != QLA_SUCCESS) {
815 DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n", 815 DEBUG2_3_11(printk("qla2x00_abort_command(%ld): failed=%x.\n",
816 ha->host_no, rval);) 816 ha->host_no, rval));
817 } else { 817 } else {
818 sp->flags |= SRB_ABORT_PENDING; 818 sp->flags |= SRB_ABORT_PENDING;
819 DEBUG11(printk("qla2x00_abort_command(%ld): done.\n", 819 DEBUG11(printk("qla2x00_abort_command(%ld): done.\n",
820 ha->host_no);) 820 ha->host_no));
821 } 821 }
822 822
823 return rval; 823 return rval;
@@ -848,7 +848,7 @@ qla2x00_abort_target(fc_port_t *fcport)
848 if (fcport == NULL) 848 if (fcport == NULL)
849 return 0; 849 return 0;
850 850
851 DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no);) 851 DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no));
852 852
853 ha = fcport->ha; 853 ha = fcport->ha;
854 mcp->mb[0] = MBC_ABORT_TARGET; 854 mcp->mb[0] = MBC_ABORT_TARGET;
@@ -872,11 +872,11 @@ qla2x00_abort_target(fc_port_t *fcport)
872 872
873 if (rval != QLA_SUCCESS) { 873 if (rval != QLA_SUCCESS) {
874 DEBUG2_3_11(printk("qla2x00_abort_target(%ld): failed=%x.\n", 874 DEBUG2_3_11(printk("qla2x00_abort_target(%ld): failed=%x.\n",
875 ha->host_no, rval);) 875 ha->host_no, rval));
876 } else { 876 } else {
877 /*EMPTY*/ 877 /*EMPTY*/
878 DEBUG11(printk("qla2x00_abort_target(%ld): done.\n", 878 DEBUG11(printk("qla2x00_abort_target(%ld): done.\n",
879 ha->host_no);) 879 ha->host_no));
880 } 880 }
881 881
882 return rval; 882 return rval;
@@ -912,7 +912,7 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa,
912 mbx_cmd_t *mcp = &mc; 912 mbx_cmd_t *mcp = &mc;
913 913
914 DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n", 914 DEBUG11(printk("qla2x00_get_adapter_id(%ld): entered.\n",
915 ha->host_no);) 915 ha->host_no));
916 916
917 mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID; 917 mcp->mb[0] = MBC_GET_ADAPTER_LOOP_ID;
918 mcp->out_mb = MBX_0; 918 mcp->out_mb = MBX_0;
@@ -933,11 +933,11 @@ qla2x00_get_adapter_id(scsi_qla_host_t *ha, uint16_t *id, uint8_t *al_pa,
933 if (rval != QLA_SUCCESS) { 933 if (rval != QLA_SUCCESS) {
934 /*EMPTY*/ 934 /*EMPTY*/
935 DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n", 935 DEBUG2_3_11(printk("qla2x00_get_adapter_id(%ld): failed=%x.\n",
936 ha->host_no, rval);) 936 ha->host_no, rval));
937 } else { 937 } else {
938 /*EMPTY*/ 938 /*EMPTY*/
939 DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n", 939 DEBUG11(printk("qla2x00_get_adapter_id(%ld): done.\n",
940 ha->host_no);) 940 ha->host_no));
941 } 941 }
942 942
943 return rval; 943 return rval;
@@ -968,7 +968,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov,
968 mbx_cmd_t *mcp = &mc; 968 mbx_cmd_t *mcp = &mc;
969 969
970 DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n", 970 DEBUG11(printk("qla2x00_get_retry_cnt(%ld): entered.\n",
971 ha->host_no);) 971 ha->host_no));
972 972
973 mcp->mb[0] = MBC_GET_RETRY_COUNT; 973 mcp->mb[0] = MBC_GET_RETRY_COUNT;
974 mcp->out_mb = MBX_0; 974 mcp->out_mb = MBX_0;
@@ -980,7 +980,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov,
980 if (rval != QLA_SUCCESS) { 980 if (rval != QLA_SUCCESS) {
981 /*EMPTY*/ 981 /*EMPTY*/
982 DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n", 982 DEBUG2_3_11(printk("qla2x00_get_retry_cnt(%ld): failed = %x.\n",
983 ha->host_no, mcp->mb[0]);) 983 ha->host_no, mcp->mb[0]));
984 } else { 984 } else {
985 /* Convert returned data and check our values. */ 985 /* Convert returned data and check our values. */
986 *r_a_tov = mcp->mb[3] / 2; 986 *r_a_tov = mcp->mb[3] / 2;
@@ -992,7 +992,7 @@ qla2x00_get_retry_cnt(scsi_qla_host_t *ha, uint8_t *retry_cnt, uint8_t *tov,
992 } 992 }
993 993
994 DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d " 994 DEBUG11(printk("qla2x00_get_retry_cnt(%ld): done. mb3=%d "
995 "ratov=%d.\n", ha->host_no, mcp->mb[3], ratov);) 995 "ratov=%d.\n", ha->host_no, mcp->mb[3], ratov));
996 } 996 }
997 997
998 return rval; 998 return rval;
@@ -1023,7 +1023,7 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size)
1023 mbx_cmd_t *mcp = &mc; 1023 mbx_cmd_t *mcp = &mc;
1024 1024
1025 DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n", 1025 DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n",
1026 ha->host_no);) 1026 ha->host_no));
1027 1027
1028 mcp->mb[0] = MBC_INITIALIZE_FIRMWARE; 1028 mcp->mb[0] = MBC_INITIALIZE_FIRMWARE;
1029 mcp->mb[2] = MSW(ha->init_cb_dma); 1029 mcp->mb[2] = MSW(ha->init_cb_dma);
@@ -1043,11 +1043,11 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size)
1043 /*EMPTY*/ 1043 /*EMPTY*/
1044 DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x " 1044 DEBUG2_3_11(printk("qla2x00_init_firmware(%ld): failed=%x "
1045 "mb0=%x.\n", 1045 "mb0=%x.\n",
1046 ha->host_no, rval, mcp->mb[0]);) 1046 ha->host_no, rval, mcp->mb[0]));
1047 } else { 1047 } else {
1048 /*EMPTY*/ 1048 /*EMPTY*/
1049 DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n", 1049 DEBUG11(printk("qla2x00_init_firmware(%ld): done.\n",
1050 ha->host_no);) 1050 ha->host_no));
1051 } 1051 }
1052 1052
1053 return rval; 1053 return rval;
@@ -1079,7 +1079,7 @@ qla2x00_get_port_database(scsi_qla_host_t *ha, fc_port_t *fcport, uint8_t opt)
1079 struct port_database_24xx *pd24; 1079 struct port_database_24xx *pd24;
1080 dma_addr_t pd_dma; 1080 dma_addr_t pd_dma;
1081 1081
1082 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 1082 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
1083 1083
1084 pd24 = NULL; 1084 pd24 = NULL;
1085 pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma); 1085 pd = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &pd_dma);
@@ -1220,7 +1220,7 @@ qla2x00_get_firmware_state(scsi_qla_host_t *ha, uint16_t *dptr)
1220 mbx_cmd_t *mcp = &mc; 1220 mbx_cmd_t *mcp = &mc;
1221 1221
1222 DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n", 1222 DEBUG11(printk("qla2x00_get_firmware_state(%ld): entered.\n",
1223 ha->host_no);) 1223 ha->host_no));
1224 1224
1225 mcp->mb[0] = MBC_GET_FIRMWARE_STATE; 1225 mcp->mb[0] = MBC_GET_FIRMWARE_STATE;
1226 mcp->out_mb = MBX_0; 1226 mcp->out_mb = MBX_0;
@@ -1235,11 +1235,11 @@ qla2x00_get_firmware_state(scsi_qla_host_t *ha, uint16_t *dptr)
1235 if (rval != QLA_SUCCESS) { 1235 if (rval != QLA_SUCCESS) {
1236 /*EMPTY*/ 1236 /*EMPTY*/
1237 DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): " 1237 DEBUG2_3_11(printk("qla2x00_get_firmware_state(%ld): "
1238 "failed=%x.\n", ha->host_no, rval);) 1238 "failed=%x.\n", ha->host_no, rval));
1239 } else { 1239 } else {
1240 /*EMPTY*/ 1240 /*EMPTY*/
1241 DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n", 1241 DEBUG11(printk("qla2x00_get_firmware_state(%ld): done.\n",
1242 ha->host_no);) 1242 ha->host_no));
1243 } 1243 }
1244 1244
1245 return rval; 1245 return rval;
@@ -1272,7 +1272,7 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name,
1272 mbx_cmd_t *mcp = &mc; 1272 mbx_cmd_t *mcp = &mc;
1273 1273
1274 DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n", 1274 DEBUG11(printk("qla2x00_get_port_name(%ld): entered.\n",
1275 ha->host_no);) 1275 ha->host_no));
1276 1276
1277 mcp->mb[0] = MBC_GET_PORT_NAME; 1277 mcp->mb[0] = MBC_GET_PORT_NAME;
1278 mcp->out_mb = MBX_1|MBX_0; 1278 mcp->out_mb = MBX_1|MBX_0;
@@ -1292,7 +1292,7 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name,
1292 if (rval != QLA_SUCCESS) { 1292 if (rval != QLA_SUCCESS) {
1293 /*EMPTY*/ 1293 /*EMPTY*/
1294 DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n", 1294 DEBUG2_3_11(printk("qla2x00_get_port_name(%ld): failed=%x.\n",
1295 ha->host_no, rval);) 1295 ha->host_no, rval));
1296 } else { 1296 } else {
1297 if (name != NULL) { 1297 if (name != NULL) {
1298 /* This function returns name in big endian. */ 1298 /* This function returns name in big endian. */
@@ -1307,7 +1307,7 @@ qla2x00_get_port_name(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t *name,
1307 } 1307 }
1308 1308
1309 DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n", 1309 DEBUG11(printk("qla2x00_get_port_name(%ld): done.\n",
1310 ha->host_no);) 1310 ha->host_no));
1311 } 1311 }
1312 1312
1313 return rval; 1313 return rval;
@@ -1335,7 +1335,7 @@ qla2x00_lip_reset(scsi_qla_host_t *ha)
1335 mbx_cmd_t mc; 1335 mbx_cmd_t mc;
1336 mbx_cmd_t *mcp = &mc; 1336 mbx_cmd_t *mcp = &mc;
1337 1337
1338 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 1338 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
1339 1339
1340 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) { 1340 if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
1341 mcp->mb[0] = MBC_LIP_FULL_LOGIN; 1341 mcp->mb[0] = MBC_LIP_FULL_LOGIN;
@@ -1364,10 +1364,10 @@ qla2x00_lip_reset(scsi_qla_host_t *ha)
1364 if (rval != QLA_SUCCESS) { 1364 if (rval != QLA_SUCCESS) {
1365 /*EMPTY*/ 1365 /*EMPTY*/
1366 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", 1366 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n",
1367 __func__, ha->host_no, rval);) 1367 __func__, ha->host_no, rval));
1368 } else { 1368 } else {
1369 /*EMPTY*/ 1369 /*EMPTY*/
1370 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 1370 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
1371 } 1371 }
1372 1372
1373 return rval; 1373 return rval;
@@ -1400,10 +1400,10 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address,
1400 mbx_cmd_t *mcp = &mc; 1400 mbx_cmd_t *mcp = &mc;
1401 1401
1402 DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n", 1402 DEBUG11(printk("qla2x00_send_sns(%ld): entered.\n",
1403 ha->host_no);) 1403 ha->host_no));
1404 1404
1405 DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total " 1405 DEBUG11(printk("qla2x00_send_sns: retry cnt=%d ratov=%d total "
1406 "tov=%d.\n", ha->retry_count, ha->login_timeout, mcp->tov);) 1406 "tov=%d.\n", ha->retry_count, ha->login_timeout, mcp->tov));
1407 1407
1408 mcp->mb[0] = MBC_SEND_SNS_COMMAND; 1408 mcp->mb[0] = MBC_SEND_SNS_COMMAND;
1409 mcp->mb[1] = cmd_size; 1409 mcp->mb[1] = cmd_size;
@@ -1421,12 +1421,12 @@ qla2x00_send_sns(scsi_qla_host_t *ha, dma_addr_t sns_phys_address,
1421 if (rval != QLA_SUCCESS) { 1421 if (rval != QLA_SUCCESS) {
1422 /*EMPTY*/ 1422 /*EMPTY*/
1423 DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " 1423 DEBUG(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
1424 "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]);) 1424 "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
1425 DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x " 1425 DEBUG2_3_11(printk("qla2x00_send_sns(%ld): failed=%x mb[0]=%x "
1426 "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]);) 1426 "mb[1]=%x.\n", ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
1427 } else { 1427 } else {
1428 /*EMPTY*/ 1428 /*EMPTY*/
1429 DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", ha->host_no);) 1429 DEBUG11(printk("qla2x00_send_sns(%ld): done.\n", ha->host_no));
1430 } 1430 }
1431 1431
1432 return rval; 1432 return rval;
@@ -1442,7 +1442,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1442 dma_addr_t lg_dma; 1442 dma_addr_t lg_dma;
1443 uint32_t iop[2]; 1443 uint32_t iop[2];
1444 1444
1445 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 1445 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
1446 1446
1447 lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); 1447 lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
1448 if (lg == NULL) { 1448 if (lg == NULL) {
@@ -1458,13 +1458,15 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1458 lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI); 1458 lg->control_flags = __constant_cpu_to_le16(LCF_COMMAND_PLOGI);
1459 if (opt & BIT_0) 1459 if (opt & BIT_0)
1460 lg->control_flags |= __constant_cpu_to_le16(LCF_COND_PLOGI); 1460 lg->control_flags |= __constant_cpu_to_le16(LCF_COND_PLOGI);
1461 if (opt & BIT_1)
1462 lg->control_flags |= __constant_cpu_to_le16(LCF_SKIP_PRLI);
1461 lg->port_id[0] = al_pa; 1463 lg->port_id[0] = al_pa;
1462 lg->port_id[1] = area; 1464 lg->port_id[1] = area;
1463 lg->port_id[2] = domain; 1465 lg->port_id[2] = domain;
1464 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); 1466 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
1465 if (rval != QLA_SUCCESS) { 1467 if (rval != QLA_SUCCESS) {
1466 DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB " 1468 DEBUG2_3_11(printk("%s(%ld): failed to issue Login IOCB "
1467 "(%x).\n", __func__, ha->host_no, rval);) 1469 "(%x).\n", __func__, ha->host_no, rval));
1468 } else if (lg->entry_status != 0) { 1470 } else if (lg->entry_status != 0) {
1469 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 1471 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
1470 "-- error status (%x).\n", __func__, ha->host_no, 1472 "-- error status (%x).\n", __func__, ha->host_no,
@@ -1505,7 +1507,7 @@ qla24xx_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1505 break; 1507 break;
1506 } 1508 }
1507 } else { 1509 } else {
1508 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 1510 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
1509 1511
1510 iop[0] = le32_to_cpu(lg->io_parameter[0]); 1512 iop[0] = le32_to_cpu(lg->io_parameter[0]);
1511 1513
@@ -1559,7 +1561,7 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1559 mbx_cmd_t mc; 1561 mbx_cmd_t mc;
1560 mbx_cmd_t *mcp = &mc; 1562 mbx_cmd_t *mcp = &mc;
1561 1563
1562 DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", ha->host_no);) 1564 DEBUG11(printk("qla2x00_login_fabric(%ld): entered.\n", ha->host_no));
1563 1565
1564 mcp->mb[0] = MBC_LOGIN_FABRIC_PORT; 1566 mcp->mb[0] = MBC_LOGIN_FABRIC_PORT;
1565 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0; 1567 mcp->out_mb = MBX_3|MBX_2|MBX_1|MBX_0;
@@ -1604,11 +1606,11 @@ qla2x00_login_fabric(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1604 /*EMPTY*/ 1606 /*EMPTY*/
1605 DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x " 1607 DEBUG2_3_11(printk("qla2x00_login_fabric(%ld): failed=%x "
1606 "mb[0]=%x mb[1]=%x mb[2]=%x.\n", ha->host_no, rval, 1608 "mb[0]=%x mb[1]=%x mb[2]=%x.\n", ha->host_no, rval,
1607 mcp->mb[0], mcp->mb[1], mcp->mb[2]);) 1609 mcp->mb[0], mcp->mb[1], mcp->mb[2]));
1608 } else { 1610 } else {
1609 /*EMPTY*/ 1611 /*EMPTY*/
1610 DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n", 1612 DEBUG11(printk("qla2x00_login_fabric(%ld): done.\n",
1611 ha->host_no);) 1613 ha->host_no));
1612 } 1614 }
1613 1615
1614 return rval; 1616 return rval;
@@ -1643,7 +1645,7 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport,
1643 fcport->d_id.b.domain, fcport->d_id.b.area, 1645 fcport->d_id.b.domain, fcport->d_id.b.area,
1644 fcport->d_id.b.al_pa, mb_ret, opt); 1646 fcport->d_id.b.al_pa, mb_ret, opt);
1645 1647
1646 DEBUG3(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 1648 DEBUG3(printk("%s(%ld): entered.\n", __func__, ha->host_no));
1647 1649
1648 mcp->mb[0] = MBC_LOGIN_LOOP_PORT; 1650 mcp->mb[0] = MBC_LOGIN_LOOP_PORT;
1649 if (HAS_EXTENDED_IDS(ha)) 1651 if (HAS_EXTENDED_IDS(ha))
@@ -1677,13 +1679,13 @@ qla2x00_login_local_device(scsi_qla_host_t *ha, fc_port_t *fcport,
1677 1679
1678 DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " 1680 DEBUG(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
1679 "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval, 1681 "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval,
1680 mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]);) 1682 mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
1681 DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x " 1683 DEBUG2_3(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x "
1682 "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval, 1684 "mb[6]=%x mb[7]=%x.\n", __func__, ha->host_no, rval,
1683 mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]);) 1685 mcp->mb[0], mcp->mb[1], mcp->mb[6], mcp->mb[7]));
1684 } else { 1686 } else {
1685 /*EMPTY*/ 1687 /*EMPTY*/
1686 DEBUG3(printk("%s(%ld): done.\n", __func__, ha->host_no);) 1688 DEBUG3(printk("%s(%ld): done.\n", __func__, ha->host_no));
1687 } 1689 }
1688 1690
1689 return (rval); 1691 return (rval);
@@ -1697,7 +1699,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1697 struct logio_entry_24xx *lg; 1699 struct logio_entry_24xx *lg;
1698 dma_addr_t lg_dma; 1700 dma_addr_t lg_dma;
1699 1701
1700 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 1702 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
1701 1703
1702 lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); 1704 lg = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma);
1703 if (lg == NULL) { 1705 if (lg == NULL) {
@@ -1718,7 +1720,7 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1718 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0); 1720 rval = qla2x00_issue_iocb(ha, lg, lg_dma, 0);
1719 if (rval != QLA_SUCCESS) { 1721 if (rval != QLA_SUCCESS) {
1720 DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB " 1722 DEBUG2_3_11(printk("%s(%ld): failed to issue Logout IOCB "
1721 "(%x).\n", __func__, ha->host_no, rval);) 1723 "(%x).\n", __func__, ha->host_no, rval));
1722 } else if (lg->entry_status != 0) { 1724 } else if (lg->entry_status != 0) {
1723 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 1725 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
1724 "-- error status (%x).\n", __func__, ha->host_no, 1726 "-- error status (%x).\n", __func__, ha->host_no,
@@ -1729,10 +1731,10 @@ qla24xx_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1729 "-- completion status (%x) ioparam=%x/%x.\n", __func__, 1731 "-- completion status (%x) ioparam=%x/%x.\n", __func__,
1730 ha->host_no, le16_to_cpu(lg->comp_status), 1732 ha->host_no, le16_to_cpu(lg->comp_status),
1731 le32_to_cpu(lg->io_parameter[0]), 1733 le32_to_cpu(lg->io_parameter[0]),
1732 le32_to_cpu(lg->io_parameter[1]));) 1734 le32_to_cpu(lg->io_parameter[1])));
1733 } else { 1735 } else {
1734 /*EMPTY*/ 1736 /*EMPTY*/
1735 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 1737 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
1736 } 1738 }
1737 1739
1738 dma_pool_free(ha->s_dma_pool, lg, lg_dma); 1740 dma_pool_free(ha->s_dma_pool, lg, lg_dma);
@@ -1765,7 +1767,7 @@ qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1765 mbx_cmd_t *mcp = &mc; 1767 mbx_cmd_t *mcp = &mc;
1766 1768
1767 DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n", 1769 DEBUG11(printk("qla2x00_fabric_logout(%ld): entered.\n",
1768 ha->host_no);) 1770 ha->host_no));
1769 1771
1770 mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT; 1772 mcp->mb[0] = MBC_LOGOUT_FABRIC_PORT;
1771 mcp->out_mb = MBX_1|MBX_0; 1773 mcp->out_mb = MBX_1|MBX_0;
@@ -1785,11 +1787,11 @@ qla2x00_fabric_logout(scsi_qla_host_t *ha, uint16_t loop_id, uint8_t domain,
1785 if (rval != QLA_SUCCESS) { 1787 if (rval != QLA_SUCCESS) {
1786 /*EMPTY*/ 1788 /*EMPTY*/
1787 DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x " 1789 DEBUG2_3_11(printk("qla2x00_fabric_logout(%ld): failed=%x "
1788 "mbx1=%x.\n", ha->host_no, rval, mcp->mb[1]);) 1790 "mbx1=%x.\n", ha->host_no, rval, mcp->mb[1]));
1789 } else { 1791 } else {
1790 /*EMPTY*/ 1792 /*EMPTY*/
1791 DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n", 1793 DEBUG11(printk("qla2x00_fabric_logout(%ld): done.\n",
1792 ha->host_no);) 1794 ha->host_no));
1793 } 1795 }
1794 1796
1795 return rval; 1797 return rval;
@@ -1818,7 +1820,7 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha)
1818 mbx_cmd_t *mcp = &mc; 1820 mbx_cmd_t *mcp = &mc;
1819 1821
1820 DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n", 1822 DEBUG11(printk("qla2x00_full_login_lip(%ld): entered.\n",
1821 ha->host_no);) 1823 ha->host_no));
1822 1824
1823 mcp->mb[0] = MBC_LIP_FULL_LOGIN; 1825 mcp->mb[0] = MBC_LIP_FULL_LOGIN;
1824 mcp->mb[1] = 0; 1826 mcp->mb[1] = 0;
@@ -1833,11 +1835,11 @@ qla2x00_full_login_lip(scsi_qla_host_t *ha)
1833 if (rval != QLA_SUCCESS) { 1835 if (rval != QLA_SUCCESS) {
1834 /*EMPTY*/ 1836 /*EMPTY*/
1835 DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n", 1837 DEBUG2_3_11(printk("qla2x00_full_login_lip(%ld): failed=%x.\n",
1836 ha->host_no, rval);) 1838 ha->host_no, rval));
1837 } else { 1839 } else {
1838 /*EMPTY*/ 1840 /*EMPTY*/
1839 DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n", 1841 DEBUG11(printk("qla2x00_full_login_lip(%ld): done.\n",
1840 ha->host_no);) 1842 ha->host_no));
1841 } 1843 }
1842 1844
1843 return rval; 1845 return rval;
@@ -1864,7 +1866,7 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma,
1864 mbx_cmd_t *mcp = &mc; 1866 mbx_cmd_t *mcp = &mc;
1865 1867
1866 DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n", 1868 DEBUG11(printk("qla2x00_get_id_list(%ld): entered.\n",
1867 ha->host_no);) 1869 ha->host_no));
1868 1870
1869 if (id_list == NULL) 1871 if (id_list == NULL)
1870 return QLA_FUNCTION_FAILED; 1872 return QLA_FUNCTION_FAILED;
@@ -1893,11 +1895,11 @@ qla2x00_get_id_list(scsi_qla_host_t *ha, void *id_list, dma_addr_t id_list_dma,
1893 if (rval != QLA_SUCCESS) { 1895 if (rval != QLA_SUCCESS) {
1894 /*EMPTY*/ 1896 /*EMPTY*/
1895 DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n", 1897 DEBUG2_3_11(printk("qla2x00_get_id_list(%ld): failed=%x.\n",
1896 ha->host_no, rval);) 1898 ha->host_no, rval));
1897 } else { 1899 } else {
1898 *entries = mcp->mb[1]; 1900 *entries = mcp->mb[1];
1899 DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n", 1901 DEBUG11(printk("qla2x00_get_id_list(%ld): done.\n",
1900 ha->host_no);) 1902 ha->host_no));
1901 } 1903 }
1902 1904
1903 return rval; 1905 return rval;
@@ -1936,7 +1938,7 @@ qla2x00_get_resource_cnts(scsi_qla_host_t *ha, uint16_t *cur_xchg_cnt,
1936 if (rval != QLA_SUCCESS) { 1938 if (rval != QLA_SUCCESS) {
1937 /*EMPTY*/ 1939 /*EMPTY*/
1938 DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__, 1940 DEBUG2_3_11(printk("%s(%ld): failed = %x.\n", __func__,
1939 ha->host_no, mcp->mb[0]);) 1941 ha->host_no, mcp->mb[0]));
1940 } else { 1942 } else {
1941 DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x " 1943 DEBUG11(printk("%s(%ld): done. mb1=%x mb2=%x mb3=%x mb6=%x "
1942 "mb7=%x mb10=%x.\n", __func__, ha->host_no, 1944 "mb7=%x mb10=%x.\n", __func__, ha->host_no,
@@ -2045,7 +2047,7 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
2045 link_stat_t *stat_buf; 2047 link_stat_t *stat_buf;
2046 dma_addr_t stat_buf_dma; 2048 dma_addr_t stat_buf_dma;
2047 2049
2048 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 2050 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2049 2051
2050 stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma); 2052 stat_buf = dma_pool_alloc(ha->s_dma_pool, GFP_ATOMIC, &stat_buf_dma);
2051 if (stat_buf == NULL) { 2053 if (stat_buf == NULL) {
@@ -2083,7 +2085,7 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
2083 if (rval == QLA_SUCCESS) { 2085 if (rval == QLA_SUCCESS) {
2084 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) { 2086 if (mcp->mb[0] != MBS_COMMAND_COMPLETE) {
2085 DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n", 2087 DEBUG2_3_11(printk("%s(%ld): cmd failed. mbx0=%x.\n",
2086 __func__, ha->host_no, mcp->mb[0]);) 2088 __func__, ha->host_no, mcp->mb[0]));
2087 status[0] = mcp->mb[0]; 2089 status[0] = mcp->mb[0];
2088 rval = BIT_1; 2090 rval = BIT_1;
2089 } else { 2091 } else {
@@ -2108,12 +2110,12 @@ qla2x00_get_link_status(scsi_qla_host_t *ha, uint16_t loop_id,
2108 stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt, 2110 stat_buf->loss_sync_cnt, stat_buf->loss_sig_cnt,
2109 stat_buf->prim_seq_err_cnt, 2111 stat_buf->prim_seq_err_cnt,
2110 stat_buf->inval_xmit_word_cnt, 2112 stat_buf->inval_xmit_word_cnt,
2111 stat_buf->inval_crc_cnt);) 2113 stat_buf->inval_crc_cnt));
2112 } 2114 }
2113 } else { 2115 } else {
2114 /* Failed. */ 2116 /* Failed. */
2115 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__, 2117 DEBUG2_3_11(printk("%s(%ld): failed=%x.\n", __func__,
2116 ha->host_no, rval);) 2118 ha->host_no, rval));
2117 rval = BIT_1; 2119 rval = BIT_1;
2118 } 2120 }
2119 2121
@@ -2132,7 +2134,7 @@ qla24xx_get_isp_stats(scsi_qla_host_t *ha, uint32_t *dwbuf, uint32_t dwords,
2132 uint32_t *sbuf, *siter; 2134 uint32_t *sbuf, *siter;
2133 dma_addr_t sbuf_dma; 2135 dma_addr_t sbuf_dma;
2134 2136
2135 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 2137 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2136 2138
2137 if (dwords > (DMA_POOL_SIZE / 4)) { 2139 if (dwords > (DMA_POOL_SIZE / 4)) {
2138 DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs " 2140 DEBUG2_3_11(printk("%s(%ld): Unabled to retrieve %d DWORDs "
@@ -2196,7 +2198,7 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
2196 dma_addr_t abt_dma; 2198 dma_addr_t abt_dma;
2197 uint32_t handle; 2199 uint32_t handle;
2198 2200
2199 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no);) 2201 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2200 2202
2201 fcport = sp->fcport; 2203 fcport = sp->fcport;
2202 2204
@@ -2229,7 +2231,7 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
2229 rval = qla2x00_issue_iocb(ha, abt, abt_dma, 0); 2231 rval = qla2x00_issue_iocb(ha, abt, abt_dma, 0);
2230 if (rval != QLA_SUCCESS) { 2232 if (rval != QLA_SUCCESS) {
2231 DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n", 2233 DEBUG2_3_11(printk("%s(%ld): failed to issue IOCB (%x).\n",
2232 __func__, ha->host_no, rval);) 2234 __func__, ha->host_no, rval));
2233 } else if (abt->entry_status != 0) { 2235 } else if (abt->entry_status != 0) {
2234 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2236 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2235 "-- error status (%x).\n", __func__, ha->host_no, 2237 "-- error status (%x).\n", __func__, ha->host_no,
@@ -2238,10 +2240,10 @@ qla24xx_abort_command(scsi_qla_host_t *ha, srb_t *sp)
2238 } else if (abt->nport_handle != __constant_cpu_to_le16(0)) { 2240 } else if (abt->nport_handle != __constant_cpu_to_le16(0)) {
2239 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2241 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2240 "-- completion status (%x).\n", __func__, ha->host_no, 2242 "-- completion status (%x).\n", __func__, ha->host_no,
2241 le16_to_cpu(abt->nport_handle));) 2243 le16_to_cpu(abt->nport_handle)));
2242 rval = QLA_FUNCTION_FAILED; 2244 rval = QLA_FUNCTION_FAILED;
2243 } else { 2245 } else {
2244 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 2246 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
2245 sp->flags |= SRB_ABORT_PENDING; 2247 sp->flags |= SRB_ABORT_PENDING;
2246 } 2248 }
2247 2249
@@ -2268,7 +2270,7 @@ qla24xx_abort_target(fc_port_t *fcport)
2268 if (fcport == NULL) 2270 if (fcport == NULL)
2269 return 0; 2271 return 0;
2270 2272
2271 DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no);) 2273 DEBUG11(printk("%s(%ld): entered.\n", __func__, fcport->ha->host_no));
2272 2274
2273 ha = fcport->ha; 2275 ha = fcport->ha;
2274 tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma); 2276 tsk = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &tsk_dma);
@@ -2290,7 +2292,7 @@ qla24xx_abort_target(fc_port_t *fcport)
2290 rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0); 2292 rval = qla2x00_issue_iocb(ha, tsk, tsk_dma, 0);
2291 if (rval != QLA_SUCCESS) { 2293 if (rval != QLA_SUCCESS) {
2292 DEBUG2_3_11(printk("%s(%ld): failed to issue Target Reset IOCB " 2294 DEBUG2_3_11(printk("%s(%ld): failed to issue Target Reset IOCB "
2293 "(%x).\n", __func__, ha->host_no, rval);) 2295 "(%x).\n", __func__, ha->host_no, rval));
2294 goto atarget_done; 2296 goto atarget_done;
2295 } else if (tsk->p.sts.entry_status != 0) { 2297 } else if (tsk->p.sts.entry_status != 0) {
2296 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2298 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
@@ -2302,7 +2304,7 @@ qla24xx_abort_target(fc_port_t *fcport)
2302 __constant_cpu_to_le16(CS_COMPLETE)) { 2304 __constant_cpu_to_le16(CS_COMPLETE)) {
2303 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB " 2305 DEBUG2_3_11(printk("%s(%ld): failed to complete IOCB "
2304 "-- completion status (%x).\n", __func__, 2306 "-- completion status (%x).\n", __func__,
2305 ha->host_no, le16_to_cpu(tsk->p.sts.comp_status));) 2307 ha->host_no, le16_to_cpu(tsk->p.sts.comp_status)));
2306 rval = QLA_FUNCTION_FAILED; 2308 rval = QLA_FUNCTION_FAILED;
2307 goto atarget_done; 2309 goto atarget_done;
2308 } 2310 }
@@ -2311,9 +2313,9 @@ qla24xx_abort_target(fc_port_t *fcport)
2311 rval = qla2x00_marker(ha, fcport->loop_id, 0, MK_SYNC_ID); 2313 rval = qla2x00_marker(ha, fcport->loop_id, 0, MK_SYNC_ID);
2312 if (rval != QLA_SUCCESS) { 2314 if (rval != QLA_SUCCESS) {
2313 DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB " 2315 DEBUG2_3_11(printk("%s(%ld): failed to issue Marker IOCB "
2314 "(%x).\n", __func__, ha->host_no, rval);) 2316 "(%x).\n", __func__, ha->host_no, rval));
2315 } else { 2317 } else {
2316 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no);) 2318 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
2317 } 2319 }
2318 2320
2319atarget_done: 2321atarget_done:
@@ -2460,3 +2462,81 @@ qla2x00_stop_firmware(scsi_qla_host_t *ha)
2460 2462
2461 return rval; 2463 return rval;
2462} 2464}
2465
2466int
2467qla2x00_trace_control(scsi_qla_host_t *ha, uint16_t ctrl, dma_addr_t eft_dma,
2468 uint16_t buffers)
2469{
2470 int rval;
2471 mbx_cmd_t mc;
2472 mbx_cmd_t *mcp = &mc;
2473
2474 if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
2475 return QLA_FUNCTION_FAILED;
2476
2477 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2478
2479 mcp->mb[0] = MBC_TRACE_CONTROL;
2480 mcp->mb[1] = ctrl;
2481 mcp->out_mb = MBX_1|MBX_0;
2482 mcp->in_mb = MBX_1|MBX_0;
2483 if (ctrl == TC_ENABLE) {
2484 mcp->mb[2] = LSW(eft_dma);
2485 mcp->mb[3] = MSW(eft_dma);
2486 mcp->mb[4] = LSW(MSD(eft_dma));
2487 mcp->mb[5] = MSW(MSD(eft_dma));
2488 mcp->mb[6] = buffers;
2489 mcp->mb[7] = buffers;
2490 mcp->out_mb |= MBX_7|MBX_6|MBX_5|MBX_4|MBX_3|MBX_2;
2491 }
2492 mcp->tov = 30;
2493 mcp->flags = 0;
2494 rval = qla2x00_mailbox_command(ha, mcp);
2495
2496 if (rval != QLA_SUCCESS) {
2497 DEBUG2_3_11(printk("%s(%ld): failed=%x mb[0]=%x mb[1]=%x.\n",
2498 __func__, ha->host_no, rval, mcp->mb[0], mcp->mb[1]));
2499 } else {
2500 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
2501 }
2502
2503 return rval;
2504}
2505
2506int
2507qla2x00_read_sfp(scsi_qla_host_t *ha, dma_addr_t sfp_dma, uint16_t addr,
2508 uint16_t off, uint16_t count)
2509{
2510 int rval;
2511 mbx_cmd_t mc;
2512 mbx_cmd_t *mcp = &mc;
2513
2514 if (!IS_QLA24XX(ha) && !IS_QLA54XX(ha))
2515 return QLA_FUNCTION_FAILED;
2516
2517 DEBUG11(printk("%s(%ld): entered.\n", __func__, ha->host_no));
2518
2519 mcp->mb[0] = MBC_READ_SFP;
2520 mcp->mb[1] = addr;
2521 mcp->mb[2] = MSW(sfp_dma);
2522 mcp->mb[3] = LSW(sfp_dma);
2523 mcp->mb[6] = MSW(MSD(sfp_dma));
2524 mcp->mb[7] = LSW(MSD(sfp_dma));
2525 mcp->mb[8] = count;
2526 mcp->mb[9] = off;
2527 mcp->mb[10] = 0;
2528 mcp->out_mb = MBX_10|MBX_9|MBX_8|MBX_7|MBX_6|MBX_3|MBX_2|MBX_1|MBX_0;
2529 mcp->in_mb = MBX_0;
2530 mcp->tov = 30;
2531 mcp->flags = 0;
2532 rval = qla2x00_mailbox_command(ha, mcp);
2533
2534 if (rval != QLA_SUCCESS) {
2535 DEBUG2_3_11(printk("%s(%ld): failed=%x (%x).\n", __func__,
2536 ha->host_no, rval, mcp->mb[0]));
2537 } else {
2538 DEBUG11(printk("%s(%ld): done.\n", __func__, ha->host_no));
2539 }
2540
2541 return rval;
2542}