Lines Matching refs:ctrl

109 	struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q;  in be_mcc_notify()
121 if (phba->ctrl.mcc_tag_available) { in alloc_mcc_tag()
122 tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; in alloc_mcc_tag()
123 phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; in alloc_mcc_tag()
124 phba->ctrl.mcc_numtag[tag] = 0; in alloc_mcc_tag()
127 phba->ctrl.mcc_tag_available--; in alloc_mcc_tag()
128 if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1)) in alloc_mcc_tag()
129 phba->ctrl.mcc_alloc_index = 0; in alloc_mcc_tag()
131 phba->ctrl.mcc_alloc_index++; in alloc_mcc_tag()
159 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in beiscsi_mccq_compl()
162 free_mcc_tag(&phba->ctrl, tag); in beiscsi_mccq_compl()
167 spin_lock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
168 phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_RUNNING; in beiscsi_mccq_compl()
169 spin_unlock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
173 phba->ctrl.mcc_wait[tag], in beiscsi_mccq_compl()
174 phba->ctrl.mcc_numtag[tag], in beiscsi_mccq_compl()
181 spin_lock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
182 phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_TIMEOUT; in beiscsi_mccq_compl()
183 spin_unlock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
186 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; in beiscsi_mccq_compl()
202 spin_lock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
203 phba->ctrl.ptag_state[tag].tag_state = MCC_TAG_STATE_COMPLETED; in beiscsi_mccq_compl()
204 spin_unlock(&phba->ctrl.mbox_lock); in beiscsi_mccq_compl()
207 mcc_tag_response = phba->ctrl.mcc_numtag[tag]; in beiscsi_mccq_compl()
253 free_mcc_tag(&phba->ctrl, tag); in beiscsi_mccq_compl()
258 void free_mcc_tag(struct be_ctrl_info *ctrl, unsigned int tag) in free_mcc_tag() argument
260 spin_lock(&ctrl->mbox_lock); in free_mcc_tag()
262 ctrl->mcc_tag[ctrl->mcc_free_index] = tag; in free_mcc_tag()
263 if (ctrl->mcc_free_index == (MAX_MCC_CMD - 1)) in free_mcc_tag()
264 ctrl->mcc_free_index = 0; in free_mcc_tag()
266 ctrl->mcc_free_index++; in free_mcc_tag()
267 ctrl->mcc_tag_available++; in free_mcc_tag()
268 spin_unlock(&ctrl->mbox_lock); in free_mcc_tag()
317 static int be_mcc_compl_process(struct be_ctrl_info *ctrl, in be_mcc_compl_process() argument
321 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_mcc_compl_process()
322 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mcc_compl_process()
352 int be_mcc_compl_process_isr(struct be_ctrl_info *ctrl, in be_mcc_compl_process_isr() argument
355 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mcc_compl_process_isr()
371 ctrl->mcc_numtag[tag] = 0x80000000; in be_mcc_compl_process_isr()
372 ctrl->mcc_numtag[tag] |= (compl->tag0 & 0x00FF0000); in be_mcc_compl_process_isr()
373 ctrl->mcc_numtag[tag] |= (extd_status & 0x000000FF) << 8; in be_mcc_compl_process_isr()
374 ctrl->mcc_numtag[tag] |= (compl_status & 0x000000FF); in be_mcc_compl_process_isr()
376 if (ctrl->ptag_state[tag].tag_state == MCC_TAG_STATE_RUNNING) { in be_mcc_compl_process_isr()
377 wake_up_interruptible(&ctrl->mcc_wait[tag]); in be_mcc_compl_process_isr()
378 } else if (ctrl->ptag_state[tag].tag_state == MCC_TAG_STATE_TIMEOUT) { in be_mcc_compl_process_isr()
380 tag_mem = &ctrl->ptag_state[tag].tag_mem_state; in be_mcc_compl_process_isr()
389 pci_free_consistent(ctrl->pdev, tag_mem->size, in be_mcc_compl_process_isr()
393 spin_lock(&phba->ctrl.mbox_lock); in be_mcc_compl_process_isr()
394 ctrl->ptag_state[tag].tag_state = MCC_TAG_STATE_COMPLETED; in be_mcc_compl_process_isr()
395 spin_unlock(&phba->ctrl.mbox_lock); in be_mcc_compl_process_isr()
398 free_mcc_tag(ctrl, tag); in be_mcc_compl_process_isr()
406 struct be_queue_info *mcc_cq = &phba->ctrl.mcc_obj.cq; in be_mcc_compl_get()
468 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_process_mcc() local
470 spin_lock_bh(&phba->ctrl.mcc_cq_lock); in beiscsi_process_mcc()
510 status = be_mcc_compl_process(ctrl, compl); in beiscsi_process_mcc()
511 atomic_dec(&phba->ctrl.mcc_obj.q.used); in beiscsi_process_mcc()
518 hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1, 0); in beiscsi_process_mcc()
520 spin_unlock_bh(&phba->ctrl.mcc_cq_lock); in beiscsi_process_mcc()
546 if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0) in be_mcc_wait_compl()
588 static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl) in be_mbox_db_ready_wait() argument
591 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_db_ready_wait()
592 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_db_ready_wait()
644 int be_mbox_notify(struct be_ctrl_info *ctrl) in be_mbox_notify() argument
648 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify()
649 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem; in be_mbox_notify()
652 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_notify()
654 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
663 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
673 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
678 status = be_mcc_compl_process(ctrl, &mbox->compl); in be_mbox_notify()
705 void __iomem *db = phba->ctrl.db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify_wait()
706 struct be_dma_mem *mbox_mem = &phba->ctrl.mbox_mem; in be_mbox_notify_wait()
709 struct be_ctrl_info *ctrl = &phba->ctrl; in be_mbox_notify_wait() local
711 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
721 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
730 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
736 status = be_mcc_compl_process(ctrl, &mbox->compl); in be_mbox_notify_wait()
814 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in wrb_from_mccq()
827 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_eq_create() argument
830 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_eq_create()
836 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
847 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_eq_create()
858 status = be_mbox_notify(ctrl); in beiscsi_cmd_eq_create()
863 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
877 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl) in be_cmd_fw_initialize() argument
879 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_fw_initialize()
880 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_fw_initialize()
884 spin_lock(&ctrl->mbox_lock); in be_cmd_fw_initialize()
898 status = be_mbox_notify(ctrl); in be_cmd_fw_initialize()
903 spin_unlock(&ctrl->mbox_lock); in be_cmd_fw_initialize()
917 int be_cmd_fw_uninit(struct be_ctrl_info *ctrl) in be_cmd_fw_uninit() argument
919 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_fw_uninit()
920 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_fw_uninit()
924 spin_lock(&ctrl->mbox_lock); in be_cmd_fw_uninit()
939 status = be_mbox_notify(ctrl); in be_cmd_fw_uninit()
944 spin_unlock(&ctrl->mbox_lock); in be_cmd_fw_uninit()
948 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_cq_create() argument
952 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_cq_create()
955 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_cq_create()
960 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
981 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_cq_create()
1001 status = be_mbox_notify(ctrl); in beiscsi_cmd_cq_create()
1010 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
1030 struct be_ctrl_info *ctrl; in beiscsi_cmd_mccq_create() local
1034 spin_lock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
1035 ctrl = &phba->ctrl; in beiscsi_cmd_mccq_create()
1036 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_mccq_create()
1065 spin_unlock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
1070 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, in beiscsi_cmd_q_destroy() argument
1073 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_q_destroy()
1075 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_q_destroy()
1083 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1113 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1121 status = be_mbox_notify(ctrl); in beiscsi_cmd_q_destroy()
1123 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1145 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, in be_cmd_create_default_pdu_queue() argument
1151 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_create_default_pdu_queue()
1154 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_create_default_pdu_queue()
1158 spin_lock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1179 pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn)); in be_cmd_create_default_pdu_queue()
1207 status = be_mbox_notify(ctrl); in be_cmd_create_default_pdu_queue()
1230 spin_unlock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1246 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, in be_cmd_wrbq_create() argument
1252 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_wrbq_create()
1255 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_wrbq_create()
1258 spin_lock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1275 status = be_mbox_notify(ctrl); in be_cmd_wrbq_create()
1289 spin_unlock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1293 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_template_hdr() argument
1296 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_template_hdr()
1300 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1312 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_template_hdr()
1313 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1317 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl) in be_cmd_iscsi_remove_template_hdr() argument
1319 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_remove_template_hdr()
1323 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1333 status = be_mbox_notify(ctrl); in be_cmd_iscsi_remove_template_hdr()
1334 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1338 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_sgl_pages() argument
1342 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_sgl_pages()
1344 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_iscsi_post_sgl_pages()
1353 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1373 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_sgl_pages()
1382 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1384 beiscsi_cmd_q_destroy(ctrl, NULL, QTYPE_SGL); in be_cmd_iscsi_post_sgl_pages()
1390 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_reset_function() local
1391 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_reset_function()
1395 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_reset_function()
1403 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_reset_function()
1423 struct be_ctrl_info *ctrl = &phba->ctrl; in be_cmd_set_vlan() local
1425 spin_lock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1428 spin_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1444 spin_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()