Changeset 19f0048 in mainline for uspace/drv/bus/usb/xhci/commands.c


Ignore:
Timestamp:
2018-02-01T02:13:34Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
17d34a8
Parents:
53fdf8c
Message:

xhci: reinitialize in case of HC error

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/commands.c

    r53fdf8c r19f0048  
    8686        list_initialize(&cr->cmd_list);
    8787
    88         cr->state = XHCI_CR_STATE_OPEN;
    89 
    9088        return EOK;
    9189}
     
    251249                fibril_condvar_wait(&cr->stopped_cv, &cr->guard);
    252250
     251        fibril_mutex_unlock(&cr->guard);
     252}
     253
     254/**
     255 * Mark the command ring as stopped. NAK new commands, abort running, do not
     256 * touch the HC as it's probably broken.
     257 */
     258void xhci_nuke_command_ring(xhci_hc_t *hc)
     259{
     260        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
     261        fibril_mutex_lock(&cr->guard);
     262        // Prevent others from starting CR again.
     263        cr_set_state(cr, XHCI_CR_STATE_CLOSED);
     264        fibril_mutex_unlock(&cr->guard);
     265}
     266
     267/**
     268 * Mark the command ring as working again.
     269 */
     270void xhci_start_command_ring(xhci_hc_t *hc)
     271{
     272        xhci_cmd_ring_t *cr = get_cmd_ring(hc);
     273        fibril_mutex_lock(&cr->guard);
     274        // Prevent others from starting CR again.
     275        cr_set_state(cr, XHCI_CR_STATE_OPEN);
    253276        fibril_mutex_unlock(&cr->guard);
    254277}
Note: See TracChangeset for help on using the changeset viewer.