Lines Matching refs:ipc_protocol
11 ipc_protocol_free_msg_get(struct iosm_protocol *ipc_protocol, int *index) in ipc_protocol_free_msg_get() argument
13 u32 head = le32_to_cpu(ipc_protocol->p_ap_shm->msg_head); in ipc_protocol_free_msg_get()
17 if (new_head == le32_to_cpu(ipc_protocol->p_ap_shm->msg_tail)) { in ipc_protocol_free_msg_get()
18 dev_err(ipc_protocol->dev, "message ring is full"); in ipc_protocol_free_msg_get()
25 msg = &ipc_protocol->p_ap_shm->msg_ring[head]; in ipc_protocol_free_msg_get()
37 struct iosm_protocol *ipc_protocol = ipc_imem->ipc_protocol; in ipc_protocol_msg_hp_update() local
38 u32 head = le32_to_cpu(ipc_protocol->p_ap_shm->msg_head); in ipc_protocol_msg_hp_update()
42 ipc_protocol->p_ap_shm->msg_head = cpu_to_le32(new_head); in ipc_protocol_msg_hp_update()
43 ipc_protocol->old_msg_tail = in ipc_protocol_msg_hp_update()
44 le32_to_cpu(ipc_protocol->p_ap_shm->msg_tail); in ipc_protocol_msg_hp_update()
46 ipc_pm_signal_hpda_doorbell(&ipc_protocol->pm, IPC_HP_MR, false); in ipc_protocol_msg_hp_update()
53 static int ipc_protocol_msg_prepipe_open(struct iosm_protocol *ipc_protocol, in ipc_protocol_msg_prepipe_open() argument
58 ipc_protocol_free_msg_get(ipc_protocol, &index); in ipc_protocol_msg_prepipe_open()
64 dev_err(ipc_protocol->dev, "failed to get free message"); in ipc_protocol_msg_prepipe_open()
77 tdr = dma_alloc_coherent(&ipc_protocol->pcie->pci->dev, in ipc_protocol_msg_prepipe_open()
82 dev_err(ipc_protocol->dev, "tdr alloc error"); in ipc_protocol_msg_prepipe_open()
92 ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr] = 0; in ipc_protocol_msg_prepipe_open()
105 static int ipc_protocol_msg_prepipe_close(struct iosm_protocol *ipc_protocol, in ipc_protocol_msg_prepipe_close() argument
110 ipc_protocol_free_msg_get(ipc_protocol, &index); in ipc_protocol_msg_prepipe_close()
119 dev_dbg(ipc_protocol->dev, "IPC_MEM_MSG_CLOSE_PIPE(pipe_nr=%d)", in ipc_protocol_msg_prepipe_close()
125 static int ipc_protocol_msg_prep_sleep(struct iosm_protocol *ipc_protocol, in ipc_protocol_msg_prep_sleep() argument
130 ipc_protocol_free_msg_get(ipc_protocol, &index); in ipc_protocol_msg_prep_sleep()
133 dev_err(ipc_protocol->dev, "failed to get free message"); in ipc_protocol_msg_prep_sleep()
144 dev_dbg(ipc_protocol->dev, "IPC_MEM_MSG_SLEEP(target=%d; state=%d)", in ipc_protocol_msg_prep_sleep()
150 static int ipc_protocol_msg_prep_feature_set(struct iosm_protocol *ipc_protocol, in ipc_protocol_msg_prep_feature_set() argument
155 ipc_protocol_free_msg_get(ipc_protocol, &index); in ipc_protocol_msg_prep_feature_set()
158 dev_err(ipc_protocol->dev, "failed to get free message"); in ipc_protocol_msg_prep_feature_set()
166 dev_dbg(ipc_protocol->dev, "IPC_MEM_MSG_FEATURE_SET(reset_enable=%d)", in ipc_protocol_msg_prep_feature_set()
175 struct iosm_protocol *ipc_protocol = ipc_imem->ipc_protocol; in ipc_protocol_msg_process() local
176 struct ipc_rsp **rsp_ring = ipc_protocol->rsp_ring; in ipc_protocol_msg_process()
180 if (le32_to_cpu(ipc_protocol->p_ap_shm->msg_tail) >= in ipc_protocol_msg_process()
182 dev_err(ipc_protocol->dev, "msg_tail out of range: %d", in ipc_protocol_msg_process()
183 le32_to_cpu(ipc_protocol->p_ap_shm->msg_tail)); in ipc_protocol_msg_process()
188 irq != ipc_protocol->p_ap_shm->ci.msg_irq_vector) in ipc_protocol_msg_process()
191 for (i = ipc_protocol->old_msg_tail; in ipc_protocol_msg_process()
192 i != le32_to_cpu(ipc_protocol->p_ap_shm->msg_tail); in ipc_protocol_msg_process()
195 &ipc_protocol->p_ap_shm->msg_ring[i]; in ipc_protocol_msg_process()
197 dev_dbg(ipc_protocol->dev, "msg[%d]: type=%u status=%d", i, in ipc_protocol_msg_process()
211 ipc_protocol->old_msg_tail = i; in ipc_protocol_msg_process()
218 bool ipc_protocol_ul_td_send(struct iosm_protocol *ipc_protocol, in ipc_protocol_ul_td_send() argument
229 if (!ipc_protocol->p_ap_shm) { in ipc_protocol_ul_td_send()
230 dev_err(ipc_protocol->dev, "driver is not initialized"); in ipc_protocol_ul_td_send()
237 head = le32_to_cpu(ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr]); in ipc_protocol_ul_td_send()
248 dev_dbg(ipc_protocol->dev, in ipc_protocol_ul_td_send()
278 ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr] = in ipc_protocol_ul_td_send()
283 dev_dbg(ipc_protocol->dev, "New UL TDs Pipe:%d", pipe->pipe_nr); in ipc_protocol_ul_td_send()
294 struct sk_buff *ipc_protocol_ul_td_process(struct iosm_protocol *ipc_protocol, in ipc_protocol_ul_td_process() argument
306 dev_err(ipc_protocol->dev, "Td buffer address is NULL"); in ipc_protocol_ul_td_process()
311 dev_err(ipc_protocol->dev, in ipc_protocol_ul_td_process()
323 bool ipc_protocol_dl_td_prepare(struct iosm_protocol *ipc_protocol, in ipc_protocol_dl_td_prepare() argument
335 head = le32_to_cpu(ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr]); in ipc_protocol_dl_td_prepare()
336 tail = le32_to_cpu(ipc_protocol->p_ap_shm->tail_array[pipe->pipe_nr]); in ipc_protocol_dl_td_prepare()
349 skb = ipc_pcie_alloc_skb(ipc_protocol->pcie, pipe->buf_size, GFP_ATOMIC, in ipc_protocol_dl_td_prepare()
360 ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr] = in ipc_protocol_dl_td_prepare()
372 struct sk_buff *ipc_protocol_dl_td_process(struct iosm_protocol *ipc_protocol, in ipc_protocol_dl_td_process() argument
395 dev_err(ipc_protocol->dev, "skb is null"); in ipc_protocol_dl_td_process()
398 dev_err(ipc_protocol->dev, "td/buffer address is null"); in ipc_protocol_dl_td_process()
399 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); in ipc_protocol_dl_td_process()
405 dev_err(ipc_protocol->dev, "invalid buf=%llx or skb=%p", in ipc_protocol_dl_td_process()
407 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); in ipc_protocol_dl_td_process()
411 dev_err(ipc_protocol->dev, "invalid buffer size %d > %d", in ipc_protocol_dl_td_process()
414 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); in ipc_protocol_dl_td_process()
420 dev_dbg(ipc_protocol->dev, "discard 'aborted' buffers"); in ipc_protocol_dl_td_process()
421 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); in ipc_protocol_dl_td_process()
433 void ipc_protocol_get_head_tail_index(struct iosm_protocol *ipc_protocol, in ipc_protocol_get_head_tail_index() argument
437 struct ipc_protocol_ap_shm *ipc_ap_shm = ipc_protocol->p_ap_shm; in ipc_protocol_get_head_tail_index()
447 void ipc_protocol_pipe_cleanup(struct iosm_protocol *ipc_protocol, in ipc_protocol_pipe_cleanup() argument
455 head = le32_to_cpu(ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr]); in ipc_protocol_pipe_cleanup()
459 ipc_protocol->p_ap_shm->tail_array[pipe->pipe_nr] = 0; in ipc_protocol_pipe_cleanup()
460 ipc_protocol->p_ap_shm->head_array[pipe->pipe_nr] = 0; in ipc_protocol_pipe_cleanup()
470 ipc_pcie_kfree_skb(ipc_protocol->pcie, skb); in ipc_protocol_pipe_cleanup()
485 dma_free_coherent(&ipc_protocol->pcie->pci->dev, in ipc_protocol_pipe_cleanup()
494 *ipc_protocol) in ipc_protocol_get_ipc_status() argument
497 le32_to_cpu(ipc_protocol->p_ap_shm->device_info.ipc_status); in ipc_protocol_get_ipc_status()
501 ipc_protocol_get_ap_exec_stage(struct iosm_protocol *ipc_protocol) in ipc_protocol_get_ap_exec_stage() argument
503 return le32_to_cpu(ipc_protocol->p_ap_shm->device_info.execution_stage); in ipc_protocol_get_ap_exec_stage()
510 struct iosm_protocol *ipc_protocol = ipc_imem->ipc_protocol; in ipc_protocol_msg_prep() local
514 return ipc_protocol_msg_prep_sleep(ipc_protocol, args); in ipc_protocol_msg_prep()
517 return ipc_protocol_msg_prepipe_open(ipc_protocol, args); in ipc_protocol_msg_prep()
520 return ipc_protocol_msg_prepipe_close(ipc_protocol, args); in ipc_protocol_msg_prep()
523 return ipc_protocol_msg_prep_feature_set(ipc_protocol, args); in ipc_protocol_msg_prep()
529 dev_err(ipc_protocol->dev, in ipc_protocol_msg_prep()
536 ipc_protocol_pm_dev_get_sleep_notification(struct iosm_protocol *ipc_protocol) in ipc_protocol_pm_dev_get_sleep_notification() argument
538 struct ipc_protocol_ap_shm *ipc_ap_shm = ipc_protocol->p_ap_shm; in ipc_protocol_pm_dev_get_sleep_notification()