]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/message/fusion/mptctl.c
V4L/DVB (8066): cx18: Fix audio mux input definitions for HVR-1600 Line In 2 and...
[linux-2.6-omap-h63xx.git] / drivers / message / fusion / mptctl.c
index 58e6c319cc76244db9aab6b6a79eb57e0afaed81..e630b50966ec5ba0192a36acb9e22a328e9b5675 100644 (file)
@@ -1,10 +1,10 @@
 /*
  *  linux/drivers/message/fusion/mptctl.c
  *      mpt Ioctl driver.
- *      For use with LSI Logic PCI chip/adapters
- *      running LSI Logic Fusion MPT (Message Passing Technology) firmware.
+ *      For use with LSI PCI chip/adapters
+ *      running LSI Fusion MPT (Message Passing Technology) firmware.
  *
- *  Copyright (c) 1999-2007 LSI Logic Corporation
+ *  Copyright (c) 1999-2007 LSI Corporation
  *  (mailto:DL-MPTFusionLinux@lsi.com)
  *
  */
@@ -66,8 +66,8 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_tcq.h>
 
-#define COPYRIGHT      "Copyright (c) 1999-2007 LSI Logic Corporation"
-#define MODULEAUTHOR   "LSI Logic Corporation"
+#define COPYRIGHT      "Copyright (c) 1999-2007 LSI Corporation"
+#define MODULEAUTHOR   "LSI Corporation"
 #include "mptbase.h"
 #include "mptctl.h"
 
@@ -83,7 +83,7 @@ MODULE_VERSION(my_VERSION);
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
-static int mptctl_id = -1;
+static u8 mptctl_id = MPT_MAX_PROTOCOL_DRIVERS;
 
 static DECLARE_WAIT_QUEUE_HEAD ( mptctl_wait );
 
@@ -181,7 +181,6 @@ static inline int
 mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
 {
        int rc = 0;
-       dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
 
        if (nonblock) {
                if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
@@ -190,7 +189,6 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
                if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
                        rc = -ERESTARTSYS;
        }
-       dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc));
        return rc;
 }
 
@@ -209,18 +207,19 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
        u16 iocStatus;
        u8 cmd;
 
-       dctlprintk(("mptctl_reply()!\n"));
        if (req)
                 cmd = req->u.hdr.Function;
        else
                return 1;
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tcompleting mpi function (0x%02X), req=%p, "
+           "reply=%p\n", ioc->name,  req->u.hdr.Function, req, reply));
 
        if (ioc->ioctl) {
 
                if (reply==NULL) {
 
-                       dctlprintk(("mptctl_reply() NULL Reply "
-                               "Function=%x!\n", cmd));
+                       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_reply() NULL Reply "
+                               "Function=%x!\n", ioc->name, cmd));
 
                        ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
                        ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
@@ -233,14 +232,9 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
 
                }
 
-               dctlprintk(("mptctl_reply() with req=%p "
-                       "reply=%p Function=%x!\n", req, reply, cmd));
-
                /* Copy the reply frame (which much exist
                 * for non-SCSI I/O) to the IOC structure.
                 */
-               dctlprintk(("Copying Reply Frame @%p to ioc%d!\n",
-                       reply, ioc->id));
                memcpy(ioc->ioctl->ReplyFrame, reply,
                        min(ioc->reply_sz, 4*reply->u.reply.MsgLength));
                ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID;
@@ -252,8 +246,24 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
                if (iocStatus  == MPI_IOCSTATUS_SUCCESS)
                        ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
 
+               if (iocStatus || reply->u.reply.IOCLogInfo)
+                       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tiocstatus (0x%04X), "
+                               "loginfo (0x%08X)\n", ioc->name,
+                               iocStatus,
+                               le32_to_cpu(reply->u.reply.IOCLogInfo)));
+
                if ((cmd == MPI_FUNCTION_SCSI_IO_REQUEST) ||
                        (cmd == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
+
+                       if (reply->u.sreply.SCSIStatus || reply->u.sreply.SCSIState)
+                               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "\tscsi_status (0x%02x), scsi_state (0x%02x), "
+                                       "tag = (0x%04x), transfer_count (0x%08x)\n", ioc->name,
+                                       reply->u.sreply.SCSIStatus,
+                                       reply->u.sreply.SCSIState,
+                                       le16_to_cpu(reply->u.sreply.TaskTag),
+                                       le32_to_cpu(reply->u.sreply.TransferCount)));
+
                        ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
 
                        if ((iocStatus == MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) ||
@@ -298,8 +308,8 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
 {
        int rc = 1;
 
-       dctlprintk((KERN_NOTICE MYNAM ": Timeout Expired! Host %d\n",
-                               ioctl->ioc->id));
+       dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT ": Timeout Expired! Host %d\n",
+                               ioctl->ioc->name, ioctl->ioc->id));
        if (ioctl == NULL)
                return;
 
@@ -311,7 +321,7 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
                /* Issue a reset for this device.
                 * The IOC is not responding.
                 */
-               dctlprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n",
+               dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
                         ioctl->ioc->name));
                mpt_HardResetHandler(ioctl->ioc, CAN_SLEEP);
        }
@@ -330,7 +340,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
        SCSITaskMgmt_t  *pScsiTm;
        MPT_SCSI_HOST   *hd;
        int              ii;
-       int              retval;
+       int              retval=0;
 
 
        ioctl->reset &= ~MPTCTL_RESET_OK;
@@ -338,7 +348,7 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
        if (ioctl->ioc->sh == NULL)
                return -EPERM;
 
-       hd = (MPT_SCSI_HOST *) ioctl->ioc->sh->hostdata;
+       hd = shost_priv(ioctl->ioc->sh);
        if (hd == NULL)
                return -EPERM;
 
@@ -350,14 +360,14 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
        /* Send request
         */
        if ((mf = mpt_get_msg_frame(mptctl_id, ioctl->ioc)) == NULL) {
-               dctlprintk((MYIOC_s_WARN_FMT "IssueTaskMgmt, no msg frames!!\n",
+               dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt, no msg frames!!\n",
                                ioctl->ioc->name));
 
                mptctl_free_tm_flags(ioctl->ioc);
                return -ENOMEM;
        }
 
-       dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n",
+       dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
                        ioctl->ioc->name, mf));
 
        pScsiTm = (SCSITaskMgmt_t *) mf;
@@ -377,18 +387,25 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
                pScsiTm->Reserved2[ii] = 0;
 
        pScsiTm->TaskMsgContext = 0;
-       dtmprintk((MYIOC_s_INFO_FMT
+       dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT
                "mptctl_bus_reset: issued.\n", ioctl->ioc->name));
 
-       DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf);
+       DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf);
 
        ioctl->wait_done=0;
