Changeset 3dc519f in mainline


Ignore:
Timestamp:
2017-07-24T01:46:36Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2fa43d1
Parents:
60f7c590
Message:

Added the ability to stop and abort the command ring, though discovered a bug in qemu - see note in xhci_stop_command_ring. Also note that currently stopping/aborting result in assertion failure as command completion handler is not yet prepared for them, but they do stop the command ring

Location:
uspace/drv/bus/usb/xhci
Files:
2 edited

Legend:

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

    r60f7c590 r3dc519f  
    155155
    156156        return cmd;
     157}
     158
     159void xhci_stop_command_ring(xhci_hc_t *hc)
     160{
     161        assert(hc);
     162
     163        XHCI_REG_SET(hc->op_regs, XHCI_OP_CS, 1);
     164
     165        /**
     166         * Note: There is a bug in qemu that checks CS only when CRCR_HI
     167         *       is written, this (and the read/write in abort) ensures
     168         *       the command rings stops.
     169         */
     170        XHCI_REG_WR(hc->op_regs, XHCI_OP_CRCR_HI, XHCI_REG_RD(hc->op_regs, XHCI_OP_CRCR_HI));
     171}
     172
     173void xhci_abort_command_ring(xhci_hc_t *hc)
     174{
     175        assert(hc);
     176
     177        XHCI_REG_WR(hc->op_regs, XHCI_OP_CA, 1);
     178        XHCI_REG_WR(hc->op_regs, XHCI_OP_CRCR_HI, XHCI_REG_RD(hc->op_regs, XHCI_OP_CRCR_HI));
     179}
     180
     181void xhci_start_command_ring(xhci_hc_t *hc)
     182{
     183        assert(hc);
     184
     185        XHCI_REG_WR(hc->op_regs, XHCI_OP_CRR, 1);
     186        ring_doorbell(hc, 0, 0);
    157187}
    158188
     
    390420        assert(trb);
    391421
     422        // TODO: STOP & ABORT may not have command structs in the list!
     423
    392424        usb_log_debug("HC(%p) Command completed.", hc);
    393425
  • uspace/drv/bus/usb/xhci/commands.h

    r60f7c590 r3dc519f  
    6262void xhci_free_command(xhci_cmd_t *);
    6363
     64void xhci_stop_command_ring(xhci_hc_t *);
     65void xhci_abort_command_ring(xhci_hc_t *);
     66void xhci_start_command_ring(xhci_hc_t *);
     67
    6468int xhci_send_no_op_command(xhci_hc_t *, xhci_cmd_t *);
    6569int xhci_send_enable_slot_command(xhci_hc_t *, xhci_cmd_t *);
Note: See TracChangeset for help on using the changeset viewer.