[SCSI] mptfusion: misc fix's
[powerpc.git] / drivers / message / fusion / mptspi.c
index 09c745b..e4cc3dd 100644 (file)
@@ -83,10 +83,6 @@ static int mpt_saf_te = MPTSCSIH_SAF_TE;
 module_param(mpt_saf_te, int, 0);
 MODULE_PARM_DESC(mpt_saf_te, " Force enabling SEP Processor: enable=1  (default=MPTSCSIH_SAF_TE=0)");
 
-static int mpt_pq_filter = 0;
-module_param(mpt_pq_filter, int, 0);
-MODULE_PARM_DESC(mpt_pq_filter, " Enable peripheral qualifier filter: enable=1  (default=0)");
-
 static void mptspi_write_offset(struct scsi_target *, int);
 static void mptspi_write_width(struct scsi_target *, int);
 static int mptspi_write_spi_device_pg1(struct scsi_target *,
@@ -775,14 +771,80 @@ static struct spi_function_template mptspi_transport_functions = {
  */
 
 static struct pci_device_id mptspi_pci_table[] = {
-       { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C1030,
+       { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1030,
                PCI_ANY_ID, PCI_ANY_ID },
-       { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_1030_53C1035,
+       { PCI_VENDOR_ID_LSI_LOGIC, MPI_MANUFACTPAGE_DEVID_53C1035,
                PCI_ANY_ID, PCI_ANY_ID },
        {0}     /* Terminating entry */
 };
 MODULE_DEVICE_TABLE(pci, mptspi_pci_table);
 
+
+/*
+ * renegotiate for a given target
+ */
+static void
+mptspi_dv_renegotiate_work(void *data)
+{
+       struct work_queue_wrapper *wqw = (struct work_queue_wrapper *)data;
+       struct _MPT_SCSI_HOST *hd = wqw->hd;
+       struct scsi_device *sdev;
+
+       kfree(wqw);
+
+       shost_for_each_device(sdev, hd->ioc->sh)
+               mptspi_dv_device(hd, sdev);
+}
+
+static void
+mptspi_dv_renegotiate(struct _MPT_SCSI_HOST *hd)
+{
+       struct work_queue_wrapper *wqw = kmalloc(sizeof(*wqw), GFP_ATOMIC);
+
+       if (!wqw)
+               return;
+
+       INIT_WORK(&wqw->work, mptspi_dv_renegotiate_work, wqw);
+       wqw->hd = hd;
+
+       schedule_work(&wqw->work);
+}
+
+/*
+ * spi module reset handler
+ */
+static int
+mptspi_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
+{
+       struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata;
+       int rc;
+
+       rc = mptscsih_ioc_reset(ioc, reset_phase);
+
+       if (reset_phase == MPT_IOC_POST_RESET)
+               mptspi_dv_renegotiate(hd);
+
+       return rc;
+}
+
+#ifdef CONFIG_PM
+/*
+ * spi module resume handler
+ */
+static int
+mptspi_resume(struct pci_dev *pdev)
+{
+       MPT_ADAPTER     *ioc = pci_get_drvdata(pdev);
+       struct _MPT_SCSI_HOST *hd = (struct _MPT_SCSI_HOST *)ioc->sh->hostdata;
+       int rc;
+
+       rc = mptscsih_resume(pdev);
+       mptspi_dv_renegotiate(hd);
+
+       return rc;
+}
+#endif
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
@@ -981,14 +1043,12 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        hd->timer.function = mptscsih_timer_expired;
 
        ioc->spi_data.Saf_Te = mpt_saf_te;
-       hd->mpt_pq_filter = mpt_pq_filter;
 
        hd->negoNvram = MPT_SCSICFG_USE_NVRAM;
        ddvprintk((MYIOC_s_INFO_FMT
-               "saf_te %x mpt_pq_filter %x\n",
+               "saf_te %x\n",
                ioc->name,
-               mpt_saf_te,
-               mpt_pq_filter));
+               mpt_saf_te));
        ioc->spi_data.noQas = 0;
 
        init_waitqueue_head(&hd->scandv_waitq);
@@ -1032,7 +1092,7 @@ static struct pci_driver mptspi_driver = {
        .shutdown       = mptscsih_shutdown,
 #ifdef CONFIG_PM
        .suspend        = mptscsih_suspend,
-       .resume         = mptscsih_resume,
+       .resume         = mptspi_resume,
 #endif
 };
 
@@ -1061,7 +1121,7 @@ mptspi_init(void)
                  ": Registered for IOC event notifications\n"));
        }
 
-       if (mpt_reset_register(mptspiDoneCtx, mptscsih_ioc_reset) == 0) {
+       if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) {
                dprintk((KERN_INFO MYNAM
                  ": Registered for IOC reset notifications\n"));
        }