]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/lpfc/lpfc_init.c
[SCSI] lpfc 8.1.2: Fixed system panic in lpfc_sli_brdreset during dynamic add of...
[linux-2.6-omap-h63xx.git] / drivers / scsi / lpfc / lpfc_init.c
index 1ab3dac7b632b329f1e32305de3bbeb38d513adf..369487e8f45051f7c7538f7f04d6c5add33eb2bb 100644 (file)
@@ -370,6 +370,10 @@ lpfc_config_port_post(struct lpfc_hba * phba)
        if (psli->num_rings > 3)
                status |= HC_R3INT_ENA;
 
+       if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) &&
+           (phba->cfg_poll & DISABLE_FCP_RING_INT))
+               status &= ~(HC_R0INT_ENA << LPFC_FCP_RING);
+
        writel(status, phba->HCregaddr);
        readl(phba->HCregaddr); /* flush */
        spin_unlock_irq(phba->host->host_lock);
@@ -759,132 +763,139 @@ static void
 lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
 {
        lpfc_vpd_t *vp;
-       uint16_t dev_id;
-       uint8_t hdrtype;
-       char str[16];
+       uint16_t dev_id = phba->pcidev->device;
+       uint16_t dev_subid = phba->pcidev->subsystem_device;
+       uint8_t hdrtype = phba->pcidev->hdr_type;
+       char *model_str = "";
 
        vp = &phba->vpd;
-       pci_read_config_word(phba->pcidev, PCI_DEVICE_ID, &dev_id);
-       pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
 
        switch (dev_id) {
        case PCI_DEVICE_ID_FIREFLY:
-               strcpy(str, "LP6000 1");
+               model_str = "LP6000 1Gb PCI";
                break;
        case PCI_DEVICE_ID_SUPERFLY:
                if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3)
-                       strcpy(str, "LP7000 1");
+                       model_str = "LP7000 1Gb PCI";
                else
-                       strcpy(str, "LP7000E 1");
+                       model_str = "LP7000E 1Gb PCI";
                break;
        case PCI_DEVICE_ID_DRAGONFLY:
-               strcpy(str, "LP8000 1");
+               model_str = "LP8000 1Gb PCI";
                break;
        case PCI_DEVICE_ID_CENTAUR:
                if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID)
-                       strcpy(str, "LP9002 2");
+                       model_str = "LP9002 2Gb PCI";
                else
-                       strcpy(str, "LP9000 1");
+                       model_str = "LP9000 1Gb PCI";
                break;
        case PCI_DEVICE_ID_RFLY:
-               strcpy(str, "LP952 2");
+               model_str = "LP952 2Gb PCI";
                break;
        case PCI_DEVICE_ID_PEGASUS:
-               strcpy(str, "LP9802 2");
+               model_str = "LP9802 2Gb PCI-X";
                break;
        case PCI_DEVICE_ID_THOR:
                if (hdrtype == 0x80)
-                       strcpy(str, "LP10000DC 2");
+                       model_str = "LP10000DC 2Gb 2-port PCI-X";
                else
-                       strcpy(str, "LP10000 2");
+                       model_str = "LP10000 2Gb PCI-X";
                break;
        case PCI_DEVICE_ID_VIPER:
-               strcpy(str, "LPX1000 10");
+               model_str = "LPX1000 10Gb PCI-X";
                break;
        case PCI_DEVICE_ID_PFLY:
-               strcpy(str, "LP982 2");
+               model_str = "LP982 2Gb PCI-X";
                break;
        case PCI_DEVICE_ID_TFLY:
                if (hdrtype == 0x80)
-                       strcpy(str, "LP1050DC 2");
+                       model_str = "LP1050DC 2Gb 2-port PCI-X";
                else
-                       strcpy(str, "LP1050 2");
+                       model_str = "LP1050 2Gb PCI-X";
                break;
        case PCI_DEVICE_ID_HELIOS:
                if (hdrtype == 0x80)
-                       strcpy(str, "LP11002 4");
+                       model_str = "LP11002 4Gb 2-port PCI-X2";
                else
-                       strcpy(str, "LP11000 4");
+                       model_str = "LP11000 4Gb PCI-X2";
                break;
        case PCI_DEVICE_ID_HELIOS_SCSP:
-               strcpy(str, "LP11000-SP 4");
+               model_str = "LP11000-SP 4Gb PCI-X2";
                break;
        case PCI_DEVICE_ID_HELIOS_DCSP:
-               strcpy(str, "LP11002-SP 4");
+               model_str = "LP11002-SP 4Gb 2-port PCI-X2";
                break;
        case PCI_DEVICE_ID_NEPTUNE:
                if (hdrtype == 0x80)
-                       strcpy(str, "LPe1002 4");
+                       model_str = "LPe1002 4Gb 2-port";
                else
-                       strcpy(str, "LPe1000 4");
+                       model_str = "LPe1000 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_NEPTUNE_SCSP:
-               strcpy(str, "LPe1000-SP 4");
+               model_str = "LPe1000-SP 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_NEPTUNE_DCSP:
-               strcpy(str, "LPe1002-SP 4");
+               model_str = "LPe1002-SP 4Gb 2-port PCIe";
                break;
        case PCI_DEVICE_ID_BMID:
-               strcpy(str, "LP1150 4");
+               model_str = "LP1150 4Gb PCI-X2";
                break;
        case PCI_DEVICE_ID_BSMB:
-               strcpy(str, "LP111 4");
+               model_str = "LP111 4Gb PCI-X2";
                break;
        case PCI_DEVICE_ID_ZEPHYR:
                if (hdrtype == 0x80)
-                       strcpy(str, "LPe11002 4");
+                       model_str = "LPe11002 4Gb 2-port PCIe";
                else
