aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion
diff options
context:
space:
mode:
authorPrakash, Sathya <sathya.prakash@lsi.com>2007-07-24 06:17:41 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-28 11:31:54 -0400
commitd6ecdd638aa840604b87195f2097cabbd095092c (patch)
tree1c3d84dc2219164f4cb99324362226a287029e2b /drivers/message/fusion
parent6757d6b4c0701866bbf2ac02c397f78879b75e58 (diff)
[SCSI] mpt fusion: Changes in mptfc.c mptlan.c mptsas.c and mptspi.c for logging support
This patch contains changes in mptfc.c, mptlan.c, mptsas.c and mptspi.c to support logging in MPT fusion drivers. The changes are majorly in debug printks, the existing debugprintk are modified accroding to new debug macros defined in the file mptbdebug.h signed-off-by: Sathya Prakash <sathya.prakash@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message/fusion')
-rw-r--r--drivers/message/fusion/mptfc.c108
-rw-r--r--drivers/message/fusion/mptlan.c3
-rw-r--r--drivers/message/fusion/mptsas.c276
-rw-r--r--drivers/message/fusion/mptspi.c53
4 files changed, 194 insertions, 246 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);
diff --git a/drivers/message/fusion/mptlan.c b/drivers/message/fusion/mptlan.c
index 7e8a90cb484e..01fc397fdd97 100644
--- a/drivers/message/fusion/mptlan.c
+++ b/drivers/message/fusion/mptlan.c
@@ -1524,8 +1524,7 @@ static int __init mpt_lan_init (void)
1524 1524
1525 dlprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n")); 1525 dlprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n"));
1526 1526
1527 if (mpt_device_driver_register(&mptlan_driver, MPTLAN_DRIVER)) 1527 mpt_device_driver_register(&mptlan_driver, MPTLAN_DRIVER);
1528 dprintk((KERN_INFO MYNAM ": failed to register dd callbacks\n"));
1529 return 0; 1528 return 0;
1530} 1529}
1531 1530
diff --git a/drivers/message/fusion/mptsas.c b/drivers/message/fusion/mptsas.c
index d50664640512..29add83da588 100644
--- a/drivers/message/fusion/mptsas.c
+++ b/drivers/message/fusion/mptsas.c
@@ -201,103 +201,91 @@ struct mptsas_enclosure {
201 u8 sep_channel; /* SEP channel logical channel id */ 201 u8 sep_channel; /* SEP channel logical channel id */
202}; 202};
203 203
204#ifdef MPT_DEBUG_SAS 204static void mptsas_print_phy_data(MPT_ADAPTER *ioc,
205static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data) 205 MPI_SAS_IO_UNIT0_PHY_DATA *phy_data)
206{ 206{
207 printk("---- IO UNIT PAGE 0 ------------\n"); 207 dsasprintk(ioc, printk(KERN_DEBUG "---- IO UNIT PAGE 0 ------------\n"));
208 printk("Handle=0x%X\n", 208 dsasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
209 le16_to_cpu(phy_data->AttachedDeviceHandle)); 209 le16_to_cpu(phy_data->AttachedDeviceHandle)));
210 printk("Controller Handle=0x%X\n", 210 dsasprintk(ioc, printk(KERN_DEBUG "Controller Handle=0x%X\n",
211 le16_to_cpu(phy_data->ControllerDevHandle)); 211 le16_to_cpu(phy_data->ControllerDevHandle)));
212 printk("Port=0x%X\n", phy_data->Port); 212 dsasprintk(ioc, printk(KERN_DEBUG "Port=0x%X\n", phy_data->Port));
213 printk("Port Flags=0x%X\n", phy_data->PortFlags); 213 dsasprintk(ioc, printk(KERN_DEBUG "Port Flags=0x%X\n", phy_data->PortFlags));
214 printk("PHY Flags=0x%X\n", phy_data->PhyFlags); 214 dsasprintk(ioc, printk(KERN_DEBUG "PHY Flags=0x%X\n", phy_data->PhyFlags));
215 printk("Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate); 215 dsasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate));
216 printk("Controller PHY Device Info=0x%X\n", 216 dsasprintk(ioc, printk(KERN_DEBUG "Controller PHY Device Info=0x%X\n",
217 le32_to_cpu(phy_data->ControllerPhyDeviceInfo)); 217 le32_to_cpu(phy_data->ControllerPhyDeviceInfo)));
218 printk("DiscoveryStatus=0x%X\n", 218 dsasprintk(ioc, printk(KERN_DEBUG "DiscoveryStatus=0x%X\n\n",
219 le32_to_cpu(phy_data->DiscoveryStatus)); 219 le32_to_cpu(phy_data->DiscoveryStatus)));
220 printk("\n");
221} 220}
222 221
223static void mptsas_print_phy_pg0(SasPhyPage0_t *pg0) 222static void mptsas_print_phy_pg0(MPT_ADAPTER *ioc, SasPhyPage0_t *pg0)
224{ 223{
225 __le64 sas_address; 224 __le64 sas_address;
226 225
227 memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); 226 memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64));
228 227
229 printk("---- SAS PHY PAGE 0 ------------\n"); 228 dsasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 0 ------------\n"));
230 printk("Attached Device Handle=0x%X\n", 229 dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Handle=0x%X\n",
231 le16_to_cpu(pg0->AttachedDevHandle)); 230 le16_to_cpu(pg0->AttachedDevHandle)));
232 printk("SAS Address=0x%llX\n", 231 dsasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
233 (unsigned long long)le64_to_cpu(sas_address)); 232 (unsigned long long)le64_to_cpu(sas_address)));
234 printk("Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier); 233 dsasprintk(ioc, printk(KERN_DEBUG "Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier));
235 printk("Attached Device Info=0x%X\n", 234 dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Info=0x%X\n",
236 le32_to_cpu(pg0->AttachedDeviceInfo)); 235 le32_to_cpu(pg0->AttachedDeviceInfo)));
237 printk("Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate); 236 dsasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate));
238 printk("Change Count=0x%X\n", pg0->ChangeCount); 237 dsasprintk(ioc, printk(KERN_DEBUG "Change Count=0x%X\n", pg0->ChangeCount));
239 printk("PHY Info=0x%X\n", le32_to_cpu(pg0->PhyInfo)); 238 dsasprintk(ioc, printk(KERN_DEBUG "PHY Info=0x%X\n\n", le32_to_cpu(pg0->PhyInfo)));
240 printk("\n");
241} 239}
242 240
243static void mptsas_print_phy_pg1(SasPhyPage1_t *pg1) 241static void mptsas_print_phy_pg1(MPT_ADAPTER *ioc, SasPhyPage1_t *pg1)
244{ 242{
245 printk("---- SAS PHY PAGE 1 ------------\n"); 243 dsasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 1 ------------\n"));
246 printk("Invalid Dword Count=0x%x\n", pg1->InvalidDwordCount); 244 dsasprintk(ioc, printk(KERN_DEBUG "Invalid Dword Count=0x%x\n", pg1->InvalidDwordCount));
247 printk("Running Disparity Error Count=0x%x\n", 245 dsasprintk(ioc, printk(KERN_DEBUG "Running Disparity Error Count=0x%x\n",
248 pg1->RunningDisparityErrorCount); 246 pg1->RunningDisparityErrorCount));
249 printk("Loss Dword Synch Count=0x%x\n", pg1->LossDwordSynchCount); 247 dsasprintk(ioc, printk(KERN_DEBUG "Loss Dword Synch Count=0x%x\n", pg1->LossDwordSynchCount));
250 printk("PHY Reset Problem Count=0x%x\n", pg1->PhyResetProblemCount); 248 dsasprintk(ioc, printk(KERN_DEBUG "PHY Reset Problem Count=0x%x\n\n", pg1->PhyResetProblemCount));
251 printk("\n");
252} 249}
253 250
254static void mptsas_print_device_pg0(SasDevicePage0_t *pg0) 251static void mptsas_print_device_pg0(MPT_ADAPTER *ioc, SasDevicePage0_t *pg0)
255{ 252{
256 __le64 sas_address; 253 __le64 sas_address;
257 254
258 memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64)); 255 memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64));
259 256
260 printk("---- SAS DEVICE PAGE 0 ---------\n"); 257 dsasprintk(ioc, printk(KERN_DEBUG "---- SAS DEVICE PAGE 0 ---------\n"));
261 printk("Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle)); 258 dsasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle)));
262 printk("Parent Handle=0x%X\n" ,le16_to_cpu(pg0->ParentDevHandle)); 259 dsasprintk(ioc, printk(KERN_DEBUG "Parent Handle=0x%X\n" ,le16_to_cpu(pg0->ParentDevHandle)));
263 printk("Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle)); 260 dsasprintk(ioc, printk(KERN_DEBUG "Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle)));
264 printk("Slot=0x%X\n", le16_to_cpu(pg0->Slot)); 261 dsasprintk(ioc, printk(KERN_DEBUG "Slot=0x%X\n", le16_to_cpu(pg0->Slot)));
265 printk("SAS Address=0x%llX\n", (unsigned long long) 262 dsasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n", (unsigned long long)
266 le64_to_cpu(sas_address)); 263 le64_to_cpu(sas_address)));
267 printk("Target ID=0x%X\n", pg0->TargetID); 264 dsasprintk(ioc, printk(KERN_DEBUG "Target ID=0x%X\n", pg0->TargetID));
268 printk("Bus=0x%X\n", pg0->Bus); 265 dsasprintk(ioc, printk(KERN_DEBUG "Bus=0x%X\n", pg0->Bus));
269 /* The PhyNum field specifies the PHY number of the parent 266 /* The PhyNum field specifies the PHY number of the parent
270 * device this device is linked to 267 * device this device is linked to
271 */ 268 */
272 printk("Parent Phy Num=0x%X\n", pg0->PhyNum); 269 dsasprintk(ioc, printk(KERN_DEBUG "Parent Phy Num=0x%X\n", pg0->PhyNum));
273 printk("Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)); 270 dsasprintk(ioc, printk(KERN_DEBUG "Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)));
274 printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)); 271 dsasprintk(ioc, printk(KERN_DEBUG "Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)));
275 printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags)); 272 dsasprintk(ioc, printk(KERN_DEBUG "Flags=0x%X\n", le16_to_cpu(pg0->Flags)));
276 printk("Physical Port=0x%X\n", pg0->PhysicalPort); 273 dsasprintk(ioc, printk(KERN_DEBUG "Physical Port=0x%X\n\n", pg0->PhysicalPort));
277 printk("\n");
278} 274}
279 275
280static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1) 276static void mptsas_print_expander_pg1(MPT_ADAPTER *ioc, SasExpanderPage1_t *pg1)
281{ 277{
282 printk("---- SAS EXPANDER PAGE 1 ------------\n"); 278 dsasprintk(ioc, printk(KERN_DEBUG "---- SAS EXPANDER PAGE 1 ------------\n"));
283 279 dsasprintk(ioc, printk(KERN_DEBUG "Physical Port=0x%X\n", pg1->PhysicalPort));
284 printk("Physical Port=0x%X\n", pg1->PhysicalPort); 280 dsasprintk(ioc, printk(KERN_DEBUG "PHY Identifier=0x%X\n", pg1->PhyIdentifier));
285 printk("PHY Identifier=0x%X\n", pg1->PhyIdentifier); 281 dsasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate));
286 printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate); 282 dsasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate));
287 printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate); 283 dsasprintk(ioc, printk(KERN_DEBUG "Hardware Link Rate=0x%X\n", pg1->HwLinkRate));
288 printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate); 284 dsasprintk(ioc, printk(KERN_DEBUG "Owner Device Handle=0x%X\n",
289 printk("Owner Device Handle=0x%X\n", 285 le16_to_cpu(pg1->OwnerDevHandle)));
290 le16_to_cpu(pg1->OwnerDevHandle)); 286 dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Handle=0x%X\n\n",
291 printk("Attached Device Handle=0x%X\n", 287 le16_to_cpu(pg1->AttachedDevHandle)));
292 le16_to_cpu(pg1->AttachedDevHandle));
293} 288}
294#else
295#define mptsas_print_phy_data(phy_data) do { } while (0)
296#define mptsas_print_phy_pg0(pg0) do { } while (0)
297#define mptsas_print_phy_pg1(pg1) do { } while (0)
298#define mptsas_print_device_pg0(pg0) do { } while (0)
299#define mptsas_print_expander_pg1(pg1) do { } while (0)
300#endif
301 289
302static inline MPT_ADAPTER *phy_to_ioc(struct sas_phy *phy) 290static inline MPT_ADAPTER *phy_to_ioc(struct sas_phy *phy)
303{ 291{
@@ -354,7 +342,7 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
354 342
355/* no mutex */ 343/* no mutex */
356static void 344static void
357mptsas_port_delete(struct mptsas_portinfo_details * port_details) 345mptsas_port_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo_details * port_details)
358{ 346{
359 struct mptsas_portinfo *port_info; 347 struct mptsas_portinfo *port_info;
360 struct mptsas_phyinfo *phy_info; 348 struct mptsas_phyinfo *phy_info;
@@ -366,7 +354,7 @@ mptsas_port_delete(struct mptsas_portinfo_details * port_details)
366 port_info = port_details->port_info; 354 port_info = port_details->port_info;
367 phy_info = port_info->phy_info; 355 phy_info = port_info->phy_info;
368 356
369 dsaswideprintk((KERN_DEBUG "%s: [%p]: num_phys=%02d " 357 dsaswideprintk(ioc, printk(KERN_DEBUG "%s: [%p]: num_phys=%02d "
370 "bitmask=0x%016llX\n", __FUNCTION__, port_details, 358 "bitmask=0x%016llX\n", __FUNCTION__, port_details,
371 port_details->num_phys, (unsigned long long) 359 port_details->num_phys, (unsigned long long)
372 port_details->phy_bitmask)); 360 port_details->phy_bitmask));
@@ -390,20 +378,19 @@ mptsas_get_rphy(struct mptsas_phyinfo *phy_info)
390} 378}
391 379
392static inline void 380static inline void
393mptsas_set_rphy(struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy) 381mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy)
394{ 382{
395 if (phy_info->port_details) { 383 if (phy_info->port_details) {
396 phy_info->port_details->rphy = rphy; 384 phy_info->port_details->rphy = rphy;
397 dsaswideprintk((KERN_DEBUG "sas_rphy_add: rphy=%p\n", rphy)); 385 dsaswideprintk(ioc, printk(KERN_DEBUG "sas_rphy_add: rphy=%p\n", rphy));
398 } 386 }
399 387
400#ifdef MPT_DEBUG_SAS_WIDE
401 if (rphy) { 388 if (rphy) {
402 dev_printk(KERN_DEBUG, &rphy->dev, "add:"); 389 dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
403 printk("rphy=%p release=%p\n", 390 &rphy->dev, "add:"));
404 rphy, rphy->dev.release); 391 dsaswideprintk(ioc, printk(KERN_DEBUG "rphy=%p release=%p\n",
392 rphy, rphy->dev.release));
405 } 393 }
406#endif
407} 394}
408 395
409static inline struct sas_port * 396static inline struct sas_port *
@@ -416,18 +403,17 @@ mptsas_get_port(struct mptsas_phyinfo *phy_info)
416} 403}
417 404
418static inline void 405static inline void
419mptsas_set_port(struct mptsas_phyinfo *phy_info, struct sas_port *port) 406mptsas_set_port(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_port *port)
420{ 407{
421 if (phy_info->port_details) 408 if (phy_info->port_details)
422 phy_info->port_details->port = port; 409 phy_info->port_details->port = port;
423 410
424#ifdef MPT_DEBUG_SAS_WIDE
425 if (port) { 411 if (port) {
426 dev_printk(KERN_DEBUG, &port->dev, "add: "); 412 dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
427 printk("port=%p release=%p\n", 413 &port->dev, "add:"));
428 port, port->dev.release); 414 dsaswideprintk(ioc, printk(KERN_DEBUG "port=%p release=%p\n",
415 port, port->dev.release));
429 } 416 }
430#endif
431} 417}
432 418
433static inline struct scsi_target * 419static inline struct scsi_target *
@@ -477,7 +463,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
477 * Removing a phy from a port, letting the last 463 * Removing a phy from a port, letting the last
478 * phy be removed by firmware events. 464 * phy be removed by firmware events.
479 */ 465 */
480 dsaswideprintk((KERN_DEBUG 466 dsaswideprintk(ioc, printk(KERN_DEBUG
481 "%s: [%p]: deleting phy = %d\n", 467 "%s: [%p]: deleting phy = %d\n",
482 __FUNCTION__, port_details, i)); 468 __FUNCTION__, port_details, i));
483 port_details->num_phys--; 469 port_details->num_phys--;
@@ -493,7 +479,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
493 phy_info = port_info->phy_info; 479 phy_info = port_info->phy_info;
494 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) { 480 for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
495 sas_address = phy_info->attached.sas_address; 481 sas_address = phy_info->attached.sas_address;
496 dsaswideprintk((KERN_DEBUG "phy_id=%d sas_address=0x%018llX\n", 482 dsaswideprintk(ioc, printk(KERN_DEBUG "phy_id=%d sas_address=0x%018llX\n",
497 i, (unsigned long long)sas_address)); 483 i, (unsigned long long)sas_address));
498 if (!sas_address) 484 if (!sas_address)
499 continue; 485 continue;
@@ -512,7 +498,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
512 port_details->phy_bitmask |= 498 port_details->phy_bitmask |=
513 (1 << phy_info->phy_id); 499 (1 << phy_info->phy_id);
514 phy_info->sas_port_add_phy=1; 500 phy_info->sas_port_add_phy=1;
515 dsaswideprintk((KERN_DEBUG "\t\tForming port\n\t\t" 501 dsaswideprintk(ioc, printk(KERN_DEBUG "\t\tForming port\n\t\t"
516 "phy_id=%d sas_address=0x%018llX\n", 502 "phy_id=%d sas_address=0x%018llX\n",
517 i, (unsigned long long)sas_address)); 503 i, (unsigned long long)sas_address));
518 phy_info->port_details = port_details; 504 phy_info->port_details = port_details;
@@ -529,7 +515,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
529 continue; 515 continue;
530 if (phy_info_cmp->port_details == port_details ) 516 if (phy_info_cmp->port_details == port_details )
531 continue; 517 continue;
532 dsaswideprintk((KERN_DEBUG 518 dsaswideprintk(ioc, printk(KERN_DEBUG
533 "\t\tphy_id=%d sas_address=0x%018llX\n", 519 "\t\tphy_id=%d sas_address=0x%018llX\n",
534 j, (unsigned long long) 520 j, (unsigned long long)
535 phy_info_cmp->attached.sas_address)); 521 phy_info_cmp->attached.sas_address));
@@ -559,21 +545,19 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
559 545
560 out: 546 out:
561 547
562#ifdef MPT_DEBUG_SAS_WIDE
563 for (i = 0; i < port_info->num_phys; i++) { 548 for (i = 0; i < port_info->num_phys; i++) {
564 port_details = port_info->phy_info[i].port_details; 549 port_details = port_info->phy_info[i].port_details;
565 if (!port_details) 550 if (!port_details)
566 continue; 551 continue;
567 dsaswideprintk((KERN_DEBUG 552 dsaswideprintk(ioc, printk(KERN_DEBUG
568 "%s: [%p]: phy_id=%02d num_phys=%02d " 553 "%s: [%p]: phy_id=%02d num_phys=%02d "
569 "bitmask=0x%016llX\n", __FUNCTION__, 554 "bitmask=0x%016llX\n", __FUNCTION__,
570 port_details, i, port_details->num_phys, 555 port_details, i, port_details->num_phys,
571 (unsigned long long)port_details->phy_bitmask)); 556 (unsigned long long)port_details->phy_bitmask));
572 dsaswideprintk((KERN_DEBUG"\t\tport = %p rphy=%p\n", 557 dsaswideprintk(ioc, printk(KERN_DEBUG"\t\tport = %p rphy=%p\n",
573 port_details->port, port_details->rphy)); 558 port_details->port, port_details->rphy));
574 } 559 }
575 dsaswideprintk((KERN_DEBUG"\n")); 560 dsaswideprintk(ioc, printk(KERN_DEBUG"\n"));
576#endif
577 mutex_unlock(&ioc->sas_topology_mutex); 561 mutex_unlock(&ioc->sas_topology_mutex);
578} 562}
579 563
@@ -622,7 +606,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
622 SCSITaskMgmt_t *pScsiTm; 606 SCSITaskMgmt_t *pScsiTm;
623 607
624 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) { 608 if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
625 dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n", 609 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n",
626 ioc->name,__FUNCTION__, __LINE__)); 610 ioc->name,__FUNCTION__, __LINE__));
627 return 0; 611 return 0;
628 } 612 }
@@ -637,12 +621,12 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
637 pScsiTm->TaskType = MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET; 621 pScsiTm->TaskType = MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
638 pScsiTm->MsgFlags = MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION; 622 pScsiTm->MsgFlags = MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION;
639 623
640 DBG_DUMP_TM_REQUEST_FRAME(mf); 624 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
641 625
642 if (mpt_send_handshake_request(ioc->TaskCtx, ioc, 626 if (mpt_send_handshake_request(ioc->TaskCtx, ioc,
643 sizeof(SCSITaskMgmt_t), (u32 *)mf, NO_SLEEP)) { 627 sizeof(SCSITaskMgmt_t), (u32 *)mf, NO_SLEEP)) {
644 mpt_free_msg_frame(ioc, mf); 628 mpt_free_msg_frame(ioc, mf);
645 dfailprintk((MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n", 629 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n",
646 ioc->name,__FUNCTION__, __LINE__)); 630 ioc->name,__FUNCTION__, __LINE__));
647 return 0; 631 return 0;
648 } 632 }
@@ -681,7 +665,7 @@ mptsas_target_reset_queue(MPT_ADAPTER *ioc,
681 target_reset_list = kzalloc(sizeof(*target_reset_list), 665 target_reset_list = kzalloc(sizeof(*target_reset_list),
682 GFP_ATOMIC); 666 GFP_ATOMIC);
683 if (!target_reset_list) { 667 if (!target_reset_list) {
684 dfailprintk((MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n", 668 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
685 ioc->name,__FUNCTION__, __LINE__)); 669 ioc->name,__FUNCTION__, __LINE__));
686 return; 670 return;
687 } 671 }
@@ -748,7 +732,7 @@ mptsas_dev_reset_complete(MPT_ADAPTER *ioc)
748 732
749 ev = kzalloc(sizeof(*ev), GFP_ATOMIC); 733 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
750 if (!ev) { 734 if (!ev) {
751 dfailprintk((MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n", 735 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
752 ioc->name,__FUNCTION__, __LINE__)); 736 ioc->name,__FUNCTION__, __LINE__));
753 return; 737 return;
754 } 738 }
@@ -1168,7 +1152,7 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
1168 if (error) 1152 if (error)
1169 goto out_free_consistent; 1153 goto out_free_consistent;
1170 1154
1171 mptsas_print_phy_pg1(buffer); 1155 mptsas_print_phy_pg1(ioc, buffer);
1172 1156
1173 phy->invalid_dword_count = le32_to_cpu(buffer->InvalidDwordCount); 1157 phy->invalid_dword_count = le32_to_cpu(buffer->InvalidDwordCount);
1174 phy->running_disparity_error_count = 1158 phy->running_disparity_error_count =
@@ -1397,7 +1381,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
1397 le16_to_cpu(buffer->NvdataVersionDefault); 1381 le16_to_cpu(buffer->NvdataVersionDefault);
1398 1382
1399 for (i = 0; i < port_info->num_phys; i++) { 1383 for (i = 0; i < port_info->num_phys; i++) {
1400 mptsas_print_phy_data(&buffer->PhyData[i]); 1384 mptsas_print_phy_data(ioc, &buffer->PhyData[i]);
1401 port_info->phy_info[i].phy_id = i; 1385 port_info->phy_info[i].phy_id = i;
1402 port_info->phy_info[i].port_id = 1386 port_info->phy_info[i].port_id =
1403 buffer->PhyData[i].Port; 1387 buffer->PhyData[i].Port;
@@ -1522,7 +1506,7 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1522 if (error) 1506 if (error)
1523 goto out_free_consistent; 1507 goto out_free_consistent;
1524 1508
1525 mptsas_print_phy_pg0(buffer); 1509 mptsas_print_phy_pg0(ioc, buffer);
1526 1510
1527 phy_info->hw_link_rate = buffer->HwLinkRate; 1511 phy_info->hw_link_rate = buffer->HwLinkRate;
1528 phy_info->programmed_link_rate = buffer->ProgrammedLinkRate; 1512 phy_info->programmed_link_rate = buffer->ProgrammedLinkRate;
@@ -1589,7 +1573,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
1589 if (error) 1573 if (error)
1590 goto out_free_consistent; 1574 goto out_free_consistent;
1591 1575
1592 mptsas_print_device_pg0(buffer); 1576 mptsas_print_device_pg0(ioc, buffer);
1593 1577
1594 device_info->handle = le16_to_cpu(buffer->DevHandle); 1578 device_info->handle = le16_to_cpu(buffer->DevHandle);
1595 device_info->handle_parent = le16_to_cpu(buffer->ParentDevHandle); 1579 device_info->handle_parent = le16_to_cpu(buffer->ParentDevHandle);
@@ -1737,7 +1721,7 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
1737 goto out_free_consistent; 1721 goto out_free_consistent;
1738 1722
1739 1723
1740 mptsas_print_expander_pg1(buffer); 1724 mptsas_print_expander_pg1(ioc, buffer);
1741 1725
1742 /* save config data */ 1726 /* save config data */
1743 phy_info->phy_id = buffer->PhyIdentifier; 1727 phy_info->phy_id = buffer->PhyIdentifier;
@@ -1946,17 +1930,17 @@ static int mptsas_probe_one_phy(struct device *dev,
1946 } 1930 }
1947 error = sas_port_add(port); 1931 error = sas_port_add(port);
1948 if (error) { 1932 if (error) {
1949 dfailprintk((MYIOC_s_ERR_FMT 1933 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
1950 "%s: exit at line=%d\n", ioc->name, 1934 "%s: exit at line=%d\n", ioc->name,
1951 __FUNCTION__, __LINE__)); 1935 __FUNCTION__, __LINE__));
1952 goto out; 1936 goto out;
1953 } 1937 }
1954 mptsas_set_port(phy_info, port); 1938 mptsas_set_port(ioc, phy_info, port);
1955 dsaswideprintk((KERN_DEBUG 1939 dsaswideprintk(ioc, printk(KERN_DEBUG
1956 "sas_port_alloc: port=%p dev=%p port_id=%d\n", 1940 "sas_port_alloc: port=%p dev=%p port_id=%d\n",
1957 port, dev, port->port_identifier)); 1941 port, dev, port->port_identifier));
1958 } 1942 }
1959 dsaswideprintk((KERN_DEBUG "sas_port_add_phy: phy_id=%d\n", 1943 dsaswideprintk(ioc, printk(KERN_DEBUG "sas_port_add_phy: phy_id=%d\n",
1960 phy_info->phy_id)); 1944 phy_info->phy_id));
1961 sas_port_add_phy(port, phy_info->phy); 1945 sas_port_add_phy(port, phy_info->phy);
1962 phy_info->sas_port_add_phy = 0; 1946 phy_info->sas_port_add_phy = 0;
@@ -2017,7 +2001,7 @@ static int mptsas_probe_one_phy(struct device *dev,
2017 break; 2001 break;
2018 } 2002 }
2019 if (!rphy) { 2003 if (!rphy) {
2020 dfailprintk((MYIOC_s_ERR_FMT 2004 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2021 "%s: exit at line=%d\n", ioc->name, 2005 "%s: exit at line=%d\n", ioc->name,
2022 __FUNCTION__, __LINE__)); 2006 __FUNCTION__, __LINE__));
2023 goto out; 2007 goto out;
@@ -2026,13 +2010,13 @@ static int mptsas_probe_one_phy(struct device *dev,
2026 rphy->identify = identify; 2010 rphy->identify = identify;
2027 error = sas_rphy_add(rphy); 2011 error = sas_rphy_add(rphy);
2028 if (error) { 2012 if (error) {
2029 dfailprintk((MYIOC_s_ERR_FMT 2013 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2030 "%s: exit at line=%d\n", ioc->name, 2014 "%s: exit at line=%d\n", ioc->name,
2031 __FUNCTION__, __LINE__)); 2015 __FUNCTION__, __LINE__));
2032 sas_rphy_free(rphy); 2016 sas_rphy_free(rphy);
2033 goto out; 2017 goto out;
2034 } 2018 }
2035 mptsas_set_rphy(phy_info, rphy); 2019 mptsas_set_rphy(ioc, phy_info, rphy);
2036 } 2020 }
2037 2021
2038 out: 2022 out:
@@ -2258,18 +2242,17 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
2258 if (phy_info->attached.sas_address != 2242 if (phy_info->attached.sas_address !=
2259 expander_sas_address) 2243 expander_sas_address)
2260 continue; 2244 continue;
2261#ifdef MPT_DEBUG_SAS_WIDE 2245 dsaswideprintk(ioc,
2262 dev_printk(KERN_DEBUG, &port->dev, 2246 dev_printk(KERN_DEBUG, &port->dev,
2263 "delete port (%d)\n", port->port_identifier); 2247 "delete port (%d)\n", port->port_identifier));
2264#endif
2265 sas_port_delete(port); 2248 sas_port_delete(port);
2266 mptsas_port_delete(phy_info->port_details); 2249 mptsas_port_delete(ioc, phy_info->port_details);
2267 } 2250 }
2268 next_port: 2251 next_port:
2269 2252
2270 phy_info = port_info->phy_info; 2253 phy_info = port_info->phy_info;
2271 for (i = 0; i < port_info->num_phys; i++, phy_info++) 2254 for (i = 0; i < port_info->num_phys; i++, phy_info++)
2272 mptsas_port_delete(phy_info->port_details); 2255 mptsas_port_delete(ioc, phy_info->port_details);
2273 2256
2274 list_del(&port_info->list); 2257 list_del(&port_info->list);
2275 kfree(port_info->phy_info); 2258 kfree(port_info->phy_info);
@@ -2555,7 +2538,7 @@ mptsas_hotplug_work(struct work_struct *work)
2555 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID << 2538 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
2556 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 2539 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
2557 (ev->channel << 8) + ev->id)) { 2540 (ev->channel << 8) + ev->id)) {
2558 dfailprintk((MYIOC_s_ERR_FMT 2541 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2559 "%s: exit at line=%d\n", ioc->name, 2542 "%s: exit at line=%d\n", ioc->name,
2560 __FUNCTION__, __LINE__)); 2543 __FUNCTION__, __LINE__));
2561 break; 2544 break;
@@ -2575,20 +2558,20 @@ mptsas_hotplug_work(struct work_struct *work)
2575 * Sanity checks, for non-existing phys and remote rphys. 2558 * Sanity checks, for non-existing phys and remote rphys.
2576 */ 2559 */
2577 if (!phy_info){ 2560 if (!phy_info){
2578 dfailprintk((MYIOC_s_ERR_FMT 2561 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2579 "%s: exit at line=%d\n", ioc->name, 2562 "%s: exit at line=%d\n", ioc->name,
2580 __FUNCTION__, __LINE__)); 2563 __FUNCTION__, __LINE__));
2581 break; 2564 break;
2582 } 2565 }
2583 if (!phy_info->port_details) { 2566 if (!phy_info->port_details) {
2584 dfailprintk((MYIOC_s_ERR_FMT 2567 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2585 "%s: exit at line=%d\n", ioc->name, 2568 "%s: exit at line=%d\n", ioc->name,
2586 __FUNCTION__, __LINE__)); 2569 __FUNCTION__, __LINE__));
2587 break; 2570 break;
2588 } 2571 }
2589 rphy = mptsas_get_rphy(phy_info); 2572 rphy = mptsas_get_rphy(phy_info);
2590 if (!rphy) { 2573 if (!rphy) {
2591 dfailprintk((MYIOC_s_ERR_FMT 2574 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2592 "%s: exit at line=%d\n", ioc->name, 2575 "%s: exit at line=%d\n", ioc->name,
2593 __FUNCTION__, __LINE__)); 2576 __FUNCTION__, __LINE__));
2594 break; 2577 break;
@@ -2596,7 +2579,7 @@ mptsas_hotplug_work(struct work_struct *work)
2596 2579
2597 port = mptsas_get_port(phy_info); 2580 port = mptsas_get_port(phy_info);
2598 if (!port) { 2581 if (!port) {
2599 dfailprintk((MYIOC_s_ERR_FMT 2582 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2600 "%s: exit at line=%d\n", ioc->name, 2583 "%s: exit at line=%d\n", ioc->name,
2601 __FUNCTION__, __LINE__)); 2584 __FUNCTION__, __LINE__));
2602 break; 2585 break;
@@ -2607,7 +2590,7 @@ mptsas_hotplug_work(struct work_struct *work)
2607 vtarget = starget->hostdata; 2590 vtarget = starget->hostdata;
2608 2591
2609 if (!vtarget) { 2592 if (!vtarget) {
2610 dfailprintk((MYIOC_s_ERR_FMT 2593 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2611 "%s: exit at line=%d\n", ioc->name, 2594 "%s: exit at line=%d\n", ioc->name,
2612 __FUNCTION__, __LINE__)); 2595 __FUNCTION__, __LINE__));
2613 break; 2596 break;
@@ -2645,12 +2628,10 @@ mptsas_hotplug_work(struct work_struct *work)
2645 printk(MYIOC_s_INFO_FMT 2628 printk(MYIOC_s_INFO_FMT
2646 "removing %s device, channel %d, id %d, phy %d\n", 2629 "removing %s device, channel %d, id %d, phy %d\n",
2647 ioc->name, ds, ev->channel, ev->id, phy_info->phy_id); 2630 ioc->name, ds, ev->channel, ev->id, phy_info->phy_id);
2648#ifdef MPT_DEBUG_SAS_WIDE
2649 dev_printk(KERN_DEBUG, &port->dev, 2631 dev_printk(KERN_DEBUG, &port->dev,
2650 "delete port (%d)\n", port->port_identifier); 2632 "delete port (%d)\n", port->port_identifier);
2651#endif
2652 sas_port_delete(port); 2633 sas_port_delete(port);
2653 mptsas_port_delete(phy_info->port_details); 2634 mptsas_port_delete(ioc, phy_info->port_details);
2654 break; 2635 break;
2655 case MPTSAS_ADD_DEVICE: 2636 case MPTSAS_ADD_DEVICE:
2656 2637
@@ -2664,7 +2645,7 @@ mptsas_hotplug_work(struct work_struct *work)
2664 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID << 2645 (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
2665 MPI_SAS_DEVICE_PGAD_FORM_SHIFT), 2646 MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
2666 (ev->channel << 8) + ev->id)) { 2647 (ev->channel << 8) + ev->id)) {
2667 dfailprintk((MYIOC_s_ERR_FMT 2648 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2668 "%s: exit at line=%d\n", ioc->name, 2649 "%s: exit at line=%d\n", ioc->name,
2669 __FUNCTION__, __LINE__)); 2650 __FUNCTION__, __LINE__));
2670 break; 2651 break;
@@ -2676,7 +2657,7 @@ mptsas_hotplug_work(struct work_struct *work)
2676 sas_device.sas_address); 2657 sas_device.sas_address);
2677 2658
2678 if (!phy_info || !phy_info->port_details) { 2659 if (!phy_info || !phy_info->port_details) {
2679 dfailprintk((MYIOC_s_ERR_FMT 2660 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2680 "%s: exit at line=%d\n", ioc->name, 2661 "%s: exit at line=%d\n", ioc->name,
2681 __FUNCTION__, __LINE__)); 2662 __FUNCTION__, __LINE__));
2682 break; 2663 break;
@@ -2688,7 +2669,7 @@ mptsas_hotplug_work(struct work_struct *work)
2688 vtarget = starget->hostdata; 2669 vtarget = starget->hostdata;
2689 2670
2690 if (!vtarget) { 2671 if (!vtarget) {
2691 dfailprintk((MYIOC_s_ERR_FMT 2672 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2692 "%s: exit at line=%d\n", ioc->name, 2673 "%s: exit at line=%d\n", ioc->name,
2693 __FUNCTION__, __LINE__)); 2674 __FUNCTION__, __LINE__));
2694 break; 2675 break;
@@ -2711,7 +2692,7 @@ mptsas_hotplug_work(struct work_struct *work)
2711 } 2692 }
2712 2693
2713 if (mptsas_get_rphy(phy_info)) { 2694 if (mptsas_get_rphy(phy_info)) {
2714 dfailprintk((MYIOC_s_ERR_FMT 2695 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2715 "%s: exit at line=%d\n", ioc->name, 2696 "%s: exit at line=%d\n", ioc->name,
2716 __FUNCTION__, __LINE__)); 2697 __FUNCTION__, __LINE__));
2717 if (ev->channel) printk("%d\n", __LINE__); 2698 if (ev->channel) printk("%d\n", __LINE__);
@@ -2720,7 +2701,7 @@ mptsas_hotplug_work(struct work_struct *work)
2720 2701
2721 port = mptsas_get_port(phy_info); 2702 port = mptsas_get_port(phy_info);
2722 if (!port) { 2703 if (!port) {
2723 dfailprintk((MYIOC_s_ERR_FMT 2704 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2724 "%s: exit at line=%d\n", ioc->name, 2705 "%s: exit at line=%d\n", ioc->name,
2725 __FUNCTION__, __LINE__)); 2706 __FUNCTION__, __LINE__));
2726 break; 2707 break;
@@ -2745,7 +2726,7 @@ mptsas_hotplug_work(struct work_struct *work)
2745 mptsas_parse_device_info(&identify, &phy_info->attached); 2726 mptsas_parse_device_info(&identify, &phy_info->attached);
2746 rphy = sas_end_device_alloc(port); 2727 rphy = sas_end_device_alloc(port);
2747 if (!rphy) { 2728 if (!rphy) {
2748 dfailprintk((MYIOC_s_ERR_FMT 2729 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2749 "%s: exit at line=%d\n", ioc->name, 2730 "%s: exit at line=%d\n", ioc->name,
2750 __FUNCTION__, __LINE__)); 2731 __FUNCTION__, __LINE__));
2751 break; /* non-fatal: an rphy can be added later */ 2732 break; /* non-fatal: an rphy can be added later */
@@ -2753,13 +2734,13 @@ mptsas_hotplug_work(struct work_struct *work)
2753 2734
2754 rphy->identify = identify; 2735 rphy->identify = identify;
2755 if (sas_rphy_add(rphy)) { 2736 if (sas_rphy_add(rphy)) {
2756 dfailprintk((MYIOC_s_ERR_FMT 2737 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
2757 "%s: exit at line=%d\n", ioc->name, 2738 "%s: exit at line=%d\n", ioc->name,
2758 __FUNCTION__, __LINE__)); 2739 __FUNCTION__, __LINE__));
2759 sas_rphy_free(rphy); 2740 sas_rphy_free(rphy);
2760 break; 2741 break;
2761 } 2742 }
2762 mptsas_set_rphy(phy_info, rphy); 2743 mptsas_set_rphy(ioc, phy_info, rphy);
2763 break; 2744 break;
2764 case MPTSAS_ADD_RAID: 2745 case MPTSAS_ADD_RAID:
2765 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL, 2746 sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
@@ -3175,7 +3156,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3175 3156
3176 if (numSGE < sh->sg_tablesize) { 3157 if (numSGE < sh->sg_tablesize) {
3177 /* Reset this value */ 3158 /* Reset this value */
3178 dprintk((MYIOC_s_INFO_FMT 3159 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3179 "Resetting sg_tablesize to %d from %d\n", 3160 "Resetting sg_tablesize to %d from %d\n",
3180 ioc->name, numSGE, sh->sg_tablesize)); 3161 ioc->name, numSGE, sh->sg_tablesize));
3181 sh->sg_tablesize = numSGE; 3162 sh->sg_tablesize = numSGE;
@@ -3193,7 +3174,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3193 goto out_mptsas_probe; 3174 goto out_mptsas_probe;
3194 } 3175 }
3195 3176
3196 dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", 3177 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
3197 ioc->name, hd->ScsiLookup)); 3178 ioc->name, hd->ScsiLookup));
3198 3179
3199 /* Clear the TM flags 3180 /* Clear the TM flags
@@ -3233,7 +3214,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
3233 3214
3234 error = scsi_add_host(sh, &ioc->pcidev->dev); 3215 error = scsi_add_host(sh, &ioc->pcidev->dev);
3235 if (error) { 3216 if (error) {
3236 dprintk((KERN_ERR MYNAM 3217 dprintk(ioc, printk(KERN_ERR MYNAM
3237 "scsi_add_host failed\n")); 3218 "scsi_add_host failed\n"));
3238 goto out_mptsas_probe; 3219 goto out_mptsas_probe;
3239 } 3220 }
@@ -3261,7 +3242,7 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
3261 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) { 3242 list_for_each_entry_safe(p, n, &ioc->sas_topology, list) {
3262 list_del(&p->list); 3243 list_del(&p->list);
3263 for (i = 0 ; i < p->num_phys ; i++) 3244 for (i = 0 ; i < p->num_phys ; i++)
3264 mptsas_port_delete(p->phy_info[i].port_details); 3245 mptsas_port_delete(ioc, p->phy_info[i].port_details);
3265 kfree(p->phy_info); 3246 kfree(p->phy_info);
3266 kfree(p); 3247 kfree(p);
3267 } 3248 }
@@ -3316,15 +3297,8 @@ mptsas_init(void)
3316 mpt_register(mptscsih_scandv_complete, MPTSAS_DRIVER); 3297 mpt_register(mptscsih_scandv_complete, MPTSAS_DRIVER);
3317 mptsasMgmtCtx = mpt_register(mptsas_mgmt_done, MPTSAS_DRIVER); 3298 mptsasMgmtCtx = mpt_register(mptsas_mgmt_done, MPTSAS_DRIVER);
3318 3299
3319 if (mpt_event_register(mptsasDoneCtx, mptsas_event_process) == 0) { 3300 mpt_event_register(mptsasDoneCtx, mptsas_event_process);
3320 devtverboseprintk((KERN_INFO MYNAM 3301 mpt_reset_register(mptsasDoneCtx, mptsas_ioc_reset);
3321 ": Registered for IOC event notifications\n"));
3322 }
3323
3324 if (mpt_reset_register(mptsasDoneCtx, mptsas_ioc_reset) == 0) {
3325 dprintk((KERN_INFO MYNAM
3326 ": Registered for IOC reset notifications\n"));
3327 }
3328 3302
3329 error = pci_register_driver(&mptsas_driver); 3303 error = pci_register_driver(&mptsas_driver);
3330 if (error) 3304 if (error)
diff --git a/drivers/message/fusion/mptspi.c b/drivers/message/fusion/mptspi.c
index 947fe2901800..8c98420640a5 100644
--- a/drivers/message/fusion/mptspi.c
+++ b/drivers/message/fusion/mptspi.c
@@ -138,7 +138,9 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
138 else { 138 else {
139 factor = MPT_ULTRA320; 139 factor = MPT_ULTRA320;
140 if (scsi_device_qas(sdev)) { 140 if (scsi_device_qas(sdev)) {
141 ddvprintk((KERN_INFO "Enabling QAS due to byte56=%02x on id=%d!\n", scsi_device_qas(sdev), id)); 141 ddvprintk(hd->ioc,
142 printk(KERN_DEBUG "Enabling QAS due to "
143 "byte56=%02x on id=%d!\n", scsi_device_qas(sdev), id));
142 noQas = 0; 144 noQas = 0;
143 } 145 }
144 if (sdev->type == TYPE_TAPE && 146 if (sdev->type == TYPE_TAPE &&
@@ -225,7 +227,8 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
225 /* Disable QAS in a mixed configuration case 227 /* Disable QAS in a mixed configuration case
226 */ 228 */
227 229
228 ddvprintk((KERN_INFO "Disabling QAS due to noQas=%02x on id=%d!\n", noQas, id)); 230 ddvprintk(hd->ioc, printk(KERN_DEBUG
231 "Disabling QAS due to noQas=%02x on id=%d!\n", noQas, id));
229 } 232 }
230} 233}
231 234
@@ -256,8 +259,8 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd, u8 channel , u8 id)
256 /* Get a MF for this command. 259 /* Get a MF for this command.
257 */ 260 */
258 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) { 261 if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {
259 dfailprintk((MYIOC_s_WARN_FMT "writeIOCPage4 : no msg frames!\n", 262 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
260 ioc->name)); 263 "writeIOCPage4 : no msg frames!\n",ioc->name));
261 return -EAGAIN; 264 return -EAGAIN;
262 } 265 }
263 266
@@ -297,7 +300,7 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd, u8 channel , u8 id)
297 300
298 mpt_add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma); 301 mpt_add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma);
299 302
300 ddvprintk((MYIOC_s_INFO_FMT 303 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
301 "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n", 304 "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n",
302 ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel)); 305 ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
303 306
@@ -422,7 +425,7 @@ static int mptspi_target_alloc(struct scsi_target *starget)
422 if (starget->channel == 0 && 425 if (starget->channel == 0 &&
423 mptspi_is_raid(hd, starget->id)) { 426 mptspi_is_raid(hd, starget->id)) {
424 vtarget->raidVolume = 1; 427 vtarget->raidVolume = 1;
425 ddvprintk((KERN_INFO 428 ddvprintk(hd->ioc, printk(KERN_DEBUG
426 "RAID Volume @ channel=%d id=%d\n", starget->channel, 429 "RAID Volume @ channel=%d id=%d\n", starget->channel,
427 starget->id)); 430 starget->id));
428 } 431 }
@@ -462,7 +465,7 @@ mptspi_target_destroy(struct scsi_target *starget)
462static void 465static void
463mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii) 466mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii)
464{ 467{
465 ddvprintk((MYIOC_s_INFO_FMT "id=%d Requested = 0x%08x" 468 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Requested = 0x%08x"
466 " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n", 469 " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n",
467 hd->ioc->name, starget->id, ii, 470 hd->ioc->name, starget->id, ii,
468 ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "", 471 ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "",
@@ -487,7 +490,7 @@ mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget,
487static void 490static void
488mptspi_print_read_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii) 491mptspi_print_read_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii)
489{ 492{
490 ddvprintk((MYIOC_s_INFO_FMT "id=%d Read = 0x%08x" 493 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Read = 0x%08x"
491 " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n", 494 " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n",
492 hd->ioc->name, starget->id, ii, 495 hd->ioc->name, starget->id, ii,
493 ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "", 496 ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "",
@@ -613,7 +616,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
613 /* Get and Populate a free Frame 616 /* Get and Populate a free Frame
614 */ 617 */
615 if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) { 618 if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
616 ddvprintk((MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n", 619 ddvprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
617 hd->ioc->name)); 620 hd->ioc->name));
618 return -EAGAIN; 621 return -EAGAIN;
619 } 622 }
@@ -635,7 +638,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
635 mpt_add_sge((char *)&pReq->ActionDataSGE, 638 mpt_add_sge((char *)&pReq->ActionDataSGE,
636 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1); 639 MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
637 640
638 ddvprintk((MYIOC_s_INFO_FMT "RAID Volume action=%x channel=%d id=%d\n", 641 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
639 hd->ioc->name, pReq->Action, channel, id)); 642 hd->ioc->name, pReq->Action, channel, id));
640 643
641 hd->pLocal = NULL; 644 hd->pLocal = NULL;
@@ -735,7 +738,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev)
735 if (ret) 738 if (ret)
736 return ret; 739 return ret;
737 740
738 ddvprintk((MYIOC_s_INFO_FMT "id=%d min_period=0x%02x" 741 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d min_period=0x%02x"
739 " max_offset=0x%02x max_width=%d\n", hd->ioc->name, 742 " max_offset=0x%02x max_width=%d\n", hd->ioc->name,
740 sdev->id, spi_min_period(scsi_target(sdev)), 743 sdev->id, spi_min_period(scsi_target(sdev)),
741 spi_max_offset(scsi_target(sdev)), 744 spi_max_offset(scsi_target(sdev)),
@@ -768,10 +771,8 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
768 return 0; 771 return 0;
769 } 772 }
770 773
771#ifdef MPT_DEBUG_DV
772 if (spi_dv_pending(scsi_target(SCpnt->device))) 774 if (spi_dv_pending(scsi_target(SCpnt->device)))
773 scsi_print_command(SCpnt); 775 ddvprintk(hd->ioc, scsi_print_command(SCpnt));
774#endif
775 776
776 return mptscsih_qcmd(SCpnt,done); 777 return mptscsih_qcmd(SCpnt,done);
777} 778}
@@ -1415,7 +1416,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1415 1416
1416 if (numSGE < sh->sg_tablesize) { 1417 if (numSGE < sh->sg_tablesize) {
1417 /* Reset this value */ 1418 /* Reset this value */
1418 dprintk((MYIOC_s_INFO_FMT 1419 dprintk(ioc, printk(MYIOC_s_INFO_FMT
1419 "Resetting sg_tablesize to %d from %d\n", 1420 "Resetting sg_tablesize to %d from %d\n",
1420 ioc->name, numSGE, sh->sg_tablesize)); 1421 ioc->name, numSGE, sh->sg_tablesize));
1421 sh->sg_tablesize = numSGE; 1422 sh->sg_tablesize = numSGE;
@@ -1435,7 +1436,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1435 goto out_mptspi_probe; 1436 goto out_mptspi_probe;
1436 } 1437 }
1437 1438
1438 dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n", 1439 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
1439 ioc->name, hd->ScsiLookup)); 1440 ioc->name, hd->ScsiLookup));
1440 1441
1441 /* Clear the TM flags 1442 /* Clear the TM flags
@@ -1463,7 +1464,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1463 ioc->spi_data.Saf_Te = mpt_saf_te; 1464 ioc->spi_data.Saf_Te = mpt_saf_te;
1464 1465
1465 hd->negoNvram = MPT_SCSICFG_USE_NVRAM; 1466 hd->negoNvram = MPT_SCSICFG_USE_NVRAM;
1466 ddvprintk((MYIOC_s_INFO_FMT 1467 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1467 "saf_te %x\n", 1468 "saf_te %x\n",
1468 ioc->name, 1469 ioc->name,
1469 mpt_saf_te)); 1470 mpt_saf_te));
@@ -1481,7 +1482,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
1481 1482
1482 error = scsi_add_host (sh, &ioc->pcidev->dev); 1483 error = scsi_add_host (sh, &ioc->pcidev->dev);
1483 if(error) { 1484 if(error) {
1484 dprintk((KERN_ERR MYNAM 1485 dprintk(ioc, printk(KERN_ERR MYNAM
1485 "scsi_add_host failed\n")); 1486 "scsi_add_host failed\n"));
1486 goto out_mptspi_probe; 1487 goto out_mptspi_probe;
1487 } 1488 }
@@ -1536,15 +1537,8 @@ mptspi_init(void)
1536 mptspiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSPI_DRIVER); 1537 mptspiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSPI_DRIVER);
1537 mptspiInternalCtx = mpt_register(mptscsih_scandv_complete, MPTSPI_DRIVER); 1538 mptspiInternalCtx = mpt_register(mptscsih_scandv_complete, MPTSPI_DRIVER);
1538 1539
1539 if (mpt_event_register(mptspiDoneCtx, mptspi_event_process) == 0) { 1540 mpt_event_register(mptspiDoneCtx, mptspi_event_process);
1540 devtverboseprintk((KERN_INFO MYNAM 1541 mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset);
1541 ": Registered for IOC event notifications\n"));
1542 }
1543
1544 if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) {
1545 dprintk((KERN_INFO MYNAM
1546 ": Registered for IOC reset notifications\n"));
1547 }
1548 1542
1549 error = pci_register_driver(&mptspi_driver); 1543 error = pci_register_driver(&mptspi_driver);
1550 if (error) 1544 if (error)
@@ -1564,12 +1558,7 @@ mptspi_exit(void)
1564 pci_unregister_driver(&mptspi_driver); 1558 pci_unregister_driver(&mptspi_driver);
1565 1559
1566 mpt_reset_deregister(mptspiDoneCtx); 1560 mpt_reset_deregister(mptspiDoneCtx);
1567 dprintk((KERN_INFO MYNAM
1568 ": Deregistered for IOC reset notifications\n"));
1569
1570 mpt_event_deregister(mptspiDoneCtx); 1561 mpt_event_deregister(mptspiDoneCtx);
1571 dprintk((KERN_INFO MYNAM
1572 ": Deregistered for IOC event notifications\n"));
1573 1562
1574 mpt_deregister(mptspiInternalCtx); 1563 mpt_deregister(mptspiInternalCtx);
1575 mpt_deregister(mptspiTaskCtx); 1564 mpt_deregister(mptspiTaskCtx);