fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / message / fusion / mptbase.c
index 79718c1..b3f28a0 100644 (file)
@@ -5,7 +5,7 @@
  *      For use with LSI Logic PCI chip/adapter(s)
  *      running LSI Logic Fusion MPT (Message Passing Technology) firmware.
  *
- *  Copyright (c) 1999-2005 LSI Logic Corporation
+ *  Copyright (c) 1999-2007 LSI Logic Corporation
  *  (mailto:mpt_linux_developer@lsil.com)
  *
  */
@@ -46,7 +46,6 @@
 */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
@@ -63,9 +62,6 @@
 #ifdef CONFIG_MTRR
 #include <asm/mtrr.h>
 #endif
-#ifdef __sparc__
-#include <asm/irq.h>                   /* needed for __irq_itoa() proto */
-#endif
 
 #include "mptbase.h"
 
@@ -77,7 +73,7 @@
 MODULE_AUTHOR(MODULEAUTHOR);
 MODULE_DESCRIPTION(my_NAME);
 MODULE_LICENSE("GPL");
-MODULE_VERSION(MPT_LINUX_VERSION_COMMON);
+MODULE_VERSION(my_VERSION);
 
 /*
  *  cmd line parameters
@@ -127,7 +123,7 @@ static DECLARE_WAIT_QUEUE_HEAD(mpt_waitq);
 /*
  *  Forward protos...
  */
-static irqreturn_t mpt_interrupt(int irq, void *bus_id, struct pt_regs *r);
+static irqreturn_t mpt_interrupt(int irq, void *bus_id);
 static int     mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply);
 static int     mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes,
                        u32 *req, int replyBytes, u16 *u16reply, int maxwait,
@@ -352,11 +348,10 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_interrupt - MPT adapter (IOC) specific interrupt handler.
  *     @irq: irq number (not used)
  *     @bus_id: bus identifier cookie == pointer to MPT_ADAPTER structure
- *     @r: pt_regs pointer (not used)
  *
  *     This routine is registered via the request_irq() kernel API call,
  *     and handles all interrupts generated from a specific MPT adapter
@@ -370,36 +365,39 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
  *     the protocol-specific details of the MPT request completion.
  */
 static irqreturn_t
-mpt_interrupt(int irq, void *bus_id, struct pt_regs *r)
+mpt_interrupt(int irq, void *bus_id)
 {
        MPT_ADAPTER *ioc = bus_id;
-       u32 pa;
+       u32 pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
+
+       if (pa == 0xFFFFFFFF)
+               return IRQ_NONE;
 
        /*
         *  Drain the reply FIFO!
         */
-       while (1) {
-               pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
-               if (pa == 0xFFFFFFFF)
-                       return IRQ_HANDLED;
-               else if (pa & MPI_ADDRESS_REPLY_A_BIT)
+       do {
+               if (pa & MPI_ADDRESS_REPLY_A_BIT)
                        mpt_reply(ioc, pa);
                else
                        mpt_turbo_reply(ioc, pa);
-       }
+               pa = CHIPREG_READ32_dmasync(&ioc->chip->ReplyFifo);
+       } while (pa != 0xFFFFFFFF);
 
        return IRQ_HANDLED;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mpt_base_reply - MPT base driver's callback routine; all base driver
- *     "internal" request/reply processing is routed here.
- *     Currently used for EventNotification and EventAck handling.
+/**
+ *     mpt_base_reply - MPT base driver's callback routine
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @mf: Pointer to original MPT request frame
  *     @reply: Pointer to MPT reply frame (NULL if TurboReply)
  *
+ *     MPT base driver's callback routine; all base driver
+ *     "internal" request/reply processing is routed here.
+ *     Currently used for EventNotification and EventAck handling.
+ *
  *     Returns 1 indicating original alloc'd request frame ptr
  *     should be freed, or 0 if it shouldn't.
  */
@@ -440,8 +438,6 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
                 */
                if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) {
                        freereq = 0;
-                       devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p does not return Request frame\n",
-                               ioc->name, pEvReply));
                } else {
                        devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n",
                                ioc->name, pEvReply));
@@ -537,7 +533,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
  *     @dclass: Protocol driver's class (%MPT_DRIVER_CLASS enum value)
  *
  *     This routine is called by a protocol-specific driver (SCSI host,
- *     LAN, SCSI target) to register it's reply callback routine.  Each
+ *     LAN, SCSI target) to register its reply callback routine.  Each
  *     protocol-specific driver must do this before it will be able to
  *     use any IOC resources, such as obtaining request frames.
  *
@@ -579,7 +575,7 @@ mpt_register(MPT_CALLBACK cbfunc, MPT_DRIVER_CLASS dclass)
  *     mpt_deregister - Deregister a protocol drivers resources.
  *     @cb_idx: previously registered callback handle
  *
- *     Each protocol-specific driver should call this routine when it's
+ *     Each protocol-specific driver should call this routine when its
  *     module is unloaded.
  */
 void
@@ -624,7 +620,7 @@ mpt_event_register(int cb_idx, MPT_EVHANDLER ev_cbfunc)
  *
  *     Each protocol-specific driver should call this routine
  *     when it does not (or can no longer) handle events,
- *     or when it's module is unloaded.
+ *     or when its module is unloaded.
  */
 void
 mpt_event_deregister(int cb_idx)
@@ -663,7 +659,7 @@ mpt_reset_register(int cb_idx, MPT_RESETHANDLER reset_func)
  *
  *     Each protocol-specific driver should call this routine
  *     when it does not (or can no longer) handle IOC reset handling,
- *     or when it's module is unloaded.
+ *     or when its module is unloaded.
  */
 void
 mpt_reset_deregister(int cb_idx)
@@ -677,24 +673,26 @@ mpt_reset_deregister(int cb_idx)
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *     mpt_device_driver_register - Register device driver hooks
+ *     @dd_cbfunc: driver callbacks struct
+ *     @cb_idx: MPT protocol driver index
  */
 int
 mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
 {
        MPT_ADAPTER     *ioc;
+       const struct pci_device_id *id;
 
-       if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS) {
+       if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS)
                return -EINVAL;
-       }
 
        MptDeviceDriverHandlers[cb_idx] = dd_cbfunc;
 
        /* call per pci device probe entry point */
        list_for_each_entry(ioc, &ioc_list, list) {
-               if(dd_cbfunc->probe) {
-                       dd_cbfunc->probe(ioc->pcidev,
-                         ioc->pcidev->driver->id_table);
-               }
+               id = ioc->pcidev->driver ?
+                   ioc->pcidev->driver->id_table : NULL;
+               if (dd_cbfunc->probe)
+                       dd_cbfunc->probe(ioc->pcidev, id);
         }
 
        return 0;