-                       strcpy(str, "LPe11000 4");
+                       model_str = "LPe11000 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_ZEPHYR_SCSP:
-               strcpy(str, "LPe11000-SP 4");
+               model_str = "LPe11000-SP 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_ZEPHYR_DCSP:
-               strcpy(str, "LPe11002-SP 4");
+               model_str = "LPe11002-SP 4Gb 2-port PCIe";
                break;
        case PCI_DEVICE_ID_ZMID:
-               strcpy(str, "LPe1150 4");
+               model_str = "LPe1150 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_ZSMB:
-               strcpy(str, "LPe111 4");
+               model_str = "LPe111 4Gb PCIe";
                break;
        case PCI_DEVICE_ID_LP101:
-               strcpy(str, "LP101 2");
+               model_str = "LP101 2Gb PCI-X";
                break;
        case PCI_DEVICE_ID_LP10000S:
-               strcpy(str, "LP10000-S 2");
-               break;
-       default:
-               memset(str, 0, 16);
+               model_str = "LP10000-S 2Gb PCI";
                break;
        case PCI_DEVICE_ID_LP11000S:
-               if (hdrtype == 0x80)
-                       strcpy(str, "LP11002-S 4");
-               else
-                       strcpy(str, "LP11000-S 4");
-               break;
        case PCI_DEVICE_ID_LPE11000S:
-               if (hdrtype == 0x80)
-                       strcpy(str, "LPe11002-S 4");
-               else
-                       strcpy(str, "LPe11000-S 4");
+               switch (dev_subid) {
+               case PCI_SUBSYSTEM_ID_LP11000S:
+                       model_str = "LP11002-S 4Gb PCI-X2";
+                       break;
+               case PCI_SUBSYSTEM_ID_LP11002S:
+                       model_str = "LP11000-S 4Gb 2-port PCI-X2";
+                       break;
+               case PCI_SUBSYSTEM_ID_LPE11000S:
+                       model_str = "LPe11002-S 4Gb PCIe";
+                       break;
+               case PCI_SUBSYSTEM_ID_LPE11002S:
+                       model_str = "LPe11002-S 4Gb 2-port PCIe";
+                       break;
+               case PCI_SUBSYSTEM_ID_LPE11010S:
+                       model_str = "LPe11010-S 4Gb 10-port PCIe";
+                       break;
+               default:
+                       break;
+               }
+               break;
+       default:
                break;
        }
        if (mdp)
-               sscanf(str, "%s", mdp);
+               sscanf(model_str, "%s", mdp);
        if (descp)
-               sprintf(descp, "Emulex LightPulse %s Gigabit PCI Fibre "
-                       "Channel Adapter", str);
+               sprintf(descp, "Emulex %s Fibre Channel Adapter", model_str);
 }
 
 /**************************************************/
@@ -1226,6 +1237,7 @@ lpfc_stop_timer(struct lpfc_hba * phba)
                }
        }
 
+       del_timer_sync(&phba->fcp_poll_timer);
        del_timer_sync(&phba->fc_estabtmo);
        del_timer_sync(&phba->fc_disctmo);
        del_timer_sync(&phba->fc_fdmitmo);
@@ -1405,6 +1417,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        psli->mbox_tmo.function = lpfc_mbox_timeout;
        psli->mbox_tmo.data = (unsigned long)phba;
 
+       init_timer(&phba->fcp_poll_timer);
+       phba->fcp_poll_timer.function = lpfc_poll_timeout;
+       phba->fcp_poll_timer.data = (unsigned long)phba;
+
        /*
         * Get all the module params for configuring this host and then
         * establish the host parameters.
@@ -1446,9 +1462,23 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        phba->pci_bar2_map = pci_resource_start(phba->pcidev, 2);
        bar2map_len        = pci_resource_len(phba->pcidev, 2);
 
-       /* Map HBA SLIM and Control Registers to a kernel virtual address. */
+       /* Map HBA SLIM to a kernel virtual address. */
        phba->slim_memmap_p      = ioremap(phba->pci_bar0_map, bar0map_len);
+       if (!phba->slim_memmap_p) {
+               error = -ENODEV;
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "ioremap failed for SLIM memory.\n");
+               goto out_idr_remove;
+       }
+
+       /* Map HBA Control Registers to a kernel virtual address. */
        phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len);
+       if (!phba->ctrl_regs_memmap_p) {
+               error = -ENODEV;
+               dev_printk(KERN_ERR, &pdev->dev,
+                          "ioremap failed for HBA control registers.\n");
+               goto out_iounmap_slim;
+       }
 
        /* Allocate memory for SLI-2 structures */
        phba->slim2p = dma_alloc_coherent(&phba->pcidev->dev, SLI2_SLIM_SIZE,
@@ -1519,6 +1549,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        host->max_cmd_len = 16;
 
        /* Initialize the list of scsi buffers used by driver for scsi IO. */
+       spin_lock_init(&phba->scsi_buf_list_lock);
        INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list);
 
        host->transportt = lpfc_transport_template;
@@ -1550,6 +1581,12 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        if (error)
                goto out_free_irq;
 
+       if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
+               spin_lock_irq(phba->host->host_lock);
+               lpfc_poll_start_timer(phba);
+               spin_unlock_irq(phba->host->host_lock);
+       }
+
        /*
         * set fixed host attributes
         * Must done after lpfc_sli_hba_setup()
@@ -1620,6 +1657,7 @@ out_free_slim:
                                                        phba->slim2p_mapping);
 out_iounmap:
        iounmap(phba->ctrl_regs_memmap_p);
+out_iounmap_slim:
        iounmap(phba->slim_memmap_p);
 out_idr_remove:
        idr_remove(&lpfc_hba_index, phba->brd_no);