aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
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
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')
-rw-r--r--drivers/message/fusion/Kconfig14
-rw-r--r--drivers/message/fusion/Makefile37
-rw-r--r--drivers/message/fusion/mptbase.c467
-rw-r--r--drivers/message/fusion/mptbase.h198
-rw-r--r--drivers/message/fusion/mptctl.c266
-rw-r--r--drivers/message/fusion/mptdebug.h288
-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/mptscsih.c446
-rw-r--r--drivers/message/fusion/mptspi.c53
11 files changed, 1137 insertions, 1019 deletions
diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index 4494e0fd36c6..f55cc03a75c9 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -102,4 +102,18 @@ config FUSION_LAN
102 102
103 If unsure whether you really want or need this, say N. 103 If unsure whether you really want or need this, say N.
104 104
105config FUSION_LOGGING
106 bool "Fusion MPT logging facility"
107 depends on FUSION
108 ---help---
109 This turns on a logging facility that can be used to debug a number
110 of Fusion MPT related problems.
111
112 The debug level can be programmed on the fly via SysFS (hex values)
113
114 echo [level] > /sys/class/scsi_host/host#/debug_level
115
116 There are various debug levels that an be found in the source:
117 file:drivers/message/fusion/mptdebug.h
118
105endmenu 119endmenu
diff --git a/drivers/message/fusion/Makefile b/drivers/message/fusion/Makefile
index 6003b46c8438..95c9532cb07c 100644
--- a/drivers/message/fusion/Makefile
+++ b/drivers/message/fusion/Makefile
@@ -1,39 +1,8 @@
1# Fusion MPT drivers; recognized debug defines... 1# Fusion MPT drivers; recognized debug defines...
2# MPT general:
3#EXTRA_CFLAGS += -DMPT_DEBUG
4#EXTRA_CFLAGS += -DMPT_DEBUG_MSG_FRAME
5#EXTRA_CFLAGS += -DMPT_DEBUG_SG
6#EXTRA_CFLAGS += -DMPT_DEBUG_EVENTS
7#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE_EVENTS
8#EXTRA_CFLAGS += -DMPT_DEBUG_INIT
9#EXTRA_CFLAGS += -DMPT_DEBUG_EXIT
10#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL
11#EXTRA_CFLAGS += -DMPT_DEBUG_DV
12#EXTRA_CFLAGS += -DMPT_DEBUG_TM
13#EXTRA_CFLAGS += -DMPT_DEBUG_REPLY
14 2
15# 3# enable verbose logging
16# driver/module specifics... 4# CONFIG_FUSION_LOGGING needs to be enabled in Kconfig
17# 5#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE
18# For mptbase:
19#CFLAGS_mptbase.o += -DMPT_DEBUG_HANDSHAKE
20#CFLAGS_mptbase.o += -DMPT_DEBUG_CONFIG
21#CFLAGS_mptbase.o += -DMPT_DEBUG_DL
22#CFLAGS_mptbase.o += -DMPT_DEBUG_IRQ
23#CFLAGS_mptbase.o += -DMPT_DEBUG_RESET
24#
25# For mptscsih:
26#CFLAGS_mptscsih.o += -DMPT_DEBUG_SCSI
27#
28# For mptctl:
29#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
30#
31# For mptfc:
32#CFLAGS_mptfc.o += -DMPT_DEBUG_FC
33
34# For mptsas:
35#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS
36#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS_WIDE
37 6
38 7
39#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC 8#=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
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
diff --git a/drivers/message/fusion/mptbase.h b/drivers/message/fusion/mptbase.h
index 98eb9c688e17..15ff22645844 100644
--- a/drivers/message/fusion/mptbase.h
+++ b/drivers/message/fusion/mptbase.h
@@ -186,6 +186,7 @@
186 * MPT drivers. NOTE: Users of these macro defs must 186 * MPT drivers. NOTE: Users of these macro defs must
187 * themselves define their own MYNAM. 187 * themselves define their own MYNAM.
188 */ 188 */
189#define MYIOC_s_DEBUG_FMT KERN_DEBUG MYNAM ": %s: "
189#define MYIOC_s_INFO_FMT KERN_INFO MYNAM ": %s: " 190#define MYIOC_s_INFO_FMT KERN_INFO MYNAM ": %s: "
190#define MYIOC_s_NOTE_FMT KERN_NOTICE MYNAM ": %s: " 191#define MYIOC_s_NOTE_FMT KERN_NOTICE MYNAM ": %s: "
191#define MYIOC_s_WARN_FMT KERN_WARNING MYNAM ": %s: WARNING - " 192#define MYIOC_s_WARN_FMT KERN_WARNING MYNAM ": %s: WARNING - "
@@ -543,6 +544,7 @@ typedef struct _MPT_ADAPTER
543 char board_tracer[16]; 544 char board_tracer[16];
544 u16 nvdata_version_persistent; 545 u16 nvdata_version_persistent;
545 u16 nvdata_version_default; 546 u16 nvdata_version_default;
547 int debug_level;
546 u8 io_missing_delay; 548 u8 io_missing_delay;
547 u8 device_missing_delay; 549 u8 device_missing_delay;
548 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */ 550 SYSIF_REGS __iomem *chip; /* == c8817000 (mmap) */
@@ -718,171 +720,7 @@ typedef struct _mpt_sge {
718/* 720/*
719 * Funky (private) macros... 721 * Funky (private) macros...
720 */ 722 */
721#ifdef MPT_DEBUG 723#include "mptdebug.h"
722#define dprintk(x) printk x
723#else
724#define dprintk(x)
725#endif
726
727#ifdef MPT_DEBUG_INIT
728#define dinitprintk(x) printk x
729#define DBG_DUMP_FW_REQUEST_FRAME(mfp) \
730 { int i, n = 10; \
731 u32 *m = (u32 *)(mfp); \
732 printk(KERN_INFO " "); \
733 for (i=0; i<n; i++) \
734 printk(" %08x", le32_to_cpu(m[i])); \
735 printk("\n"); \
736 }
737#else
738#define dinitprintk(x)
739#define DBG_DUMP_FW_REQUEST_FRAME(mfp)
740#endif
741
742#ifdef MPT_DEBUG_EXIT
743#define dexitprintk(x) printk x
744#else
745#define dexitprintk(x)
746#endif
747
748#if defined MPT_DEBUG_FAIL || defined (MPT_DEBUG_SG)
749#define dfailprintk(x) printk x
750#else
751#define dfailprintk(x)
752#endif
753
754#ifdef MPT_DEBUG_HANDSHAKE
755#define dhsprintk(x) printk x
756#else
757#define dhsprintk(x)
758#endif
759
760#if defined(MPT_DEBUG_EVENTS) || defined(MPT_DEBUG_VERBOSE_EVENTS)
761#define devtprintk(x) printk x
762#else
763#define devtprintk(x)
764#endif
765
766#ifdef MPT_DEBUG_VERBOSE_EVENTS
767#define devtverboseprintk(x) printk x
768#else
769#define devtverboseprintk(x)
770#endif
771
772#ifdef MPT_DEBUG_RESET
773#define drsprintk(x) printk x
774#else
775#define drsprintk(x)
776#endif
777
778//#if defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
779#if defined(MPT_DEBUG_MSG_FRAME)
780#define dmfprintk(x) printk x
781#define DBG_DUMP_REQUEST_FRAME(mfp) \
782 { int i, n = 24; \
783 u32 *m = (u32 *)(mfp); \
784 for (i=0; i<n; i++) { \
785 if (i && ((i%8)==0)) \
786 printk("\n"); \
787 printk("%08x ", le32_to_cpu(m[i])); \
788 } \
789 printk("\n"); \
790 }
791#else
792#define dmfprintk(x)
793#define DBG_DUMP_REQUEST_FRAME(mfp)
794#endif
795
796#ifdef MPT_DEBUG_IRQ
797#define dirqprintk(x) printk x
798#else
799#define dirqprintk(x)
800#endif
801
802#ifdef MPT_DEBUG_SG
803#define dsgprintk(x) printk x
804#else
805#define dsgprintk(x)
806#endif
807
808#if defined(MPT_DEBUG_DL) || defined(MPT_DEBUG)
809#define ddlprintk(x) printk x
810#else
811#define ddlprintk(x)
812#endif
813
814#ifdef MPT_DEBUG_DV
815#define ddvprintk(x) printk x
816#else
817#define ddvprintk(x)
818#endif
819
820#if defined(MPT_DEBUG_DV) || defined(MPT_DEBUG_DV_TINY)
821#define ddvtprintk(x) printk x
822#else
823#define ddvtprintk(x)
824#endif
825
826#ifdef MPT_DEBUG_IOCTL
827#define dctlprintk(x) printk x
828#else
829#define dctlprintk(x)
830#endif
831
832#ifdef MPT_DEBUG_REPLY
833#define dreplyprintk(x) printk x
834#else
835#define dreplyprintk(x)
836#endif
837
838#ifdef DMPT_DEBUG_FC
839#define dfcprintk(x) printk x
840#else
841#define dfcprintk(x)
842#endif
843
844#ifdef MPT_DEBUG_TM
845#define dtmprintk(x) printk x
846#define DBG_DUMP_TM_REQUEST_FRAME(mfp) \
847 { u32 *m = (u32 *)(mfp); \
848 int i, n = 13; \
849 printk("TM_REQUEST:\n"); \
850 for (i=0; i<n; i++) { \
851 if (i && ((i%8)==0)) \
852 printk("\n"); \
853 printk("%08x ", le32_to_cpu(m[i])); \
854 } \
855 printk("\n"); \
856 }
857#define DBG_DUMP_TM_REPLY_FRAME(mfp) \
858 { u32 *m = (u32 *)(mfp); \
859 int i, n = (le32_to_cpu(m[0]) & 0x00FF0000) >> 16; \
860 printk("TM_REPLY MessageLength=%d:\n", n); \
861 for (i=0; i<n; i++) { \
862 if (i && ((i%8)==0)) \
863 printk("\n"); \
864 printk(" %08x", le32_to_cpu(m[i])); \
865 } \
866 printk("\n"); \
867 }
868#else
869#define dtmprintk(x)
870#define DBG_DUMP_TM_REQUEST_FRAME(mfp)
871#define DBG_DUMP_TM_REPLY_FRAME(mfp)
872#endif
873
874#if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG)
875#define dcprintk(x) printk x
876#else
877#define dcprintk(x)
878#endif
879
880#if defined(MPT_DEBUG_SCSI) || defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
881#define dsprintk(x) printk x
882#else
883#define dsprintk(x)
884#endif
885
886 724
887#define MPT_INDEX_2_MFPTR(ioc,idx) \ 725#define MPT_INDEX_2_MFPTR(ioc,idx) \
888 (MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) ) 726 (MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) )
@@ -893,36 +731,6 @@ typedef struct _mpt_sge {
893#define MPT_INDEX_2_RFPTR(ioc,idx) \ 731#define MPT_INDEX_2_RFPTR(ioc,idx) \
894 (MPT_FRAME_HDR*)( (u8*)(ioc)->reply_frames + (ioc)->req_sz * (idx) ) 732 (MPT_FRAME_HDR*)( (u8*)(ioc)->reply_frames + (ioc)->req_sz * (idx) )
895 733
896#if defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
897#define DBG_DUMP_REPLY_FRAME(mfp) \
898 { u32 *m = (u32 *)(mfp); \
899 int i, n = (le32_to_cpu(m[0]) & 0x00FF0000) >> 16; \
900 printk(KERN_INFO " "); \
901 for (i=0; i<n; i++) \
902 printk(" %08x", le32_to_cpu(m[i])); \
903 printk("\n"); \
904 }
905#define DBG_DUMP_REQUEST_FRAME_HDR(mfp) \
906 { int i, n = 3; \
907 u32 *m = (u32 *)(mfp); \
908 printk(KERN_INFO " "); \
909 for (i=0; i<n; i++) \
910 printk(" %08x", le32_to_cpu(m[i])); \
911 printk("\n"); \
912 }
913#else
914#define DBG_DUMP_REPLY_FRAME(mfp)
915#define DBG_DUMP_REQUEST_FRAME_HDR(mfp)
916#endif
917
918// debug sas wide ports
919#ifdef MPT_DEBUG_SAS_WIDE
920#define dsaswideprintk(x) printk x
921#else
922#define dsaswideprintk(x)
923#endif
924
925
926/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 734/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
927 735
928#define SCSI_STD_SENSE_BYTES 18 736#define SCSI_STD_SENSE_BYTES 18
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c
index 58e6c319cc76..89695e705bdc 100644
--- a/drivers/message/fusion/mptctl.c
+++ b/drivers/message/fusion/mptctl.c
@@ -181,7 +181,7 @@ static inline int
181mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock) 181mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
182{ 182{
183 int rc = 0; 183 int rc = 0;
184 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock)); 184// dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
185 185
186 if (nonblock) { 186 if (nonblock) {
187 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex)) 187 if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
@@ -190,7 +190,7 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
190 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex)) 190 if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
191 rc = -ERESTARTSYS; 191 rc = -ERESTARTSYS;
192 } 192 }
193 dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc)); 193// dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down return %d\n", rc));
194 return rc; 194 return rc;
195} 195}
196 196
@@ -209,18 +209,19 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
209 u16 iocStatus; 209 u16 iocStatus;
210 u8 cmd; 210 u8 cmd;
211 211
212 dctlprintk(("mptctl_reply()!\n"));
213 if (req) 212 if (req)
214 cmd = req->u.hdr.Function; 213 cmd = req->u.hdr.Function;
215 else 214 else
216 return 1; 215 return 1;
216 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tcompleting mpi function (0x%02X), req=%p, "
217 "reply=%p\n", ioc->name, req->u.hdr.Function, req, reply));
217 218
218 if (ioc->ioctl) { 219 if (ioc->ioctl) {
219 220
220 if (reply==NULL) { 221 if (reply==NULL) {
221 222
222 dctlprintk(("mptctl_reply() NULL Reply " 223 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_reply() NULL Reply "
223 "Function=%x!\n", cmd)); 224 "Function=%x!\n", ioc->name, cmd));
224 225
225 ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD; 226 ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
226 ioc->ioctl->reset &= ~MPTCTL_RESET_OK; 227 ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
@@ -233,14 +234,9 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
233 234
234 } 235 }
235 236
236 dctlprintk(("mptctl_reply() with req=%p "
237 "reply=%p Function=%x!\n", req, reply, cmd));
238
239 /* Copy the reply frame (which much exist 237 /* Copy the reply frame (which much exist
240 * for non-SCSI I/O) to the IOC structure. 238 * for non-SCSI I/O) to the IOC structure.
241 */ 239 */
242 dctlprintk(("Copying Reply Frame @%p to ioc%d!\n",
243 reply, ioc->id));
244 memcpy(ioc->ioctl->ReplyFrame, reply, 240 memcpy(ioc->ioctl->ReplyFrame, reply,
245 min(ioc->reply_sz, 4*reply->u.reply.MsgLength)); 241 min(ioc->reply_sz, 4*reply->u.reply.MsgLength));
246 ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID; 242 ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID;
@@ -252,8 +248,24 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
252 if (iocStatus == MPI_IOCSTATUS_SUCCESS) 248 if (iocStatus == MPI_IOCSTATUS_SUCCESS)
253 ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD; 249 ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
254 250
251 if (iocStatus || reply->u.reply.IOCLogInfo)
252 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tiocstatus (0x%04X), "
253 "loginfo (0x%08X)\n", ioc->name,
254 iocStatus,
255 le32_to_cpu(reply->u.reply.IOCLogInfo)));
256
255 if ((cmd == MPI_FUNCTION_SCSI_IO_REQUEST) || 257 if ((cmd == MPI_FUNCTION_SCSI_IO_REQUEST) ||
256 (cmd == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) { 258 (cmd == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
259
260 if (reply->u.sreply.SCSIStatus || reply->u.sreply.SCSIState)
261 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
262 "\tscsi_status (0x%02x), scsi_state (0x%02x), "
263 "tag = (0x%04x), transfer_count (0x%08x)\n", ioc->name,
264 reply->u.sreply.SCSIStatus,
265 reply->u.sreply.SCSIState,
266 le16_to_cpu(reply->u.sreply.TaskTag),
267 le32_to_cpu(reply->u.sreply.TransferCount)));
268
257 ioc->ioctl->reset &= ~MPTCTL_RESET_OK; 269 ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
258 270
259 if ((iocStatus == MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) || 271 if ((iocStatus == MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) ||
@@ -298,8 +310,8 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
298{ 310{
299 int rc = 1; 311 int rc = 1;
300 312
301 dctlprintk((KERN_NOTICE MYNAM ": Timeout Expired! Host %d\n", 313 dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT ": Timeout Expired! Host %d\n",
302 ioctl->ioc->id)); 314 ioctl->ioc->name, ioctl->ioc->id));
303 if (ioctl == NULL) 315 if (ioctl == NULL)
304 return; 316 return;
305 317
@@ -311,7 +323,7 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
311 /* Issue a reset for this device. 323 /* Issue a reset for this device.
312 * The IOC is not responding. 324 * The IOC is not responding.
313 */ 325 */
314 dctlprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n", 326 dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
315 ioctl->ioc->name)); 327 ioctl->ioc->name));
316 mpt_HardResetHandler(ioctl->ioc, CAN_SLEEP); 328 mpt_HardResetHandler(ioctl->ioc, CAN_SLEEP);
317 } 329 }
@@ -350,14 +362,14 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
350 /* Send request 362 /* Send request
351 */ 363 */
352 if ((mf = mpt_get_msg_frame(mptctl_id, ioctl->ioc)) == NULL) { 364 if ((mf = mpt_get_msg_frame(mptctl_id, ioctl->ioc)) == NULL) {
353 dctlprintk((MYIOC_s_WARN_FMT "IssueTaskMgmt, no msg frames!!\n", 365 dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt, no msg frames!!\n",
354 ioctl->ioc->name)); 366 ioctl->ioc->name));
355 367
356 mptctl_free_tm_flags(ioctl->ioc); 368 mptctl_free_tm_flags(ioctl->ioc);
357 return -ENOMEM; 369 return -ENOMEM;
358 } 370 }
359 371
360 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n", 372 dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
361 ioctl->ioc->name, mf)); 373 ioctl->ioc->name, mf));
362 374
363 pScsiTm = (SCSITaskMgmt_t *) mf; 375 pScsiTm = (SCSITaskMgmt_t *) mf;
@@ -377,15 +389,15 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
377 pScsiTm->Reserved2[ii] = 0; 389 pScsiTm->Reserved2[ii] = 0;
378 390
379 pScsiTm->TaskMsgContext = 0; 391 pScsiTm->TaskMsgContext = 0;
380 dtmprintk((MYIOC_s_INFO_FMT 392 dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT
381 "mptctl_bus_reset: issued.\n", ioctl->ioc->name)); 393 "mptctl_bus_reset: issued.\n", ioctl->ioc->name));
382 394
383 DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf); 395 DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf);
384 396
385 ioctl->wait_done=0; 397 ioctl->wait_done=0;
386 if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc, 398 if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
387 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { 399 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) {
388 dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!" 400 dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
389 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd, 401 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
390 hd->ioc, mf)); 402 hd->ioc, mf));
391 goto mptctl_bus_reset_done; 403 goto mptctl_bus_reset_done;
@@ -456,7 +468,7 @@ static int
456mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase) 468mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
457{ 469{
458 MPT_IOCTL *ioctl = ioc->ioctl; 470 MPT_IOCTL *ioctl = ioc->ioctl;
459 dctlprintk((KERN_INFO MYNAM ": IOC %s_reset routed to IOCTL driver!\n", 471 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": IOC %s_reset routed to IOCTL driver!\n",ioc->name,
460 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : ( 472 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
461 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post"))); 473 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
462 474
@@ -487,7 +499,8 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
487 499
488 event = le32_to_cpu(pEvReply->Event) & 0xFF; 500 event = le32_to_cpu(pEvReply->Event) & 0xFF;
489 501
490 dctlprintk(("%s() called\n", __FUNCTION__)); 502 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s() called\n",
503 ioc->name, __FUNCTION__));
491 if(async_queue == NULL) 504 if(async_queue == NULL)
492 return 1; 505 return 1;
493 506
@@ -497,8 +510,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
497 */ 510 */
498 if (event == 0x21 ) { 511 if (event == 0x21 ) {
499 ioc->aen_event_read_flag=1; 512 ioc->aen_event_read_flag=1;
500 dctlprintk(("Raised SIGIO to application\n")); 513 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Raised SIGIO to application\n",
501 devtverboseprintk(("Raised SIGIO to application\n")); 514 ioc->name));
515 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
516 "Raised SIGIO to application\n", ioc->name));
502 kill_fasync(&async_queue, SIGIO, POLL_IN); 517 kill_fasync(&async_queue, SIGIO, POLL_IN);
503 return 1; 518 return 1;
504 } 519 }
@@ -515,8 +530,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
515 */ 530 */
516 if (ioc->events && (ioc->eventTypes & ( 1 << event))) { 531 if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
517 ioc->aen_event_read_flag=1; 532 ioc->aen_event_read_flag=1;
518 dctlprintk(("Raised SIGIO to application\n")); 533 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
519 devtverboseprintk(("Raised SIGIO to application\n")); 534 "Raised SIGIO to application\n", ioc->name));
535 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
536 "Raised SIGIO to application\n", ioc->name));
520 kill_fasync(&async_queue, SIGIO, POLL_IN); 537 kill_fasync(&async_queue, SIGIO, POLL_IN);
521 } 538 }
522 return 1; 539 return 1;
@@ -530,14 +547,12 @@ mptctl_fasync(int fd, struct file *filep, int mode)
530 list_for_each_entry(ioc, &ioc_list, list) 547 list_for_each_entry(ioc, &ioc_list, list)
531 ioc->aen_event_read_flag=0; 548 ioc->aen_event_read_flag=0;
532 549
533 dctlprintk(("%s() called\n", __FUNCTION__));
534 return fasync_helper(fd, filep, mode, &async_queue); 550 return fasync_helper(fd, filep, mode, &async_queue);
535} 551}
536 552
537static int 553static int
538mptctl_release(struct inode *inode, struct file *filep) 554mptctl_release(struct inode *inode, struct file *filep)
539{ 555{
540 dctlprintk(("%s() called\n", __FUNCTION__));
541 return fasync_helper(-1, filep, 0, &async_queue); 556 return fasync_helper(-1, filep, 0, &async_queue);
542} 557}
543 558
@@ -558,8 +573,6 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
558 int ret; 573 int ret;
559 MPT_ADAPTER *iocp = NULL; 574 MPT_ADAPTER *iocp = NULL;
560 575
561 dctlprintk(("mptctl_ioctl() called\n"));
562
563 if (copy_from_user(&khdr, uhdr, sizeof(khdr))) { 576 if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
564 printk(KERN_ERR "%s::mptctl_ioctl() @%d - " 577 printk(KERN_ERR "%s::mptctl_ioctl() @%d - "
565 "Unable to copy mpt_ioctl_header data @ %p\n", 578 "Unable to copy mpt_ioctl_header data @ %p\n",
@@ -574,13 +587,13 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
574 iocnumX = khdr.iocnum & 0xFF; 587 iocnumX = khdr.iocnum & 0xFF;
575 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 588 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
576 (iocp == NULL)) { 589 (iocp == NULL)) {
577 dctlprintk((KERN_ERR "%s::mptctl_ioctl() @%d - ioc%d not found!\n", 590 printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
578 __FILE__, __LINE__, iocnumX)); 591 __FILE__, __LINE__, iocnumX);
579 return -ENODEV; 592 return -ENODEV;
580 } 593 }
581 594
582 if (!iocp->active) { 595 if (!iocp->active) {
583 printk(KERN_ERR "%s::mptctl_ioctl() @%d - Controller disabled.\n", 596 printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - Controller disabled.\n",
584 __FILE__, __LINE__); 597 __FILE__, __LINE__);
585 return -EFAULT; 598 return -EFAULT;
586 } 599 }
@@ -612,8 +625,6 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
612 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0) 625 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
613 return ret; 626 return ret;
614 627
615 dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
616
617 if (cmd == MPTFWDOWNLOAD) 628 if (cmd == MPTFWDOWNLOAD)
618 ret = mptctl_fw_download(arg); 629 ret = mptctl_fw_download(arg);
619 else if (cmd == MPTCOMMAND) 630 else if (cmd == MPTCOMMAND)
@@ -648,8 +659,6 @@ static int mptctl_do_reset(unsigned long arg)
648 struct mpt_ioctl_diag_reset krinfo; 659 struct mpt_ioctl_diag_reset krinfo;
649 MPT_ADAPTER *iocp; 660 MPT_ADAPTER *iocp;
650 661
651 dctlprintk((KERN_INFO "mptctl_do_reset called.\n"));
652
653 if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) { 662 if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
654 printk(KERN_ERR "%s@%d::mptctl_do_reset - " 663 printk(KERN_ERR "%s@%d::mptctl_do_reset - "
655 "Unable to copy mpt_ioctl_diag_reset struct @ %p\n", 664 "Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
@@ -658,11 +667,14 @@ static int mptctl_do_reset(unsigned long arg)
658 } 667 }
659 668
660 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) { 669 if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
661 dctlprintk((KERN_ERR "%s@%d::mptctl_do_reset - ioc%d not found!\n", 670 printk(KERN_DEBUG "%s@%d::mptctl_do_reset - ioc%d not found!\n",
662 __FILE__, __LINE__, krinfo.hdr.iocnum)); 671 __FILE__, __LINE__, krinfo.hdr.iocnum);
663 return -ENODEV; /* (-6) No such device or address */ 672 return -ENODEV; /* (-6) No such device or address */
664 } 673 }
665 674
675 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
676 iocp->name));
677
666 if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) { 678 if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) {
667 printk (KERN_ERR "%s@%d::mptctl_do_reset - reset failed.\n", 679 printk (KERN_ERR "%s@%d::mptctl_do_reset - reset failed.\n",
668 __FILE__, __LINE__); 680 __FILE__, __LINE__);
@@ -695,7 +707,6 @@ mptctl_fw_download(unsigned long arg)
695 struct mpt_fw_xfer __user *ufwdl = (void __user *) arg; 707 struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
696 struct mpt_fw_xfer kfwdl; 708 struct mpt_fw_xfer kfwdl;
697 709
698 dctlprintk((KERN_INFO "mptctl_fwdl called. mptctl_id = %xh\n", mptctl_id)); //tc
699 if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) { 710 if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) {
700 printk(KERN_ERR "%s@%d::_ioctl_fwdl - " 711 printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
701 "Unable to copy mpt_fw_xfer struct @ %p\n", 712 "Unable to copy mpt_fw_xfer struct @ %p\n",
@@ -744,15 +755,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
744 u16 iocstat; 755 u16 iocstat;
745 pFWDownloadReply_t ReplyMsg = NULL; 756 pFWDownloadReply_t ReplyMsg = NULL;
746 757
747 dctlprintk(("mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id));
748
749 dctlprintk(("DbG: kfwdl.bufp = %p\n", ufwbuf));
750 dctlprintk(("DbG: kfwdl.fwlen = %d\n", (int)fwlen));
751 dctlprintk(("DbG: kfwdl.ioc = %04xh\n", ioc));
752
753 if (mpt_verify_adapter(ioc, &iocp) < 0) { 758 if (mpt_verify_adapter(ioc, &iocp) < 0) {
754 dctlprintk(("ioctl_fwdl - ioc%d not found!\n", 759 printk(KERN_DEBUG "ioctl_fwdl - ioc%d not found!\n", ioc);
755 ioc));
756 return -ENODEV; /* (-6) No such device or address */ 760 return -ENODEV; /* (-6) No such device or address */
757 } else { 761 } else {
758 762
@@ -761,6 +765,16 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
761 if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL) 765 if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
762 return -EAGAIN; 766 return -EAGAIN;
763 } 767 }
768
769 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT
770 "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id));
771 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.bufp = %p\n",
772 iocp->name, ufwbuf));
773 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n",
774 iocp->name, (int)fwlen));
775 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc = %04xh\n",
776 iocp->name, ioc));
777
764 dlmsg = (FWDownload_t*) mf; 778 dlmsg = (FWDownload_t*) mf;
765 ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL; 779 ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
766 sgOut = (char *) (ptsge + 1); 780 sgOut = (char *) (ptsge + 1);
@@ -829,7 +843,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
829 goto fwdl_out; 843 goto fwdl_out;
830 } 844 }
831 845
832 dctlprintk(("DbG: sgl buffer = %p, sgfrags = %d\n", sgl, numfrags)); 846 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: sgl buffer = %p, sgfrags = %d\n",
847 iocp->name, sgl, numfrags));
833 848
834 /* 849 /*
835 * Parse SG list, copying sgl itself, 850 * Parse SG list, copying sgl itself,
@@ -865,15 +880,7 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
865 sgOut += (sizeof(dma_addr_t) + sizeof(u32)); 880 sgOut += (sizeof(dma_addr_t) + sizeof(u32));
866 } 881 }
867 882
868#ifdef MPT_DEBUG 883 DBG_DUMP_FW_DOWNLOAD(iocp, (u32 *)mf, numfrags);
869 {
870 u32 *m = (u32 *)mf;
871 printk(KERN_INFO MYNAM ": F/W download request:\n" KERN_INFO " ");
872 for (i=0; i < 7+numfrags*2; i++)
873 printk(" %08x", le32_to_cpu(m[i]));
874 printk("\n");
875 }
876#endif
877 884
878 /* 885 /*
879 * Finally, perform firmware download. 886 * Finally, perform firmware download.
@@ -1049,13 +1056,11 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
1049 *frags = numfrags; 1056 *frags = numfrags;
1050 *blp = buflist; 1057 *blp = buflist;
1051 1058
1052 dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - " 1059 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
1053 "%d SG frags generated!\n", 1060 "%d SG frags generated!\n", ioc->name, numfrags));
1054 numfrags));
1055 1061
1056 dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - " 1062 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
1057 "last (big) alloc_sz=%d\n", 1063 "last (big) alloc_sz=%d\n", ioc->name, alloc_sz));
1058 alloc_sz));
1059 1064
1060 return sglbuf; 1065 return sglbuf;
1061 1066
@@ -1139,7 +1144,8 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
1139 1144
1140 pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma); 1145 pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma);
1141 kfree(buflist); 1146 kfree(buflist);
1142 dctlprintk((KERN_INFO MYNAM "-SG: Free'd 1 SGL buf + %d kbufs!\n", n)); 1147 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n",
1148 ioc->name, n));
1143} 1149}
1144 1150
1145/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/ 1151/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1166,7 +1172,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1166 struct scsi_device *sdev; 1172 struct scsi_device *sdev;
1167 VirtDevice *vdev; 1173 VirtDevice *vdev;
1168 1174
1169 dctlprintk((": mptctl_getiocinfo called.\n"));
1170 /* Add of PCI INFO results in unaligned access for 1175 /* Add of PCI INFO results in unaligned access for
1171 * IA64 and Sparc. Reset long to int. Return no PCI 1176 * IA64 and Sparc. Reset long to int. Return no PCI
1172 * data for obsolete format. 1177 * data for obsolete format.
@@ -1199,8 +1204,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1199 1204
1200 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) || 1205 if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
1201 (ioc == NULL)) { 1206 (ioc == NULL)) {
1202 dctlprintk((KERN_ERR "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n", 1207 printk(KERN_DEBUG "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
1203 __FILE__, __LINE__, iocnum)); 1208 __FILE__, __LINE__, iocnum);
1204 kfree(karg); 1209 kfree(karg);
1205 return -ENODEV; 1210 return -ENODEV;
1206 } 1211 }
@@ -1214,6 +1219,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
1214 return -EFAULT; 1219 return -EFAULT;
1215 } 1220 }
1216 1221
1222 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_getiocinfo called.\n",
1223 ioc->name));
1224
1217 /* Fill in the data and return the structure to the calling 1225 /* Fill in the data and return the structure to the calling
1218 * program 1226 * program
1219 */ 1227 */
@@ -1320,7 +1328,6 @@ mptctl_gettargetinfo (unsigned long arg)
1320 u8 port; 1328 u8 port;
1321 struct scsi_device *sdev; 1329 struct scsi_device *sdev;
1322 1330
1323 dctlprintk(("mptctl_gettargetinfo called.\n"));
1324 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) { 1331 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) {
1325 printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - " 1332 printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
1326 "Unable to read in mpt_ioctl_targetinfo struct @ %p\n", 1333 "Unable to read in mpt_ioctl_targetinfo struct @ %p\n",
@@ -1330,11 +1337,13 @@ mptctl_gettargetinfo (unsigned long arg)
1330 1337
1331 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1338 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1332 (ioc == NULL)) { 1339 (ioc == NULL)) {
1333 dctlprintk((KERN_ERR "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n", 1340 printk(KERN_DEBUG "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
1334 __FILE__, __LINE__, iocnum)); 1341 __FILE__, __LINE__, iocnum);
1335 return -ENODEV; 1342 return -ENODEV;
1336 } 1343 }
1337 1344
1345 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n",
1346 ioc->name));
1338 /* Get the port number and set the maximum number of bytes 1347 /* Get the port number and set the maximum number of bytes
1339 * in the returned structure. 1348 * in the returned structure.
1340 * Ignore the port setting. 1349 * Ignore the port setting.
@@ -1434,7 +1443,6 @@ mptctl_readtest (unsigned long arg)
1434 MPT_ADAPTER *ioc; 1443 MPT_ADAPTER *ioc;
1435 int iocnum; 1444 int iocnum;
1436 1445
1437 dctlprintk(("mptctl_readtest called.\n"));
1438 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) { 1446 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
1439 printk(KERN_ERR "%s@%d::mptctl_readtest - " 1447 printk(KERN_ERR "%s@%d::mptctl_readtest - "
1440 "Unable to read in mpt_ioctl_test struct @ %p\n", 1448 "Unable to read in mpt_ioctl_test struct @ %p\n",
@@ -1444,11 +1452,13 @@ mptctl_readtest (unsigned long arg)
1444 1452
1445 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1453 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1446 (ioc == NULL)) { 1454 (ioc == NULL)) {
1447 dctlprintk((KERN_ERR "%s::mptctl_readtest() @%d - ioc%d not found!\n", 1455 printk(KERN_DEBUG "%s::mptctl_readtest() @%d - ioc%d not found!\n",
1448 __FILE__, __LINE__, iocnum)); 1456 __FILE__, __LINE__, iocnum);
1449 return -ENODEV; 1457 return -ENODEV;
1450 } 1458 }
1451 1459
1460 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
1461 ioc->name));
1452 /* Fill in the data and return the structure to the calling 1462 /* Fill in the data and return the structure to the calling
1453 * program 1463 * program
1454 */ 1464 */
@@ -1494,7 +1504,6 @@ mptctl_eventquery (unsigned long arg)
1494 MPT_ADAPTER *ioc; 1504 MPT_ADAPTER *ioc;
1495 int iocnum; 1505 int iocnum;
1496 1506
1497 dctlprintk(("mptctl_eventquery called.\n"));
1498 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) { 1507 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
1499 printk(KERN_ERR "%s@%d::mptctl_eventquery - " 1508 printk(KERN_ERR "%s@%d::mptctl_eventquery - "
1500 "Unable to read in mpt_ioctl_eventquery struct @ %p\n", 1509 "Unable to read in mpt_ioctl_eventquery struct @ %p\n",
@@ -1504,11 +1513,13 @@ mptctl_eventquery (unsigned long arg)
1504 1513
1505 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1514 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1506 (ioc == NULL)) { 1515 (ioc == NULL)) {
1507 dctlprintk((KERN_ERR "%s::mptctl_eventquery() @%d - ioc%d not found!\n", 1516 printk(KERN_DEBUG "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
1508 __FILE__, __LINE__, iocnum)); 1517 __FILE__, __LINE__, iocnum);
1509 return -ENODEV; 1518 return -ENODEV;
1510 } 1519 }
1511 1520
1521 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n",
1522 ioc->name));
1512 karg.eventEntries = MPTCTL_EVENT_LOG_SIZE; 1523 karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
1513 karg.eventTypes = ioc->eventTypes; 1524 karg.eventTypes = ioc->eventTypes;
1514 1525
@@ -1532,7 +1543,6 @@ mptctl_eventenable (unsigned long arg)
1532 MPT_ADAPTER *ioc; 1543 MPT_ADAPTER *ioc;
1533 int iocnum; 1544 int iocnum;
1534 1545
1535 dctlprintk(("mptctl_eventenable called.\n"));
1536 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) { 1546 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
1537 printk(KERN_ERR "%s@%d::mptctl_eventenable - " 1547 printk(KERN_ERR "%s@%d::mptctl_eventenable - "
1538 "Unable to read in mpt_ioctl_eventenable struct @ %p\n", 1548 "Unable to read in mpt_ioctl_eventenable struct @ %p\n",
@@ -1542,11 +1552,13 @@ mptctl_eventenable (unsigned long arg)
1542 1552
1543 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1553 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1544 (ioc == NULL)) { 1554 (ioc == NULL)) {
1545 dctlprintk((KERN_ERR "%s::mptctl_eventenable() @%d - ioc%d not found!\n", 1555 printk(KERN_DEBUG "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
1546 __FILE__, __LINE__, iocnum)); 1556 __FILE__, __LINE__, iocnum);
1547 return -ENODEV; 1557 return -ENODEV;
1548 } 1558 }
1549 1559
1560 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n",
1561 ioc->name));
1550 if (ioc->events == NULL) { 1562 if (ioc->events == NULL) {
1551 /* Have not yet allocated memory - do so now. 1563 /* Have not yet allocated memory - do so now.
1552 */ 1564 */
@@ -1579,7 +1591,6 @@ mptctl_eventreport (unsigned long arg)
1579 int iocnum; 1591 int iocnum;
1580 int numBytes, maxEvents, max; 1592 int numBytes, maxEvents, max;
1581 1593
1582 dctlprintk(("mptctl_eventreport called.\n"));
1583 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) { 1594 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
1584 printk(KERN_ERR "%s@%d::mptctl_eventreport - " 1595 printk(KERN_ERR "%s@%d::mptctl_eventreport - "
1585 "Unable to read in mpt_ioctl_eventreport struct @ %p\n", 1596 "Unable to read in mpt_ioctl_eventreport struct @ %p\n",
@@ -1589,10 +1600,12 @@ mptctl_eventreport (unsigned long arg)
1589 1600
1590 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1601 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1591 (ioc == NULL)) { 1602 (ioc == NULL)) {
1592 dctlprintk((KERN_ERR "%s::mptctl_eventreport() @%d - ioc%d not found!\n", 1603 printk(KERN_DEBUG "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
1593 __FILE__, __LINE__, iocnum)); 1604 __FILE__, __LINE__, iocnum);
1594 return -ENODEV; 1605 return -ENODEV;
1595 } 1606 }
1607 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n",
1608 ioc->name));
1596 1609
1597 numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header); 1610 numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header);
1598 maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS); 1611 maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
@@ -1632,7 +1645,6 @@ mptctl_replace_fw (unsigned long arg)
1632 int iocnum; 1645 int iocnum;
1633 int newFwSize; 1646 int newFwSize;
1634 1647
1635 dctlprintk(("mptctl_replace_fw called.\n"));
1636 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) { 1648 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
1637 printk(KERN_ERR "%s@%d::mptctl_replace_fw - " 1649 printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
1638 "Unable to read in mpt_ioctl_replace_fw struct @ %p\n", 1650 "Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
@@ -1642,11 +1654,13 @@ mptctl_replace_fw (unsigned long arg)
1642 1654
1643 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1655 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1644 (ioc == NULL)) { 1656 (ioc == NULL)) {
1645 dctlprintk((KERN_ERR "%s::mptctl_replace_fw() @%d - ioc%d not found!\n", 1657 printk(KERN_DEBUG "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
1646 __FILE__, __LINE__, iocnum)); 1658 __FILE__, __LINE__, iocnum);
1647 return -ENODEV; 1659 return -ENODEV;
1648 } 1660 }
1649 1661
1662 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n",
1663 ioc->name));
1650 /* If caching FW, Free the old FW image 1664 /* If caching FW, Free the old FW image
1651 */ 1665 */
1652 if (ioc->cached_fw == NULL) 1666 if (ioc->cached_fw == NULL)
@@ -1704,7 +1718,6 @@ mptctl_mpt_command (unsigned long arg)
1704 int iocnum; 1718 int iocnum;
1705 int rc; 1719 int rc;
1706 1720
1707 dctlprintk(("mptctl_command called.\n"));
1708 1721
1709 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) { 1722 if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
1710 printk(KERN_ERR "%s@%d::mptctl_mpt_command - " 1723 printk(KERN_ERR "%s@%d::mptctl_mpt_command - "
@@ -1715,8 +1728,8 @@ mptctl_mpt_command (unsigned long arg)
1715 1728
1716 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1729 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1717 (ioc == NULL)) { 1730 (ioc == NULL)) {
1718 dctlprintk((KERN_ERR "%s::mptctl_mpt_command() @%d - ioc%d not found!\n", 1731 printk(KERN_DEBUG "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
1719 __FILE__, __LINE__, iocnum)); 1732 __FILE__, __LINE__, iocnum);
1720 return -ENODEV; 1733 return -ENODEV;
1721 } 1734 }
1722 1735
@@ -1756,13 +1769,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1756 ulong timeout; 1769 ulong timeout;
1757 struct scsi_device *sdev; 1770 struct scsi_device *sdev;
1758 1771
1759 dctlprintk(("mptctl_do_mpt_command called.\n"));
1760 bufIn.kptr = bufOut.kptr = NULL; 1772 bufIn.kptr = bufOut.kptr = NULL;
1761 1773
1762 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 1774 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
1763 (ioc == NULL)) { 1775 (ioc == NULL)) {
1764 dctlprintk((KERN_ERR "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n", 1776 printk(KERN_DEBUG "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
1765 __FILE__, __LINE__, iocnum)); 1777 __FILE__, __LINE__, iocnum);
1766 return -ENODEV; 1778 return -ENODEV;
1767 } 1779 }
1768 if (!ioc->ioctl) { 1780 if (!ioc->ioctl) {
@@ -1816,6 +1828,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1816 1828
1817 /* Verify that this request is allowed. 1829 /* Verify that this request is allowed.
1818 */ 1830 */
1831 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "sending mpi function (0x%02X), req=%p\n",
1832 ioc->name, hdr->Function, mf));
1833
1819 switch (hdr->Function) { 1834 switch (hdr->Function) {
1820 case MPI_FUNCTION_IOC_FACTS: 1835 case MPI_FUNCTION_IOC_FACTS:
1821 case MPI_FUNCTION_PORT_FACTS: 1836 case MPI_FUNCTION_PORT_FACTS:
@@ -1823,6 +1838,18 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
1823 break; 1838 break;
1824 1839
1825 case MPI_FUNCTION_CONFIG: 1840 case MPI_FUNCTION_CONFIG:
1841 {
1842 Config_t *config_frame;
1843 config_frame = (Config_t *)mf;
1844 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\ttype=0x%02x ext_type=0x%02x "
1845 "number=0x%02x action=0x%02x\n", ioc->name,
1846 config_frame->Header.PageType,
1847 config_frame->ExtPageType,
1848 config_frame->Header.PageNumber,
1849 config_frame->Action));
1850 break;
1851 }
1852
1826 case MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND: 1853 case MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND:
1827 case MPI_FUNCTION_FC_EX_LINK_SRVC_SEND: 1854 case MPI_FUNCTION_FC_EX_LINK_SRVC_SEND:
1828 case MPI_FUNCTION_FW_UPLOAD: 1855 case MPI_FUNCTION_FW_UPLOAD:
@@ -2158,12 +2185,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
2158 ioc->ioctl->wait_done = 0; 2185 ioc->ioctl->wait_done = 0;
2159 if (hdr->Function == MPI_FUNCTION_SCSI_TASK_MGMT) { 2186 if (hdr->Function == MPI_FUNCTION_SCSI_TASK_MGMT) {
2160 2187
2161 DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf); 2188 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
2162 2189
2163 if (mpt_send_handshake_request(mptctl_id, ioc, 2190 if (mpt_send_handshake_request(mptctl_id, ioc,
2164 sizeof(SCSITaskMgmt_t), (u32*)mf, 2191 sizeof(SCSITaskMgmt_t), (u32*)mf,
2165 CAN_SLEEP) != 0) { 2192 CAN_SLEEP) != 0) {
2166 dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!" 2193 dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
2167 " (ioc %p, mf %p) \n", ioc->name, 2194 " (ioc %p, mf %p) \n", ioc->name,
2168 ioc, mf)); 2195 ioc, mf));
2169 mptctl_free_tm_flags(ioc); 2196 mptctl_free_tm_flags(ioc);
@@ -2303,7 +2330,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2303 MPT_FRAME_HDR *mf = NULL; 2330 MPT_FRAME_HDR *mf = NULL;
2304 MPIHeader_t *mpi_hdr; 2331 MPIHeader_t *mpi_hdr;
2305 2332
2306 dctlprintk((": mptctl_hp_hostinfo called.\n"));
2307 /* Reset long to int. Should affect IA64 and SPARC only 2333 /* Reset long to int. Should affect IA64 and SPARC only
2308 */ 2334 */
2309 if (data_size == sizeof(hp_host_info_t)) 2335 if (data_size == sizeof(hp_host_info_t))
@@ -2322,10 +2348,12 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2322 2348
2323 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 2349 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2324 (ioc == NULL)) { 2350 (ioc == NULL)) {
2325 dctlprintk((KERN_ERR "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n", 2351 printk(KERN_DEBUG "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
2326 __FILE__, __LINE__, iocnum)); 2352 __FILE__, __LINE__, iocnum);
2327 return -ENODEV; 2353 return -ENODEV;
2328 } 2354 }
2355 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n",
2356 ioc->name));
2329 2357
2330 /* Fill in the data and return the structure to the calling 2358 /* Fill in the data and return the structure to the calling
2331 * program 2359 * program
@@ -2441,7 +2469,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2441 * Gather ISTWI(Industry Standard Two Wire Interface) Data 2469 * Gather ISTWI(Industry Standard Two Wire Interface) Data
2442 */ 2470 */
2443 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) { 2471 if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
2444 dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n", 2472 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
2445 ioc->name,__FUNCTION__)); 2473 ioc->name,__FUNCTION__));
2446 goto out; 2474 goto out;
2447 } 2475 }
@@ -2474,7 +2502,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2474 HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */); 2502 HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */);
2475 2503
2476 if(rc <=0 && (ioc->ioctl->wait_done != 1 )) { 2504 if(rc <=0 && (ioc->ioctl->wait_done != 1 )) {
2477 /* 2505 /*
2478 * Now we need to reset the board 2506 * Now we need to reset the board
2479 */ 2507 */
2480 mpt_free_msg_frame(ioc, mf); 2508 mpt_free_msg_frame(ioc, mf);
@@ -2482,7 +2510,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
2482 goto out; 2510 goto out;
2483 } 2511 }
2484 2512
2485 /* 2513 /*
2486 *ISTWI Data Definition 2514 *ISTWI Data Definition
2487 * pbuf[0] = FW_VERSION = 0x4 2515 * pbuf[0] = FW_VERSION = 0x4
2488 * pbuf[1] = Bay Count = 6 or 4 or 2, depending on 2516 * pbuf[1] = Bay Count = 6 or 4 or 2, depending on
@@ -2538,7 +2566,6 @@ mptctl_hp_targetinfo(unsigned long arg)
2538 ConfigPageHeader_t hdr; 2566 ConfigPageHeader_t hdr;
2539 int tmp, np, rc = 0; 2567 int tmp, np, rc = 0;
2540 2568
2541 dctlprintk((": mptctl_hp_targetinfo called.\n"));
2542 if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) { 2569 if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) {
2543 printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - " 2570 printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - "
2544 "Unable to read in hp_host_targetinfo struct @ %p\n", 2571 "Unable to read in hp_host_targetinfo struct @ %p\n",
@@ -2548,10 +2575,12 @@ mptctl_hp_targetinfo(unsigned long arg)
2548 2575
2549 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) || 2576 if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
2550 (ioc == NULL)) { 2577 (ioc == NULL)) {
2551 dctlprintk((KERN_ERR "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n", 2578 printk(KERN_DEBUG "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
2552 __FILE__, __LINE__, iocnum)); 2579 __FILE__, __LINE__, iocnum);
2553 return -ENODEV; 2580 return -ENODEV;
2554 } 2581 }
2582 dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_targetinfo called.\n",
2583 ioc->name));
2555 2584
2556 /* There is nothing to do for FCP parts. 2585 /* There is nothing to do for FCP parts.
2557 */ 2586 */
@@ -2694,7 +2723,6 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
2694 int nonblock = (filp->f_flags & O_NONBLOCK); 2723 int nonblock = (filp->f_flags & O_NONBLOCK);
2695 int ret; 2724 int ret;
2696 2725
2697 dctlprintk((KERN_INFO MYNAM "::compat_mptfwxfer_ioctl() called\n"));
2698 2726
2699 if (copy_from_user(&kfw32, (char __user *)arg, sizeof(kfw32))) 2727 if (copy_from_user(&kfw32, (char __user *)arg, sizeof(kfw32)))
2700 return -EFAULT; 2728 return -EFAULT;
@@ -2703,14 +2731,16 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
2703 iocnumX = kfw32.iocnum & 0xFF; 2731 iocnumX = kfw32.iocnum & 0xFF;
2704 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 2732 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
2705 (iocp == NULL)) { 2733 (iocp == NULL)) {
2706 dctlprintk((KERN_ERR MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n", 2734 printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
2707 __LINE__, iocnumX)); 2735 __LINE__, iocnumX);
2708 return -ENODEV; 2736 return -ENODEV;
2709 } 2737 }
2710 2738
2711 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0) 2739 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
2712 return ret; 2740 return ret;
2713 2741
2742 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mptfwxfer_ioctl() called\n",
2743 iocp->name));
2714 kfw.iocnum = iocnum; 2744 kfw.iocnum = iocnum;
2715 kfw.fwlen = kfw32.fwlen; 2745 kfw.fwlen = kfw32.fwlen;
2716 kfw.bufp = compat_ptr(kfw32.bufp); 2746 kfw.bufp = compat_ptr(kfw32.bufp);
@@ -2734,8 +2764,6 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2734 int nonblock = (filp->f_flags & O_NONBLOCK); 2764 int nonblock = (filp->f_flags & O_NONBLOCK);
2735 int ret; 2765 int ret;
2736 2766
2737 dctlprintk((KERN_INFO MYNAM "::compat_mpt_command() called\n"));
2738
2739 if (copy_from_user(&karg32, (char __user *)arg, sizeof(karg32))) 2767 if (copy_from_user(&karg32, (char __user *)arg, sizeof(karg32)))
2740 return -EFAULT; 2768 return -EFAULT;
2741 2769
@@ -2743,14 +2771,16 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
2743 iocnumX = karg32.hdr.iocnum & 0xFF; 2771 iocnumX = karg32.hdr.iocnum & 0xFF;
2744 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) || 2772 if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
2745 (iocp == NULL)) { 2773 (iocp == NULL)) {
2746 dctlprintk((KERN_ERR MYNAM "::compat_mpt_command @%d - ioc%d not found!\n", 2774 printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
2747 __LINE__, iocnumX)); 2775 __LINE__, iocnumX);
2748 return -ENODEV; 2776 return -ENODEV;
2749 } 2777 }
2750 2778
2751 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0) 2779 if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
2752 return ret; 2780 return ret;
2753 2781
2782 dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mpt_command() called\n",
2783 iocp->name));
2754 /* Copy data to karg */ 2784 /* Copy data to karg */
2755 karg.hdr.iocnum = karg32.hdr.iocnum; 2785 karg.hdr.iocnum = karg32.hdr.iocnum;
2756 karg.hdr.port = karg32.hdr.port; 2786 karg.hdr.port = karg32.hdr.port;
@@ -2878,11 +2908,7 @@ static int __init mptctl_init(void)
2878 2908
2879 show_mptmod_ver(my_NAME, my_VERSION); 2909 show_mptmod_ver(my_NAME, my_VERSION);
2880 2910
2881 if(mpt_device_driver_register(&mptctl_driver, 2911 mpt_device_driver_register(&mptctl_driver, MPTCTL_DRIVER);
2882 MPTCTL_DRIVER) != 0 ) {
2883 dprintk((KERN_INFO MYNAM
2884 ": failed to register dd callbacks\n"));
2885 }
2886 2912
2887 /* Register this device */ 2913 /* Register this device */
2888 err = misc_register(&mptctl_miscdev); 2914 err = misc_register(&mptctl_miscdev);
@@ -2905,16 +2931,8 @@ static int __init mptctl_init(void)
2905 goto out_fail; 2931 goto out_fail;
2906 } 2932 }
2907 2933
2908 if (mpt_reset_register(mptctl_id, mptctl_ioc_reset) == 0) { 2934 mpt_reset_register(mptctl_id, mptctl_ioc_reset);
2909 dprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n")); 2935 mpt_event_register(mptctl_id, mptctl_event_process);
2910 } else {
2911 /* FIXME! */
2912 }
2913
2914 if (mpt_event_register(mptctl_id, mptctl_event_process) == 0) {
2915 devtverboseprintk((KERN_INFO MYNAM
2916 ": Registered for IOC event notifications\n"));
2917 }
2918 2936
2919 return 0; 2937 return 0;
2920 2938
@@ -2934,11 +2952,9 @@ static void mptctl_exit(void)
2934 2952
2935 /* De-register reset handler from base module */ 2953 /* De-register reset handler from base module */
2936 mpt_reset_deregister(mptctl_id); 2954 mpt_reset_deregister(mptctl_id);
2937 dprintk((KERN_INFO MYNAM ": Deregistered for IOC reset notifications\n"));
2938 2955
2939 /* De-register callback handler from base module */ 2956 /* De-register callback handler from base module */
2940 mpt_deregister(mptctl_id); 2957 mpt_deregister(mptctl_id);
2941 printk(KERN_INFO MYNAM ": Deregistered from Fusion MPT base driver\n");
2942 2958
2943 mpt_device_driver_deregister(MPTCTL_DRIVER); 2959 mpt_device_driver_deregister(MPTCTL_DRIVER);
2944 2960
diff --git a/drivers/message/fusion/mptdebug.h b/drivers/message/fusion/mptdebug.h
new file mode 100644
index 000000000000..ffdb0a6191b4
--- /dev/null
+++ b/drivers/message/fusion/mptdebug.h
@@ -0,0 +1,288 @@
1/*
2 * linux/drivers/message/fusion/mptdebug.h
3 * For use with LSI PCI chip/adapter(s)
4 * running LSI Fusion MPT (Message Passing Technology) firmware.
5 *
6 * Copyright (c) 1999-2007 LSI Corporation
7 * (mailto:DL-MPTFusionLinux@lsi.com)
8 *
9 */
10/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
11
12#ifndef MPTDEBUG_H_INCLUDED
13#define MPTDEBUG_H_INCLUDED
14
15/*
16 * debug level can be programmed on the fly via SysFS (hex values)
17 *
18 * Example: (programming for MPT_DEBUG_EVENTS on host 5)
19 *
20 * echo 8 > /sys/class/scsi_host/host5/debug_level
21 *
22 * --------------------------------------------------------
23 * mpt_debug_level - command line parameter
24 * this allow enabling debug at driver load time (for all iocs)
25 *
26 * Example (programming for MPT_DEBUG_EVENTS)
27 *
28 * insmod mptbase.ko mpt_debug_level=8
29 *
30 * --------------------------------------------------------
31 * CONFIG_FUSION_LOGGING - enables compiling debug into driver
32 * this can be enabled in the driver Makefile
33 *
34 *
35 * --------------------------------------------------------
36 * Please note most debug prints are set to logging priority = debug
37 * This is the lowest level, and most verbose. Please refer to manual
38 * pages for syslogd or syslogd-ng on how to configure this.
39 */
40
41#define MPT_DEBUG 0x00000001
42#define MPT_DEBUG_MSG_FRAME 0x00000002
43#define MPT_DEBUG_SG 0x00000004
44#define MPT_DEBUG_EVENTS 0x00000008
45#define MPT_DEBUG_VERBOSE_EVENTS 0x00000010
46#define MPT_DEBUG_INIT 0x00000020
47#define MPT_DEBUG_EXIT 0x00000040
48#define MPT_DEBUG_FAIL 0x00000080
49#define MPT_DEBUG_TM 0x00000100
50#define MPT_DEBUG_DV 0x00000200
51#define MPT_DEBUG_REPLY 0x00000400
52#define MPT_DEBUG_HANDSHAKE 0x00000800
53#define MPT_DEBUG_CONFIG 0x00001000
54#define MPT_DEBUG_DL 0x00002000
55#define MPT_DEBUG_RESET 0x00008000
56#define MPT_DEBUG_SCSI 0x00010000
57#define MPT_DEBUG_IOCTL 0x00020000
58#define MPT_DEBUG_FC 0x00080000
59#define MPT_DEBUG_SAS 0x00100000
60#define MPT_DEBUG_SAS_WIDE 0x00200000
61
62/*
63 * CONFIG_FUSION_LOGGING - enabled in Kconfig
64 */
65
66#ifdef CONFIG_FUSION_LOGGING
67#define MPT_CHECK_LOGGING(IOC, CMD, BITS) \
68{ \
69 if (IOC->debug_level & BITS) \
70 CMD; \
71}
72#else
73#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
74#endif
75
76
77/*
78 * debug macros
79 */
80
81#define dprintk(IOC, CMD) \
82 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
83
84#define dsgprintk(IOC, CMD) \
85 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
86
87#define devtprintk(IOC, CMD) \
88 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
89
90#define devtverboseprintk(IOC, CMD) \
91 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_VERBOSE_EVENTS)
92
93#define dinitprintk(IOC, CMD) \
94 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
95
96#define dexitprintk(IOC, CMD) \
97 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
98
99#define dfailprintk(IOC, CMD) \
100 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
101
102#define dtmprintk(IOC, CMD) \
103 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)
104
105#define ddvprintk(IOC, CMD) \
106 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DV)
107
108#define dreplyprintk(IOC, CMD) \
109 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)
110
111#define dhsprintk(IOC, CMD) \
112 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)
113
114#define dcprintk(IOC, CMD) \
115 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)
116
117#define ddlprintk(IOC, CMD) \
118 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)
119
120#define drsprintk(IOC, CMD) \
121 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)
122
123#define dsprintk(IOC, CMD) \
124 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)
125
126#define dctlprintk(IOC, CMD) \
127 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)
128
129#define dfcprintk(IOC, CMD) \
130 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FC)
131
132#define dsasprintk(IOC, CMD) \
133 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)
134
135#define dsaswideprintk(IOC, CMD) \
136 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)
137
138
139
140/*
141 * Verbose logging
142 */
143#if defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING)
144static inline void
145DBG_DUMP_FW_DOWNLOAD(MPT_ADAPTER *ioc, u32 *mfp, int numfrags)
146{
147 int i;
148
149 if (!(ioc->debug_level & MPT_DEBUG))
150 return;
151 printk(KERN_DEBUG "F/W download request:\n");
152 for (i=0; i < 7+numfrags*2; i++)
153 printk(" %08x", le32_to_cpu(mfp[i]));
154 printk("\n");
155}
156
157static inline void
158DBG_DUMP_PUT_MSG_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
159{
160 int ii, n;
161
162 if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
163 return;
164 printk(KERN_DEBUG "%s: About to Put msg frame @ %p:\n",
165 ioc->name, mfp);
166 n = ioc->req_sz/4 - 1;
167 while (mfp[n] == 0)
168 n--;
169 for (ii=0; ii<=n; ii++) {
170 if (ii && ((ii%8)==0))
171 printk("\n");
172 printk(" %08x", le32_to_cpu(mfp[ii]));
173 }
174 printk("\n");
175}
176
177static inline void
178DBG_DUMP_FW_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
179{
180 int i, n;
181
182 if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
183 return;
184 n = 10;
185 printk(KERN_INFO " ");
186 for (i = 0; i < n; i++)
187 printk(" %08x", le32_to_cpu(mfp[i]));
188 printk("\n");
189}
190
191static inline void
192DBG_DUMP_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
193{
194 int i, n;
195
196 if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
197 return;
198 n = 24;
199 for (i=0; i<n; i++) {
200 if (i && ((i%8)==0))
201 printk("\n");
202 printk("%08x ", le32_to_cpu(mfp[i]));
203 }
204 printk("\n");
205}
206
207static inline void
208DBG_DUMP_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
209{
210 int i, n;
211
212 if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
213 return;
214 n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;
215 printk(KERN_INFO " ");
216 for (i=0; i<n; i++)
217 printk(" %08x", le32_to_cpu(mfp[i]));
218 printk("\n");
219}
220
221static inline void
222DBG_DUMP_REQUEST_FRAME_HDR(MPT_ADAPTER *ioc, u32 *mfp)
223{
224 int i, n;
225
226 if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
227 return;
228 n = 3;
229 printk(KERN_INFO " ");
230 for (i=0; i<n; i++)
231 printk(" %08x", le32_to_cpu(mfp[i]));
232 printk("\n");
233}
234
235static inline void
236DBG_DUMP_TM_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
237{
238 int i, n;
239
240 if (!(ioc->debug_level & MPT_DEBUG_TM))
241 return;
242 n = 13;
243 printk(KERN_DEBUG "TM_REQUEST:\n");
244 for (i=0; i<n; i++) {
245 if (i && ((i%8)==0))
246 printk("\n");
247 printk("%08x ", le32_to_cpu(mfp[i]));
248 }
249 printk("\n");
250}
251
252static inline void
253DBG_DUMP_TM_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
254{
255 int i, n;
256
257 if (!(ioc->debug_level & MPT_DEBUG_TM))
258 return;
259 n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;
260 printk(KERN_DEBUG "TM_REPLY MessageLength=%d:\n", n);
261 for (i=0; i<n; i++) {
262 if (i && ((i%8)==0))
263 printk("\n");
264 printk(" %08x", le32_to_cpu(mfp[i]));
265 }
266 printk("\n");
267}
268
269#define dmfprintk(IOC, CMD) \
270 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
271
272# else /* ifdef MPT_DEBUG_MF */
273
274#define DBG_DUMP_FW_DOWNLOAD(IOC, mfp, numfrags)
275#define DBG_DUMP_PUT_MSG_FRAME(IOC, mfp)
276#define DBG_DUMP_FW_REQUEST_FRAME(IOC, mfp)
277#define DBG_DUMP_REQUEST_FRAME(IOC, mfp)
278#define DBG_DUMP_REPLY_FRAME(IOC, mfp)
279#define DBG_DUMP_REQUEST_FRAME_HDR(IOC, mfp)
280#define DBG_DUMP_TM_REQUEST_FRAME(IOC, mfp)
281#define DBG_DUMP_TM_REPLY_FRAME(IOC, mfp)
282
283#define dmfprintk(IOC, CMD) \
284 MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
285
286#endif /* defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING) */
287
288#endif /* ifndef MPTDEBUG_H_INCLUDED */
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/mptscsih.c b/drivers/message/fusion/mptscsih.c
index fd3aa2619f42..5431529741ad 100644
--- a/drivers/message/fusion/mptscsih.c
+++ b/drivers/message/fusion/mptscsih.c
@@ -191,7 +191,7 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
191 int rc; 191 int rc;
192 int chain_idx; 192 int chain_idx;
193 193
194 dsgprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer called\n", 194 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer called\n",
195 ioc->name)); 195 ioc->name));
196 spin_lock_irqsave(&ioc->FreeQlock, flags); 196 spin_lock_irqsave(&ioc->FreeQlock, flags);
197 if (!list_empty(&ioc->FreeChainQ)) { 197 if (!list_empty(&ioc->FreeChainQ)) {
@@ -203,12 +203,12 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
203 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer; 203 offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer;
204 chain_idx = offset / ioc->req_sz; 204 chain_idx = offset / ioc->req_sz;
205 rc = SUCCESS; 205 rc = SUCCESS;
206 dsgprintk((MYIOC_s_ERR_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n", 206 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
207 ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx)); 207 ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx));
208 } else { 208 } else {
209 rc = FAILED; 209 rc = FAILED;
210 chain_idx = MPT_HOST_NO_CHAIN; 210 chain_idx = MPT_HOST_NO_CHAIN;
211 dfailprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer failed\n", 211 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer failed\n",
212 ioc->name)); 212 ioc->name));
213 } 213 }
214 spin_unlock_irqrestore(&ioc->FreeQlock, flags); 214 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
@@ -337,7 +337,7 @@ nextSGEset:
337 */ 337 */
338 pReq->ChainOffset = 0; 338 pReq->ChainOffset = 0;
339 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03; 339 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03;
340 dsgprintk((MYIOC_s_INFO_FMT 340 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT
341 "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset)); 341 "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
342 ioc->RequestNB[req_idx] = RequestNB; 342 ioc->RequestNB[req_idx] = RequestNB;
343 } 343 }
@@ -353,7 +353,7 @@ nextSGEset:
353 * Loop until done. 353 * Loop until done.
354 */ 354 */
355 355
356 dsgprintk((MYIOC_s_INFO_FMT "SG: Chain Required! sg done %d\n", 356 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SG: Chain Required! sg done %d\n",
357 ioc->name, sg_done)); 357 ioc->name, sg_done));
358 358
359 /* Set LAST_ELEMENT flag for last non-chain element 359 /* Set LAST_ELEMENT flag for last non-chain element
@@ -386,7 +386,7 @@ nextSGEset:
386 */ 386 */
387 pReq->ChainOffset = (u8) (sgeOffset >> 2); 387 pReq->ChainOffset = (u8) (sgeOffset >> 2);
388 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03; 388 RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor) + 1) & 0x03;
389 dsgprintk((MYIOC_s_ERR_FMT "Chain Buffer Needed, RequestNB=%x sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset)); 389 dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Chain Buffer Needed, RequestNB=%x sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
390 ioc->RequestNB[req_idx] = RequestNB; 390 ioc->RequestNB[req_idx] = RequestNB;
391 } 391 }
392 392
@@ -397,7 +397,7 @@ nextSGEset:
397 * in current buffer. Get a chain buffer. 397 * in current buffer. Get a chain buffer.
398 */ 398 */
399 if ((mptscsih_getFreeChainBuffer(ioc, &newIndex)) == FAILED) { 399 if ((mptscsih_getFreeChainBuffer(ioc, &newIndex)) == FAILED) {
400 dfailprintk((MYIOC_s_INFO_FMT 400 dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
401 "getFreeChainBuffer FAILED SCSI cmd=%02x (%p)\n", 401 "getFreeChainBuffer FAILED SCSI cmd=%02x (%p)\n",
402 ioc->name, pReq->CDB[0], SCpnt)); 402 ioc->name, pReq->CDB[0], SCpnt));
403 return FAILED; 403 return FAILED;
@@ -419,7 +419,7 @@ nextSGEset:
419 * out the Address and Flags fields. 419 * out the Address and Flags fields.
420 */ 420 */
421 chainSge = (char *) psge; 421 chainSge = (char *) psge;
422 dsgprintk((KERN_INFO " Current buff @ %p (index 0x%x)", 422 dsgprintk(ioc, printk(KERN_DEBUG " Current buff @ %p (index 0x%x)",
423 psge, req_idx)); 423 psge, req_idx));
424 424
425 /* Start the SGE for the next buffer 425 /* Start the SGE for the next buffer
@@ -428,7 +428,7 @@ nextSGEset:
428 sgeOffset = 0; 428 sgeOffset = 0;
429 sg_done = 0; 429 sg_done = 0;
430 430
431 dsgprintk((KERN_INFO " Chain buff @ %p (index 0x%x)\n", 431 dsgprintk(ioc, printk(KERN_DEBUG " Chain buff @ %p (index 0x%x)\n",
432 psge, chain_idx)); 432 psge, chain_idx));
433 433
434 /* Start the SGE for the next buffer 434 /* Start the SGE for the next buffer
@@ -456,7 +456,7 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
456 return; 456 return;
457 457
458 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) { 458 if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
459 dfailprintk((MYIOC_s_WARN_FMT "%s: no msg frames!!\n", 459 dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!!\n",
460 ioc->name,__FUNCTION__)); 460 ioc->name,__FUNCTION__));
461 return; 461 return;
462 } 462 }
@@ -467,93 +467,158 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
467 SEPMsg->TargetID = vtarget->id; 467 SEPMsg->TargetID = vtarget->id;
468 SEPMsg->Action = MPI_SEP_REQ_ACTION_WRITE_STATUS; 468 SEPMsg->Action = MPI_SEP_REQ_ACTION_WRITE_STATUS;
469 SEPMsg->SlotStatus = SlotStatus; 469 SEPMsg->SlotStatus = SlotStatus;
470 devtverboseprintk((MYIOC_s_WARN_FMT 470 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
471 "Sending SEP cmd=%x channel=%d id=%d\n", 471 "Sending SEP cmd=%x channel=%d id=%d\n",
472 ioc->name, SlotStatus, SEPMsg->Bus, SEPMsg->TargetID)); 472 ioc->name, SlotStatus, SEPMsg->Bus, SEPMsg->TargetID));
473 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf); 473 mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
474} 474}
475 475
476#ifdef MPT_DEBUG_REPLY 476#ifdef CONFIG_FUSION_LOGGING
477/** 477/**
478 * mptscsih_iocstatus_info_scsiio - IOCSTATUS information for SCSIIO 478 * mptscsih_info_scsiio - debug print info on reply frame
479 * @ioc: Pointer to MPT_ADAPTER structure 479 * @ioc: Pointer to MPT_ADAPTER structure
480 * @ioc_status: U32 IOCStatus word from IOC
481 * @scsi_status: U8 sam status from target
482 * @scsi_state: U8 scsi state
483 * @sc: original scsi cmnd pointer 480 * @sc: original scsi cmnd pointer
484 * @mf: Pointer to MPT request frame 481 * @pScsiReply: Pointer to MPT reply frame
482 *
483 * MPT_DEBUG_REPLY needs to be enabled to obtain this info
485 * 484 *
486 * Refer to lsi/mpi.h. 485 * Refer to lsi/mpi.h.
487 **/ 486 **/
488static void 487static void
489mptscsih_iocstatus_info_scsiio(MPT_ADAPTER *ioc, u32 ioc_status, 488mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pScsiReply)
490 u8 scsi_status, u8 scsi_state, struct scsi_cmnd *sc)
491{ 489{
492 char extend_desc[EVENT_DESCR_STR_SZ]; 490 char *desc = NULL;
493 char *desc = NULL; 491 char *desc1 = NULL;
492 u16 ioc_status;
493 u8 skey, asc, ascq;
494
495 ioc_status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
494 496
495 switch (ioc_status) { 497 switch (ioc_status) {
496 498
497 case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */ 499 case MPI_IOCSTATUS_SUCCESS:
498 desc = "SCSI Invalid Bus"; 500 desc = "success";
499 break; 501 break;
500 502 case MPI_IOCSTATUS_SCSI_INVALID_BUS:
501 case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */ 503 desc = "invalid bus";
502 desc = "SCSI Invalid TargetID";
503 break; 504 break;
504 505 case MPI_IOCSTATUS_SCSI_INVALID_TARGETID:
505 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */ 506 desc = "invalid target_id";
506 /*
507 * Inquiry is issued for device scanning
508 */
509 if (sc->cmnd[0] != 0x12)
510 desc = "SCSI Device Not There";
511 break; 507 break;
512 508 case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE:
513 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */ 509 desc = "device not there";
514 desc = "SCSI Data Overrun";
515 break; 510 break;
516 511 case MPI_IOCSTATUS_SCSI_DATA_OVERRUN:
517 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */ 512 desc = "data overrun";
518 desc = "SCSI I/O Data Error";
519 break; 513 break;
520 514 case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:
521 case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */ 515 desc = "data underrun";
522 desc = "SCSI Protocol Error";
523 break; 516 break;
524 517 case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR:
525 case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */ 518 desc = "I/O data error";
526 desc = "SCSI Task Terminated";
527 break; 519 break;
528 520 case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:
529 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */ 521 desc = "protocol error";
530 desc = "SCSI Residual Mismatch";
531 break; 522 break;
532 523 case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:
533 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */ 524 desc = "task terminated";
534 desc = "SCSI Task Management Failed";
535 break; 525 break;
536 526 case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
537 case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */ 527 desc = "residual mismatch";
538 desc = "SCSI IOC Terminated"; 528 break;
529 case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
530 desc = "task management failed";
531 break;
532 case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:
533 desc = "IOC terminated";
534 break;
535 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:
536 desc = "ext terminated";
539 break; 537 break;
538 default:
539 desc = "";
540 break;
541 }
542
543 switch (pScsiReply->SCSIStatus)
544 {
540 545
541 case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */ 546 case MPI_SCSI_STATUS_SUCCESS:
542 desc = "SCSI Ext Terminated"; 547 desc1 = "success";
548 break;
549 case MPI_SCSI_STATUS_CHECK_CONDITION:
550 desc1 = "check condition";
551 break;
552 case MPI_SCSI_STATUS_CONDITION_MET:
553 desc1 = "condition met";
554 break;
555 case MPI_SCSI_STATUS_BUSY:
556 desc1 = "busy";
557 break;
558 case MPI_SCSI_STATUS_INTERMEDIATE:
559 desc1 = "intermediate";
560 break;
561 case MPI_SCSI_STATUS_INTERMEDIATE_CONDMET:
562 desc1 = "intermediate condmet";
563 break;
564 case MPI_SCSI_STATUS_RESERVATION_CONFLICT:
565 desc1 = "reservation conflict";
566 break;
567 case MPI_SCSI_STATUS_COMMAND_TERMINATED:
568 desc1 = "command terminated";
569 break;
570 case MPI_SCSI_STATUS_TASK_SET_FULL:
571 desc1 = "task set full";
572 break;
573 case MPI_SCSI_STATUS_ACA_ACTIVE:
574 desc1 = "aca active";
575 break;
576 case MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT:
577 desc1 = "fcpext device logged out";
578 break;
579 case MPI_SCSI_STATUS_FCPEXT_NO_LINK:
580 desc1 = "fcpext no link";
581 break;
582 case MPI_SCSI_STATUS_FCPEXT_UNASSIGNED:
583 desc1 = "fcpext unassigned";
584 break;
585 default:
586 desc1 = "";
543 break; 587 break;
544 } 588 }
545 589
546 if (!desc) 590 scsi_print_command(sc);
547 return; 591 printk(KERN_DEBUG "\tfw_channel = %d, fw_id = %d\n",
592 pScsiReply->Bus, pScsiReply->TargetID);
593 printk(KERN_DEBUG "\trequest_len = %d, underflow = %d, resid = %d\n",
594 scsi_bufflen(sc), sc->underflow, scsi_get_resid(sc));
595 printk(KERN_DEBUG "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
596 le16_to_cpu(pScsiReply->TaskTag),
597 le32_to_cpu(pScsiReply->TransferCount), sc->result);
548 598
549 snprintf(extend_desc, EVENT_DESCR_STR_SZ, 599 printk(KERN_DEBUG "\tiocstatus = %s (0x%04x), "
550 "[%d:%d:%d:%d] cmd=%02Xh, sam_status=%02Xh state=%02Xh", 600 "scsi_status = %s (0x%02x), scsi_state = (0x%02x)\n",
551 sc->device->host->host_no, 601 desc, ioc_status,
552 sc->device->channel, sc->device->id, sc->device->lun, 602 desc1, pScsiReply->SCSIStatus,
553 sc->cmnd[0], scsi_status, scsi_state); 603 pScsiReply->SCSIState);
554 604
555 printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s: %s\n", 605 if (pScsiReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
556 ioc->name, ioc_status, desc, extend_desc); 606 skey = sc->sense_buffer[2] & 0x0F;
607 asc = sc->sense_buffer[12];
608 ascq = sc->sense_buffer[13];
609
610 printk(KERN_DEBUG "\t[sense_key,asc,ascq]: "
611 "[0x%02x,0x%02x,0x%02x]\n",
612 skey, asc, ascq);
613 }
614
615 /*
616 * Look for + dump FCP ResponseInfo[]!
617 */
618 if (pScsiReply->SCSIState & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
619 pScsiReply->ResponseInfo)
620 printk(KERN_DEBUG "response_info = %08xh\n",
621 le32_to_cpu(pScsiReply->ResponseInfo));
557} 622}
558#endif 623#endif
559 624
@@ -627,11 +692,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
627 pScsiReply = (SCSIIOReply_t *) mr; 692 pScsiReply = (SCSIIOReply_t *) mr;
628 693
629 if((ioc->facts.MsgVersion >= MPI_VERSION_01_05) && pScsiReply){ 694 if((ioc->facts.MsgVersion >= MPI_VERSION_01_05) && pScsiReply){
630 dmfprintk((MYIOC_s_INFO_FMT 695 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT
631 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d,task-tag=%d)\n", 696 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d,task-tag=%d)\n",
632 ioc->name, mf, mr, sc, req_idx, pScsiReply->TaskTag)); 697 ioc->name, mf, mr, sc, req_idx, pScsiReply->TaskTag));
633 }else{ 698 }else{
634 dmfprintk((MYIOC_s_INFO_FMT 699 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT
635 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d)\n", 700 "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d)\n",
636 ioc->name, mf, mr, sc, req_idx)); 701 ioc->name, mf, mr, sc, req_idx));
637 } 702 }
@@ -759,7 +824,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
759 sc->result=DID_SOFT_ERROR << 16; 824 sc->result=DID_SOFT_ERROR << 16;
760 else /* Sufficient data transfer occurred */ 825 else /* Sufficient data transfer occurred */
761 sc->result = (DID_OK << 16) | scsi_status; 826 sc->result = (DID_OK << 16) | scsi_status;
762 dreplyprintk((KERN_NOTICE 827 dreplyprintk(ioc, printk(KERN_DEBUG
763 "RESIDUAL_MISMATCH: result=%x on channel=%d id=%d\n", 828 "RESIDUAL_MISMATCH: result=%x on channel=%d id=%d\n",
764 sc->result, sc->device->channel, sc->device->id)); 829 sc->result, sc->device->channel, sc->device->id));
765 break; 830 break;
@@ -792,9 +857,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
792 } 857 }
793 } 858 }
794 859
795 dreplyprintk((KERN_NOTICE " sc->underflow={report ERR if < %02xh bytes xfer'd}\n", 860
861 dreplyprintk(ioc, printk(KERN_DEBUG " sc->underflow={report ERR if < %02xh bytes xfer'd}\n",
796 sc->underflow)); 862 sc->underflow));
797 dreplyprintk((KERN_NOTICE " ActBytesXferd=%02xh\n", xfer_cnt)); 863 dreplyprintk(ioc, printk(KERN_DEBUG " ActBytesXferd=%02xh\n", xfer_cnt));
864
798 /* Report Queue Full 865 /* Report Queue Full
799 */ 866 */
800 if (scsi_status == MPI_SCSI_STATUS_TASK_SET_FULL) 867 if (scsi_status == MPI_SCSI_STATUS_TASK_SET_FULL)
@@ -871,27 +938,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
871 938
872 } /* switch(status) */ 939 } /* switch(status) */
873 940
874#ifdef MPT_DEBUG_REPLY 941#ifdef CONFIG_FUSION_LOGGING
875 if (sc->result) { 942 if (sc->result && (ioc->debug_level & MPT_DEBUG_REPLY))
876 943 mptscsih_info_scsiio(ioc, sc, pScsiReply);
877 mptscsih_iocstatus_info_scsiio(ioc, status,
878 scsi_status, scsi_state, sc);
879
880 dreplyprintk(("%s: [%d:%d:%d:%d] cmd=0x%02x "
881 "result=0x%08x\n\tiocstatus=0x%04X "
882 "scsi_state=0x%02X scsi_status=0x%02X "
883 "loginfo=0x%08X\n", __FUNCTION__,
884 sc->device->host->host_no, sc->device->channel, sc->device->id,
885 sc->device->lun, sc->cmnd[0], sc->result, status,
886 scsi_state, scsi_status, log_info));
887
888 dreplyprintk(("%s: [%d:%d:%d:%d] resid=%d "
889 "bufflen=%d xfer_cnt=%d\n", __FUNCTION__,
890 sc->device->host->host_no,
891 sc->device->channel, sc->device->id,
892 sc->device->lun, scsi_get_resid(sc),
893 scsi_bufflen(sc), xfer_cnt));
894 }
895#endif 944#endif
896 945
897 } /* end of address reply case */ 946 } /* end of address reply case */
@@ -925,7 +974,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
925 int ii; 974 int ii;
926 int max = ioc->req_depth; 975 int max = ioc->req_depth;
927 976
928 dprintk((KERN_INFO MYNAM ": flush_ScsiLookup called\n")); 977 dprintk(ioc, printk(KERN_DEBUG MYNAM ": flush_ScsiLookup called\n"));
929 for (ii= 0; ii < max; ii++) { 978 for (ii= 0; ii < max; ii++) {
930 if ((SCpnt = hd->ScsiLookup[ii]) != NULL) { 979 if ((SCpnt = hd->ScsiLookup[ii]) != NULL) {
931 980
@@ -937,7 +986,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
937 hd->ScsiLookup[ii] = NULL; 986 hd->ScsiLookup[ii] = NULL;
938 987
939 mf = MPT_INDEX_2_MFPTR(ioc, ii); 988 mf = MPT_INDEX_2_MFPTR(ioc, ii);
940 dmfprintk(( "flush: ScsiDone (mf=%p,sc=%p)\n", 989 dmfprintk(ioc, printk(KERN_DEBUG MYNAM ": flush: ScsiDone (mf=%p,sc=%p)\n",
941 mf, SCpnt)); 990 mf, SCpnt));
942 991
943 /* Free Chain buffers */ 992 /* Free Chain buffers */
@@ -987,7 +1036,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
987 struct scsi_cmnd *sc; 1036 struct scsi_cmnd *sc;
988 struct scsi_lun lun; 1037 struct scsi_lun lun;
989 1038
990 dsprintk((KERN_INFO MYNAM ": search_running channel %d id %d lun %d max %d\n", 1039 dsprintk(hd->ioc, printk(KERN_DEBUG MYNAM ": search_running channel %d id %d lun %d max %d\n",
991 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max)); 1040 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max));
992 1041
993 for (ii=0; ii < max; ii++) { 1042 for (ii=0; ii < max; ii++) {
@@ -1020,9 +1069,9 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
1020 scsi_dma_unmap(sc); 1069 scsi_dma_unmap(sc);
1021 sc->host_scribble = NULL; 1070 sc->host_scribble = NULL;
1022 sc->result = DID_NO_CONNECT << 16; 1071 sc->result = DID_NO_CONNECT << 16;
1023 dsprintk(( "search_running: found (sc=%p, mf = %p) " 1072 sdev_printk(KERN_INFO, sc->device, "completing cmds: fw_channel %d,"
1024 "channel %d id %d, lun %d \n", sc, mf, 1073 "fw_id %d, sc=%p, mf = %p, idx=%x\n", vdevice->vtarget->channel,
1025 vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun)); 1074 vdevice->vtarget->id, sc, mf, ii);
1026 sc->scsi_done(sc); 1075 sc->scsi_done(sc);
1027 } 1076 }
1028 } 1077 }
@@ -1057,7 +1106,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI
1057 return; 1106 return;
1058 1107
1059 if (time - hd->last_queue_full > 10 * HZ) { 1108 if (time - hd->last_queue_full > 10 * HZ) {
1060 dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n", 1109 dprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
1061 hd->ioc->name, 0, sc->device->id, sc->device->lun)); 1110 hd->ioc->name, 0, sc->device->id, sc->device->lun));
1062 hd->last_queue_full = time; 1111 hd->last_queue_full = time;
1063 } 1112 }
@@ -1098,7 +1147,7 @@ mptscsih_remove(struct pci_dev *pdev)
1098 hd->ScsiLookup = NULL; 1147 hd->ScsiLookup = NULL;
1099 } 1148 }
1100 1149
1101 dprintk((MYIOC_s_INFO_FMT 1150 dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
1102 "Free'd ScsiLookup (%d) memory\n", 1151 "Free'd ScsiLookup (%d) memory\n",
1103 hd->ioc->name, sz1)); 1152 hd->ioc->name, sz1));
1104 1153
@@ -1317,17 +1366,19 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1317 u32 cmd_len; 1366 u32 cmd_len;
1318 int my_idx; 1367 int my_idx;
1319 int ii; 1368 int ii;
1369 MPT_ADAPTER *ioc;
1320 1370
1321 hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata; 1371 hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
1372 ioc = hd->ioc;
1322 lun = SCpnt->device->lun; 1373 lun = SCpnt->device->lun;
1323 SCpnt->scsi_done = done; 1374 SCpnt->scsi_done = done;
1324 1375
1325 dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n", 1376 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "qcmd: SCpnt=%p, done()=%p\n",
1326 (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done)); 1377 ioc->name, SCpnt, done));
1327 1378
1328 if (hd->resetPending) { 1379 if (hd->resetPending) {
1329 dtmprintk((MYIOC_s_WARN_FMT "qcmd: SCpnt=%p timeout + 60HZ\n", 1380 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "qcmd: SCpnt=%p timeout + 60HZ\n",
1330 (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt)); 1381 ioc->name, SCpnt));
1331 return SCSI_MLQUEUE_HOST_BUSY; 1382 return SCSI_MLQUEUE_HOST_BUSY;
1332 } 1383 }
1333 1384
@@ -1335,8 +1386,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1335 * Put together a MPT SCSI request... 1386 * Put together a MPT SCSI request...
1336 */ 1387 */
1337 if ((mf = mpt_get_msg_frame(hd->ioc->DoneCtx, hd->ioc)) == NULL) { 1388 if ((mf = mpt_get_msg_frame(hd->ioc->DoneCtx, hd->ioc)) == NULL) {
1338 dprintk((MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n", 1389 dprintk(ioc, printk(MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n",
1339 hd->ioc->name)); 1390 ioc->name));
1340 return SCSI_MLQUEUE_HOST_BUSY; 1391 return SCSI_MLQUEUE_HOST_BUSY;
1341 } 1392 }
1342 1393
@@ -1422,9 +1473,9 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
1422 hd->ScsiLookup[my_idx] = SCpnt; 1473 hd->ScsiLookup[my_idx] = SCpnt;
1423 1474
1424 mpt_put_msg_frame(hd->ioc->DoneCtx, hd->ioc, mf); 1475 mpt_put_msg_frame(hd->ioc->DoneCtx, hd->ioc, mf);
1425 dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n", 1476 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
1426 hd->ioc->name, SCpnt, mf, my_idx)); 1477 ioc->name, SCpnt, mf, my_idx));
1427 DBG_DUMP_REQUEST_FRAME(mf) 1478 DBG_DUMP_REQUEST_FRAME(ioc, (u32 *)mf)
1428 return 0; 1479 return 0;
1429 1480
1430 fail: 1481 fail:
@@ -1475,7 +1526,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
1475 list_add_tail(&chain->u.frame.linkage.list, &ioc->FreeChainQ); 1526 list_add_tail(&chain->u.frame.linkage.list, &ioc->FreeChainQ);
1476 spin_unlock_irqrestore(&ioc->FreeQlock, flags); 1527 spin_unlock_irqrestore(&ioc->FreeQlock, flags);
1477 1528
1478 dmfprintk((MYIOC_s_INFO_FMT "FreeChainBuffers (index %d)\n", 1529 dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FreeChainBuffers (index %d)\n",
1479 ioc->name, chain_idx)); 1530 ioc->name, chain_idx));
1480 1531
1481 /* handle next */ 1532 /* handle next */
@@ -1519,7 +1570,7 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
1519 unsigned long flags; 1570 unsigned long flags;
1520 1571
1521 ioc = hd->ioc; 1572 ioc = hd->ioc;
1522 dtmprintk((MYIOC_s_INFO_FMT "TMHandler Entered!\n", ioc->name)); 1573 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TMHandler Entered!\n", ioc->name));
1523 1574
1524 // SJR - CHECKME - Can we avoid this here? 1575 // SJR - CHECKME - Can we avoid this here?
1525 // (mpt_HardResetHandler has this check...) 1576 // (mpt_HardResetHandler has this check...)
@@ -1539,20 +1590,20 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
1539 */ 1590 */
1540 if (mptscsih_tm_pending_wait(hd) == FAILED) { 1591 if (mptscsih_tm_pending_wait(hd) == FAILED) {
1541 if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) { 1592 if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
1542 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler abort: " 1593 dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler abort: "
1543 "Timed out waiting for last TM (%d) to complete! \n", 1594 "Timed out waiting for last TM (%d) to complete! \n",
1544 hd->ioc->name, hd->tmPending)); 1595 ioc->name, hd->tmPending));
1545 return FAILED; 1596 return FAILED;
1546 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) { 1597 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) {
1547 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler target " 1598 dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler target "
1548 "reset: Timed out waiting for last TM (%d) " 1599 "reset: Timed out waiting for last TM (%d) "
1549 "to complete! \n", hd->ioc->name, 1600 "to complete! \n", ioc->name,
1550 hd->tmPending)); 1601 hd->tmPending));
1551 return FAILED; 1602 return FAILED;
1552 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) { 1603 } else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) {
1553 dtmprintk((KERN_INFO MYNAM ": %s: TMHandler bus reset: " 1604 dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler bus reset: "
1554 "Timed out waiting for last TM (%d) to complete! \n", 1605 "Timed out waiting for last TM (%d) to complete! \n",
1555 hd->ioc->name, hd->tmPending)); 1606 ioc->name, hd->tmPending));
1556 return FAILED; 1607 return FAILED;
1557 } 1608 }
1558 } else { 1609 } else {
@@ -1591,12 +1642,13 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
1591 ctx2abort, timeout); 1642 ctx2abort, timeout);
1592 if (rc) 1643 if (rc)
1593 printk(MYIOC_s_INFO_FMT "Issue of TaskMgmt failed!\n", 1644 printk(MYIOC_s_INFO_FMT "Issue of TaskMgmt failed!\n",
1594 hd->ioc->name); 1645 ioc->name);
1595 else 1646 else
1596 dtmprintk((MYIOC_s_INFO_FMT "Issue of TaskMgmt Successful!\n", 1647 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issue of TaskMgmt Successful!\n",
1597 hd->ioc->name)); 1648 ioc->name));
1598 1649
1599 dtmprintk((MYIOC_s_INFO_FMT "TMHandler rc = %d!\n", hd->ioc->name, rc)); 1650 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
1651 "TMHandler rc = %d!\n", ioc->name, rc));
1600 1652
1601 return rc; 1653 return rc;
1602} 1654}
@@ -1632,11 +1684,11 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
1632 /* Return Fail to calling function if no message frames available. 1684 /* Return Fail to calling function if no message frames available.
1633 */ 1685 */
1634 if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) { 1686 if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) {
1635 dfailprintk((MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n", 1687 dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
1636 hd->ioc->name)); 1688 hd->ioc->name));
1637 return FAILED; 1689 return FAILED;
1638 } 1690 }
1639 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n", 1691 dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
1640 hd->ioc->name, mf)); 1692 hd->ioc->name, mf));
1641 1693
1642 /* Format the Request 1694 /* Format the Request
@@ -1660,27 +1712,27 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
1660 1712
1661 pScsiTm->TaskMsgContext = ctx2abort; 1713 pScsiTm->TaskMsgContext = ctx2abort;
1662 1714
1663 dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt: ctx2abort (0x%08x) " 1715 dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) "
1664 "type=%d\n", hd->ioc->name, ctx2abort, type)); 1716 "type=%d\n", hd->ioc->name, ctx2abort, type));
1665 1717
1666 DBG_DUMP_TM_REQUEST_FRAME((u32 *)pScsiTm); 1718 DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm);
1667 1719
1668 if ((retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc, 1720 if ((retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc,
1669 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) { 1721 sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) {
1670 dfailprintk((MYIOC_s_ERR_FMT "send_handshake FAILED!" 1722 dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
1671 " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd, 1723 " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd,
1672 hd->ioc, mf, retval)); 1724 hd->ioc, mf, retval));
1673 goto fail_out; 1725 goto fail_out;
1674 } 1726 }
1675 1727
1676 if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) { 1728 if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) {
1677 dfailprintk((MYIOC_s_ERR_FMT "task management request TIMED OUT!" 1729 dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!"
1678 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd, 1730 " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
1679 hd->ioc, mf)); 1731 hd->ioc, mf));
1680 dtmprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n", 1732 dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
1681 hd->ioc->name)); 1733 hd->ioc->name));
1682 retval = mpt_HardResetHandler(hd->ioc, CAN_SLEEP); 1734 retval = mpt_HardResetHandler(hd->ioc, CAN_SLEEP);
1683 dtmprintk((MYIOC_s_INFO_FMT "rc=%d \n", 1735 dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n",
1684 hd->ioc->name, retval)); 1736 hd->ioc->name, retval));
1685 goto fail_out; 1737 goto fail_out;
1686 } 1738 }
@@ -1748,8 +1800,8 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1748 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) { 1800 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
1749 SCpnt->result = DID_RESET << 16; 1801 SCpnt->result = DID_RESET << 16;
1750 SCpnt->scsi_done(SCpnt); 1802 SCpnt->scsi_done(SCpnt);
1751 dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate " 1803 printk(KERN_DEBUG MYNAM ": mptscsih_abort: Can't locate "
1752 "host! (sc=%p)\n", SCpnt)); 1804 "host! (sc=%p)\n", SCpnt);
1753 return FAILED; 1805 return FAILED;
1754 } 1806 }
1755 1807
@@ -1760,7 +1812,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1760 1812
1761 vdevice = SCpnt->device->hostdata; 1813 vdevice = SCpnt->device->hostdata;
1762 if (!vdevice || !vdevice->vtarget) { 1814 if (!vdevice || !vdevice->vtarget) {
1763 dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been " 1815 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: device has been "
1764 "deleted (sc=%p)\n", ioc->name, SCpnt)); 1816 "deleted (sc=%p)\n", ioc->name, SCpnt));
1765 SCpnt->result = DID_NO_CONNECT << 16; 1817 SCpnt->result = DID_NO_CONNECT << 16;
1766 SCpnt->scsi_done(SCpnt); 1818 SCpnt->scsi_done(SCpnt);
@@ -1771,7 +1823,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1771 /* Task aborts are not supported for hidden raid components. 1823 /* Task aborts are not supported for hidden raid components.
1772 */ 1824 */
1773 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) { 1825 if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
1774 dtmprintk((MYIOC_s_DEBUG_FMT "task abort: hidden raid " 1826 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: hidden raid "
1775 "component (sc=%p)\n", ioc->name, SCpnt)); 1827 "component (sc=%p)\n", ioc->name, SCpnt));
1776 SCpnt->result = DID_RESET << 16; 1828 SCpnt->result = DID_RESET << 16;
1777 retval = FAILED; 1829 retval = FAILED;
@@ -1785,7 +1837,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
1785 * Do OS callback. 1837 * Do OS callback.
1786 */ 1838 */
1787 SCpnt->result = DID_RESET << 16; 1839 SCpnt->result = DID_RESET << 16;
1788 dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: " 1840 dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: mptscsih_abort: "
1789 "Command not in the active list! (sc=%p)\n", ioc->name, 1841 "Command not in the active list! (sc=%p)\n", ioc->name,
1790 SCpnt)); 1842 SCpnt));
1791 retval = 0; 1843 retval = 0;
@@ -1850,8 +1902,8 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
1850 /* If we can't locate our host adapter structure, return FAILED status. 1902 /* If we can't locate our host adapter structure, return FAILED status.
1851 */ 1903 */
1852 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1904 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1853 dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't " 1905 printk(KERN_DEBUG MYNAM ": mptscsih_dev_reset: Can't "
1854 "locate host! (sc=%p)\n", SCpnt)); 1906 "locate host! (sc=%p)\n", SCpnt);
1855 return FAILED; 1907 return FAILED;
1856 } 1908 }
1857 1909
@@ -1913,8 +1965,8 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
1913 /* If we can't locate our host adapter structure, return FAILED status. 1965 /* If we can't locate our host adapter structure, return FAILED status.
1914 */ 1966 */
1915 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 1967 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1916 dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't " 1968 printk(KERN_DEBUG MYNAM ": mptscsih_bus_reset: Can't "
1917 "locate host! (sc=%p)\n", SCpnt )); 1969 "locate host! (sc=%p)\n", SCpnt );
1918 return FAILED; 1970 return FAILED;
1919 } 1971 }
1920 1972
@@ -1957,8 +2009,8 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
1957 2009
1958 /* If we can't locate the host to reset, then we failed. */ 2010 /* If we can't locate the host to reset, then we failed. */
1959 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){ 2011 if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
1960 dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't " 2012 printk( KERN_DEBUG MYNAM ": mptscsih_host_reset: Can't "
1961 "locate host! (sc=%p)\n", SCpnt)); 2013 "locate host! (sc=%p)\n", SCpnt);
1962 return FAILED; 2014 return FAILED;
1963 } 2015 }
1964 2016
@@ -2106,16 +2158,16 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m
2106 u8 tmType; 2158 u8 tmType;
2107 u32 termination_count; 2159 u32 termination_count;
2108 2160
2109 dtmprintk((MYIOC_s_WARN_FMT "TaskMgmt completed (mf=%p,mr=%p)\n", 2161 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p,mr=%p)\n",
2110 ioc->name, mf, mr)); 2162 ioc->name, mf, mr));
2111 if (!ioc->sh) { 2163 if (!ioc->sh) {
2112 dtmprintk((MYIOC_s_WARN_FMT 2164 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
2113 "TaskMgmt Complete: NULL Scsi Host Ptr\n", ioc->name)); 2165 "TaskMgmt Complete: NULL Scsi Host Ptr\n", ioc->name));
2114 return 1; 2166 return 1;
2115 } 2167 }
2116 2168
2117 if (mr == NULL) { 2169 if (mr == NULL) {
2118 dtmprintk((MYIOC_s_WARN_FMT 2170 dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
2119 "ERROR! TaskMgmt Reply: NULL Request %p\n", ioc->name, mf)); 2171 "ERROR! TaskMgmt Reply: NULL Request %p\n", ioc->name, mf));
2120 return 1; 2172 return 1;
2121 } 2173 }
@@ -2131,19 +2183,21 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m
2131 pScsiTmReply->ResponseCode) 2183 pScsiTmReply->ResponseCode)
2132 mptscsih_taskmgmt_response_code(ioc, 2184 mptscsih_taskmgmt_response_code(ioc,
2133 pScsiTmReply->ResponseCode); 2185 pScsiTmReply->ResponseCode);
2134 DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply); 2186 DBG_DUMP_TM_REPLY_FRAME(ioc, (u32 *)pScsiTmReply);
2135 2187
2136#if defined(MPT_DEBUG_REPLY) || defined(MPT_DEBUG_TM) 2188#ifdef CONFIG_FUSION_LOGGING
2137 printk("%s: ha=%d [%d:%d:0] task_type=0x%02X " 2189 if ((ioc->debug_level & MPT_DEBUG_REPLY) ||
2138 "iocstatus=0x%04X\n\tloginfo=0x%08X response_code=0x%02X " 2190 (ioc->debug_level & MPT_DEBUG_TM ))
2139 "term_cmnds=%d\n", __FUNCTION__, ioc->id, pScsiTmReply->Bus, 2191 printk("%s: ha=%d [%d:%d:0] task_type=0x%02X "
2140 pScsiTmReply->TargetID, pScsiTmReq->TaskType, 2192 "iocstatus=0x%04X\n\tloginfo=0x%08X response_code=0x%02X "
2141 le16_to_cpu(pScsiTmReply->IOCStatus), 2193 "term_cmnds=%d\n", __FUNCTION__, ioc->id, pScsiTmReply->Bus,
2142 le32_to_cpu(pScsiTmReply->IOCLogInfo),pScsiTmReply->ResponseCode, 2194 pScsiTmReply->TargetID, pScsiTmReq->TaskType,
2143 le32_to_cpu(pScsiTmReply->TerminationCount)); 2195 le16_to_cpu(pScsiTmReply->IOCStatus),
2196 le32_to_cpu(pScsiTmReply->IOCLogInfo),pScsiTmReply->ResponseCode,
2197 le32_to_cpu(pScsiTmReply->TerminationCount));
2144#endif 2198#endif
2145 if (!iocstatus) { 2199 if (!iocstatus) {
2146 dtmprintk((MYIOC_s_WARN_FMT " TaskMgmt SUCCESS\n", ioc->name)); 2200 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT " TaskMgmt SUCCESS\n", ioc->name));
2147 hd->abortSCpnt = NULL; 2201 hd->abortSCpnt = NULL;
2148 goto out; 2202 goto out;
2149 } 2203 }
@@ -2224,10 +2278,6 @@ mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev,
2224 geom[1] = sectors; 2278 geom[1] = sectors;
2225 geom[2] = cylinders; 2279 geom[2] = cylinders;
2226 2280
2227 dprintk((KERN_NOTICE
2228 ": bios_param: Id=%i Lun=%i Channel=%i CHS=%i/%i/%i\n",
2229 sdev->id, sdev->lun, sdev->channel, (int)cylinders, heads, sectors));
2230
2231 return 0; 2281 return 0;
2232} 2282}
2233 2283
@@ -2393,11 +2443,11 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2393 vtarget = starget->hostdata; 2443 vtarget = starget->hostdata;
2394 vdevice = sdev->hostdata; 2444 vdevice = sdev->hostdata;
2395 2445
2396 dsprintk((MYIOC_s_INFO_FMT 2446 dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
2397 "device @ %p, channel=%d, id=%d, lun=%d\n", 2447 "device @ %p, channel=%d, id=%d, lun=%d\n",
2398 hd->ioc->name, sdev, sdev->channel, sdev->id, sdev->lun)); 2448 hd->ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
2399 if (hd->ioc->bus_type == SPI) 2449 if (hd->ioc->bus_type == SPI)
2400 dsprintk((MYIOC_s_INFO_FMT 2450 dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
2401 "sdtr %d wdtr %d ppr %d inq length=%d\n", 2451 "sdtr %d wdtr %d ppr %d inq length=%d\n",
2402 hd->ioc->name, sdev->sdtr, sdev->wdtr, 2452 hd->ioc->name, sdev->sdtr, sdev->wdtr,
2403 sdev->ppr, sdev->inquiry_len)); 2453 sdev->ppr, sdev->inquiry_len));
@@ -2411,19 +2461,19 @@ mptscsih_slave_configure(struct scsi_device *sdev)
2411 vdevice->configured_lun = 1; 2461 vdevice->configured_lun = 1;
2412 mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH); 2462 mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
2413 2463
2414 dsprintk((MYIOC_s_INFO_FMT 2464 dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
2415 "Queue depth=%d, tflags=%x\n", 2465 "Queue depth=%d, tflags=%x\n",
2416 hd->ioc->name, sdev->queue_depth, vtarget->tflags)); 2466 hd->ioc->name, sdev->queue_depth, vtarget->tflags));
2417 2467
2418 if (hd->ioc->bus_type == SPI) 2468 if (hd->ioc->bus_type == SPI)
2419 dsprintk((MYIOC_s_INFO_FMT 2469 dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
2420 "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n", 2470 "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n",
2421 hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset, 2471 hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset,
2422 vtarget->minSyncFactor)); 2472 vtarget->minSyncFactor));
2423 2473
2424slave_configure_exit: 2474slave_configure_exit:
2425 2475
2426 dsprintk((MYIOC_s_INFO_FMT 2476 dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
2427 "tagged %d, simple %d, ordered %d\n", 2477 "tagged %d, simple %d, ordered %d\n",
2428 hd->ioc->name,sdev->tagged_supported, sdev->simple_tags, 2478 hd->ioc->name,sdev->tagged_supported, sdev->simple_tags,
2429 sdev->ordered_tags)); 2479 sdev->ordered_tags));
@@ -2490,7 +2540,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
2490 } 2540 }
2491 } 2541 }
2492 } else { 2542 } else {
2493 dprintk((MYIOC_s_INFO_FMT "Hmmm... SenseData len=0! (?)\n", 2543 dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n",
2494 hd->ioc->name)); 2544 hd->ioc->name));
2495 } 2545 }
2496} 2546}
@@ -2520,7 +2570,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2520 unsigned long flags; 2570 unsigned long flags;
2521 int ii; 2571 int ii;
2522 2572
2523 dtmprintk((KERN_WARNING MYNAM 2573 dtmprintk(ioc, printk(KERN_DEBUG MYNAM
2524 ": IOC %s_reset routed to SCSI host driver!\n", 2574 ": IOC %s_reset routed to SCSI host driver!\n",
2525 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : ( 2575 reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
2526 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post"))); 2576 reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
@@ -2535,7 +2585,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2535 hd = (MPT_SCSI_HOST *) ioc->sh->hostdata; 2585 hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
2536 2586
2537 if (reset_phase == MPT_IOC_SETUP_RESET) { 2587 if (reset_phase == MPT_IOC_SETUP_RESET) {
2538 dtmprintk((MYIOC_s_WARN_FMT "Setup-Diag Reset\n", ioc->name)); 2588 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Setup-Diag Reset\n", ioc->name));
2539 2589
2540 /* Clean Up: 2590 /* Clean Up:
2541 * 1. Set Hard Reset Pending Flag 2591 * 1. Set Hard Reset Pending Flag
@@ -2544,7 +2594,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2544 hd->resetPending = 1; 2594 hd->resetPending = 1;
2545 2595
2546 } else if (reset_phase == MPT_IOC_PRE_RESET) { 2596 } else if (reset_phase == MPT_IOC_PRE_RESET) {
2547 dtmprintk((MYIOC_s_WARN_FMT "Pre-Diag Reset\n", ioc->name)); 2597 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Pre-Diag Reset\n", ioc->name));
2548 2598
2549 /* 2. Flush running commands 2599 /* 2. Flush running commands
2550 * Clean ScsiLookup (and associated memory) 2600 * Clean ScsiLookup (and associated memory)
@@ -2564,10 +2614,10 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2564 mpt_free_msg_frame(ioc, hd->cmdPtr); 2614 mpt_free_msg_frame(ioc, hd->cmdPtr);
2565 } 2615 }
2566 2616
2567 dtmprintk((MYIOC_s_WARN_FMT "Pre-Reset complete.\n", ioc->name)); 2617 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Pre-Reset complete.\n", ioc->name));
2568 2618
2569 } else { 2619 } else {
2570 dtmprintk((MYIOC_s_WARN_FMT "Post-Diag Reset\n", ioc->name)); 2620 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Post-Diag Reset\n", ioc->name));
2571 2621
2572 /* Once a FW reload begins, all new OS commands are 2622 /* Once a FW reload begins, all new OS commands are
2573 * redirected to the doneQ w/ a reset status. 2623 * redirected to the doneQ w/ a reset status.
@@ -2607,7 +2657,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
2607 hd->cmdPtr = NULL; 2657 hd->cmdPtr = NULL;
2608 } 2658 }
2609 2659
2610 dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name)); 2660 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Post-Reset complete.\n", ioc->name));
2611 2661
2612 } 2662 }
2613 2663
@@ -2621,7 +2671,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2621 MPT_SCSI_HOST *hd; 2671 MPT_SCSI_HOST *hd;
2622 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF; 2672 u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
2623 2673
2624 devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n", 2674 devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
2625 ioc->name, event)); 2675 ioc->name, event));
2626 2676
2627 if (ioc->sh == NULL || 2677 if (ioc->sh == NULL ||
@@ -2663,7 +2713,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
2663 case MPI_EVENT_STATE_CHANGE: /* 02 */ 2713 case MPI_EVENT_STATE_CHANGE: /* 02 */
2664 case MPI_EVENT_EVENT_CHANGE: /* 0A */ 2714 case MPI_EVENT_EVENT_CHANGE: /* 0A */
2665 default: 2715 default:
2666 dprintk((KERN_INFO " Ignoring event (=%02Xh)\n", event)); 2716 dprintk(ioc, printk(KERN_DEBUG MYNAM ": Ignoring event (=%02Xh)\n", event));
2667 break; 2717 break;
2668 } 2718 }
2669 2719
@@ -2724,7 +2774,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
2724 } 2774 }
2725 hd->cmdPtr = NULL; 2775 hd->cmdPtr = NULL;
2726 2776
2727 ddvprintk((MYIOC_s_INFO_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n", 2777 ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n",
2728 hd->ioc->name, mf, mr, req_idx)); 2778 hd->ioc->name, mf, mr, req_idx));
2729 2779
2730 hd->pLocal = &hd->localReply; 2780 hd->pLocal = &hd->localReply;
@@ -2744,9 +2794,6 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
2744 status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK; 2794 status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK;
2745 scsi_status = pReply->SCSIStatus; 2795 scsi_status = pReply->SCSIStatus;
2746 2796
2747 ddvtprintk((KERN_NOTICE " IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh, IOCLogInfo=%08xh\n",
2748 status, pReply->SCSIState, scsi_status,
2749 le32_to_cpu(pReply->IOCLogInfo)));
2750 2797
2751 switch(status) { 2798 switch(status) {
2752 2799
@@ -2799,7 +2846,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
2799 SCSI_STD_SENSE_BYTES); 2846 SCSI_STD_SENSE_BYTES);
2800 memcpy(hd->pLocal->sense, sense_data, sz); 2847 memcpy(hd->pLocal->sense, sense_data, sz);
2801 2848
2802 ddvprintk((KERN_NOTICE " Check Condition, sense ptr %p\n", 2849 ddvprintk(ioc, printk(KERN_DEBUG " Check Condition, sense ptr %p\n",
2803 sense_data)); 2850 sense_data));
2804 } else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) { 2851 } else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) {
2805 if (pReq->CDB[0] == INQUIRY) 2852 if (pReq->CDB[0] == INQUIRY)
@@ -2830,8 +2877,6 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
2830 2877
2831 } /* switch(status) */ 2878 } /* switch(status) */
2832 2879
2833 ddvtprintk((KERN_NOTICE " completionCode set to %08xh\n",
2834 completionCode));
2835 } /* end of address reply case */ 2880 } /* end of address reply case */
2836 2881
2837 hd->pLocal->completion = completionCode; 2882 hd->pLocal->completion = completionCode;
@@ -2862,7 +2907,7 @@ mptscsih_timer_expired(unsigned long data)
2862{ 2907{
2863 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data; 2908 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data;
2864 2909
2865 ddvprintk((MYIOC_s_WARN_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr)); 2910 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
2866 2911
2867 if (hd->cmdPtr) { 2912 if (hd->cmdPtr) {
2868 MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr; 2913 MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr;
@@ -2874,7 +2919,6 @@ mptscsih_timer_expired(unsigned long data)
2874 * If new eh code, do nothing. Wait for OS cmd timeout 2919 * If new eh code, do nothing. Wait for OS cmd timeout
2875 * for bus reset. 2920 * for bus reset.
2876 */ 2921 */
2877 ddvtprintk((MYIOC_s_NOTE_FMT "DV Cmd Timeout: NoOp\n", hd->ioc->name));
2878 } else { 2922 } else {
2879 /* Perform a FW reload */ 2923 /* Perform a FW reload */
2880 if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) { 2924 if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
@@ -2891,7 +2935,7 @@ mptscsih_timer_expired(unsigned long data)
2891 * The FW will reply to all outstanding commands, callback will finish cleanup. 2935 * The FW will reply to all outstanding commands, callback will finish cleanup.
2892 * Hard reset clean-up will free all resources. 2936 * Hard reset clean-up will free all resources.
2893 */ 2937 */
2894 ddvprintk((MYIOC_s_WARN_FMT "Timer Expired Complete!\n", hd->ioc->name)); 2938 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", hd->ioc->name));
2895 2939
2896 return; 2940 return;
2897} 2941}
@@ -2932,7 +2976,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
2932 2976
2933 in_isr = in_interrupt(); 2977 in_isr = in_interrupt();
2934 if (in_isr) { 2978 if (in_isr) {
2935 dprintk((MYIOC_s_WARN_FMT "Internal SCSI IO request not allowed in ISR context!\n", 2979 dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n",
2936 hd->ioc->name)); 2980 hd->ioc->name));
2937 return -EPERM; 2981 return -EPERM;
2938 } 2982 }
@@ -3035,7 +3079,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
3035 /* Get and Populate a free Frame 3079 /* Get and Populate a free Frame
3036 */ 3080 */
3037 if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) { 3081 if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
3038 ddvprintk((MYIOC_s_WARN_FMT "No msg frames!\n", 3082 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "No msg frames!\n",
3039 hd->ioc->name)); 3083 hd->ioc->name));
3040 return -EBUSY; 3084 return -EBUSY;
3041 } 3085 }
@@ -3075,7 +3119,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
3075 3119
3076 if (cmd == REQUEST_SENSE) { 3120 if (cmd == REQUEST_SENSE) {
3077 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED); 3121 pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED);
3078 ddvprintk((MYIOC_s_INFO_FMT "Untagged! 0x%2x\n", 3122 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n",
3079 hd->ioc->name, cmd)); 3123 hd->ioc->name, cmd));
3080 } 3124 }
3081 3125
@@ -3086,7 +3130,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
3086 pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma 3130 pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma
3087 + (my_idx * MPT_SENSE_BUFFER_ALLOC)); 3131 + (my_idx * MPT_SENSE_BUFFER_ALLOC));
3088 3132
3089 ddvprintk((MYIOC_s_INFO_FMT "Sending Command 0x%x for (%d:%d:%d)\n", 3133 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n",
3090 hd->ioc->name, cmd, io->channel, io->id, io->lun)); 3134 hd->ioc->name, cmd, io->channel, io->id, io->lun));
3091 3135
3092 if (dir == MPI_SCSIIO_CONTROL_READ) { 3136 if (dir == MPI_SCSIIO_CONTROL_READ) {
@@ -3138,7 +3182,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
3138 } else { 3182 } else {
3139 rc = -EFAULT; 3183 rc = -EFAULT;
3140 /* This should never happen. */ 3184 /* This should never happen. */
3141 ddvprintk((MYIOC_s_INFO_FMT "_do_cmd: Null pLocal!!!\n", 3185 ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n",
3142 hd->ioc->name)); 3186 hd->ioc->name));
3143 } 3187 }
3144 3188
@@ -3324,6 +3368,35 @@ mptscsih_device_delay_show(struct class_device *cdev, char *buf)
3324static CLASS_DEVICE_ATTR(device_delay, S_IRUGO, 3368static CLASS_DEVICE_ATTR(device_delay, S_IRUGO,
3325 mptscsih_device_delay_show, NULL); 3369 mptscsih_device_delay_show, NULL);
3326 3370
3371static ssize_t
3372mptscsih_debug_level_show(struct class_device *cdev, char *buf)
3373{
3374 struct Scsi_Host *host = class_to_shost(cdev);
3375 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3376 MPT_ADAPTER *ioc = hd->ioc;
3377
3378 return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level);
3379}
3380static ssize_t
3381mptscsih_debug_level_store(struct class_device *cdev, const char *buf,
3382 size_t count)
3383{
3384 struct Scsi_Host *host = class_to_shost(cdev);
3385 MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *)host->hostdata;
3386 MPT_ADAPTER *ioc = hd->ioc;
3387 int val = 0;
3388
3389 if (sscanf(buf, "%x", &val) != 1)
3390 return -EINVAL;
3391
3392 ioc->debug_level = val;
3393 printk(MYIOC_s_INFO_FMT "debug_level=%08xh\n",
3394 ioc->name, ioc->debug_level);
3395 return strlen(buf);
3396}
3397static CLASS_DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR,
3398 mptscsih_debug_level_show, mptscsih_debug_level_store);
3399
3327struct class_device_attribute *mptscsih_host_attrs[] = { 3400struct class_device_attribute *mptscsih_host_attrs[] = {
3328 &class_device_attr_version_fw, 3401 &class_device_attr_version_fw,
3329 &class_device_attr_version_bios, 3402 &class_device_attr_version_bios,
@@ -3336,6 +3409,7 @@ struct class_device_attribute *mptscsih_host_attrs[] = {
3336 &class_device_attr_board_tracer, 3409 &class_device_attr_board_tracer,
3337 &class_device_attr_io_delay, 3410 &class_device_attr_io_delay,
3338 &class_device_attr_device_delay, 3411 &class_device_attr_device_delay,
3412 &class_device_attr_debug_level,
3339 NULL, 3413 NULL,
3340}; 3414};
3341EXPORT_SYMBOL(mptscsih_host_attrs); 3415EXPORT_SYMBOL(mptscsih_host_attrs);
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);