@@ -703,6 +701,7 @@ mpt_device_driver_register(struct mpt_pci_driver * dd_cbfunc, int cb_idx)
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *     mpt_device_driver_deregister - DeRegister device driver hooks
+ *     @cb_idx: MPT protocol driver index
  */
 void
 mpt_device_driver_deregister(int cb_idx)
@@ -894,8 +893,7 @@ mpt_add_sge(char *pAddr, u32 flagslength, dma_addr_t dma_addr)
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
- *     mpt_send_handshake_request - Send MPT request via doorbell
- *     handshake method.
+ *     mpt_send_handshake_request - Send MPT request via doorbell handshake method.
  *     @handle: Handle of registered MPT protocol driver
  *     @ioc: Pointer to MPT adapter structure
  *     @reqBytes: Size of the request in bytes
@@ -988,10 +986,13 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req,
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
- * mpt_host_page_access_control - provides mechanism for the host
- * driver to control the IOC's Host Page Buffer access.
+ * mpt_host_page_access_control - control the IOC's Host Page Buffer access
  * @ioc: Pointer to MPT adapter structure
  * @access_control_value: define bits below
+ * @sleepFlag: Specifies whether the process can sleep
+ *
+ * Provides mechanism for the host driver to control the IOC's
+ * Host Page Buffer access.
  *
  * Access Control Value - bits[15:12]
  * 0h Reserved
@@ -1029,10 +1030,10 @@ mpt_host_page_access_control(MPT_ADAPTER *ioc, u8 access_control_value, int slee
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *     mpt_host_page_alloc - allocate system memory for the fw
- *     If we already allocated memory in past, then resend the same pointer.
- *     ioc@: Pointer to pointer to IOC adapter
- *     ioc_init@: Pointer to ioc init config page
+ *     @ioc: Pointer to pointer to IOC adapter
+ *     @ioc_init: Pointer to ioc init config page
  *
+ *     If we already allocated memory in past, then resend the same pointer.
  *     Returns 0 for success, non-zero for failure.
  */
 static int
@@ -1060,9 +1061,8 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
 
                                dinitprintk((MYIOC_s_INFO_FMT
                                    "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
-                                   ioc->name,
-                                   ioc->HostPageBuffer,
-                                   ioc->HostPageBuffer_dma,
+                                   ioc->name, ioc->HostPageBuffer,
+                                   (u32)ioc->HostPageBuffer_dma,
                                    host_page_buffer_sz));
                                ioc->alloc_total += host_page_buffer_sz;
                                ioc->HostPageBuffer_sz = host_page_buffer_sz;
@@ -1099,12 +1099,15 @@ return 0;
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
- *     mpt_verify_adapter - Given a unique IOC identifier, set pointer to
- *     the associated MPT adapter structure.
+ *     mpt_verify_adapter - Given IOC identifier, set pointer to its adapter structure.
  *     @iocid: IOC unique identifier (integer)
  *     @iocpp: Pointer to pointer to IOC adapter
  *
- *     Returns iocid and sets iocpp.
+ *     Given a unique IOC identifier, set pointer to the associated MPT
+ *     adapter structure.
+ *
+ *     Returns iocid and sets iocpp if iocid is found.
+ *     Returns -1 if iocid is not found.
  */
 int
 mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
@@ -1123,9 +1126,10 @@ mpt_verify_adapter(int iocid, MPT_ADAPTER **iocpp)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_attach - Install a PCI intelligent MPT adapter.
  *     @pdev: Pointer to pci_dev structure
+ *     @id: PCI device ID information
  *
  *     This routine performs all the steps necessary to bring the IOC of
  *     a MPT adapter to a OPERATIONAL state.  This includes registering
@@ -1189,7 +1193,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        ioc->pcidev = pdev;
        ioc->diagPending = 0;
        spin_lock_init(&ioc->diagLock);
-       spin_lock_init(&ioc->fc_rescan_work_lock);
        spin_lock_init(&ioc->initializing_hba_lock);
 
        /* Initialize the event logging.
@@ -1225,31 +1228,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        port = psize = 0;
        for (ii=0; ii < DEVICE_COUNT_RESOURCE; ii++) {
                if (pci_resource_flags(pdev, ii) & PCI_BASE_ADDRESS_SPACE_IO) {
+                       if (psize)
+                               continue;
                        /* Get I/O space! */
                        port = pci_resource_start(pdev, ii);
                        psize = pci_resource_len(pdev,ii);
                } else {
+                       if (msize)
+                               continue;
                        /* Get memmap */
                        mem_phys = pci_resource_start(pdev, ii);
                        msize = pci_resource_len(pdev,ii);
-                       break;
                }
        }
        ioc->mem_size = msize;
 
-       if (ii == DEVICE_COUNT_RESOURCE) {
-               printk(KERN_ERR MYNAM ": ERROR - MPT adapter has no memory regions defined!\n");
-               kfree(ioc);
-               return -EINVAL;
-       }
-
-       dinitprintk((KERN_INFO MYNAM ": MPT adapter @ %lx, msize=%dd bytes\n", mem_phys, msize));
-       dinitprintk((KERN_INFO MYNAM ": (port i/o @ %lx, psize=%dd bytes)\n", port, psize));
-
        mem = NULL;
        /* Get logical ptr for PciMem0 space */
        /*mem = ioremap(mem_phys, msize);*/
-       mem = ioremap(mem_phys, 0x100);
+       mem = ioremap(mem_phys, msize);
        if (mem == NULL) {
                printk(KERN_ERR MYNAM ": ERROR - Unable to map adapter memory!\n");
                kfree(ioc);
@@ -1349,11 +1346,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                ioc->bus_type = SAS;
                ioc->errata_flag_1064 = 1;
        }
-       else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1066) {
-               ioc->prod_name = "LSISAS1066";
-               ioc->bus_type = SAS;
-               ioc->errata_flag_1064 = 1;
-       }
        else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068) {
                ioc->prod_name = "LSISAS1068";
                ioc->bus_type = SAS;
@@ -1363,14 +1355,14 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                ioc->prod_name = "LSISAS1064E";
                ioc->bus_type = SAS;
        }
-       else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1066E) {
-               ioc->prod_name = "LSISAS1066E";
-               ioc->bus_type = SAS;
-       }
        else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1068E) {
                ioc->prod_name = "LSISAS1068E";
                ioc->bus_type = SAS;
        }
+       else if (pdev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
+               ioc->prod_name = "LSISAS1078";
+               ioc->bus_type = SAS;
+       }
 
        if (ioc->errata_flag_1064)
                pci_disable_io_access(pdev);
@@ -1387,39 +1379,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        /* Set lookup ptr. */
        list_add_tail(&ioc->list, &ioc_list);
 
