Changeset aee352c in mainline


Ignore:
Timestamp:
2017-07-22T23:09:06Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
a06fd64
Parents:
110d795
Message:

Added a temporary workaround about faulty interrupts (IP being reset to 0 before handler is called). However, still only one interrupt will be handled (others will halt in qemu because of - I think - not updated dequeue ptrs). Also added command system changes.

File:
1 edited

Legend:

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

    r110d795 raee352c  
    211211                goto err_event_ring;
    212212
     213        if ((err = xhci_init_commands(hc)))
     214                goto err_event_ring;
     215
    213216        return EOK;
    214217
     
    352355{
    353356        xhci_dump_state(hc);
    354         xhci_send_no_op_command(hc);
     357        xhci_send_no_op_command(hc, NULL);
    355358        async_usleep(1000);
    356359        xhci_dump_state(hc);
     
    405408void hc_interrupt(xhci_hc_t *hc, uint32_t status)
    406409{
     410        /**
     411         * TODO: This is a temporary workaround, when an event interrupt
     412         *       happens, status has the value of 3, which is equal to
     413         *       XHCI_REG_SHIFT(XHCI_OP_EINT), intstead to the correct
     414         *       XHCI_REG_MASK(XHCI_OP_EINT), which has the value of 8 (1 << 3).
     415         *       This is how e.g. FreeBSD does it.
     416         */
     417        status = hc->op_regs->usbsts;
     418
    407419        if (status & XHCI_REG_MASK(XHCI_OP_HSE)) {
    408420                usb_log_error("Host controller error occured. Bad things gonna happen...");
     
    414426                xhci_interrupter_regs_t *intr0 = &hc->rt_regs->ir[0];
    415427
    416                 if (XHCI_REG_RD(intr0, XHCI_INTR_IP)) {
     428                /**
     429                 * EINT has to be cleared before IP, but we also need to
     430                 * handle the event before clearing EINT.
     431                 */
     432                uint32_t ip = XHCI_REG_RD(intr0, XHCI_INTR_IP);
     433
     434                if (ip | 1) { // TODO: IP is being cleared right after it is set by the xHC.
     435                        hc_run_event_ring(hc, &hc->event_ring, intr0);
     436                }
     437
     438                XHCI_REG_SET(hc->op_regs, XHCI_OP_EINT, 1);
     439
     440                if (ip) {
    417441                        XHCI_REG_SET(intr0, XHCI_INTR_IP, 1);
    418                         hc_run_event_ring(hc, &hc->event_ring, intr0);
    419442                }
    420443        }
Note: See TracChangeset for help on using the changeset viewer.