diff options
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_init.c')
-rw-r--r-- | drivers/scsi/qla2xxx/qla_init.c | 97 |
1 files changed, 70 insertions, 27 deletions
diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c index 191dafd89be0..d0633ca894be 100644 --- a/drivers/scsi/qla2xxx/qla_init.c +++ b/drivers/scsi/qla2xxx/qla_init.c | |||
@@ -732,9 +732,9 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
732 | { | 732 | { |
733 | int rval; | 733 | int rval; |
734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, | 734 | uint32_t dump_size, fixed_size, mem_size, req_q_size, rsp_q_size, |
735 | eft_size; | 735 | eft_size, fce_size; |
736 | dma_addr_t eft_dma; | 736 | dma_addr_t tc_dma; |
737 | void *eft; | 737 | void *tc; |
738 | 738 | ||
739 | if (ha->fw_dump) { | 739 | if (ha->fw_dump) { |
740 | qla_printk(KERN_WARNING, ha, | 740 | qla_printk(KERN_WARNING, ha, |
@@ -743,7 +743,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
743 | } | 743 | } |
744 | 744 | ||
745 | ha->fw_dumped = 0; | 745 | ha->fw_dumped = 0; |
746 | fixed_size = mem_size = eft_size = 0; | 746 | fixed_size = mem_size = eft_size = fce_size = 0; |
747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { | 747 | if (IS_QLA2100(ha) || IS_QLA2200(ha)) { |
748 | fixed_size = sizeof(struct qla2100_fw_dump); | 748 | fixed_size = sizeof(struct qla2100_fw_dump); |
749 | } else if (IS_QLA23XX(ha)) { | 749 | } else if (IS_QLA23XX(ha)) { |
@@ -758,21 +758,21 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
758 | sizeof(uint32_t); | 758 | sizeof(uint32_t); |
759 | 759 | ||
760 | /* Allocate memory for Extended Trace Buffer. */ | 760 | /* Allocate memory for Extended Trace Buffer. */ |
761 | eft = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &eft_dma, | 761 | tc = dma_alloc_coherent(&ha->pdev->dev, EFT_SIZE, &tc_dma, |
762 | GFP_KERNEL); | 762 | GFP_KERNEL); |
763 | if (!eft) { | 763 | if (!tc) { |
764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | 764 | qla_printk(KERN_WARNING, ha, "Unable to allocate " |
765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); | 765 | "(%d KB) for EFT.\n", EFT_SIZE / 1024); |
766 | goto cont_alloc; | 766 | goto cont_alloc; |
767 | } | 767 | } |
768 | 768 | ||
769 | rval = qla2x00_trace_control(ha, TC_ENABLE, eft_dma, | 769 | memset(tc, 0, EFT_SIZE); |
770 | EFT_NUM_BUFFERS); | 770 | rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS); |
771 | if (rval) { | 771 | if (rval) { |
772 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | 772 | qla_printk(KERN_WARNING, ha, "Unable to initialize " |
773 | "EFT (%d).\n", rval); | 773 | "EFT (%d).\n", rval); |
774 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, eft, | 774 | dma_free_coherent(&ha->pdev->dev, EFT_SIZE, tc, |
775 | eft_dma); | 775 | tc_dma); |
776 | goto cont_alloc; | 776 | goto cont_alloc; |
777 | } | 777 | } |
778 | 778 | ||
@@ -780,9 +780,40 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha) | |||
780 | EFT_SIZE / 1024); | 780 | EFT_SIZE / 1024); |
781 | 781 | ||
782 | eft_size = EFT_SIZE; | 782 | eft_size = EFT_SIZE; |
783 | memset(eft, 0, eft_size); | 783 | ha->eft_dma = tc_dma; |
784 | ha->eft_dma = eft_dma; | 784 | ha->eft = tc; |
785 | ha->eft = eft; | 785 | |
786 | /* Allocate memory for Fibre Channel Event Buffer. */ | ||
787 | if (!IS_QLA25XX(ha)) | ||
788 | goto cont_alloc; | ||
789 | |||
790 | tc = dma_alloc_coherent(&ha->pdev->dev, FCE_SIZE, &tc_dma, | ||
791 | GFP_KERNEL); | ||
792 | if (!tc) { | ||
793 | qla_printk(KERN_WARNING, ha, "Unable to allocate " | ||
794 | "(%d KB) for FCE.\n", FCE_SIZE / 1024); | ||
795 | goto cont_alloc; | ||
796 | } | ||
797 | |||
798 | memset(tc, 0, FCE_SIZE); | ||
799 | rval = qla2x00_enable_fce_trace(ha, tc_dma, FCE_NUM_BUFFERS, | ||
800 | ha->fce_mb, &ha->fce_bufs); | ||
801 | if (rval) { | ||
802 | qla_printk(KERN_WARNING, ha, "Unable to initialize " | ||
803 | "FCE (%d).\n", rval); | ||
804 | dma_free_coherent(&ha->pdev->dev, FCE_SIZE, tc, | ||
805 | tc_dma); | ||
806 | ha->flags.fce_enabled = 0; | ||
807 | goto cont_alloc; | ||
808 | } | ||
809 | |||
810 | qla_printk(KERN_INFO, ha, "Allocated (%d KB) for FCE...\n", | ||
811 | FCE_SIZE / 1024); | ||
812 | |||
813 | fce_size = sizeof(struct qla2xxx_fce_chain) + EFT_SIZE; | ||
814 | ha->flags.fce_enabled = 1; | ||
815 | ha->fce_dma = tc_dma; | ||
816 | ha->fce = tc; | ||
786 | } | 817 | } |
787 | cont_alloc: | 818 | cont_alloc: |
788 | req_q_size = ha->request_q_length * sizeof(request_t); | 819 | req_q_size = ha->request_q_length * sizeof(request_t); |
@@ -790,7 +821,7 @@ cont_alloc: | |||
790 | 821 | ||
791 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); | 822 | dump_size = offsetof(struct qla2xxx_fw_dump, isp); |
792 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + | 823 | dump_size += fixed_size + mem_size + req_q_size + rsp_q_size + |
793 | eft_size; | 824 | eft_size + fce_size; |
794 | 825 | ||
795 | ha->fw_dump = vmalloc(dump_size); | 826 | ha->fw_dump = vmalloc(dump_size); |
796 | if (!ha->fw_dump) { | 827 | if (!ha->fw_dump) { |
@@ -922,9 +953,9 @@ qla2x00_setup_chip(scsi_qla_host_t *ha) | |||
922 | ha->flags.npiv_supported = 1; | 953 | ha->flags.npiv_supported = 1; |
923 | if ((!ha->max_npiv_vports) || | 954 | if ((!ha->max_npiv_vports) || |
924 | ((ha->max_npiv_vports + 1) % | 955 | ((ha->max_npiv_vports + 1) % |
925 | MAX_MULTI_ID_FABRIC)) | 956 | MIN_MULTI_ID_FABRIC)) |
926 | ha->max_npiv_vports = | 957 | ha->max_npiv_vports = |
927 | MAX_NUM_VPORT_FABRIC; | 958 | MIN_MULTI_ID_FABRIC - 1; |
928 | } | 959 | } |
929 | 960 | ||
930 | if (ql2xallocfwdump) | 961 | if (ql2xallocfwdump) |
@@ -1162,7 +1193,10 @@ qla2x00_init_rings(scsi_qla_host_t *ha) | |||
1162 | 1193 | ||
1163 | DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); | 1194 | DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no)); |
1164 | 1195 | ||
1165 | mid_init_cb->count = ha->max_npiv_vports; | 1196 | if (ha->flags.npiv_supported) |
1197 | mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports); | ||
1198 | |||
1199 | mid_init_cb->options = __constant_cpu_to_le16(BIT_1); | ||
1166 | 1200 | ||
1167 | rval = qla2x00_init_firmware(ha, ha->init_cb_size); | 1201 | rval = qla2x00_init_firmware(ha, ha->init_cb_size); |
1168 | if (rval) { | 1202 | if (rval) { |
@@ -2566,14 +2600,7 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) | |||
2566 | 2600 | ||
2567 | /* Bypass virtual ports of the same host. */ | 2601 | /* Bypass virtual ports of the same host. */ |
2568 | if (pha->num_vhosts) { | 2602 | if (pha->num_vhosts) { |
2569 | vp_index = find_next_bit( | 2603 | for_each_mapped_vp_idx(pha, vp_index) { |
2570 | (unsigned long *)pha->vp_idx_map, | ||
2571 | MAX_MULTI_ID_FABRIC + 1, 1); | ||
2572 | |||
2573 | for (;vp_index <= MAX_MULTI_ID_FABRIC; | ||
2574 | vp_index = find_next_bit( | ||
2575 | (unsigned long *)pha->vp_idx_map, | ||
2576 | MAX_MULTI_ID_FABRIC + 1, vp_index + 1)) { | ||
2577 | empty_vp_index = 1; | 2604 | empty_vp_index = 1; |
2578 | found_vp = 0; | 2605 | found_vp = 0; |
2579 | list_for_each_entry(vha, &pha->vp_list, | 2606 | list_for_each_entry(vha, &pha->vp_list, |
@@ -2592,7 +2619,8 @@ qla2x00_find_all_fabric_devs(scsi_qla_host_t *ha, struct list_head *new_fcports) | |||
2592 | new_fcport->d_id.b24 == vha->d_id.b24) | 2619 | new_fcport->d_id.b24 == vha->d_id.b24) |
2593 | break; | 2620 | break; |
2594 | } | 2621 | } |
2595 | if (vp_index <= MAX_MULTI_ID_FABRIC) | 2622 | |
2623 | if (vp_index <= pha->max_npiv_vports) | ||
2596 | continue; | 2624 | continue; |
2597 | } | 2625 | } |
2598 | 2626 | ||
@@ -3245,7 +3273,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3245 | clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); | 3273 | clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags); |
3246 | 3274 | ||
3247 | if (ha->eft) { | 3275 | if (ha->eft) { |
3248 | rval = qla2x00_trace_control(ha, TC_ENABLE, | 3276 | rval = qla2x00_enable_eft_trace(ha, |
3249 | ha->eft_dma, EFT_NUM_BUFFERS); | 3277 | ha->eft_dma, EFT_NUM_BUFFERS); |
3250 | if (rval) { | 3278 | if (rval) { |
3251 | qla_printk(KERN_WARNING, ha, | 3279 | qla_printk(KERN_WARNING, ha, |
@@ -3253,6 +3281,21 @@ qla2x00_abort_isp(scsi_qla_host_t *ha) | |||
3253 | "(%d).\n", rval); | 3281 | "(%d).\n", rval); |
3254 | } | 3282 | } |
3255 | } | 3283 | } |
3284 | |||
3285 | if (ha->fce) { | ||
3286 | ha->flags.fce_enabled = 1; | ||
3287 | memset(ha->fce, 0, | ||
3288 | fce_calc_size(ha->fce_bufs)); | ||
3289 | rval = qla2x00_enable_fce_trace(ha, | ||
3290 | ha->fce_dma, ha->fce_bufs, ha->fce_mb, | ||
3291 | &ha->fce_bufs); | ||
3292 | if (rval) { | ||
3293 | qla_printk(KERN_WARNING, ha, | ||
3294 | "Unable to reinitialize FCE " | ||
3295 | "(%d).\n", rval); | ||
3296 | ha->flags.fce_enabled = 0; | ||
3297 | } | ||
3298 | } | ||
3256 | } else { /* failed the ISP abort */ | 3299 | } else { /* failed the ISP abort */ |
3257 | ha->flags.online = 1; | 3300 | ha->flags.online = 1; |
3258 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { | 3301 | if (test_bit(ISP_ABORT_RETRY, &ha->dpc_flags)) { |