-       ioc->pci_irq = -1;
-       if (pdev->irq) {
-               if (mpt_msi_enable && !pci_enable_msi(pdev))
-                       printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n", ioc->name);
-
-               r = request_irq(pdev->irq, mpt_interrupt, SA_SHIRQ, ioc->name, ioc);
-
-               if (r < 0) {
-#ifndef __sparc__
-                       printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %d!\n",
-                                       ioc->name, pdev->irq);
-#else
-                       printk(MYIOC_s_ERR_FMT "Unable to allocate interrupt %s!\n",
-                                       ioc->name, __irq_itoa(pdev->irq));
-#endif
-                       list_del(&ioc->list);
-                       iounmap(mem);
-                       kfree(ioc);
-                       return -EBUSY;
-               }
-
-               ioc->pci_irq = pdev->irq;
-
-               pci_set_master(pdev);                   /* ?? */
-               pci_set_drvdata(pdev, ioc);
-
-#ifndef __sparc__
-               dprintk((KERN_INFO MYNAM ": %s installed at interrupt %d\n", ioc->name, pdev->irq));
-#else
-               dprintk((KERN_INFO MYNAM ": %s installed at interrupt %s\n", ioc->name, __irq_itoa(pdev->irq)));
-#endif
-       }
-
        /* Check for "bound ports" (929, 929X, 1030, 1035) to reduce redundant resets.
         */
        mpt_detect_bound_ports(ioc, pdev);
@@ -1431,9 +1390,6 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                  ioc->name, r);
 
                list_del(&ioc->list);
-               free_irq(ioc->pci_irq, ioc);
-               if (mpt_msi_enable)
-                       pci_disable_msi(pdev);
                if (ioc->alt_ioc)
                        ioc->alt_ioc->alt_ioc = NULL;
                iounmap(mem);
@@ -1473,10 +1429,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_detach - Remove a PCI intelligent MPT adapter.
  *     @pdev: Pointer to pci_dev structure
- *
  */
 
 void
@@ -1522,10 +1477,10 @@ mpt_detach(struct pci_dev *pdev)
  */
 #ifdef CONFIG_PM
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_suspend - Fusion MPT base driver suspend routine.
- *
- *
+ *     @pdev: Pointer to pci_dev structure
+ *     @state: new state to enter
  */
 int
 mpt_suspend(struct pci_dev *pdev, pm_message_t state)
@@ -1561,10 +1516,9 @@ mpt_suspend(struct pci_dev *pdev, pm_message_t state)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_resume - Fusion MPT base driver resume routine.
- *
- *
+ *     @pdev: Pointer to pci_dev structure
  */
 int
 mpt_resume(struct pci_dev *pdev)
@@ -1622,7 +1576,7 @@ mpt_signal_reset(int index, MPT_ADAPTER *ioc, int reset_phase)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_do_ioc_recovery - Initialize or recover MPT adapter.
  *     @ioc: Pointer to MPT adapter structure
  *     @reason: Event word / reason
@@ -1652,6 +1606,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
        int      handlers;
        int      ret = 0;
        int      reset_alt_ioc_active = 0;
+       int      irq_allocated = 0;
 
        printk(KERN_INFO MYNAM ": Initiating %s %s\n",
                        ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");
@@ -1735,6 +1690,36 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                }
        }
 
+       /*
+        * Device is reset now. It must have de-asserted the interrupt line
+        * (if it was asserted) and it should be safe to register for the
+        * interrupt now.
+        */
+       if ((ret == 0) && (reason == MPT_HOSTEVENT_IOC_BRINGUP)) {
+               ioc->pci_irq = -1;
+               if (ioc->pcidev->irq) {
+                       if (mpt_msi_enable && !pci_enable_msi(ioc->pcidev))
+                               printk(MYIOC_s_INFO_FMT "PCI-MSI enabled\n",
+                                       ioc->name);
+                       rc = request_irq(ioc->pcidev->irq, mpt_interrupt,
+                                       IRQF_SHARED, ioc->name, ioc);
+                       if (rc < 0) {
+                               printk(MYIOC_s_ERR_FMT "Unable to allocate "
+                                       "interrupt %d!\n", ioc->name,
+                                       ioc->pcidev->irq);
+                               if (mpt_msi_enable)
+                                       pci_disable_msi(ioc->pcidev);
+                               return -EBUSY;
+                       }
+                       irq_allocated = 1;
+                       ioc->pci_irq = ioc->pcidev->irq;
+                       pci_set_master(ioc->pcidev);            /* ?? */
+                       pci_set_drvdata(ioc->pcidev, ioc);
+                       dprintk((KERN_INFO MYNAM ": %s installed at interrupt "
+                               "%d\n", ioc->name, ioc->pcidev->irq));
+               }
+       }
+
        /* Prime reply & request queues!
         * (mucho alloc's) Must be done prior to
         * init as upper addresses are needed for init.
@@ -1784,9 +1769,9 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                                                 * chips (mpt_adapter_disable,
                                                 * mpt_diag_reset)
                                                 */
-                                               ioc->cached_fw = NULL;
                                                ddlprintk((MYIOC_s_INFO_FMT ": mpt_upload:  alt_%s has cached_fw=%p \n",
                                                        ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw));
+                                               ioc->alt_ioc->cached_fw = NULL;
                                        }
                                } else {
                                        printk(KERN_WARNING MYNAM ": firmware upload failure!\n");
@@ -1834,7 +1819,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                                ret = mptbase_sas_persist_operation(ioc,
                                    MPI_SAS_OP_CLEAR_NOT_PRESENT);
                                if(ret != 0)
-                                       return -1;
+                                       goto out;
                        }
 
                        /* Find IM volumes
@@ -1842,14 +1827,6 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                        mpt_findImVolumes(ioc);
 
                } else if (ioc->bus_type == FC) {
-                       /*
-                        *  Pre-fetch FC port WWN and stuff...
-                        *  (FCPortPage0_t stuff)
-                        */
-                       for (ii=0; ii < ioc->facts.NumberOfPorts; ii++) {
-                               (void) mptbase_GetFcPortPage0(ioc, ii);
-                       }
-
                        if ((ioc->pfacts[0].ProtocolFlags & MPI_PORTFACTS_PROTOCOL_LAN) &&
                            (ioc->lan_cnfg_page0.Header.PageLength == 0)) {
                                /*
@@ -1915,17 +1892,25 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                /* FIXME?  Examine results here? */
        }
 
+ out:
+       if ((ret != 0) && irq_allocated) {
+               free_irq(ioc->pci_irq, ioc);
+               if (mpt_msi_enable)
+                       pci_disable_msi(ioc->pcidev);
+       }
        return ret;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mpt_detect_bound_ports - Search for PCI bus/dev_function
