aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
authorPrakash, Sathya <sathya.prakash@lsi.com>2007-07-25 01:44:01 -0400
committerJames Bottomley <jejb@mulgrave.localdomain>2007-07-28 11:30:27 -0400
commit6757d6b4c0701866bbf2ac02c397f78879b75e58 (patch)
tree0355ed46fdda509b40a0837cbfdb5604396abaa2 /drivers/message
parent436ace725f35eb9af16b1986e3e9d776d384b7db (diff)
[SCSI] mpt fusion: Changes in mptscsih.c for logging support
This patch contains changes in mptscsih.c to support logging in MPT fusion drivers. The changes are majorly in debug printks, the existing debugprintk are modified accroding to new debug macros defined in the file mptbdebug.h A new sysfs attribute is added to retrieve and modify the debug level. signed-off-by: Sathya Prakash <sathya.prakash@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptscsih.c446
1 files changed, 260 insertions, 186 deletions
diff --git a/drivers/message/fusion/mptscsih.c b/drivers/message/fusion/mptscsih.c
index fd3aa2619f4..5431529741a 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);