Changeset 3bacee1 in mainline for uspace/drv/bus/usb/xhci/streams.c
- Timestamp:
- 2018-04-12T16:27:17Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3cf22f9
- Parents:
- 76d0981d
- git-author:
- Jiri Svoboda <jiri@…> (2018-04-11 19:25:33)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-04-12 16:27:17)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/streams.c
r76d0981d r3bacee1 88 88 { 89 89 usb_log_debug("Allocating primary stream context array of size %u " 90 90 "for endpoint " XHCI_EP_FMT, count, XHCI_EP_ARGS(*xhci_ep)); 91 91 92 92 if ((dma_buffer_alloc(&xhci_ep->primary_stream_ctx_dma, 93 93 count * sizeof(xhci_stream_ctx_t)))) { 94 94 return ENOMEM; 95 95 } … … 110 110 { 111 111 usb_log_debug("Deallocating primary stream structures for " 112 112 "endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 113 113 114 114 dma_buffer_free(&xhci_ep->primary_stream_ctx_dma); … … 138 138 { 139 139 usb_log_debug("Freeing stream rings and context arrays of endpoint " 140 140 XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 141 141 142 142 for (size_t index = 0; index < xhci_ep->primary_stream_data_size; ++index) { … … 153 153 */ 154 154 static errno_t initialize_primary_stream(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, 155 155 unsigned index) 156 156 { 157 157 xhci_stream_ctx_t *ctx = &xhci_ep->primary_stream_ctx_array[index]; … … 206 206 */ 207 207 static errno_t initialize_secondary_streams(xhci_hc_t *hc, xhci_endpoint_t *xhci_ep, 208 208 unsigned idx, unsigned count) 209 209 { 210 210 if (count == 0) { … … 218 218 if ((count & (count - 1)) != 0 || count < 8 || count > 256) { 219 219 usb_log_error("The secondary stream array size must be a power of 2 " 220 220 "between 8 and 256."); 221 221 return EINVAL; 222 222 } … … 233 233 234 234 if ((dma_buffer_alloc(&data->secondary_stream_ctx_dma, 235 235 count * sizeof(xhci_stream_ctx_t)))) { 236 236 free(data->secondary_data); 237 237 return ENOMEM; … … 275 275 */ 276 276 static void setup_stream_context(xhci_endpoint_t *xhci_ep, xhci_ep_ctx_t *ctx, 277 277 unsigned pstreams, unsigned lsa) 278 278 { 279 279 XHCI_EP_TYPE_SET(*ctx, xhci_endpoint_type(xhci_ep)); … … 295 295 */ 296 296 static errno_t verify_stream_conditions(xhci_hc_t *hc, xhci_device_t *dev, 297 298 { 299 if (xhci_ep->base.transfer_type != USB_TRANSFER_BULK 300 ||dev->base.speed != USB_SPEED_SUPER) {297 xhci_endpoint_t *xhci_ep, unsigned count) 298 { 299 if (xhci_ep->base.transfer_type != USB_TRANSFER_BULK || 300 dev->base.speed != USB_SPEED_SUPER) { 301 301 usb_log_error("Streams are only supported by superspeed bulk endpoints."); 302 302 return EINVAL; … … 321 321 if (count > max_psa_size) { 322 322 usb_log_error("Host controller only supports " 323 323 "%u primary streams.", max_psa_size); 324 324 return EINVAL; 325 325 } … … 327 327 if (count > xhci_ep->max_streams) { 328 328 usb_log_error("Endpoint " XHCI_EP_FMT " supports only %" PRIu32 " streams.", 329 329 XHCI_EP_ARGS(*xhci_ep), xhci_ep->max_streams); 330 330 return EINVAL; 331 331 } … … 346 346 */ 347 347 errno_t xhci_endpoint_remove_streams(xhci_hc_t *hc, xhci_device_t *dev, 348 348 xhci_endpoint_t *xhci_ep) 349 349 { 350 350 if (!xhci_ep->primary_stream_data_size) { … … 374 374 */ 375 375 errno_t xhci_endpoint_request_primary_streams(xhci_hc_t *hc, xhci_device_t *dev, 376 376 xhci_endpoint_t *xhci_ep, unsigned count) 377 377 { 378 378 errno_t err = verify_stream_conditions(hc, dev, xhci_ep, count); … … 422 422 */ 423 423 errno_t xhci_endpoint_request_secondary_streams(xhci_hc_t *hc, xhci_device_t *dev, 424 424 xhci_endpoint_t *xhci_ep, unsigned *sizes, unsigned count) 425 425 { 426 426 /* Check if HC supports secondary indexing */ … … 454 454 if (max * count > xhci_ep->max_streams) { 455 455 usb_log_error("Endpoint " XHCI_EP_FMT " supports only %" PRIu32 " streams.", 456 456 XHCI_EP_ARGS(*xhci_ep), xhci_ep->max_streams); 457 457 return EINVAL; 458 458 }
Note:
See TracChangeset
for help on using the changeset viewer.