-       if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
-            sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) {
-               dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!"
-                       " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
-                       hd->ioc, mf));
-               goto mptctl_bus_reset_done;
+
+       if ((ioctl->ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
+           (ioctl->ioc->facts.MsgVersion >= MPI_VERSION_01_05))
+               mpt_put_msg_frame_hi_pri(mptctl_id, ioctl->ioc, mf);
+       else {
+               retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
+                       sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP);
+               if (retval != 0) {
+                       dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
+                               " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
+                               hd->ioc, mf));
+                       goto mptctl_bus_reset_done;
+               }
        }
 
        /* Now wait for the command to complete */
@@ -432,7 +449,7 @@ mptctl_free_tm_flags(MPT_ADAPTER *ioc)
        MPT_SCSI_HOST * hd;
        unsigned long flags;
 
-       hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
+       hd = shost_priv(ioc->sh);
        if (hd == NULL)
                return;
 
@@ -456,7 +473,7 @@ static int
 mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 {
        MPT_IOCTL *ioctl = ioc->ioctl;
-       dctlprintk((KERN_INFO MYNAM ": IOC %s_reset routed to IOCTL driver!\n",
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOC %s_reset routed to IOCTL driver!\n", ioc->name,
                reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
                reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
 
@@ -487,7 +504,8 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
 
        event = le32_to_cpu(pEvReply->Event) & 0xFF;
 
-       dctlprintk(("%s() called\n", __FUNCTION__));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s() called\n",
+           ioc->name, __FUNCTION__));
        if(async_queue == NULL)
                return 1;
 
@@ -497,8 +515,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
         */
         if (event == 0x21 ) {
                ioc->aen_event_read_flag=1;
-               dctlprintk(("Raised SIGIO to application\n"));
-               devtverboseprintk(("Raised SIGIO to application\n"));
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Raised SIGIO to application\n",
+                   ioc->name));
+               devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
                kill_fasync(&async_queue, SIGIO, POLL_IN);
                return 1;
         }
@@ -515,8 +535,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
         */
        if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
                ioc->aen_event_read_flag=1;
-               dctlprintk(("Raised SIGIO to application\n"));
-               devtverboseprintk(("Raised SIGIO to application\n"));
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
+               devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
                kill_fasync(&async_queue, SIGIO, POLL_IN);
        }
        return 1;
@@ -530,14 +552,12 @@ mptctl_fasync(int fd, struct file *filep, int mode)
        list_for_each_entry(ioc, &ioc_list, list)
                ioc->aen_event_read_flag=0;
 
-       dctlprintk(("%s() called\n", __FUNCTION__));
        return fasync_helper(fd, filep, mode, &async_queue);
 }
 
 static int
 mptctl_release(struct inode *inode, struct file *filep)
 {
-       dctlprintk(("%s() called\n", __FUNCTION__));
        return fasync_helper(-1, filep, 0, &async_queue);
 }
 
@@ -558,10 +578,8 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        int ret;
        MPT_ADAPTER *iocp = NULL;
 
-       dctlprintk(("mptctl_ioctl() called\n"));
-
        if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
-               printk(KERN_ERR "%s::mptctl_ioctl() @%d - "
+               printk(KERN_ERR MYNAM "%s::mptctl_ioctl() @%d - "
                                "Unable to copy mpt_ioctl_header data @ %p\n",
                                __FILE__, __LINE__, uhdr);
                return -EFAULT;
@@ -574,13 +592,13 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        iocnumX = khdr.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnumX));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if (!iocp->active) {
-               printk(KERN_ERR "%s::mptctl_ioctl() @%d - Controller disabled.\n",
+               printk(KERN_DEBUG MYNAM "%s::mptctl_ioctl() @%d - Controller disabled.\n",
                                __FILE__, __LINE__);
                return -EFAULT;
        }
@@ -612,8 +630,6 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
-       dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
-
        if (cmd == MPTFWDOWNLOAD)
                ret = mptctl_fw_download(arg);
        else if (cmd == MPTCOMMAND)
@@ -648,24 +664,25 @@ static int mptctl_do_reset(unsigned long arg)
        struct mpt_ioctl_diag_reset krinfo;
        MPT_ADAPTER             *iocp;
 
-       dctlprintk((KERN_INFO "mptctl_do_reset called.\n"));
-
        if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
-               printk(KERN_ERR "%s@%d::mptctl_do_reset - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_do_reset - "
                                "Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
                                __FILE__, __LINE__, urinfo);
                return -EFAULT;
        }
 
        if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
-               dctlprintk((KERN_ERR "%s@%d::mptctl_do_reset - ioc%d not found!\n",
-                               __FILE__, __LINE__, krinfo.hdr.iocnum));
+               printk(KERN_DEBUG MYNAM "%s@%d::mptctl_do_reset - ioc%d not found!\n",
+                               __FILE__, __LINE__, krinfo.hdr.iocnum);
                return -ENODEV; /* (-6) No such device or address */
        }
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
+           iocp->name));
+
        if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) {
-               printk (KERN_ERR "%s@%d::mptctl_do_reset - reset failed.\n",
-                       __FILE__, __LINE__);
+               printk (MYIOC_s_ERR_FMT "%s@%d::mptctl_do_reset - reset failed.\n",
+                       iocp->name, __FILE__, __LINE__);
                return -1;
        }
 
@@ -695,9 +712,8 @@ mptctl_fw_download(unsigned long arg)
        struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
        struct mpt_fw_xfer       kfwdl;
 
-       dctlprintk((KERN_INFO "mptctl_fwdl called. mptctl_id = %xh\n", mptctl_id)); //tc
        if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) {
-               printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
+               printk(KERN_ERR MYNAM "%s@%d::_ioctl_fwdl - "
                                "Unable to copy mpt_fw_xfer struct @ %p\n",
                                __FILE__, __LINE__, ufwdl);
                return -EFAULT;
@@ -744,15 +760,9 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
        u16                      iocstat;
        pFWDownloadReply_t       ReplyMsg = NULL;
 
-       dctlprintk(("mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id));
-
-       dctlprintk(("DbG: kfwdl.bufp  = %p\n", ufwbuf));
-       dctlprintk(("DbG: kfwdl.fwlen = %d\n", (int)fwlen));
-       dctlprintk(("DbG: kfwdl.ioc   = %04xh\n", ioc));
-
        if (mpt_verify_adapter(ioc, &iocp) < 0) {
-               dctlprintk(("ioctl_fwdl - ioc%d not found!\n",
-                                ioc));
+               printk(KERN_DEBUG MYNAM "ioctl_fwdl - ioc%d not found!\n",
+                                ioc);
                return -ENODEV; /* (-6) No such device or address */
        } else {
 
@@ -761,6 +771,16 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
                        return -EAGAIN;
        }
+
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT
+           "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.bufp  = %p\n",
+           iocp->name, ufwbuf));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n",
+           iocp->name, (int)fwlen));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc   = %04xh\n",
+           iocp->name, ioc));
+
        dlmsg = (FWDownload_t*) mf;
        ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
        sgOut = (char *) (ptsge + 1);