- *     which matches PCI bus/dev_function (+/-1) for newly discovered 929,
- *     929X, 1030 or 1035.
+/**
+ *     mpt_detect_bound_ports - Search for matching PCI bus/dev_function
  *     @ioc: Pointer to MPT adapter structure
  *     @pdev: Pointer to (struct pci_dev) structure
  *
+ *     Search for PCI bus/dev_function which matches
+ *     PCI bus/dev_function (+/-1) for newly discovered 929,
+ *     929X, 1030 or 1035.
+ *
  *     If match on PCI dev_function +/-1 is found, bind the two MPT adapters
  *     using alt_ioc pointer fields in their %MPT_ADAPTER structures.
  */
@@ -1972,9 +1957,9 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_adapter_disable - Disable misbehaving MPT adapter.
- *     @this: Pointer to MPT adapter structure
+ *     @ioc: Pointer to MPT adapter structure
  */
 static void
 mpt_adapter_disable(MPT_ADAPTER *ioc)
@@ -2073,9 +2058,8 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mpt_adapter_dispose - Free all resources associated with a MPT
- *     adapter.
+/**
+ *     mpt_adapter_dispose - Free all resources associated with an MPT adapter
  *     @ioc: Pointer to MPT adapter structure
  *
  *     This routine unregisters h/w resources and frees all alloc'd memory
@@ -2126,8 +2110,8 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     MptDisplayIocCapabilities - Disply IOC's capacilities.
+/**
+ *     MptDisplayIocCapabilities - Disply IOC's capabilities.
  *     @ioc: Pointer to MPT adapter structure
  */
 static void
@@ -2169,7 +2153,7 @@ MptDisplayIocCapabilities(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     MakeIocReady - Get IOC to a READY state, using KickStart if needed.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @force: Force hard KickStart of IOC
@@ -2289,7 +2273,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
                }
 
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible(1);
+                       msleep(1);
                } else {
                        mdelay (1);     /* 1 msec delay */
                }
@@ -2306,7 +2290,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_GetIocState - Get the current state of a MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @cooked: Request raw or cooked IOC state
@@ -2331,7 +2315,7 @@ mpt_GetIocState(MPT_ADAPTER *ioc, int cooked)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     GetIocFacts - Send IOCFacts request to MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @sleepFlag: Specifies whether the process can sleep
@@ -2505,7 +2489,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     GetPortFacts - Send PortFacts request to MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @portnum: Port number
@@ -2572,7 +2556,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     SendIocInit - Send IOCInit request to MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @sleepFlag: Specifies whether the process can sleep
@@ -2657,7 +2641,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
        }
 
        /* No need to byte swap the multibyte fields in the reply
-        * since we don't even look at it's contents.
+        * since we don't even look at its contents.
         */
 
        dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n",
@@ -2677,7 +2661,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
        state = mpt_GetIocState(ioc, 1);
        while (state != MPI_IOC_STATE_OPERATIONAL && --cntdn) {
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible(1);
+                       msleep(1);
                } else {
                        mdelay(1);
                }
@@ -2694,11 +2678,12 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
        dinitprintk((MYIOC_s_INFO_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n",
                        ioc->name, count));
 
+       ioc->aen_event_read_flag=0;
        return r;
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     SendPortEnable - Send PortEnable request to MPT adapter port.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @portnum: Port number to enable
@@ -2749,9 +2734,13 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
        return rc;
 }
 
-/*
- *     ioc: Pointer to MPT_ADAPTER structure
- *      size - total FW bytes
+/**
+ *     mpt_alloc_fw_memory - allocate firmware memory
+ *     @ioc: Pointer to MPT_ADAPTER structure
+ *      @size: total FW bytes
+ *
+ *     If memory has already been allocated, the same (cached) value
+ *     is returned.
  */
 void
 mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size)
@@ -2761,14 +2750,19 @@ mpt_alloc_fw_memory(MPT_ADAPTER *ioc, int size)
        if (ioc->alt_ioc && ioc->alt_ioc->cached_fw) {
                ioc->cached_fw = ioc->alt_ioc->cached_fw;  /* use alt_ioc's memory */
                ioc->cached_fw_dma = ioc->alt_ioc->cached_fw_dma;
+               ioc->alloc_total += size;
+               ioc->alt_ioc->alloc_total -= size;
        } else {
                if ( (ioc->cached_fw = pci_alloc_consistent(ioc->pcidev, size, &ioc->cached_fw_dma) ) )
                        ioc->alloc_total += size;
        }
 }
-/*
- * If alt_img is NULL, delete from ioc structure.
- * Else, delete a secondary image in same format.
+/**
+ *     mpt_free_fw_memory - free firmware memory
+ *     @ioc: Pointer to MPT_ADAPTER structure
+ *
+ *     If alt_img is NULL, delete from ioc structure.
+ *     Else, delete a secondary image in same format.
  */
 void
 mpt_free_fw_memory(MPT_ADAPTER *ioc)
@@ -2787,7 +2781,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
 
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_do_upload - Construct and Send FWUpload request to MPT adapter port.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @sleepFlag: Specifies whether the process can sleep
@@ -2889,10 +2883,10 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_downloadboot - DownloadBoot code
  *     @ioc: Pointer to MPT_ADAPTER structure
- *     @flag: Specify which part of IOC memory is to be uploaded.
+ *     @pFwHeader: Pointer to firmware header info
  *     @sleepFlag: Specifies whether the process can sleep
  *
  *     FwDownloadBoot requires Programmed IO access.
@@ -2929,7 +2923,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
 
        /* wait 1 msec */
        if (sleepFlag == CAN_SLEEP) {
-               msleep_interruptible(1);
+               msleep(1);
        } else {
                mdelay (1);
        }
@@ -2946,7 +2940,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                }
                /* wait .1 sec */
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (100);
+                       msleep (100);
                } else {
                        mdelay (100);
                }
@@ -3036,7 +3030,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
 
                /* wait 1 msec */
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (1);
+                       msleep (1);
                } else {
                        mdelay (1);
                }
@@ -3084,7 +3078,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                        return 0;
                }
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (10);
+                       msleep (10);
                } else {
                        mdelay (10);
                }
@@ -3095,7 +3089,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     KickStart - Perform hard reset of MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @force: Force hard reset
@@ -3135,7 +3129,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
                SendIocReset(ioc, MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET, sleepFlag);
 
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (1000);
+                       msleep (1000);
                } else {
                        mdelay (1000);
                }
@@ -3157,7 +3151,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
                        return hard_reset_done;
                }
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (10);
+                       msleep (10);
                } else {
                        mdelay (10);
                }
@@ -3169,12 +3163,12 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_diag_reset - Perform hard reset of the adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @ignore: Set if to honor and clear to ignore
  *             the reset history bit
- *     @sleepflag: CAN_SLEEP if called in a non-interrupt thread,
+ *     @sleepFlag: CAN_SLEEP if called in a non-interrupt thread,
  *             else set to NO_SLEEP (use mdelay instead)
  *
  *     This routine places the adapter in diagnostic mode via the
