Changeset 41abf3c in mainline


Ignore:
Timestamp:
2018-01-18T19:08:51Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
7138a78b
Parents:
8fe29a7c
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-18 19:06:36)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-18 19:08:51)
Message:

xhci: various debugging changes

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

Legend:

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

    r8fe29a7c r41abf3c  
    264264void xhci_dump_trb(const xhci_trb_t *trb)
    265265{
    266         usb_log_debug2("TRB(%p): type %s, cycle %u", trb, xhci_trb_str_type(TRB_TYPE(*trb)), TRB_CYCLE(*trb));
     266        usb_log_debug2("TRB(%p): type %s, cycle %u, status 0x%#08" PRIx32 ", parameter 0x%#016" PRIx64, trb, xhci_trb_str_type(TRB_TYPE(*trb)), TRB_CYCLE(*trb), trb->status, trb->parameter);
    267267}
    268268
     
    341341}
    342342
    343 static void xhci_dump_slot_ctx(const struct xhci_slot_ctx *ctx)
     343void xhci_dump_slot_ctx(const struct xhci_slot_ctx *ctx)
    344344{
    345345#define SLOT_DUMP(name) usb_log_debug("\t" #name ":\t0x%x", XHCI_SLOT_##name(*ctx))
     
    356356        SLOT_DUMP(INTERRUPTER);
    357357        SLOT_DUMP(DEVICE_ADDRESS);
    358         SLOT_DUMP(SLOT_STATE);
     358        SLOT_DUMP(STATE);
    359359#undef SLOT_DUMP
    360360}
    361361
    362 static void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *ctx)
     362void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *ctx)
    363363{
    364364#define EP_DUMP_DW(name)        usb_log_debug("\t" #name ":\t0x%x", XHCI_EP_##name(*ctx))
  • uspace/drv/bus/usb/xhci/debug.h

    r8fe29a7c r41abf3c  
    4646struct xhci_trb;
    4747struct xhci_extcap;
     48struct xhci_slot_ctx;
     49struct xhci_endpoint_ctx;
    4850struct xhci_input_ctx;
    4951
     
    5961void xhci_dump_extcap(const struct xhci_extcap *);
    6062
     63void xhci_dump_slot_ctx(const struct xhci_slot_ctx *);
     64void xhci_dump_endpoint_ctx(const struct xhci_endpoint_ctx *);
    6165void xhci_dump_input_ctx(const struct xhci_input_ctx *);
    6266
  • uspace/drv/bus/usb/xhci/endpoint.h

    r8fe29a7c r41abf3c  
    6363        EP_TYPE_BULK_IN = 6,
    6464        EP_TYPE_INTERRUPT_IN = 7
    65 };
    66 
    67 enum {
    68         EP_STATE_DISABLED = 0,
    69         EP_STATE_RUNNING = 1,
    70         EP_STATE_HALTED = 2,
    71         EP_STATE_STOPPED = 3,
    72         EP_STATE_ERROR = 4,
    7365};
    7466
  • uspace/drv/bus/usb/xhci/hw_struct/context.h

    r8fe29a7c r41abf3c  
    109109} __attribute__((packed)) xhci_ep_ctx_t;
    110110
     111enum {
     112        EP_STATE_DISABLED = 0,
     113        EP_STATE_RUNNING = 1,
     114        EP_STATE_HALTED = 2,
     115        EP_STATE_STOPPED = 3,
     116        EP_STATE_ERROR = 4,
     117};
     118
    111119/**
    112120 * Slot context: section 6.2.2
     
    148156
    149157#define XHCI_SLOT_DEVICE_ADDRESS(ctx)   XHCI_DWORD_EXTRACT((ctx).data[3],  7,  0)
    150 #define XHCI_SLOT_SLOT_STATE(ctx)       XHCI_DWORD_EXTRACT((ctx).data[3], 31, 27)
     158#define XHCI_SLOT_STATE(ctx)       XHCI_DWORD_EXTRACT((ctx).data[3], 31, 27)
    151159
    152160} __attribute__((packed)) xhci_slot_ctx_t;
     161
     162enum {
     163        SLOT_STATE_DISABLED = 0,
     164        SLOT_STATE_DEFAULT = 1,
     165        SLOT_STATE_ADDRESS = 2,
     166        SLOT_STATE_CONFIGURED = 3,
     167};
    153168
    154169/**
  • uspace/drv/bus/usb/xhci/transfers.c

    r8fe29a7c r41abf3c  
    297297        const usb_endpoint_t ep_num = ep_dci / 2;
    298298        const usb_endpoint_t dir = ep_dci % 2 ? USB_DIRECTION_IN : USB_DIRECTION_OUT;
     299        /* Creating temporary reference */
    299300        endpoint_t *ep_base = bus_find_endpoint(&dev->base, ep_num, dir);
    300301        if (!ep_base) {
     
    325326                if (ep->base.transfer_type == USB_TRANSFER_ISOCHRONOUS) {
    326327                        isoch_handle_transfer_event(hc, ep, trb);
     328                        /* Dropping temporary reference */
    327329                        endpoint_del_ref(&ep->base);
    328330                        return EOK;
     
    333335                if (!batch) {
    334336                        fibril_mutex_unlock(&ep->base.guard);
     337                        /* Dropping temporary reference */
    335338                        endpoint_del_ref(&ep->base);
    336339                        return ENOENT;
     
    395398        if (xhci_endpoint_get_state(ep) == EP_STATE_HALTED) {
    396399                usb_log_debug("Endpoint halted, resetting endpoint.");
    397                 xhci_endpoint_clear_halt(ep, batch->target.stream);
    398                
     400                const int err = xhci_endpoint_clear_halt(ep, batch->target.stream);
     401                if (err)
     402                        usb_log_error("Failed to clear halted condition on "
     403                            "endpoint " XHCI_EP_FMT ". Unexpected results "
     404                            "coming.", XHCI_EP_ARGS(*ep));
    399405        }
    400406
     
    406412
    407413        usb_transfer_batch_finish(batch);
     414        /* Dropping temporary reference */
    408415        endpoint_del_ref(&ep->base);
    409416        return EOK;
Note: See TracChangeset for help on using the changeset viewer.