@@ -829,7 +849,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                goto fwdl_out;
        }
 
-       dctlprintk(("DbG: sgl buffer  = %p, sgfrags = %d\n", sgl, numfrags));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: sgl buffer = %p, sgfrags = %d\n",
+           iocp->name, sgl, numfrags));
 
        /*
         * Parse SG list, copying sgl itself,
@@ -853,9 +874,9 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                        mpt_add_sge(sgOut, sgIn->FlagsLength, sgIn->Address);
                        n++;
                        if (copy_from_user(bl->kptr, ufwbuf+fw_bytes_copied, bl->len)) {
-                               printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
-                                               "Unable to copy f/w buffer hunk#%d @ %p\n",
-                                               __FILE__, __LINE__, n, ufwbuf);
+                               printk(MYIOC_s_ERR_FMT "%s@%d::_ioctl_fwdl - "
+                                       "Unable to copy f/w buffer hunk#%d @ %p\n",
+                                       iocp->name, __FILE__, __LINE__, n, ufwbuf);
                                goto fwdl_out;
                        }
                        fw_bytes_copied += bl->len;
@@ -865,15 +886,7 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                sgOut += (sizeof(dma_addr_t) + sizeof(u32));
        }
 
-#ifdef MPT_DEBUG
-       {
-               u32 *m = (u32 *)mf;
-               printk(KERN_INFO MYNAM ": F/W download request:\n" KERN_INFO " ");
-               for (i=0; i < 7+numfrags*2; i++)
-                       printk(" %08x", le32_to_cpu(m[i]));
-               printk("\n");
-       }
-#endif
+       DBG_DUMP_FW_DOWNLOAD(iocp, (u32 *)mf, numfrags);
 
        /*
         * Finally, perform firmware download.
@@ -899,21 +912,22 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
        ReplyMsg = (pFWDownloadReply_t)iocp->ioctl->ReplyFrame;
        iocstat = le16_to_cpu(ReplyMsg->IOCStatus) & MPI_IOCSTATUS_MASK;
        if (iocstat == MPI_IOCSTATUS_SUCCESS) {
-               printk(KERN_INFO MYNAM ": F/W update successfully sent to %s!\n", iocp->name);
+               printk(MYIOC_s_INFO_FMT "F/W update successfull!\n", iocp->name);
                return 0;
        } else if (iocstat == MPI_IOCSTATUS_INVALID_FUNCTION) {
-               printk(KERN_WARNING MYNAM ": ?Hmmm...  %s says it doesn't support F/W download!?!\n",
-                               iocp->name);
-               printk(KERN_WARNING MYNAM ": (time to go bang on somebodies door)\n");
+               printk(MYIOC_s_WARN_FMT "Hmmm...  F/W download not supported!?!\n",
+                       iocp->name);
+               printk(MYIOC_s_WARN_FMT "(time to go bang on somebodies door)\n",
+                       iocp->name);
                return -EBADRQC;
        } else if (iocstat == MPI_IOCSTATUS_BUSY) {
-               printk(KERN_WARNING MYNAM ": Warning!  %s says: IOC_BUSY!\n", iocp->name);
-               printk(KERN_WARNING MYNAM ": (try again later?)\n");
+               printk(MYIOC_s_WARN_FMT "IOC_BUSY!\n", iocp->name);
+               printk(MYIOC_s_WARN_FMT "(try again later?)\n", iocp->name);
                return -EBUSY;
        } else {
-               printk(KERN_WARNING MYNAM "::ioctl_fwdl() ERROR!  %s returned [bad] status = %04xh\n",
-                                   iocp->name, iocstat);
-               printk(KERN_WARNING MYNAM ": (bad VooDoo)\n");
+               printk(MYIOC_s_WARN_FMT "ioctl_fwdl() returned [bad] status = %04xh\n",
+                       iocp->name, iocstat);
+               printk(MYIOC_s_WARN_FMT "(bad VooDoo)\n", iocp->name);
                return -ENOMSG;
        }
        return 0;
@@ -963,10 +977,9 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
         * structures for the SG elements.
         */
        i = MAX_SGL_BYTES / 8;
-       buflist = kmalloc(i, GFP_USER);
-       if (buflist == NULL)
+       buflist = kzalloc(i, GFP_USER);
+       if (!buflist)
                return NULL;
-       memset(buflist, 0, i);
        buflist_ent = 0;
 
        /* Allocate a single block of memory to store the sg elements and
@@ -1001,10 +1014,10 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
                if (buflist[buflist_ent].kptr == NULL) {
                        alloc_sz = alloc_sz / 2;
                        if (alloc_sz == 0) {
-                               printk(KERN_WARNING MYNAM "-SG: No can do - "
-                                                   "not enough memory!   :-(\n");
-                               printk(KERN_WARNING MYNAM "-SG: (freeing %d frags)\n",
-                                                   numfrags);
+                               printk(MYIOC_s_WARN_FMT "-SG: No can do - "
+                                   "not enough memory!   :-(\n", ioc->name);
+                               printk(MYIOC_s_WARN_FMT "-SG: (freeing %d frags)\n",
+                                       ioc->name, numfrags);
                                goto free_and_fail;
                        }
                        continue;
@@ -1027,18 +1040,19 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
 
                /* Need to chain? */
                if (fragcnt == sg_spill) {
-                       printk(KERN_WARNING MYNAM "-SG: No can do - " "Chain required!   :-(\n");
-                       printk(KERN_WARNING MYNAM "(freeing %d frags)\n", numfrags);
+                       printk(MYIOC_s_WARN_FMT
+                           "-SG: No can do - " "Chain required!   :-(\n", ioc->name);
+                       printk(MYIOC_s_WARN_FMT "(freeing %d frags)\n", ioc->name, numfrags);
                        goto free_and_fail;
                }
 
                /* overflow check... */
                if (numfrags*8 > MAX_SGL_BYTES){
                        /* GRRRRR... */
-                       printk(KERN_WARNING MYNAM "-SG: No can do - "
-                                           "too many SG frags!   :-(\n");
-                       printk(KERN_WARNING MYNAM "-SG: (freeing %d frags)\n",
-                                           numfrags);
+                       printk(MYIOC_s_WARN_FMT "-SG: No can do - "
+                               "too many SG frags!   :-(\n", ioc->name);
+                       printk(MYIOC_s_WARN_FMT "-SG: (freeing %d frags)\n",
+                               ioc->name, numfrags);
                        goto free_and_fail;
                }
        }