@@ -3190,6 +3184,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
 static int
 mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 {
+       MPT_ADAPTER     *iocp=NULL;
        u32 diag0val;
        u32 doorbell;
        int hard_reset_done = 0;
@@ -3198,6 +3193,37 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
        u32 diag1val = 0;
 #endif
 
+       if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
+               drsprintk((MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
+                       "address=%p\n",  ioc->name, __FUNCTION__,
+                       &ioc->chip->Doorbell, &ioc->chip->Reset_1078));
+               CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
+               if (sleepFlag == CAN_SLEEP)
+                       msleep(1);
+               else
+                       mdelay(1);
+
+               for (count = 0; count < 60; count ++) {
+                       doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
+                       doorbell &= MPI_IOC_STATE_MASK;
+
+                       drsprintk((MYIOC_s_INFO_FMT
+                               "looking for READY STATE: doorbell=%x"
+                               " count=%d\n",
+                               ioc->name, doorbell, count));
+                       if (doorbell == MPI_IOC_STATE_READY) {
+                               return 0;
+                       }
+
+                       /* wait 1 sec */
+                       if (sleepFlag == CAN_SLEEP)
+                               msleep(1000);
+                       else
+                               mdelay(1000);
+               }
+               return -1;
+       }
+
        /* Clear any existing interrupts */
        CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
 
@@ -3228,7 +3254,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 
                        /* wait 100 msec */
                        if (sleepFlag == CAN_SLEEP) {
-                               msleep_interruptible (100);
+                               msleep (100);
                        } else {
                                mdelay (100);
                        }
@@ -3294,26 +3320,32 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                        /* FIXME?  Examine results here? */
                }
 
-               if (ioc->cached_fw) {
+               if (ioc->cached_fw)
+                       iocp = ioc;
+               else if (ioc->alt_ioc && ioc->alt_ioc->cached_fw)
+                       iocp = ioc->alt_ioc;
+               if (iocp) {
                        /* If the DownloadBoot operation fails, the
                         * IOC will be left unusable. This is a fatal error
                         * case.  _diag_reset will return < 0
                         */
                        for (count = 0; count < 30; count ++) {
-                               diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
+                               diag0val = CHIPREG_READ32(&iocp->chip->Diagnostic);
                                if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
                                        break;
                                }
 
+                               dprintk((MYIOC_s_INFO_FMT "cached_fw: diag0val=%x count=%d\n",
+                                       iocp->name, diag0val, count));
                                /* wait 1 sec */
                                if (sleepFlag == CAN_SLEEP) {
-                                       msleep_interruptible (1000);
+                                       msleep (1000);
                                } else {
                                        mdelay (1000);
                                }
                        }
                        if ((count = mpt_downloadboot(ioc,
-                               (MpiFwHeader_t *)ioc->cached_fw, sleepFlag)) < 0) {
+                               (MpiFwHeader_t *)iocp->cached_fw, sleepFlag)) < 0) {
                                printk(KERN_WARNING MYNAM
                                        ": firmware downloadboot failure (%d)!\n", count);
                        }
@@ -3335,7 +3367,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 
                                /* wait 1 sec */
                                if (sleepFlag == CAN_SLEEP) {
-                                       msleep_interruptible (1000);
+                                       msleep (1000);
                                } else {
                                        mdelay (1000);
                                }
@@ -3369,7 +3401,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 
                /* wait 100 msec */
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible (100);
+                       msleep (100);
                } else {
                        mdelay (100);
                }
@@ -3422,11 +3454,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     SendIocReset - Send IOCReset request to MPT adapter.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @reset_type: reset type, expected values are
  *     %MPI_FUNCTION_IOC_MESSAGE_UNIT_RESET or %MPI_FUNCTION_IO_UNIT_RESET
+ *     @sleepFlag: Specifies whether the process can sleep
  *
  *     Send IOCReset request to the MPT adapter.
  *
@@ -3463,7 +3496,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
                }
 
                if (sleepFlag == CAN_SLEEP) {
-                       msleep_interruptible(1);
+                       msleep(1);
                } else {
                        mdelay (1);     /* 1 msec delay */
                }
@@ -3480,11 +3513,12 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     initChainBuffers - Allocate memory for and initialize
- *     chain buffers, chain buffer control arrays and spinlock.
- *     @hd: Pointer to MPT_SCSI_HOST structure
- *     @init: If set, initialize the spin lock.
+/**
+ *     initChainBuffers - Allocate memory for and initialize chain buffers
+ *     @ioc: Pointer to MPT_ADAPTER structure
+ *
+ *     Allocates memory for and initializes chain buffers,
+ *     chain buffer control arrays and spinlock.
  */
 static int
 initChainBuffers(MPT_ADAPTER *ioc)
@@ -3580,7 +3614,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     PrimeIocFifos - Initialize IOC request and reply FIFOs.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *
@@ -3877,15 +3911,15 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     WaitForDoorbellAck - Wait for IOC to clear the IOP_DOORBELL_STATUS bit
- *     in it's IntStatus register.
+/**
+ *     WaitForDoorbellAck - Wait for IOC doorbell handshake acknowledge
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @howlong: How long to wait (in seconds)
  *     @sleepFlag: Specifies whether the process can sleep
  *
  *     This routine waits (up to ~2 seconds max) for IOC doorbell
- *     handshake ACKnowledge.
+ *     handshake ACKnowledge, indicated by the IOP_DOORBELL_STATUS
+ *     bit in its IntStatus register being clear.
  *
  *     Returns a negative value on failure, else wait loop count.
  */
@@ -3900,18 +3934,18 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 
        if (sleepFlag == CAN_SLEEP) {
                while (--cntdn) {
+                       msleep (1);
                        intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
                        if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
                                break;
-                       msleep_interruptible (1);
                        count++;
                }
        } else {
                while (--cntdn) {
+                       mdelay (1);
                        intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
                        if (! (intstat & MPI_HIS_IOP_DOORBELL_STATUS))
                                break;
-                       mdelay (1);
                        count++;
                }
        }
@@ -3928,14 +3962,14 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     WaitForDoorbellInt - Wait for IOC to set the HIS_DOORBELL_INTERRUPT bit
- *     in it's IntStatus register.
+/**
+ *     WaitForDoorbellInt - Wait for IOC to set its doorbell interrupt bit
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @howlong: How long to wait (in seconds)
  *     @sleepFlag: Specifies whether the process can sleep
  *
- *     This routine waits (up to ~2 seconds max) for IOC doorbell interrupt.
+ *     This routine waits (up to ~2 seconds max) for IOC doorbell interrupt
+ *     (MPI_HIS_DOORBELL_INTERRUPT) to be set in the IntStatus register.
  *
  *     Returns a negative value on failure, else wait loop count.
  */
