Lines Matching full:async
8 * Support for fully async operation and multiple outstanding transactions
65 * Pending async transaction.
102 static void uhci_async_cancel(UHCIAsync *async);
137 UHCIAsync *async; in uhci_queue_free() local
140 async = QTAILQ_FIRST(&queue->asyncs); in uhci_queue_free()
141 uhci_async_cancel(async); in uhci_queue_free()
178 UHCIAsync *async = g_new0(UHCIAsync, 1); in uhci_async_alloc() local
180 async->queue = queue; in uhci_async_alloc()
181 async->td_addr = td_addr; in uhci_async_alloc()
182 usb_packet_init(&async->packet); in uhci_async_alloc()
183 trace_usb_uhci_packet_add(async->queue->token, async->td_addr); in uhci_async_alloc()
185 return async; in uhci_async_alloc()
188 static void uhci_async_free(UHCIAsync *async) in uhci_async_free() argument
190 trace_usb_uhci_packet_del(async->queue->token, async->td_addr); in uhci_async_free()
191 usb_packet_cleanup(&async->packet); in uhci_async_free()
192 if (async->buf != async->static_buf) { in uhci_async_free()
193 g_free(async->buf); in uhci_async_free()
195 g_free(async); in uhci_async_free()
198 static void uhci_async_link(UHCIAsync *async) in uhci_async_link() argument
200 UHCIQueue *queue = async->queue; in uhci_async_link()
201 QTAILQ_INSERT_TAIL(&queue->asyncs, async, next); in uhci_async_link()
202 trace_usb_uhci_packet_link_async(async->queue->token, async->td_addr); in uhci_async_link()
205 static void uhci_async_unlink(UHCIAsync *async) in uhci_async_unlink() argument
207 UHCIQueue *queue = async->queue; in uhci_async_unlink()
208 QTAILQ_REMOVE(&queue->asyncs, async, next); in uhci_async_unlink()
209 trace_usb_uhci_packet_unlink_async(async->queue->token, async->td_addr); in uhci_async_unlink()
212 static void uhci_async_cancel(UHCIAsync *async) in uhci_async_cancel() argument
214 uhci_async_unlink(async); in uhci_async_cancel()
215 trace_usb_uhci_packet_cancel(async->queue->token, async->td_addr, in uhci_async_cancel()
216 async->done); in uhci_async_cancel()
217 if (!async->done) { in uhci_async_cancel()
218 usb_cancel_packet(&async->packet); in uhci_async_cancel()
220 uhci_async_free(async); in uhci_async_cancel()
224 * Mark all outstanding async packets as invalid.
237 * Cancel async packets that are no longer valid
273 UHCIAsync *async; in uhci_async_find_td() local
276 QTAILQ_FOREACH(async, &queue->asyncs, next) { in uhci_async_find_td()
277 if (async->td_addr == td_addr) { in uhci_async_find_td()
278 return async; in uhci_async_find_td()
686 static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, in uhci_complete_td() argument
699 if (async->packet.status != USB_RET_SUCCESS) { in uhci_complete_td()
700 return uhci_handle_td_error(s, td, async->td_addr, in uhci_complete_td()
701 async->packet.status, int_mask); in uhci_complete_td()
704 len = async->packet.actual_length; in uhci_complete_td()
718 uhci_dma_write(s, td->buffer, async->buf, len); in uhci_complete_td()
722 trace_usb_uhci_packet_complete_shortxfer(async->queue->token, in uhci_complete_td()
723 async->td_addr); in uhci_complete_td()
729 trace_usb_uhci_packet_complete_success(async->queue->token, in uhci_complete_td()
730 async->td_addr); in uhci_complete_td()
741 UHCIAsync *async; in uhci_handle_td() local
743 async = uhci_async_find_td(s, td_addr); in uhci_handle_td()
744 if (async) { in uhci_handle_td()
745 if (uhci_queue_verify(async->queue, qh_addr, td, td_addr, queuing)) { in uhci_handle_td()
746 assert(q == NULL || q == async->queue); in uhci_handle_td()
747 q = async->queue; in uhci_handle_td()
749 uhci_queue_free(async->queue, "guest re-used pending td"); in uhci_handle_td()
750 async = NULL; in uhci_handle_td()
768 if (async) { in uhci_handle_td()
770 uhci_queue_free(async->queue, "pending td non-active"); in uhci_handle_td()
795 if (async) { in uhci_handle_td()
800 * in async state in uhci_handle_td()
804 if (!async->done) { in uhci_handle_td()
806 UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs); in uhci_handle_td()
813 uhci_queue_fill(async->queue, &last_td); in uhci_handle_td()
817 uhci_async_unlink(async); in uhci_handle_td()
838 async = uhci_async_alloc(q, td_addr); in uhci_handle_td()
842 usb_packet_setup(&async->packet, pid, q->ep, 0, td_addr, spd, in uhci_handle_td()
844 if (max_len <= sizeof(async->static_buf)) { in uhci_handle_td()
845 async->buf = async->static_buf; in uhci_handle_td()
847 async->buf = g_malloc(max_len); in uhci_handle_td()
849 usb_packet_addbuf(&async->packet, async->buf, max_len); in uhci_handle_td()
854 uhci_dma_read(s, td->buffer, async->buf, max_len); in uhci_handle_td()
855 usb_handle_packet(q->ep->dev, &async->packet); in uhci_handle_td()
856 if (async->packet.status == USB_RET_SUCCESS) { in uhci_handle_td()
857 async->packet.actual_length = max_len; in uhci_handle_td()
862 usb_handle_packet(q->ep->dev, &async->packet); in uhci_handle_td()
869 if (async->packet.status == USB_RET_ASYNC) { in uhci_handle_td()
870 uhci_async_link(async); in uhci_handle_td()
878 ret = uhci_complete_td(s, td, async, int_mask); in uhci_handle_td()
879 uhci_async_free(async); in uhci_handle_td()
885 UHCIAsync *async = container_of(packet, UHCIAsync, packet); in uhci_async_complete() local
886 UHCIState *s = async->queue->uhci; in uhci_async_complete()
889 uhci_async_cancel(async); in uhci_async_complete()
893 async->done = 1; in uhci_async_complete()