@@ -1049,20 +1063,16 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
        *frags = numfrags;
        *blp = buflist;
 
-       dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - "
-                          "%d SG frags generated!\n",
-                          numfrags));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
+          "%d SG frags generated!\n", ioc->name, numfrags));
 
-       dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - "
-                          "last (big) alloc_sz=%d\n",
-                          alloc_sz));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
+          "last (big) alloc_sz=%d\n", ioc->name, alloc_sz));
 
        return sglbuf;
 
 free_and_fail:
        if (sglbuf != NULL) {
-               int i;
-
                for (i = 0; i < numfrags; i++) {
                        dma_addr_t dma_addr;
                        u8 *kptr;
@@ -1139,7 +1149,8 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
 
        pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma);
        kfree(buflist);
-       dctlprintk((KERN_INFO MYNAM "-SG: Free'd 1 SGL buf + %d kbufs!\n", n));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n",
+           ioc->name, n));
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1164,9 +1175,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
        int                     cim_rev;
        u8                      revision;
        struct scsi_device      *sdev;
-       VirtDevice              *vdev;
+       VirtDevice              *vdevice;
 
-       dctlprintk((": mptctl_getiocinfo called.\n"));
        /* Add of PCI INFO results in unaligned access for
         * IA64 and Sparc. Reset long to int. Return no PCI
         * data for obsolete format.
@@ -1184,13 +1194,13 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
 
        karg = kmalloc(data_size, GFP_KERNEL);
        if (karg == NULL) {
-               printk(KERN_ERR "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n",
+               printk(KERN_ERR MYNAM "%s::mpt_ioctl_iocinfo() @%d - no memory available!\n",
                                __FILE__, __LINE__);
                return -ENOMEM;
        }
 
        if (copy_from_user(karg, uarg, data_size)) {
-               printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_getiocinfo - "
                        "Unable to read in mpt_ioctl_iocinfo struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                kfree(karg);
@@ -1199,21 +1209,24 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
 
        if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                kfree(karg);
                return -ENODEV;
        }
 
        /* Verify the data transfer size is correct. */
        if (karg->hdr.maxDataSize != data_size) {
-               printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
                        "Structure size mismatch. Command not completed.\n",
-                               __FILE__, __LINE__);
+                       ioc->name, __FILE__, __LINE__);
                kfree(karg);
                return -EFAULT;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_getiocinfo called.\n",
+           ioc->name));
+
        /* Fill in the data and return the structure to the calling
         * program
         */
