aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptfc.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-29 20:22:03 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-29 20:22:03 -0400
commita6ce22a5f61ba838b43763bf1e5be399f9dee4d0 (patch)
tree2abed83e85724bd45c5b0b842b9ce36d1c4ca160 /drivers/message/fusion/mptfc.c
parent4e950f6f0189f65f8bf069cf2272649ef418f5e4 (diff)
parent09120a8cd38dbdb0c9a59ff8456cf88b510e6baa (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (28 commits) [SCSI] mpt fusion: Changes in mptctl.c for logging support [SCSI] mpt fusion: Changes in mptfc.c mptlan.c mptsas.c and mptspi.c for logging support [SCSI] mpt fusion: Changes in mptscsih.c for logging support [SCSI] mpt fusion: Changes in mptbase.c for logging support [SCSI] mpt fusion: logging support in Kconfig, Makefile, mptbase.h and addition of mptdebug.h [SCSI] libsas: Fix potential NULL dereference in sas_smp_get_phy_events() [SCSI] bsg: Fix build for CONFIG_BLOCK=n [SCSI] aacraid: fix Sunrise Lake reset handling [SCSI] aacraid: add SCSI SYNCHONIZE_CACHE range checking [SCSI] add easyRAID to the no report luns blacklist [SCSI] advansys: lindent and other large, uninteresting changes [SCSI] aic79xx, aic7xxx: Fix incorrect width setting [SCSI] qla2xxx: fix to honor ignored parameters in sysfs attributes [SCSI] aacraid: draw line in sand, sundry cleanup and version update [SCSI] iscsi_tcp: Turn off bounce buffers [SCSI] libiscsi: fix cmd seqeunce number checking [SCSI] iscsi_tcp, ib_iser Enable module refcounting for iscsi host template [SCSI] libiscsi: make sure session is not blocked when removing host [SCSI] libsas: Remove PCI dependencies [SCSI] simscsi: convert to use the data buffer accessors ...
Diffstat (limited to 'drivers/message/fusion/mptfc.c')
-rw-r--r--drivers/message/fusion/mptfc.c108
1 files changed, 47 insertions, 61 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index f2ebaa9992fe..8422c25e4a3e 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -188,16 +188,18 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
188 int (*func)(struct scsi_cmnd *SCpnt), 188 int (*func)(struct scsi_cmnd *SCpnt),
189 const char *caller) 189 const char *caller)
190{ 190{
191 MPT_SCSI_HOST *hd;
191 struct scsi_device *sdev = SCpnt->device; 192 struct scsi_device *sdev = SCpnt->device;
192 struct Scsi_Host *shost = sdev->host; 193 struct Scsi_Host *shost = sdev->host;
193 struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); 194 struct fc_rport *rport = starget_to_rport(scsi_target(sdev));
194 unsigned long flags; 195 unsigned long flags;
195 int ready; 196 int ready;
196 197
198 hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
197 spin_lock_irqsave(shost->host_lock, flags); 199 spin_lock_irqsave(shost->host_lock, flags);
198 while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) { 200 while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
199 spin_unlock_irqrestore(shost->host_lock, flags); 201 spin_unlock_irqrestore(shost->host_lock, flags);
200 dfcprintk ((MYIOC_s_INFO_FMT 202 dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
201 "mptfc_block_error_handler.%d: %d:%d, port status is " 203 "mptfc_block_error_handler.%d: %d:%d, port status is "
202 "DID_IMM_RETRY, deferring %s recovery.\n", 204 "DID_IMM_RETRY, deferring %s recovery.\n",
203 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, 205 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -209,7 +211,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
209 spin_unlock_irqrestore(shost->host_lock, flags); 211 spin_unlock_irqrestore(shost->host_lock, flags);
210 212
211 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) { 213 if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
212 dfcprintk ((MYIOC_s_INFO_FMT 214 dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
213 "%s.%d: %d:%d, failing recovery, " 215 "%s.%d: %d:%d, failing recovery, "
214 "port state %d, vdev %p.\n", caller, 216 "port state %d, vdev %p.\n", caller,
215 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, 217 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -218,7 +220,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
218 SCpnt->device->hostdata)); 220 SCpnt->device->hostdata));
219 return FAILED; 221 return FAILED;
220 } 222 }
221 dfcprintk ((MYIOC_s_INFO_FMT 223 dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
222 "%s.%d: %d:%d, executing recovery.\n", caller, 224 "%s.%d: %d:%d, executing recovery.\n", caller,
223 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name, 225 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
224 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no, 226 ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
@@ -483,7 +485,7 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
483 485
484 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low; 486 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
485 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low; 487 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
486 dfcprintk ((MYIOC_s_INFO_FMT 488 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
487 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, " 489 "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, "
488 "rport tid %d, tmo %d\n", 490 "rport tid %d, tmo %d\n",
489 ioc->name, 491 ioc->name,
@@ -559,6 +561,35 @@ mptfc_target_alloc(struct scsi_target *starget)
559 561
560 return rc; 562 return rc;
561} 563}
564/*
565 * mptfc_dump_lun_info
566 * @ioc
567 * @rport
568 * @sdev
569 *
570 */
571static void
572mptfc_dump_lun_info(MPT_ADAPTER *ioc, struct fc_rport *rport, struct scsi_device *sdev,
573 VirtTarget *vtarget)
574{
575 u64 nn, pn;
576 struct mptfc_rport_info *ri;
577
578 ri = *((struct mptfc_rport_info **)rport->dd_data);
579 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
580 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
581 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
582 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
583 "CurrentTargetID %d, %x %llx %llx\n",
584 ioc->name,
585 sdev->host->host_no,
586 vtarget->num_luns,
587 sdev->id, ri->pg0.CurrentTargetID,
588 ri->pg0.PortIdentifier,
589 (unsigned long long)pn,
590 (unsigned long long)nn));
591}
592
562 593
563/* 594/*
564 * OS entry point to allow host driver to alloc memory 595 * OS entry point to allow host driver to alloc memory
@@ -606,25 +637,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
606 vtarget->num_luns++; 637 vtarget->num_luns++;
607 638
608 639
609#ifdef DMPT_DEBUG_FC 640 mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget);
610 {
611 u64 nn, pn;
612 struct mptfc_rport_info *ri;
613 ri = *((struct mptfc_rport_info **)rport->dd_data);
614 pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
615 nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
616 dfcprintk ((MYIOC_s_INFO_FMT
617 "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
618 "CurrentTargetID %d, %x %llx %llx\n",
619 hd->ioc->name,
620 sdev->host->host_no,
621 vtarget->num_luns,
622 sdev->id, ri->pg0.CurrentTargetID,
623 ri->pg0.PortIdentifier,
624 (unsigned long long)pn,
625 (unsigned long long)nn));
626 }
627#endif
628 641
629 return 0; 642 return 0;
630} 643}
@@ -653,27 +666,12 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
653 /* dd_data is null until finished adding target */ 666 /* dd_data is null until finished adding target */
654 ri = *((struct mptfc_rport_info **)rport->dd_data); 667 ri = *((struct mptfc_rport_info **)rport->dd_data);
655 if (unlikely(!ri)) { 668 if (unlikely(!ri)) {
656 dfcprintk ((MYIOC_s_INFO_FMT
657 "mptfc_qcmd.%d: %d:%d, dd_data is null.\n",
658 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
659 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
660 SCpnt->device->id,SCpnt->device->lun));
661 SCpnt->result = DID_IMM_RETRY << 16; 669 SCpnt->result = DID_IMM_RETRY << 16;
662 done(SCpnt); 670 done(SCpnt);
663 return 0; 671 return 0;
664 } 672 }
665 673
666 err = mptscsih_qcmd(SCpnt,done); 674 return mptscsih_qcmd(SCpnt,done);
667#ifdef DMPT_DEBUG_FC
668 if (unlikely(err)) {
669 dfcprintk ((MYIOC_s_INFO_FMT
670 "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero, (%x).\n",
671 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
672 ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
673 SCpnt->device->id,SCpnt->device->lun,err));
674 }
675#endif
676 return err;
677} 675}
678 676
679/* 677/*
@@ -1041,7 +1039,7 @@ mptfc_setup_reset(struct work_struct *work)
1041 1039
1042 pn = (u64)ri->pg0.WWPN.High << 32 | 1040 pn = (u64)ri->pg0.WWPN.High << 32 |
1043 (u64)ri->pg0.WWPN.Low; 1041 (u64)ri->pg0.WWPN.Low;
1044 dfcprintk ((MYIOC_s_INFO_FMT 1042 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
1045 "mptfc_setup_reset.%d: %llx deleted\n", 1043 "mptfc_setup_reset.%d: %llx deleted\n",
1046 ioc->name, 1044 ioc->name,
1047 ioc->sh->host_no, 1045 ioc->sh->host_no,
@@ -1088,7 +1086,7 @@ mptfc_rescan_devices(struct work_struct *work)
1088 1086
1089 pn = (u64)ri->pg0.WWPN.High << 32 | 1087 pn = (u64)ri->pg0.WWPN.High << 32 |
1090 (u64)ri->pg0.WWPN.Low; 1088 (u64)ri->pg0.WWPN.Low;
1091 dfcprintk ((MYIOC_s_INFO_FMT 1089 dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
1092 "mptfc_rescan.%d: %llx deleted\n", 1090 "mptfc_rescan.%d: %llx deleted\n",
1093 ioc->name, 1091 ioc->name,
1094 ioc->sh->host_no, 1092 ioc->sh->host_no,
@@ -1212,7 +1210,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1212 1210
1213 if (numSGE < sh->sg_tablesize) { 1211 if (numSGE < sh->sg_tablesize) {
1214 /* Reset this value */ 1212 /* Reset this value */
1215 dprintk((MYIOC_s_INFO_FMT 1213 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1216 "Resetting sg_tablesize to %d from %d\n", 1214 "Resetting sg_tablesize to %d from %d\n",
1217 ioc->name, numSGE, sh->sg_tablesize)); 1215 ioc->name, numSGE, sh->sg_tablesize));
1218 sh->sg_tablesize = numSGE; 1216 sh->sg_tablesize = numSGE;
@@ -1232,7 +1230,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1232 goto out_mptfc_probe; 1230 goto out_mptfc_probe;
1233 } 1231 }
1234 1232
1235 dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", 1233 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
1236 ioc->name, hd->ScsiLookup)); 1234 ioc->name, hd->ScsiLookup));
1237 1235
1238 /* Clear the TM flags 1236 /* Clear the TM flags
@@ -1264,7 +1262,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1264 sh->transportt = mptfc_transport_template; 1262 sh->transportt = mptfc_transport_template;
1265 error = scsi_add_host (sh, &ioc->pcidev->dev); 1263 error = scsi_add_host (sh, &ioc->pcidev->dev);
1266 if(error) { 1264 if(error) {
1267 dprintk((KERN_ERR MYNAM 1265 dprintk(ioc, printk(KERN_ERR MYNAM
1268 "scsi_add_host failed\n")); 1266 "scsi_add_host failed\n"));
1269 goto out_mptfc_probe; 1267 goto out_mptfc_probe;
1270 } 1268 }
@@ -1323,7 +1321,7 @@ mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
1323 unsigned long flags; 1321 unsigned long flags;
1324 int rc=1; 1322 int rc=1;
1325 1323
1326 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", 1324 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
1327 ioc->name, event)); 1325 ioc->name, event));
1328 1326
1329 if (ioc->sh == NULL || 1327 if (ioc->sh == NULL ||
@@ -1357,8 +1355,8 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
1357 return rc; 1355 return rc;
1358 1356
1359 1357
1360 dtmprintk((KERN_WARNING MYNAM 1358 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1361 ": IOC %s_reset routed to FC host driver!\n", 1359 ": IOC %s_reset routed to FC host driver!\n",ioc->name,
1362 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : ( 1360 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
1363 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post"))); 1361 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
1364 1362
@@ -1413,15 +1411,8 @@ mptfc_init(void)
1413 mptfcTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTFC_DRIVER); 1411 mptfcTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTFC_DRIVER);
1414 mptfcInternalCtx = mpt_register(mptscsih_scandv_complete, MPTFC_DRIVER); 1412 mptfcInternalCtx = mpt_register(mptscsih_scandv_complete, MPTFC_DRIVER);
1415 1413
1416 if (mpt_event_register(mptfcDoneCtx, mptfc_event_process) == 0) { 1414 mpt_event_register(mptfcDoneCtx, mptfc_event_process);
1417 devtverboseprintk((KERN_INFO MYNAM 1415 mpt_reset_register(mptfcDoneCtx, mptfc_ioc_reset);
1418 ": Registered for IOC event notifications\n"));
1419 }
1420
1421 if (mpt_reset_register(mptfcDoneCtx, mptfc_ioc_reset) == 0) {
1422 dprintk((KERN_INFO MYNAM
1423 ": Registered for IOC reset notifications\n"));
1424 }
1425 1416
1426 error = pci_register_driver(&mptfc_driver); 1417 error = pci_register_driver(&mptfc_driver);
1427 if (error) 1418 if (error)
@@ -1486,12 +1477,7 @@ mptfc_exit(void)
1486 fc_release_transport(mptfc_transport_template); 1477 fc_release_transport(mptfc_transport_template);
1487 1478
1488 mpt_reset_deregister(mptfcDoneCtx); 1479 mpt_reset_deregister(mptfcDoneCtx);
1489 dprintk((KERN_INFO MYNAM
1490 ": Deregistered for IOC reset notifications\n"));
1491
1492 mpt_event_deregister(mptfcDoneCtx); 1480 mpt_event_deregister(mptfcDoneCtx);
1493 dprintk((KERN_INFO MYNAM
1494 ": Deregistered for IOC event notifications\n"));
1495 1481
1496 mpt_deregister(mptfcInternalCtx); 1482 mpt_deregister(mptfcInternalCtx);
1497 mpt_deregister(mptfcTaskCtx); 1483 mpt_deregister(mptfcTaskCtx);