Lines Matching refs:async
108 static void uhci_async_cancel(UHCIAsync *async);
143 UHCIAsync *async; in uhci_queue_free() local
146 async = QTAILQ_FIRST(&queue->asyncs); in uhci_queue_free()
147 uhci_async_cancel(async); in uhci_queue_free()
184 UHCIAsync *async = g_new0(UHCIAsync, 1); in uhci_async_alloc() local
186 async->queue = queue; in uhci_async_alloc()
187 async->td_addr = td_addr; in uhci_async_alloc()
188 usb_packet_init(&async->packet); in uhci_async_alloc()
189 trace_usb_uhci_packet_add(async->queue->token, async->td_addr); in uhci_async_alloc()
191 return async; in uhci_async_alloc()
194 static void uhci_async_free(UHCIAsync *async) in uhci_async_free() argument
196 trace_usb_uhci_packet_del(async->queue->token, async->td_addr); in uhci_async_free()
197 usb_packet_cleanup(&async->packet); in uhci_async_free()
198 if (async->buf != async->static_buf) { in uhci_async_free()
199 g_free(async->buf); in uhci_async_free()
201 g_free(async); in uhci_async_free()
204 static void uhci_async_link(UHCIAsync *async) in uhci_async_link() argument
206 UHCIQueue *queue = async->queue; in uhci_async_link()
207 QTAILQ_INSERT_TAIL(&queue->asyncs, async, next); in uhci_async_link()
208 trace_usb_uhci_packet_link_async(async->queue->token, async->td_addr); in uhci_async_link()
211 static void uhci_async_unlink(UHCIAsync *async) in uhci_async_unlink() argument
213 UHCIQueue *queue = async->queue; in uhci_async_unlink()
214 QTAILQ_REMOVE(&queue->asyncs, async, next); in uhci_async_unlink()
215 trace_usb_uhci_packet_unlink_async(async->queue->token, async->td_addr); in uhci_async_unlink()
218 static void uhci_async_cancel(UHCIAsync *async) in uhci_async_cancel() argument
220 uhci_async_unlink(async); in uhci_async_cancel()
221 trace_usb_uhci_packet_cancel(async->queue->token, async->td_addr, in uhci_async_cancel()
222 async->done); in uhci_async_cancel()
223 if (!async->done) in uhci_async_cancel()
224 usb_cancel_packet(&async->packet); in uhci_async_cancel()
225 uhci_async_free(async); in uhci_async_cancel()
278 UHCIAsync *async; in uhci_async_find_td() local
281 QTAILQ_FOREACH(async, &queue->asyncs, next) { in uhci_async_find_td()
282 if (async->td_addr == td_addr) { in uhci_async_find_td()
283 return async; in uhci_async_find_td()
677 static int uhci_complete_td(UHCIState *s, UHCI_TD *td, UHCIAsync *async, uint32_t *int_mask) in uhci_complete_td() argument
688 if (async->packet.status != USB_RET_SUCCESS) { in uhci_complete_td()
689 return uhci_handle_td_error(s, td, async->td_addr, in uhci_complete_td()
690 async->packet.status, int_mask); in uhci_complete_td()
693 len = async->packet.actual_length; in uhci_complete_td()
704 pci_dma_write(&s->dev, td->buffer, async->buf, len); in uhci_complete_td()
708 trace_usb_uhci_packet_complete_shortxfer(async->queue->token, in uhci_complete_td()
709 async->td_addr); in uhci_complete_td()
715 trace_usb_uhci_packet_complete_success(async->queue->token, in uhci_complete_td()
716 async->td_addr); in uhci_complete_td()
727 UHCIAsync *async; in uhci_handle_td() local
729 async = uhci_async_find_td(s, td_addr); in uhci_handle_td()
730 if (async) { in uhci_handle_td()
731 if (uhci_queue_verify(async->queue, qh_addr, td, td_addr, queuing)) { in uhci_handle_td()
732 assert(q == NULL || q == async->queue); in uhci_handle_td()
733 q = async->queue; in uhci_handle_td()
735 uhci_queue_free(async->queue, "guest re-used pending td"); in uhci_handle_td()
736 async = NULL; in uhci_handle_td()
754 if (async) { in uhci_handle_td()
756 uhci_queue_free(async->queue, "pending td non-active"); in uhci_handle_td()
781 if (async) { in uhci_handle_td()
788 if (!async->done) { in uhci_handle_td()
790 UHCIAsync *last = QTAILQ_LAST(&async->queue->asyncs); in uhci_handle_td()
797 uhci_queue_fill(async->queue, &last_td); in uhci_handle_td()
801 uhci_async_unlink(async); in uhci_handle_td()
822 async = uhci_async_alloc(q, td_addr); in uhci_handle_td()
826 usb_packet_setup(&async->packet, pid, q->ep, 0, td_addr, spd, in uhci_handle_td()
828 if (max_len <= sizeof(async->static_buf)) { in uhci_handle_td()
829 async->buf = async->static_buf; in uhci_handle_td()
831 async->buf = g_malloc(max_len); in uhci_handle_td()
833 usb_packet_addbuf(&async->packet, async->buf, max_len); in uhci_handle_td()
838 pci_dma_read(&s->dev, td->buffer, async->buf, max_len); in uhci_handle_td()
839 usb_handle_packet(q->ep->dev, &async->packet); in uhci_handle_td()
840 if (async->packet.status == USB_RET_SUCCESS) { in uhci_handle_td()
841 async->packet.actual_length = max_len; in uhci_handle_td()
846 usb_handle_packet(q->ep->dev, &async->packet); in uhci_handle_td()
853 if (async->packet.status == USB_RET_ASYNC) { in uhci_handle_td()
854 uhci_async_link(async); in uhci_handle_td()
862 ret = uhci_complete_td(s, td, async, int_mask); in uhci_handle_td()
863 uhci_async_free(async); in uhci_handle_td()
869 UHCIAsync *async = container_of(packet, UHCIAsync, packet); in uhci_async_complete() local
870 UHCIState *s = async->queue->uhci; in uhci_async_complete()
873 uhci_async_cancel(async); in uhci_async_complete()
877 async->done = 1; in uhci_async_complete()