@@ -1257,8 +1270,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
        karg->numDevices = 0;
        if (ioc->sh) {
                shost_for_each_device(sdev, ioc->sh) {
-                       vdev = sdev->hostdata;
-                       if (vdev->vtarget->tflags &
+                       vdevice = sdev->hostdata;
+                       if (vdevice->vtarget->tflags &
                            MPT_TARGET_FLAGS_RAID_COMPONENT)
                                continue;
                        karg->numDevices++;
@@ -1282,9 +1295,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
        /* Copy the data from kernel memory to user memory
         */
        if (copy_to_user((char __user *)arg, karg, data_size)) {
-               printk(KERN_ERR "%s@%d::mptctl_getiocinfo - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_getiocinfo - "
                        "Unable to write out mpt_ioctl_iocinfo struct @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                kfree(karg);
                return -EFAULT;
        }
@@ -1309,7 +1322,7 @@ mptctl_gettargetinfo (unsigned long arg)
        struct mpt_ioctl_targetinfo __user *uarg = (void __user *) arg;
        struct mpt_ioctl_targetinfo karg;
        MPT_ADAPTER             *ioc;
-       VirtDevice              *vdev;
+       VirtDevice              *vdevice;
        char                    *pmem;
        int                     *pdata;
        int                     iocnum;
@@ -1320,9 +1333,8 @@ mptctl_gettargetinfo (unsigned long arg)
        u8                      port;
        struct scsi_device      *sdev;
 
-       dctlprintk(("mptctl_gettargetinfo called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) {
-               printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_gettargetinfo - "
                        "Unable to read in mpt_ioctl_targetinfo struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1330,11 +1342,13 @@ mptctl_gettargetinfo (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n",
+           ioc->name));
        /* Get the port number and set the maximum number of bytes
         * in the returned structure.
         * Ignore the port setting.
@@ -1344,8 +1358,8 @@ mptctl_gettargetinfo (unsigned long arg)
        port = karg.hdr.port;
 
        if (maxWordsLeft <= 0) {
-               printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
-                               __FILE__, __LINE__);
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo() - no memory available!\n",
+                       ioc->name, __FILE__, __LINE__);
                return -ENOMEM;
        }
 
@@ -1363,13 +1377,12 @@ mptctl_gettargetinfo (unsigned long arg)
         *      15- 8: Bus Number
         *       7- 0: Target ID
         */
-       pmem = kmalloc(numBytes, GFP_KERNEL);
-       if (pmem == NULL) {
-               printk(KERN_ERR "%s::mptctl_gettargetinfo() @%d - no memory available!\n",
-                               __FILE__, __LINE__);
+       pmem = kzalloc(numBytes, GFP_KERNEL);
+       if (!pmem) {
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo() - no memory available!\n",
+                       ioc->name, __FILE__, __LINE__);
                return -ENOMEM;
        }
-       memset(pmem, 0, numBytes);
        pdata =  (int *) pmem;
 
        /* Get number of devices
@@ -1378,13 +1391,13 @@ mptctl_gettargetinfo (unsigned long arg)
                shost_for_each_device(sdev, ioc->sh) {
                        if (!maxWordsLeft)
                                continue;
-                       vdev = sdev->hostdata;
-                       if (vdev->vtarget->tflags &
+                       vdevice = sdev->hostdata;
+                       if (vdevice->vtarget->tflags &
                            MPT_TARGET_FLAGS_RAID_COMPONENT)
                                continue;
-                       lun = (vdev->vtarget->raidVolume) ? 0x80 : vdev->lun;
-                       *pdata = (((u8)lun << 16) + (vdev->vtarget->channel << 8) +
-                           (vdev->vtarget->id ));
+                       lun = (vdevice->vtarget->raidVolume) ? 0x80 : vdevice->lun;
+                       *pdata = (((u8)lun << 16) + (vdevice->vtarget->channel << 8) +
+                           (vdevice->vtarget->id ));
                        pdata++;
                        numDevices++;
                        --maxWordsLeft;
@@ -1396,9 +1409,9 @@ mptctl_gettargetinfo (unsigned long arg)
         */
        if (copy_to_user((char __user *)arg, &karg,
                                sizeof(struct mpt_ioctl_targetinfo))) {
-               printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo - "
                        "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                kfree(pmem);
                return -EFAULT;
        }
@@ -1406,9 +1419,9 @@ mptctl_gettargetinfo (unsigned long arg)
        /* Copy the remaining data from kernel memory to user memory
         */
        if (copy_to_user(uarg->targetInfo, pmem, numBytes)) {
-               printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_gettargetinfo - "
                        "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
-                               __FILE__, __LINE__, pdata);
+                       ioc->name, __FILE__, __LINE__, pdata);
                kfree(pmem);
                return -EFAULT;
        }
@@ -1434,9 +1447,8 @@ mptctl_readtest (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_readtest called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
-               printk(KERN_ERR "%s@%d::mptctl_readtest - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_readtest - "
                        "Unable to read in mpt_ioctl_test struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1444,11 +1456,13 @@ mptctl_readtest (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_readtest() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_readtest() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
+           ioc->name));
        /* Fill in the data and return the structure to the calling
         * program
         */
@@ -1466,9 +1480,9 @@ mptctl_readtest (unsigned long arg)
        /* Copy the data from kernel memory to user memory
         */
        if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_test))) {
-               printk(KERN_ERR "%s@%d::mptctl_readtest - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_readtest - "
                        "Unable to write out mpt_ioctl_test struct @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                return -EFAULT;
        }
 
@@ -1494,9 +1508,8 @@ mptctl_eventquery (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_eventquery called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
-               printk(KERN_ERR "%s@%d::mptctl_eventquery - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_eventquery - "
                        "Unable to read in mpt_ioctl_eventquery struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1504,20 +1517,22 @@ mptctl_eventquery (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n",
+           ioc->name));
        karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
        karg.eventTypes = ioc->eventTypes;
 
        /* Copy the data from kernel memory to user memory
         */
        if (copy_to_user((char __user *)arg, &karg, sizeof(struct mpt_ioctl_eventquery))) {
-               printk(KERN_ERR "%s@%d::mptctl_eventquery - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_eventquery - "
                        "Unable to write out mpt_ioctl_eventquery struct @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                return -EFAULT;
        }
        return 0;
@@ -1532,9 +1547,8 @@ mptctl_eventenable (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_eventenable called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
-               printk(KERN_ERR "%s@%d::mptctl_eventenable - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_eventenable - "
                        "Unable to read in mpt_ioctl_eventenable struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1542,21 +1556,24 @@ mptctl_eventenable (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n",
+           ioc->name));
        if (ioc->events == NULL) {
                /* Have not yet allocated memory - do so now.
                 */
                int sz = MPTCTL_EVENT_LOG_SIZE * sizeof(MPT_IOCTL_EVENTS);
-               ioc->events = kmalloc(sz, GFP_KERNEL);
-               if (ioc->events == NULL) {
-                       printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
+               ioc->events = kzalloc(sz, GFP_KERNEL);
+               if (!ioc->events) {
+                       printk(MYIOC_s_ERR_FMT
+                           ": ERROR - Insufficient memory to add adapter!\n",
+                           ioc->name);
                        return -ENOMEM;
                }
-               memset(ioc->events, 0, sz);
                ioc->alloc_total += sz;
 
                ioc->eventContext = 0;
@@ -1579,9 +1596,8 @@ mptctl_eventreport (unsigned long arg)
        int                      iocnum;
        int                      numBytes, maxEvents, max;
 
-       dctlprintk(("mptctl_eventreport called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
-               printk(KERN_ERR "%s@%d::mptctl_eventreport - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_eventreport - "
                        "Unable to read in mpt_ioctl_eventreport struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1589,10 +1605,12 @@ mptctl_eventreport (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n",
+           ioc->name));
 
        numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header);
        maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
@@ -1613,9 +1631,9 @@ mptctl_eventreport (unsigned long arg)
         */
        numBytes = max * sizeof(MPT_IOCTL_EVENTS);
        if (copy_to_user(uarg->eventData, ioc->events, numBytes)) {
-               printk(KERN_ERR "%s@%d::mptctl_eventreport - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_eventreport - "
                        "Unable to write out mpt_ioctl_eventreport struct @ %p\n",
-                               __FILE__, __LINE__, ioc->events);
+                       ioc->name, __FILE__, __LINE__, ioc->events);
                return -EFAULT;
        }
 
@@ -1632,9 +1650,8 @@ mptctl_replace_fw (unsigned long arg)
        int                      iocnum;
        int                      newFwSize;
 
-       dctlprintk(("mptctl_replace_fw called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
-               printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_replace_fw - "
                        "Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1642,11 +1659,13 @@ mptctl_replace_fw (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n",
+           ioc->name));
        /* If caching FW, Free the old FW image
         */
        if (ioc->cached_fw == NULL)
@@ -1670,9 +1689,9 @@ mptctl_replace_fw (unsigned long arg)
        /* Copy the data from user memory to kernel space
         */
        if (copy_from_user(ioc->cached_fw, uarg->newImage, newFwSize)) {
-               printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_replace_fw - "
                                "Unable to read in mpt_ioctl_replace_fw image "
-                               "@ %p\n", __FILE__, __LINE__, uarg);
+                               "@ %p\n", ioc->name, __FILE__, __LINE__, uarg);
                mpt_free_fw_memory(ioc);
                return -EFAULT;
        }
@@ -1689,7 +1708,7 @@ mptctl_replace_fw (unsigned long arg)
  *
  * Outputs:    None.
  * Return:     0 if successful
- *             -EBUSY  if previous command timout and IOC reset is not complete.
+ *             -EBUSY  if previous command timeout and IOC reset is not complete.
  *             -EFAULT if data unavailable
  *             -ENODEV if no such device/adapter
  *             -ETIME  if timer expires
@@ -1704,10 +1723,9 @@ mptctl_mpt_command (unsigned long arg)
        int             iocnum;
        int             rc;
 
-       dctlprintk(("mptctl_command called.\n"));
 
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
-               printk(KERN_ERR "%s@%d::mptctl_mpt_command - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_mpt_command - "
                        "Unable to read in mpt_ioctl_command struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -1715,8 +1733,8 @@ mptctl_mpt_command (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
@@ -1730,7 +1748,7 @@ mptctl_mpt_command (unsigned long arg)
  *
  * Outputs:    None.
  * Return:     0 if successful
- *             -EBUSY  if previous command timout and IOC reset is not complete.
+ *             -EBUSY  if previous command timeout and IOC reset is not complete.
  *             -EFAULT if data unavailable
  *             -ENODEV if no such device/adapter
  *             -ETIME  if timer expires
@@ -1756,22 +1774,24 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        ulong           timeout;
        struct scsi_device *sdev;
 
-       dctlprintk(("mptctl_do_mpt_command called.\n"));
+       /* bufIn and bufOut are used for user to kernel space transfers
+        */
        bufIn.kptr = bufOut.kptr = NULL;
+       bufIn.len = bufOut.len = 0;
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
        if (!ioc->ioctl) {
-               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_do_mpt_command - "
                        "No memory available during driver init.\n",
                                __FILE__, __LINE__);
                return -ENOMEM;
        } else if (ioc->ioctl->status & MPT_IOCTL_STATUS_DID_IOCRESET) {
-               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_do_mpt_command - "
                        "Busy with IOC Reset \n", __FILE__, __LINE__);
                return -EBUSY;
        }
