Lines Matching refs:dev

48 	spin_lock_irqsave(&cl->dev->read_list_spinlock, flags);  in ishtp_read_list_flush()
49 list_for_each_entry_safe(rb, next, &cl->dev->read_list.list, list) in ishtp_read_list_flush()
54 spin_unlock_irqrestore(&cl->dev->read_list_spinlock, flags); in ishtp_read_list_flush()
68 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_flush_queues()
85 static void ishtp_cl_init(struct ishtp_cl *cl, struct ishtp_device *dev) in ishtp_cl_init() argument
95 cl->dev = dev; in ishtp_cl_init()
142 struct ishtp_device *dev; in ishtp_cl_free() local
148 dev = cl->dev; in ishtp_cl_free()
149 if (!dev) in ishtp_cl_free()
152 spin_lock_irqsave(&dev->cl_list_lock, flags); in ishtp_cl_free()
156 spin_unlock_irqrestore(&dev->cl_list_lock, flags); in ishtp_cl_free()
173 struct ishtp_device *dev; in ishtp_cl_link() local
177 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_link()
180 dev = cl->dev; in ishtp_cl_link()
182 spin_lock_irqsave(&dev->device_lock, flags); in ishtp_cl_link()
184 if (dev->open_handle_count >= ISHTP_MAX_OPEN_HANDLE_COUNT) { in ishtp_cl_link()
189 id = find_first_zero_bit(dev->host_clients_map, ISHTP_CLIENTS_MAX); in ishtp_cl_link()
192 spin_unlock_irqrestore(&dev->device_lock, flags); in ishtp_cl_link()
193 dev_err(&cl->device->dev, "id exceeded %d", ISHTP_CLIENTS_MAX); in ishtp_cl_link()
197 dev->open_handle_count++; in ishtp_cl_link()
199 spin_lock_irqsave(&dev->cl_list_lock, flags_cl); in ishtp_cl_link()
200 if (dev->dev_state != ISHTP_DEV_ENABLED) { in ishtp_cl_link()
204 list_add_tail(&cl->link, &dev->cl_list); in ishtp_cl_link()
205 set_bit(id, dev->host_clients_map); in ishtp_cl_link()
209 spin_unlock_irqrestore(&dev->cl_list_lock, flags_cl); in ishtp_cl_link()
211 spin_unlock_irqrestore(&dev->device_lock, flags); in ishtp_cl_link()
224 struct ishtp_device *dev; in ishtp_cl_unlink() local
229 if (!cl || !cl->dev) in ishtp_cl_unlink()
232 dev = cl->dev; in ishtp_cl_unlink()
234 spin_lock_irqsave(&dev->device_lock, flags); in ishtp_cl_unlink()
235 if (dev->open_handle_count > 0) { in ishtp_cl_unlink()
236 clear_bit(cl->host_client_id, dev->host_clients_map); in ishtp_cl_unlink()
237 dev->open_handle_count--; in ishtp_cl_unlink()
239 spin_unlock_irqrestore(&dev->device_lock, flags); in ishtp_cl_unlink()
245 spin_lock_irqsave(&dev->cl_list_lock, flags); in ishtp_cl_unlink()
246 list_for_each_entry(pos, &dev->cl_list, link) in ishtp_cl_unlink()
251 spin_unlock_irqrestore(&dev->cl_list_lock, flags); in ishtp_cl_unlink()
266 struct ishtp_device *dev; in ishtp_cl_disconnect() local
268 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_disconnect()
271 dev = cl->dev; in ishtp_cl_disconnect()
273 dev->print_log(dev, "%s() state %d\n", __func__, cl->state); in ishtp_cl_disconnect()
276 dev->print_log(dev, "%s() Disconnect in progress\n", __func__); in ishtp_cl_disconnect()
280 if (ishtp_hbm_cl_disconnect_req(dev, cl)) { in ishtp_cl_disconnect()
281 dev->print_log(dev, "%s() Failed to disconnect\n", __func__); in ishtp_cl_disconnect()
282 dev_err(&cl->device->dev, "failed to disconnect.\n"); in ishtp_cl_disconnect()
287 (dev->dev_state != ISHTP_DEV_ENABLED || in ishtp_cl_disconnect()
295 if (dev->dev_state != ISHTP_DEV_ENABLED) { in ishtp_cl_disconnect()
296 dev->print_log(dev, "%s() dev_state != ISHTP_DEV_ENABLED\n", in ishtp_cl_disconnect()
302 dev->print_log(dev, "%s() successful\n", __func__); in ishtp_cl_disconnect()
320 struct ishtp_device *dev; in ishtp_cl_is_other_connecting() local
324 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_is_other_connecting()
327 dev = cl->dev; in ishtp_cl_is_other_connecting()
328 spin_lock_irqsave(&dev->cl_list_lock, flags); in ishtp_cl_is_other_connecting()
329 list_for_each_entry(pos, &dev->cl_list, link) { in ishtp_cl_is_other_connecting()
332 spin_unlock_irqrestore(&dev->cl_list_lock, flags); in ishtp_cl_is_other_connecting()
336 spin_unlock_irqrestore(&dev->cl_list_lock, flags); in ishtp_cl_is_other_connecting()
353 struct ishtp_device *dev; in ishtp_cl_connect() local
356 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_connect()
359 dev = cl->dev; in ishtp_cl_connect()
361 dev->print_log(dev, "%s() current_state = %d\n", __func__, cl->state); in ishtp_cl_connect()
364 dev->print_log(dev, "%s() Busy\n", __func__); in ishtp_cl_connect()
368 if (ishtp_hbm_cl_connect_req(dev, cl)) { in ishtp_cl_connect()
369 dev->print_log(dev, "%s() HBM connect req fail\n", __func__); in ishtp_cl_connect()
374 (dev->dev_state == ISHTP_DEV_ENABLED && in ishtp_cl_connect()
383 if (dev->dev_state != ISHTP_DEV_ENABLED) { in ishtp_cl_connect()
384 dev->print_log(dev, "%s() dev_state != ISHTP_DEV_ENABLED\n", in ishtp_cl_connect()
390 dev->print_log(dev, "%s() state != ISHTP_CL_CONNECTED\n", in ishtp_cl_connect()
397 dev->print_log(dev, "%s() Invalid status\n", __func__); in ishtp_cl_connect()
403 dev->print_log(dev, "%s() Bind error\n", __func__); in ishtp_cl_connect()
410 dev->print_log(dev, "%s() Alloc RX ring failed\n", __func__); in ishtp_cl_connect()
418 dev->print_log(dev, "%s() Alloc TX ring failed\n", __func__); in ishtp_cl_connect()
428 dev->print_log(dev, "%s() successful\n", __func__); in ishtp_cl_connect()
446 struct ishtp_device *dev; in ishtp_cl_read_start() local
453 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_read_start()
456 dev = cl->dev; in ishtp_cl_read_start()
461 if (dev->dev_state != ISHTP_DEV_ENABLED) in ishtp_cl_read_start()
464 i = ishtp_fw_cl_by_id(dev, cl->fw_client_id); in ishtp_cl_read_start()
466 dev_err(&cl->device->dev, "no such fw client %d\n", in ishtp_cl_read_start()
474 dev_warn(&cl->device->dev, in ishtp_cl_read_start()
495 spin_lock_irqsave(&dev->read_list_spinlock, dev_flags); in ishtp_cl_read_start()
496 list_add_tail(&rb->list, &dev->read_list.list); in ishtp_cl_read_start()
497 spin_unlock_irqrestore(&dev->read_list_spinlock, dev_flags); in ishtp_cl_read_start()
498 if (ishtp_hbm_cl_flow_control_req(dev, cl)) { in ishtp_cl_read_start()
505 spin_lock_irqsave(&dev->read_list_spinlock, dev_flags); in ishtp_cl_read_start()
507 spin_unlock_irqrestore(&dev->read_list_spinlock, dev_flags); in ishtp_cl_read_start()
530 struct ishtp_device *dev; in ishtp_cl_send() local
536 if (WARN_ON(!cl || !cl->dev)) in ishtp_cl_send()
539 dev = cl->dev; in ishtp_cl_send()
546 if (dev->dev_state != ISHTP_DEV_ENABLED) { in ishtp_cl_send()
552 id = ishtp_fw_cl_by_id(dev, cl->fw_client_id); in ishtp_cl_send()
558 if (length > dev->fw_clients[id].props.max_msg_length) { in ishtp_cl_send()
596 ishtp_cl_send_msg(dev, cl); in ishtp_cl_send()
641 struct ishtp_device *dev = (cl ? cl->dev : NULL); in ipc_tx_send() local
646 if (!dev) in ipc_tx_send()
653 if (dev->dev_state != ISHTP_DEV_ENABLED) in ipc_tx_send()
687 if (rem <= dev->mtu) { in ipc_tx_send()
692 ishtp_write_message(dev, &ishtp_hdr, pmsg); in ipc_tx_send()
699 ishtp_hdr.length = dev->mtu; in ipc_tx_send()
702 ishtp_write_message(dev, &ishtp_hdr, pmsg); in ipc_tx_send()
703 cl->tx_offs += dev->mtu; in ipc_tx_send()
725 static void ishtp_cl_send_msg_ipc(struct ishtp_device *dev, in ishtp_cl_send_msg_ipc() argument
744 static void ishtp_cl_send_msg_dma(struct ishtp_device *dev, in ishtp_cl_send_msg_dma() argument
767 msg_addr = ishtp_cl_get_dma_send_buf(dev, cl_msg->send_buf.size); in ishtp_cl_send_msg_dma()
770 if (dev->transfer_path == CL_TX_PATH_DEFAULT) in ishtp_cl_send_msg_dma()
771 ishtp_cl_send_msg_ipc(dev, cl); in ishtp_cl_send_msg_dma()
790 if (dev->ops->dma_no_cache_snooping && in ishtp_cl_send_msg_dma()
791 dev->ops->dma_no_cache_snooping(dev)) in ishtp_cl_send_msg_dma()
795 off = msg_addr - (unsigned char *)dev->ishtp_host_dma_tx_buf; in ishtp_cl_send_msg_dma()
801 dma_xfer.msg_addr = dev->ishtp_host_dma_tx_buf_phys + off; in ishtp_cl_send_msg_dma()
804 ishtp_write_message(dev, &hdr, (unsigned char *)&dma_xfer); in ishtp_cl_send_msg_dma()
819 void ishtp_cl_send_msg(struct ishtp_device *dev, struct ishtp_cl *cl) in ishtp_cl_send_msg() argument
821 if (dev->transfer_path == CL_TX_PATH_DMA) in ishtp_cl_send_msg()
822 ishtp_cl_send_msg_dma(dev, cl); in ishtp_cl_send_msg()
824 ishtp_cl_send_msg_ipc(dev, cl); in ishtp_cl_send_msg()
835 void recv_ishtp_cl_msg(struct ishtp_device *dev, in recv_ishtp_cl_msg() argument
846 dev_err(dev->devc, "corrupted message header.\n"); in recv_ishtp_cl_msg()
851 dev_err(dev->devc, in recv_ishtp_cl_msg()
856 spin_lock_irqsave(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg()
857 list_for_each_entry(rb, &dev->read_list.list, list) { in recv_ishtp_cl_msg()
866 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg()
867 dev_err(&cl->device->dev, in recv_ishtp_cl_msg()
882 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg()
883 dev_err(&cl->device->dev, in recv_ishtp_cl_msg()
894 dev->ops->ishtp_read(dev, buffer, ishtp_hdr->length); in recv_ishtp_cl_msg()
919 &dev->read_list.list); in recv_ishtp_cl_msg()
921 ishtp_hbm_cl_flow_control_req(dev, cl); in recv_ishtp_cl_msg()
936 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg()
941 dev_err(dev->devc, "Dropped Rx msg - no request\n"); in recv_ishtp_cl_msg()
942 dev->ops->ishtp_read(dev, rd_msg_buf, ishtp_hdr->length); in recv_ishtp_cl_msg()
965 void recv_ishtp_cl_msg_dma(struct ishtp_device *dev, void *msg, in recv_ishtp_cl_msg_dma() argument
975 spin_lock_irqsave(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg_dma()
977 list_for_each_entry(rb, &dev->read_list.list, list) { in recv_ishtp_cl_msg_dma()
988 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg_dma()
989 dev_err(&cl->device->dev, in recv_ishtp_cl_msg_dma()
1004 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg_dma()
1005 dev_err(&cl->device->dev, in recv_ishtp_cl_msg_dma()
1020 if (dev->ops->dma_no_cache_snooping && in recv_ishtp_cl_msg_dma()
1021 dev->ops->dma_no_cache_snooping(dev)) in recv_ishtp_cl_msg_dma()
1048 &dev->read_list.list); in recv_ishtp_cl_msg_dma()
1050 ishtp_hbm_cl_flow_control_req(dev, cl); in recv_ishtp_cl_msg_dma()
1065 spin_unlock_irqrestore(&dev->read_list_spinlock, flags); in recv_ishtp_cl_msg_dma()
1068 dev_err(dev->devc, "Dropped Rx (DMA) msg - no request\n"); in recv_ishtp_cl_msg_dma()
1096 return cl->dev; in ishtp_get_ishtp_device()