diff options
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r-- | drivers/scsi/lpfc/lpfc_init.c | 265 |
1 files changed, 170 insertions, 95 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c index b7a603a45328..66d5d003555d 100644 --- a/drivers/scsi/lpfc/lpfc_init.c +++ b/drivers/scsi/lpfc/lpfc_init.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /******************************************************************* | 1 | /******************************************************************* |
2 | * This file is part of the Emulex Linux Device Driver for * | 2 | * This file is part of the Emulex Linux Device Driver for * |
3 | * Fibre Channel Host Bus Adapters. * | 3 | * Fibre Channel Host Bus Adapters. * |
4 | * Copyright (C) 2004-2005 Emulex. All rights reserved. * | 4 | * Copyright (C) 2004-2006 Emulex. All rights reserved. * |
5 | * EMULEX and SLI are trademarks of Emulex. * | 5 | * EMULEX and SLI are trademarks of Emulex. * |
6 | * www.emulex.com * | 6 | * www.emulex.com * |
7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * | 7 | * Portions Copyright (C) 2004-2005 Christoph Hellwig * |
@@ -42,7 +42,7 @@ | |||
42 | #include "lpfc_crtn.h" | 42 | #include "lpfc_crtn.h" |
43 | #include "lpfc_version.h" | 43 | #include "lpfc_version.h" |
44 | 44 | ||
45 | static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *); | 45 | static int lpfc_parse_vpd(struct lpfc_hba *, uint8_t *, int); |
46 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); | 46 | static void lpfc_get_hba_model_desc(struct lpfc_hba *, uint8_t *, uint8_t *); |
47 | static int lpfc_post_rcv_buf(struct lpfc_hba *); | 47 | static int lpfc_post_rcv_buf(struct lpfc_hba *); |
48 | 48 | ||
@@ -161,9 +161,6 @@ lpfc_config_port_prep(struct lpfc_hba * phba) | |||
161 | memcpy(phba->RandomData, (char *)&mb->un.varWords[24], | 161 | memcpy(phba->RandomData, (char *)&mb->un.varWords[24], |
162 | sizeof (phba->RandomData)); | 162 | sizeof (phba->RandomData)); |
163 | 163 | ||
164 | /* Get the default values for Model Name and Description */ | ||
165 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); | ||
166 | |||
167 | /* Get adapter VPD information */ | 164 | /* Get adapter VPD information */ |
168 | pmb->context2 = kmalloc(DMP_RSP_SIZE, GFP_KERNEL); | 165 | pmb->context2 = kmalloc(DMP_RSP_SIZE, GFP_KERNEL); |
169 | if (!pmb->context2) | 166 | if (!pmb->context2) |
@@ -182,16 +179,15 @@ lpfc_config_port_prep(struct lpfc_hba * phba) | |||
182 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", | 179 | "mbxCmd x%x DUMP VPD, mbxStatus x%x\n", |
183 | phba->brd_no, | 180 | phba->brd_no, |
184 | mb->mbxCommand, mb->mbxStatus); | 181 | mb->mbxCommand, mb->mbxStatus); |
185 | kfree(lpfc_vpd_data); | 182 | mb->un.varDmp.word_cnt = 0; |
186 | lpfc_vpd_data = NULL; | ||
187 | break; | ||
188 | } | 183 | } |
189 | 184 | if (mb->un.varDmp.word_cnt > DMP_VPD_SIZE - offset) | |
185 | mb->un.varDmp.word_cnt = DMP_VPD_SIZE - offset; | ||
190 | lpfc_sli_pcimem_bcopy(pmb->context2, lpfc_vpd_data + offset, | 186 | lpfc_sli_pcimem_bcopy(pmb->context2, lpfc_vpd_data + offset, |
191 | mb->un.varDmp.word_cnt); | 187 | mb->un.varDmp.word_cnt); |
192 | offset += mb->un.varDmp.word_cnt; | 188 | offset += mb->un.varDmp.word_cnt; |
193 | } while (mb->un.varDmp.word_cnt); | 189 | } while (mb->un.varDmp.word_cnt && offset < DMP_VPD_SIZE); |
194 | lpfc_parse_vpd(phba, lpfc_vpd_data); | 190 | lpfc_parse_vpd(phba, lpfc_vpd_data, offset); |
195 | 191 | ||
196 | kfree(lpfc_vpd_data); | 192 | kfree(lpfc_vpd_data); |
197 | out_free_context2: | 193 | out_free_context2: |
@@ -327,13 +323,22 @@ lpfc_config_port_post(struct lpfc_hba * phba) | |||
327 | mb->un.varRdConfig.max_xri + 1; | 323 | mb->un.varRdConfig.max_xri + 1; |
328 | 324 | ||
329 | phba->lmt = mb->un.varRdConfig.lmt; | 325 | phba->lmt = mb->un.varRdConfig.lmt; |
330 | /* HBA is not 4GB capable, or HBA is not 2GB capable, | 326 | |
331 | don't let link speed ask for it */ | 327 | /* Get the default values for Model Name and Description */ |
332 | if ((((phba->lmt & LMT_4250_10bit) != LMT_4250_10bit) && | 328 | lpfc_get_hba_model_desc(phba, phba->ModelName, phba->ModelDesc); |
333 | (phba->cfg_link_speed > LINK_SPEED_2G)) || | 329 | |
334 | (((phba->lmt & LMT_2125_10bit) != LMT_2125_10bit) && | 330 | if ((phba->cfg_link_speed > LINK_SPEED_10G) |
335 | (phba->cfg_link_speed > LINK_SPEED_1G))) { | 331 | || ((phba->cfg_link_speed == LINK_SPEED_1G) |
336 | /* Reset link speed to auto. 1G/2GB HBA cfg'd for 4G */ | 332 | && !(phba->lmt & LMT_1Gb)) |
333 | || ((phba->cfg_link_speed == LINK_SPEED_2G) | ||
334 | && !(phba->lmt & LMT_2Gb)) | ||
335 | || ((phba->cfg_link_speed == LINK_SPEED_4G) | ||
336 | && !(phba->lmt & LMT_4Gb)) | ||
337 | || ((phba->cfg_link_speed == LINK_SPEED_8G) | ||
338 | && !(phba->lmt & LMT_8Gb)) | ||
339 | || ((phba->cfg_link_speed == LINK_SPEED_10G) | ||
340 | && !(phba->lmt & LMT_10Gb))) { | ||
341 | /* Reset link speed to auto */ | ||
337 | lpfc_printf_log(phba, | 342 | lpfc_printf_log(phba, |
338 | KERN_WARNING, | 343 | KERN_WARNING, |
339 | LOG_LINK_EVENT, | 344 | LOG_LINK_EVENT, |
@@ -464,6 +469,40 @@ lpfc_hba_down_prep(struct lpfc_hba * phba) | |||
464 | 469 | ||
465 | /************************************************************************/ | 470 | /************************************************************************/ |
466 | /* */ | 471 | /* */ |
472 | /* lpfc_hba_down_post */ | ||
473 | /* This routine will do uninitialization after the HBA is reset */ | ||
474 | /* when bringing down the SLI Layer. */ | ||
475 | /* This routine returns 0 on success. Any other return value */ | ||
476 | /* indicates an error. */ | ||
477 | /* */ | ||
478 | /************************************************************************/ | ||
479 | int | ||
480 | lpfc_hba_down_post(struct lpfc_hba * phba) | ||
481 | { | ||
482 | struct lpfc_sli *psli = &phba->sli; | ||
483 | struct lpfc_sli_ring *pring; | ||
484 | struct lpfc_dmabuf *mp, *next_mp; | ||
485 | int i; | ||
486 | |||
487 | /* Cleanup preposted buffers on the ELS ring */ | ||
488 | pring = &psli->ring[LPFC_ELS_RING]; | ||
489 | list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) { | ||
490 | list_del(&mp->list); | ||
491 | pring->postbufq_cnt--; | ||
492 | lpfc_mbuf_free(phba, mp->virt, mp->phys); | ||
493 | kfree(mp); | ||
494 | } | ||
495 | |||
496 | for (i = 0; i < psli->num_rings; i++) { | ||
497 | pring = &psli->ring[i]; | ||
498 | lpfc_sli_abort_iocb_ring(phba, pring); | ||
499 | } | ||
500 | |||
501 | return 0; | ||
502 | } | ||
503 | |||
504 | /************************************************************************/ | ||
505 | /* */ | ||
467 | /* lpfc_handle_eratt */ | 506 | /* lpfc_handle_eratt */ |
468 | /* This routine will handle processing a Host Attention */ | 507 | /* This routine will handle processing a Host Attention */ |
469 | /* Error Status event. This will be initialized */ | 508 | /* Error Status event. This will be initialized */ |
@@ -476,20 +515,6 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
476 | struct lpfc_sli *psli = &phba->sli; | 515 | struct lpfc_sli *psli = &phba->sli; |
477 | struct lpfc_sli_ring *pring; | 516 | struct lpfc_sli_ring *pring; |
478 | 517 | ||
479 | /* | ||
480 | * If a reset is sent to the HBA restore PCI configuration registers. | ||
481 | */ | ||
482 | if ( phba->hba_state == LPFC_INIT_START ) { | ||
483 | mdelay(1); | ||
484 | readl(phba->HCregaddr); /* flush */ | ||
485 | writel(0, phba->HCregaddr); | ||
486 | readl(phba->HCregaddr); /* flush */ | ||
487 | |||
488 | /* Restore PCI cmd register */ | ||
489 | pci_write_config_word(phba->pcidev, | ||
490 | PCI_COMMAND, phba->pci_cfg_value); | ||
491 | } | ||
492 | |||
493 | if (phba->work_hs & HS_FFER6) { | 518 | if (phba->work_hs & HS_FFER6) { |
494 | /* Re-establishing Link */ | 519 | /* Re-establishing Link */ |
495 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, | 520 | lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT, |
@@ -499,6 +524,7 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
499 | phba->work_status[0], phba->work_status[1]); | 524 | phba->work_status[0], phba->work_status[1]); |
500 | spin_lock_irq(phba->host->host_lock); | 525 | spin_lock_irq(phba->host->host_lock); |
501 | phba->fc_flag |= FC_ESTABLISH_LINK; | 526 | phba->fc_flag |= FC_ESTABLISH_LINK; |
527 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | ||
502 | spin_unlock_irq(phba->host->host_lock); | 528 | spin_unlock_irq(phba->host->host_lock); |
503 | 529 | ||
504 | /* | 530 | /* |
@@ -516,6 +542,7 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
516 | * attempt to restart it. | 542 | * attempt to restart it. |
517 | */ | 543 | */ |
518 | lpfc_offline(phba); | 544 | lpfc_offline(phba); |
545 | lpfc_sli_brdrestart(phba); | ||
519 | if (lpfc_online(phba) == 0) { /* Initialize the HBA */ | 546 | if (lpfc_online(phba) == 0) { /* Initialize the HBA */ |
520 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); | 547 | mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60); |
521 | return; | 548 | return; |
@@ -531,8 +558,10 @@ lpfc_handle_eratt(struct lpfc_hba * phba) | |||
531 | phba->brd_no, phba->work_hs, | 558 | phba->brd_no, phba->work_hs, |
532 | phba->work_status[0], phba->work_status[1]); | 559 | phba->work_status[0], phba->work_status[1]); |
533 | 560 | ||
561 | psli->sli_flag &= ~LPFC_SLI2_ACTIVE; | ||
534 | lpfc_offline(phba); | 562 | lpfc_offline(phba); |
535 | 563 | phba->hba_state = LPFC_HBA_ERROR; | |
564 | lpfc_hba_down_post(phba); | ||
536 | } | 565 | } |
537 | } | 566 | } |
538 | 567 | ||
@@ -623,7 +652,7 @@ lpfc_handle_latt_err_exit: | |||
623 | /* */ | 652 | /* */ |
624 | /************************************************************************/ | 653 | /************************************************************************/ |
625 | static int | 654 | static int |
626 | lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd) | 655 | lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd, int len) |
627 | { | 656 | { |
628 | uint8_t lenlo, lenhi; | 657 | uint8_t lenlo, lenhi; |
629 | uint32_t Length; | 658 | uint32_t Length; |
@@ -642,9 +671,10 @@ lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd) | |||
642 | phba->brd_no, | 671 | phba->brd_no, |
643 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], | 672 | (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2], |
644 | (uint32_t) vpd[3]); | 673 | (uint32_t) vpd[3]); |
645 | do { | 674 | while (!finished && (index < (len - 4))) { |
646 | switch (vpd[index]) { | 675 | switch (vpd[index]) { |
647 | case 0x82: | 676 | case 0x82: |
677 | case 0x91: | ||
648 | index += 1; | 678 | index += 1; |
649 | lenlo = vpd[index]; | 679 | lenlo = vpd[index]; |
650 | index += 1; | 680 | index += 1; |
@@ -660,7 +690,8 @@ lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd) | |||
660 | lenhi = vpd[index]; | 690 | lenhi = vpd[index]; |
661 | index += 1; | 691 | index += 1; |
662 | Length = ((((unsigned short)lenhi) << 8) + lenlo); | 692 | Length = ((((unsigned short)lenhi) << 8) + lenlo); |
663 | 693 | if (Length > len - index) | |
694 | Length = len - index; | ||
664 | while (Length > 0) { | 695 | while (Length > 0) { |
665 | /* Look for Serial Number */ | 696 | /* Look for Serial Number */ |
666 | if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) { | 697 | if ((vpd[index] == 'S') && (vpd[index+1] == 'N')) { |
@@ -754,7 +785,7 @@ lpfc_parse_vpd(struct lpfc_hba * phba, uint8_t * vpd) | |||
754 | index ++; | 785 | index ++; |
755 | break; | 786 | break; |
756 | } | 787 | } |
757 | } while (!finished && (index < 108)); | 788 | } |
758 | 789 | ||
759 | return(1); | 790 | return(1); |
760 | } | 791 | } |
@@ -765,137 +796,173 @@ lpfc_get_hba_model_desc(struct lpfc_hba * phba, uint8_t * mdp, uint8_t * descp) | |||
765 | lpfc_vpd_t *vp; | 796 | lpfc_vpd_t *vp; |
766 | uint16_t dev_id = phba->pcidev->device; | 797 | uint16_t dev_id = phba->pcidev->device; |
767 | uint16_t dev_subid = phba->pcidev->subsystem_device; | 798 | uint16_t dev_subid = phba->pcidev->subsystem_device; |
768 | uint8_t hdrtype = phba->pcidev->hdr_type; | 799 | uint8_t hdrtype; |
769 | char *model_str = ""; | 800 | int max_speed; |
801 | char * ports; | ||
802 | struct { | ||
803 | char * name; | ||
804 | int max_speed; | ||
805 | char * ports; | ||
806 | char * bus; | ||
807 | } m; | ||
808 | |||
809 | pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype); | ||
810 | ports = (hdrtype == 0x80) ? "2-port " : ""; | ||
811 | if (mdp && mdp[0] != '\0' | ||
812 | && descp && descp[0] != '\0') | ||
813 | return; | ||
814 | |||
815 | if (phba->lmt & LMT_10Gb) | ||
816 | max_speed = 10; | ||
817 | else if (phba->lmt & LMT_8Gb) | ||
818 | max_speed = 8; | ||
819 | else if (phba->lmt & LMT_4Gb) | ||
820 | max_speed = 4; | ||
821 | else if (phba->lmt & LMT_2Gb) | ||
822 | max_speed = 2; | ||
823 | else | ||
824 | max_speed = 1; | ||
770 | 825 | ||
771 | vp = &phba->vpd; | 826 | vp = &phba->vpd; |
772 | 827 | ||
773 | switch (dev_id) { | 828 | switch (dev_id) { |
774 | case PCI_DEVICE_ID_FIREFLY: | 829 | case PCI_DEVICE_ID_FIREFLY: |
775 | model_str = "LP6000 1Gb PCI"; | 830 | m = (typeof(m)){"LP6000", max_speed, "", "PCI"}; |
776 | break; | 831 | break; |
777 | case PCI_DEVICE_ID_SUPERFLY: | 832 | case PCI_DEVICE_ID_SUPERFLY: |
778 | if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) | 833 | if (vp->rev.biuRev >= 1 && vp->rev.biuRev <= 3) |
779 | model_str = "LP7000 1Gb PCI"; | 834 | m = (typeof(m)){"LP7000", max_speed, "", "PCI"}; |
780 | else | 835 | else |
781 | model_str = "LP7000E 1Gb PCI"; | 836 | m = (typeof(m)){"LP7000E", max_speed, "", "PCI"}; |
782 | break; | 837 | break; |
783 | case PCI_DEVICE_ID_DRAGONFLY: | 838 | case PCI_DEVICE_ID_DRAGONFLY: |
784 | model_str = "LP8000 1Gb PCI"; | 839 | m = (typeof(m)){"LP8000", max_speed, "", "PCI"}; |
785 | break; | 840 | break; |
786 | case PCI_DEVICE_ID_CENTAUR: | 841 | case PCI_DEVICE_ID_CENTAUR: |
787 | if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) | 842 | if (FC_JEDEC_ID(vp->rev.biuRev) == CENTAUR_2G_JEDEC_ID) |
788 | model_str = "LP9002 2Gb PCI"; | 843 | m = (typeof(m)){"LP9002", max_speed, "", "PCI"}; |
789 | else | 844 | else |
790 | model_str = "LP9000 1Gb PCI"; | 845 | m = (typeof(m)){"LP9000", max_speed, "", "PCI"}; |
791 | break; | 846 | break; |
792 | case PCI_DEVICE_ID_RFLY: | 847 | case PCI_DEVICE_ID_RFLY: |
793 | model_str = "LP952 2Gb PCI"; | 848 | m = (typeof(m)){"LP952", max_speed, "", "PCI"}; |
794 | break; | 849 | break; |
795 | case PCI_DEVICE_ID_PEGASUS: | 850 | case PCI_DEVICE_ID_PEGASUS: |
796 | model_str = "LP9802 2Gb PCI-X"; | 851 | m = (typeof(m)){"LP9802", max_speed, "", "PCI-X"}; |
797 | break; | 852 | break; |
798 | case PCI_DEVICE_ID_THOR: | 853 | case PCI_DEVICE_ID_THOR: |
799 | if (hdrtype == 0x80) | 854 | if (hdrtype == 0x80) |
800 | model_str = "LP10000DC 2Gb 2-port PCI-X"; | 855 | m = (typeof(m)){"LP10000DC", |
856 | max_speed, ports, "PCI-X"}; | ||
801 | else | 857 | else |
802 | model_str = "LP10000 2Gb PCI-X"; | 858 | m = (typeof(m)){"LP10000", |
859 | max_speed, ports, "PCI-X"}; | ||
803 | break; | 860 | break; |
804 | case PCI_DEVICE_ID_VIPER: | 861 | case PCI_DEVICE_ID_VIPER: |
805 | model_str = "LPX1000 10Gb PCI-X"; | 862 | m = (typeof(m)){"LPX1000", max_speed, "", "PCI-X"}; |
806 | break; | 863 | break; |
807 | case PCI_DEVICE_ID_PFLY: | 864 | case PCI_DEVICE_ID_PFLY: |
808 | model_str = "LP982 2Gb PCI-X"; | 865 | m = (typeof(m)){"LP982", max_speed, "", "PCI-X"}; |
809 | break; | 866 | break; |
810 | case PCI_DEVICE_ID_TFLY: | 867 | case PCI_DEVICE_ID_TFLY: |
811 | if (hdrtype == 0x80) | 868 | if (hdrtype == 0x80) |
812 | model_str = "LP1050DC 2Gb 2-port PCI-X"; | 869 | m = (typeof(m)){"LP1050DC", max_speed, ports, "PCI-X"}; |
813 | else | 870 | else |
814 | model_str = "LP1050 2Gb PCI-X"; | 871 | m = (typeof(m)){"LP1050", max_speed, ports, "PCI-X"}; |
815 | break; | 872 | break; |
816 | case PCI_DEVICE_ID_HELIOS: | 873 | case PCI_DEVICE_ID_HELIOS: |
817 | if (hdrtype == 0x80) | 874 | if (hdrtype == 0x80) |
818 | model_str = "LP11002 4Gb 2-port PCI-X2"; | 875 | m = (typeof(m)){"LP11002", max_speed, ports, "PCI-X2"}; |
819 | else | 876 | else |
820 | model_str = "LP11000 4Gb PCI-X2"; | 877 | m = (typeof(m)){"LP11000", max_speed, ports, "PCI-X2"}; |
821 | break; | 878 | break; |
822 | case PCI_DEVICE_ID_HELIOS_SCSP: | 879 | case PCI_DEVICE_ID_HELIOS_SCSP: |
823 | model_str = "LP11000-SP 4Gb PCI-X2"; | 880 | m = (typeof(m)){"LP11000-SP", max_speed, ports, "PCI-X2"}; |
824 | break; | 881 | break; |
825 | case PCI_DEVICE_ID_HELIOS_DCSP: | 882 | case PCI_DEVICE_ID_HELIOS_DCSP: |
826 | model_str = "LP11002-SP 4Gb 2-port PCI-X2"; | 883 | m = (typeof(m)){"LP11002-SP", max_speed, ports, "PCI-X2"}; |
827 | break; | 884 | break; |
828 | case PCI_DEVICE_ID_NEPTUNE: | 885 | case PCI_DEVICE_ID_NEPTUNE: |
829 | if (hdrtype == 0x80) | 886 | if (hdrtype == 0x80) |
830 | model_str = "LPe1002 4Gb 2-port"; | 887 | m = (typeof(m)){"LPe1002", max_speed, ports, "PCIe"}; |
831 | else | 888 | else |
832 | model_str = "LPe1000 4Gb PCIe"; | 889 | m = (typeof(m)){"LPe1000", max_speed, ports, "PCIe"}; |
833 | break; | 890 | break; |
834 | case PCI_DEVICE_ID_NEPTUNE_SCSP: | 891 | case PCI_DEVICE_ID_NEPTUNE_SCSP: |
835 | model_str = "LPe1000-SP 4Gb PCIe"; | 892 | m = (typeof(m)){"LPe1000-SP", max_speed, ports, "PCIe"}; |
836 | break; | 893 | break; |
837 | case PCI_DEVICE_ID_NEPTUNE_DCSP: | 894 | case PCI_DEVICE_ID_NEPTUNE_DCSP: |
838 | model_str = "LPe1002-SP 4Gb 2-port PCIe"; | 895 | m = (typeof(m)){"LPe1002-SP", max_speed, ports, "PCIe"}; |
839 | break; | 896 | break; |
840 | case PCI_DEVICE_ID_BMID: | 897 | case PCI_DEVICE_ID_BMID: |
841 | model_str = "LP1150 4Gb PCI-X2"; | 898 | m = (typeof(m)){"LP1150", max_speed, ports, "PCI-X2"}; |
842 | break; | 899 | break; |
843 | case PCI_DEVICE_ID_BSMB: | 900 | case PCI_DEVICE_ID_BSMB: |
844 | model_str = "LP111 4Gb PCI-X2"; | 901 | m = (typeof(m)){"LP111", max_speed, ports, "PCI-X2"}; |
845 | break; | 902 | break; |
846 | case PCI_DEVICE_ID_ZEPHYR: | 903 | case PCI_DEVICE_ID_ZEPHYR: |
847 | if (hdrtype == 0x80) | 904 | if (hdrtype == 0x80) |
848 | model_str = "LPe11002 4Gb 2-port PCIe"; | 905 | m = (typeof(m)){"LPe11002", max_speed, ports, "PCIe"}; |
849 | else | 906 | else |
850 | model_str = "LPe11000 4Gb PCIe"; | 907 | m = (typeof(m)){"LPe11000", max_speed, ports, "PCIe"}; |
851 | break; | 908 | break; |
852 | case PCI_DEVICE_ID_ZEPHYR_SCSP: | 909 | case PCI_DEVICE_ID_ZEPHYR_SCSP: |
853 | model_str = "LPe11000-SP 4Gb PCIe"; | 910 | m = (typeof(m)){"LPe11000", max_speed, ports, "PCIe"}; |
854 | break; | 911 | break; |
855 | case PCI_DEVICE_ID_ZEPHYR_DCSP: | 912 | case PCI_DEVICE_ID_ZEPHYR_DCSP: |
856 | model_str = "LPe11002-SP 4Gb 2-port PCIe"; | 913 | m = (typeof(m)){"LPe11002-SP", max_speed, ports, "PCIe"}; |
857 | break; | 914 | break; |
858 | case PCI_DEVICE_ID_ZMID: | 915 | case PCI_DEVICE_ID_ZMID: |
859 | model_str = "LPe1150 4Gb PCIe"; | 916 | m = (typeof(m)){"LPe1150", max_speed, ports, "PCIe"}; |
860 | break; | 917 | break; |
861 | case PCI_DEVICE_ID_ZSMB: | 918 | case PCI_DEVICE_ID_ZSMB: |
862 | model_str = "LPe111 4Gb PCIe"; | 919 | m = (typeof(m)){"LPe111", max_speed, ports, "PCIe"}; |
863 | break; | 920 | break; |
864 | case PCI_DEVICE_ID_LP101: | 921 | case PCI_DEVICE_ID_LP101: |
865 | model_str = "LP101 2Gb PCI-X"; | 922 | m = (typeof(m)){"LP101", max_speed, ports, "PCI-X"}; |
866 | break; | 923 | break; |
867 | case PCI_DEVICE_ID_LP10000S: | 924 | case PCI_DEVICE_ID_LP10000S: |
868 | model_str = "LP10000-S 2Gb PCI"; | 925 | m = (typeof(m)){"LP10000-S", max_speed, ports, "PCI"}; |
869 | break; | 926 | break; |
870 | case PCI_DEVICE_ID_LP11000S: | 927 | case PCI_DEVICE_ID_LP11000S: |
871 | case PCI_DEVICE_ID_LPE11000S: | 928 | case PCI_DEVICE_ID_LPE11000S: |
872 | switch (dev_subid) { | 929 | switch (dev_subid) { |
873 | case PCI_SUBSYSTEM_ID_LP11000S: | 930 | case PCI_SUBSYSTEM_ID_LP11000S: |
874 | model_str = "LP11002-S 4Gb PCI-X2"; | 931 | m = (typeof(m)){"LP11000-S", max_speed, |
932 | ports, "PCI-X2"}; | ||
875 | break; | 933 | break; |
876 | case PCI_SUBSYSTEM_ID_LP11002S: | 934 | case PCI_SUBSYSTEM_ID_LP11002S: |
877 | model_str = "LP11000-S 4Gb 2-port PCI-X2"; | 935 | m = (typeof(m)){"LP11002-S", max_speed, |
936 | ports, "PCI-X2"}; | ||
878 | break; | 937 | break; |
879 | case PCI_SUBSYSTEM_ID_LPE11000S: | 938 | case PCI_SUBSYSTEM_ID_LPE11000S: |
880 | model_str = "LPe11002-S 4Gb PCIe"; | 939 | m = (typeof(m)){"LPe11000-S", max_speed, |
940 | ports, "PCIe"}; | ||
881 | break; | 941 | break; |
882 | case PCI_SUBSYSTEM_ID_LPE11002S: | 942 | case PCI_SUBSYSTEM_ID_LPE11002S: |
883 | model_str = "LPe11002-S 4Gb 2-port PCIe"; | 943 | m = (typeof(m)){"LPe11002-S", max_speed, |
944 | ports, "PCIe"}; | ||
884 | break; | 945 | break; |
885 | case PCI_SUBSYSTEM_ID_LPE11010S: | 946 | case PCI_SUBSYSTEM_ID_LPE11010S: |
886 | model_str = "LPe11010-S 4Gb 10-port PCIe"; | 947 | m = (typeof(m)){"LPe11010-S", max_speed, |
948 | "10-port ", "PCIe"}; | ||
887 | break; | 949 | break; |
888 | default: | 950 | default: |
951 | m = (typeof(m)){ 0 }; | ||
889 | break; | 952 | break; |
890 | } | 953 | } |
891 | break; | 954 | break; |
892 | default: | 955 | default: |
956 | m = (typeof(m)){ 0 }; | ||
893 | break; | 957 | break; |
894 | } | 958 | } |
895 | if (mdp) | 959 | |
896 | sscanf(model_str, "%s", mdp); | 960 | if (mdp && mdp[0] == '\0') |
897 | if (descp) | 961 | snprintf(mdp, 79,"%s", m.name); |
898 | sprintf(descp, "Emulex %s Fibre Channel Adapter", model_str); | 962 | if (descp && descp[0] == '\0') |
963 | snprintf(descp, 255, | ||
964 | "Emulex %s %dGb %s%s Fibre Channel Adapter", | ||
965 | m.name, m.max_speed, m.ports, m.bus); | ||
899 | } | 966 | } |
900 | 967 | ||
901 | /**************************************************/ | 968 | /**************************************************/ |
@@ -1462,9 +1529,23 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1462 | phba->pci_bar2_map = pci_resource_start(phba->pcidev, 2); | 1529 | phba->pci_bar2_map = pci_resource_start(phba->pcidev, 2); |
1463 | bar2map_len = pci_resource_len(phba->pcidev, 2); | 1530 | bar2map_len = pci_resource_len(phba->pcidev, 2); |
1464 | 1531 | ||
1465 | /* Map HBA SLIM and Control Registers to a kernel virtual address. */ | 1532 | /* Map HBA SLIM to a kernel virtual address. */ |
1466 | phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); | 1533 | phba->slim_memmap_p = ioremap(phba->pci_bar0_map, bar0map_len); |
1534 | if (!phba->slim_memmap_p) { | ||
1535 | error = -ENODEV; | ||
1536 | dev_printk(KERN_ERR, &pdev->dev, | ||
1537 | "ioremap failed for SLIM memory.\n"); | ||
1538 | goto out_idr_remove; | ||
1539 | } | ||
1540 | |||
1541 | /* Map HBA Control Registers to a kernel virtual address. */ | ||
1467 | phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); | 1542 | phba->ctrl_regs_memmap_p = ioremap(phba->pci_bar2_map, bar2map_len); |
1543 | if (!phba->ctrl_regs_memmap_p) { | ||
1544 | error = -ENODEV; | ||
1545 | dev_printk(KERN_ERR, &pdev->dev, | ||
1546 | "ioremap failed for HBA control registers.\n"); | ||
1547 | goto out_iounmap_slim; | ||
1548 | } | ||
1468 | 1549 | ||
1469 | /* Allocate memory for SLI-2 structures */ | 1550 | /* Allocate memory for SLI-2 structures */ |
1470 | phba->slim2p = dma_alloc_coherent(&phba->pcidev->dev, SLI2_SLIM_SIZE, | 1551 | phba->slim2p = dma_alloc_coherent(&phba->pcidev->dev, SLI2_SLIM_SIZE, |
@@ -1539,7 +1620,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1539 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list); | 1620 | INIT_LIST_HEAD(&phba->lpfc_scsi_buf_list); |
1540 | 1621 | ||
1541 | host->transportt = lpfc_transport_template; | 1622 | host->transportt = lpfc_transport_template; |
1542 | host->hostdata[0] = (unsigned long)phba; | ||
1543 | pci_set_drvdata(pdev, host); | 1623 | pci_set_drvdata(pdev, host); |
1544 | error = scsi_add_host(host, &pdev->dev); | 1624 | error = scsi_add_host(host, &pdev->dev); |
1545 | if (error) | 1625 | if (error) |
@@ -1590,21 +1670,14 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid) | |||
1590 | lpfc_get_hba_sym_node_name(phba, fc_host_symbolic_name(host)); | 1670 | lpfc_get_hba_sym_node_name(phba, fc_host_symbolic_name(host)); |
1591 | 1671 | ||
1592 | fc_host_supported_speeds(host) = 0; | 1672 | fc_host_supported_speeds(host) = 0; |
1593 | switch (FC_JEDEC_ID(phba->vpd.rev.biuRev)) { | 1673 | if (phba->lmt & LMT_10Gb) |
1594 | case VIPER_JEDEC_ID: | ||
1595 | fc_host_supported_speeds(host) |= FC_PORTSPEED_10GBIT; | 1674 | fc_host_supported_speeds(host) |= FC_PORTSPEED_10GBIT; |
1596 | break; | 1675 | if (phba->lmt & LMT_4Gb) |
1597 | case HELIOS_JEDEC_ID: | ||
1598 | fc_host_supported_speeds(host) |= FC_PORTSPEED_4GBIT; | 1676 | fc_host_supported_speeds(host) |= FC_PORTSPEED_4GBIT; |
1599 | /* Fall through */ | 1677 | if (phba->lmt & LMT_2Gb) |
1600 | case CENTAUR_2G_JEDEC_ID: | ||
1601 | case PEGASUS_JEDEC_ID: | ||
1602 | case THOR_JEDEC_ID: | ||
1603 | fc_host_supported_speeds(host) |= FC_PORTSPEED_2GBIT; | 1678 | fc_host_supported_speeds(host) |= FC_PORTSPEED_2GBIT; |
1604 | /* Fall through */ | 1679 | if (phba->lmt & LMT_1Gb) |
1605 | default: | 1680 | fc_host_supported_speeds(host) |= FC_PORTSPEED_1GBIT; |
1606 | fc_host_supported_speeds(host) = FC_PORTSPEED_1GBIT; | ||
1607 | } | ||
1608 | 1681 | ||
1609 | fc_host_maxframe_size(host) = | 1682 | fc_host_maxframe_size(host) = |
1610 | ((((uint32_t) phba->fc_sparam.cmn.bbRcvSizeMsb & 0x0F) << 8) | | 1683 | ((((uint32_t) phba->fc_sparam.cmn.bbRcvSizeMsb & 0x0F) << 8) | |
@@ -1643,6 +1716,7 @@ out_free_slim: | |||
1643 | phba->slim2p_mapping); | 1716 | phba->slim2p_mapping); |
1644 | out_iounmap: | 1717 | out_iounmap: |
1645 | iounmap(phba->ctrl_regs_memmap_p); | 1718 | iounmap(phba->ctrl_regs_memmap_p); |
1719 | out_iounmap_slim: | ||
1646 | iounmap(phba->slim_memmap_p); | 1720 | iounmap(phba->slim_memmap_p); |
1647 | out_idr_remove: | 1721 | out_idr_remove: |
1648 | idr_remove(&lpfc_hba_index, phba->brd_no); | 1722 | idr_remove(&lpfc_hba_index, phba->brd_no); |
@@ -1660,7 +1734,7 @@ static void __devexit | |||
1660 | lpfc_pci_remove_one(struct pci_dev *pdev) | 1734 | lpfc_pci_remove_one(struct pci_dev *pdev) |
1661 | { | 1735 | { |
1662 | struct Scsi_Host *host = pci_get_drvdata(pdev); | 1736 | struct Scsi_Host *host = pci_get_drvdata(pdev); |
1663 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata[0]; | 1737 | struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata; |
1664 | unsigned long iflag; | 1738 | unsigned long iflag; |
1665 | 1739 | ||
1666 | lpfc_free_sysfs_attr(phba); | 1740 | lpfc_free_sysfs_attr(phba); |
@@ -1681,6 +1755,7 @@ lpfc_pci_remove_one(struct pci_dev *pdev) | |||
1681 | * the HBA. | 1755 | * the HBA. |
1682 | */ | 1756 | */ |
1683 | lpfc_sli_hba_down(phba); | 1757 | lpfc_sli_hba_down(phba); |
1758 | lpfc_sli_brdrestart(phba); | ||
1684 | 1759 | ||
1685 | /* Release the irq reservation */ | 1760 | /* Release the irq reservation */ |
1686 | free_irq(phba->pcidev->irq, phba); | 1761 | free_irq(phba->pcidev->irq, phba); |