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()
467 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_process_mcc() local
469 spin_lock_bh(&phba->ctrl.mcc_cq_lock); in beiscsi_process_mcc()
506 status = be_mcc_compl_process(ctrl, compl); in beiscsi_process_mcc()
507 atomic_dec(&phba->ctrl.mcc_obj.q.used); in beiscsi_process_mcc()
514 hwi_ring_cq_db(phba, phba->ctrl.mcc_obj.cq.id, num, 1, 0); in beiscsi_process_mcc()
516 spin_unlock_bh(&phba->ctrl.mcc_cq_lock); in beiscsi_process_mcc()
542 if (atomic_read(&phba->ctrl.mcc_obj.q.used) == 0) in be_mcc_wait_compl()
584 static int be_mbox_db_ready_wait(struct be_ctrl_info *ctrl) in be_mbox_db_ready_wait() argument
587 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_db_ready_wait()
588 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_db_ready_wait()
640 int be_mbox_notify(struct be_ctrl_info *ctrl) in be_mbox_notify() argument
644 void __iomem *db = ctrl->db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify()
645 struct be_dma_mem *mbox_mem = &ctrl->mbox_mem; in be_mbox_notify()
648 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_notify()
650 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
659 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
669 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify()
674 status = be_mcc_compl_process(ctrl, &mbox->compl); in be_mbox_notify()
701 void __iomem *db = phba->ctrl.db + MPU_MAILBOX_DB_OFFSET; in be_mbox_notify_wait()
702 struct be_dma_mem *mbox_mem = &phba->ctrl.mbox_mem; in be_mbox_notify_wait()
705 struct be_ctrl_info *ctrl = &phba->ctrl; in be_mbox_notify_wait() local
707 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
717 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
726 status = be_mbox_db_ready_wait(ctrl); in be_mbox_notify_wait()
732 status = be_mcc_compl_process(ctrl, &mbox->compl); in be_mbox_notify_wait()
810 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in wrb_from_mccq()
823 int beiscsi_cmd_eq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_eq_create() argument
826 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_eq_create()
832 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
843 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_eq_create()
854 status = be_mbox_notify(ctrl); in beiscsi_cmd_eq_create()
859 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_eq_create()
873 int be_cmd_fw_initialize(struct be_ctrl_info *ctrl) in be_cmd_fw_initialize() argument
875 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_fw_initialize()
876 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_fw_initialize()
880 spin_lock(&ctrl->mbox_lock); in be_cmd_fw_initialize()
894 status = be_mbox_notify(ctrl); in be_cmd_fw_initialize()
899 spin_unlock(&ctrl->mbox_lock); in be_cmd_fw_initialize()
913 int be_cmd_fw_uninit(struct be_ctrl_info *ctrl) in be_cmd_fw_uninit() argument
915 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_fw_uninit()
916 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_fw_uninit()
920 spin_lock(&ctrl->mbox_lock); in be_cmd_fw_uninit()
935 status = be_mbox_notify(ctrl); in be_cmd_fw_uninit()
940 spin_unlock(&ctrl->mbox_lock); in be_cmd_fw_uninit()
944 int beiscsi_cmd_cq_create(struct be_ctrl_info *ctrl, in beiscsi_cmd_cq_create() argument
948 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_cq_create()
951 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_cq_create()
956 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
977 PCI_FUNC(ctrl->pdev->devfn)); in beiscsi_cmd_cq_create()
997 status = be_mbox_notify(ctrl); in beiscsi_cmd_cq_create()
1006 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_cq_create()
1026 struct be_ctrl_info *ctrl; in beiscsi_cmd_mccq_create() local
1030 spin_lock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
1031 ctrl = &phba->ctrl; in beiscsi_cmd_mccq_create()
1032 wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_mccq_create()
1061 spin_unlock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
1066 int beiscsi_cmd_q_destroy(struct be_ctrl_info *ctrl, struct be_queue_info *q, in beiscsi_cmd_q_destroy() argument
1069 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_q_destroy()
1071 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_q_destroy()
1079 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1109 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1117 status = be_mbox_notify(ctrl); in beiscsi_cmd_q_destroy()
1119 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_q_destroy()
1141 int be_cmd_create_default_pdu_queue(struct be_ctrl_info *ctrl, in be_cmd_create_default_pdu_queue() argument
1147 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_create_default_pdu_queue()
1150 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_create_default_pdu_queue()
1154 spin_lock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1175 pci_func_id, ctxt, PCI_FUNC(ctrl->pdev->devfn)); in be_cmd_create_default_pdu_queue()
1203 status = be_mbox_notify(ctrl); in be_cmd_create_default_pdu_queue()
1226 spin_unlock(&ctrl->mbox_lock); in be_cmd_create_default_pdu_queue()
1242 int be_cmd_wrbq_create(struct be_ctrl_info *ctrl, in be_cmd_wrbq_create() argument
1248 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_wrbq_create()
1251 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_wrbq_create()
1254 spin_lock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1271 status = be_mbox_notify(ctrl); in be_cmd_wrbq_create()
1285 spin_unlock(&ctrl->mbox_lock); in be_cmd_wrbq_create()
1289 int be_cmd_iscsi_post_template_hdr(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_template_hdr() argument
1292 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_template_hdr()
1296 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1308 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_template_hdr()
1309 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_template_hdr()
1313 int be_cmd_iscsi_remove_template_hdr(struct be_ctrl_info *ctrl) in be_cmd_iscsi_remove_template_hdr() argument
1315 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_remove_template_hdr()
1319 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1329 status = be_mbox_notify(ctrl); in be_cmd_iscsi_remove_template_hdr()
1330 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_remove_template_hdr()
1334 int be_cmd_iscsi_post_sgl_pages(struct be_ctrl_info *ctrl, in be_cmd_iscsi_post_sgl_pages() argument
1338 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in be_cmd_iscsi_post_sgl_pages()
1340 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_iscsi_post_sgl_pages()
1349 spin_lock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1369 status = be_mbox_notify(ctrl); in be_cmd_iscsi_post_sgl_pages()
1378 spin_unlock(&ctrl->mbox_lock); in be_cmd_iscsi_post_sgl_pages()
1380 beiscsi_cmd_q_destroy(ctrl, NULL, QTYPE_SGL); in be_cmd_iscsi_post_sgl_pages()
1386 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_reset_function() local
1387 struct be_mcc_wrb *wrb = wrb_from_mbox(&ctrl->mbox_mem); in beiscsi_cmd_reset_function()
1391 spin_lock(&ctrl->mbox_lock); in beiscsi_cmd_reset_function()
1399 spin_unlock(&ctrl->mbox_lock); in beiscsi_cmd_reset_function()
1419 struct be_ctrl_info *ctrl = &phba->ctrl; in be_cmd_set_vlan() local
1421 spin_lock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1424 spin_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()
1440 spin_unlock(&ctrl->mbox_lock); in be_cmd_set_vlan()