Changeset defaab2 in mainline
- Timestamp:
- 2018-01-20T22:46:24Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 217e981
- Parents:
- 9d3536e
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/xhci/commands.c
r9d3536e rdefaab2 339 339 * requesting thread is waiting inside the CV. 340 340 */ 341 usb_log_debug 2("Command ring stopped.");341 usb_log_debug("Command ring stopped."); 342 342 fibril_condvar_broadcast(&cr->stopped_cv); 343 343 fibril_mutex_unlock(&cr->guard); -
uspace/drv/bus/usb/xhci/debug.c
r9d3536e rdefaab2 45 45 46 46 #define DUMP_REG_FIELD(ptr, title, size, ...) \ 47 usb_log_debug 2(PX "%" PRIu##size, title, XHCI_REG_RD_FIELD(ptr, size, ##__VA_ARGS__))47 usb_log_debug(PX "%" PRIu##size, title, XHCI_REG_RD_FIELD(ptr, size, ##__VA_ARGS__)) 48 48 49 49 #define DUMP_REG_RANGE(ptr, title, size, ...) \ 50 usb_log_debug 2(PX "%" PRIu##size, title, XHCI_REG_RD_RANGE(ptr, size, ##__VA_ARGS__))50 usb_log_debug(PX "%" PRIu##size, title, XHCI_REG_RD_RANGE(ptr, size, ##__VA_ARGS__)) 51 51 52 52 #define DUMP_REG_FLAG(ptr, title, size, ...) \ 53 usb_log_debug 2(PX "%s", title, XHCI_REG_RD_FLAG(ptr, size, ##__VA_ARGS__) ? "true" : "false")53 usb_log_debug(PX "%s", title, XHCI_REG_RD_FLAG(ptr, size, ##__VA_ARGS__) ? "true" : "false") 54 54 55 55 #define DUMP_REG_INNER(set, title, field, size, type, ...) \ … … 63 63 void xhci_dump_cap_regs(const xhci_cap_regs_t *cap) 64 64 { 65 usb_log_debug 2("Capabilities:");65 usb_log_debug("Capabilities:"); 66 66 67 67 DUMP_REG(cap, XHCI_CAP_LENGTH); … … 72 72 DUMP_REG(cap, XHCI_CAP_IST); 73 73 DUMP_REG(cap, XHCI_CAP_ERST_MAX); 74 usb_log_debug 2(PX "%u", "Max Scratchpad bufs", xhci_get_max_spbuf(cap));74 usb_log_debug(PX "%u", "Max Scratchpad bufs", xhci_get_max_spbuf(cap)); 75 75 DUMP_REG(cap, XHCI_CAP_SPR); 76 76 DUMP_REG(cap, XHCI_CAP_U1EL); … … 149 149 void xhci_dump_state(const xhci_hc_t *hc) 150 150 { 151 usb_log_debug 2("Operational registers:");151 usb_log_debug("Operational registers:"); 152 152 153 153 DUMP_REG(hc->op_regs, XHCI_OP_RS); … … 182 182 DUMP_REG(hc->rt_regs, XHCI_RT_MFINDEX); 183 183 184 usb_log_debug 2("Interrupter 0 state:");184 usb_log_debug("Interrupter 0 state:"); 185 185 DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IP); 186 186 DUMP_REG(&hc->rt_regs->ir[0], XHCI_INTR_IE); … … 201 201 const size_t num_ports = XHCI_REG_RD(hc->cap_regs, XHCI_CAP_MAX_PORTS); 202 202 for (size_t i = 0; i < num_ports; i++) { 203 usb_log_debug 2("Port %zu state:", i);203 usb_log_debug("Port %zu state:", i); 204 204 205 205 xhci_dump_port(&hc->op_regs->portrs[i]); … … 264 264 void xhci_dump_trb(const xhci_trb_t *trb) 265 265 { 266 usb_log_debug 2("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);266 usb_log_debug("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); 267 267 } 268 268 -
uspace/drv/bus/usb/xhci/device.c
r9d3536e rdefaab2 76 76 if ((err = hc_enable_slot(dev)) != EOK) 77 77 return err; 78 usb_log_debug 2("Obtained slot ID: %u.", dev->slot_id);78 usb_log_debug("Obtained slot ID: %u.", dev->slot_id); 79 79 80 80 /* Create and configure control endpoint. */ … … 87 87 dev->base.endpoints[0] = ep0_base; 88 88 89 usb_log_debug 2("Looking up new device initial speed: %i", dev->base.speed);89 usb_log_debug("Looking up new device initial MPS: %s", usb_str_speed(dev->base.speed)); 90 90 ep0_base->max_packet_size = hc_get_ep0_initial_mps(dev->base.speed); 91 91 … … 160 160 } 161 161 162 usb_log_debug 2("Device(%u): recognised USB hub with %u ports", dev->base.address, dev->num_ports);162 usb_log_debug("Device(%u): recognised USB hub with %u ports", dev->base.address, dev->num_ports); 163 163 return EOK; 164 164 } -
uspace/drv/bus/usb/xhci/endpoint.c
r9d3536e rdefaab2 279 279 { 280 280 /* Can't use XHCI_EP_FMT because the endpoint may not have device. */ 281 usb_log_debug 2("Allocating main transfer ring for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));281 usb_log_debug("Allocating main transfer ring for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 282 282 283 283 xhci_ep->primary_stream_data_array = NULL; … … 307 307 xhci_stream_free_ds(xhci_ep); 308 308 } else { 309 usb_log_debug 2("Freeing main transfer ring of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));309 usb_log_debug("Freeing main transfer ring of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 310 310 xhci_trb_ring_fini(&xhci_ep->ring); 311 311 } -
uspace/drv/bus/usb/xhci/hc.c
r9d3536e rdefaab2 128 128 } 129 129 130 usb_log_debug 2("Implied speed of USB %u.0 set up.", major);130 usb_log_debug("Implied speed of USB %u.0 set up.", major); 131 131 } else { 132 132 for (unsigned i = 0; i < psic; i++) { … … 157 157 && default_psiv_to_port_speed[psiv].tx_bps == bps) { 158 158 speeds[psiv] = default_psiv_to_port_speed[psiv]; 159 usb_log_debug 2("Assumed default %s speed of USB %u.", usb_str_speed(speeds[psiv].usb_speed), major);159 usb_log_debug("Assumed default %s speed of USB %u.", usb_str_speed(speeds[psiv].usb_speed), major); 160 160 continue; 161 161 } … … 171 171 if (sim == XHCI_PSI_PLT_SYMM || sim == XHCI_PSI_PLT_TX) { 172 172 speeds[psiv].tx_bps = bps; 173 usb_log_debug 2("Speed %u set up for bps %" PRIu64 " / %" PRIu64 ".", psiv, speeds[psiv].rx_bps, speeds[psiv].tx_bps);173 usb_log_debug("Speed %u set up for bps %" PRIu64 " / %" PRIu64 ".", psiv, speeds[psiv].rx_bps, speeds[psiv].tx_bps); 174 174 } 175 175 } … … 214 214 hc->xecp = (xhci_extcap_t *) (base + xec_offset); 215 215 216 usb_log_debug 2("Initialized MMIO reg areas:");217 usb_log_debug 2("\tCapability regs: %p", hc->cap_regs);218 usb_log_debug 2("\tOperational regs: %p", hc->op_regs);219 usb_log_debug 2("\tRuntime regs: %p", hc->rt_regs);220 usb_log_debug 2("\tDoorbell array base: %p", hc->db_arry);216 usb_log_debug("Initialized MMIO reg areas:"); 217 usb_log_debug("\tCapability regs: %p", hc->cap_regs); 218 usb_log_debug("\tOperational regs: %p", hc->op_regs); 219 usb_log_debug("\tRuntime regs: %p", hc->rt_regs); 220 usb_log_debug("\tDoorbell array base: %p", hc->db_arry); 221 221 222 222 xhci_dump_cap_regs(hc->cap_regs); … … 419 419 return ETIMEOUT; 420 420 421 usb_log_debug 2("LEGSUP: bios: %x, os: %x", hc->legsup->sem_bios, hc->legsup->sem_os);421 usb_log_debug("LEGSUP: bios: %x, os: %x", hc->legsup->sem_bios, hc->legsup->sem_os); 422 422 XHCI_REG_SET(hc->legsup, XHCI_LEGSUP_SEM_OS, 1); 423 423 for (int i = 0; i <= (XHCI_LEGSUP_BIOS_TIMEOUT_US / XHCI_LEGSUP_POLLING_DELAY_1MS); i++) { 424 usb_log_debug 2("LEGSUP: elapsed: %i ms, bios: %x, os: %x", i,424 usb_log_debug("LEGSUP: elapsed: %i ms, bios: %x, os: %x", i, 425 425 XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_BIOS), 426 426 XHCI_REG_RD(hc->legsup, XHCI_LEGSUP_SEM_OS)); … … 526 526 } 527 527 528 usb_log_debug 2("Polled status: %x", *status);528 usb_log_debug("Polled status: %x", *status); 529 529 return EOK; 530 530 } … … 534 534 struct timeval tv; 535 535 getuptime(&tv); 536 usb_log_debug 2("Microframe index wrapped (@%lu.%li, %"PRIu64" total).", tv.tv_sec, tv.tv_usec, hc->wrap_count);536 usb_log_debug("Microframe index wrapped (@%lu.%li, %"PRIu64" total).", tv.tv_sec, tv.tv_usec, hc->wrap_count); 537 537 hc->wrap_time = ((uint64_t) tv.tv_sec) * 1000000 + ((uint64_t) tv.tv_usec); 538 538 ++hc->wrap_count; … … 856 856 xhci_device_ctx_t *device_ctx = dev->dev_ctx.virt; 857 857 dev->base.address = XHCI_SLOT_DEVICE_ADDRESS(*XHCI_GET_SLOT_CTX(device_ctx, hc)); 858 usb_log_debug 2("Obtained USB address: %d.", dev->base.address);858 usb_log_debug("Obtained USB address: %d.", dev->base.address); 859 859 860 860 return EOK; -
uspace/drv/bus/usb/xhci/isoch.c
r9d3536e rdefaab2 65 65 isoch->buffer_count = max(2, isoch->buffer_count); 66 66 67 usb_log_debug 2("[isoch] isoch setup with %zu buffers", isoch->buffer_count);67 usb_log_debug("[isoch] isoch setup with %zu buffers", isoch->buffer_count); 68 68 } 69 69 … … 311 311 case WINDOW_TOO_SOON: { 312 312 const suseconds_t delay = wd.offset * 125; 313 usb_log_debug 2("[isoch] delaying feeding buffer %lu for %ldus",313 usb_log_debug("[isoch] delaying feeding buffer %lu for %ldus", 314 314 it - isoch->transfers, delay); 315 315 fibril_timer_set_locked(isoch->feeding_timer, delay, … … 319 319 320 320 case WINDOW_INSIDE: 321 usb_log_debug 2("[isoch] feeding buffer %lu at 0x%llx",321 usb_log_debug("[isoch] feeding buffer %lu at 0x%llx", 322 322 it - isoch->transfers, it->mfindex); 323 323 it->error = schedule_isochronous_trb(ep, it); … … 334 334 case WINDOW_TOO_LATE: 335 335 /* Missed the opportunity to schedule. Just mark this transfer as skipped. */ 336 usb_log_debug 2("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes",336 usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes", 337 337 it - isoch->transfers, it->mfindex, wd.offset); 338 338 it->state = ISOCH_COMPLETE; … … 397 397 /* Not allowed to feed yet. Defer to later. */ 398 398 const suseconds_t delay = wd.offset * 125; 399 usb_log_debug 2("[isoch] delaying feeding buffer %lu for %ldus",399 usb_log_debug("[isoch] delaying feeding buffer %lu for %ldus", 400 400 it - isoch->transfers, delay); 401 401 fibril_timer_set_locked(isoch->feeding_timer, delay, … … 405 405 406 406 case WINDOW_TOO_LATE: 407 usb_log_debug 2("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes",407 usb_log_debug("[isoch] missed feeding buffer %lu at 0x%llx by %llu uframes", 408 408 it - isoch->transfers, it->mfindex, wd.offset); 409 409 /* Missed the opportunity to schedule. Schedule ASAP. */ … … 418 418 isoch->last_mf = it->mfindex; 419 419 420 usb_log_debug 2("[isoch] feeding buffer %lu at 0x%llx",420 usb_log_debug("[isoch] feeding buffer %lu at 0x%llx", 421 421 it - isoch->transfers, it->mfindex); 422 422 … … 502 502 calc_next_mfindex(ep, it); 503 503 isoch->last_mf = it->mfindex; 504 usb_log_debug 2("[isoch] buffer %zu will be on schedule at 0x%llx", it - isoch->transfers, it->mfindex);504 usb_log_debug("[isoch] buffer %zu will be on schedule at 0x%llx", it - isoch->transfers, it->mfindex); 505 505 506 506 /* Prepare the transfer. */ … … 543 543 isoch_feed_in(ep); 544 544 545 usb_log_debug 2("[isoch] waiting for buffer %zu to be completed", it - isoch->transfers);545 usb_log_debug("[isoch] waiting for buffer %zu to be completed", it - isoch->transfers); 546 546 fibril_condvar_wait(&isoch->avail, &isoch->guard); 547 547 … … 615 615 616 616 if (it->state == ISOCH_FED && it->interrupt_trb_phys == trb->parameter) { 617 usb_log_debug 2("[isoch] buffer %zu completed", it - isoch->transfers);617 usb_log_debug("[isoch] buffer %zu completed", it - isoch->transfers); 618 618 it->state = ISOCH_COMPLETE; 619 619 it->size -= TRB_TRANSFER_LENGTH(*trb); -
uspace/drv/bus/usb/xhci/scratchpad.c
r9d3536e rdefaab2 80 80 hc->dcbaa[0] = host2xhci(64, hc->scratchpad_array.phys); 81 81 82 usb_log_debug 2("Allocated %d scratchpad buffers.", num_bufs);82 usb_log_debug("Allocated %d scratchpad buffers.", num_bufs); 83 83 84 84 return EOK; -
uspace/drv/bus/usb/xhci/streams.c
r9d3536e rdefaab2 82 82 static int initialize_primary_structures(xhci_endpoint_t *xhci_ep, unsigned count) 83 83 { 84 usb_log_debug 2("Allocating primary stream context array of size %u for endpoint " XHCI_EP_FMT,84 usb_log_debug("Allocating primary stream context array of size %u for endpoint " XHCI_EP_FMT, 85 85 count, XHCI_EP_ARGS(*xhci_ep)); 86 86 … … 106 106 static void clear_primary_structures(xhci_endpoint_t *xhci_ep) 107 107 { 108 usb_log_debug 2("Deallocating primary stream structures for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));108 usb_log_debug("Deallocating primary stream structures for endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 109 109 110 110 dma_buffer_free(&xhci_ep->primary_stream_ctx_dma); … … 133 133 void xhci_stream_free_ds(xhci_endpoint_t *xhci_ep) 134 134 { 135 usb_log_debug 2("Freeing stream rings and context arrays of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep));135 usb_log_debug("Freeing stream rings and context arrays of endpoint " XHCI_EP_FMT, XHCI_EP_ARGS(*xhci_ep)); 136 136 137 137 for (size_t index = 0; index < xhci_ep->primary_stream_data_size; ++index) { -
uspace/drv/bus/usb/xhci/trb_ring.c
r9d3536e rdefaab2 85 85 memset(*segment, 0, PAGE_SIZE); 86 86 (*segment)->phys = dbuf.phys; 87 usb_log_debug 2("Allocated new ring segment.");87 usb_log_debug("Allocated new ring segment."); 88 88 return EOK; 89 89 } … … 247 247 if (TRB_LINK_TC(*ring->enqueue_trb)) { 248 248 ring->pcs = !ring->pcs; 249 usb_log_debug 2("TRB ring(%p): PCS toggled", ring);249 usb_log_debug("TRB ring(%p): PCS toggled", ring); 250 250 } 251 251 -
uspace/lib/usbhost/src/endpoint.c
r9d3536e rdefaab2 203 203 usbhc_iface_transfer_callback_t on_complete, void *arg, const char *name) 204 204 { 205 usb_log_debug2("%s %d:%d %zu(%zu).", 206 name, target.address, target.endpoint, size, ep->max_packet_size); 205 if (!ep) 206 return EBADMEM; 207 208 if (ep->transfer_type == USB_TRANSFER_CONTROL) { 209 usb_log_debug("%s %d:%d %zu/%zuB, setup %#016" PRIx64, name, 210 target.address, target.endpoint, size, ep->max_packet_size, 211 setup_data); 212 } else { 213 usb_log_debug("%s %d:%d %zu/%zuB", name, target.address, 214 target.endpoint, size, ep->max_packet_size); 215 } 207 216 208 217 device_t * const device = ep->device;
Note:
See TracChangeset
for help on using the changeset viewer.