Changeset 2755a622 in mainline
- Timestamp:
- 2018-01-17T01:36:46Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 740dafc
- Parents:
- 3f44312
- git-author:
- Ondřej Hlavatý <aearsis@…> (2018-01-16 23:24:28)
- git-committer:
- Ondřej Hlavatý <aearsis@…> (2018-01-17 01:36:46)
- Location:
- uspace/drv/bus/usb/uhci
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hc.c
r3f44312 r2755a622 329 329 uhci_transfer_batch_t *batch = NULL; 330 330 331 // Check for the roothub, as it does not schedule into lists 332 if (ep->device->speed == USB_SPEED_MAX) { 333 // FIXME: We shall check the roothub for active transfer. But 334 // as it is polling, there is no way to make it stop doing so. 335 // Return after rewriting uhci rh. 336 return; 337 } 338 339 transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type]; 340 assert(list); 341 342 // To avoid ABBA deadlock, we need to take the list first 343 fibril_mutex_lock(&list->guard); 331 344 fibril_mutex_lock(&ep->guard); 332 345 if (ep->active_batch) { 333 346 batch = uhci_transfer_batch_get(ep->active_batch); 334 335 transfer_list_t *list = hc->transfers[ep->device->speed][ep->transfer_type]; 336 assert(list); 337 338 fibril_mutex_lock(&list->guard); 347 endpoint_deactivate_locked(ep); 339 348 transfer_list_remove_batch(list, batch); 340 fibril_mutex_unlock(&list->guard); 341 349 } 350 fibril_mutex_unlock(&ep->guard); 351 fibril_mutex_unlock(&list->guard); 352 353 if (batch) { 354 // The HW could have been looking at the batch. 355 // Better wait two frames before we release the buffers. 342 356 endpoint_wait_timeout_locked(ep, 2000); 343 344 batch = uhci_transfer_batch_get(ep->active_batch);345 if (ep->active_batch) {346 endpoint_deactivate_locked(ep);347 }348 }349 fibril_mutex_unlock(&ep->guard);350 351 if (batch) {352 357 batch->base.error = EINTR; 353 358 batch->base.transfered_size = 0; -
uspace/drv/bus/usb/uhci/transfer_list.c
r3f44312 r2755a622 173 173 174 174 if (uhci_transfer_batch_check_completed(batch)) { 175 /* Save for processing */ 175 /* Remove from schedule, save for processing */ 176 fibril_mutex_lock(&batch->base.ep->guard); 177 assert(batch->base.ep->active_batch == &batch->base); 178 endpoint_deactivate_locked(batch->base.ep); 176 179 transfer_list_remove_batch(instance, batch); 180 fibril_mutex_unlock(&batch->base.ep->guard); 181 177 182 list_append(current, done); 178 183 } … … 212 217 assert(uhci_batch->qh); 213 218 assert(fibril_mutex_is_locked(&instance->guard)); 219 assert(!list_empty(&instance->batch_list)); 214 220 215 221 usb_log_debug2("Batch %p removing from queue %s.", -
uspace/drv/bus/usb/uhci/uhci_batch.c
r3f44312 r2755a622 179 179 180 180 batch->ep->toggle = td_toggle(&uhci_batch->tds[i]); 181 if (i > 0) 182 goto substract_ret; 183 return true; 181 goto substract_ret; 184 182 } 185 183 … … 190 188 } 191 189 substract_ret: 192 if (batch->ep->transfer_type == USB_TRANSFER_CONTROL) 190 if (batch->transfered_size > 0 && batch->ep->transfer_type == USB_TRANSFER_CONTROL) { 191 assert(batch->transfered_size >= USB_SETUP_PACKET_SIZE); 193 192 batch->transfered_size -= USB_SETUP_PACKET_SIZE; 194 195 fibril_mutex_lock(&batch->ep->guard); 196 endpoint_deactivate_locked(batch->ep); 197 fibril_mutex_unlock(&batch->ep->guard); 193 } 198 194 199 195 if (batch->dir == USB_DIRECTION_IN) {
Note:
See TracChangeset
for help on using the changeset viewer.