diff options
Diffstat (limited to 'drivers/scsi/be2iscsi/be_main.c')
-rw-r--r-- | drivers/scsi/be2iscsi/be_main.c | 333 |
1 files changed, 227 insertions, 106 deletions
diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c index dd5b105f8f47..7436c5ad5697 100644 --- a/drivers/scsi/be2iscsi/be_main.c +++ b/drivers/scsi/be2iscsi/be_main.c | |||
@@ -41,6 +41,8 @@ | |||
41 | static unsigned int be_iopoll_budget = 10; | 41 | static unsigned int be_iopoll_budget = 10; |
42 | static unsigned int be_max_phys_size = 64; | 42 | static unsigned int be_max_phys_size = 64; |
43 | static unsigned int enable_msix = 1; | 43 | static unsigned int enable_msix = 1; |
44 | static unsigned int gcrashmode = 0; | ||
45 | static unsigned int num_hba = 0; | ||
44 | 46 | ||
45 | MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); | 47 | MODULE_DEVICE_TABLE(pci, beiscsi_pci_id_table); |
46 | MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); | 48 | MODULE_DESCRIPTION(DRV_DESC " " BUILD_STR); |
@@ -69,6 +71,7 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) | |||
69 | struct beiscsi_hba *phba; | 71 | struct beiscsi_hba *phba; |
70 | struct iscsi_session *session; | 72 | struct iscsi_session *session; |
71 | struct invalidate_command_table *inv_tbl; | 73 | struct invalidate_command_table *inv_tbl; |
74 | struct be_dma_mem nonemb_cmd; | ||
72 | unsigned int cid, tag, num_invalidate; | 75 | unsigned int cid, tag, num_invalidate; |
73 | 76 | ||
74 | cls_session = starget_to_session(scsi_target(sc->device)); | 77 | cls_session = starget_to_session(scsi_target(sc->device)); |
@@ -99,18 +102,34 @@ static int beiscsi_eh_abort(struct scsi_cmnd *sc) | |||
99 | inv_tbl->cid = cid; | 102 | inv_tbl->cid = cid; |
100 | inv_tbl->icd = aborted_io_task->psgl_handle->sgl_index; | 103 | inv_tbl->icd = aborted_io_task->psgl_handle->sgl_index; |
101 | num_invalidate = 1; | 104 | num_invalidate = 1; |
102 | tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, cid); | 105 | nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, |
106 | sizeof(struct invalidate_commands_params_in), | ||
107 | &nonemb_cmd.dma); | ||
108 | if (nonemb_cmd.va == NULL) { | ||
109 | SE_DEBUG(DBG_LVL_1, | ||
110 | "Failed to allocate memory for" | ||
111 | "mgmt_invalidate_icds\n"); | ||
112 | return FAILED; | ||
113 | } | ||
114 | nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); | ||
115 | |||
116 | tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, | ||
117 | cid, &nonemb_cmd); | ||
103 | if (!tag) { | 118 | if (!tag) { |
104 | shost_printk(KERN_WARNING, phba->shost, | 119 | shost_printk(KERN_WARNING, phba->shost, |
105 | "mgmt_invalidate_icds could not be" | 120 | "mgmt_invalidate_icds could not be" |
106 | " submitted\n"); | 121 | " submitted\n"); |
122 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | ||
123 | nonemb_cmd.va, nonemb_cmd.dma); | ||
124 | |||
107 | return FAILED; | 125 | return FAILED; |
108 | } else { | 126 | } else { |
109 | wait_event_interruptible(phba->ctrl.mcc_wait[tag], | 127 | wait_event_interruptible(phba->ctrl.mcc_wait[tag], |
110 | phba->ctrl.mcc_numtag[tag]); | 128 | phba->ctrl.mcc_numtag[tag]); |
111 | free_mcc_tag(&phba->ctrl, tag); | 129 | free_mcc_tag(&phba->ctrl, tag); |
112 | } | 130 | } |
113 | 131 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
132 | nonemb_cmd.va, nonemb_cmd.dma); | ||
114 | return iscsi_eh_abort(sc); | 133 | return iscsi_eh_abort(sc); |
115 | } | 134 | } |
116 | 135 | ||
@@ -124,6 +143,7 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) | |||
124 | struct iscsi_session *session; | 143 | struct iscsi_session *session; |
125 | struct iscsi_cls_session *cls_session; | 144 | struct iscsi_cls_session *cls_session; |
126 | struct invalidate_command_table *inv_tbl; | 145 | struct invalidate_command_table *inv_tbl; |
146 | struct be_dma_mem nonemb_cmd; | ||
127 | unsigned int cid, tag, i, num_invalidate; | 147 | unsigned int cid, tag, i, num_invalidate; |
128 | int rc = FAILED; | 148 | int rc = FAILED; |
129 | 149 | ||
@@ -158,18 +178,33 @@ static int beiscsi_eh_device_reset(struct scsi_cmnd *sc) | |||
158 | spin_unlock_bh(&session->lock); | 178 | spin_unlock_bh(&session->lock); |
159 | inv_tbl = phba->inv_tbl; | 179 | inv_tbl = phba->inv_tbl; |
160 | 180 | ||
161 | tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, cid); | 181 | nonemb_cmd.va = pci_alloc_consistent(phba->ctrl.pdev, |
182 | sizeof(struct invalidate_commands_params_in), | ||
183 | &nonemb_cmd.dma); | ||
184 | if (nonemb_cmd.va == NULL) { | ||
185 | SE_DEBUG(DBG_LVL_1, | ||
186 | "Failed to allocate memory for" | ||
187 | "mgmt_invalidate_icds\n"); | ||
188 | return FAILED; | ||
189 | } | ||
190 | nonemb_cmd.size = sizeof(struct invalidate_commands_params_in); | ||
191 | memset(nonemb_cmd.va, 0, nonemb_cmd.size); | ||
192 | tag = mgmt_invalidate_icds(phba, inv_tbl, num_invalidate, | ||
193 | cid, &nonemb_cmd); | ||
162 | if (!tag) { | 194 | if (!tag) { |
163 | shost_printk(KERN_WARNING, phba->shost, | 195 | shost_printk(KERN_WARNING, phba->shost, |
164 | "mgmt_invalidate_icds could not be" | 196 | "mgmt_invalidate_icds could not be" |
165 | " submitted\n"); | 197 | " submitted\n"); |
198 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | ||
199 | nonemb_cmd.va, nonemb_cmd.dma); | ||
166 | return FAILED; | 200 | return FAILED; |
167 | } else { | 201 | } else { |
168 | wait_event_interruptible(phba->ctrl.mcc_wait[tag], | 202 | wait_event_interruptible(phba->ctrl.mcc_wait[tag], |
169 | phba->ctrl.mcc_numtag[tag]); | 203 | phba->ctrl.mcc_numtag[tag]); |
170 | free_mcc_tag(&phba->ctrl, tag); | 204 | free_mcc_tag(&phba->ctrl, tag); |
171 | } | 205 | } |
172 | 206 | pci_free_consistent(phba->ctrl.pdev, nonemb_cmd.size, | |
207 | nonemb_cmd.va, nonemb_cmd.dma); | ||
173 | return iscsi_eh_device_reset(sc); | 208 | return iscsi_eh_device_reset(sc); |
174 | unlock: | 209 | unlock: |
175 | spin_unlock_bh(&session->lock); | 210 | spin_unlock_bh(&session->lock); |
@@ -216,7 +251,7 @@ static struct beiscsi_hba *beiscsi_hba_alloc(struct pci_dev *pcidev) | |||
216 | shost = iscsi_host_alloc(&beiscsi_sht, sizeof(*phba), 0); | 251 | shost = iscsi_host_alloc(&beiscsi_sht, sizeof(*phba), 0); |
217 | if (!shost) { | 252 | if (!shost) { |
218 | dev_err(&pcidev->dev, "beiscsi_hba_alloc -" | 253 | dev_err(&pcidev->dev, "beiscsi_hba_alloc -" |
219 | "iscsi_host_alloc failed \n"); | 254 | "iscsi_host_alloc failed\n"); |
220 | return NULL; | 255 | return NULL; |
221 | } | 256 | } |
222 | shost->dma_boundary = pcidev->dma_mask; | 257 | shost->dma_boundary = pcidev->dma_mask; |
@@ -371,7 +406,7 @@ static void beiscsi_get_params(struct beiscsi_hba *phba) | |||
371 | + BE2_TMFS) / 512) + 1) * 512; | 406 | + BE2_TMFS) / 512) + 1) * 512; |
372 | phba->params.num_eq_entries = (phba->params.num_eq_entries < 1024) | 407 | phba->params.num_eq_entries = (phba->params.num_eq_entries < 1024) |
373 | ? 1024 : phba->params.num_eq_entries; | 408 | ? 1024 : phba->params.num_eq_entries; |
374 | SE_DEBUG(DBG_LVL_8, "phba->params.num_eq_entries=%d \n", | 409 | SE_DEBUG(DBG_LVL_8, "phba->params.num_eq_entries=%d\n", |
375 | phba->params.num_eq_entries); | 410 | phba->params.num_eq_entries); |
376 | phba->params.num_cq_entries = | 411 | phba->params.num_cq_entries = |
377 | (((BE2_CMDS_PER_CXN * 2 + phba->fw_config.iscsi_cid_count * 2 | 412 | (((BE2_CMDS_PER_CXN * 2 + phba->fw_config.iscsi_cid_count * 2 |
@@ -616,7 +651,7 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) | |||
616 | struct pci_dev *pcidev = phba->pcidev; | 651 | struct pci_dev *pcidev = phba->pcidev; |
617 | struct hwi_controller *phwi_ctrlr; | 652 | struct hwi_controller *phwi_ctrlr; |
618 | struct hwi_context_memory *phwi_context; | 653 | struct hwi_context_memory *phwi_context; |
619 | int ret, msix_vec, i = 0; | 654 | int ret, msix_vec, i, j; |
620 | char desc[32]; | 655 | char desc[32]; |
621 | 656 | ||
622 | phwi_ctrlr = phba->phwi_ctrlr; | 657 | phwi_ctrlr = phba->phwi_ctrlr; |
@@ -628,10 +663,25 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) | |||
628 | msix_vec = phba->msix_entries[i].vector; | 663 | msix_vec = phba->msix_entries[i].vector; |
629 | ret = request_irq(msix_vec, be_isr_msix, 0, desc, | 664 | ret = request_irq(msix_vec, be_isr_msix, 0, desc, |
630 | &phwi_context->be_eq[i]); | 665 | &phwi_context->be_eq[i]); |
666 | if (ret) { | ||
667 | shost_printk(KERN_ERR, phba->shost, | ||
668 | "beiscsi_init_irqs-Failed to" | ||
669 | "register msix for i = %d\n", i); | ||
670 | if (!i) | ||
671 | return ret; | ||
672 | goto free_msix_irqs; | ||
673 | } | ||
631 | } | 674 | } |
632 | msix_vec = phba->msix_entries[i].vector; | 675 | msix_vec = phba->msix_entries[i].vector; |
633 | ret = request_irq(msix_vec, be_isr_mcc, 0, "beiscsi_msix_mcc", | 676 | ret = request_irq(msix_vec, be_isr_mcc, 0, "beiscsi_msix_mcc", |
634 | &phwi_context->be_eq[i]); | 677 | &phwi_context->be_eq[i]); |
678 | if (ret) { | ||
679 | shost_printk(KERN_ERR, phba->shost, "beiscsi_init_irqs-" | ||
680 | "Failed to register beiscsi_msix_mcc\n"); | ||
681 | i++; | ||
682 | goto free_msix_irqs; | ||
683 | } | ||
684 | |||
635 | } else { | 685 | } else { |
636 | ret = request_irq(pcidev->irq, be_isr, IRQF_SHARED, | 686 | ret = request_irq(pcidev->irq, be_isr, IRQF_SHARED, |
637 | "beiscsi", phba); | 687 | "beiscsi", phba); |
@@ -642,6 +692,10 @@ static int beiscsi_init_irqs(struct beiscsi_hba *phba) | |||
642 | } | 692 | } |
643 | } | 693 | } |
644 | return 0; | 694 | return 0; |
695 | free_msix_irqs: | ||
696 | for (j = i - 1; j == 0; j++) | ||
697 | free_irq(msix_vec, &phwi_context->be_eq[j]); | ||
698 | return ret; | ||
645 | } | 699 | } |
646 | 700 | ||
647 | static void hwi_ring_cq_db(struct beiscsi_hba *phba, | 701 | static void hwi_ring_cq_db(struct beiscsi_hba *phba, |
@@ -692,7 +746,7 @@ beiscsi_process_async_pdu(struct beiscsi_conn *beiscsi_conn, | |||
692 | break; | 746 | break; |
693 | default: | 747 | default: |
694 | shost_printk(KERN_WARNING, phba->shost, | 748 | shost_printk(KERN_WARNING, phba->shost, |
695 | "Unrecognized opcode 0x%x in async msg \n", | 749 | "Unrecognized opcode 0x%x in async msg\n", |
696 | (ppdu-> | 750 | (ppdu-> |
697 | dw[offsetof(struct amap_pdu_base, opcode) / 32] | 751 | dw[offsetof(struct amap_pdu_base, opcode) / 32] |
698 | & PDUBASE_OPCODE_MASK)); | 752 | & PDUBASE_OPCODE_MASK)); |
@@ -711,7 +765,7 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba) | |||
711 | 765 | ||
712 | if (phba->io_sgl_hndl_avbl) { | 766 | if (phba->io_sgl_hndl_avbl) { |
713 | SE_DEBUG(DBG_LVL_8, | 767 | SE_DEBUG(DBG_LVL_8, |
714 | "In alloc_io_sgl_handle,io_sgl_alloc_index=%d \n", | 768 | "In alloc_io_sgl_handle,io_sgl_alloc_index=%d\n", |
715 | phba->io_sgl_alloc_index); | 769 | phba->io_sgl_alloc_index); |
716 | psgl_handle = phba->io_sgl_hndl_base[phba-> | 770 | psgl_handle = phba->io_sgl_hndl_base[phba-> |
717 | io_sgl_alloc_index]; | 771 | io_sgl_alloc_index]; |
@@ -730,7 +784,7 @@ static struct sgl_handle *alloc_io_sgl_handle(struct beiscsi_hba *phba) | |||
730 | static void | 784 | static void |
731 | free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | 785 | free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) |
732 | { | 786 | { |
733 | SE_DEBUG(DBG_LVL_8, "In free_,io_sgl_free_index=%d \n", | 787 | SE_DEBUG(DBG_LVL_8, "In free_,io_sgl_free_index=%d\n", |
734 | phba->io_sgl_free_index); | 788 | phba->io_sgl_free_index); |
735 | if (phba->io_sgl_hndl_base[phba->io_sgl_free_index]) { | 789 | if (phba->io_sgl_hndl_base[phba->io_sgl_free_index]) { |
736 | /* | 790 | /* |
@@ -739,7 +793,7 @@ free_io_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
739 | */ | 793 | */ |
740 | SE_DEBUG(DBG_LVL_8, | 794 | SE_DEBUG(DBG_LVL_8, |
741 | "Double Free in IO SGL io_sgl_free_index=%d," | 795 | "Double Free in IO SGL io_sgl_free_index=%d," |
742 | "value there=%p \n", phba->io_sgl_free_index, | 796 | "value there=%p\n", phba->io_sgl_free_index, |
743 | phba->io_sgl_hndl_base[phba->io_sgl_free_index]); | 797 | phba->io_sgl_hndl_base[phba->io_sgl_free_index]); |
744 | return; | 798 | return; |
745 | } | 799 | } |
@@ -804,7 +858,7 @@ free_wrb_handle(struct beiscsi_hba *phba, struct hwi_wrb_context *pwrb_context, | |||
804 | 858 | ||
805 | SE_DEBUG(DBG_LVL_8, | 859 | SE_DEBUG(DBG_LVL_8, |
806 | "FREE WRB: pwrb_handle=%p free_index=0x%x" | 860 | "FREE WRB: pwrb_handle=%p free_index=0x%x" |
807 | "wrb_handles_available=%d \n", | 861 | "wrb_handles_available=%d\n", |
808 | pwrb_handle, pwrb_context->free_index, | 862 | pwrb_handle, pwrb_context->free_index, |
809 | pwrb_context->wrb_handles_available); | 863 | pwrb_context->wrb_handles_available); |
810 | } | 864 | } |
@@ -816,7 +870,7 @@ static struct sgl_handle *alloc_mgmt_sgl_handle(struct beiscsi_hba *phba) | |||
816 | if (phba->eh_sgl_hndl_avbl) { | 870 | if (phba->eh_sgl_hndl_avbl) { |
817 | psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index]; | 871 | psgl_handle = phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index]; |
818 | phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL; | 872 | phba->eh_sgl_hndl_base[phba->eh_sgl_alloc_index] = NULL; |
819 | SE_DEBUG(DBG_LVL_8, "mgmt_sgl_alloc_index=%d=0x%x \n", | 873 | SE_DEBUG(DBG_LVL_8, "mgmt_sgl_alloc_index=%d=0x%x\n", |
820 | phba->eh_sgl_alloc_index, phba->eh_sgl_alloc_index); | 874 | phba->eh_sgl_alloc_index, phba->eh_sgl_alloc_index); |
821 | phba->eh_sgl_hndl_avbl--; | 875 | phba->eh_sgl_hndl_avbl--; |
822 | if (phba->eh_sgl_alloc_index == | 876 | if (phba->eh_sgl_alloc_index == |
@@ -834,7 +888,7 @@ void | |||
834 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | 888 | free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) |
835 | { | 889 | { |
836 | 890 | ||
837 | SE_DEBUG(DBG_LVL_8, "In free_mgmt_sgl_handle,eh_sgl_free_index=%d \n", | 891 | SE_DEBUG(DBG_LVL_8, "In free_mgmt_sgl_handle,eh_sgl_free_index=%d\n", |
838 | phba->eh_sgl_free_index); | 892 | phba->eh_sgl_free_index); |
839 | if (phba->eh_sgl_hndl_base[phba->eh_sgl_free_index]) { | 893 | if (phba->eh_sgl_hndl_base[phba->eh_sgl_free_index]) { |
840 | /* | 894 | /* |
@@ -842,7 +896,7 @@ free_mgmt_sgl_handle(struct beiscsi_hba *phba, struct sgl_handle *psgl_handle) | |||
842 | * failed in xmit_task or alloc_pdu. | 896 | * failed in xmit_task or alloc_pdu. |
843 | */ | 897 | */ |
844 | SE_DEBUG(DBG_LVL_8, | 898 | SE_DEBUG(DBG_LVL_8, |
845 | "Double Free in eh SGL ,eh_sgl_free_index=%d \n", | 899 | "Double Free in eh SGL ,eh_sgl_free_index=%d\n", |
846 | phba->eh_sgl_free_index); | 900 | phba->eh_sgl_free_index); |
847 | return; | 901 | return; |
848 | } | 902 | } |
@@ -1081,7 +1135,7 @@ static void hwi_complete_cmd(struct beiscsi_conn *beiscsi_conn, | |||
1081 | case HWH_TYPE_LOGIN: | 1135 | case HWH_TYPE_LOGIN: |
1082 | SE_DEBUG(DBG_LVL_1, | 1136 | SE_DEBUG(DBG_LVL_1, |
1083 | "\t\t No HWH_TYPE_LOGIN Expected in hwi_complete_cmd" | 1137 | "\t\t No HWH_TYPE_LOGIN Expected in hwi_complete_cmd" |
1084 | "- Solicited path \n"); | 1138 | "- Solicited path\n"); |
1085 | break; | 1139 | break; |
1086 | 1140 | ||
1087 | case HWH_TYPE_NOP: | 1141 | case HWH_TYPE_NOP: |
@@ -1164,7 +1218,7 @@ hwi_get_async_handle(struct beiscsi_hba *phba, | |||
1164 | default: | 1218 | default: |
1165 | pbusy_list = NULL; | 1219 | pbusy_list = NULL; |
1166 | shost_printk(KERN_WARNING, phba->shost, | 1220 | shost_printk(KERN_WARNING, phba->shost, |
1167 | "Unexpected code=%d \n", | 1221 | "Unexpected code=%d\n", |
1168 | pdpdu_cqe->dw[offsetof(struct amap_i_t_dpdu_cqe, | 1222 | pdpdu_cqe->dw[offsetof(struct amap_i_t_dpdu_cqe, |
1169 | code) / 32] & PDUCQE_CODE_MASK); | 1223 | code) / 32] & PDUCQE_CODE_MASK); |
1170 | return NULL; | 1224 | return NULL; |
@@ -1552,7 +1606,7 @@ static void beiscsi_process_mcc_isr(struct beiscsi_hba *phba) | |||
1552 | else | 1606 | else |
1553 | SE_DEBUG(DBG_LVL_1, | 1607 | SE_DEBUG(DBG_LVL_1, |
1554 | " Unsupported Async Event, flags" | 1608 | " Unsupported Async Event, flags" |
1555 | " = 0x%08x \n", mcc_compl->flags); | 1609 | " = 0x%08x\n", mcc_compl->flags); |
1556 | } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) { | 1610 | } else if (mcc_compl->flags & CQE_FLAGS_COMPLETED_MASK) { |
1557 | be_mcc_compl_process_isr(&phba->ctrl, mcc_compl); | 1611 | be_mcc_compl_process_isr(&phba->ctrl, mcc_compl); |
1558 | atomic_dec(&phba->ctrl.mcc_obj.q.used); | 1612 | atomic_dec(&phba->ctrl.mcc_obj.q.used); |
@@ -1611,7 +1665,7 @@ static unsigned int beiscsi_process_cq(struct be_eq_obj *pbe_eq) | |||
1611 | hwi_complete_cmd(beiscsi_conn, phba, sol); | 1665 | hwi_complete_cmd(beiscsi_conn, phba, sol); |
1612 | break; | 1666 | break; |
1613 | case DRIVERMSG_NOTIFY: | 1667 | case DRIVERMSG_NOTIFY: |
1614 | SE_DEBUG(DBG_LVL_8, "Received DRIVERMSG_NOTIFY \n"); | 1668 | SE_DEBUG(DBG_LVL_8, "Received DRIVERMSG_NOTIFY\n"); |
1615 | dmsg = (struct dmsg_cqe *)sol; | 1669 | dmsg = (struct dmsg_cqe *)sol; |
1616 | hwi_complete_drvr_msgs(beiscsi_conn, phba, sol); | 1670 | hwi_complete_drvr_msgs(beiscsi_conn, phba, sol); |
1617 | break; | 1671 | break; |
@@ -1782,9 +1836,9 @@ hwi_write_sgl(struct iscsi_wrb *pwrb, struct scatterlist *sg, | |||
1782 | sg_len = sg_dma_len(sg); | 1836 | sg_len = sg_dma_len(sg); |
1783 | addr = (u64) sg_dma_address(sg); | 1837 | addr = (u64) sg_dma_address(sg); |
1784 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_lo, pwrb, | 1838 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_lo, pwrb, |
1785 | (addr & 0xFFFFFFFF)); | 1839 | ((u32)(addr & 0xFFFFFFFF))); |
1786 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_hi, pwrb, | 1840 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_hi, pwrb, |
1787 | (addr >> 32)); | 1841 | ((u32)(addr >> 32))); |
1788 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_len, pwrb, | 1842 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_len, pwrb, |
1789 | sg_len); | 1843 | sg_len); |
1790 | sge_len = sg_len; | 1844 | sge_len = sg_len; |
@@ -1794,9 +1848,9 @@ hwi_write_sgl(struct iscsi_wrb *pwrb, struct scatterlist *sg, | |||
1794 | sg_len = sg_dma_len(sg); | 1848 | sg_len = sg_dma_len(sg); |
1795 | addr = (u64) sg_dma_address(sg); | 1849 | addr = (u64) sg_dma_address(sg); |
1796 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_addr_lo, pwrb, | 1850 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_addr_lo, pwrb, |
1797 | (addr & 0xFFFFFFFF)); | 1851 | ((u32)(addr & 0xFFFFFFFF))); |
1798 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_addr_hi, pwrb, | 1852 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_addr_hi, pwrb, |
1799 | (addr >> 32)); | 1853 | ((u32)(addr >> 32))); |
1800 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_len, pwrb, | 1854 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge1_len, pwrb, |
1801 | sg_len); | 1855 | sg_len); |
1802 | } | 1856 | } |
@@ -1872,9 +1926,9 @@ static void hwi_write_buffer(struct iscsi_wrb *pwrb, struct iscsi_task *task) | |||
1872 | addr = 0; | 1926 | addr = 0; |
1873 | } | 1927 | } |
1874 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_lo, pwrb, | 1928 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_lo, pwrb, |
1875 | (addr & 0xFFFFFFFF)); | 1929 | ((u32)(addr & 0xFFFFFFFF))); |
1876 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_hi, pwrb, | 1930 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_addr_hi, pwrb, |
1877 | (addr >> 32)); | 1931 | ((u32)(addr >> 32))); |
1878 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_len, pwrb, | 1932 | AMAP_SET_BITS(struct amap_iscsi_wrb, sge0_len, pwrb, |
1879 | task->data_count); | 1933 | task->data_count); |
1880 | 1934 | ||
@@ -1904,9 +1958,9 @@ static void hwi_write_buffer(struct iscsi_wrb *pwrb, struct iscsi_task *task) | |||
1904 | psgl++; | 1958 | psgl++; |
1905 | if (task->data) { | 1959 | if (task->data) { |
1906 | AMAP_SET_BITS(struct amap_iscsi_sge, addr_lo, psgl, | 1960 | AMAP_SET_BITS(struct amap_iscsi_sge, addr_lo, psgl, |
1907 | (addr & 0xFFFFFFFF)); | 1961 | ((u32)(addr & 0xFFFFFFFF))); |
1908 | AMAP_SET_BITS(struct amap_iscsi_sge, addr_hi, psgl, | 1962 | AMAP_SET_BITS(struct amap_iscsi_sge, addr_hi, psgl, |
1909 | (addr >> 32)); | 1963 | ((u32)(addr >> 32))); |
1910 | } | 1964 | } |
1911 | AMAP_SET_BITS(struct amap_iscsi_sge, len, psgl, 0x106); | 1965 | AMAP_SET_BITS(struct amap_iscsi_sge, len, psgl, 0x106); |
1912 | } | 1966 | } |
@@ -2054,7 +2108,8 @@ free_mem: | |||
2054 | mem_descr->mem_array[j - 1].size, | 2108 | mem_descr->mem_array[j - 1].size, |
2055 | mem_descr->mem_array[j - 1]. | 2109 | mem_descr->mem_array[j - 1]. |
2056 | virtual_address, | 2110 | virtual_address, |
2057 | mem_descr->mem_array[j - 1]. | 2111 | (unsigned long)mem_descr-> |
2112 | mem_array[j - 1]. | ||
2058 | bus_address.u.a64.address); | 2113 | bus_address.u.a64.address); |
2059 | } | 2114 | } |
2060 | if (i) { | 2115 | if (i) { |
@@ -2223,10 +2278,10 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2223 | if (mem_descr->mem_array[0].virtual_address) { | 2278 | if (mem_descr->mem_array[0].virtual_address) { |
2224 | SE_DEBUG(DBG_LVL_8, | 2279 | SE_DEBUG(DBG_LVL_8, |
2225 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_BUF" | 2280 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_BUF" |
2226 | "va=%p \n", mem_descr->mem_array[0].virtual_address); | 2281 | "va=%p\n", mem_descr->mem_array[0].virtual_address); |
2227 | } else | 2282 | } else |
2228 | shost_printk(KERN_WARNING, phba->shost, | 2283 | shost_printk(KERN_WARNING, phba->shost, |
2229 | "No Virtual address \n"); | 2284 | "No Virtual address\n"); |
2230 | 2285 | ||
2231 | pasync_ctx->async_header.va_base = | 2286 | pasync_ctx->async_header.va_base = |
2232 | mem_descr->mem_array[0].virtual_address; | 2287 | mem_descr->mem_array[0].virtual_address; |
@@ -2239,10 +2294,10 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2239 | if (mem_descr->mem_array[0].virtual_address) { | 2294 | if (mem_descr->mem_array[0].virtual_address) { |
2240 | SE_DEBUG(DBG_LVL_8, | 2295 | SE_DEBUG(DBG_LVL_8, |
2241 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_RING" | 2296 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_RING" |
2242 | "va=%p \n", mem_descr->mem_array[0].virtual_address); | 2297 | "va=%p\n", mem_descr->mem_array[0].virtual_address); |
2243 | } else | 2298 | } else |
2244 | shost_printk(KERN_WARNING, phba->shost, | 2299 | shost_printk(KERN_WARNING, phba->shost, |
2245 | "No Virtual address \n"); | 2300 | "No Virtual address\n"); |
2246 | pasync_ctx->async_header.ring_base = | 2301 | pasync_ctx->async_header.ring_base = |
2247 | mem_descr->mem_array[0].virtual_address; | 2302 | mem_descr->mem_array[0].virtual_address; |
2248 | 2303 | ||
@@ -2251,10 +2306,10 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2251 | if (mem_descr->mem_array[0].virtual_address) { | 2306 | if (mem_descr->mem_array[0].virtual_address) { |
2252 | SE_DEBUG(DBG_LVL_8, | 2307 | SE_DEBUG(DBG_LVL_8, |
2253 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_HANDLE" | 2308 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_HEADER_HANDLE" |
2254 | "va=%p \n", mem_descr->mem_array[0].virtual_address); | 2309 | "va=%p\n", mem_descr->mem_array[0].virtual_address); |
2255 | } else | 2310 | } else |
2256 | shost_printk(KERN_WARNING, phba->shost, | 2311 | shost_printk(KERN_WARNING, phba->shost, |
2257 | "No Virtual address \n"); | 2312 | "No Virtual address\n"); |
2258 | 2313 | ||
2259 | pasync_ctx->async_header.handle_base = | 2314 | pasync_ctx->async_header.handle_base = |
2260 | mem_descr->mem_array[0].virtual_address; | 2315 | mem_descr->mem_array[0].virtual_address; |
@@ -2266,10 +2321,10 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2266 | if (mem_descr->mem_array[0].virtual_address) { | 2321 | if (mem_descr->mem_array[0].virtual_address) { |
2267 | SE_DEBUG(DBG_LVL_8, | 2322 | SE_DEBUG(DBG_LVL_8, |
2268 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_BUF" | 2323 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_BUF" |
2269 | "va=%p \n", mem_descr->mem_array[0].virtual_address); | 2324 | "va=%p\n", mem_descr->mem_array[0].virtual_address); |
2270 | } else | 2325 | } else |
2271 | shost_printk(KERN_WARNING, phba->shost, | 2326 | shost_printk(KERN_WARNING, phba->shost, |
2272 | "No Virtual address \n"); | 2327 | "No Virtual address\n"); |
2273 | pasync_ctx->async_data.va_base = | 2328 | pasync_ctx->async_data.va_base = |
2274 | mem_descr->mem_array[0].virtual_address; | 2329 | mem_descr->mem_array[0].virtual_address; |
2275 | pasync_ctx->async_data.pa_base.u.a64.address = | 2330 | pasync_ctx->async_data.pa_base.u.a64.address = |
@@ -2280,10 +2335,10 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2280 | if (mem_descr->mem_array[0].virtual_address) { | 2335 | if (mem_descr->mem_array[0].virtual_address) { |
2281 | SE_DEBUG(DBG_LVL_8, | 2336 | SE_DEBUG(DBG_LVL_8, |
2282 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_RING" | 2337 | "hwi_init_async_pdu_ctx HWI_MEM_ASYNC_DATA_RING" |
2283 | "va=%p \n", mem_descr->mem_array[0].virtual_address); | 2338 | "va=%p\n", mem_descr->mem_array[0].virtual_address); |
2284 | } else | 2339 | } else |
2285 | shost_printk(KERN_WARNING, phba->shost, | 2340 | shost_printk(KERN_WARNING, phba->shost, |
2286 | "No Virtual address \n"); | 2341 | "No Virtual address\n"); |
2287 | 2342 | ||
2288 | pasync_ctx->async_data.ring_base = | 2343 | pasync_ctx->async_data.ring_base = |
2289 | mem_descr->mem_array[0].virtual_address; | 2344 | mem_descr->mem_array[0].virtual_address; |
@@ -2292,7 +2347,7 @@ static void hwi_init_async_pdu_ctx(struct beiscsi_hba *phba) | |||
2292 | mem_descr += HWI_MEM_ASYNC_DATA_HANDLE; | 2347 | mem_descr += HWI_MEM_ASYNC_DATA_HANDLE; |
2293 | if (!mem_descr->mem_array[0].virtual_address) | 2348 | if (!mem_descr->mem_array[0].virtual_address) |
2294 | shost_printk(KERN_WARNING, phba->shost, | 2349 | shost_printk(KERN_WARNING, phba->shost, |
2295 | "No Virtual address \n"); | 2350 | "No Virtual address\n"); |
2296 | 2351 | ||
2297 | pasync_ctx->async_data.handle_base = | 2352 | pasync_ctx->async_data.handle_base = |
2298 | mem_descr->mem_array[0].virtual_address; | 2353 | mem_descr->mem_array[0].virtual_address; |
@@ -2364,7 +2419,7 @@ be_sgl_create_contiguous(void *virtual_address, | |||
2364 | WARN_ON(!sgl); | 2419 | WARN_ON(!sgl); |
2365 | 2420 | ||
2366 | sgl->va = virtual_address; | 2421 | sgl->va = virtual_address; |
2367 | sgl->dma = physical_address; | 2422 | sgl->dma = (unsigned long)physical_address; |
2368 | sgl->size = length; | 2423 | sgl->size = length; |
2369 | 2424 | ||
2370 | return 0; | 2425 | return 0; |
@@ -2447,7 +2502,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, | |||
2447 | sizeof(struct be_eq_entry), eq_vaddress); | 2502 | sizeof(struct be_eq_entry), eq_vaddress); |
2448 | if (ret) { | 2503 | if (ret) { |
2449 | shost_printk(KERN_ERR, phba->shost, | 2504 | shost_printk(KERN_ERR, phba->shost, |
2450 | "be_fill_queue Failed for EQ \n"); | 2505 | "be_fill_queue Failed for EQ\n"); |
2451 | goto create_eq_error; | 2506 | goto create_eq_error; |
2452 | } | 2507 | } |
2453 | 2508 | ||
@@ -2457,7 +2512,7 @@ static int beiscsi_create_eqs(struct beiscsi_hba *phba, | |||
2457 | if (ret) { | 2512 | if (ret) { |
2458 | shost_printk(KERN_ERR, phba->shost, | 2513 | shost_printk(KERN_ERR, phba->shost, |
2459 | "beiscsi_cmd_eq_create" | 2514 | "beiscsi_cmd_eq_create" |
2460 | "Failedfor EQ \n"); | 2515 | "Failedfor EQ\n"); |
2461 | goto create_eq_error; | 2516 | goto create_eq_error; |
2462 | } | 2517 | } |
2463 | SE_DEBUG(DBG_LVL_8, "eqid = %d\n", phwi_context->be_eq[i].q.id); | 2518 | SE_DEBUG(DBG_LVL_8, "eqid = %d\n", phwi_context->be_eq[i].q.id); |
@@ -2505,7 +2560,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, | |||
2505 | sizeof(struct sol_cqe), cq_vaddress); | 2560 | sizeof(struct sol_cqe), cq_vaddress); |
2506 | if (ret) { | 2561 | if (ret) { |
2507 | shost_printk(KERN_ERR, phba->shost, | 2562 | shost_printk(KERN_ERR, phba->shost, |
2508 | "be_fill_queue Failed for ISCSI CQ \n"); | 2563 | "be_fill_queue Failed for ISCSI CQ\n"); |
2509 | goto create_cq_error; | 2564 | goto create_cq_error; |
2510 | } | 2565 | } |
2511 | 2566 | ||
@@ -2515,7 +2570,7 @@ static int beiscsi_create_cqs(struct beiscsi_hba *phba, | |||
2515 | if (ret) { | 2570 | if (ret) { |
2516 | shost_printk(KERN_ERR, phba->shost, | 2571 | shost_printk(KERN_ERR, phba->shost, |
2517 | "beiscsi_cmd_eq_create" | 2572 | "beiscsi_cmd_eq_create" |
2518 | "Failed for ISCSI CQ \n"); | 2573 | "Failed for ISCSI CQ\n"); |
2519 | goto create_cq_error; | 2574 | goto create_cq_error; |
2520 | } | 2575 | } |
2521 | SE_DEBUG(DBG_LVL_8, "iscsi cq_id is %d for eq_id %d\n", | 2576 | SE_DEBUG(DBG_LVL_8, "iscsi cq_id is %d for eq_id %d\n", |
@@ -2565,7 +2620,8 @@ beiscsi_create_def_hdr(struct beiscsi_hba *phba, | |||
2565 | "be_fill_queue Failed for DEF PDU HDR\n"); | 2620 | "be_fill_queue Failed for DEF PDU HDR\n"); |
2566 | return ret; | 2621 | return ret; |
2567 | } | 2622 | } |
2568 | mem->dma = mem_descr->mem_array[idx].bus_address.u.a64.address; | 2623 | mem->dma = (unsigned long)mem_descr->mem_array[idx]. |
2624 | bus_address.u.a64.address; | ||
2569 | ret = be_cmd_create_default_pdu_queue(&phba->ctrl, cq, dq, | 2625 | ret = be_cmd_create_default_pdu_queue(&phba->ctrl, cq, dq, |
2570 | def_pdu_ring_sz, | 2626 | def_pdu_ring_sz, |
2571 | phba->params.defpdu_hdr_sz); | 2627 | phba->params.defpdu_hdr_sz); |
@@ -2609,7 +2665,8 @@ beiscsi_create_def_data(struct beiscsi_hba *phba, | |||
2609 | "be_fill_queue Failed for DEF PDU DATA\n"); | 2665 | "be_fill_queue Failed for DEF PDU DATA\n"); |
2610 | return ret; | 2666 | return ret; |
2611 | } | 2667 | } |
2612 | mem->dma = mem_descr->mem_array[idx].bus_address.u.a64.address; | 2668 | mem->dma = (unsigned long)mem_descr->mem_array[idx]. |
2669 | bus_address.u.a64.address; | ||
2613 | ret = be_cmd_create_default_pdu_queue(&phba->ctrl, cq, dataq, | 2670 | ret = be_cmd_create_default_pdu_queue(&phba->ctrl, cq, dataq, |
2614 | def_pdu_ring_sz, | 2671 | def_pdu_ring_sz, |
2615 | phba->params.defpdu_data_sz); | 2672 | phba->params.defpdu_data_sz); |
@@ -2623,7 +2680,7 @@ beiscsi_create_def_data(struct beiscsi_hba *phba, | |||
2623 | SE_DEBUG(DBG_LVL_8, "iscsi def data id is %d\n", | 2680 | SE_DEBUG(DBG_LVL_8, "iscsi def data id is %d\n", |
2624 | phwi_context->be_def_dataq.id); | 2681 | phwi_context->be_def_dataq.id); |
2625 | hwi_post_async_buffers(phba, 0); | 2682 | hwi_post_async_buffers(phba, 0); |
2626 | SE_DEBUG(DBG_LVL_8, "DEFAULT PDU DATA RING CREATED \n"); | 2683 | SE_DEBUG(DBG_LVL_8, "DEFAULT PDU DATA RING CREATED\n"); |
2627 | return 0; | 2684 | return 0; |
2628 | } | 2685 | } |
2629 | 2686 | ||
@@ -2655,7 +2712,7 @@ beiscsi_post_pages(struct beiscsi_hba *phba) | |||
2655 | } | 2712 | } |
2656 | pm_arr++; | 2713 | pm_arr++; |
2657 | } | 2714 | } |
2658 | SE_DEBUG(DBG_LVL_8, "POSTED PAGES \n"); | 2715 | SE_DEBUG(DBG_LVL_8, "POSTED PAGES\n"); |
2659 | return 0; | 2716 | return 0; |
2660 | } | 2717 | } |
2661 | 2718 | ||
@@ -2678,7 +2735,7 @@ static int be_queue_alloc(struct beiscsi_hba *phba, struct be_queue_info *q, | |||
2678 | mem->size = len * entry_size; | 2735 | mem->size = len * entry_size; |
2679 | mem->va = pci_alloc_consistent(phba->pcidev, mem->size, &mem->dma); | 2736 | mem->va = pci_alloc_consistent(phba->pcidev, mem->size, &mem->dma); |
2680 | if (!mem->va) | 2737 | if (!mem->va) |
2681 | return -1; | 2738 | return -ENOMEM; |
2682 | memset(mem->va, 0, mem->size); | 2739 | memset(mem->va, 0, mem->size); |
2683 | return 0; | 2740 | return 0; |
2684 | } | 2741 | } |
@@ -2750,6 +2807,7 @@ beiscsi_create_wrb_rings(struct beiscsi_hba *phba, | |||
2750 | if (status != 0) { | 2807 | if (status != 0) { |
2751 | shost_printk(KERN_ERR, phba->shost, | 2808 | shost_printk(KERN_ERR, phba->shost, |
2752 | "wrbq create failed."); | 2809 | "wrbq create failed."); |
2810 | kfree(pwrb_arr); | ||
2753 | return status; | 2811 | return status; |
2754 | } | 2812 | } |
2755 | phwi_ctrlr->wrb_context[i * 2].cid = phwi_context->be_wrbq[i]. | 2813 | phwi_ctrlr->wrb_context[i * 2].cid = phwi_context->be_wrbq[i]. |
@@ -2873,7 +2931,7 @@ mcc_cq_destroy: | |||
2873 | mcc_cq_free: | 2931 | mcc_cq_free: |
2874 | be_queue_free(phba, cq); | 2932 | be_queue_free(phba, cq); |
2875 | err: | 2933 | err: |
2876 | return -1; | 2934 | return -ENOMEM; |
2877 | } | 2935 | } |
2878 | 2936 | ||
2879 | static int find_num_cpus(void) | 2937 | static int find_num_cpus(void) |
@@ -2884,7 +2942,7 @@ static int find_num_cpus(void) | |||
2884 | if (num_cpus >= MAX_CPUS) | 2942 | if (num_cpus >= MAX_CPUS) |
2885 | num_cpus = MAX_CPUS - 1; | 2943 | num_cpus = MAX_CPUS - 1; |
2886 | 2944 | ||
2887 | SE_DEBUG(DBG_LVL_8, "num_cpus = %d \n", num_cpus); | 2945 | SE_DEBUG(DBG_LVL_8, "num_cpus = %d\n", num_cpus); |
2888 | return num_cpus; | 2946 | return num_cpus; |
2889 | } | 2947 | } |
2890 | 2948 | ||
@@ -2907,7 +2965,7 @@ static int hwi_init_port(struct beiscsi_hba *phba) | |||
2907 | 2965 | ||
2908 | status = beiscsi_create_eqs(phba, phwi_context); | 2966 | status = beiscsi_create_eqs(phba, phwi_context); |
2909 | if (status != 0) { | 2967 | if (status != 0) { |
2910 | shost_printk(KERN_ERR, phba->shost, "EQ not created \n"); | 2968 | shost_printk(KERN_ERR, phba->shost, "EQ not created\n"); |
2911 | goto error; | 2969 | goto error; |
2912 | } | 2970 | } |
2913 | 2971 | ||
@@ -2918,7 +2976,7 @@ static int hwi_init_port(struct beiscsi_hba *phba) | |||
2918 | status = mgmt_check_supported_fw(ctrl, phba); | 2976 | status = mgmt_check_supported_fw(ctrl, phba); |
2919 | if (status != 0) { | 2977 | if (status != 0) { |
2920 | shost_printk(KERN_ERR, phba->shost, | 2978 | shost_printk(KERN_ERR, phba->shost, |
2921 | "Unsupported fw version \n"); | 2979 | "Unsupported fw version\n"); |
2922 | goto error; | 2980 | goto error; |
2923 | } | 2981 | } |
2924 | 2982 | ||
@@ -2974,7 +3032,7 @@ static int hwi_init_controller(struct beiscsi_hba *phba) | |||
2974 | if (1 == phba->init_mem[HWI_MEM_ADDN_CONTEXT].num_elements) { | 3032 | if (1 == phba->init_mem[HWI_MEM_ADDN_CONTEXT].num_elements) { |
2975 | phwi_ctrlr->phwi_ctxt = (struct hwi_context_memory *)phba-> | 3033 | phwi_ctrlr->phwi_ctxt = (struct hwi_context_memory *)phba-> |
2976 | init_mem[HWI_MEM_ADDN_CONTEXT].mem_array[0].virtual_address; | 3034 | init_mem[HWI_MEM_ADDN_CONTEXT].mem_array[0].virtual_address; |
2977 | SE_DEBUG(DBG_LVL_8, " phwi_ctrlr->phwi_ctxt=%p \n", | 3035 | SE_DEBUG(DBG_LVL_8, " phwi_ctrlr->phwi_ctxt=%p\n", |
2978 | phwi_ctrlr->phwi_ctxt); | 3036 | phwi_ctrlr->phwi_ctxt); |
2979 | } else { | 3037 | } else { |
2980 | shost_printk(KERN_ERR, phba->shost, | 3038 | shost_printk(KERN_ERR, phba->shost, |
@@ -3007,8 +3065,8 @@ static void beiscsi_free_mem(struct beiscsi_hba *phba) | |||
3007 | pci_free_consistent(phba->pcidev, | 3065 | pci_free_consistent(phba->pcidev, |
3008 | mem_descr->mem_array[j - 1].size, | 3066 | mem_descr->mem_array[j - 1].size, |
3009 | mem_descr->mem_array[j - 1].virtual_address, | 3067 | mem_descr->mem_array[j - 1].virtual_address, |
3010 | mem_descr->mem_array[j - 1].bus_address. | 3068 | (unsigned long)mem_descr->mem_array[j - 1]. |
3011 | u.a64.address); | 3069 | bus_address.u.a64.address); |
3012 | } | 3070 | } |
3013 | kfree(mem_descr->mem_array); | 3071 | kfree(mem_descr->mem_array); |
3014 | mem_descr++; | 3072 | mem_descr++; |
@@ -3024,7 +3082,7 @@ static int beiscsi_init_controller(struct beiscsi_hba *phba) | |||
3024 | ret = beiscsi_get_memory(phba); | 3082 | ret = beiscsi_get_memory(phba); |
3025 | if (ret < 0) { | 3083 | if (ret < 0) { |
3026 | shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe -" | 3084 | shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe -" |
3027 | "Failed in beiscsi_alloc_memory \n"); | 3085 | "Failed in beiscsi_alloc_memory\n"); |
3028 | return ret; | 3086 | return ret; |
3029 | } | 3087 | } |
3030 | 3088 | ||
@@ -3101,12 +3159,12 @@ static int beiscsi_init_sgl_handle(struct beiscsi_hba *phba) | |||
3101 | } | 3159 | } |
3102 | SE_DEBUG(DBG_LVL_8, | 3160 | SE_DEBUG(DBG_LVL_8, |
3103 | "phba->io_sgl_hndl_avbl=%d" | 3161 | "phba->io_sgl_hndl_avbl=%d" |
3104 | "phba->eh_sgl_hndl_avbl=%d \n", | 3162 | "phba->eh_sgl_hndl_avbl=%d\n", |
3105 | phba->io_sgl_hndl_avbl, | 3163 | phba->io_sgl_hndl_avbl, |
3106 | phba->eh_sgl_hndl_avbl); | 3164 | phba->eh_sgl_hndl_avbl); |
3107 | mem_descr_sg = phba->init_mem; | 3165 | mem_descr_sg = phba->init_mem; |
3108 | mem_descr_sg += HWI_MEM_SGE; | 3166 | mem_descr_sg += HWI_MEM_SGE; |
3109 | SE_DEBUG(DBG_LVL_8, "\n mem_descr_sg->num_elements=%d \n", | 3167 | SE_DEBUG(DBG_LVL_8, "\n mem_descr_sg->num_elements=%d\n", |
3110 | mem_descr_sg->num_elements); | 3168 | mem_descr_sg->num_elements); |
3111 | arr_index = 0; | 3169 | arr_index = 0; |
3112 | idx = 0; | 3170 | idx = 0; |
@@ -3155,7 +3213,7 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | |||
3155 | if (!phba->ep_array) { | 3213 | if (!phba->ep_array) { |
3156 | shost_printk(KERN_ERR, phba->shost, | 3214 | shost_printk(KERN_ERR, phba->shost, |
3157 | "Failed to allocate memory in " | 3215 | "Failed to allocate memory in " |
3158 | "hba_setup_cid_tbls \n"); | 3216 | "hba_setup_cid_tbls\n"); |
3159 | kfree(phba->cid_array); | 3217 | kfree(phba->cid_array); |
3160 | return -ENOMEM; | 3218 | return -ENOMEM; |
3161 | } | 3219 | } |
@@ -3168,7 +3226,7 @@ static int hba_setup_cid_tbls(struct beiscsi_hba *phba) | |||
3168 | return 0; | 3226 | return 0; |
3169 | } | 3227 | } |
3170 | 3228 | ||
3171 | static unsigned char hwi_enable_intr(struct beiscsi_hba *phba) | 3229 | static void hwi_enable_intr(struct beiscsi_hba *phba) |
3172 | { | 3230 | { |
3173 | struct be_ctrl_info *ctrl = &phba->ctrl; | 3231 | struct be_ctrl_info *ctrl = &phba->ctrl; |
3174 | struct hwi_controller *phwi_ctrlr; | 3232 | struct hwi_controller *phwi_ctrlr; |
@@ -3184,26 +3242,25 @@ static unsigned char hwi_enable_intr(struct beiscsi_hba *phba) | |||
3184 | addr = (u8 __iomem *) ((u8 __iomem *) ctrl->pcicfg + | 3242 | addr = (u8 __iomem *) ((u8 __iomem *) ctrl->pcicfg + |
3185 | PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET); | 3243 | PCICFG_MEMBAR_CTRL_INT_CTRL_OFFSET); |
3186 | reg = ioread32(addr); | 3244 | reg = ioread32(addr); |
3187 | SE_DEBUG(DBG_LVL_8, "reg =x%08x \n", reg); | 3245 | SE_DEBUG(DBG_LVL_8, "reg =x%08x\n", reg); |
3188 | 3246 | ||
3189 | enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; | 3247 | enabled = reg & MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; |
3190 | if (!enabled) { | 3248 | if (!enabled) { |
3191 | reg |= MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; | 3249 | reg |= MEMBAR_CTRL_INT_CTRL_HOSTINTR_MASK; |
3192 | SE_DEBUG(DBG_LVL_8, "reg =x%08x addr=%p \n", reg, addr); | 3250 | SE_DEBUG(DBG_LVL_8, "reg =x%08x addr=%p\n", reg, addr); |
3193 | iowrite32(reg, addr); | 3251 | iowrite32(reg, addr); |
3194 | if (!phba->msix_enabled) { | 3252 | if (!phba->msix_enabled) { |
3195 | eq = &phwi_context->be_eq[0].q; | 3253 | eq = &phwi_context->be_eq[0].q; |
3196 | SE_DEBUG(DBG_LVL_8, "eq->id=%d \n", eq->id); | 3254 | SE_DEBUG(DBG_LVL_8, "eq->id=%d\n", eq->id); |
3197 | hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); | 3255 | hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); |
3198 | } else { | 3256 | } else { |
3199 | for (i = 0; i <= phba->num_cpus; i++) { | 3257 | for (i = 0; i <= phba->num_cpus; i++) { |
3200 | eq = &phwi_context->be_eq[i].q; | 3258 | eq = &phwi_context->be_eq[i].q; |
3201 | SE_DEBUG(DBG_LVL_8, "eq->id=%d \n", eq->id); | 3259 | SE_DEBUG(DBG_LVL_8, "eq->id=%d\n", eq->id); |
3202 | hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); | 3260 | hwi_ring_eq_db(phba, eq->id, 0, 0, 1, 1); |
3203 | } | 3261 | } |
3204 | } | 3262 | } |
3205 | } | 3263 | } |
3206 | return true; | ||
3207 | } | 3264 | } |
3208 | 3265 | ||
3209 | static void hwi_disable_intr(struct beiscsi_hba *phba) | 3266 | static void hwi_disable_intr(struct beiscsi_hba *phba) |
@@ -3219,7 +3276,7 @@ static void hwi_disable_intr(struct beiscsi_hba *phba) | |||
3219 | iowrite32(reg, addr); | 3276 | iowrite32(reg, addr); |
3220 | } else | 3277 | } else |
3221 | shost_printk(KERN_WARNING, phba->shost, | 3278 | shost_printk(KERN_WARNING, phba->shost, |
3222 | "In hwi_disable_intr, Already Disabled \n"); | 3279 | "In hwi_disable_intr, Already Disabled\n"); |
3223 | } | 3280 | } |
3224 | 3281 | ||
3225 | static int beiscsi_init_port(struct beiscsi_hba *phba) | 3282 | static int beiscsi_init_port(struct beiscsi_hba *phba) |
@@ -3230,14 +3287,14 @@ static int beiscsi_init_port(struct beiscsi_hba *phba) | |||
3230 | if (ret < 0) { | 3287 | if (ret < 0) { |
3231 | shost_printk(KERN_ERR, phba->shost, | 3288 | shost_printk(KERN_ERR, phba->shost, |
3232 | "beiscsi_dev_probe - Failed in" | 3289 | "beiscsi_dev_probe - Failed in" |
3233 | "beiscsi_init_controller \n"); | 3290 | "beiscsi_init_controller\n"); |
3234 | return ret; | 3291 | return ret; |
3235 | } | 3292 | } |
3236 | ret = beiscsi_init_sgl_handle(phba); | 3293 | ret = beiscsi_init_sgl_handle(phba); |
3237 | if (ret < 0) { | 3294 | if (ret < 0) { |
3238 | shost_printk(KERN_ERR, phba->shost, | 3295 | shost_printk(KERN_ERR, phba->shost, |
3239 | "beiscsi_dev_probe - Failed in" | 3296 | "beiscsi_dev_probe - Failed in" |
3240 | "beiscsi_init_sgl_handle \n"); | 3297 | "beiscsi_init_sgl_handle\n"); |
3241 | goto do_cleanup_ctrlr; | 3298 | goto do_cleanup_ctrlr; |
3242 | } | 3299 | } |
3243 | 3300 | ||
@@ -3291,12 +3348,12 @@ static void hwi_purge_eq(struct beiscsi_hba *phba) | |||
3291 | 3348 | ||
3292 | static void beiscsi_clean_port(struct beiscsi_hba *phba) | 3349 | static void beiscsi_clean_port(struct beiscsi_hba *phba) |
3293 | { | 3350 | { |
3294 | unsigned char mgmt_status; | 3351 | int mgmt_status; |
3295 | 3352 | ||
3296 | mgmt_status = mgmt_epfw_cleanup(phba, CMD_CONNECTION_CHUTE_0); | 3353 | mgmt_status = mgmt_epfw_cleanup(phba, CMD_CONNECTION_CHUTE_0); |
3297 | if (mgmt_status) | 3354 | if (mgmt_status) |
3298 | shost_printk(KERN_WARNING, phba->shost, | 3355 | shost_printk(KERN_WARNING, phba->shost, |
3299 | "mgmt_epfw_cleanup FAILED \n"); | 3356 | "mgmt_epfw_cleanup FAILED\n"); |
3300 | 3357 | ||
3301 | hwi_purge_eq(phba); | 3358 | hwi_purge_eq(phba); |
3302 | hwi_cleanup(phba); | 3359 | hwi_cleanup(phba); |
@@ -3428,14 +3485,12 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
3428 | return -ENOMEM; | 3485 | return -ENOMEM; |
3429 | io_task->bhs_pa.u.a64.address = paddr; | 3486 | io_task->bhs_pa.u.a64.address = paddr; |
3430 | io_task->libiscsi_itt = (itt_t)task->itt; | 3487 | io_task->libiscsi_itt = (itt_t)task->itt; |
3431 | io_task->pwrb_handle = alloc_wrb_handle(phba, | ||
3432 | beiscsi_conn->beiscsi_conn_cid - | ||
3433 | phba->fw_config.iscsi_cid_start | ||
3434 | ); | ||
3435 | io_task->conn = beiscsi_conn; | 3488 | io_task->conn = beiscsi_conn; |
3436 | 3489 | ||
3437 | task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; | 3490 | task->hdr = (struct iscsi_hdr *)&io_task->cmd_bhs->iscsi_hdr; |
3438 | task->hdr_max = sizeof(struct be_cmd_bhs); | 3491 | task->hdr_max = sizeof(struct be_cmd_bhs); |
3492 | io_task->psgl_handle = NULL; | ||
3493 | io_task->psgl_handle = NULL; | ||
3439 | 3494 | ||
3440 | if (task->sc) { | 3495 | if (task->sc) { |
3441 | spin_lock(&phba->io_sgl_lock); | 3496 | spin_lock(&phba->io_sgl_lock); |
@@ -3443,6 +3498,11 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
3443 | spin_unlock(&phba->io_sgl_lock); | 3498 | spin_unlock(&phba->io_sgl_lock); |
3444 | if (!io_task->psgl_handle) | 3499 | if (!io_task->psgl_handle) |
3445 | goto free_hndls; | 3500 | goto free_hndls; |
3501 | io_task->pwrb_handle = alloc_wrb_handle(phba, | ||
3502 | beiscsi_conn->beiscsi_conn_cid - | ||
3503 | phba->fw_config.iscsi_cid_start); | ||
3504 | if (!io_task->pwrb_handle) | ||
3505 | goto free_io_hndls; | ||
3446 | } else { | 3506 | } else { |
3447 | io_task->scsi_cmnd = NULL; | 3507 | io_task->scsi_cmnd = NULL; |
3448 | if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) { | 3508 | if ((opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN) { |
@@ -3457,9 +3517,20 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
3457 | beiscsi_conn->login_in_progress = 1; | 3517 | beiscsi_conn->login_in_progress = 1; |
3458 | beiscsi_conn->plogin_sgl_handle = | 3518 | beiscsi_conn->plogin_sgl_handle = |
3459 | io_task->psgl_handle; | 3519 | io_task->psgl_handle; |
3520 | io_task->pwrb_handle = | ||
3521 | alloc_wrb_handle(phba, | ||
3522 | beiscsi_conn->beiscsi_conn_cid - | ||
3523 | phba->fw_config.iscsi_cid_start); | ||
3524 | if (!io_task->pwrb_handle) | ||
3525 | goto free_io_hndls; | ||
3526 | beiscsi_conn->plogin_wrb_handle = | ||
3527 | io_task->pwrb_handle; | ||
3528 | |||
3460 | } else { | 3529 | } else { |
3461 | io_task->psgl_handle = | 3530 | io_task->psgl_handle = |
3462 | beiscsi_conn->plogin_sgl_handle; | 3531 | beiscsi_conn->plogin_sgl_handle; |
3532 | io_task->pwrb_handle = | ||
3533 | beiscsi_conn->plogin_wrb_handle; | ||
3463 | } | 3534 | } |
3464 | } else { | 3535 | } else { |
3465 | spin_lock(&phba->mgmt_sgl_lock); | 3536 | spin_lock(&phba->mgmt_sgl_lock); |
@@ -3467,6 +3538,13 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
3467 | spin_unlock(&phba->mgmt_sgl_lock); | 3538 | spin_unlock(&phba->mgmt_sgl_lock); |
3468 | if (!io_task->psgl_handle) | 3539 | if (!io_task->psgl_handle) |
3469 | goto free_hndls; | 3540 | goto free_hndls; |
3541 | io_task->pwrb_handle = | ||
3542 | alloc_wrb_handle(phba, | ||
3543 | beiscsi_conn->beiscsi_conn_cid - | ||
3544 | phba->fw_config.iscsi_cid_start); | ||
3545 | if (!io_task->pwrb_handle) | ||
3546 | goto free_mgmt_hndls; | ||
3547 | |||
3470 | } | 3548 | } |
3471 | } | 3549 | } |
3472 | itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle-> | 3550 | itt = (itt_t) cpu_to_be32(((unsigned int)io_task->pwrb_handle-> |
@@ -3477,16 +3555,26 @@ static int beiscsi_alloc_pdu(struct iscsi_task *task, uint8_t opcode) | |||
3477 | io_task->cmd_bhs->iscsi_hdr.itt = itt; | 3555 | io_task->cmd_bhs->iscsi_hdr.itt = itt; |
3478 | return 0; | 3556 | return 0; |
3479 | 3557 | ||
3558 | free_io_hndls: | ||
3559 | spin_lock(&phba->io_sgl_lock); | ||
3560 | free_io_sgl_handle(phba, io_task->psgl_handle); | ||
3561 | spin_unlock(&phba->io_sgl_lock); | ||
3562 | goto free_hndls; | ||
3563 | free_mgmt_hndls: | ||
3564 | spin_lock(&phba->mgmt_sgl_lock); | ||
3565 | free_mgmt_sgl_handle(phba, io_task->psgl_handle); | ||
3566 | spin_unlock(&phba->mgmt_sgl_lock); | ||
3480 | free_hndls: | 3567 | free_hndls: |
3481 | phwi_ctrlr = phba->phwi_ctrlr; | 3568 | phwi_ctrlr = phba->phwi_ctrlr; |
3482 | pwrb_context = &phwi_ctrlr->wrb_context[ | 3569 | pwrb_context = &phwi_ctrlr->wrb_context[ |
3483 | beiscsi_conn->beiscsi_conn_cid - | 3570 | beiscsi_conn->beiscsi_conn_cid - |
3484 | phba->fw_config.iscsi_cid_start]; | 3571 | phba->fw_config.iscsi_cid_start]; |
3485 | free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); | 3572 | if (io_task->pwrb_handle) |
3573 | free_wrb_handle(phba, pwrb_context, io_task->pwrb_handle); | ||
3486 | io_task->pwrb_handle = NULL; | 3574 | io_task->pwrb_handle = NULL; |
3487 | pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, | 3575 | pci_pool_free(beiscsi_sess->bhs_pool, io_task->cmd_bhs, |
3488 | io_task->bhs_pa.u.a64.address); | 3576 | io_task->bhs_pa.u.a64.address); |
3489 | SE_DEBUG(DBG_LVL_1, "Alloc of SGL_ICD Failed \n"); | 3577 | SE_DEBUG(DBG_LVL_1, "Alloc of SGL_ICD Failed\n"); |
3490 | return -ENOMEM; | 3578 | return -ENOMEM; |
3491 | } | 3579 | } |
3492 | 3580 | ||
@@ -3653,7 +3741,7 @@ static int beiscsi_mtask(struct iscsi_task *task) | |||
3653 | break; | 3741 | break; |
3654 | 3742 | ||
3655 | default: | 3743 | default: |
3656 | SE_DEBUG(DBG_LVL_1, "opcode =%d Not supported \n", | 3744 | SE_DEBUG(DBG_LVL_1, "opcode =%d Not supported\n", |
3657 | task->hdr->opcode & ISCSI_OPCODE_MASK); | 3745 | task->hdr->opcode & ISCSI_OPCODE_MASK); |
3658 | return -EINVAL; | 3746 | return -EINVAL; |
3659 | } | 3747 | } |
@@ -3689,13 +3777,11 @@ static int beiscsi_task_xmit(struct iscsi_task *task) | |||
3689 | SE_DEBUG(DBG_LVL_1, " scsi_dma_map Failed\n") | 3777 | SE_DEBUG(DBG_LVL_1, " scsi_dma_map Failed\n") |
3690 | return num_sg; | 3778 | return num_sg; |
3691 | } | 3779 | } |
3692 | SE_DEBUG(DBG_LVL_4, "xferlen=0x%08x scmd=%p num_sg=%d sernum=%lu\n", | ||
3693 | (scsi_bufflen(sc)), sc, num_sg, sc->serial_number); | ||
3694 | xferlen = scsi_bufflen(sc); | 3780 | xferlen = scsi_bufflen(sc); |
3695 | sg = scsi_sglist(sc); | 3781 | sg = scsi_sglist(sc); |
3696 | if (sc->sc_data_direction == DMA_TO_DEVICE) { | 3782 | if (sc->sc_data_direction == DMA_TO_DEVICE) { |
3697 | writedir = 1; | 3783 | writedir = 1; |
3698 | SE_DEBUG(DBG_LVL_4, "task->imm_count=0x%08x \n", | 3784 | SE_DEBUG(DBG_LVL_4, "task->imm_count=0x%08x\n", |
3699 | task->imm_count); | 3785 | task->imm_count); |
3700 | } else | 3786 | } else |
3701 | writedir = 0; | 3787 | writedir = 0; |
@@ -3709,10 +3795,12 @@ static void beiscsi_remove(struct pci_dev *pcidev) | |||
3709 | struct hwi_context_memory *phwi_context; | 3795 | struct hwi_context_memory *phwi_context; |
3710 | struct be_eq_obj *pbe_eq; | 3796 | struct be_eq_obj *pbe_eq; |
3711 | unsigned int i, msix_vec; | 3797 | unsigned int i, msix_vec; |
3798 | u8 *real_offset = 0; | ||
3799 | u32 value = 0; | ||
3712 | 3800 | ||
3713 | phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev); | 3801 | phba = (struct beiscsi_hba *)pci_get_drvdata(pcidev); |
3714 | if (!phba) { | 3802 | if (!phba) { |
3715 | dev_err(&pcidev->dev, "beiscsi_remove called with no phba \n"); | 3803 | dev_err(&pcidev->dev, "beiscsi_remove called with no phba\n"); |
3716 | return; | 3804 | return; |
3717 | } | 3805 | } |
3718 | 3806 | ||
@@ -3737,6 +3825,14 @@ static void beiscsi_remove(struct pci_dev *pcidev) | |||
3737 | 3825 | ||
3738 | beiscsi_clean_port(phba); | 3826 | beiscsi_clean_port(phba); |
3739 | beiscsi_free_mem(phba); | 3827 | beiscsi_free_mem(phba); |
3828 | real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE; | ||
3829 | |||
3830 | value = readl((void *)real_offset); | ||
3831 | |||
3832 | if (value & 0x00010000) { | ||
3833 | value &= 0xfffeffff; | ||
3834 | writel(value, (void *)real_offset); | ||
3835 | } | ||
3740 | beiscsi_unmap_pci_function(phba); | 3836 | beiscsi_unmap_pci_function(phba); |
3741 | pci_free_consistent(phba->pcidev, | 3837 | pci_free_consistent(phba->pcidev, |
3742 | phba->ctrl.mbox_mem_alloced.size, | 3838 | phba->ctrl.mbox_mem_alloced.size, |
@@ -3769,19 +3865,21 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
3769 | struct hwi_controller *phwi_ctrlr; | 3865 | struct hwi_controller *phwi_ctrlr; |
3770 | struct hwi_context_memory *phwi_context; | 3866 | struct hwi_context_memory *phwi_context; |
3771 | struct be_eq_obj *pbe_eq; | 3867 | struct be_eq_obj *pbe_eq; |
3772 | int ret, msix_vec, num_cpus, i; | 3868 | int ret, num_cpus, i; |
3869 | u8 *real_offset = 0; | ||
3870 | u32 value = 0; | ||
3773 | 3871 | ||
3774 | ret = beiscsi_enable_pci(pcidev); | 3872 | ret = beiscsi_enable_pci(pcidev); |
3775 | if (ret < 0) { | 3873 | if (ret < 0) { |
3776 | shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" | 3874 | dev_err(&pcidev->dev, "beiscsi_dev_probe-" |
3777 | "Failed to enable pci device \n"); | 3875 | " Failed to enable pci device\n"); |
3778 | return ret; | 3876 | return ret; |
3779 | } | 3877 | } |
3780 | 3878 | ||
3781 | phba = beiscsi_hba_alloc(pcidev); | 3879 | phba = beiscsi_hba_alloc(pcidev); |
3782 | if (!phba) { | 3880 | if (!phba) { |
3783 | dev_err(&pcidev->dev, "beiscsi_dev_probe-" | 3881 | dev_err(&pcidev->dev, "beiscsi_dev_probe-" |
3784 | " Failed in beiscsi_hba_alloc \n"); | 3882 | " Failed in beiscsi_hba_alloc\n"); |
3785 | goto disable_pci; | 3883 | goto disable_pci; |
3786 | } | 3884 | } |
3787 | 3885 | ||
@@ -3804,7 +3902,7 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
3804 | else | 3902 | else |
3805 | num_cpus = 1; | 3903 | num_cpus = 1; |
3806 | phba->num_cpus = num_cpus; | 3904 | phba->num_cpus = num_cpus; |
3807 | SE_DEBUG(DBG_LVL_8, "num_cpus = %d \n", phba->num_cpus); | 3905 | SE_DEBUG(DBG_LVL_8, "num_cpus = %d\n", phba->num_cpus); |
3808 | 3906 | ||
3809 | if (enable_msix) | 3907 | if (enable_msix) |
3810 | beiscsi_msix_enable(phba); | 3908 | beiscsi_msix_enable(phba); |
@@ -3815,6 +3913,33 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
3815 | goto hba_free; | 3913 | goto hba_free; |
3816 | } | 3914 | } |
3817 | 3915 | ||
3916 | if (!num_hba) { | ||
3917 | real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE; | ||
3918 | value = readl((void *)real_offset); | ||
3919 | if (value & 0x00010000) { | ||
3920 | gcrashmode++; | ||
3921 | shost_printk(KERN_ERR, phba->shost, | ||
3922 | "Loading Driver in crashdump mode\n"); | ||
3923 | ret = beiscsi_pci_soft_reset(phba); | ||
3924 | if (ret) { | ||
3925 | shost_printk(KERN_ERR, phba->shost, | ||
3926 | "Reset Failed. Aborting Crashdump\n"); | ||
3927 | goto hba_free; | ||
3928 | } | ||
3929 | ret = be_chk_reset_complete(phba); | ||
3930 | if (ret) { | ||
3931 | shost_printk(KERN_ERR, phba->shost, | ||
3932 | "Failed to get out of reset." | ||
3933 | "Aborting Crashdump\n"); | ||
3934 | goto hba_free; | ||
3935 | } | ||
3936 | } else { | ||
3937 | value |= 0x00010000; | ||
3938 | writel(value, (void *)real_offset); | ||
3939 | num_hba++; | ||
3940 | } | ||
3941 | } | ||
3942 | |||
3818 | spin_lock_init(&phba->io_sgl_lock); | 3943 | spin_lock_init(&phba->io_sgl_lock); |
3819 | spin_lock_init(&phba->mgmt_sgl_lock); | 3944 | spin_lock_init(&phba->mgmt_sgl_lock); |
3820 | spin_lock_init(&phba->isr_lock); | 3945 | spin_lock_init(&phba->isr_lock); |
@@ -3870,25 +3995,10 @@ static int __devinit beiscsi_dev_probe(struct pci_dev *pcidev, | |||
3870 | "Failed to beiscsi_init_irqs\n"); | 3995 | "Failed to beiscsi_init_irqs\n"); |
3871 | goto free_blkenbld; | 3996 | goto free_blkenbld; |
3872 | } | 3997 | } |
3873 | ret = hwi_enable_intr(phba); | 3998 | hwi_enable_intr(phba); |
3874 | if (ret < 0) { | 3999 | SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED\n\n\n"); |
3875 | shost_printk(KERN_ERR, phba->shost, "beiscsi_dev_probe-" | ||
3876 | "Failed to hwi_enable_intr\n"); | ||
3877 | goto free_ctrlr; | ||
3878 | } | ||
3879 | SE_DEBUG(DBG_LVL_8, "\n\n\n SUCCESS - DRIVER LOADED \n\n\n"); | ||
3880 | return 0; | 4000 | return 0; |
3881 | 4001 | ||
3882 | free_ctrlr: | ||
3883 | if (phba->msix_enabled) { | ||
3884 | for (i = 0; i <= phba->num_cpus; i++) { | ||
3885 | msix_vec = phba->msix_entries[i].vector; | ||
3886 | free_irq(msix_vec, &phwi_context->be_eq[i]); | ||
3887 | } | ||
3888 | } else | ||
3889 | if (phba->pcidev->irq) | ||
3890 | free_irq(phba->pcidev->irq, phba); | ||
3891 | pci_disable_msix(phba->pcidev); | ||
3892 | free_blkenbld: | 4002 | free_blkenbld: |
3893 | destroy_workqueue(phba->wq); | 4003 | destroy_workqueue(phba->wq); |
3894 | if (blk_iopoll_enabled) | 4004 | if (blk_iopoll_enabled) |
@@ -3900,12 +4010,23 @@ free_twq: | |||
3900 | beiscsi_clean_port(phba); | 4010 | beiscsi_clean_port(phba); |
3901 | beiscsi_free_mem(phba); | 4011 | beiscsi_free_mem(phba); |
3902 | free_port: | 4012 | free_port: |
4013 | real_offset = (u8 *)phba->csr_va + MPU_EP_SEMAPHORE; | ||
4014 | |||
4015 | value = readl((void *)real_offset); | ||
4016 | |||
4017 | if (value & 0x00010000) { | ||
4018 | value &= 0xfffeffff; | ||
4019 | writel(value, (void *)real_offset); | ||
4020 | } | ||
4021 | |||
3903 | pci_free_consistent(phba->pcidev, | 4022 | pci_free_consistent(phba->pcidev, |
3904 | phba->ctrl.mbox_mem_alloced.size, | 4023 | phba->ctrl.mbox_mem_alloced.size, |
3905 | phba->ctrl.mbox_mem_alloced.va, | 4024 | phba->ctrl.mbox_mem_alloced.va, |
3906 | phba->ctrl.mbox_mem_alloced.dma); | 4025 | phba->ctrl.mbox_mem_alloced.dma); |
3907 | beiscsi_unmap_pci_function(phba); | 4026 | beiscsi_unmap_pci_function(phba); |
3908 | hba_free: | 4027 | hba_free: |
4028 | if (phba->msix_enabled) | ||
4029 | pci_disable_msix(phba->pcidev); | ||
3909 | iscsi_host_remove(phba->shost); | 4030 | iscsi_host_remove(phba->shost); |
3910 | pci_dev_put(phba->pcidev); | 4031 | pci_dev_put(phba->pcidev); |
3911 | iscsi_host_free(phba->shost); | 4032 | iscsi_host_free(phba->shost); |
@@ -3955,7 +4076,7 @@ struct iscsi_transport beiscsi_iscsi_transport = { | |||
3955 | .get_session_param = iscsi_session_get_param, | 4076 | .get_session_param = iscsi_session_get_param, |
3956 | .get_host_param = beiscsi_get_host_param, | 4077 | .get_host_param = beiscsi_get_host_param, |
3957 | .start_conn = beiscsi_conn_start, | 4078 | .start_conn = beiscsi_conn_start, |
3958 | .stop_conn = beiscsi_conn_stop, | 4079 | .stop_conn = iscsi_conn_stop, |
3959 | .send_pdu = iscsi_conn_send_pdu, | 4080 | .send_pdu = iscsi_conn_send_pdu, |
3960 | .xmit_task = beiscsi_task_xmit, | 4081 | .xmit_task = beiscsi_task_xmit, |
3961 | .cleanup_task = beiscsi_cleanup_task, | 4082 | .cleanup_task = beiscsi_cleanup_task, |
@@ -3988,7 +4109,7 @@ static int __init beiscsi_module_init(void) | |||
3988 | "transport.\n"); | 4109 | "transport.\n"); |
3989 | return -ENOMEM; | 4110 | return -ENOMEM; |
3990 | } | 4111 | } |
3991 | SE_DEBUG(DBG_LVL_8, "In beiscsi_module_init, tt=%p \n", | 4112 | SE_DEBUG(DBG_LVL_8, "In beiscsi_module_init, tt=%p\n", |
3992 | &beiscsi_iscsi_transport); | 4113 | &beiscsi_iscsi_transport); |
3993 | 4114 | ||
3994 | ret = pci_register_driver(&beiscsi_pci_driver); | 4115 | ret = pci_register_driver(&beiscsi_pci_driver); |