@@ -3952,7 +3986,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
                        intstat = CHIPREG_READ32(&ioc->chip->IntStatus);
                        if (intstat & MPI_HIS_DOORBELL_INTERRUPT)
                                break;
-                       msleep_interruptible(1);
+                       msleep(1);
                        count++;
                }
        } else {
@@ -3977,8 +4011,8 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     WaitForDoorbellReply - Wait for and capture a IOC handshake reply.
+/**
+ *     WaitForDoorbellReply - Wait for and capture an IOC handshake reply.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @howlong: How long to wait (in seconds)
  *     @sleepFlag: Specifies whether the process can sleep
@@ -4063,7 +4097,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     GetLanConfigPages - Fetch LANConfig pages.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *
@@ -4174,114 +4208,9 @@ GetLanConfigPages(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mptbase_GetFcPortPage0 - Fetch FCPort config Page0.
- *     @ioc: Pointer to MPT_ADAPTER structure
- *     @portnum: IOC Port number
- *
- *     Return: 0 for success
- *     -ENOMEM if no memory available
- *             -EPERM if not allowed due to ISR context
- *             -EAGAIN if no msg frames currently available
- *             -EFAULT for non-successful reply or no reply (timeout)
- */
-int
-mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
-{
-       ConfigPageHeader_t       hdr;
-       CONFIGPARMS              cfg;
-       FCPortPage0_t           *ppage0_alloc;
-       FCPortPage0_t           *pp0dest;
-       dma_addr_t               page0_dma;
-       int                      data_sz;
-       int                      copy_sz;
-       int                      rc;
-       int                      count = 400;
-
-
-       /* Get FCPort Page 0 header */
-       hdr.PageVersion = 0;
-       hdr.PageLength = 0;
-       hdr.PageNumber = 0;
-       hdr.PageType = MPI_CONFIG_PAGETYPE_FC_PORT;
-       cfg.cfghdr.hdr = &hdr;
-       cfg.physAddr = -1;
-       cfg.action = MPI_CONFIG_ACTION_PAGE_HEADER;
-       cfg.dir = 0;
-       cfg.pageAddr = portnum;
-       cfg.timeout = 0;
-
-       if ((rc = mpt_config(ioc, &cfg)) != 0)
-               return rc;
-
-       if (hdr.PageLength == 0)
-               return 0;
-
-       data_sz = hdr.PageLength * 4;
-       rc = -ENOMEM;
-       ppage0_alloc = (FCPortPage0_t *) pci_alloc_consistent(ioc->pcidev, data_sz, &page0_dma);
-       if (ppage0_alloc) {
-
- try_again:
-               memset((u8 *)ppage0_alloc, 0, data_sz);
-               cfg.physAddr = page0_dma;
-               cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
-
-               if ((rc = mpt_config(ioc, &cfg)) == 0) {
-                       /* save the data */
-                       pp0dest = &ioc->fc_port_page0[portnum];
-                       copy_sz = min_t(int, sizeof(FCPortPage0_t), data_sz);
-                       memcpy(pp0dest, ppage0_alloc, copy_sz);
-
-                       /*
-                        *      Normalize endianness of structure data,
-                        *      by byte-swapping all > 1 byte fields!
-                        */
-                       pp0dest->Flags = le32_to_cpu(pp0dest->Flags);
-                       pp0dest->PortIdentifier = le32_to_cpu(pp0dest->PortIdentifier);
-                       pp0dest->WWNN.Low = le32_to_cpu(pp0dest->WWNN.Low);
-                       pp0dest->WWNN.High = le32_to_cpu(pp0dest->WWNN.High);
-                       pp0dest->WWPN.Low = le32_to_cpu(pp0dest->WWPN.Low);
-                       pp0dest->WWPN.High = le32_to_cpu(pp0dest->WWPN.High);
-                       pp0dest->SupportedServiceClass = le32_to_cpu(pp0dest->SupportedServiceClass);
-                       pp0dest->SupportedSpeeds = le32_to_cpu(pp0dest->SupportedSpeeds);
-                       pp0dest->CurrentSpeed = le32_to_cpu(pp0dest->CurrentSpeed);
-                       pp0dest->MaxFrameSize = le32_to_cpu(pp0dest->MaxFrameSize);
-                       pp0dest->FabricWWNN.Low = le32_to_cpu(pp0dest->FabricWWNN.Low);
-                       pp0dest->FabricWWNN.High = le32_to_cpu(pp0dest->FabricWWNN.High);
-                       pp0dest->FabricWWPN.Low = le32_to_cpu(pp0dest->FabricWWPN.Low);
-                       pp0dest->FabricWWPN.High = le32_to_cpu(pp0dest->FabricWWPN.High);
-                       pp0dest->DiscoveredPortsCount = le32_to_cpu(pp0dest->DiscoveredPortsCount);
-                       pp0dest->MaxInitiators = le32_to_cpu(pp0dest->MaxInitiators);
-
-                       /*
-                        * if still doing discovery,
-                        * hang loose a while until finished
-                        */
-                       if (pp0dest->PortState == MPI_FCPORTPAGE0_PORTSTATE_UNKNOWN) {
-                               if (count-- > 0) {
-                                       msleep_interruptible(100);
-                                       goto try_again;
-                               }
-                               printk(MYIOC_s_INFO_FMT "Firmware discovery not"
-                                                       " complete.\n",
-                                               ioc->name);
-                       }
-               }
-
-               pci_free_consistent(ioc->pcidev, data_sz, (u8 *) ppage0_alloc, page0_dma);
-       }
-
-       return rc;
-}
-
-/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mptbase_sas_persist_operation - Perform operation on SAS Persitent Table
+/**
+ *     mptbase_sas_persist_operation - Perform operation on SAS Persistent Table
  *     @ioc: Pointer to MPT_ADAPTER structure
- *     @sas_address: 64bit SAS Address for operation.
- *     @target_id: specified target for operation
- *     @bus: specified bus for operation
  *     @persist_opcode: see below
  *
  *     MPI_SAS_OP_CLEAR_NOT_PRESENT - Free all persist TargetID mappings for
@@ -4290,7 +4219,7 @@ mptbase_GetFcPortPage0(MPT_ADAPTER *ioc, int portnum)
  *
  *     NOTE: Don't use not this function during interrupt time.
  *
- *     Returns: 0 for success, non-zero error
+ *     Returns 0 for success, non-zero error
  */
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -4487,7 +4416,7 @@ mptbase_raid_process_event_data(MPT_ADAPTER *ioc,
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     GetIoUnitPage2 - Retrieve BIOS version and boot order information.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *
@@ -4545,7 +4474,8 @@ GetIoUnitPage2(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*     mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2
+/**
+ *     mpt_GetScsiPortSettings - read SCSI Port Page 0 and 2
  *     @ioc: Pointer to a Adapter Strucutre
  *     @portnum: IOC port number
  *
@@ -4732,7 +4662,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*     mpt_readScsiDevicePageHeaders - save version and length of SDP1
+/**
+ *     mpt_readScsiDevicePageHeaders - save version and length of SDP1
  *     @ioc: Pointer to a Adapter Strucutre
  *     @portnum: IOC port number
  *
@@ -4978,6 +4909,7 @@ mpt_read_ioc_pg_4(MPT_ADAPTER *ioc)
                pIoc4 = pci_alloc_consistent(ioc->pcidev, iocpage4sz, &ioc4_dma);
                if (!pIoc4)
                        return;
+               ioc->alloc_total += iocpage4sz;
        } else {
                ioc4_dma = ioc->spi_data.IocPg4_dma;
                iocpage4sz = ioc->spi_data.IocPg4Sz;
@@ -4994,6 +4926,7 @@ mpt_read_ioc_pg_4(MPT_ADAPTER *ioc)
        } else {
                pci_free_consistent(ioc->pcidev, iocpage4sz, pIoc4, ioc4_dma);
                ioc->spi_data.pIocPg4 = NULL;
+               ioc->alloc_total -= iocpage4sz;
        }
 }
 
@@ -5082,9 +5015,8 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     SendEventNotification - Send EventNotification (on or off) request
- *     to MPT adapter.
+/**
+ *     SendEventNotification - Send EventNotification (on or off) request to adapter
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @EvSwitch: Event switch flags
  */
@@ -5125,19 +5057,18 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
        EventAck_t      *pAck;
 
        if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
-               printk(MYIOC_s_WARN_FMT "Unable to allocate event ACK "
-                       "request frame for Event=%x EventContext=%x EventData=%x!\n",
-                       ioc->name, evnp->Event, le32_to_cpu(evnp->EventContext),
-                       le32_to_cpu(evnp->Data[0]));
+               dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
+                   ioc->name,__FUNCTION__));
                return -1;
        }