@@ -1785,9 +1805,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                sz += sizeof(dma_addr_t) + sizeof(u32);
 
        if (sz > ioc->req_sz) {
-               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                        "Request frame too large (%d) maximum (%d)\n",
-                               __FILE__, __LINE__, sz, ioc->req_sz);
+                       ioc->name, __FILE__, __LINE__, sz, ioc->req_sz);
                return -EFAULT;
        }
 
@@ -1805,9 +1825,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
         * Request frame in user space
         */
        if (copy_from_user(mf, mfPtr, karg.dataSgeOffset * 4)) {
-               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                        "Unable to read MF from mpt_ioctl_command struct @ %p\n",
-                       __FILE__, __LINE__, mfPtr);
+                       ioc->name, __FILE__, __LINE__, mfPtr);
                rc = -EFAULT;
                goto done_free_mem;
        }
@@ -1816,6 +1836,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
 
        /* Verify that this request is allowed.
         */
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "sending mpi function (0x%02X), req=%p\n",
+           ioc->name, hdr->Function, mf));
+
        switch (hdr->Function) {
        case MPI_FUNCTION_IOC_FACTS:
        case MPI_FUNCTION_PORT_FACTS:
@@ -1823,6 +1846,18 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                break;
 
        case MPI_FUNCTION_CONFIG:
+       {
+               Config_t *config_frame;
+               config_frame = (Config_t *)mf;
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\ttype=0x%02x ext_type=0x%02x "
+                   "number=0x%02x action=0x%02x\n", ioc->name,
+                   config_frame->Header.PageType,
+                   config_frame->ExtPageType,
+                   config_frame->Header.PageNumber,
+                   config_frame->Action));
+               break;
+       }
+
        case MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND:
        case MPI_FUNCTION_FC_EX_LINK_SRVC_SEND:
        case MPI_FUNCTION_FW_UPLOAD:
@@ -1843,17 +1878,17 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
 
                        id = (ioc->devices_per_bus == 0) ? 256 : ioc->devices_per_bus;
                        if (pScsiReq->TargetID > id) {
-                               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                        "Target ID out of bounds. \n",
-                                       __FILE__, __LINE__);
+                                       ioc->name, __FILE__, __LINE__);
                                rc = -ENODEV;
                                goto done_free_mem;
                        }
 
                        if (pScsiReq->Bus >= ioc->number_of_buses) {
-                               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                        "Target Bus out of bounds. \n",
-                                       __FILE__, __LINE__);
+                                       ioc->name, __FILE__, __LINE__);
                                rc = -ENODEV;
                                goto done_free_mem;
                        }
@@ -1905,9 +1940,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                        ioc->ioctl->id = pScsiReq->TargetID;
 
                } else {
-                       printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                       printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                "SCSI driver is not loaded. \n",
-                                       __FILE__, __LINE__);
+                               ioc->name, __FILE__, __LINE__);
                        rc = -EFAULT;
                        goto done_free_mem;
                }
@@ -1924,9 +1959,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
 
        case MPI_FUNCTION_SATA_PASSTHROUGH:
                if (!ioc->sh) {
-                       printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                       printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                "SCSI driver is not loaded. \n",
-                                       __FILE__, __LINE__);
+                               ioc->name, __FILE__, __LINE__);
                        rc = -EFAULT;
                        goto done_free_mem;
                }
@@ -1983,9 +2018,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                        ioc->ioctl->reset = MPTCTL_RESET_OK;
                        ioc->ioctl->id = pScsiReq->TargetID;
                } else {
-                       printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                       printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                "SCSI driver is not loaded. \n",
-                                       __FILE__, __LINE__);
+                               ioc->name, __FILE__, __LINE__);
                        rc = -EFAULT;
                        goto done_free_mem;
                }
@@ -1994,10 +2029,10 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        case MPI_FUNCTION_SCSI_TASK_MGMT:
                {
                        MPT_SCSI_HOST *hd = NULL;
-                       if ((ioc->sh == NULL) || ((hd = (MPT_SCSI_HOST *)ioc->sh->hostdata) == NULL)) {
-                               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                       if ((ioc->sh == NULL) || ((hd = shost_priv(ioc->sh)) == NULL)) {
+                               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                        "SCSI driver not loaded or SCSI host not found. \n",
-                                       __FILE__, __LINE__);
+                                       ioc->name, __FILE__, __LINE__);
                                rc = -EFAULT;
                                goto done_free_mem;
                        } else if (mptctl_set_tm_flags(hd) != 0) {
@@ -2028,9 +2063,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                                (pInit->ReplyFrameSize != cpu_to_le16(ioc->reply_sz)) ||
                                (pInit->HostMfaHighAddr != high_addr) ||
                                (pInit->SenseBufferHighAddr != sense_high)) {
-                               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                        "IOC_INIT issued with 1 or more incorrect parameters. Rejected.\n",
-                                       __FILE__, __LINE__);
+                                       ioc->name, __FILE__, __LINE__);
                                rc = -EFAULT;
                                goto done_free_mem;
                        }
@@ -2061,9 +2096,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                        MPI_FUNCTION_LAN_RESET
                */
 
-               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                        "Illegal request (function 0x%x) \n",
-                       __FILE__, __LINE__, hdr->Function);
+                       ioc->name, __FILE__, __LINE__, hdr->Function);
                rc = -EFAULT;
                goto done_free_mem;
        }
@@ -2076,11 +2111,6 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        psge = (char *) (((int *) mf) + karg.dataSgeOffset);
        flagsLength = 0;
 
-       /* bufIn and bufOut are used for user to kernel space transfers
-        */
-       bufIn.kptr = bufOut.kptr = NULL;
-       bufIn.len = bufOut.len = 0;
-
        if (karg.dataOutSize > 0)
                sgSize ++;
 
