Lines Matching refs:phba
88 struct be_mcc_wrb *alloc_mcc_wrb(struct beiscsi_hba *phba, in alloc_mcc_wrb() argument
91 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in alloc_mcc_wrb()
95 spin_lock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
97 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT | in alloc_mcc_wrb()
100 mccq->used, phba->ctrl.mcc_tag_available); in alloc_mcc_wrb()
104 if (!phba->ctrl.mcc_tag_available) in alloc_mcc_wrb()
107 tag = phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index]; in alloc_mcc_wrb()
109 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT | in alloc_mcc_wrb()
112 phba->ctrl.mcc_tag_available, in alloc_mcc_wrb()
113 phba->ctrl.mcc_alloc_index); in alloc_mcc_wrb()
119 phba->ctrl.mcc_tag[phba->ctrl.mcc_alloc_index] = 0; in alloc_mcc_wrb()
120 phba->ctrl.mcc_tag_status[tag] = 0; in alloc_mcc_wrb()
121 phba->ctrl.ptag_state[tag].tag_state = 0; in alloc_mcc_wrb()
122 phba->ctrl.ptag_state[tag].cbfn = NULL; in alloc_mcc_wrb()
123 phba->ctrl.mcc_tag_available--; in alloc_mcc_wrb()
124 if (phba->ctrl.mcc_alloc_index == (MAX_MCC_CMD - 1)) in alloc_mcc_wrb()
125 phba->ctrl.mcc_alloc_index = 0; in alloc_mcc_wrb()
127 phba->ctrl.mcc_alloc_index++; in alloc_mcc_wrb()
137 spin_unlock(&phba->ctrl.mcc_lock); in alloc_mcc_wrb()
168 int __beiscsi_mcc_compl_status(struct beiscsi_hba *phba, in __beiscsi_mcc_compl_status() argument
173 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in __beiscsi_mcc_compl_status()
181 mcc_tag_status = phba->ctrl.mcc_tag_status[tag]; in __beiscsi_mcc_compl_status()
199 beiscsi_log(phba, KERN_WARNING, in __beiscsi_mcc_compl_status()
208 beiscsi_log(phba, KERN_WARNING, in __beiscsi_mcc_compl_status()
234 int beiscsi_mccq_compl_wait(struct beiscsi_hba *phba, in beiscsi_mccq_compl_wait() argument
242 __beiscsi_log(phba, KERN_ERR, in beiscsi_mccq_compl_wait()
247 if (beiscsi_hba_in_error(phba)) { in beiscsi_mccq_compl_wait()
249 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
254 rc = wait_event_interruptible_timeout(phba->ctrl.mcc_wait[tag], in beiscsi_mccq_compl_wait()
255 phba->ctrl.mcc_tag_status[tag], in beiscsi_mccq_compl_wait()
263 if (!test_bit(BEISCSI_HBA_ONLINE, &phba->state)) { in beiscsi_mccq_compl_wait()
265 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
282 tag_mem = &phba->ctrl.ptag_state[tag].tag_mem_state; in beiscsi_mccq_compl_wait()
293 &phba->ctrl.ptag_state[tag].tag_state); in beiscsi_mccq_compl_wait()
295 beiscsi_log(phba, KERN_ERR, in beiscsi_mccq_compl_wait()
302 rc = __beiscsi_mcc_compl_status(phba, tag, wrb, mbx_cmd_mem); in beiscsi_mccq_compl_wait()
304 free_mcc_wrb(&phba->ctrl, tag); in beiscsi_mccq_compl_wait()
323 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mbox_compl() local
333 beiscsi_log(phba, KERN_ERR, in beiscsi_process_mbox_compl()
356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, in beiscsi_process_mbox_compl()
362 static void beiscsi_process_async_link(struct beiscsi_hba *phba, in beiscsi_process_async_link() argument
369 phba->port_speed = evt->port_speed; in beiscsi_process_async_link()
375 set_bit(BEISCSI_HBA_LINK_UP, &phba->state); in beiscsi_process_async_link()
376 if (test_bit(BEISCSI_HBA_BOOT_FOUND, &phba->state)) in beiscsi_process_async_link()
377 beiscsi_start_boot_work(phba, BE_BOOT_INVALID_SHANDLE); in beiscsi_process_async_link()
378 __beiscsi_log(phba, KERN_ERR, in beiscsi_process_async_link()
382 clear_bit(BEISCSI_HBA_LINK_UP, &phba->state); in beiscsi_process_async_link()
383 __beiscsi_log(phba, KERN_ERR, in beiscsi_process_async_link()
386 iscsi_host_for_each_session(phba->shost, in beiscsi_process_async_link()
400 static void beiscsi_process_async_sli(struct beiscsi_hba *phba, in beiscsi_process_async_sli() argument
417 (phba->fw_config.phys_port * 8) & 0xff; in beiscsi_process_async_sli()
419 (phba->fw_config.phys_port * 8) & 0xff; in beiscsi_process_async_sli()
421 old_state = phba->optic_state; in beiscsi_process_async_sli()
422 phba->optic_state = state; in beiscsi_process_async_sli()
426 __beiscsi_log(phba, KERN_ERR, in beiscsi_process_async_sli()
428 phba->port_name, async_sli->event_data1); in beiscsi_process_async_sli()
446 if (old_state != phba->optic_state) in beiscsi_process_async_sli()
447 __beiscsi_log(phba, sev, "BC_%d : Port %c: %s%s\n", in beiscsi_process_async_sli()
448 phba->port_name, in beiscsi_process_async_sli()
453 void beiscsi_process_async_event(struct beiscsi_hba *phba, in beiscsi_process_async_event() argument
464 beiscsi_process_async_link(phba, compl); in beiscsi_process_async_event()
467 if (test_bit(BEISCSI_HBA_BOOT_FOUND, &phba->state)) in beiscsi_process_async_event()
468 beiscsi_start_boot_work(phba, BE_BOOT_INVALID_SHANDLE); in beiscsi_process_async_event()
472 beiscsi_process_async_sli(phba, compl); in beiscsi_process_async_event()
479 beiscsi_log(phba, sev, BEISCSI_LOG_CONFIG | BEISCSI_LOG_MBOX, in beiscsi_process_async_event()
487 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_process_mcc_compl() local
498 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_MBOX | in beiscsi_process_mcc_compl()
508 beiscsi_log(phba, KERN_WARNING, in beiscsi_process_mcc_compl()
542 ctrl->ptag_state[tag].cbfn(phba, tag); in beiscsi_process_mcc_compl()
544 __beiscsi_log(phba, KERN_ERR, in beiscsi_process_mcc_compl()
552 __beiscsi_mcc_compl_status(phba, tag, NULL, NULL); in beiscsi_process_mcc_compl()
561 void be_mcc_notify(struct beiscsi_hba *phba, unsigned int tag) in be_mcc_notify() argument
563 struct be_queue_info *mccq = &phba->ctrl.mcc_obj.q; in be_mcc_notify()
566 set_bit(MCC_TAG_STATE_RUNNING, &phba->ctrl.ptag_state[tag].tag_state); in be_mcc_notify()
571 iowrite32(val, phba->db_va + DB_MCCQ_OFFSET); in be_mcc_notify()
590 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_mbox_db_ready_poll() local
600 if (beiscsi_hba_in_error(phba)) in be_mbox_db_ready_poll()
617 beiscsi_log(phba, KERN_ERR, in be_mbox_db_ready_poll()
620 set_bit(BEISCSI_HBA_FW_TIMEOUT, &phba->state); in be_mbox_db_ready_poll()
782 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_cq_create() local
796 if (is_chip_be2_be3r(phba)) { in beiscsi_cmd_cq_create()
833 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_cmd_cq_create()
850 int beiscsi_cmd_mccq_create(struct beiscsi_hba *phba, in beiscsi_cmd_mccq_create() argument
861 mutex_lock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
862 ctrl = &phba->ctrl; in beiscsi_cmd_mccq_create()
879 PCI_FUNC(phba->pcidev->devfn)); in beiscsi_cmd_mccq_create()
895 mutex_unlock(&phba->ctrl.mbox_lock); in beiscsi_cmd_mccq_create()
905 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_q_destroy() local
909 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_cmd_q_destroy()
983 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_create_default_pdu_queue() local
996 if (phba->fw_config.dual_ulp_aware) { in be_cmd_create_default_pdu_queue()
1002 if (is_chip_be2_be3r(phba)) { in be_cmd_create_default_pdu_queue()
1044 defq_ring = &phba->phwi_ctrlr->default_pdu_hdr[ulp_num]; in be_cmd_create_default_pdu_queue()
1046 defq_ring = &phba->phwi_ctrlr-> in be_cmd_create_default_pdu_queue()
1051 if (!phba->fw_config.dual_ulp_aware) { in be_cmd_create_default_pdu_queue()
1084 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_wrbq_create() local
1096 if (phba->fw_config.dual_ulp_aware) { in be_cmd_wrbq_create()
1110 if (!phba->fw_config.dual_ulp_aware) { in be_cmd_wrbq_create()
1173 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in be_cmd_iscsi_post_sgl_pages() local
1204 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in be_cmd_iscsi_post_sgl_pages()
1227 int be_cmd_set_vlan(struct beiscsi_hba *phba, in be_cmd_set_vlan() argument
1233 struct be_ctrl_info *ctrl = &phba->ctrl; in be_cmd_set_vlan()
1237 wrb = alloc_mcc_wrb(phba, &tag); in be_cmd_set_vlan()
1249 req->interface_hndl = phba->interface_handle; in be_cmd_set_vlan()
1252 be_mcc_notify(phba, tag); in be_cmd_set_vlan()
1259 struct beiscsi_hba *phba) in beiscsi_check_supported_fw() argument
1271 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_check_supported_fw()
1291 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_check_supported_fw()
1300 phba->fw_config.iscsi_features = in beiscsi_check_supported_fw()
1302 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_check_supported_fw()
1304 phba->fw_config.iscsi_features); in beiscsi_check_supported_fw()
1305 memcpy(phba->fw_ver_str, resp->params.hba_attribs. in beiscsi_check_supported_fw()
1308 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_check_supported_fw()
1331 struct beiscsi_hba *phba) in beiscsi_get_fw_config() argument
1348 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1354 phba->fw_config.phys_port = pfw_cfg->phys_port; in beiscsi_get_fw_config()
1355 if (phba->fw_config.phys_port >= BEISCSI_PHYS_PORT_MAX) { in beiscsi_get_fw_config()
1356 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1358 phba->fw_config.phys_port); in beiscsi_get_fw_config()
1363 if (!is_chip_be2_be3r(phba)) { in beiscsi_get_fw_config()
1364 phba->fw_config.eqid_count = pfw_cfg->eqid_count; in beiscsi_get_fw_config()
1365 phba->fw_config.cqid_count = pfw_cfg->cqid_count; in beiscsi_get_fw_config()
1366 if (phba->fw_config.eqid_count == 0 || in beiscsi_get_fw_config()
1367 phba->fw_config.eqid_count > 2048) { in beiscsi_get_fw_config()
1368 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1370 phba->fw_config.eqid_count); in beiscsi_get_fw_config()
1373 if (phba->fw_config.cqid_count == 0 || in beiscsi_get_fw_config()
1374 phba->fw_config.cqid_count > 4096) { in beiscsi_get_fw_config()
1375 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1377 phba->fw_config.cqid_count); in beiscsi_get_fw_config()
1380 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1382 phba->fw_config.eqid_count, in beiscsi_get_fw_config()
1383 phba->fw_config.cqid_count); in beiscsi_get_fw_config()
1395 set_bit(ulp_num, &phba->fw_config.ulp_supported); in beiscsi_get_fw_config()
1398 phba->fw_config.iscsi_cid_start[ulp_num] = in beiscsi_get_fw_config()
1400 phba->fw_config.iscsi_cid_count[ulp_num] = in beiscsi_get_fw_config()
1403 phba->fw_config.iscsi_icd_start[ulp_num] = in beiscsi_get_fw_config()
1405 phba->fw_config.iscsi_icd_count[ulp_num] = in beiscsi_get_fw_config()
1408 phba->fw_config.iscsi_chain_start[ulp_num] = in beiscsi_get_fw_config()
1410 phba->fw_config.iscsi_chain_count[ulp_num] = in beiscsi_get_fw_config()
1413 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1420 phba->fw_config. in beiscsi_get_fw_config()
1422 phba->fw_config. in beiscsi_get_fw_config()
1424 phba->fw_config. in beiscsi_get_fw_config()
1426 phba->fw_config. in beiscsi_get_fw_config()
1431 if (phba->fw_config.ulp_supported == 0) { in beiscsi_get_fw_config()
1432 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1443 if (test_bit(ulp_num, &phba->fw_config.ulp_supported)) in beiscsi_get_fw_config()
1445 icd_count = phba->fw_config.iscsi_icd_count[ulp_num]; in beiscsi_get_fw_config()
1447 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1452 cid_count = BEISCSI_GET_CID_COUNT(phba, BEISCSI_ULP0) + in beiscsi_get_fw_config()
1453 BEISCSI_GET_CID_COUNT(phba, BEISCSI_ULP1); in beiscsi_get_fw_config()
1455 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1464 phba->fw_config.dual_ulp_aware = (pfw_cfg->function_mode & in beiscsi_get_fw_config()
1467 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_get_fw_config()
1469 phba->fw_config.dual_ulp_aware); in beiscsi_get_fw_config()
1486 int beiscsi_get_port_name(struct be_ctrl_info *ctrl, struct beiscsi_hba *phba) in beiscsi_get_port_name() argument
1502 phba->port_name = 0; in beiscsi_get_port_name()
1504 phba->port_name = ioctl->p.resp.port_names >> in beiscsi_get_port_name()
1505 (phba->fw_config.phys_port * 8) & 0xff; in beiscsi_get_port_name()
1507 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_get_port_name()
1512 if (phba->port_name == 0) in beiscsi_get_port_name()
1513 phba->port_name = '?'; in beiscsi_get_port_name()
1519 int beiscsi_set_host_data(struct beiscsi_hba *phba) in beiscsi_set_host_data() argument
1521 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_set_host_data()
1526 if (is_chip_be2_be3r(phba)) in beiscsi_set_host_data()
1548 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_set_host_data()
1557 __beiscsi_log(phba, KERN_INFO, in beiscsi_set_host_data()
1565 int beiscsi_set_uer_feature(struct beiscsi_hba *phba) in beiscsi_set_uer_feature() argument
1567 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_set_uer_feature()
1586 phba->ue2rp = ioctl->param.resp.ue2rp; in beiscsi_set_uer_feature()
1587 set_bit(BEISCSI_HBA_UER_SUPP, &phba->state); in beiscsi_set_uer_feature()
1588 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_set_uer_feature()
1597 __beiscsi_log(phba, KERN_INFO, in beiscsi_set_uer_feature()
1605 static u32 beiscsi_get_post_stage(struct beiscsi_hba *phba) in beiscsi_get_post_stage() argument
1609 if (is_chip_be2_be3r(phba)) in beiscsi_get_post_stage()
1610 sem = ioread32(phba->csr_va + SLIPORT_SEMAPHORE_OFFSET_BEx); in beiscsi_get_post_stage()
1612 pci_read_config_dword(phba->pcidev, in beiscsi_get_post_stage()
1617 int beiscsi_check_fw_rdy(struct beiscsi_hba *phba) in beiscsi_check_fw_rdy() argument
1623 post = beiscsi_get_post_stage(phba); in beiscsi_check_fw_rdy()
1634 __beiscsi_log(phba, KERN_ERR, in beiscsi_check_fw_rdy()
1641 int beiscsi_cmd_function_reset(struct beiscsi_hba *phba) in beiscsi_cmd_function_reset() argument
1643 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_function_reset()
1663 struct beiscsi_hba *phba = pci_get_drvdata(ctrl->pdev); in beiscsi_cmd_special_wrb() local
1696 beiscsi_log(phba, KERN_INFO, BEISCSI_LOG_INIT, in beiscsi_cmd_special_wrb()
1702 int beiscsi_init_sliport(struct beiscsi_hba *phba) in beiscsi_init_sliport() argument
1707 status = beiscsi_check_fw_rdy(phba); in beiscsi_init_sliport()
1712 phba->state &= ~BEISCSI_HBA_IN_ERR; in beiscsi_init_sliport()
1715 phba->state &= ~BEISCSI_HBA_UER_SUPP; in beiscsi_init_sliport()
1721 status = beiscsi_cmd_function_reset(phba); in beiscsi_init_sliport()
1723 beiscsi_log(phba, KERN_ERR, BEISCSI_LOG_INIT, in beiscsi_init_sliport()
1729 return beiscsi_cmd_special_wrb(&phba->ctrl, 1); in beiscsi_init_sliport()
1741 int beiscsi_cmd_iscsi_cleanup(struct beiscsi_hba *phba, unsigned short ulp) in beiscsi_cmd_iscsi_cleanup() argument
1743 struct be_ctrl_info *ctrl = &phba->ctrl; in beiscsi_cmd_iscsi_cleanup()
1753 hdr_ring_id = HWI_GET_DEF_HDRQ_ID(phba, ulp); in beiscsi_cmd_iscsi_cleanup()
1754 data_ring_id = HWI_GET_DEF_BUFQ_ID(phba, ulp); in beiscsi_cmd_iscsi_cleanup()
1755 if (is_chip_be2_be3r(phba)) { in beiscsi_cmd_iscsi_cleanup()
1778 beiscsi_log(phba, KERN_WARNING, BEISCSI_LOG_INIT, in beiscsi_cmd_iscsi_cleanup()
1790 int beiscsi_detect_ue(struct beiscsi_hba *phba) in beiscsi_detect_ue() argument
1797 pci_read_config_dword(phba->pcidev, in beiscsi_detect_ue()
1799 pci_read_config_dword(phba->pcidev, in beiscsi_detect_ue()
1802 pci_read_config_dword(phba->pcidev, in beiscsi_detect_ue()
1805 pci_read_config_dword(phba->pcidev, in beiscsi_detect_ue()
1814 set_bit(BEISCSI_HBA_IN_UE, &phba->state); in beiscsi_detect_ue()
1815 __beiscsi_log(phba, KERN_ERR, in beiscsi_detect_ue()
1823 __beiscsi_log(phba, KERN_ERR, in beiscsi_detect_ue()
1832 __beiscsi_log(phba, KERN_ERR, in beiscsi_detect_ue()
1847 int beiscsi_detect_tpe(struct beiscsi_hba *phba) in beiscsi_detect_tpe() argument
1852 post = beiscsi_get_post_stage(phba); in beiscsi_detect_tpe()
1856 set_bit(BEISCSI_HBA_IN_TPE, &phba->state); in beiscsi_detect_tpe()
1857 __beiscsi_log(phba, KERN_INFO, in beiscsi_detect_tpe()
1861 __beiscsi_log(phba, KERN_INFO, in beiscsi_detect_tpe()