Changeset cb89430 in mainline for uspace/drv/bus/usb/xhci/debug.c


Ignore:
Timestamp:
2017-06-22T13:59:15Z (8 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e4d7363
Parents:
62ba2cbe
Message:

xhci: event rings && hc initialization (WIP)

File:
1 edited

Legend:

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

    r62ba2cbe rcb89430  
    3737#include <usb/debug.h>
    3838
     39#include "hw_struct/trb.h"
    3940#include "debug.h"
    4041#include "hc.h"
     
    6667        DUMP_REG(cap, XHCI_CAP_VERSION);
    6768        DUMP_REG(cap, XHCI_CAP_MAX_SLOTS);
     69        DUMP_REG(cap, XHCI_CAP_MAX_INTRS);
     70        DUMP_REG(cap, XHCI_CAP_MAX_PORTS);
    6871        DUMP_REG(cap, XHCI_CAP_IST);
    6972        DUMP_REG(cap, XHCI_CAP_ERST_MAX);
     73        usb_log_debug2(PX "%u", "Max Scratchpad bufs", xhci_get_max_spbuf(cap));
    7074        DUMP_REG(cap, XHCI_CAP_SPR);
    7175        DUMP_REG(cap, XHCI_CAP_U1EL);
     
    124128        usb_log_debug2("Operational registers:");
    125129
    126         DUMP_REG(hc->op_regs, XHCI_OP_RS);
    127130        DUMP_REG(hc->op_regs, XHCI_OP_RS);
    128131        DUMP_REG(hc->op_regs, XHCI_OP_HCRST);
     
    152155        DUMP_REG(hc->op_regs, XHCI_OP_CRCR_LO);
    153156        DUMP_REG(hc->op_regs, XHCI_OP_CRCR_HI);
    154 
     157        DUMP_REG(hc->op_regs, XHCI_OP_DCBAAP_LO);
     158        DUMP_REG(hc->op_regs, XHCI_OP_DCBAAP_HI);
     159        DUMP_REG(hc->rt_regs, XHCI_RT_MFINDEX);
     160
     161        usb_log_debug2("Interrupter 0 state:");
     162        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IP);
     163        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IE);
     164        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMI);
     165        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IMC);
     166        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTSZ);
     167        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTBA_LO);
     168        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERSTBA_HI);
     169        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERDP_LO);
     170        DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_ERDP_HI);
     171}
     172
     173void xhci_dump_ports(xhci_hc_t *hc)
     174{
    155175        const size_t num_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS);
    156176        for (size_t i = 0; i < num_ports; i++) {
     
    160180        }
    161181}
     182
     183static const char *trb_types [] = {
     184        [0] = "<empty>",
     185#define TRB(t) [XHCI_TRB_TYPE_##t] = #t
     186        TRB(NORMAL),
     187        TRB(SETUP_STAGE),
     188        TRB(DATA_STAGE),
     189        TRB(STATUS_STAGE),
     190        TRB(ISOCH),
     191        TRB(LINK),
     192        TRB(EVENT_DATA),
     193        TRB(NO_OP),
     194        TRB(ENABLE_SLOT_CMD),
     195        TRB(DISABLE_SLOT_CMD),
     196        TRB(ADDRESS_DEVICE_CMD),
     197        TRB(CONFIGURE_ENDPOINT_CMD),
     198        TRB(EVALUATE_CONTEXT_CMD),
     199        TRB(RESET_ENDPOINT_CMD),
     200        TRB(STOP_ENDPOINT_CMD),
     201        TRB(SET_TR_DEQUEUE_POINTER_CMD),
     202        TRB(RESET_DEVICE_CMD),
     203        TRB(FORCE_EVENT_CMD),
     204        TRB(NEGOTIATE_BANDWIDTH_CMD),
     205        TRB(SET_LATENCY_TOLERANCE_VALUE_CMD),
     206        TRB(GET_PORT_BANDWIDTH_CMD),
     207        TRB(FORCE_HEADER_CMD),
     208        TRB(NO_OP_CMD),
     209        TRB(TRANSFER_EVENT),
     210        TRB(COMMAND_COMPLETION_EVENT),
     211        TRB(PORT_STATUS_CHANGE_EVENT),
     212        TRB(BANDWIDTH_REQUEST_EVENT),
     213        TRB(DOORBELL_EVENT),
     214        TRB(HOST_CONTROLLER_EVENT),
     215        TRB(DEVICE_NOTIFICATION_EVENT),
     216        TRB(MFINDEX_WRAP_EVENT),
     217#undef TRB
     218        [XHCI_TRB_TYPE_MAX] = NULL,
     219};
     220
     221const char *xhci_trb_str_type(unsigned type)
     222{
     223        static char type_buf [20];
     224
     225        if (type < XHCI_TRB_TYPE_MAX && trb_types[type] != NULL)
     226                return trb_types[type];
     227
     228        snprintf(type_buf, sizeof(type_buf), "<unknown (%u)>", type);
     229        return type_buf;
     230}
     231
     232void xhci_dump_trb(xhci_trb_t *trb)
     233{
     234        usb_log_debug2("TRB(%p): type %s, cycle %u", trb, xhci_trb_str_type(TRB_TYPE(*trb)), TRB_CYCLE(*trb));
     235}
     236
    162237/**
    163238 * @}
Note: See TracChangeset for help on using the changeset viewer.