aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/message')
-rw-r--r--drivers/message/fusion/mptctl.c266
1 files changed, 141 insertions, 125 deletions
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