aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c183
1 files changed, 127 insertions, 56 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 07498118359d..b7a603a45328 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -126,34 +126,26 @@ lpfc_config_port_prep(struct lpfc_hba * phba)
126 return -ERESTART; 126 return -ERESTART;
127 } 127 }
128 128
129 /* The HBA's current state is provided by the ProgType and rr fields. 129 /*
130 * Read and check the value of these fields before continuing to config 130 * The value of rr must be 1 since the driver set the cv field to 1.
131 * this port. 131 * This setting requires the FW to set all revision fields.
132 */ 132 */
133 if (mb->un.varRdRev.rr == 0 || mb->un.varRdRev.un.b.ProgType != 2) { 133 if (mb->un.varRdRev.rr == 0) {
134 /* Old firmware */
135 vp->rev.rBit = 0; 134 vp->rev.rBit = 0;
136 lpfc_printf_log(phba, 135 lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
137 KERN_ERR, 136 "%d:0440 Adapter failed to init, READ_REV has "
138 LOG_INIT, 137 "missing revision information.\n",
139 "%d:0440 Adapter failed to init, mbxCmd x%x " 138 phba->brd_no);
140 "READ_REV detected outdated firmware"
141 "Data: x%x\n",
142 phba->brd_no,
143 mb->mbxCommand, 0);
144 mempool_free(pmb, phba->mbox_mem_pool); 139 mempool_free(pmb, phba->mbox_mem_pool);
145 return -ERESTART; 140 return -ERESTART;
146 } else {
147 vp->rev.rBit = 1;
148 vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev;
149 memcpy(vp->rev.sli1FwName,
150 (char*)mb->un.varRdRev.sli1FwName, 16);
151 vp->rev.sli2FwRev = mb->un.varRdRev.sli2FwRev;
152 memcpy(vp->rev.sli2FwName,
153 (char *)mb->un.varRdRev.sli2FwName, 16);
154 } 141 }
155 142
156 /* Save information as VPD data */ 143 /* Save information as VPD data */
144 vp->rev.rBit = 1;
145 vp->rev.sli1FwRev = mb->un.varRdRev.sli1FwRev;
146 memcpy(vp->rev.sli1FwName, (char*) mb->un.varRdRev.sli1FwName, 16);
147 vp->rev.sli2FwRev = mb->un.varRdRev.sli2FwRev;
148 memcpy(vp->rev.sli2FwName, (char *) mb->un.varRdRev.sli2FwName, 16);
157 vp->rev.biuRev = mb->un.varRdRev.biuRev; 149 vp->rev.biuRev = mb->un.varRdRev.biuRev;
158 vp->rev.smRev = mb->un.varRdRev.smRev; 150 vp->rev.smRev = mb->un.varRdRev.smRev;
159 vp->rev.smFwRev = mb->un.varRdRev.un.smFwRev; 151 vp->rev.smFwRev = mb->un.varRdRev.un.smFwRev;
@@ -378,6 +370,10 @@ lpfc_config_port_post(struct lpfc_hba * phba)
378 if (psli->num_rings > 3) 370 if (psli->num_rings > 3)
379 status |= HC_R3INT_ENA; 371 status |= HC_R3INT_ENA;
380 372
373 if ((phba->cfg_poll & ENABLE_FCP_RING_POLLING) &&
374 (phba->cfg_poll & DISABLE_FCP_RING_INT))
375 status &= ~(HC_R0INT_ENA << LPFC_FCP_RING);
376
381 writel(status, phba->HCregaddr); 377 writel(status, phba->HCregaddr);
382 readl(phba->HCregaddr); /* flush */ 378 readl(phba->HCregaddr); /* flush */
383 spin_unlock_irq(phba->host->host_lock); 379 spin_unlock_irq(phba->host->host_lock);
@@ -571,6 +567,8 @@ lpfc_handle_latt(struct lpfc_hba * phba)
571 567
572 rc = -EIO; 568 rc = -EIO;
573 569
570 /* Cleanup any outstanding ELS commands */
571 lpfc_els_flush_cmd(phba);
574 572
575 psli->slistat.link_event++; 573 psli->slistat.link_event++;
576 lpfc_read_la(phba, pmb, mp); 574 lpfc_read_la(phba, pmb, mp);
@@ -765,96 +763,139 @@ static void
765lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) 763lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp)
766{ 764{
767 lpfc_vpd_t *vp; 765 lpfc_vpd_t *vp;
768 uint32_t id; 766 uint16_t dev_id = phba->pcidev->device;
769 uint8_t hdrtype; 767 uint16_t dev_subid = phba->pcidev->subsystem_device;
770 char str[16]; 768 uint8_t hdrtype = phba->pcidev->hdr_type;
769 char *model_str = "";
771 770
772 vp = &phba->vpd; 771 vp = &phba->vpd;
773 pci_read_config_dword(phba->pcidev, PCI_VENDOR_ID, &id);
774 pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
775 772
776 switch ((id >> 16) & 0xffff) { 773 switch (dev_id) {
777 case PCI_DEVICE_ID_FIREFLY: 774 case PCI_DEVICE_ID_FIREFLY:
778 strcpy(str, "LP6000 1"); 775 model_str = "LP6000 1Gb PCI";
779 break; 776 break;
780 case PCI_DEVICE_ID_SUPERFLY: 777 case PCI_DEVICE_ID_SUPERFLY:
781 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) 778 if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3)
782 strcpy(str, "LP7000 1"); 779 model_str = "LP7000 1Gb PCI";
783 else 780 else
784 strcpy(str, "LP7000E 1"); 781 model_str = "LP7000E 1Gb PCI";
785 break; 782 break;
786 case PCI_DEVICE_ID_DRAGONFLY: 783 case PCI_DEVICE_ID_DRAGONFLY:
787 strcpy(str, "LP8000 1"); 784 model_str = "LP8000 1Gb PCI";
788 break; 785 break;
789 case PCI_DEVICE_ID_CENTAUR: 786 case PCI_DEVICE_ID_CENTAUR:
790 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) 787 if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID)
791 strcpy(str, "LP9002 2"); 788 model_str = "LP9002 2Gb PCI";
792 else 789 else
793 strcpy(str, "LP9000 1"); 790 model_str = "LP9000 1Gb PCI";
794 break; 791 break;
795 case PCI_DEVICE_ID_RFLY: 792 case PCI_DEVICE_ID_RFLY:
796 strcpy(str, "LP952 2"); 793 model_str = "LP952 2Gb PCI";
797 break; 794 break;
798 case PCI_DEVICE_ID_PEGASUS: 795 case PCI_DEVICE_ID_PEGASUS:
799 strcpy(str, "LP9802 2"); 796 model_str = "LP9802 2Gb PCI-X";
800 break; 797 break;
801 case PCI_DEVICE_ID_THOR: 798 case PCI_DEVICE_ID_THOR:
802 if (hdrtype == 0x80) 799 if (hdrtype == 0x80)
803 strcpy(str, "LP10000DC 2"); 800 model_str = "LP10000DC 2Gb 2-port PCI-X";
804 else 801 else
805 strcpy(str, "LP10000 2"); 802 model_str = "LP10000 2Gb PCI-X";
806 break; 803 break;
807 case PCI_DEVICE_ID_VIPER: 804 case PCI_DEVICE_ID_VIPER:
808 strcpy(str, "LPX1000 10"); 805 model_str = "LPX1000 10Gb PCI-X";
809 break; 806 break;
810 case PCI_DEVICE_ID_PFLY: 807 case PCI_DEVICE_ID_PFLY:
811 strcpy(str, "LP982 2"); 808 model_str = "LP982 2Gb PCI-X";
812 break; 809 break;
813 case PCI_DEVICE_ID_TFLY: 810 case PCI_DEVICE_ID_TFLY:
814 if (hdrtype == 0x80) 811 if (hdrtype == 0x80)
815 strcpy(str, "LP1050DC 2"); 812 model_str = "LP1050DC 2Gb 2-port PCI-X";
816 else 813 else
817 strcpy(str, "LP1050 2"); 814 model_str = "LP1050 2Gb PCI-X";
818 break; 815 break;
819 case PCI_DEVICE_ID_HELIOS: 816 case PCI_DEVICE_ID_HELIOS:
820 if (hdrtype == 0x80) 817 if (hdrtype == 0x80)
821 strcpy(str, "LP11002 4"); 818 model_str = "LP11002 4Gb 2-port PCI-X2";
819 else
820 model_str = "LP11000 4Gb PCI-X2";
821 break;
822 case PCI_DEVICE_ID_HELIOS_SCSP:
823 model_str = "LP11000-SP 4Gb PCI-X2";
824 break;
825 case PCI_DEVICE_ID_HELIOS_DCSP:
826 model_str = "LP11002-SP 4Gb 2-port PCI-X2";
827 break;
828 case PCI_DEVICE_ID_NEPTUNE:
829 if (hdrtype == 0x80)
830 model_str = "LPe1002 4Gb 2-port";
822 else 831 else
823 strcpy(str, "LP11000 4"); 832 model_str = "LPe1000 4Gb PCIe";
833 break;
834 case PCI_DEVICE_ID_NEPTUNE_SCSP:
835 model_str = "LPe1000-SP 4Gb PCIe";
836 break;
837 case PCI_DEVICE_ID_NEPTUNE_DCSP:
838 model_str = "LPe1002-SP 4Gb 2-port PCIe";
824 break; 839 break;
825 case PCI_DEVICE_ID_BMID: 840 case PCI_DEVICE_ID_BMID:
826 strcpy(str, "LP1150 4"); 841 model_str = "LP1150 4Gb PCI-X2";
827 break; 842 break;
828 case PCI_DEVICE_ID_BSMB: 843 case PCI_DEVICE_ID_BSMB:
829 strcpy(str, "LP111 4"); 844 model_str = "LP111 4Gb PCI-X2";
830 break; 845 break;
831 case PCI_DEVICE_ID_ZEPHYR: 846 case PCI_DEVICE_ID_ZEPHYR:
832 if (hdrtype == 0x80) 847 if (hdrtype == 0x80)
833 strcpy(str, "LPe11002 4"); 848 model_str = "LPe11002 4Gb 2-port PCIe";
834 else 849 else
835 strcpy(str, "LPe11000 4"); 850 model_str = "LPe11000 4Gb PCIe";
851 break;
852 case PCI_DEVICE_ID_ZEPHYR_SCSP:
853 model_str = "LPe11000-SP 4Gb PCIe";
854 break;
855 case PCI_DEVICE_ID_ZEPHYR_DCSP:
856 model_str = "LPe11002-SP 4Gb 2-port PCIe";
836 break; 857 break;
837 case PCI_DEVICE_ID_ZMID: 858 case PCI_DEVICE_ID_ZMID:
838 strcpy(str, "LPe1150 4"); 859 model_str = "LPe1150 4Gb PCIe";
839 break; 860 break;
840 case PCI_DEVICE_ID_ZSMB: 861 case PCI_DEVICE_ID_ZSMB:
841 strcpy(str, "LPe111 4"); 862 model_str = "LPe111 4Gb PCIe";
842 break; 863 break;
843 case PCI_DEVICE_ID_LP101: 864 case PCI_DEVICE_ID_LP101:
844 strcpy(str, "LP101 2"); 865 model_str = "LP101 2Gb PCI-X";
845 break; 866 break;
846 case PCI_DEVICE_ID_LP10000S: 867 case PCI_DEVICE_ID_LP10000S:
847 strcpy(str, "LP10000-S 2"); 868 model_str = "LP10000-S 2Gb PCI";
869 break;
870 case PCI_DEVICE_ID_LP11000S:
871 case PCI_DEVICE_ID_LPE11000S:
872 switch (dev_subid) {
873 case PCI_SUBSYSTEM_ID_LP11000S:
874 model_str = "LP11002-S 4Gb PCI-X2";
875 break;
876 case PCI_SUBSYSTEM_ID_LP11002S:
877 model_str = "LP11000-S 4Gb 2-port PCI-X2";
878 break;
879 case PCI_SUBSYSTEM_ID_LPE11000S:
880 model_str = "LPe11002-S 4Gb PCIe";
881 break;
882 case PCI_SUBSYSTEM_ID_LPE11002S:
883 model_str = "LPe11002-S 4Gb 2-port PCIe";
884 break;
885 case PCI_SUBSYSTEM_ID_LPE11010S:
886 model_str = "LPe11010-S 4Gb 10-port PCIe";
887 break;
888 default:
889 break;
890 }
848 break; 891 break;
849 default: 892 default:
850 memset(str, 0, 16);
851 break; 893 break;
852 } 894 }
853 if (mdp) 895 if (mdp)
854 sscanf(str, "%s", mdp); 896 sscanf(model_str, "%s", mdp);
855 if (descp) 897 if (descp)
856 sprintf(descp, "Emulex LightPulse %s Gigabit PCI Fibre " 898 sprintf(descp, "Emulex %s Fibre Channel Adapter", model_str);
857 "Channel Adapter", str);
858} 899}
859 900
860/**************************************************/ 901/**************************************************/
@@ -1196,6 +1237,7 @@ lpfc_stop_timer(struct lpfc_hba * phba)
1196 } 1237 }
1197 } 1238 }
1198 1239
1240 del_timer_sync(&phba->fcp_poll_timer);
1199 del_timer_sync(&phba->fc_estabtmo); 1241 del_timer_sync(&phba->fc_estabtmo);
1200 del_timer_sync(&phba->fc_disctmo); 1242 del_timer_sync(&phba->fc_disctmo);
1201 del_timer_sync(&phba->fc_fdmitmo); 1243 del_timer_sync(&phba->fc_fdmitmo);
@@ -1351,7 +1393,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1351 goto out_put_host; 1393 goto out_put_host;
1352 1394
1353 host->unique_id = phba->brd_no; 1395 host->unique_id = phba->brd_no;
1354 1396 init_MUTEX(&phba->hba_can_block);
1355 INIT_LIST_HEAD(&phba->ctrspbuflist); 1397 INIT_LIST_HEAD(&phba->ctrspbuflist);
1356 INIT_LIST_HEAD(&phba->rnidrspbuflist); 1398 INIT_LIST_HEAD(&phba->rnidrspbuflist);
1357 INIT_LIST_HEAD(&phba->freebufList); 1399 INIT_LIST_HEAD(&phba->freebufList);
@@ -1375,6 +1417,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1375 psli->mbox_tmo.function = lpfc_mbox_timeout; 1417 psli->mbox_tmo.function = lpfc_mbox_timeout;
1376 psli->mbox_tmo.data = (unsigned long)phba; 1418 psli->mbox_tmo.data = (unsigned long)phba;
1377 1419
1420 init_timer(&phba->fcp_poll_timer);
1421 phba->fcp_poll_timer.function = lpfc_poll_timeout;
1422 phba->fcp_poll_timer.data = (unsigned long)phba;
1423
1378 /* 1424 /*
1379 * Get all the module params for configuring this host and then 1425 * Get all the module params for configuring this host and then
1380 * establish the host parameters. 1426 * establish the host parameters.
@@ -1489,6 +1535,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1489 host->max_cmd_len = 16; 1535 host->max_cmd_len = 16;
1490 1536
1491 /* Initialize the list of scsi buffers used by driver for scsi IO. */ 1537 /* Initialize the list of scsi buffers used by driver for scsi IO. */
1538 spin_lock_init(&phba->scsi_buf_list_lock);
1492 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list); 1539 INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list);
1493 1540
1494 host->transportt = lpfc_transport_template; 1541 host->transportt = lpfc_transport_template;
@@ -1520,6 +1567,12 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1520 if (error) 1567 if (error)
1521 goto out_free_irq; 1568 goto out_free_irq;
1522 1569
1570 if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
1571 spin_lock_irq(phba->host->host_lock);
1572 lpfc_poll_start_timer(phba);
1573 spin_unlock_irq(phba->host->host_lock);
1574 }
1575
1523 /* 1576 /*
1524 * set fixed host attributes 1577 * set fixed host attributes
1525 * Must done after lpfc_sli_hba_setup() 1578 * Must done after lpfc_sli_hba_setup()
@@ -1679,14 +1732,28 @@ static struct pci_device_id lpfc_id_table[] = {
1679 PCI_ANY_ID, PCI_ANY_ID, }, 1732 PCI_ANY_ID, PCI_ANY_ID, },
1680 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY, 1733 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_PFLY,
1681 PCI_ANY_ID, PCI_ANY_ID, }, 1734 PCI_ANY_ID, PCI_ANY_ID, },
1735 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE,
1736 PCI_ANY_ID, PCI_ANY_ID, },
1737 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_SCSP,
1738 PCI_ANY_ID, PCI_ANY_ID, },
1739 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_NEPTUNE_DCSP,
1740 PCI_ANY_ID, PCI_ANY_ID, },
1682 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS, 1741 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS,
1683 PCI_ANY_ID, PCI_ANY_ID, }, 1742 PCI_ANY_ID, PCI_ANY_ID, },
1743 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_SCSP,
1744 PCI_ANY_ID, PCI_ANY_ID, },
1745 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_HELIOS_DCSP,
1746 PCI_ANY_ID, PCI_ANY_ID, },
1684 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID, 1747 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BMID,
1685 PCI_ANY_ID, PCI_ANY_ID, }, 1748 PCI_ANY_ID, PCI_ANY_ID, },
1686 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB, 1749 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_BSMB,
1687 PCI_ANY_ID, PCI_ANY_ID, }, 1750 PCI_ANY_ID, PCI_ANY_ID, },
1688 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR, 1751 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR,
1689 PCI_ANY_ID, PCI_ANY_ID, }, 1752 PCI_ANY_ID, PCI_ANY_ID, },
1753 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_SCSP,
1754 PCI_ANY_ID, PCI_ANY_ID, },
1755 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZEPHYR_DCSP,
1756 PCI_ANY_ID, PCI_ANY_ID, },
1690 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZMID, 1757 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZMID,
1691 PCI_ANY_ID, PCI_ANY_ID, }, 1758 PCI_ANY_ID, PCI_ANY_ID, },
1692 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB, 1759 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_ZSMB,
@@ -1697,6 +1764,10 @@ static struct pci_device_id lpfc_id_table[] = {
1697 PCI_ANY_ID, PCI_ANY_ID, }, 1764 PCI_ANY_ID, PCI_ANY_ID, },
1698 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP10000S, 1765 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP10000S,
1699 PCI_ANY_ID, PCI_ANY_ID, }, 1766 PCI_ANY_ID, PCI_ANY_ID, },
1767 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LP11000S,
1768 PCI_ANY_ID, PCI_ANY_ID, },
1769 {PCI_VENDOR_ID_EMULEX, PCI_DEVICE_ID_LPE11000S,
1770 PCI_ANY_ID, PCI_ANY_ID, },
1700 { 0 } 1771 { 0 }
1701}; 1772};
1702 1773