aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptbase.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/mptbase.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/mptbase.c')
-rw-r--r--drivers/message/fusion/mptbase.c467
1 files changed, 234 insertions, 233 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index 04f75e24dcec..e866dacde7e5 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -87,6 +87,10 @@ static int mpt_channel_mapping;
87module_param(mpt_channel_mapping, int, 0); 87module_param(mpt_channel_mapping, int, 0);
88MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)"); 88MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
89 89
90static int mpt_debug_level;
91module_param(mpt_debug_level, int, 0);
92MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
93
90#ifdef MFCNT 94#ifdef MFCNT
91static int mfcounter = 0; 95static int mfcounter = 0;
92#define PRINT_MF_COUNT 20000 96#define PRINT_MF_COUNT 20000
@@ -179,9 +183,7 @@ static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
179 183
180//int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag); 184//int mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
181static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers); 185static int ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers);
182#ifdef MPT_DEBUG_REPLY
183static void mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf); 186static void mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf);
184#endif
185static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info); 187static void mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
186static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info); 188static void mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info);
187static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info); 189static void mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info);
@@ -229,7 +231,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa)
229 int req_idx = 0; 231 int req_idx = 0;
230 int cb_idx; 232 int cb_idx;
231 233
232 dmfprintk((MYIOC_s_INFO_FMT "Got TURBO reply req_idx=%08x\n", 234 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got TURBO reply req_idx=%08x\n",
233 ioc->name, pa)); 235 ioc->name, pa));
234 236
235 switch (pa >> MPI_CONTEXT_REPLY_TYPE_SHIFT) { 237 switch (pa >> MPI_CONTEXT_REPLY_TYPE_SHIFT) {
@@ -312,9 +314,9 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
312 cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx; 314 cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx;
313 mf = MPT_INDEX_2_MFPTR(ioc, req_idx); 315 mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
314 316
315 dmfprintk((MYIOC_s_INFO_FMT "Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n", 317 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n",
316 ioc->name, mr, req_idx, cb_idx, mr->u.hdr.Function)); 318 ioc->name, mr, req_idx, cb_idx, mr->u.hdr.Function));
317 DBG_DUMP_REPLY_FRAME(mr) 319 DBG_DUMP_REPLY_FRAME(ioc, (u32 *)mr)
318 320
319 /* Check/log IOC log info 321 /* Check/log IOC log info
320 */ 322 */
@@ -329,10 +331,8 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
329 mpt_sas_log_info(ioc, log_info); 331 mpt_sas_log_info(ioc, log_info);
330 } 332 }
331 333
332#ifdef MPT_DEBUG_REPLY
333 if (ioc_stat & MPI_IOCSTATUS_MASK) 334 if (ioc_stat & MPI_IOCSTATUS_MASK)
334 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf); 335 mpt_iocstatus_info(ioc, (u32)ioc_stat, mf);
335#endif
336 336
337 /* Check for (valid) IO callback! */ 337 /* Check for (valid) IO callback! */
338 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS || 338 if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
@@ -414,17 +414,17 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
414 int freereq = 1; 414 int freereq = 1;
415 u8 func; 415 u8 func;
416 416
417 dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply() called\n", ioc->name)); 417 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply() called\n", ioc->name));
418 418#ifdef CONFIG_FUSION_LOGGING
419#if defined(MPT_DEBUG_MSG_FRAME) 419 if ((ioc->debug_level & MPT_DEBUG_MSG_FRAME) &&
420 if (!(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) { 420 !(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) {
421 dmfprintk((KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf)); 421 dmfprintk(ioc, printk(KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf));
422 DBG_DUMP_REQUEST_FRAME_HDR(mf) 422 DBG_DUMP_REQUEST_FRAME_HDR(ioc, (u32 *)mf)
423 } 423 }
424#endif 424#endif
425 425
426 func = reply->u.hdr.Function; 426 func = reply->u.hdr.Function;
427 dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply, Function=%02Xh\n", 427 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply, Function=%02Xh\n",
428 ioc->name, func)); 428 ioc->name, func));
429 429
430 if (func == MPI_FUNCTION_EVENT_NOTIFICATION) { 430 if (func == MPI_FUNCTION_EVENT_NOTIFICATION) {
@@ -435,7 +435,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
435 results = ProcessEventNotification(ioc, pEvReply, &evHandlers); 435 results = ProcessEventNotification(ioc, pEvReply, &evHandlers);
436 if (results != evHandlers) { 436 if (results != evHandlers) {
437 /* CHECKME! Any special handling needed here? */ 437 /* CHECKME! Any special handling needed here? */
438 devtverboseprintk((MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n", 438 devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n",
439 ioc->name, evHandlers, results)); 439 ioc->name, evHandlers, results));
440 } 440 }
441 441
@@ -446,7 +446,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
446 if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) { 446 if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) {
447 freereq = 0; 447 freereq = 0;
448 } else { 448 } else {
449 devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n", 449 devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n",
450 ioc->name, pEvReply)); 450 ioc->name, pEvReply));
451 } 451 }
452 452
@@ -455,13 +455,13 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
455#endif 455#endif
456 456
457 } else if (func == MPI_FUNCTION_EVENT_ACK) { 457 } else if (func == MPI_FUNCTION_EVENT_ACK) {
458 dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n", 458 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply, EventAck reply received\n",
459 ioc->name)); 459 ioc->name));
460 } else if (func == MPI_FUNCTION_CONFIG) { 460 } else if (func == MPI_FUNCTION_CONFIG) {
461 CONFIGPARMS *pCfg; 461 CONFIGPARMS *pCfg;
462 unsigned long flags; 462 unsigned long flags;
463 463
464 dcprintk((MYIOC_s_INFO_FMT "config_complete (mf=%p,mr=%p)\n", 464 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "config_complete (mf=%p,mr=%p)\n",
465 ioc->name, mf, reply)); 465 ioc->name, mf, reply));
466 466
467 pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *))); 467 pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *)));
@@ -484,7 +484,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
484 u16 status; 484 u16 status;
485 485
486 status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK; 486 status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK;
487 dcprintk((KERN_NOTICE " IOCStatus=%04xh, IOCLogInfo=%08xh\n", 487 dcprintk(ioc, printk(KERN_NOTICE " IOCStatus=%04xh, IOCLogInfo=%08xh\n",
488 status, le32_to_cpu(pReply->IOCLogInfo))); 488 status, le32_to_cpu(pReply->IOCLogInfo)));
489 489
490 pCfg->status = status; 490 pCfg->status = status;
@@ -789,7 +789,7 @@ mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc)
789 printk(KERN_INFO "MF Count 0x%x Max 0x%x \n", ioc->mfcnt, ioc->req_depth); 789 printk(KERN_INFO "MF Count 0x%x Max 0x%x \n", ioc->mfcnt, ioc->req_depth);
790#endif 790#endif
791 791
792 dmfprintk((KERN_INFO MYNAM ": %s: mpt_get_msg_frame(%d,%d), got mf=%p\n", 792 dmfprintk(ioc, printk(KERN_INFO MYNAM ": %s: mpt_get_msg_frame(%d,%d), got mf=%p\n",
793 ioc->name, handle, ioc->id, mf)); 793 ioc->name, handle, ioc->id, mf));
794 return mf; 794 return mf;
795} 795}
@@ -820,27 +820,10 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
820 mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx); 820 mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx);
821 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0; 821 mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
822 822
823#ifdef MPT_DEBUG_MSG_FRAME 823 DBG_DUMP_PUT_MSG_FRAME(ioc, (u32 *)mf);
824 {
825 u32 *m = mf->u.frame.hwhdr.__hdr;
826 int ii, n;
827
828 printk(KERN_INFO MYNAM ": %s: About to Put msg frame @ %p:\n" KERN_INFO " ",
829 ioc->name, m);
830 n = ioc->req_sz/4 - 1;
831 while (m[n] == 0)
832 n--;
833 for (ii=0; ii<=n; ii++) {
834 if (ii && ((ii%8)==0))
835 printk("\n" KERN_INFO " ");
836 printk(" %08x", le32_to_cpu(m[ii]));
837 }
838 printk("\n");
839 }
840#endif
841 824
842 mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx]; 825 mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx];
843 dsgprintk((MYIOC_s_INFO_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx])); 826 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx]));
844 CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr); 827 CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr);
845} 828}
846 829
@@ -955,7 +938,7 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req,
955 if (!(CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_DOORBELL_ACTIVE)) 938 if (!(CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_DOORBELL_ACTIVE))
956 return -5; 939 return -5;
957 940
958 dhsprintk((KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n", 941 dhsprintk(ioc, printk(KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n",
959 ioc->name, ii)); 942 ioc->name, ii));
960 943
961 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 944 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
@@ -1066,7 +1049,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
1066 host_page_buffer_sz, 1049 host_page_buffer_sz,
1067 &ioc->HostPageBuffer_dma)) != NULL) { 1050 &ioc->HostPageBuffer_dma)) != NULL) {
1068 1051
1069 dinitprintk((MYIOC_s_INFO_FMT 1052 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1070 "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n", 1053 "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
1071 ioc->name, ioc->HostPageBuffer, 1054 ioc->name, ioc->HostPageBuffer,
1072 (u32)ioc->HostPageBuffer_dma, 1055 (u32)ioc->HostPageBuffer_dma,
@@ -1410,31 +1393,37 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1410 struct proc_dir_entry *dent, *ent; 1393 struct proc_dir_entry *dent, *ent;
1411#endif 1394#endif
1412 1395
1396 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
1397 if (ioc == NULL) {
1398 printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
1399 return -ENOMEM;
1400 }
1401
1402 ioc->debug_level = mpt_debug_level;
1403 if (mpt_debug_level)
1404 printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level);
1405
1413 if (pci_enable_device(pdev)) 1406 if (pci_enable_device(pdev))
1414 return r; 1407 return r;
1415 1408
1416 dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n")); 1409 dinitprintk(ioc, printk(KERN_WARNING MYNAM ": mpt_adapter_install\n"));
1417 1410
1418 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) { 1411 if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
1419 dprintk((KERN_INFO MYNAM 1412 dprintk(ioc, printk(KERN_INFO MYNAM
1420 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n")); 1413 ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n"));
1421 } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) { 1414 } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
1422 printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n"); 1415 printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n");
1423 return r; 1416 return r;
1424 } 1417 }
1425 1418
1426 if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) 1419 if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
1427 dprintk((KERN_INFO MYNAM 1420 dprintk(ioc, printk(KERN_INFO MYNAM
1428 ": Using 64 bit consistent mask\n")); 1421 ": Using 64 bit consistent mask\n"));
1429 else 1422 } else {
1430 dprintk((KERN_INFO MYNAM 1423 dprintk(ioc, printk(KERN_INFO MYNAM
1431 ": Not using 64 bit consistent mask\n")); 1424 ": Not using 64 bit consistent mask\n"));
1432
1433 ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
1434 if (ioc == NULL) {
1435 printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
1436 return -ENOMEM;
1437 } 1425 }
1426
1438 ioc->alloc_total = sizeof(MPT_ADAPTER); 1427 ioc->alloc_total = sizeof(MPT_ADAPTER);
1439 ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */ 1428 ioc->req_sz = MPT_DEFAULT_FRAME_SIZE; /* avoid div by zero! */
1440 ioc->reply_sz = MPT_REPLY_FRAME_SIZE; 1429 ioc->reply_sz = MPT_REPLY_FRAME_SIZE;
@@ -1502,9 +1491,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1502 return -EINVAL; 1491 return -EINVAL;
1503 } 1492 }
1504 ioc->memmap = mem; 1493 ioc->memmap = mem;
1505 dinitprintk((KERN_INFO MYNAM ": mem = %p, mem_phys = %lx\n", mem, mem_phys)); 1494 dinitprintk(ioc, printk(KERN_INFO MYNAM ": mem = %p, mem_phys = %lx\n", mem, mem_phys));
1506 1495
1507 dinitprintk((KERN_INFO MYNAM ": facts @ %p, pfacts[0] @ %p\n", 1496 dinitprintk(ioc, printk(KERN_INFO MYNAM ": facts @ %p, pfacts[0] @ %p\n",
1508 &ioc->facts, &ioc->pfacts[0])); 1497 &ioc->facts, &ioc->pfacts[0]));
1509 1498
1510 ioc->mem_phys = mem_phys; 1499 ioc->mem_phys = mem_phys;
@@ -1830,6 +1819,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1830 int ret = 0; 1819 int ret = 0;
1831 int reset_alt_ioc_active = 0; 1820 int reset_alt_ioc_active = 0;
1832 int irq_allocated = 0; 1821 int irq_allocated = 0;
1822 u8 *a;
1833 1823
1834 printk(KERN_INFO MYNAM ": Initiating %s %s\n", 1824 printk(KERN_INFO MYNAM ": Initiating %s %s\n",
1835 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery"); 1825 ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");
@@ -1858,7 +1848,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1858 1848
1859 if (reset_alt_ioc_active && ioc->alt_ioc) { 1849 if (reset_alt_ioc_active && ioc->alt_ioc) {
1860 /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */ 1850 /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */
1861 dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", 1851 dprintk(ioc, printk(KERN_INFO MYNAM
1852 ": alt-%s reply irq re-enabled\n",
1862 ioc->alt_ioc->name)); 1853 ioc->alt_ioc->name));
1863 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM); 1854 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
1864 ioc->alt_ioc->active = 1; 1855 ioc->alt_ioc->active = 1;
@@ -1891,7 +1882,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1891 1882
1892 1883
1893 if (ii == 5) { 1884 if (ii == 5) {
1894 dinitprintk((MYIOC_s_INFO_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc)); 1885 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc));
1895 ret = -2; 1886 ret = -2;
1896 } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { 1887 } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
1897 MptDisplayIocCapabilities(ioc); 1888 MptDisplayIocCapabilities(ioc);
@@ -1899,13 +1890,15 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1899 1890
1900 if (alt_ioc_ready) { 1891 if (alt_ioc_ready) {
1901 if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) { 1892 if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) {
1902 dinitprintk((MYIOC_s_INFO_FMT "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc)); 1893 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1894 "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc));
1903 /* Retry - alt IOC was initialized once 1895 /* Retry - alt IOC was initialized once
1904 */ 1896 */
1905 rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason); 1897 rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason);
1906 } 1898 }
1907 if (rc) { 1899 if (rc) {
1908 dinitprintk((MYIOC_s_INFO_FMT "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc)); 1900 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1901 "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc));
1909 alt_ioc_ready = 0; 1902 alt_ioc_ready = 0;
1910 reset_alt_ioc_active = 0; 1903 reset_alt_ioc_active = 0;
1911 } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { 1904 } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
@@ -1938,7 +1931,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1938 ioc->pci_irq = ioc->pcidev->irq; 1931 ioc->pci_irq = ioc->pcidev->irq;
1939 pci_set_master(ioc->pcidev); /* ?? */ 1932 pci_set_master(ioc->pcidev); /* ?? */
1940 pci_set_drvdata(ioc->pcidev, ioc); 1933 pci_set_drvdata(ioc->pcidev, ioc);
1941 dprintk((KERN_INFO MYNAM ": %s installed at interrupt " 1934 dprintk(ioc, printk(KERN_INFO MYNAM ": %s installed at interrupt "
1942 "%d\n", ioc->name, ioc->pcidev->irq)); 1935 "%d\n", ioc->name, ioc->pcidev->irq));
1943 } 1936 }
1944 } 1937 }
@@ -1976,7 +1969,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1976 1969
1977 if (reason == MPT_HOSTEVENT_IOC_BRINGUP){ 1970 if (reason == MPT_HOSTEVENT_IOC_BRINGUP){
1978 if (ioc->upload_fw) { 1971 if (ioc->upload_fw) {
1979 ddlprintk((MYIOC_s_INFO_FMT 1972 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1980 "firmware upload required!\n", ioc->name)); 1973 "firmware upload required!\n", ioc->name));
1981 1974
1982 /* Controller is not operational, cannot do upload 1975 /* Controller is not operational, cannot do upload
@@ -1992,7 +1985,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
1992 * chips (mpt_adapter_disable, 1985 * chips (mpt_adapter_disable,
1993 * mpt_diag_reset) 1986 * mpt_diag_reset)
1994 */ 1987 */
1995 ddlprintk((MYIOC_s_INFO_FMT ": mpt_upload: alt_%s has cached_fw=%p \n", 1988 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1989 ": mpt_upload: alt_%s has cached_fw=%p \n",
1996 ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw)); 1990 ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw));
1997 ioc->alt_ioc->cached_fw = NULL; 1991 ioc->alt_ioc->cached_fw = NULL;
1998 } 1992 }
@@ -2012,7 +2006,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2012 2006
2013 if (reset_alt_ioc_active && ioc->alt_ioc) { 2007 if (reset_alt_ioc_active && ioc->alt_ioc) {
2014 /* (re)Enable alt-IOC! (reply interrupt) */ 2008 /* (re)Enable alt-IOC! (reply interrupt) */
2015 dinitprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n", 2009 dinitprintk(ioc, printk(KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",
2016 ioc->alt_ioc->name)); 2010 ioc->alt_ioc->name));
2017 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM); 2011 CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
2018 ioc->alt_ioc->active = 1; 2012 ioc->alt_ioc->active = 1;
@@ -2064,13 +2058,13 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2064 * (LANPage1_t stuff) 2058 * (LANPage1_t stuff)
2065 */ 2059 */
2066 (void) GetLanConfigPages(ioc); 2060 (void) GetLanConfigPages(ioc);
2067#ifdef MPT_DEBUG 2061 a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
2068 { 2062 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2069 u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow; 2063 "LanAddr = %02X:%02X:%02X:"
2070 dprintk((MYIOC_s_INFO_FMT "LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n", 2064 "%02X:%02X:%02X\n",
2071 ioc->name, a[5], a[4], a[3], a[2], a[1], a[0] )); 2065 ioc->name, a[5], a[4],
2072 } 2066 a[3], a[2], a[1], a[0] ));
2073#endif 2067
2074 } 2068 }
2075 } else { 2069 } else {
2076 /* Get NVRAM and adapter maximums from SPP 0 and 2 2070 /* Get NVRAM and adapter maximums from SPP 0 and 2
@@ -2107,15 +2101,17 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
2107 rc = handlers = 0; 2101 rc = handlers = 0;
2108 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 2102 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
2109 if ((ret == 0) && MptResetHandlers[ii]) { 2103 if ((ret == 0) && MptResetHandlers[ii]) {
2110 dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n", 2104 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2111 ioc->name, ii)); 2105 "Calling IOC post_reset handler #%d\n",
2106 ioc->name, ii));
2112 rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET); 2107 rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET);
2113 handlers++; 2108 handlers++;
2114 } 2109 }
2115 2110
2116 if (alt_ioc_ready && MptResetHandlers[ii]) { 2111 if (alt_ioc_ready && MptResetHandlers[ii]) {
2117 drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n", 2112 drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2118 ioc->name, ioc->alt_ioc->name, ii)); 2113 "Calling alt-%s post_reset handler #%d\n",
2114 ioc->name, ioc->alt_ioc->name, ii));
2119 rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET); 2115 rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET);
2120 handlers++; 2116 handlers++;
2121 } 2117 }
@@ -2153,7 +2149,7 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
2153 unsigned int func = PCI_FUNC(pdev->devfn); 2149 unsigned int func = PCI_FUNC(pdev->devfn);
2154 MPT_ADAPTER *ioc_srch; 2150 MPT_ADAPTER *ioc_srch;
2155 2151
2156 dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x," 2152 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PCI device %s devfn=%x/%x,"
2157 " searching for devfn match on %x or %x\n", 2153 " searching for devfn match on %x or %x\n",
2158 ioc->name, pci_name(pdev), pdev->bus->number, 2154 ioc->name, pci_name(pdev), pdev->bus->number,
2159 pdev->devfn, func-1, func+1)); 2155 pdev->devfn, func-1, func+1));
@@ -2178,7 +2174,7 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
2178 ioc_srch->name, ioc_srch->alt_ioc->name); 2174 ioc_srch->name, ioc_srch->alt_ioc->name);
2179 break; 2175 break;
2180 } 2176 }
2181 dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n", 2177 dprintk(ioc, printk(KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n",
2182 ioc->name, ioc_srch->name)); 2178 ioc->name, ioc_srch->name));
2183 ioc_srch->alt_ioc = ioc; 2179 ioc_srch->alt_ioc = ioc;
2184 ioc->alt_ioc = ioc_srch; 2180 ioc->alt_ioc = ioc_srch;
@@ -2199,7 +2195,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2199 int ret; 2195 int ret;
2200 2196
2201 if (ioc->cached_fw != NULL) { 2197 if (ioc->cached_fw != NULL) {
2202 ddlprintk((KERN_INFO MYNAM ": mpt_adapter_disable: Pushing FW onto adapter\n")); 2198 ddlprintk(ioc, printk(KERN_INFO MYNAM ": mpt_adapter_disable: Pushing FW onto adapter\n"));
2203 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)ioc->cached_fw, NO_SLEEP)) < 0) { 2199 if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)ioc->cached_fw, NO_SLEEP)) < 0) {
2204 printk(KERN_WARNING MYNAM 2200 printk(KERN_WARNING MYNAM
2205 ": firmware downloadboot failure (%d)!\n", ret); 2201 ": firmware downloadboot failure (%d)!\n", ret);
@@ -2214,7 +2210,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2214 2210
2215 if (ioc->alloc != NULL) { 2211 if (ioc->alloc != NULL) {
2216 sz = ioc->alloc_sz; 2212 sz = ioc->alloc_sz;
2217 dexitprintk((KERN_INFO MYNAM ": %s.free @ %p, sz=%d bytes\n", 2213 dexitprintk(ioc, printk(KERN_INFO MYNAM ": %s.free @ %p, sz=%d bytes\n",
2218 ioc->name, ioc->alloc, ioc->alloc_sz)); 2214 ioc->name, ioc->alloc, ioc->alloc_sz));
2219 pci_free_consistent(ioc->pcidev, sz, 2215 pci_free_consistent(ioc->pcidev, sz,
2220 ioc->alloc, ioc->alloc_dma); 2216 ioc->alloc, ioc->alloc_dma);
@@ -2256,7 +2252,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2256 2252
2257 if (ioc->spi_data.pIocPg4 != NULL) { 2253 if (ioc->spi_data.pIocPg4 != NULL) {
2258 sz = ioc->spi_data.IocPg4Sz; 2254 sz = ioc->spi_data.IocPg4Sz;
2259 pci_free_consistent(ioc->pcidev, sz, 2255 pci_free_consistent(ioc->pcidev, sz,
2260 ioc->spi_data.pIocPg4, 2256 ioc->spi_data.pIocPg4,
2261 ioc->spi_data.IocPg4_dma); 2257 ioc->spi_data.IocPg4_dma);
2262 ioc->spi_data.pIocPg4 = NULL; 2258 ioc->spi_data.pIocPg4 = NULL;
@@ -2279,7 +2275,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
2279 ": %s: host page buffers free failed (%d)!\n", 2275 ": %s: host page buffers free failed (%d)!\n",
2280 __FUNCTION__, ret); 2276 __FUNCTION__, ret);
2281 } 2277 }
2282 dexitprintk((KERN_INFO MYNAM ": %s HostPageBuffer free @ %p, sz=%d bytes\n", 2278 dexitprintk(ioc, printk(KERN_INFO MYNAM ": %s HostPageBuffer free @ %p, sz=%d bytes\n",
2283 ioc->name, ioc->HostPageBuffer, ioc->HostPageBuffer_sz)); 2279 ioc->name, ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
2284 pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz, 2280 pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
2285 ioc->HostPageBuffer, 2281 ioc->HostPageBuffer,
@@ -2325,7 +2321,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
2325#if defined(CONFIG_MTRR) && 0 2321#if defined(CONFIG_MTRR) && 0
2326 if (ioc->mtrr_reg > 0) { 2322 if (ioc->mtrr_reg > 0) {
2327 mtrr_del(ioc->mtrr_reg, 0, 0); 2323 mtrr_del(ioc->mtrr_reg, 0, 0);
2328 dprintk((KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name)); 2324 dprintk(ioc, printk(KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name));
2329 } 2325 }
2330#endif 2326#endif
2331 2327
@@ -2333,7 +2329,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
2333 list_del(&ioc->list); 2329 list_del(&ioc->list);
2334 2330
2335 sz_last = ioc->alloc_total; 2331 sz_last = ioc->alloc_total;
2336 dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n", 2332 dprintk(ioc, printk(KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n",
2337 ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first)); 2333 ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first));
2338 2334
2339 if (ioc->alt_ioc) 2335 if (ioc->alt_ioc)
@@ -2413,7 +2409,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
2413 2409
2414 /* Get current [raw] IOC state */ 2410 /* Get current [raw] IOC state */
2415 ioc_state = mpt_GetIocState(ioc, 0); 2411 ioc_state = mpt_GetIocState(ioc, 0);
2416 dhsprintk((KERN_INFO MYNAM "::MakeIocReady, %s [raw] state=%08x\n", ioc->name, ioc_state)); 2412 dhsprintk(ioc, printk(KERN_INFO MYNAM "::MakeIocReady, %s [raw] state=%08x\n", ioc->name, ioc_state));
2417 2413
2418 /* 2414 /*
2419 * Check to see if IOC got left/stuck in doorbell handshake 2415 * Check to see if IOC got left/stuck in doorbell handshake
@@ -2444,7 +2440,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
2444 * Hmmm... Did it get left operational? 2440 * Hmmm... Did it get left operational?
2445 */ 2441 */
2446 if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) { 2442 if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) {
2447 dinitprintk((MYIOC_s_INFO_FMT "IOC operational unexpected\n", 2443 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOC operational unexpected\n",
2448 ioc->name)); 2444 ioc->name));
2449 2445
2450 /* Check WhoInit. 2446 /* Check WhoInit.
@@ -2453,7 +2449,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
2453 * Else, fall through to KickStart case 2449 * Else, fall through to KickStart case
2454 */ 2450 */
2455 whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT; 2451 whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT;
2456 dinitprintk((KERN_INFO MYNAM 2452 dinitprintk(ioc, printk(KERN_INFO MYNAM
2457 ": whoinit 0x%x statefault %d force %d\n", 2453 ": whoinit 0x%x statefault %d force %d\n",
2458 whoinit, statefault, force)); 2454 whoinit, statefault, force));
2459 if (whoinit == MPI_WHOINIT_PCI_PEER) 2455 if (whoinit == MPI_WHOINIT_PCI_PEER)
@@ -2589,7 +2585,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
2589 get_facts.Function = MPI_FUNCTION_IOC_FACTS; 2585 get_facts.Function = MPI_FUNCTION_IOC_FACTS;
2590 /* Assert: All other get_facts fields are zero! */ 2586 /* Assert: All other get_facts fields are zero! */
2591 2587
2592 dinitprintk((MYIOC_s_INFO_FMT 2588 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2593 "Sending get IocFacts request req_sz=%d reply_sz=%d\n", 2589 "Sending get IocFacts request req_sz=%d reply_sz=%d\n",
2594 ioc->name, req_sz, reply_sz)); 2590 ioc->name, req_sz, reply_sz));
2595 2591
@@ -2691,8 +2687,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
2691 sz = sz >> 1; 2687 sz = sz >> 1;
2692 } 2688 }
2693 ioc->NBShiftFactor = shiftFactor; 2689 ioc->NBShiftFactor = shiftFactor;
2694 dinitprintk((MYIOC_s_INFO_FMT "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n", 2690 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
2695 ioc->name, vv, shiftFactor, r)); 2691 "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n",
2692 ioc->name, vv, shiftFactor, r));
2696 2693
2697 if (reason == MPT_HOSTEVENT_IOC_BRINGUP) { 2694 if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
2698 /* 2695 /*
@@ -2704,9 +2701,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
2704 ioc->reply_sz = MPT_REPLY_FRAME_SIZE; 2701 ioc->reply_sz = MPT_REPLY_FRAME_SIZE;
2705 ioc->reply_depth = min_t(int, MPT_DEFAULT_REPLY_DEPTH, facts->ReplyQueueDepth); 2702 ioc->reply_depth = min_t(int, MPT_DEFAULT_REPLY_DEPTH, facts->ReplyQueueDepth);
2706 2703
2707 dinitprintk((MYIOC_s_INFO_FMT "reply_sz=%3d, reply_depth=%4d\n", 2704 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "reply_sz=%3d, reply_depth=%4d\n",
2708 ioc->name, ioc->reply_sz, ioc->reply_depth)); 2705 ioc->name, ioc->reply_sz, ioc->reply_depth));
2709 dinitprintk((MYIOC_s_INFO_FMT "req_sz =%3d, req_depth =%4d\n", 2706 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "req_sz =%3d, req_depth =%4d\n",
2710 ioc->name, ioc->req_sz, ioc->req_depth)); 2707 ioc->name, ioc->req_sz, ioc->req_depth));
2711 2708
2712 /* Get port facts! */ 2709 /* Get port facts! */
@@ -2765,7 +2762,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
2765 get_pfacts.PortNumber = portnum; 2762 get_pfacts.PortNumber = portnum;
2766 /* Assert: All other get_pfacts fields are zero! */ 2763 /* Assert: All other get_pfacts fields are zero! */
2767 2764
2768 dinitprintk((MYIOC_s_INFO_FMT "Sending get PortFacts(%d) request\n", 2765 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending get PortFacts(%d) request\n",
2769 ioc->name, portnum)); 2766 ioc->name, portnum));
2770 2767
2771 /* No non-zero fields in the get_pfacts request are greater than 2768 /* No non-zero fields in the get_pfacts request are greater than
@@ -2841,12 +2838,12 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
2841 ioc->upload_fw = 1; 2838 ioc->upload_fw = 1;
2842 else 2839 else
2843 ioc->upload_fw = 0; 2840 ioc->upload_fw = 0;
2844 ddlprintk((MYIOC_s_INFO_FMT "upload_fw %d facts.Flags=%x\n", 2841 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "upload_fw %d facts.Flags=%x\n",
2845 ioc->name, ioc->upload_fw, ioc->facts.Flags)); 2842 ioc->name, ioc->upload_fw, ioc->facts.Flags));
2846 2843
2847 ioc_init.MaxDevices = (U8)ioc->devices_per_bus; 2844 ioc_init.MaxDevices = (U8)ioc->devices_per_bus;
2848 ioc_init.MaxBuses = (U8)ioc->number_of_buses; 2845 ioc_init.MaxBuses = (U8)ioc->number_of_buses;
2849 dinitprintk((MYIOC_s_INFO_FMT "facts.MsgVersion=%x\n", 2846 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts.MsgVersion=%x\n",
2850 ioc->name, ioc->facts.MsgVersion)); 2847 ioc->name, ioc->facts.MsgVersion));
2851 if (ioc->facts.MsgVersion >= MPI_VERSION_01_05) { 2848 if (ioc->facts.MsgVersion >= MPI_VERSION_01_05) {
2852 // set MsgVersion and HeaderVersion host driver was built with 2849 // set MsgVersion and HeaderVersion host driver was built with
@@ -2877,7 +2874,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
2877 ioc->facts.MaxDevices = ioc_init.MaxDevices; 2874 ioc->facts.MaxDevices = ioc_init.MaxDevices;
2878 ioc->facts.MaxBuses = ioc_init.MaxBuses; 2875 ioc->facts.MaxBuses = ioc_init.MaxBuses;
2879 2876
2880 dhsprintk((MYIOC_s_INFO_FMT "Sending IOCInit (req @ %p)\n", 2877 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending IOCInit (req @ %p)\n",
2881 ioc->name, &ioc_init)); 2878 ioc->name, &ioc_init));
2882 2879
2883 r = mpt_handshake_req_reply_wait(ioc, sizeof(IOCInit_t), (u32*)&ioc_init, 2880 r = mpt_handshake_req_reply_wait(ioc, sizeof(IOCInit_t), (u32*)&ioc_init,
@@ -2891,7 +2888,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
2891 * since we don't even look at its contents. 2888 * since we don't even look at its contents.
2892 */ 2889 */
2893 2890
2894 dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n", 2891 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending PortEnable (req @ %p)\n",
2895 ioc->name, &ioc_init)); 2892 ioc->name, &ioc_init));
2896 2893
2897 if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) { 2894 if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) {
@@ -2922,7 +2919,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
2922 state = mpt_GetIocState(ioc, 1); 2919 state = mpt_GetIocState(ioc, 1);
2923 count++; 2920 count++;
2924 } 2921 }
2925 dinitprintk((MYIOC_s_INFO_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n", 2922 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n",
2926 ioc->name, count)); 2923 ioc->name, count));
2927 2924
2928 ioc->aen_event_read_flag=0; 2925 ioc->aen_event_read_flag=0;
@@ -2962,7 +2959,7 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
2962/* port_enable.MsgFlags = 0; */ 2959/* port_enable.MsgFlags = 0; */
2963/* port_enable.MsgContext = 0; */ 2960/* port_enable.MsgContext = 0; */
2964 2961
2965 dinitprintk((MYIOC_s_INFO_FMT "Sending Port(%d)Enable (req @ %p)\n", 2962 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Port(%d)Enable (req @ %p)\n",
2966 ioc->name, portnum, &port_enable)); 2963 ioc->name, portnum, &port_enable));
2967 2964
2968 /* RAID FW may take a long time to enable 2965 /* RAID FW may take a long time to enable
@@ -3015,7 +3012,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
3015 int sz; 3012 int sz;
3016 3013
3017 sz = ioc->facts.FWImageSize; 3014 sz = ioc->facts.FWImageSize;
3018 dinitprintk((KERN_INFO MYNAM "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n", 3015 dinitprintk(ioc, printk(KERN_INFO MYNAM "free_fw_memory: FW Image @ %p[%p], sz=%d[%x] bytes\n",
3019 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); 3016 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
3020 pci_free_consistent(ioc->pcidev, sz, 3017 pci_free_consistent(ioc->pcidev, sz,
3021 ioc->cached_fw, ioc->cached_fw_dma); 3018 ioc->cached_fw, ioc->cached_fw_dma);
@@ -3059,7 +3056,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3059 3056
3060 mpt_alloc_fw_memory(ioc, sz); 3057 mpt_alloc_fw_memory(ioc, sz);
3061 3058
3062 dinitprintk((KERN_INFO MYNAM ": FW Image @ %p[%p], sz=%d[%x] bytes\n", 3059 dinitprintk(ioc, printk(KERN_INFO MYNAM ": FW Image @ %p[%p], sz=%d[%x] bytes\n",
3063 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz)); 3060 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
3064 3061
3065 if (ioc->cached_fw == NULL) { 3062 if (ioc->cached_fw == NULL) {
@@ -3091,14 +3088,14 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3091 mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma); 3088 mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma);
3092 3089
3093 sgeoffset += sizeof(u32) + sizeof(dma_addr_t); 3090 sgeoffset += sizeof(u32) + sizeof(dma_addr_t);
3094 dinitprintk((KERN_INFO MYNAM ": Sending FW Upload (req @ %p) sgeoffset=%d \n", 3091 dinitprintk(ioc, printk(KERN_INFO MYNAM ": Sending FW Upload (req @ %p) sgeoffset=%d \n",
3095 prequest, sgeoffset)); 3092 prequest, sgeoffset));
3096 DBG_DUMP_FW_REQUEST_FRAME(prequest) 3093 DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest)
3097 3094
3098 ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest, 3095 ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest,
3099 reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag); 3096 reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag);
3100 3097
3101 dinitprintk((KERN_INFO MYNAM ": FW Upload completed rc=%x \n", ii)); 3098 dinitprintk(ioc, printk(KERN_INFO MYNAM ": FW Upload completed rc=%x \n", ii));
3102 3099
3103 cmdStatus = -EFAULT; 3100 cmdStatus = -EFAULT;
3104 if (ii == 0) { 3101 if (ii == 0) {
@@ -3113,13 +3110,13 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
3113 cmdStatus = 0; 3110 cmdStatus = 0;
3114 } 3111 }
3115 } 3112 }
3116 dinitprintk((MYIOC_s_INFO_FMT ": do_upload cmdStatus=%d \n", 3113 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": do_upload cmdStatus=%d \n",
3117 ioc->name, cmdStatus)); 3114 ioc->name, cmdStatus));
3118 3115
3119 3116
3120 if (cmdStatus) { 3117 if (cmdStatus) {
3121 3118
3122 ddlprintk((MYIOC_s_INFO_FMT ": fw upload failed, freeing image \n", 3119 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": fw upload failed, freeing image \n",
3123 ioc->name)); 3120 ioc->name));
3124 mpt_free_fw_memory(ioc); 3121 mpt_free_fw_memory(ioc);
3125 } 3122 }
@@ -3154,7 +3151,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3154 u32 load_addr; 3151 u32 load_addr;
3155 u32 ioc_state=0; 3152 u32 ioc_state=0;
3156 3153
3157 ddlprintk((MYIOC_s_INFO_FMT "downloadboot: fw size 0x%x (%d), FW Ptr %p\n", 3154 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot: fw size 0x%x (%d), FW Ptr %p\n",
3158 ioc->name, pFwHeader->ImageSize, pFwHeader->ImageSize, pFwHeader)); 3155 ioc->name, pFwHeader->ImageSize, pFwHeader->ImageSize, pFwHeader));
3159 3156
3160 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF); 3157 CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
@@ -3179,7 +3176,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3179 for (count = 0; count < 30; count ++) { 3176 for (count = 0; count < 30; count ++) {
3180 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); 3177 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3181 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) { 3178 if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
3182 ddlprintk((MYIOC_s_INFO_FMT "RESET_ADAPTER cleared, count=%d\n", 3179 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RESET_ADAPTER cleared, count=%d\n",
3183 ioc->name, count)); 3180 ioc->name, count));
3184 break; 3181 break;
3185 } 3182 }
@@ -3192,7 +3189,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3192 } 3189 }
3193 3190
3194 if ( count == 30 ) { 3191 if ( count == 30 ) {
3195 ddlprintk((MYIOC_s_INFO_FMT "downloadboot failed! " 3192 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot failed! "
3196 "Unable to get MPI_DIAG_DRWE mode, diag0val=%x\n", 3193 "Unable to get MPI_DIAG_DRWE mode, diag0val=%x\n",
3197 ioc->name, diag0val)); 3194 ioc->name, diag0val));
3198 return -3; 3195 return -3;
@@ -3218,10 +3215,10 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3218 pci_enable_io_access(ioc->pcidev); 3215 pci_enable_io_access(ioc->pcidev);
3219 3216
3220 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress); 3217 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress);
3221 ddlprintk((MYIOC_s_INFO_FMT "LoadStart addr written 0x%x \n", 3218 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "LoadStart addr written 0x%x \n",
3222 ioc->name, pFwHeader->LoadStartAddress)); 3219 ioc->name, pFwHeader->LoadStartAddress));
3223 3220
3224 ddlprintk((MYIOC_s_INFO_FMT "Write FW Image: 0x%x bytes @ %p\n", 3221 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write FW Image: 0x%x bytes @ %p\n",
3225 ioc->name, fwSize*4, ptrFw)); 3222 ioc->name, fwSize*4, ptrFw));
3226 while (fwSize--) { 3223 while (fwSize--) {
3227 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, *ptrFw++); 3224 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, *ptrFw++);
@@ -3236,7 +3233,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3236 fwSize = (pExtImage->ImageSize + 3) >> 2; 3233 fwSize = (pExtImage->ImageSize + 3) >> 2;
3237 ptrFw = (u32 *)pExtImage; 3234 ptrFw = (u32 *)pExtImage;
3238 3235
3239 ddlprintk((MYIOC_s_INFO_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n", 3236 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n",
3240 ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr)); 3237 ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr));
3241 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr); 3238 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr);
3242 3239
@@ -3247,11 +3244,11 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3247 } 3244 }
3248 3245
3249 /* Write the IopResetVectorRegAddr */ 3246 /* Write the IopResetVectorRegAddr */
3250 ddlprintk((MYIOC_s_INFO_FMT "Write IopResetVector Addr=%x! \n", ioc->name, pFwHeader->IopResetRegAddr)); 3247 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Addr=%x! \n", ioc->name, pFwHeader->IopResetRegAddr));
3251 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr); 3248 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr);
3252 3249
3253 /* Write the IopResetVectorValue */ 3250 /* Write the IopResetVectorValue */
3254 ddlprintk((MYIOC_s_INFO_FMT "Write IopResetVector Value=%x! \n", ioc->name, pFwHeader->IopResetVectorValue)); 3251 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Value=%x! \n", ioc->name, pFwHeader->IopResetVectorValue));
3255 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue); 3252 CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue);
3256 3253
3257 /* Clear the internal flash bad bit - autoincrementing register, 3254 /* Clear the internal flash bad bit - autoincrementing register,
@@ -3285,11 +3282,11 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3285 pci_disable_io_access(ioc->pcidev); 3282 pci_disable_io_access(ioc->pcidev);
3286 3283
3287 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); 3284 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3288 ddlprintk((MYIOC_s_INFO_FMT "downloadboot diag0val=%x, " 3285 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot diag0val=%x, "
3289 "turning off PREVENT_IOC_BOOT, DISABLE_ARM, RW_ENABLE\n", 3286 "turning off PREVENT_IOC_BOOT, DISABLE_ARM, RW_ENABLE\n",
3290 ioc->name, diag0val)); 3287 ioc->name, diag0val));
3291 diag0val &= ~(MPI_DIAG_PREVENT_IOC_BOOT | MPI_DIAG_DISABLE_ARM | MPI_DIAG_RW_ENABLE); 3288 diag0val &= ~(MPI_DIAG_PREVENT_IOC_BOOT | MPI_DIAG_DISABLE_ARM | MPI_DIAG_RW_ENABLE);
3292 ddlprintk((MYIOC_s_INFO_FMT "downloadboot now diag0val=%x\n", 3289 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot now diag0val=%x\n",
3293 ioc->name, diag0val)); 3290 ioc->name, diag0val));
3294 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val); 3291 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val);
3295 3292
@@ -3300,7 +3297,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3300 ioc_state = mpt_GetIocState(ioc, 0); 3297 ioc_state = mpt_GetIocState(ioc, 0);
3301 if ( (GetIocFacts(ioc, sleepFlag, 3298 if ( (GetIocFacts(ioc, sleepFlag,
3302 MPT_HOSTEVENT_IOC_BRINGUP)) != 0 ) { 3299 MPT_HOSTEVENT_IOC_BRINGUP)) != 0 ) {
3303 ddlprintk((MYIOC_s_INFO_FMT "GetIocFacts failed: IocState=%x\n", 3300 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "GetIocFacts failed: IocState=%x\n",
3304 ioc->name, ioc_state)); 3301 ioc->name, ioc_state));
3305 return -EFAULT; 3302 return -EFAULT;
3306 } 3303 }
@@ -3308,17 +3305,20 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3308 3305
3309 for (count=0; count<HZ*20; count++) { 3306 for (count=0; count<HZ*20; count++) {
3310 if ((ioc_state = mpt_GetIocState(ioc, 0)) & MPI_IOC_STATE_READY) { 3307 if ((ioc_state = mpt_GetIocState(ioc, 0)) & MPI_IOC_STATE_READY) {
3311 ddlprintk((MYIOC_s_INFO_FMT "downloadboot successful! (count=%d) IocState=%x\n", 3308 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3312 ioc->name, count, ioc_state)); 3309 "downloadboot successful! (count=%d) IocState=%x\n",
3310 ioc->name, count, ioc_state));
3313 if (ioc->bus_type == SAS) { 3311 if (ioc->bus_type == SAS) {
3314 return 0; 3312 return 0;
3315 } 3313 }
3316 if ((SendIocInit(ioc, sleepFlag)) != 0) { 3314 if ((SendIocInit(ioc, sleepFlag)) != 0) {
3317 ddlprintk((MYIOC_s_INFO_FMT "downloadboot: SendIocInit failed\n", 3315 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3316 "downloadboot: SendIocInit failed\n",
3318 ioc->name)); 3317 ioc->name));
3319 return -EFAULT; 3318 return -EFAULT;
3320 } 3319 }
3321 ddlprintk((MYIOC_s_INFO_FMT "downloadboot: SendIocInit successful\n", 3320 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3321 "downloadboot: SendIocInit successful\n",
3322 ioc->name)); 3322 ioc->name));
3323 return 0; 3323 return 0;
3324 } 3324 }
@@ -3328,8 +3328,8 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
3328 mdelay (10); 3328 mdelay (10);
3329 } 3329 }
3330 } 3330 }
3331 ddlprintk((MYIOC_s_INFO_FMT "downloadboot failed! IocState=%x\n", 3331 ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3332 ioc->name, ioc_state)); 3332 "downloadboot failed! IocState=%x\n",ioc->name, ioc_state));
3333 return -EFAULT; 3333 return -EFAULT;
3334} 3334}
3335 3335
@@ -3366,7 +3366,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
3366 u32 ioc_state=0; 3366 u32 ioc_state=0;
3367 int cnt,cntdn; 3367 int cnt,cntdn;
3368 3368
3369 dinitprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name)); 3369 dinitprintk(ioc, printk(KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
3370 if (ioc->bus_type == SPI) { 3370 if (ioc->bus_type == SPI) {
3371 /* Always issue a Msg Unit Reset first. This will clear some 3371 /* Always issue a Msg Unit Reset first. This will clear some
3372 * SCSI bus hang conditions. 3372 * SCSI bus hang conditions.
@@ -3384,14 +3384,14 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
3384 if (hard_reset_done < 0) 3384 if (hard_reset_done < 0)
3385 return hard_reset_done; 3385 return hard_reset_done;
3386 3386
3387 dinitprintk((MYIOC_s_INFO_FMT "Diagnostic reset successful!\n", 3387 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset successful!\n",
3388 ioc->name)); 3388 ioc->name));
3389 3389
3390 cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 2; /* 2 seconds */ 3390 cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 2; /* 2 seconds */
3391 for (cnt=0; cnt<cntdn; cnt++) { 3391 for (cnt=0; cnt<cntdn; cnt++) {
3392 ioc_state = mpt_GetIocState(ioc, 1); 3392 ioc_state = mpt_GetIocState(ioc, 1);
3393 if ((ioc_state == MPI_IOC_STATE_READY) || (ioc_state == MPI_IOC_STATE_OPERATIONAL)) { 3393 if ((ioc_state == MPI_IOC_STATE_READY) || (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
3394 dinitprintk((MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n", 3394 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "KickStart successful! (cnt=%d)\n",
3395 ioc->name, cnt)); 3395 ioc->name, cnt));
3396 return hard_reset_done; 3396 return hard_reset_done;
3397 } 3397 }
@@ -3434,15 +3434,13 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3434 u32 doorbell; 3434 u32 doorbell;
3435 int hard_reset_done = 0; 3435 int hard_reset_done = 0;
3436 int count = 0; 3436 int count = 0;
3437#ifdef MPT_DEBUG
3438 u32 diag1val = 0; 3437 u32 diag1val = 0;
3439#endif
3440 3438
3441 /* Clear any existing interrupts */ 3439 /* Clear any existing interrupts */
3442 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0); 3440 CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
3443 3441
3444 if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) { 3442 if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
3445 drsprintk((MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset " 3443 drsprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
3446 "address=%p\n", ioc->name, __FUNCTION__, 3444 "address=%p\n", ioc->name, __FUNCTION__,
3447 &ioc->chip->Doorbell, &ioc->chip->Reset_1078)); 3445 &ioc->chip->Doorbell, &ioc->chip->Reset_1078));
3448 CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07); 3446 CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
@@ -3455,7 +3453,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3455 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell); 3453 doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
3456 doorbell &= MPI_IOC_STATE_MASK; 3454 doorbell &= MPI_IOC_STATE_MASK;
3457 3455
3458 drsprintk((MYIOC_s_INFO_FMT 3456 drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3459 "looking for READY STATE: doorbell=%x" 3457 "looking for READY STATE: doorbell=%x"
3460 " count=%d\n", 3458 " count=%d\n",
3461 ioc->name, doorbell, count)); 3459 ioc->name, doorbell, count));
@@ -3475,12 +3473,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3475 /* Use "Diagnostic reset" method! (only thing available!) */ 3473 /* Use "Diagnostic reset" method! (only thing available!) */
3476 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); 3474 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3477 3475
3478#ifdef MPT_DEBUG 3476 if (ioc->debug_level & MPT_DEBUG) {
3479 if (ioc->alt_ioc) 3477 if (ioc->alt_ioc)
3480 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic); 3478 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
3481 dprintk((MYIOC_s_INFO_FMT "DbG1: diag0=%08x, diag1=%08x\n", 3479 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG1: diag0=%08x, diag1=%08x\n",
3482 ioc->name, diag0val, diag1val)); 3480 ioc->name, diag0val, diag1val));
3483#endif 3481 }
3484 3482
3485 /* Do the reset if we are told to ignore the reset history 3483 /* Do the reset if we are told to ignore the reset history
3486 * or if the reset history is 0 3484 * or if the reset history is 0
@@ -3514,16 +3512,16 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3514 3512
3515 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); 3513 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3516 3514
3517 dprintk((MYIOC_s_INFO_FMT "Wrote magic DiagWriteEn sequence (%x)\n", 3515 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Wrote magic DiagWriteEn sequence (%x)\n",
3518 ioc->name, diag0val)); 3516 ioc->name, diag0val));
3519 } 3517 }
3520 3518
3521#ifdef MPT_DEBUG 3519 if (ioc->debug_level & MPT_DEBUG) {
3522 if (ioc->alt_ioc) 3520 if (ioc->alt_ioc)
3523 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic); 3521 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
3524 dprintk((MYIOC_s_INFO_FMT "DbG2: diag0=%08x, diag1=%08x\n", 3522 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG2: diag0=%08x, diag1=%08x\n",
3525 ioc->name, diag0val, diag1val)); 3523 ioc->name, diag0val, diag1val));
3526#endif 3524 }
3527 /* 3525 /*
3528 * Disable the ARM (Bug fix) 3526 * Disable the ARM (Bug fix)
3529 * 3527 *
@@ -3537,7 +3535,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3537 */ 3535 */
3538 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER); 3536 CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
3539 hard_reset_done = 1; 3537 hard_reset_done = 1;
3540 dprintk((MYIOC_s_INFO_FMT "Diagnostic reset performed\n", 3538 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset performed\n",
3541 ioc->name)); 3539 ioc->name));
3542 3540
3543 /* 3541 /*
@@ -3552,12 +3550,14 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3552 3550
3553 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 3551 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
3554 if (MptResetHandlers[ii]) { 3552 if (MptResetHandlers[ii]) {
3555 dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n", 3553 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3556 ioc->name, ii)); 3554 "Calling IOC pre_reset handler #%d\n",
3555 ioc->name, ii));
3557 r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET); 3556 r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET);
3558 if (ioc->alt_ioc) { 3557 if (ioc->alt_ioc) {
3559 dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n", 3558 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
3560 ioc->name, ioc->alt_ioc->name, ii)); 3559 "Calling alt-%s pre_reset handler #%d\n",
3560 ioc->name, ioc->alt_ioc->name, ii));
3561 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET); 3561 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET);
3562 } 3562 }
3563 } 3563 }
@@ -3580,7 +3580,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3580 break; 3580 break;
3581 } 3581 }
3582 3582
3583 dprintk((MYIOC_s_INFO_FMT "cached_fw: diag0val=%x count=%d\n", 3583 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n",
3584 iocp->name, diag0val, count)); 3584 iocp->name, diag0val, count));
3585 /* wait 1 sec */ 3585 /* wait 1 sec */
3586 if (sleepFlag == CAN_SLEEP) { 3586 if (sleepFlag == CAN_SLEEP) {
@@ -3621,12 +3621,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3621 } 3621 }
3622 3622
3623 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic); 3623 diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
3624#ifdef MPT_DEBUG 3624 if (ioc->debug_level & MPT_DEBUG) {
3625 if (ioc->alt_ioc) 3625 if (ioc->alt_ioc)
3626 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic); 3626 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
3627 dprintk((MYIOC_s_INFO_FMT "DbG3: diag0=%08x, diag1=%08x\n", 3627 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG3: diag0=%08x, diag1=%08x\n",
3628 ioc->name, diag0val, diag1val)); 3628 ioc->name, diag0val, diag1val));
3629#endif 3629 }
3630 3630
3631 /* Clear RESET_HISTORY bit! Place board in the 3631 /* Clear RESET_HISTORY bit! Place board in the
3632 * diagnostic mode to update the diag register. 3632 * diagnostic mode to update the diag register.
@@ -3680,12 +3680,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
3680 return -3; 3680 return -3;
3681 } 3681 }
3682 3682
3683#ifdef MPT_DEBUG 3683 if (ioc->debug_level & MPT_DEBUG) {
3684 if (ioc->alt_ioc) 3684 if (ioc->alt_ioc)
3685 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic); 3685 diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
3686 dprintk((MYIOC_s_INFO_FMT "DbG4: diag0=%08x, diag1=%08x\n", 3686 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG4: diag0=%08x, diag1=%08x\n",
3687 ioc->name, diag0val, diag1val)); 3687 ioc->name, diag0val, diag1val));
3688#endif 3688 }
3689 3689
3690 /* 3690 /*
3691 * Reset flag that says we've enabled event notification 3691 * Reset flag that says we've enabled event notification
@@ -3717,7 +3717,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
3717 u32 state; 3717 u32 state;
3718 int cntdn, count; 3718 int cntdn, count;
3719 3719
3720 drsprintk((KERN_INFO MYNAM ": %s: Sending IOC reset(0x%02x)!\n", 3720 drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending IOC reset(0x%02x)!\n",
3721 ioc->name, reset_type)); 3721 ioc->name, reset_type));
3722 CHIPREG_WRITE32(&ioc->chip->Doorbell, reset_type<<MPI_DOORBELL_FUNCTION_SHIFT); 3722 CHIPREG_WRITE32(&ioc->chip->Doorbell, reset_type<<MPI_DOORBELL_FUNCTION_SHIFT);
3723 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0) 3723 if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0)
@@ -3782,14 +3782,14 @@ initChainBuffers(MPT_ADAPTER *ioc)
3782 return -1; 3782 return -1;
3783 3783
3784 ioc->ReqToChain = (int *) mem; 3784 ioc->ReqToChain = (int *) mem;
3785 dinitprintk((KERN_INFO MYNAM ": %s ReqToChain alloc @ %p, sz=%d bytes\n", 3785 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReqToChain alloc @ %p, sz=%d bytes\n",
3786 ioc->name, mem, sz)); 3786 ioc->name, mem, sz));
3787 mem = kmalloc(sz, GFP_ATOMIC); 3787 mem = kmalloc(sz, GFP_ATOMIC);
3788 if (mem == NULL) 3788 if (mem == NULL)
3789 return -1; 3789 return -1;
3790 3790
3791 ioc->RequestNB = (int *) mem; 3791 ioc->RequestNB = (int *) mem;
3792 dinitprintk((KERN_INFO MYNAM ": %s RequestNB alloc @ %p, sz=%d bytes\n", 3792 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestNB alloc @ %p, sz=%d bytes\n",
3793 ioc->name, mem, sz)); 3793 ioc->name, mem, sz));
3794 } 3794 }
3795 for (ii = 0; ii < ioc->req_depth; ii++) { 3795 for (ii = 0; ii < ioc->req_depth; ii++) {
@@ -3819,7 +3819,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
3819 numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale + 3819 numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale +
3820 (ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32)); 3820 (ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32));
3821 } 3821 }
3822 dinitprintk((KERN_INFO MYNAM ": %s num_sge=%d numSGE=%d\n", 3822 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "num_sge=%d numSGE=%d\n",
3823 ioc->name, num_sge, numSGE)); 3823 ioc->name, num_sge, numSGE));
3824 3824
3825 if ( numSGE > MPT_SCSI_SG_DEPTH ) 3825 if ( numSGE > MPT_SCSI_SG_DEPTH )
@@ -3832,7 +3832,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
3832 } 3832 }
3833 num_chain++; 3833 num_chain++;
3834 3834
3835 dinitprintk((KERN_INFO MYNAM ": %s Now numSGE=%d num_sge=%d num_chain=%d\n", 3835 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Now numSGE=%d num_sge=%d num_chain=%d\n",
3836 ioc->name, numSGE, num_sge, num_chain)); 3836 ioc->name, numSGE, num_sge, num_chain));
3837 3837
3838 if (ioc->bus_type == SPI) 3838 if (ioc->bus_type == SPI)
@@ -3849,7 +3849,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
3849 return -1; 3849 return -1;
3850 3850
3851 ioc->ChainToChain = (int *) mem; 3851 ioc->ChainToChain = (int *) mem;
3852 dinitprintk((KERN_INFO MYNAM ": %s ChainToChain alloc @ %p, sz=%d bytes\n", 3852 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainToChain alloc @ %p, sz=%d bytes\n",
3853 ioc->name, mem, sz)); 3853 ioc->name, mem, sz));
3854 } else { 3854 } else {
3855 mem = (u8 *) ioc->ChainToChain; 3855 mem = (u8 *) ioc->ChainToChain;
@@ -3885,22 +3885,22 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3885 return -1; 3885 return -1;
3886 3886
3887 total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth); 3887 total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth);
3888 dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffer sz=%d bytes, ReplyDepth=%d\n", 3888 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d bytes, ReplyDepth=%d\n",
3889 ioc->name, ioc->reply_sz, ioc->reply_depth)); 3889 ioc->name, ioc->reply_sz, ioc->reply_depth));
3890 dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffer sz=%d[%x] bytes\n", 3890 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d[%x] bytes\n",
3891 ioc->name, reply_sz, reply_sz)); 3891 ioc->name, reply_sz, reply_sz));
3892 3892
3893 sz = (ioc->req_sz * ioc->req_depth); 3893 sz = (ioc->req_sz * ioc->req_depth);
3894 dinitprintk((KERN_INFO MYNAM ": %s.RequestBuffer sz=%d bytes, RequestDepth=%d\n", 3894 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffer sz=%d bytes, RequestDepth=%d\n",
3895 ioc->name, ioc->req_sz, ioc->req_depth)); 3895 ioc->name, ioc->req_sz, ioc->req_depth));
3896 dinitprintk((KERN_INFO MYNAM ": %s.RequestBuffer sz=%d[%x] bytes\n", 3896 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffer sz=%d[%x] bytes\n",
3897 ioc->name, sz, sz)); 3897 ioc->name, sz, sz));
3898 total_size += sz; 3898 total_size += sz;
3899 3899
3900 sz = num_chain * ioc->req_sz; /* chain buffer pool size */ 3900 sz = num_chain * ioc->req_sz; /* chain buffer pool size */
3901 dinitprintk((KERN_INFO MYNAM ": %s.ChainBuffer sz=%d bytes, ChainDepth=%d\n", 3901 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffer sz=%d bytes, ChainDepth=%d\n",
3902 ioc->name, ioc->req_sz, num_chain)); 3902 ioc->name, ioc->req_sz, num_chain));
3903 dinitprintk((KERN_INFO MYNAM ": %s.ChainBuffer sz=%d[%x] bytes num_chain=%d\n", 3903 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffer sz=%d[%x] bytes num_chain=%d\n",
3904 ioc->name, sz, sz, num_chain)); 3904 ioc->name, sz, sz, num_chain));
3905 3905
3906 total_size += sz; 3906 total_size += sz;
@@ -3911,7 +3911,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3911 goto out_fail; 3911 goto out_fail;
3912 } 3912 }
3913 3913
3914 dinitprintk((KERN_INFO MYNAM ": %s.Total alloc @ %p[%p], sz=%d[%x] bytes\n", 3914 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Total alloc @ %p[%p], sz=%d[%x] bytes\n",
3915 ioc->name, mem, (void *)(ulong)alloc_dma, total_size, total_size)); 3915 ioc->name, mem, (void *)(ulong)alloc_dma, total_size, total_size));
3916 3916
3917 memset(mem, 0, total_size); 3917 memset(mem, 0, total_size);
@@ -3922,7 +3922,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3922 ioc->reply_frames = (MPT_FRAME_HDR *) mem; 3922 ioc->reply_frames = (MPT_FRAME_HDR *) mem;
3923 ioc->reply_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); 3923 ioc->reply_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF);
3924 3924
3925 dinitprintk((KERN_INFO MYNAM ": %s ReplyBuffers @ %p[%p]\n", 3925 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffers @ %p[%p]\n",
3926 ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma)); 3926 ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma));
3927 3927
3928 alloc_dma += reply_sz; 3928 alloc_dma += reply_sz;
@@ -3933,7 +3933,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3933 ioc->req_frames = (MPT_FRAME_HDR *) mem; 3933 ioc->req_frames = (MPT_FRAME_HDR *) mem;
3934 ioc->req_frames_dma = alloc_dma; 3934 ioc->req_frames_dma = alloc_dma;
3935 3935
3936 dinitprintk((KERN_INFO MYNAM ": %s RequestBuffers @ %p[%p]\n", 3936 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffers @ %p[%p]\n",
3937 ioc->name, mem, (void *)(ulong)alloc_dma)); 3937 ioc->name, mem, (void *)(ulong)alloc_dma));
3938 3938
3939 ioc->req_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF); 3939 ioc->req_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF);
@@ -3947,7 +3947,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3947 ioc->mtrr_reg = mtrr_add(ioc->req_frames_dma, 3947 ioc->mtrr_reg = mtrr_add(ioc->req_frames_dma,
3948 sz, 3948 sz,
3949 MTRR_TYPE_WRCOMB, 1); 3949 MTRR_TYPE_WRCOMB, 1);
3950 dprintk((MYIOC_s_INFO_FMT "MTRR region registered (base:size=%08x:%x)\n", 3950 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MTRR region registered (base:size=%08x:%x)\n",
3951 ioc->name, ioc->req_frames_dma, sz)); 3951 ioc->name, ioc->req_frames_dma, sz));
3952#endif 3952#endif
3953 3953
@@ -3959,7 +3959,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
3959 ioc->ChainBuffer = mem; 3959 ioc->ChainBuffer = mem;
3960 ioc->ChainBufferDMA = alloc_dma; 3960 ioc->ChainBufferDMA = alloc_dma;
3961 3961
3962 dinitprintk((KERN_INFO MYNAM " :%s ChainBuffers @ %p(%p)\n", 3962 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffers @ %p(%p)\n",
3963 ioc->name, ioc->ChainBuffer, (void *)(ulong)ioc->ChainBufferDMA)); 3963 ioc->name, ioc->ChainBuffer, (void *)(ulong)ioc->ChainBufferDMA));
3964 3964
3965 /* Initialize the free chain Q. 3965 /* Initialize the free chain Q.
@@ -4004,7 +4004,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
4004 4004
4005 ioc->sense_buf_low_dma = (u32) (ioc->sense_buf_pool_dma & 0xFFFFFFFF); 4005 ioc->sense_buf_low_dma = (u32) (ioc->sense_buf_pool_dma & 0xFFFFFFFF);
4006 ioc->alloc_total += sz; 4006 ioc->alloc_total += sz;
4007 dinitprintk((KERN_INFO MYNAM ": %s.SenseBuffers @ %p[%p]\n", 4007 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SenseBuffers @ %p[%p]\n",
4008 ioc->name, ioc->sense_buf_pool, (void *)(ulong)ioc->sense_buf_pool_dma)); 4008 ioc->name, ioc->sense_buf_pool, (void *)(ulong)ioc->sense_buf_pool_dma));
4009 4009
4010 } 4010 }
@@ -4012,7 +4012,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
4012 /* Post Reply frames to FIFO 4012 /* Post Reply frames to FIFO
4013 */ 4013 */
4014 alloc_dma = ioc->alloc_dma; 4014 alloc_dma = ioc->alloc_dma;
4015 dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffers @ %p[%p]\n", 4015 dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffers @ %p[%p]\n",
4016 ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma)); 4016 ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma));
4017 4017
4018 for (i = 0; i < ioc->reply_depth; i++) { 4018 for (i = 0; i < ioc->reply_depth; i++) {
@@ -4093,7 +4093,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
4093 if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0) 4093 if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
4094 failcnt++; 4094 failcnt++;
4095 4095
4096 dhsprintk((MYIOC_s_INFO_FMT "HandShake request start reqBytes=%d, WaitCnt=%d%s\n", 4096 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake request start reqBytes=%d, WaitCnt=%d%s\n",
4097 ioc->name, reqBytes, t, failcnt ? " - MISSING DOORBELL HANDSHAKE!" : "")); 4097 ioc->name, reqBytes, t, failcnt ? " - MISSING DOORBELL HANDSHAKE!" : ""));
4098 4098
4099 /* Read doorbell and check for active bit */ 4099 /* Read doorbell and check for active bit */
@@ -4128,10 +4128,10 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
4128 failcnt++; 4128 failcnt++;
4129 } 4129 }
4130 4130
4131 dhsprintk((KERN_INFO MYNAM ": Handshake request frame (@%p) header\n", req)); 4131 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handshake request frame (@%p) header\n", ioc->name, req));
4132 DBG_DUMP_REQUEST_FRAME_HDR(req) 4132 DBG_DUMP_REQUEST_FRAME_HDR(ioc, (u32 *)req)
4133 4133
4134 dhsprintk((MYIOC_s_INFO_FMT "HandShake request post done, WaitCnt=%d%s\n", 4134 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake request post done, WaitCnt=%d%s\n",
4135 ioc->name, t, failcnt ? " - MISSING DOORBELL ACK!" : "")); 4135 ioc->name, t, failcnt ? " - MISSING DOORBELL ACK!" : ""));
4136 4136
4137 /* 4137 /*
@@ -4140,7 +4140,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
4140 if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0) 4140 if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0)
4141 failcnt++; 4141 failcnt++;
4142 4142
4143 dhsprintk((MYIOC_s_INFO_FMT "HandShake reply count=%d%s\n", 4143 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake reply count=%d%s\n",
4144 ioc->name, t, failcnt ? " - MISSING DOORBELL REPLY!" : "")); 4144 ioc->name, t, failcnt ? " - MISSING DOORBELL REPLY!" : ""));
4145 4145
4146 /* 4146 /*
@@ -4196,7 +4196,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
4196 } 4196 }
4197 4197
4198 if (cntdn) { 4198 if (cntdn) {
4199 dprintk((MYIOC_s_INFO_FMT "WaitForDoorbell ACK (count=%d)\n", 4199 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell ACK (count=%d)\n",
4200 ioc->name, count)); 4200 ioc->name, count));
4201 return count; 4201 return count;
4202 } 4202 }
@@ -4245,7 +4245,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
4245 } 4245 }
4246 4246
4247 if (cntdn) { 4247 if (cntdn) {
4248 dprintk((MYIOC_s_INFO_FMT "WaitForDoorbell INT (cnt=%d) howlong=%d\n", 4248 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell INT (cnt=%d) howlong=%d\n",
4249 ioc->name, count, howlong)); 4249 ioc->name, count, howlong));
4250 return count; 4250 return count;
4251 } 4251 }
@@ -4297,7 +4297,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
4297 } 4297 }
4298 } 4298 }
4299 4299
4300 dhsprintk((MYIOC_s_INFO_FMT "WaitCnt=%d First handshake reply word=%08x%s\n", 4300 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitCnt=%d First handshake reply word=%08x%s\n",
4301 ioc->name, t, le32_to_cpu(*(u32 *)hs_reply), 4301 ioc->name, t, le32_to_cpu(*(u32 *)hs_reply),
4302 failcnt ? " - MISSING DOORBELL HANDSHAKE!" : "")); 4302 failcnt ? " - MISSING DOORBELL HANDSHAKE!" : ""));
4303 4303
@@ -4333,10 +4333,10 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
4333 } 4333 }
4334#endif 4334#endif
4335 4335
4336 dhsprintk((MYIOC_s_INFO_FMT "Got Handshake reply:\n", ioc->name)); 4336 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got Handshake reply:\n", ioc->name));
4337 DBG_DUMP_REPLY_FRAME(mptReply) 4337 DBG_DUMP_REPLY_FRAME(ioc, (u32 *)mptReply)
4338 4338
4339 dhsprintk((MYIOC_s_INFO_FMT "WaitForDoorbell REPLY WaitCnt=%d (sz=%d)\n", 4339 dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell REPLY WaitCnt=%d (sz=%d)\n",
4340 ioc->name, t, u16cnt/2)); 4340 ioc->name, t, u16cnt/2));
4341 return u16cnt/2; 4341 return u16cnt/2;
4342} 4342}
@@ -4761,7 +4761,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4761 4761
4762 ioc->spi_data.nvram = (int *) mem; 4762 ioc->spi_data.nvram = (int *) mem;
4763 4763
4764 dprintk((MYIOC_s_INFO_FMT "SCSI device NVRAM settings @ %p, sz=%d\n", 4764 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SCSI device NVRAM settings @ %p, sz=%d\n",
4765 ioc->name, ioc->spi_data.nvram, sz)); 4765 ioc->name, ioc->spi_data.nvram, sz));
4766 } 4766 }
4767 4767
@@ -4797,7 +4797,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4797 ioc->spi_data.minSyncFactor = MPT_ASYNC; 4797 ioc->spi_data.minSyncFactor = MPT_ASYNC;
4798 ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN; 4798 ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN;
4799 rc = 1; 4799 rc = 1;
4800 ddvprintk((MYIOC_s_INFO_FMT "Unable to read PortPage0 minSyncFactor=%x\n", 4800 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4801 "Unable to read PortPage0 minSyncFactor=%x\n",
4801 ioc->name, ioc->spi_data.minSyncFactor)); 4802 ioc->name, ioc->spi_data.minSyncFactor));
4802 } else { 4803 } else {
4803 /* Save the Port Page 0 data 4804 /* Save the Port Page 0 data
@@ -4808,7 +4809,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4808 4809
4809 if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) { 4810 if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) {
4810 ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS; 4811 ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS;
4811 ddvprintk((KERN_INFO MYNAM " :%s noQas due to Capabilities=%x\n", 4812 ddvprintk(ioc, printk(KERN_INFO MYNAM
4813 " :%s noQas due to Capabilities=%x\n",
4812 ioc->name, pPP0->Capabilities)); 4814 ioc->name, pPP0->Capabilities));
4813 } 4815 }
4814 ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0; 4816 ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0;
@@ -4817,7 +4819,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4817 ioc->spi_data.maxSyncOffset = (u8) (data >> 16); 4819 ioc->spi_data.maxSyncOffset = (u8) (data >> 16);
4818 data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK; 4820 data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK;
4819 ioc->spi_data.minSyncFactor = (u8) (data >> 8); 4821 ioc->spi_data.minSyncFactor = (u8) (data >> 8);
4820 ddvprintk((MYIOC_s_INFO_FMT "PortPage0 minSyncFactor=%x\n", 4822 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4823 "PortPage0 minSyncFactor=%x\n",
4821 ioc->name, ioc->spi_data.minSyncFactor)); 4824 ioc->name, ioc->spi_data.minSyncFactor));
4822 } else { 4825 } else {
4823 ioc->spi_data.maxSyncOffset = 0; 4826 ioc->spi_data.maxSyncOffset = 0;
@@ -4833,7 +4836,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
4833 4836
4834 if (ioc->spi_data.minSyncFactor < MPT_ULTRA) { 4837 if (ioc->spi_data.minSyncFactor < MPT_ULTRA) {
4835 ioc->spi_data.minSyncFactor = MPT_ULTRA; 4838 ioc->spi_data.minSyncFactor = MPT_ULTRA;
4836 ddvprintk((MYIOC_s_INFO_FMT "HVD or SE detected, minSyncFactor=%x\n", 4839 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
4840 "HVD or SE detected, minSyncFactor=%x\n",
4837 ioc->name, ioc->spi_data.minSyncFactor)); 4841 ioc->name, ioc->spi_data.minSyncFactor));
4838 } 4842 }
4839 } 4843 }
@@ -4949,10 +4953,10 @@ mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum)
4949 ioc->spi_data.sdp0version = cfg.cfghdr.hdr->PageVersion; 4953 ioc->spi_data.sdp0version = cfg.cfghdr.hdr->PageVersion;
4950 ioc->spi_data.sdp0length = cfg.cfghdr.hdr->PageLength; 4954 ioc->spi_data.sdp0length = cfg.cfghdr.hdr->PageLength;
4951 4955
4952 dcprintk((MYIOC_s_INFO_FMT "Headers: 0: version %d length %d\n", 4956 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Headers: 0: version %d length %d\n",
4953 ioc->name, ioc->spi_data.sdp0version, ioc->spi_data.sdp0length)); 4957 ioc->name, ioc->spi_data.sdp0version, ioc->spi_data.sdp0length));
4954 4958
4955 dcprintk((MYIOC_s_INFO_FMT "Headers: 1: version %d length %d\n", 4959 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Headers: 1: version %d length %d\n",
4956 ioc->name, ioc->spi_data.sdp1version, ioc->spi_data.sdp1length)); 4960 ioc->name, ioc->spi_data.sdp1version, ioc->spi_data.sdp1length));
4957 return 0; 4961 return 0;
4958} 4962}
@@ -5361,12 +5365,12 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
5361 cfg.physAddr = ioc1_dma; 5365 cfg.physAddr = ioc1_dma;
5362 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT; 5366 cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
5363 if (mpt_config(ioc, &cfg) == 0) { 5367 if (mpt_config(ioc, &cfg) == 0) {
5364 5368
5365 tmp = le32_to_cpu(pIoc1->Flags) & MPI_IOCPAGE1_REPLY_COALESCING; 5369 tmp = le32_to_cpu(pIoc1->Flags) & MPI_IOCPAGE1_REPLY_COALESCING;
5366 if (tmp == MPI_IOCPAGE1_REPLY_COALESCING) { 5370 if (tmp == MPI_IOCPAGE1_REPLY_COALESCING) {
5367 tmp = le32_to_cpu(pIoc1->CoalescingTimeout); 5371 tmp = le32_to_cpu(pIoc1->CoalescingTimeout);
5368 5372
5369 dprintk((MYIOC_s_INFO_FMT "Coalescing Enabled Timeout = %d\n", 5373 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Coalescing Enabled Timeout = %d\n",
5370 ioc->name, tmp)); 5374 ioc->name, tmp));
5371 5375
5372 if (tmp > MPT_COALESCING_TIMEOUT) { 5376 if (tmp > MPT_COALESCING_TIMEOUT) {
@@ -5377,26 +5381,29 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
5377 cfg.dir = 1; 5381 cfg.dir = 1;
5378 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT; 5382 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
5379 if (mpt_config(ioc, &cfg) == 0) { 5383 if (mpt_config(ioc, &cfg) == 0) {
5380 dprintk((MYIOC_s_INFO_FMT "Reset Current Coalescing Timeout to = %d\n", 5384 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Reset Current Coalescing Timeout to = %d\n",
5381 ioc->name, MPT_COALESCING_TIMEOUT)); 5385 ioc->name, MPT_COALESCING_TIMEOUT));
5382 5386
5383 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_NVRAM; 5387 cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_NVRAM;
5384 if (mpt_config(ioc, &cfg) == 0) { 5388 if (mpt_config(ioc, &cfg) == 0) {
5385 dprintk((MYIOC_s_INFO_FMT "Reset NVRAM Coalescing Timeout to = %d\n", 5389 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5390 "Reset NVRAM Coalescing Timeout to = %d\n",
5386 ioc->name, MPT_COALESCING_TIMEOUT)); 5391 ioc->name, MPT_COALESCING_TIMEOUT));
5387 } else { 5392 } else {
5388 dprintk((MYIOC_s_INFO_FMT "Reset NVRAM Coalescing Timeout Failed\n", 5393 dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
5389 ioc->name)); 5394 "Reset NVRAM Coalescing Timeout Failed\n",
5395 ioc->name));
5390 } 5396 }
5391 5397
5392 } else { 5398 } else {
5393 dprintk((MYIOC_s_WARN_FMT "Reset of Current Coalescing Timeout Failed!\n", 5399 dprintk(ioc, printk(MYIOC_s_WARN_FMT
5394 ioc->name)); 5400 "Reset of Current Coalescing Timeout Failed!\n",
5401 ioc->name));
5395 } 5402 }
5396 } 5403 }
5397 5404
5398 } else { 5405 } else {
5399 dprintk((MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name)); 5406 dprintk(ioc, printk(MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name));
5400 } 5407 }
5401 } 5408 }
5402 5409
@@ -5461,13 +5468,13 @@ SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch)
5461 5468
5462 evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc); 5469 evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc);
5463 if (evnp == NULL) { 5470 if (evnp == NULL) {
5464 devtverboseprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n", 5471 devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n",
5465 ioc->name)); 5472 ioc->name));
5466 return 0; 5473 return 0;
5467 } 5474 }
5468 memset(evnp, 0, sizeof(*evnp)); 5475 memset(evnp, 0, sizeof(*evnp));
5469 5476
5470 devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp)); 5477 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp));
5471 5478
5472 evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION; 5479 evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION;
5473 evnp->ChainOffset = 0; 5480 evnp->ChainOffset = 0;
@@ -5491,12 +5498,12 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
5491 EventAck_t *pAck; 5498 EventAck_t *pAck;
5492 5499
5493 if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { 5500 if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
5494 dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n", 5501 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
5495 ioc->name,__FUNCTION__)); 5502 ioc->name,__FUNCTION__));
5496 return -1; 5503 return -1;
5497 } 5504 }
5498 5505
5499 devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventAck\n", ioc->name)); 5506 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending EventAck\n", ioc->name));
5500 5507
5501 pAck->Function = MPI_FUNCTION_EVENT_ACK; 5508 pAck->Function = MPI_FUNCTION_EVENT_ACK;
5502 pAck->ChainOffset = 0; 5509 pAck->ChainOffset = 0;
@@ -5541,7 +5548,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
5541 */ 5548 */
5542 in_isr = in_interrupt(); 5549 in_isr = in_interrupt();
5543 if (in_isr) { 5550 if (in_isr) {
5544 dcprintk((MYIOC_s_WARN_FMT "Config request not allowed in ISR context!\n", 5551 dcprintk(ioc, printk(MYIOC_s_WARN_FMT "Config request not allowed in ISR context!\n",
5545 ioc->name)); 5552 ioc->name));
5546 return -EPERM; 5553 return -EPERM;
5547 } 5554 }
@@ -5549,7 +5556,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
5549 /* Get and Populate a free Frame 5556 /* Get and Populate a free Frame
5550 */ 5557 */
5551 if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) { 5558 if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
5552 dcprintk((MYIOC_s_WARN_FMT "mpt_config: no msg frames!\n", 5559 dcprintk(ioc, printk(MYIOC_s_WARN_FMT "mpt_config: no msg frames!\n",
5553 ioc->name)); 5560 ioc->name));
5554 return -EAGAIN; 5561 return -EAGAIN;
5555 } 5562 }
@@ -5594,13 +5601,13 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
5594 if ((pCfg->cfghdr.hdr->PageType & MPI_CONFIG_PAGETYPE_MASK) == MPI_CONFIG_PAGETYPE_EXTENDED) { 5601 if ((pCfg->cfghdr.hdr->PageType & MPI_CONFIG_PAGETYPE_MASK) == MPI_CONFIG_PAGETYPE_EXTENDED) {
5595 flagsLength |= pExtHdr->ExtPageLength * 4; 5602 flagsLength |= pExtHdr->ExtPageLength * 4;
5596 5603
5597 dcprintk((MYIOC_s_INFO_FMT "Sending Config request type %d, page %d and action %d\n", 5604 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Config request type %d, page %d and action %d\n",
5598 ioc->name, pReq->ExtPageType, pReq->Header.PageNumber, pReq->Action)); 5605 ioc->name, pReq->ExtPageType, pReq->Header.PageNumber, pReq->Action));
5599 } 5606 }
5600 else { 5607 else {
5601 flagsLength |= pCfg->cfghdr.hdr->PageLength * 4; 5608 flagsLength |= pCfg->cfghdr.hdr->PageLength * 4;
5602 5609
5603 dcprintk((MYIOC_s_INFO_FMT "Sending Config request type %d, page %d and action %d\n", 5610 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Config request type %d, page %d and action %d\n",
5604 ioc->name, pReq->Header.PageType, pReq->Header.PageNumber, pReq->Action)); 5611 ioc->name, pReq->Header.PageType, pReq->Header.PageNumber, pReq->Action));
5605 } 5612 }
5606 5613
@@ -5650,7 +5657,7 @@ mpt_timer_expired(unsigned long data)
5650{ 5657{
5651 MPT_ADAPTER *ioc = (MPT_ADAPTER *) data; 5658 MPT_ADAPTER *ioc = (MPT_ADAPTER *) data;
5652 5659
5653 dcprintk((MYIOC_s_WARN_FMT "mpt_timer_expired! \n", ioc->name)); 5660 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_timer_expired! \n", ioc->name));
5654 5661
5655 /* Perform a FW reload */ 5662 /* Perform a FW reload */
5656 if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0) 5663 if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0)
@@ -5660,7 +5667,7 @@ mpt_timer_expired(unsigned long data)
5660 * Hard reset clean-up will wake up 5667 * Hard reset clean-up will wake up
5661 * process and free all resources. 5668 * process and free all resources.
5662 */ 5669 */
5663 dcprintk((MYIOC_s_WARN_FMT "mpt_timer_expired complete!\n", ioc->name)); 5670 dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_timer_expired complete!\n", ioc->name));
5664 5671
5665 return; 5672 return;
5666} 5673}
@@ -5679,7 +5686,7 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
5679 CONFIGPARMS *pCfg; 5686 CONFIGPARMS *pCfg;
5680 unsigned long flags; 5687 unsigned long flags;
5681 5688
5682 dprintk((KERN_WARNING MYNAM 5689 dprintk(ioc, printk(KERN_DEBUG MYNAM
5683 ": IOC %s_reset routed to MPT base driver!\n", 5690 ": IOC %s_reset routed to MPT base driver!\n",
5684 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : ( 5691 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
5685 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post"))); 5692 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
@@ -6050,7 +6057,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6050 int rc; 6057 int rc;
6051 unsigned long flags; 6058 unsigned long flags;
6052 6059
6053 dtmprintk((MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name)); 6060 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler Entered!\n", ioc->name));
6054#ifdef MFCNT 6061#ifdef MFCNT
6055 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name); 6062 printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name);
6056 printk("MF count 0x%x !\n", ioc->mfcnt); 6063 printk("MF count 0x%x !\n", ioc->mfcnt);
@@ -6082,11 +6089,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6082 6089
6083 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 6090 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
6084 if (MptResetHandlers[ii]) { 6091 if (MptResetHandlers[ii]) {
6085 dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n", 6092 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling IOC reset_setup handler #%d\n",
6086 ioc->name, ii)); 6093 ioc->name, ii));
6087 r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET); 6094 r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET);
6088 if (ioc->alt_ioc) { 6095 if (ioc->alt_ioc) {
6089 dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n", 6096 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling alt-%s setup reset handler #%d\n",
6090 ioc->name, ioc->alt_ioc->name, ii)); 6097 ioc->name, ioc->alt_ioc->name, ii));
6091 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET); 6098 r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
6092 } 6099 }
@@ -6108,7 +6115,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6108 ioc->alt_ioc->diagPending = 0; 6115 ioc->alt_ioc->diagPending = 0;
6109 spin_unlock_irqrestore(&ioc->diagLock, flags); 6116 spin_unlock_irqrestore(&ioc->diagLock, flags);
6110 6117
6111 dtmprintk((MYIOC_s_INFO_FMT "HardResetHandler rc = %d!\n", ioc->name, rc)); 6118 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler rc = %d!\n", ioc->name, rc));
6112 6119
6113 return rc; 6120 return rc;
6114} 6121}
@@ -6509,16 +6516,18 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6509 } 6516 }
6510 6517
6511 EventDescriptionStr(event, evData0, evStr); 6518 EventDescriptionStr(event, evData0, evStr);
6512 devtprintk((MYIOC_s_INFO_FMT "MPT event:(%02Xh) : %s\n", 6519 devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event:(%02Xh) : %s\n",
6513 ioc->name, 6520 ioc->name,
6514 event, 6521 event,
6515 evStr)); 6522 evStr));
6516 6523
6517#if defined(MPT_DEBUG) || defined(MPT_DEBUG_VERBOSE_EVENTS) 6524#ifdef CONFIG_FUSION_LOGGING
6518 printk(KERN_INFO MYNAM ": Event data:\n" KERN_INFO); 6525 devtverboseprintk(ioc, printk(KERN_DEBUG MYNAM
6526 ": Event data:\n"));
6519 for (ii = 0; ii < evDataLen; ii++) 6527 for (ii = 0; ii < evDataLen; ii++)
6520 printk(" %08x", le32_to_cpu(pEventReply->Data[ii])); 6528 devtverboseprintk(ioc, printk(" %08x",
6521 printk("\n"); 6529 le32_to_cpu(pEventReply->Data[ii])));
6530 devtverboseprintk(ioc, printk(KERN_DEBUG "\n"));
6522#endif 6531#endif
6523 6532
6524 /* 6533 /*
@@ -6573,7 +6582,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6573 */ 6582 */
6574 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) { 6583 for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
6575 if (MptEvHandlers[ii]) { 6584 if (MptEvHandlers[ii]) {
6576 devtverboseprintk((MYIOC_s_INFO_FMT "Routing Event to event handler #%d\n", 6585 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Routing Event to event handler #%d\n",
6577 ioc->name, ii)); 6586 ioc->name, ii));
6578 r += (*(MptEvHandlers[ii]))(ioc, pEventReply); 6587 r += (*(MptEvHandlers[ii]))(ioc, pEventReply);
6579 handlers++; 6588 handlers++;
@@ -6585,10 +6594,10 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
6585 * If needed, send (a single) EventAck. 6594 * If needed, send (a single) EventAck.
6586 */ 6595 */
6587 if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) { 6596 if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) {
6588 devtverboseprintk((MYIOC_s_WARN_FMT 6597 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
6589 "EventAck required\n",ioc->name)); 6598 "EventAck required\n",ioc->name));
6590 if ((ii = SendEventAck(ioc, pEventReply)) != 0) { 6599 if ((ii = SendEventAck(ioc, pEventReply)) != 0) {
6591 devtverboseprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n", 6600 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SendEventAck returned %d\n",
6592 ioc->name, ii)); 6601 ioc->name, ii));
6593 } 6602 }
6594 } 6603 }
@@ -6935,7 +6944,6 @@ union loginfo_type {
6935 sas_loginfo.dw.code, sas_loginfo.dw.subcode); 6944 sas_loginfo.dw.code, sas_loginfo.dw.subcode);
6936} 6945}
6937 6946
6938#ifdef MPT_DEBUG_REPLY
6939/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 6947/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
6940/** 6948/**
6941 * mpt_iocstatus_info_config - IOCSTATUS information for config pages 6949 * mpt_iocstatus_info_config - IOCSTATUS information for config pages
@@ -7240,7 +7248,6 @@ mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
7240 7248
7241 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc); 7249 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc);
7242} 7250}
7243#endif
7244 7251
7245/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 7252/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
7246EXPORT_SYMBOL(mpt_attach); 7253EXPORT_SYMBOL(mpt_attach);
@@ -7305,11 +7312,7 @@ fusion_init(void)
7305 7312
7306 /* Register for hard reset handling callbacks. 7313 /* Register for hard reset handling callbacks.
7307 */ 7314 */
7308 if (mpt_reset_register(mpt_base_index, mpt_ioc_reset) == 0) { 7315 mpt_reset_register(mpt_base_index, mpt_ioc_reset);
7309 dprintk((KERN_INFO MYNAM ": Register for IOC reset notification\n"));
7310 } else {
7311 /* FIXME! */
7312 }
7313 7316
7314#ifdef CONFIG_PROC_FS 7317#ifdef CONFIG_PROC_FS
7315 (void) procmpt_create(); 7318 (void) procmpt_create();
@@ -7328,8 +7331,6 @@ static void __exit
7328fusion_exit(void) 7331fusion_exit(void)
7329{ 7332{
7330 7333
7331 dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n"));
7332
7333 mpt_reset_deregister(mpt_base_index); 7334 mpt_reset_deregister(mpt_base_index);
7334 7335
7335#ifdef CONFIG_PROC_FS 7336#ifdef CONFIG_PROC_FS