@@ -2120,11 +2150,11 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                                if (copy_from_user(bufOut.kptr,
                                                karg.dataOutBufPtr,
                                                bufOut.len)) {
-                                       printk(KERN_ERR
+                                       printk(MYIOC_s_ERR_FMT
                                                "%s@%d::mptctl_do_mpt_command - Unable "
                                                "to read user data "
                                                "struct @ %p\n",
-                                               __FILE__, __LINE__,karg.dataOutBufPtr);
+                                               ioc->name, __FILE__, __LINE__,karg.dataOutBufPtr);
                                        rc =  -EFAULT;
                                        goto done_free_mem;
                                }
@@ -2158,17 +2188,22 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        ioc->ioctl->wait_done = 0;
        if (hdr->Function == MPI_FUNCTION_SCSI_TASK_MGMT) {
 
-               DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf);
-
-               if (mpt_send_handshake_request(mptctl_id, ioc,
-                       sizeof(SCSITaskMgmt_t), (u32*)mf,
-                       CAN_SLEEP) != 0) {
-                       dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!"
-                               " (ioc %p, mf %p) \n", ioc->name,
-                               ioc, mf));
-                       mptctl_free_tm_flags(ioc);
-                       rc = -ENODATA;
-                       goto done_free_mem;
+               DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
+
+               if ((ioc->facts.IOCCapabilities & MPI_IOCFACTS_CAPABILITY_HIGH_PRI_Q) &&
+                   (ioc->facts.MsgVersion >= MPI_VERSION_01_05))
+                       mpt_put_msg_frame_hi_pri(mptctl_id, ioc, mf);
+               else {
+                       rc =mpt_send_handshake_request(mptctl_id, ioc,
+                               sizeof(SCSITaskMgmt_t), (u32*)mf, CAN_SLEEP);
+                       if (rc != 0) {
+                               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
+                                   "_send_handshake FAILED! (ioc %p, mf %p)\n",
+                                   ioc->name, ioc, mf));
+                               mptctl_free_tm_flags(ioc);
+                               rc = -ENODATA;
+                               goto done_free_mem;
+                       }
                }
 
        } else
@@ -2206,10 +2241,10 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                if (sz > 0) {
                        if (copy_to_user(karg.replyFrameBufPtr,
                                 &ioc->ioctl->ReplyFrame, sz)){
-                                printk(KERN_ERR
+                                printk(MYIOC_s_ERR_FMT
                                     "%s@%d::mptctl_do_mpt_command - "
                                 "Unable to write out reply frame %p\n",
-                                __FILE__, __LINE__, karg.replyFrameBufPtr);
+                                ioc->name, __FILE__, __LINE__, karg.replyFrameBufPtr);
                                 rc =  -ENODATA;
                                 goto done_free_mem;
                        }
@@ -2222,9 +2257,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                sz = min(karg.maxSenseBytes, MPT_SENSE_BUFFER_SIZE);
                if (sz > 0) {
                        if (copy_to_user(karg.senseDataPtr, ioc->ioctl->sense, sz)) {
-                               printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                "Unable to write sense data to user %p\n",
-                               __FILE__, __LINE__,
+                               ioc->name, __FILE__, __LINE__,
                                karg.senseDataPtr);
                                rc =  -ENODATA;
                                goto done_free_mem;
@@ -2240,9 +2275,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
 
                if (copy_to_user(karg.dataInBufPtr,
                                 bufIn.kptr, karg.dataInSize)) {
-                       printk(KERN_ERR "%s@%d::mptctl_do_mpt_command - "
+                       printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_do_mpt_command - "
                                "Unable to write data to user %p\n",
-                               __FILE__, __LINE__,
+                               ioc->name, __FILE__, __LINE__,
                                karg.dataInBufPtr);
                        rc =  -ENODATA;
                }
@@ -2281,7 +2316,7 @@ done_free_mem:
  * Outputs:    None.
  * Return:     0 if successful
  *             -EFAULT if data unavailable
- *             -EBUSY  if previous command timout and IOC reset is not complete.
+ *             -EBUSY  if previous command timeout and IOC reset is not complete.
  *             -ENODEV if no such device/adapter
  *             -ETIME  if timer expires
  *             -ENOMEM if memory allocation error
@@ -2303,7 +2338,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
        MPT_FRAME_HDR           *mf = NULL;
        MPIHeader_t             *mpi_hdr;
 
-       dctlprintk((": mptctl_hp_hostinfo called.\n"));
        /* Reset long to int. Should affect IA64 and SPARC only
         */
        if (data_size == sizeof(hp_host_info_t))
@@ -2314,7 +2348,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
                return -EFAULT;
 
        if (copy_from_user(&karg, uarg, sizeof(hp_host_info_t))) {
-               printk(KERN_ERR "%s@%d::mptctl_hp_host_info - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_hp_host_info - "
                        "Unable to read in hp_host_info struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -2322,10 +2356,12 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n",
+           ioc->name));
 
        /* Fill in the data and return the structure to the calling
         * program
@@ -2428,7 +2464,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
        karg.soft_resets = 0;
        karg.timeouts = 0;
        if (ioc->sh != NULL) {
-               MPT_SCSI_HOST *hd =  (MPT_SCSI_HOST *)ioc->sh->hostdata;
+               MPT_SCSI_HOST *hd =  shost_priv(ioc->sh);
 
                if (hd && (cim_rev == 1)) {
                        karg.hard_resets = hd->hard_resets;
@@ -2441,7 +2477,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
         * Gather ISTWI(Industry Standard Two Wire Interface) Data
         */
        if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
                    ioc->name,__FUNCTION__));
                goto out;
        }
@@ -2474,7 +2510,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
             HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */);
 
        if(rc <=0 && (ioc->ioctl->wait_done != 1 )) {
-               /* 
+               /*
                 * Now we need to reset the board
                 */
                mpt_free_msg_frame(ioc, mf);
@@ -2482,7 +2518,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
                goto out;
        }
 
