Changeset 1ed3eb4 in mainline for uspace/drv/bus
- Timestamp:
- 2018-01-13T19:13:04Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2489353
- Parents:
- 001778c
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-13 19:12:34)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-13 19:13:04)
- Location:
- uspace/drv/bus/usb/xhci
- Files:
-
- 6 edited
-
bus.c (modified) (1 diff)
-
endpoint.c (modified) (1 diff)
-
endpoint.h (modified) (1 diff)
-
isoch.c (modified) (3 diffs)
-
isoch.h (modified) (1 diff)
-
transfers.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/bus.c
r001778c r1ed3eb4 116 116 return err; 117 117 118 xhci_endpoint_t *ep0 = xhci_ device_get_endpoint(dev, 0);118 xhci_endpoint_t *ep0 = xhci_endpoint_get(dev->base.endpoints[0]); 119 119 assert(ep0); 120 120 -
uspace/drv/bus/usb/xhci/endpoint.c
r001778c r1ed3eb4 443 443 } 444 444 445 /** Retrieve XHCI endpoint from a device by the endpoint number.446 * @param[in] dev XHCI device to query.447 * @param[in] ep Endpoint number identifying the endpoint to retrieve.448 *449 * @return XHCI endpoint with the specified number or NULL if no such endpoint exists.450 */451 xhci_endpoint_t *xhci_device_get_endpoint(xhci_device_t *dev, usb_endpoint_t ep)452 {453 endpoint_t *ep_base = dev->base.endpoints[ep];454 if (!ep_base)455 return NULL;456 457 return xhci_endpoint_get(ep_base);458 }459 460 445 /** 461 446 * @} -
uspace/drv/bus/usb/xhci/endpoint.h
r001778c r1ed3eb4 139 139 void xhci_setup_endpoint_context(xhci_endpoint_t *, xhci_ep_ctx_t *); 140 140 141 xhci_endpoint_t * xhci_device_get_endpoint(xhci_device_t *, usb_endpoint_t);142 143 141 static inline xhci_device_t * xhci_device_get(device_t *dev) 144 142 { -
uspace/drv/bus/usb/xhci/isoch.c
r001778c r1ed3eb4 572 572 } 573 573 574 intisoch_handle_transfer_event(xhci_hc_t *hc, xhci_endpoint_t *ep, xhci_trb_t *trb)574 void isoch_handle_transfer_event(xhci_hc_t *hc, xhci_endpoint_t *ep, xhci_trb_t *trb) 575 575 { 576 576 assert(ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS); … … 591 591 fibril_condvar_broadcast(&ep->isoch->avail); 592 592 fibril_mutex_unlock(&ep->isoch->guard); 593 return EOK;593 goto out; 594 594 case XHCI_TRBC_SHORT_PACKET: 595 595 case XHCI_TRBC_SUCCESS: … … 641 641 timer_schedule_reset(ep); 642 642 643 out: 643 644 fibril_condvar_broadcast(&ep->isoch->avail); 644 645 fibril_mutex_unlock(&ep->isoch->guard); 645 return EOK;646 646 } 647 647 -
uspace/drv/bus/usb/xhci/isoch.h
r001778c r1ed3eb4 123 123 int isoch_schedule_out(xhci_transfer_t *); 124 124 int isoch_schedule_in(xhci_transfer_t *); 125 intisoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *, xhci_trb_t *);125 void isoch_handle_transfer_event(xhci_hc_t *, xhci_endpoint_t *, xhci_trb_t *); 126 126 127 127 #endif -
uspace/drv/bus/usb/xhci/transfers.c
r001778c r1ed3eb4 258 258 259 259 const usb_endpoint_t ep_num = ep_dci / 2; 260 xhci_endpoint_t *ep = xhci_device_get_endpoint(dev, ep_num); 261 if (!ep) { 262 usb_log_error("Transfer event on dropped endpoint %u of device " 263 XHCI_DEV_FMT, ep_num, XHCI_DEV_ARGS(*dev)); 260 const usb_endpoint_t dir = ep_dci % 2 ? USB_DIRECTION_IN : USB_DIRECTION_OUT; 261 endpoint_t *ep_base = bus_find_endpoint(&dev->base, ep_num, dir); 262 if (!ep_base) { 263 usb_log_error("Transfer event on dropped endpoint %u %s of device " 264 XHCI_DEV_FMT, ep_num, usb_str_direction(dir), XHCI_DEV_ARGS(*dev)); 264 265 return ENOENT; 265 266 } 266 // No need to add reference for endpoint, it is held by the transfer batch.267 xhci_endpoint_t *ep = xhci_endpoint_get(ep_base); 267 268 268 269 /* FIXME: This is racy. Do we care? */ … … 270 271 271 272 if (ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) { 272 return isoch_handle_transfer_event(hc, ep, trb); 273 isoch_handle_transfer_event(hc, ep, trb); 274 endpoint_del_ref(&ep->base); 275 return EOK; 273 276 } 274 277 … … 277 280 if (!batch) { 278 281 fibril_mutex_unlock(&ep->base.guard); 282 endpoint_del_ref(&ep->base); 279 283 return ENOENT; 280 284 } … … 305 309 306 310 usb_transfer_batch_finish(batch); 311 endpoint_del_ref(&ep->base); 307 312 return EOK; 308 313 }
Note:
See TracChangeset
for help on using the changeset viewer.
