Lines Matching refs:wrappers
252 struct wrapper_list *wrappers = msg; in gen_crc() local
256 list_for_each_entry(w, &wrappers->list, list) in gen_crc()
341 static struct wrapper_msg *add_wrapper(struct wrapper_list *wrappers, u32 size) in add_wrapper() argument
347 list_add_tail(&w->list, &wrappers->list); in add_wrapper()
349 w->head = wrappers; in add_wrapper()
353 static int encode_passthrough(struct qaic_device *qdev, void *trans, struct wrapper_list *wrappers, in encode_passthrough() argument
363 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in encode_passthrough()
373 trans_wrapper = add_wrapper(wrappers, in encode_passthrough()
480 static int encode_addr_size_pairs(struct dma_xfer *xfer, struct wrapper_list *wrappers, in encode_addr_size_pairs() argument
508 trans_wrapper = add_wrapper(wrappers, QAIC_WRAPPER_MAX_SIZE); in encode_addr_size_pairs()
528 w = add_wrapper(wrappers, QAIC_WRAPPER_MAX_SIZE); in encode_addr_size_pairs()
560 static int encode_dma(struct qaic_device *qdev, void *trans, struct wrapper_list *wrappers, in encode_dma() argument
573 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in encode_dma()
592 ret = encode_addr_size_pairs(xfer, wrappers, resources, msg_hdr_len, &size, &out_trans); in encode_dma()
629 static int encode_activate(struct qaic_device *qdev, void *trans, struct wrapper_list *wrappers, in encode_activate() argument
644 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in encode_activate()
671 trans_wrapper = add_wrapper(wrappers, in encode_activate()
718 static int encode_status(struct qaic_device *qdev, void *trans, struct wrapper_list *wrappers, in encode_status() argument
728 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in encode_status()
735 trans_wrapper = add_wrapper(wrappers, sizeof(*trans_wrapper)); in encode_status()
752 struct wrapper_list *wrappers, struct ioctl_resources *resources, in encode_message() argument
768 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in encode_message()
774 ret = encode_dma(qdev, resources->trans_hdr, wrappers, &user_len, resources, usr); in encode_message()
793 ret = encode_passthrough(qdev, trans_hdr, wrappers, &user_len); in encode_message()
796 ret = encode_dma(qdev, trans_hdr, wrappers, &user_len, resources, usr); in encode_message()
799 ret = encode_activate(qdev, trans_hdr, wrappers, &user_len, resources); in encode_message()
805 ret = encode_status(qdev, trans_hdr, wrappers, &user_len); in encode_message()
1015 static void *msg_xfer(struct qaic_device *qdev, struct wrapper_list *wrappers, u32 seq_num, in msg_xfer() argument
1032 list_for_each_entry(w, &wrappers->list, list) in msg_xfer()
1080 list_for_each_entry(w, &wrappers->list, list) { in msg_xfer()
1084 list_is_last(&w->list, &wrappers->list) ? MHI_EOT : MHI_CHAIN); in msg_xfer()
1126 static int abort_dma_cont(struct qaic_device *qdev, struct wrapper_list *wrappers, u32 dma_chunk_id) in abort_dma_cont() argument
1134 wrapper = list_first_entry(&wrappers->list, struct wrapper_msg, list); in abort_dma_cont()
1138 list_for_each_entry_safe(wrapper, w, &wrappers->list, list) in abort_dma_cont()
1139 if (!list_is_first(&wrapper->list, &wrappers->list)) in abort_dma_cont()
1142 wrapper = add_wrapper(wrappers, sizeof(*wrapper)); in abort_dma_cont()
1163 struct wrapper_list *wrappers; in alloc_wrapper_list() local
1165 wrappers = kmalloc(sizeof(*wrappers), GFP_KERNEL); in alloc_wrapper_list()
1166 if (!wrappers) in alloc_wrapper_list()
1168 INIT_LIST_HEAD(&wrappers->list); in alloc_wrapper_list()
1169 spin_lock_init(&wrappers->lock); in alloc_wrapper_list()
1171 return wrappers; in alloc_wrapper_list()
1178 struct wrapper_list *wrappers; in qaic_manage_msg_xfer() local
1185 wrappers = alloc_wrapper_list(); in qaic_manage_msg_xfer()
1186 if (!wrappers) in qaic_manage_msg_xfer()
1189 wrapper = add_wrapper(wrappers, sizeof(*wrapper)); in qaic_manage_msg_xfer()
1191 kfree(wrappers); in qaic_manage_msg_xfer()
1198 ret = encode_message(qdev, user_msg, wrappers, resources, usr); in qaic_manage_msg_xfer()
1200 ret = abort_dma_cont(qdev, wrappers, resources->dma_chunk_id); in qaic_manage_msg_xfer()
1220 msg->hdr.crc32 = cpu_to_le32(qdev->gen_crc(wrappers)); in qaic_manage_msg_xfer()
1223 *rsp = msg_xfer(qdev, wrappers, qdev->next_seq_num - 1, false); in qaic_manage_msg_xfer()
1230 spin_lock(&wrappers->lock); in qaic_manage_msg_xfer()
1231 list_for_each_entry_safe(wrapper, w, &wrappers->list, list) in qaic_manage_msg_xfer()
1233 all_done = list_empty(&wrappers->list); in qaic_manage_msg_xfer()
1234 spin_unlock(&wrappers->lock); in qaic_manage_msg_xfer()
1236 kfree(wrappers); in qaic_manage_msg_xfer()
1425 static void free_wrapper_from_list(struct wrapper_list *wrappers, struct wrapper_msg *wrapper) in free_wrapper_from_list() argument
1429 spin_lock(&wrappers->lock); in free_wrapper_from_list()
1431 all_done = list_empty(&wrappers->list); in free_wrapper_from_list()
1432 spin_unlock(&wrappers->lock); in free_wrapper_from_list()
1435 kfree(wrappers); in free_wrapper_from_list()
1501 struct wrapper_list *wrappers; in qaic_release_usr() local
1506 wrappers = alloc_wrapper_list(); in qaic_release_usr()
1507 if (!wrappers) in qaic_release_usr()
1510 wrapper = add_wrapper(wrappers, sizeof(*wrapper) + sizeof(*msg) + sizeof(*trans)); in qaic_release_usr()
1530 msg->hdr.crc32 = cpu_to_le32(qdev->gen_crc(wrappers)); in qaic_release_usr()
1540 rsp = msg_xfer(qdev, wrappers, qdev->next_seq_num - 1, true); in qaic_release_usr()
1543 free_wrapper_from_list(wrappers, wrapper); in qaic_release_usr()