-       /* 
+       /*
         *ISTWI Data Definition
         * pbuf[0] = FW_VERSION = 0x4
         * pbuf[1] = Bay Count = 6 or 4 or 2, depending on
@@ -2501,9 +2537,9 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
        /* Copy the data from kernel memory to user memory
         */
        if (copy_to_user((char __user *)arg, &karg, sizeof(hp_host_info_t))) {
-               printk(KERN_ERR "%s@%d::mptctl_hpgethostinfo - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_hpgethostinfo - "
                        "Unable to write out hp_host_info @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                return -EFAULT;
        }
 
@@ -2517,7 +2553,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
  * Outputs:    None.
  * Return:     0 if successful
  *             -EFAULT if data unavailable
- *             -EBUSY  if previous command timout and IOC reset is not complete.
+ *             -EBUSY  if previous command timeout and IOC reset is not complete.
  *             -ENODEV if no such device/adapter
  *             -ETIME  if timer expires
  *             -ENOMEM if memory allocation error
@@ -2538,9 +2574,8 @@ mptctl_hp_targetinfo(unsigned long arg)
        ConfigPageHeader_t      hdr;
        int                     tmp, np, rc = 0;
 
-       dctlprintk((": mptctl_hp_targetinfo called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) {
-               printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - "
+               printk(KERN_ERR MYNAM "%s@%d::mptctl_hp_targetinfo - "
                        "Unable to read in hp_host_targetinfo struct @ %p\n",
                                __FILE__, __LINE__, uarg);
                return -EFAULT;
@@ -2548,10 +2583,12 @@ mptctl_hp_targetinfo(unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
                (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG MYNAM "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_hp_targetinfo called.\n",
+           ioc->name));
 
        /*  There is nothing to do for FCP parts.
         */
@@ -2644,16 +2681,16 @@ mptctl_hp_targetinfo(unsigned long arg)
                        pci_free_consistent(ioc->pcidev, data_sz, (u8 *) pg3_alloc, page_dma);
                }
        }
-       hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
+       hd = shost_priv(ioc->sh);
        if (hd != NULL)
                karg.select_timeouts = hd->sel_timeout[karg.hdr.id];
 
        /* Copy the data from kernel memory to user memory
         */
        if (copy_to_user((char __user *)arg, &karg, sizeof(hp_target_info_t))) {
-               printk(KERN_ERR "%s@%d::mptctl_hp_target_info - "
+               printk(MYIOC_s_ERR_FMT "%s@%d::mptctl_hp_target_info - "
                        "Unable to write out mpt_ioctl_targetinfo struct @ %p\n",
-                               __FILE__, __LINE__, uarg);
+                       ioc->name, __FILE__, __LINE__, uarg);
                return -EFAULT;
        }
 
@@ -2694,7 +2731,6 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
        int nonblock = (filp->f_flags & O_NONBLOCK);
        int ret;
 
-       dctlprintk((KERN_INFO MYNAM "::compat_mptfwxfer_ioctl() called\n"));
 
        if (copy_from_user(&kfw32, (char __user *)arg, sizeof(kfw32)))
                return -EFAULT;
@@ -2703,14 +2739,16 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
        iocnumX = kfw32.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
-                               __LINE__, iocnumX));
+               printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
+                       __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mptfwxfer_ioctl() called\n",
+           iocp->name));
        kfw.iocnum = iocnum;
        kfw.fwlen = kfw32.fwlen;
        kfw.bufp = compat_ptr(kfw32.bufp);
@@ -2734,8 +2772,6 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
        int nonblock = (filp->f_flags & O_NONBLOCK);
        int ret;
 
-       dctlprintk((KERN_INFO MYNAM "::compat_mpt_command() called\n"));
-
        if (copy_from_user(&karg32, (char __user *)arg, sizeof(karg32)))
                return -EFAULT;
 
@@ -2743,14 +2779,16 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
        iocnumX = karg32.hdr.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
-                               __LINE__, iocnumX));
+               printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
+                       __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mpt_command() called\n",
+           iocp->name));
        /* Copy data to karg */
        karg.hdr.iocnum = karg32.hdr.iocnum;
        karg.hdr.port = karg32.hdr.port;
@@ -2823,31 +2861,22 @@ static long compat_mpctl_ioctl(struct file *f, unsigned int cmd, unsigned long a
 static int
 mptctl_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 {
-       int err;
-       int sz;
-       u8 *mem;
+       MPT_IOCTL *mem;
        MPT_ADAPTER *ioc = pci_get_drvdata(pdev);
 
        /*
         * Allocate and inite a MPT_IOCTL structure
        */
-       sz = sizeof (MPT_IOCTL);
-       mem = kmalloc(sz, GFP_KERNEL);
-       if (mem == NULL) {
-               err = -ENOMEM;
-               goto out_fail;
+       mem = kzalloc(sizeof(MPT_IOCTL), GFP_KERNEL);
+       if (!mem) {
+               mptctl_remove(pdev);
+               return -ENOMEM;
        }
 
-       memset(mem, 0, sz);
-       ioc->ioctl = (MPT_IOCTL *) mem;
+       ioc->ioctl = mem;
        ioc->ioctl->ioc = ioc;
        mutex_init(&ioc->ioctl->ioctl_mutex);
        return 0;
-
-out_fail:
-
-       mptctl_remove(pdev);
-       return err;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -2878,11 +2907,7 @@ static int __init mptctl_init(void)
 
        show_mptmod_ver(my_NAME, my_VERSION);
 
-       if(mpt_device_driver_register(&mptctl_driver,
-         MPTCTL_DRIVER) != 0 ) {
-               dprintk((KERN_INFO MYNAM
-               ": failed to register dd callbacks\n"));
-       }
+       mpt_device_driver_register(&mptctl_driver, MPTCTL_DRIVER);
 
        /* Register this device */
        err = misc_register(&mptctl_miscdev);
@@ -2898,23 +2923,16 @@ static int __init mptctl_init(void)
         *  Install our handler
         */
        ++where;
-       if ((mptctl_id = mpt_register(mptctl_reply, MPTCTL_DRIVER)) < 0) {
+       mptctl_id = mpt_register(mptctl_reply, MPTCTL_DRIVER);
+       if (!mptctl_id || mptctl_id >= MPT_MAX_PROTOCOL_DRIVERS) {
                printk(KERN_ERR MYNAM ": ERROR: Failed to register with Fusion MPT base driver\n");
                misc_deregister(&mptctl_miscdev);
                err = -EBUSY;
                goto out_fail;
        }
 
-       if (mpt_reset_register(mptctl_id, mptctl_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n"));
-       } else {
-               /* FIXME! */
-       }
-
-       if (mpt_event_register(mptctl_id, mptctl_event_process) == 0) {
-               devtverboseprintk((KERN_INFO MYNAM
-                 ": Registered for IOC event notifications\n"));
-       }
+       mpt_reset_register(mptctl_id, mptctl_ioc_reset);
+       mpt_event_register(mptctl_id, mptctl_event_process);
 
        return 0;
 
@@ -2934,11 +2952,9 @@ static void mptctl_exit(void)
 
        /* De-register reset handler from base module */
        mpt_reset_deregister(mptctl_id);
-       dprintk((KERN_INFO MYNAM ": Deregistered for IOC reset notifications\n"));
 
        /* De-register callback handler from base module */
        mpt_deregister(mptctl_id);
-       printk(KERN_INFO MYNAM ": Deregistered from Fusion MPT base driver\n");
 
         mpt_device_driver_deregister(MPTCTL_DRIVER);