]> 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 766dac230a6c6f795a7b2e106d6944b7c0910cb0..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,14 +763,12 @@ 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;
-       uint16_t dev_subid;
-       uint8_t hdrtype;
+       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:
@@ -867,8 +869,6 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
                break;
        case PCI_DEVICE_ID_LP11000S:
        case PCI_DEVICE_ID_LPE11000S:
-               pci_read_config_word(phba->pcidev, PCI_SUBSYSTEM_ID,
-                                    &dev_subid);
                switch (dev_subid) {
                case PCI_SUBSYSTEM_ID_LP11000S:
                        model_str = "LP11002-S 4Gb PCI-X2";
@@ -1237,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);
@@ -1416,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.
@@ -1457,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,
@@ -1530,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;
@@ -1561,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()
@@ -1631,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);