Changeset 706a3e2 in mainline


Ignore:
Timestamp:
2017-08-18T16:21:33Z (7 years ago)
Author:
Jaroslav Jindrak <dzejrou@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5ff9e1d
Parents:
e439f468
Message:

Dcbaa_virt now points to virtual device contexts that contain pointers to trb rings of each of their endpoints for deallocation.

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

Legend:

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

    re439f468 r706a3e2  
    483483static void hc_dcbaa_fini(xhci_hc_t *hc)
    484484{
     485        xhci_trb_ring_t* trb_ring;
    485486        xhci_scratchpad_free(hc);
    486487
    487488        /* Idx 0 already deallocated by xhci_scratchpad_free. */
    488489        for (unsigned i = 1; i < hc->max_slots + 1; ++i) {
    489                 if (hc->dcbaa_virt[i] != NULL) {
     490                if (hc->dcbaa_virt[i]) {
     491                        if (hc->dcbaa_virt[i]->dev_ctx)
     492                                free32(hc->dcbaa_virt[i]->dev_ctx);
     493
     494                        for (unsigned i = 0; i < XHCI_EP_COUNT; ++i) {
     495                                trb_ring = hc->dcbaa_virt[i]->trs[i];
     496                                if (trb_ring) {
     497                                        xhci_trb_ring_fini(trb_ring);
     498                                        free32(trb_ring);
     499                                }
     500                        }
     501
    490502                        free32(hc->dcbaa_virt[i]);
    491503                        hc->dcbaa_virt[i] = NULL;
  • uspace/drv/bus/usb/xhci/hc.h

    re439f468 r706a3e2  
    4343#include "trb_ring.h"
    4444
     45typedef struct xhci_virt_device_ctx {
     46    xhci_device_ctx_t *dev_ctx;
     47    xhci_trb_ring_t *trs[XHCI_EP_COUNT];
     48} xhci_virt_device_ctx_t;
     49
    4550/**
    4651 * xHCI lets the controller define speeds of ports it controls.
     
    6772        xhci_event_ring_t event_ring;
    6873        uint64_t *dcbaa;
    69         xhci_device_ctx_t **dcbaa_virt;
     74        xhci_virt_device_ctx_t **dcbaa_virt;
    7075        xhci_scratchpad_t *scratchpad;
    7176
  • uspace/drv/bus/usb/xhci/hw_struct/context.h

    re439f468 r706a3e2  
    5151        xhci_dword_t data[5];
    5252        xhci_dword_t reserved[3];
     53
     54#define XHCI_EP_COUNT 31
    5355
    5456#define XHCI_EP_TYPE_ISOCH_OUT          1
     
    132134typedef struct xhci_device_ctx {
    133135        xhci_slot_ctx_t slot_ctx;
    134         xhci_ep_ctx_t endpoint_ctx [31];
     136        xhci_ep_ctx_t endpoint_ctx[XHCI_EP_COUNT];
    135137} __attribute__((packed)) xhci_device_ctx_t;
    136138
     
    165167
    166168#define XHCI_INPUT_CTRL_CTX_ADD_SET(ctx, idx) (ctx).data[1] |= (1 << (idx))
    167    
     169
    168170#define XHCI_INPUT_CTRL_CTX_CONFIG_VALUE(ctx)   XHCI_DWORD_EXTRACT((ctx).data[7],  7,  0)
    169171#define XHCI_INPUT_CTRL_CTX_IFACE_NUMBER(ctx)   XHCI_DWORD_EXTRACT((ctx).data[7], 15,  8)
     
    177179        xhci_input_ctrl_ctx_t ctrl_ctx;
    178180        xhci_slot_ctx_t slot_ctx;
    179         xhci_ep_ctx_t endpoint_ctx [31];
     181        xhci_ep_ctx_t endpoint_ctx[XHCI_EP_COUNT];
    180182} __attribute__((packed)) xhci_input_ctx_t;
    181183
  • uspace/drv/bus/usb/xhci/rh.c

    re439f468 r706a3e2  
    115115
    116116        hc->dcbaa[slot_id] = addr_to_phys(dctx);
    117         hc->dcbaa_virt[slot_id] = dctx;
     117        hc->dcbaa_virt[slot_id]->dev_ctx = dctx;
    118118
    119119        cmd = xhci_alloc_command();
Note: See TracChangeset for help on using the changeset viewer.