-       memset(pAck, 0, sizeof(*pAck));
 
-       dprintk((MYIOC_s_INFO_FMT "Sending EventAck\n", ioc->name));
+       devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventAck\n", ioc->name));
 
        pAck->Function     = MPI_FUNCTION_EVENT_ACK;
        pAck->ChainOffset  = 0;
+       pAck->Reserved[0]  = pAck->Reserved[1] = 0;
        pAck->MsgFlags     = 0;
+       pAck->Reserved1[0] = pAck->Reserved1[1] = pAck->Reserved1[2] = 0;
        pAck->Event        = evnp->Event;
        pAck->EventContext = evnp->EventContext;
 
@@ -5149,8 +5080,8 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *     mpt_config - Generic function to issue config message
- *     @ioc - Pointer to an adapter structure
- *     @cfg - Pointer to a configuration structure. Struct contains
+ *     @ioc:   Pointer to an adapter structure
+ *     @pCfg:  Pointer to a configuration structure. Struct contains
  *             action, page address, direction, physical address
  *             and pointer to a configuration page header
  *             Page header is updated.
@@ -5275,8 +5206,8 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     mpt_timer_expired - Call back for timer process.
+/**
+ *     mpt_timer_expired - Callback for timer process.
  *     Used only internal config functionality.
  *     @data: Pointer to MPT_SCSI_HOST recast as an unsigned long
  */
@@ -5301,12 +5232,12 @@ mpt_timer_expired(unsigned long data)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_ioc_reset - Base cleanup for hard reset
  *     @ioc: Pointer to the adapter structure
  *     @reset_phase: Indicates pre- or post-reset functionality
  *
- *     Remark: Free's resources with internally generated commands.
+ *     Remark: Frees resources with internally generated commands.
  */
 static int
 mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
@@ -5358,7 +5289,7 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
  *     procfs (%MPT_PROCFS_MPTBASEDIR/...) support stuff...
  */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     procmpt_create - Create %MPT_PROCFS_MPTBASEDIR entries.
  *
  *     Returns 0 for success, non-zero for failure.
@@ -5384,7 +5315,7 @@ procmpt_create(void)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     procmpt_destroy - Tear down %MPT_PROCFS_MPTBASEDIR entries.
  *
  *     Returns 0 for success, non-zero for failure.
@@ -5398,16 +5329,16 @@ procmpt_destroy(void)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     procmpt_summary_read - Handle read request from /proc/mpt/summary
- *     or from /proc/mpt/iocN/summary.
+/**
+ *     procmpt_summary_read - Handle read request of a summary file
  *     @buf: Pointer to area to write information
  *     @start: Pointer to start pointer
  *     @offset: Offset to start writing
- *     @request:
+ *     @request: Amount of read data requested
  *     @eof: Pointer to EOF integer
  *     @data: Pointer
  *
+ *     Handles read request from /proc/mpt/summary or /proc/mpt/iocN/summary.
  *     Returns number of characters written to process performing the read.
  */
 static int
@@ -5442,12 +5373,12 @@ procmpt_summary_read(char *buf, char **start, off_t offset, int request, int *eo
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     procmpt_version_read - Handle read request from /proc/mpt/version.
  *     @buf: Pointer to area to write information
  *     @start: Pointer to start pointer
  *     @offset: Offset to start writing
- *     @request:
+ *     @request: Amount of read data requested
  *     @eof: Pointer to EOF integer
  *     @data: Pointer
  *
@@ -5498,12 +5429,12 @@ procmpt_version_read(char *buf, char **start, off_t offset, int request, int *eo
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     procmpt_iocinfo_read - Handle read request from /proc/mpt/iocN/info.
  *     @buf: Pointer to area to write information
  *     @start: Pointer to start pointer
  *     @offset: Offset to start writing
- *     @request:
+ *     @request: Amount of read data requested
  *     @eof: Pointer to EOF integer
  *     @data: Pointer
  *
@@ -5648,11 +5579,7 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
                        a[5], a[4], a[3], a[2], a[1], a[0]);
        }
 
-#ifndef __sparc__
        y += sprintf(buffer+len+y, ", IRQ=%d", ioc->pci_irq);
-#else
-       y += sprintf(buffer+len+y, ", IRQ=%s", __irq_itoa(ioc->pci_irq));
-#endif
 
        if (!ioc->active)
                y += sprintf(buffer+len+y, " (disabled)");
@@ -5668,16 +5595,17 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
  */
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
- *     mpt_HardResetHandler - Generic reset handler, issue SCSI Task
- *     Management call based on input arg values.  If TaskMgmt fails,
- *     return associated SCSI request.
+ *     mpt_HardResetHandler - Generic reset handler
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @sleepFlag: Indicates if sleep or schedule must be called.
  *
