Lines Matching refs:info
105 static inline struct usb_hcd *xenhcd_info_to_hcd(struct xenhcd_info *info) in xenhcd_info_to_hcd() argument
107 return container_of((void *)info, struct usb_hcd, hcd_priv); in xenhcd_info_to_hcd()
110 static void xenhcd_set_error(struct xenhcd_info *info, const char *msg) in xenhcd_set_error() argument
112 info->error = true; in xenhcd_set_error()
117 static inline void xenhcd_timer_action_done(struct xenhcd_info *info, in xenhcd_timer_action_done() argument
120 clear_bit(action, &info->actions); in xenhcd_timer_action_done()
123 static void xenhcd_timer_action(struct xenhcd_info *info, in xenhcd_timer_action() argument
126 if (timer_pending(&info->watchdog) && in xenhcd_timer_action()
127 test_bit(TIMER_SCAN_PENDING_URBS, &info->actions)) in xenhcd_timer_action()
130 if (!test_and_set_bit(action, &info->actions)) { in xenhcd_timer_action()
141 mod_timer(&info->watchdog, t + jiffies); in xenhcd_timer_action()
148 static void xenhcd_set_connect_state(struct xenhcd_info *info, int portnum) in xenhcd_set_connect_state() argument
153 if (info->ports[port].status & USB_PORT_STAT_POWER) { in xenhcd_set_connect_state()
154 switch (info->devices[port].speed) { in xenhcd_set_connect_state()
156 info->ports[port].status &= in xenhcd_set_connect_state()
164 info->ports[port].status |= USB_PORT_STAT_CONNECTION; in xenhcd_set_connect_state()
165 info->ports[port].status |= USB_PORT_STAT_LOW_SPEED; in xenhcd_set_connect_state()
168 info->ports[port].status |= USB_PORT_STAT_CONNECTION; in xenhcd_set_connect_state()
171 info->ports[port].status |= USB_PORT_STAT_CONNECTION; in xenhcd_set_connect_state()
172 info->ports[port].status |= USB_PORT_STAT_HIGH_SPEED; in xenhcd_set_connect_state()
177 info->ports[port].status |= (USB_PORT_STAT_C_CONNECTION << 16); in xenhcd_set_connect_state()
184 static int xenhcd_rhport_connect(struct xenhcd_info *info, __u8 portnum, in xenhcd_rhport_connect() argument
189 if (portnum < 1 || portnum > info->rh_numports) in xenhcd_rhport_connect()
193 if (info->devices[port].speed != speed) { in xenhcd_rhport_connect()
196 info->devices[port].status = USB_STATE_NOTATTACHED; in xenhcd_rhport_connect()
201 info->devices[port].status = USB_STATE_ATTACHED; in xenhcd_rhport_connect()
206 info->devices[port].speed = speed; in xenhcd_rhport_connect()
207 info->ports[port].c_connection = true; in xenhcd_rhport_connect()
209 xenhcd_set_connect_state(info, portnum); in xenhcd_rhport_connect()
218 static void xenhcd_rhport_suspend(struct xenhcd_info *info, int portnum) in xenhcd_rhport_suspend() argument
223 info->ports[port].status |= USB_PORT_STAT_SUSPEND; in xenhcd_rhport_suspend()
224 info->devices[port].status = USB_STATE_SUSPENDED; in xenhcd_rhport_suspend()
230 static void xenhcd_rhport_resume(struct xenhcd_info *info, int portnum) in xenhcd_rhport_resume() argument
235 if (info->ports[port].status & USB_PORT_STAT_SUSPEND) { in xenhcd_rhport_resume()
236 info->ports[port].resuming = true; in xenhcd_rhport_resume()
237 info->ports[port].timeout = jiffies + msecs_to_jiffies(20); in xenhcd_rhport_resume()
244 static void xenhcd_rhport_power_on(struct xenhcd_info *info, int portnum) in xenhcd_rhport_power_on() argument
249 if ((info->ports[port].status & USB_PORT_STAT_POWER) == 0) { in xenhcd_rhport_power_on()
250 info->ports[port].status |= USB_PORT_STAT_POWER; in xenhcd_rhport_power_on()
251 if (info->devices[port].status != USB_STATE_NOTATTACHED) in xenhcd_rhport_power_on()
252 info->devices[port].status = USB_STATE_POWERED; in xenhcd_rhport_power_on()
253 if (info->ports[port].c_connection) in xenhcd_rhport_power_on()
254 xenhcd_set_connect_state(info, portnum); in xenhcd_rhport_power_on()
264 static void xenhcd_rhport_power_off(struct xenhcd_info *info, int portnum) in xenhcd_rhport_power_off() argument
269 if (info->ports[port].status & USB_PORT_STAT_POWER) { in xenhcd_rhport_power_off()
270 info->ports[port].status = 0; in xenhcd_rhport_power_off()
271 if (info->devices[port].status != USB_STATE_NOTATTACHED) in xenhcd_rhport_power_off()
272 info->devices[port].status = USB_STATE_ATTACHED; in xenhcd_rhport_power_off()
279 static void xenhcd_rhport_disable(struct xenhcd_info *info, int portnum) in xenhcd_rhport_disable() argument
284 info->ports[port].status &= ~USB_PORT_STAT_ENABLE; in xenhcd_rhport_disable()
285 info->ports[port].status &= ~USB_PORT_STAT_SUSPEND; in xenhcd_rhport_disable()
286 info->ports[port].resuming = false; in xenhcd_rhport_disable()
287 if (info->devices[port].status != USB_STATE_NOTATTACHED) in xenhcd_rhport_disable()
288 info->devices[port].status = USB_STATE_POWERED; in xenhcd_rhport_disable()
294 static void xenhcd_rhport_reset(struct xenhcd_info *info, int portnum) in xenhcd_rhport_reset() argument
299 info->ports[port].status &= ~(USB_PORT_STAT_ENABLE | in xenhcd_rhport_reset()
302 info->ports[port].status |= USB_PORT_STAT_RESET; in xenhcd_rhport_reset()
304 if (info->devices[port].status != USB_STATE_NOTATTACHED) in xenhcd_rhport_reset()
305 info->devices[port].status = USB_STATE_ATTACHED; in xenhcd_rhport_reset()
308 info->ports[port].timeout = jiffies + msecs_to_jiffies(10); in xenhcd_rhport_reset()
314 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_bus_suspend() local
318 ports = info->rh_numports; in xenhcd_bus_suspend()
320 spin_lock_irq(&info->lock); in xenhcd_bus_suspend()
326 xenhcd_rhport_suspend(info, i); in xenhcd_bus_suspend()
328 spin_unlock_irq(&info->lock); in xenhcd_bus_suspend()
330 del_timer_sync(&info->watchdog); in xenhcd_bus_suspend()
337 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_bus_resume() local
341 ports = info->rh_numports; in xenhcd_bus_resume()
343 spin_lock_irq(&info->lock); in xenhcd_bus_resume()
349 xenhcd_rhport_resume(info, i); in xenhcd_bus_resume()
351 spin_unlock_irq(&info->lock); in xenhcd_bus_resume()
357 static void xenhcd_hub_descriptor(struct xenhcd_info *info, in xenhcd_hub_descriptor() argument
361 int ports = info->rh_numports; in xenhcd_hub_descriptor()
396 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_hub_status_data() local
404 ports = info->rh_numports; in xenhcd_hub_status_data()
408 spin_lock_irqsave(&info->lock, flags); in xenhcd_hub_status_data()
412 if (info->ports[i].status & PORT_C_MASK) { in xenhcd_hub_status_data()
421 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_hub_status_data()
429 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_hub_control() local
430 int ports = info->rh_numports; in xenhcd_hub_control()
436 spin_lock_irqsave(&info->lock, flags); in xenhcd_hub_control()
447 xenhcd_rhport_resume(info, wIndex); in xenhcd_hub_control()
450 xenhcd_rhport_power_off(info, wIndex); in xenhcd_hub_control()
453 xenhcd_rhport_disable(info, wIndex); in xenhcd_hub_control()
456 info->ports[wIndex - 1].c_connection = false; in xenhcd_hub_control()
459 info->ports[wIndex - 1].status &= ~(1 << wValue); in xenhcd_hub_control()
464 xenhcd_hub_descriptor(info, (struct usb_hub_descriptor *)buf); in xenhcd_hub_control()
477 if (info->ports[wIndex].resuming && in xenhcd_hub_control()
478 time_after_eq(jiffies, info->ports[wIndex].timeout)) { in xenhcd_hub_control()
479 info->ports[wIndex].status |= in xenhcd_hub_control()
481 info->ports[wIndex].status &= ~USB_PORT_STAT_SUSPEND; in xenhcd_hub_control()
485 if ((info->ports[wIndex].status & USB_PORT_STAT_RESET) != 0 && in xenhcd_hub_control()
486 time_after_eq(jiffies, info->ports[wIndex].timeout)) { in xenhcd_hub_control()
487 info->ports[wIndex].status |= in xenhcd_hub_control()
489 info->ports[wIndex].status &= ~USB_PORT_STAT_RESET; in xenhcd_hub_control()
491 if (info->devices[wIndex].status != in xenhcd_hub_control()
493 info->ports[wIndex].status |= in xenhcd_hub_control()
495 info->devices[wIndex].status = in xenhcd_hub_control()
499 switch (info->devices[wIndex].speed) { in xenhcd_hub_control()
501 info->ports[wIndex].status |= in xenhcd_hub_control()
505 info->ports[wIndex].status |= in xenhcd_hub_control()
513 *(__le32 *)buf = cpu_to_le32(info->ports[wIndex].status); in xenhcd_hub_control()
521 xenhcd_rhport_power_on(info, wIndex); in xenhcd_hub_control()
524 xenhcd_rhport_reset(info, wIndex); in xenhcd_hub_control()
527 xenhcd_rhport_suspend(info, wIndex); in xenhcd_hub_control()
530 if (info->ports[wIndex-1].status & USB_PORT_STAT_POWER) in xenhcd_hub_control()
531 info->ports[wIndex-1].status |= (1 << wValue); in xenhcd_hub_control()
541 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_hub_control()
545 if (info->ports[i].status & PORT_C_MASK) in xenhcd_hub_control()
560 static inline unsigned int xenhcd_get_id_from_freelist(struct xenhcd_info *info) in xenhcd_get_id_from_freelist() argument
564 free = info->shadow_free; in xenhcd_get_id_from_freelist()
565 info->shadow_free = info->shadow[free].req.id; in xenhcd_get_id_from_freelist()
566 info->shadow[free].req.id = 0x0fff; /* debug */ in xenhcd_get_id_from_freelist()
570 static inline void xenhcd_add_id_to_freelist(struct xenhcd_info *info, in xenhcd_add_id_to_freelist() argument
573 info->shadow[id].req.id = info->shadow_free; in xenhcd_add_id_to_freelist()
574 info->shadow[id].urb = NULL; in xenhcd_add_id_to_freelist()
575 info->shadow_free = id; in xenhcd_add_id_to_freelist()
585 static void xenhcd_gnttab_map(struct xenhcd_info *info, void *addr, int length, in xenhcd_gnttab_map() argument
604 gnttab_grant_foreign_access_ref(ref, info->xbdev->otherend_id, in xenhcd_gnttab_map()
642 static int xenhcd_map_urb_for_request(struct xenhcd_info *info, struct urb *urb, in xenhcd_map_urb_for_request() argument
671 xenhcd_gnttab_map(info, urb->transfer_buffer, in xenhcd_map_urb_for_request()
691 xenhcd_gnttab_map(info, &urb->iso_frame_desc[0], in xenhcd_map_urb_for_request()
716 static void xenhcd_gnttab_done(struct xenhcd_info *info, unsigned int id) in xenhcd_gnttab_done() argument
718 struct usb_shadow *shadow = info->shadow + id; in xenhcd_gnttab_done()
723 xenhcd_set_error(info, "Illegal request id"); in xenhcd_gnttab_done()
735 xenhcd_set_error(info, "backend didn't release grant"); in xenhcd_gnttab_done()
762 static void xenhcd_giveback_urb(struct xenhcd_info *info, struct urb *urb, in xenhcd_giveback_urb() argument
774 spin_unlock(&info->lock); in xenhcd_giveback_urb()
775 usb_hcd_giveback_urb(xenhcd_info_to_hcd(info), urb, in xenhcd_giveback_urb()
777 spin_lock(&info->lock); in xenhcd_giveback_urb()
780 static int xenhcd_do_request(struct xenhcd_info *info, struct urb_priv *urbp) in xenhcd_do_request() argument
788 id = xenhcd_get_id_from_freelist(info); in xenhcd_do_request()
789 req = &info->shadow[id].req; in xenhcd_do_request()
798 ret = xenhcd_map_urb_for_request(info, urb, req); in xenhcd_do_request()
800 xenhcd_add_id_to_freelist(info, id); in xenhcd_do_request()
806 req = RING_GET_REQUEST(&info->urb_ring, info->urb_ring.req_prod_pvt); in xenhcd_do_request()
807 *req = info->shadow[id].req; in xenhcd_do_request()
809 info->urb_ring.req_prod_pvt++; in xenhcd_do_request()
810 info->shadow[id].urb = urb; in xenhcd_do_request()
811 info->shadow[id].in_flight = true; in xenhcd_do_request()
813 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->urb_ring, notify); in xenhcd_do_request()
815 notify_remote_via_irq(info->irq); in xenhcd_do_request()
820 static void xenhcd_kick_pending_urbs(struct xenhcd_info *info) in xenhcd_kick_pending_urbs() argument
824 while (!list_empty(&info->pending_submit_list)) { in xenhcd_kick_pending_urbs()
825 if (RING_FULL(&info->urb_ring)) { in xenhcd_kick_pending_urbs()
826 xenhcd_timer_action(info, TIMER_RING_WATCHDOG); in xenhcd_kick_pending_urbs()
830 urbp = list_entry(info->pending_submit_list.next, in xenhcd_kick_pending_urbs()
832 if (!xenhcd_do_request(info, urbp)) in xenhcd_kick_pending_urbs()
833 list_move_tail(&urbp->list, &info->in_progress_list); in xenhcd_kick_pending_urbs()
835 xenhcd_giveback_urb(info, urbp->urb, -ESHUTDOWN); in xenhcd_kick_pending_urbs()
837 xenhcd_timer_action_done(info, TIMER_SCAN_PENDING_URBS); in xenhcd_kick_pending_urbs()
843 static void xenhcd_cancel_all_enqueued_urbs(struct xenhcd_info *info) in xenhcd_cancel_all_enqueued_urbs() argument
848 list_for_each_entry_safe(urbp, tmp, &info->in_progress_list, list) { in xenhcd_cancel_all_enqueued_urbs()
851 xenhcd_gnttab_done(info, req_id); in xenhcd_cancel_all_enqueued_urbs()
852 if (info->error) in xenhcd_cancel_all_enqueued_urbs()
856 xenhcd_giveback_urb(info, urbp->urb, in xenhcd_cancel_all_enqueued_urbs()
859 xenhcd_giveback_urb(info, urbp->urb, in xenhcd_cancel_all_enqueued_urbs()
862 info->shadow[req_id].urb = NULL; in xenhcd_cancel_all_enqueued_urbs()
865 list_for_each_entry_safe(urbp, tmp, &info->pending_submit_list, list) in xenhcd_cancel_all_enqueued_urbs()
866 xenhcd_giveback_urb(info, urbp->urb, -ESHUTDOWN); in xenhcd_cancel_all_enqueued_urbs()
872 static void xenhcd_giveback_unlinked_urbs(struct xenhcd_info *info) in xenhcd_giveback_unlinked_urbs() argument
876 list_for_each_entry_safe(urbp, tmp, &info->giveback_waiting_list, list) in xenhcd_giveback_unlinked_urbs()
877 xenhcd_giveback_urb(info, urbp->urb, urbp->urb->status); in xenhcd_giveback_unlinked_urbs()
880 static int xenhcd_submit_urb(struct xenhcd_info *info, struct urb_priv *urbp) in xenhcd_submit_urb() argument
884 if (RING_FULL(&info->urb_ring)) { in xenhcd_submit_urb()
885 list_add_tail(&urbp->list, &info->pending_submit_list); in xenhcd_submit_urb()
886 xenhcd_timer_action(info, TIMER_RING_WATCHDOG); in xenhcd_submit_urb()
890 if (!list_empty(&info->pending_submit_list)) { in xenhcd_submit_urb()
891 list_add_tail(&urbp->list, &info->pending_submit_list); in xenhcd_submit_urb()
892 xenhcd_timer_action(info, TIMER_SCAN_PENDING_URBS); in xenhcd_submit_urb()
896 ret = xenhcd_do_request(info, urbp); in xenhcd_submit_urb()
898 list_add_tail(&urbp->list, &info->in_progress_list); in xenhcd_submit_urb()
903 static int xenhcd_unlink_urb(struct xenhcd_info *info, struct urb_priv *urbp) in xenhcd_unlink_urb() argument
915 list_move_tail(&urbp->list, &info->giveback_waiting_list); in xenhcd_unlink_urb()
916 xenhcd_timer_action(info, TIMER_SCAN_PENDING_URBS); in xenhcd_unlink_urb()
921 if (RING_FULL(&info->urb_ring)) { in xenhcd_unlink_urb()
922 list_move_tail(&urbp->list, &info->pending_unlink_list); in xenhcd_unlink_urb()
923 xenhcd_timer_action(info, TIMER_RING_WATCHDOG); in xenhcd_unlink_urb()
927 if (!list_empty(&info->pending_unlink_list)) { in xenhcd_unlink_urb()
928 list_move_tail(&urbp->list, &info->pending_unlink_list); in xenhcd_unlink_urb()
929 xenhcd_timer_action(info, TIMER_SCAN_PENDING_URBS); in xenhcd_unlink_urb()
933 ret = xenhcd_do_request(info, urbp); in xenhcd_unlink_urb()
935 list_move_tail(&urbp->list, &info->in_progress_list); in xenhcd_unlink_urb()
940 static void xenhcd_res_to_urb(struct xenhcd_info *info, in xenhcd_res_to_urb() argument
954 xenhcd_giveback_urb(info, urb, res->status); in xenhcd_res_to_urb()
957 static int xenhcd_urb_request_done(struct xenhcd_info *info, in xenhcd_urb_request_done() argument
966 spin_lock_irqsave(&info->lock, flags); in xenhcd_urb_request_done()
968 rp = info->urb_ring.sring->rsp_prod; in xenhcd_urb_request_done()
969 if (RING_RESPONSE_PROD_OVERFLOW(&info->urb_ring, rp)) { in xenhcd_urb_request_done()
970 xenhcd_set_error(info, "Illegal index on urb-ring"); in xenhcd_urb_request_done()
975 for (i = info->urb_ring.rsp_cons; i != rp; i++) { in xenhcd_urb_request_done()
976 RING_COPY_RESPONSE(&info->urb_ring, i, &res); in xenhcd_urb_request_done()
979 xenhcd_set_error(info, "Illegal data on urb-ring"); in xenhcd_urb_request_done()
983 if (likely(xenusb_pipesubmit(info->shadow[id].req.pipe))) { in xenhcd_urb_request_done()
984 xenhcd_gnttab_done(info, id); in xenhcd_urb_request_done()
985 if (info->error) in xenhcd_urb_request_done()
987 xenhcd_res_to_urb(info, &res, info->shadow[id].urb); in xenhcd_urb_request_done()
990 xenhcd_add_id_to_freelist(info, id); in xenhcd_urb_request_done()
994 info->urb_ring.rsp_cons = i; in xenhcd_urb_request_done()
996 if (i != info->urb_ring.req_prod_pvt) in xenhcd_urb_request_done()
997 RING_FINAL_CHECK_FOR_RESPONSES(&info->urb_ring, more_to_do); in xenhcd_urb_request_done()
999 info->urb_ring.sring->rsp_event = i + 1; in xenhcd_urb_request_done()
1001 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_urb_request_done()
1006 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_urb_request_done()
1010 static int xenhcd_conn_notify(struct xenhcd_info *info, unsigned int *eoiflag) in xenhcd_conn_notify() argument
1022 spin_lock_irqsave(&info->lock, flags); in xenhcd_conn_notify()
1024 rc = info->conn_ring.rsp_cons; in xenhcd_conn_notify()
1025 rp = info->conn_ring.sring->rsp_prod; in xenhcd_conn_notify()
1026 if (RING_RESPONSE_PROD_OVERFLOW(&info->conn_ring, rp)) { in xenhcd_conn_notify()
1027 xenhcd_set_error(info, "Illegal index on conn-ring"); in xenhcd_conn_notify()
1028 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_conn_notify()
1034 RING_COPY_RESPONSE(&info->conn_ring, rc, &res); in xenhcd_conn_notify()
1038 info->conn_ring.rsp_cons = ++rc; in xenhcd_conn_notify()
1040 if (xenhcd_rhport_connect(info, portnum, speed)) { in xenhcd_conn_notify()
1041 xenhcd_set_error(info, "Illegal data on conn-ring"); in xenhcd_conn_notify()
1042 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_conn_notify()
1046 if (info->ports[portnum - 1].c_connection) in xenhcd_conn_notify()
1051 req = RING_GET_REQUEST(&info->conn_ring, in xenhcd_conn_notify()
1052 info->conn_ring.req_prod_pvt); in xenhcd_conn_notify()
1054 info->conn_ring.req_prod_pvt++; in xenhcd_conn_notify()
1059 if (rc != info->conn_ring.req_prod_pvt) in xenhcd_conn_notify()
1060 RING_FINAL_CHECK_FOR_RESPONSES(&info->conn_ring, more_to_do); in xenhcd_conn_notify()
1062 info->conn_ring.sring->rsp_event = rc + 1; in xenhcd_conn_notify()
1064 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->conn_ring, notify); in xenhcd_conn_notify()
1066 notify_remote_via_irq(info->irq); in xenhcd_conn_notify()
1068 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_conn_notify()
1071 usb_hcd_poll_rh_status(xenhcd_info_to_hcd(info)); in xenhcd_conn_notify()
1078 struct xenhcd_info *info = (struct xenhcd_info *)dev_id; in xenhcd_int() local
1081 if (unlikely(info->error)) { in xenhcd_int()
1086 while (xenhcd_urb_request_done(info, &eoiflag) | in xenhcd_int()
1087 xenhcd_conn_notify(info, &eoiflag)) in xenhcd_int()
1095 static void xenhcd_destroy_rings(struct xenhcd_info *info) in xenhcd_destroy_rings() argument
1097 if (info->irq) in xenhcd_destroy_rings()
1098 unbind_from_irqhandler(info->irq, info); in xenhcd_destroy_rings()
1099 info->irq = 0; in xenhcd_destroy_rings()
1101 xenbus_teardown_ring((void **)&info->urb_ring.sring, 1, in xenhcd_destroy_rings()
1102 &info->urb_ring_ref); in xenhcd_destroy_rings()
1103 xenbus_teardown_ring((void **)&info->conn_ring.sring, 1, in xenhcd_destroy_rings()
1104 &info->conn_ring_ref); in xenhcd_destroy_rings()
1108 struct xenhcd_info *info) in xenhcd_setup_rings() argument
1114 info->conn_ring_ref = INVALID_GRANT_REF; in xenhcd_setup_rings()
1116 (void **)&urb_sring, 1, &info->urb_ring_ref); in xenhcd_setup_rings()
1121 XEN_FRONT_RING_INIT(&info->urb_ring, urb_sring, PAGE_SIZE); in xenhcd_setup_rings()
1124 (void **)&conn_sring, 1, &info->conn_ring_ref); in xenhcd_setup_rings()
1129 XEN_FRONT_RING_INIT(&info->conn_ring, conn_sring, PAGE_SIZE); in xenhcd_setup_rings()
1131 err = xenbus_alloc_evtchn(dev, &info->evtchn); in xenhcd_setup_rings()
1137 err = bind_evtchn_to_irq_lateeoi(info->evtchn); in xenhcd_setup_rings()
1143 info->irq = err; in xenhcd_setup_rings()
1145 err = request_threaded_irq(info->irq, NULL, xenhcd_int, in xenhcd_setup_rings()
1146 IRQF_ONESHOT, "xenhcd", info); in xenhcd_setup_rings()
1155 unbind_from_irqhandler(info->irq, info); in xenhcd_setup_rings()
1157 xenhcd_destroy_rings(info); in xenhcd_setup_rings()
1162 struct xenhcd_info *info) in xenhcd_talk_to_backend() argument
1168 err = xenhcd_setup_rings(dev, info); in xenhcd_talk_to_backend()
1180 info->urb_ring_ref); in xenhcd_talk_to_backend()
1187 info->conn_ring_ref); in xenhcd_talk_to_backend()
1194 info->evtchn); in xenhcd_talk_to_backend()
1215 xenhcd_destroy_rings(info); in xenhcd_talk_to_backend()
1222 struct xenhcd_info *info = dev_get_drvdata(&dev->dev); in xenhcd_connect() local
1229 hcd = xenhcd_info_to_hcd(info); in xenhcd_connect()
1232 err = xenhcd_talk_to_backend(dev, info); in xenhcd_connect()
1238 req = RING_GET_REQUEST(&info->conn_ring, idx); in xenhcd_connect()
1241 info->conn_ring.req_prod_pvt = idx; in xenhcd_connect()
1243 RING_PUSH_REQUESTS_AND_CHECK_NOTIFY(&info->conn_ring, notify); in xenhcd_connect()
1245 notify_remote_via_irq(info->irq); in xenhcd_connect()
1252 struct xenhcd_info *info = dev_get_drvdata(&dev->dev); in xenhcd_disconnect() local
1253 struct usb_hcd *hcd = xenhcd_info_to_hcd(info); in xenhcd_disconnect()
1261 struct xenhcd_info *info = from_timer(info, timer, watchdog); in xenhcd_watchdog() local
1264 spin_lock_irqsave(&info->lock, flags); in xenhcd_watchdog()
1265 if (likely(HC_IS_RUNNING(xenhcd_info_to_hcd(info)->state))) { in xenhcd_watchdog()
1266 xenhcd_timer_action_done(info, TIMER_RING_WATCHDOG); in xenhcd_watchdog()
1267 xenhcd_giveback_unlinked_urbs(info); in xenhcd_watchdog()
1268 xenhcd_kick_pending_urbs(info); in xenhcd_watchdog()
1270 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_watchdog()
1278 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_setup() local
1280 spin_lock_init(&info->lock); in xenhcd_setup()
1281 INIT_LIST_HEAD(&info->pending_submit_list); in xenhcd_setup()
1282 INIT_LIST_HEAD(&info->pending_unlink_list); in xenhcd_setup()
1283 INIT_LIST_HEAD(&info->in_progress_list); in xenhcd_setup()
1284 INIT_LIST_HEAD(&info->giveback_waiting_list); in xenhcd_setup()
1285 timer_setup(&info->watchdog, xenhcd_watchdog, 0); in xenhcd_setup()
1308 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_stop() local
1310 del_timer_sync(&info->watchdog); in xenhcd_stop()
1311 spin_lock_irq(&info->lock); in xenhcd_stop()
1314 xenhcd_cancel_all_enqueued_urbs(info); in xenhcd_stop()
1315 xenhcd_giveback_unlinked_urbs(info); in xenhcd_stop()
1316 spin_unlock_irq(&info->lock); in xenhcd_stop()
1326 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_urb_enqueue() local
1331 if (unlikely(info->error)) in xenhcd_urb_enqueue()
1338 spin_lock_irqsave(&info->lock, flags); in xenhcd_urb_enqueue()
1348 ret = xenhcd_submit_urb(info, urbp); in xenhcd_urb_enqueue()
1353 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_urb_enqueue()
1363 struct xenhcd_info *info = xenhcd_hcd_to_info(hcd); in xenhcd_urb_dequeue() local
1368 spin_lock_irqsave(&info->lock, flags); in xenhcd_urb_dequeue()
1373 ret = xenhcd_unlink_urb(info, urbp); in xenhcd_urb_dequeue()
1376 spin_unlock_irqrestore(&info->lock, flags); in xenhcd_urb_dequeue()
1448 struct xenhcd_info *info; in xenhcd_create_hcd() local
1485 info = xenhcd_hcd_to_info(hcd); in xenhcd_create_hcd()
1486 info->xbdev = dev; in xenhcd_create_hcd()
1487 info->rh_numports = num_ports; in xenhcd_create_hcd()
1490 info->shadow[i].req.id = i + 1; in xenhcd_create_hcd()
1491 info->shadow[i].urb = NULL; in xenhcd_create_hcd()
1492 info->shadow[i].in_flight = false; in xenhcd_create_hcd()
1494 info->shadow[XENUSB_URB_RING_SIZE - 1].req.id = 0x0fff; in xenhcd_create_hcd()
1535 struct xenhcd_info *info = dev_get_drvdata(&dev->dev); in xenhcd_remove() local
1536 struct usb_hcd *hcd = xenhcd_info_to_hcd(info); in xenhcd_remove()
1538 xenhcd_destroy_rings(info); in xenhcd_remove()
1547 struct xenhcd_info *info; in xenhcd_probe() local
1560 info = xenhcd_hcd_to_info(hcd); in xenhcd_probe()
1561 dev_set_drvdata(&dev->dev, info); in xenhcd_probe()