Lines Matching refs:p_hwfn
41 static void qed_spq_blocking_cb(struct qed_hwfn *p_hwfn, in qed_spq_blocking_cb() argument
57 static int qed_spq_block(struct qed_hwfn *p_hwfn, in qed_spq_block() argument
78 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n"); in qed_spq_block()
79 rc = qed_mcp_drain(p_hwfn, p_hwfn->p_main_ptt); in qed_spq_block()
81 DP_NOTICE(p_hwfn, "MCP drain failed\n"); in qed_spq_block()
103 DP_NOTICE(p_hwfn, "Ramrod is stuck, MCP drain failed\n"); in qed_spq_block()
112 qed_spq_fill_entry(struct qed_hwfn *p_hwfn, in qed_spq_fill_entry() argument
125 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n", in qed_spq_fill_entry()
130 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_fill_entry()
147 static void qed_spq_hw_initialize(struct qed_hwfn *p_hwfn, in qed_spq_hw_initialize() argument
158 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info); in qed_spq_hw_initialize()
161 DP_NOTICE(p_hwfn, "Cannot find context info for cid=%d\n", in qed_spq_hw_initialize()
178 pq = qed_get_qm_pq(p_hwfn, PROTOCOLID_CORE, &pq_params); in qed_spq_hw_initialize()
187 DMA_LO_LE(p_hwfn->p_consq->chain.p_phys_addr); in qed_spq_hw_initialize()
189 DMA_HI_LE(p_hwfn->p_consq->chain.p_phys_addr); in qed_spq_hw_initialize()
192 static int qed_spq_hw_post(struct qed_hwfn *p_hwfn, in qed_spq_hw_post() argument
196 struct qed_chain *p_chain = &p_hwfn->p_spq->chain; in qed_spq_hw_post()
204 DP_NOTICE(p_hwfn, "Failed to produce from SPQ chain\n"); in qed_spq_hw_post()
226 DOORBELL(p_hwfn, qed_db_addr(p_spq->cid, DQ_DEMS_LEGACY), *(u32 *)&db); in qed_spq_hw_post()
231 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_hw_post()
244 qed_async_event_completion(struct qed_hwfn *p_hwfn, in qed_async_event_completion() argument
247 DP_NOTICE(p_hwfn, in qed_async_event_completion()
256 void qed_eq_prod_update(struct qed_hwfn *p_hwfn, in qed_eq_prod_update() argument
260 USTORM_EQE_CONS_OFFSET(p_hwfn->rel_pf_id); in qed_eq_prod_update()
262 REG_WR16(p_hwfn, addr, prod); in qed_eq_prod_update()
268 int qed_eq_completion(struct qed_hwfn *p_hwfn, in qed_eq_completion() argument
279 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, "fw_cons_idx %x\n", fw_cons_idx); in qed_eq_completion()
297 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_eq_completion()
307 if (qed_async_event_completion(p_hwfn, p_eqe)) in qed_eq_completion()
309 } else if (qed_spq_completion(p_hwfn, in qed_eq_completion()
319 qed_eq_prod_update(p_hwfn, qed_chain_get_prod_idx(p_chain)); in qed_eq_completion()
324 struct qed_eq *qed_eq_alloc(struct qed_hwfn *p_hwfn, in qed_eq_alloc() argument
332 DP_NOTICE(p_hwfn, "Failed to allocate `struct qed_eq'\n"); in qed_eq_alloc()
337 if (qed_chain_alloc(p_hwfn->cdev, in qed_eq_alloc()
343 DP_NOTICE(p_hwfn, "Failed to allocate eq chain\n"); in qed_eq_alloc()
348 qed_int_register_cb(p_hwfn, in qed_eq_alloc()
357 qed_eq_free(p_hwfn, p_eq); in qed_eq_alloc()
361 void qed_eq_setup(struct qed_hwfn *p_hwfn, in qed_eq_setup() argument
367 void qed_eq_free(struct qed_hwfn *p_hwfn, in qed_eq_free() argument
372 qed_chain_free(p_hwfn->cdev, &p_eq->chain); in qed_eq_free()
380 struct qed_hwfn *p_hwfn, in qed_cqe_completion() argument
388 return qed_spq_completion(p_hwfn, cqe->echo, 0, NULL); in qed_cqe_completion()
391 int qed_eth_cqe_completion(struct qed_hwfn *p_hwfn, in qed_eth_cqe_completion() argument
396 rc = qed_cqe_completion(p_hwfn, cqe, PROTOCOLID_ETH); in qed_eth_cqe_completion()
398 DP_NOTICE(p_hwfn, in qed_eth_cqe_completion()
408 void qed_spq_setup(struct qed_hwfn *p_hwfn) in qed_spq_setup() argument
410 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_setup()
445 qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_CORE, &p_spq->cid); in qed_spq_setup()
446 qed_spq_hw_initialize(p_hwfn, p_spq); in qed_spq_setup()
452 int qed_spq_alloc(struct qed_hwfn *p_hwfn) in qed_spq_alloc() argument
462 DP_NOTICE(p_hwfn, "Failed to allocate `struct qed_spq'\n"); in qed_spq_alloc()
467 if (qed_chain_alloc(p_hwfn->cdev, in qed_spq_alloc()
473 DP_NOTICE(p_hwfn, "Failed to allocate spq chain\n"); in qed_spq_alloc()
478 p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, in qed_spq_alloc()
489 p_hwfn->p_spq = p_spq; in qed_spq_alloc()
494 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_alloc()
499 void qed_spq_free(struct qed_hwfn *p_hwfn) in qed_spq_free() argument
501 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_free()
507 dma_free_coherent(&p_hwfn->cdev->pdev->dev, in qed_spq_free()
513 qed_chain_free(p_hwfn->cdev, &p_spq->chain); in qed_spq_free()
519 qed_spq_get_entry(struct qed_hwfn *p_hwfn, in qed_spq_get_entry() argument
522 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_get_entry()
551 static void __qed_spq_return_entry(struct qed_hwfn *p_hwfn, in __qed_spq_return_entry() argument
554 list_add_tail(&p_ent->list, &p_hwfn->p_spq->free_pool); in __qed_spq_return_entry()
557 void qed_spq_return_entry(struct qed_hwfn *p_hwfn, in qed_spq_return_entry() argument
560 spin_lock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
561 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_return_entry()
562 spin_unlock_bh(&p_hwfn->p_spq->lock); in qed_spq_return_entry()
580 qed_spq_add_entry(struct qed_hwfn *p_hwfn, in qed_spq_add_entry() argument
584 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_add_entry()
635 u32 qed_spq_get_cid(struct qed_hwfn *p_hwfn) in qed_spq_get_cid() argument
637 if (!p_hwfn->p_spq) in qed_spq_get_cid()
639 return p_hwfn->p_spq->cid; in qed_spq_get_cid()
645 static int qed_spq_post_list(struct qed_hwfn *p_hwfn, in qed_spq_post_list() argument
649 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_post_list()
660 rc = qed_spq_hw_post(p_hwfn, p_spq, p_ent); in qed_spq_post_list()
663 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post_list()
671 static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) in qed_spq_pend_post() argument
673 struct qed_spq *p_spq = p_hwfn->p_spq; in qed_spq_pend_post()
688 qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_pend_post()
691 return qed_spq_post_list(p_hwfn, &p_spq->pending, in qed_spq_pend_post()
695 int qed_spq_post(struct qed_hwfn *p_hwfn, in qed_spq_post() argument
700 struct qed_spq *p_spq = p_hwfn ? p_hwfn->p_spq : NULL; in qed_spq_post()
703 if (!p_hwfn) in qed_spq_post()
707 DP_NOTICE(p_hwfn, "Got a NULL pointer\n"); in qed_spq_post()
712 rc = qed_spq_fill_entry(p_hwfn, p_ent); in qed_spq_post()
721 rc = qed_spq_add_entry(p_hwfn, p_ent, p_ent->priority); in qed_spq_post()
725 rc = qed_spq_pend_post(p_hwfn); in qed_spq_post()
743 rc = qed_spq_block(p_hwfn, p_ent, fw_return_code); in qed_spq_post()
748 qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
760 __qed_spq_return_entry(p_hwfn, p_ent); in qed_spq_post()
766 int qed_spq_completion(struct qed_hwfn *p_hwfn, in qed_spq_completion() argument
777 if (!p_hwfn) in qed_spq_completion()
780 p_spq = p_hwfn->p_spq; in qed_spq_completion()
816 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, in qed_spq_completion()
828 DP_NOTICE(p_hwfn, in qed_spq_completion()
833 DP_VERBOSE(p_hwfn, QED_MSG_SPQ, "Complete: func %p cookie %p)\n", in qed_spq_completion()
836 found->comp_cb.function(p_hwfn, found->comp_cb.cookie, p_data, in qed_spq_completion()
841 qed_spq_return_entry(p_hwfn, found); in qed_spq_completion()
845 rc = qed_spq_pend_post(p_hwfn); in qed_spq_completion()
851 struct qed_consq *qed_consq_alloc(struct qed_hwfn *p_hwfn) in qed_consq_alloc() argument
858 DP_NOTICE(p_hwfn, "Failed to allocate `struct qed_consq'\n"); in qed_consq_alloc()
863 if (qed_chain_alloc(p_hwfn->cdev, in qed_consq_alloc()
869 DP_NOTICE(p_hwfn, "Failed to allocate consq chain"); in qed_consq_alloc()
876 qed_consq_free(p_hwfn, p_consq); in qed_consq_alloc()
880 void qed_consq_setup(struct qed_hwfn *p_hwfn, in qed_consq_setup() argument
886 void qed_consq_free(struct qed_hwfn *p_hwfn, in qed_consq_free() argument
891 qed_chain_free(p_hwfn->cdev, &p_consq->chain); in qed_consq_free()