+ *     Issues SCSI Task Management call based on input arg values.
+ *     If TaskMgmt fails, returns associated SCSI request.
+ *
  *     Remark: _HardResetHandler can be invoked from an interrupt thread (timer)
  *     or a non-interrupt thread.  In the former, must not call schedule().
  *
- *     Remark: A return of -1 is a FATAL error case, as it means a
+ *     Note: A return of -1 is a FATAL error case, as it means a
  *     FW reload/initialization failed.
  *
  *     Returns 0 for SUCCESS or -1 if FAILED.
@@ -5711,7 +5639,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
 
        /* The SCSI driver needs to adjust timeouts on all current
         * commands prior to the diagnostic reset being issued.
-        * Prevents timeouts occuring during a diagnostic reset...very bad.
+        * Prevents timeouts occurring during a diagnostic reset...very bad.
         * For all other protocol drivers, this is a no-op.
         */
        {
@@ -5803,9 +5731,9 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
                break;
        case MPI_EVENT_EVENT_CHANGE:
                if (evData0)
-                       ds = "Events(ON) Change";
+                       ds = "Events ON";
                else
-                       ds = "Events(OFF) Change";
+                       ds = "Events OFF";
                break;
        case MPI_EVENT_INTEGRATED_RAID:
        {
@@ -5876,8 +5804,27 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
                        break;
                case MPI_EVENT_SAS_DEV_STAT_RC_NO_PERSIST_ADDED:
                        snprintf(evStr, EVENT_DESCR_STR_SZ,
-                           "SAS Device Status Change: No Persistancy "
-                           "Added: id=%d", id);
+                           "SAS Device Status Change: No Persistancy: id=%d", id);
+                       break;
+               case MPI_EVENT_SAS_DEV_STAT_RC_INTERNAL_DEVICE_RESET:
+                       snprintf(evStr, EVENT_DESCR_STR_SZ,
+                           "SAS Device Status Change: Internal Device Reset : id=%d", id);
+                       break;
+               case MPI_EVENT_SAS_DEV_STAT_RC_TASK_ABORT_INTERNAL:
+                       snprintf(evStr, EVENT_DESCR_STR_SZ,
+                           "SAS Device Status Change: Internal Task Abort : id=%d", id);
+                       break;
+               case MPI_EVENT_SAS_DEV_STAT_RC_ABORT_TASK_SET_INTERNAL:
+                       snprintf(evStr, EVENT_DESCR_STR_SZ,
+                           "SAS Device Status Change: Internal Abort Task Set : id=%d", id);
+                       break;
+               case MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL:
+                       snprintf(evStr, EVENT_DESCR_STR_SZ,
+                           "SAS Device Status Change: Internal Clear Task Set : id=%d", id);
+                       break;
+               case MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL:
+                       snprintf(evStr, EVENT_DESCR_STR_SZ,
+                           "SAS Device Status Change: Internal Query Task : id=%d", id);
                        break;
                default:
                        snprintf(evStr, EVENT_DESCR_STR_SZ,
@@ -6007,13 +5954,14 @@ EventDescriptionStr(u8 event, u32 evData0, char *evStr)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
- *     ProcessEventNotification - Route a received EventNotificationReply to
- *     all currently regeistered event handlers.
+/**
+ *     ProcessEventNotification - Route EventNotificationReply to all event handlers
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @pEventReply: Pointer to EventNotification reply frame
  *     @evHandlers: Pointer to integer, number of event handlers
  *
+ *     Routes a received EventNotificationReply to all currently registered
+ *     event handlers.
  *     Returns sum of event handlers return values.
  */
 static int
@@ -6128,12 +6076,12 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_fc_log_info - Log information returned from Fibre Channel IOC.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @log_info: U32 LogInfo reply word from the IOC
  *
- *     Refer to lsi/fc_log.h.
+ *     Refer to lsi/mpi_log_fc.h.
  */
 static void
 mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info)
@@ -6149,7 +6097,7 @@ mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_spi_log_info - Log information returned from SCSI Parallel IOC.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @mr: Pointer to MPT reply frame
@@ -6230,8 +6178,10 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
                "Invalid SAS Address",                          /* 01h */
                NULL,                                           /* 02h */
                "Invalid Page",                                 /* 03h */
-               NULL,                                           /* 04h */
-               "Task Terminated"                               /* 05h */
+               "Diag Message Error",                           /* 04h */
+               "Task Terminated",                              /* 05h */
+               "Enclosure Management",                         /* 06h */
+               "Target Mode"                                   /* 07h */
        };
        static char *pl_code_str[] = {
                NULL,                                           /* 00h */
@@ -6255,9 +6205,9 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
                "Abort",                                        /* 12h */
                "IO Not Yet Executed",                          /* 13h */
                "IO Executed",                                  /* 14h */
-               "Persistant Reservation Out Not Affiliation Owner", /* 15h */
+               "Persistent Reservation Out Not Affiliation Owner", /* 15h */
                "Open Transmit DMA Abort",                      /* 16h */
-               NULL,                                           /* 17h */
+               "IO Device Missing Delay Retry",                /* 17h */
                NULL,                                           /* 18h */
                NULL,                                           /* 19h */
                NULL,                                           /* 1Ah */
@@ -6270,7 +6220,7 @@ mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info)
        };
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_sas_log_info - Log information returned from SAS IOC.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @log_info: U32 LogInfo reply word from the IOC
@@ -6325,7 +6275,7 @@ union loginfo_type {
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     mpt_sp_ioc_info - IOC information returned from SCSI Parallel IOC.
  *     @ioc: Pointer to MPT_ADAPTER structure
  *     @ioc_status: U32 IOCStatus word from IOC
@@ -6337,7 +6287,7 @@ static void
 mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
 {
        u32 status = ioc_status & MPI_IOCSTATUS_MASK;
-       char *desc = "";
+       char *desc = NULL;
 
        switch (status) {
        case MPI_IOCSTATUS_INVALID_FUNCTION: /* 0x0001 */
@@ -6447,7 +6397,7 @@ mpt_sp_ioc_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
                desc = "Others";
                break;
        }
-       if (desc != "")
+       if (desc != NULL)
                printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04x): %s\n", ioc->name, status, desc);
 }
 
@@ -6484,11 +6434,9 @@ EXPORT_SYMBOL(mpt_findImVolumes);
 EXPORT_SYMBOL(mpt_alloc_fw_memory);
 EXPORT_SYMBOL(mpt_free_fw_memory);
 EXPORT_SYMBOL(mptbase_sas_persist_operation);
-EXPORT_SYMBOL(mptbase_GetFcPortPage0);
-
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     fusion_init - Fusion MPT base driver initialization routine.
  *
  *     Returns 0 for success, non-zero for failure.
@@ -6528,7 +6476,7 @@ fusion_init(void)
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
-/*
+/**
  *     fusion_exit - Perform driver unload cleanup.
  *
  *     This routine frees all resources associated with each MPT adapter