Lines Matching +full:4 +full:- +full:temp
1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (c) 2001-2002 by David Brownell
6 /* this file is part of ehci-hcd.c */
13 * see EHCI spec, Table 2-4 for each value
17 u32 params = ehci_readl(ehci, &ehci->caps->hcs_params); in dbg_hcs_params()
37 byte = readb(&ehci->caps->portroute[(i >> 1)]); in dbg_hcs_params()
39 (i & 0x1) ? byte & 0xf : (byte >> 4) & 0xf); in dbg_hcs_params()
49 * see EHCI Spec, Table 2-5 for each value
53 u32 params = ehci_readl(ehci, &ehci->caps->hcc_params); in dbg_hcc_params()
83 hc32_to_cpup(ehci, &qtd->hw_next), in dbg_qtd()
84 hc32_to_cpup(ehci, &qtd->hw_alt_next), in dbg_qtd()
85 hc32_to_cpup(ehci, &qtd->hw_token), in dbg_qtd()
86 hc32_to_cpup(ehci, &qtd->hw_buf[0])); in dbg_qtd()
87 if (qtd->hw_buf[1]) in dbg_qtd()
89 hc32_to_cpup(ehci, &qtd->hw_buf[1]), in dbg_qtd()
90 hc32_to_cpup(ehci, &qtd->hw_buf[2]), in dbg_qtd()
91 hc32_to_cpup(ehci, &qtd->hw_buf[3]), in dbg_qtd()
92 hc32_to_cpup(ehci, &qtd->hw_buf[4])); in dbg_qtd()
98 struct ehci_qh_hw *hw = qh->hw; in dbg_qh()
101 qh, hw->hw_next, hw->hw_info1, hw->hw_info2, hw->hw_current); in dbg_qh()
102 dbg_qtd("overlay", ehci, (struct ehci_qtd *) &hw->hw_qtd_next); in dbg_qh()
109 label, itd->frame, itd, hc32_to_cpu(ehci, itd->hw_next), in dbg_itd()
110 itd->urb); in dbg_itd()
113 hc32_to_cpu(ehci, itd->hw_transaction[0]), in dbg_itd()
114 hc32_to_cpu(ehci, itd->hw_transaction[1]), in dbg_itd()
115 hc32_to_cpu(ehci, itd->hw_transaction[2]), in dbg_itd()
116 hc32_to_cpu(ehci, itd->hw_transaction[3]), in dbg_itd()
117 hc32_to_cpu(ehci, itd->hw_transaction[4]), in dbg_itd()
118 hc32_to_cpu(ehci, itd->hw_transaction[5]), in dbg_itd()
119 hc32_to_cpu(ehci, itd->hw_transaction[6]), in dbg_itd()
120 hc32_to_cpu(ehci, itd->hw_transaction[7])); in dbg_itd()
123 hc32_to_cpu(ehci, itd->hw_bufp[0]), in dbg_itd()
124 hc32_to_cpu(ehci, itd->hw_bufp[1]), in dbg_itd()
125 hc32_to_cpu(ehci, itd->hw_bufp[2]), in dbg_itd()
126 hc32_to_cpu(ehci, itd->hw_bufp[3]), in dbg_itd()
127 hc32_to_cpu(ehci, itd->hw_bufp[4]), in dbg_itd()
128 hc32_to_cpu(ehci, itd->hw_bufp[5]), in dbg_itd()
129 hc32_to_cpu(ehci, itd->hw_bufp[6])); in dbg_itd()
131 itd->index[0], itd->index[1], itd->index[2], in dbg_itd()
132 itd->index[3], itd->index[4], itd->index[5], in dbg_itd()
133 itd->index[6], itd->index[7]); in dbg_itd()
140 label, sitd->frame, sitd, hc32_to_cpu(ehci, sitd->hw_next), in dbg_sitd()
141 sitd->urb); in dbg_sitd()
144 hc32_to_cpu(ehci, sitd->hw_fullspeed_ep), in dbg_sitd()
145 hc32_to_cpu(ehci, sitd->hw_uframe), in dbg_sitd()
146 hc32_to_cpu(ehci, sitd->hw_results), in dbg_sitd()
147 hc32_to_cpu(ehci, sitd->hw_buf[0]), in dbg_sitd()
148 hc32_to_cpu(ehci, sitd->hw_buf[1])); in dbg_sitd()
287 /*-------------------------------------------------------------------------*/
363 return '-'; in token_mark()
377 unsigned temp; in qh_lines() local
382 struct ehci_qh_hw *hw = qh->hw; in qh_lines()
384 if (hw->hw_qtd_next == list_end) /* NEC does this */ in qh_lines()
387 mark = token_mark(ehci, hw->hw_token); in qh_lines()
389 if ((hw->hw_alt_next & QTD_MASK(ehci)) in qh_lines()
390 == ehci->async->hw->hw_alt_next) in qh_lines()
392 else if (hw->hw_alt_next == list_end) in qh_lines()
396 scratch = hc32_to_cpup(ehci, &hw->hw_info1); in qh_lines()
397 hw_curr = (mark == '*') ? hc32_to_cpup(ehci, &hw->hw_current) : 0; in qh_lines()
398 temp = scnprintf(next, size, in qh_lines()
404 scratch, hc32_to_cpup(ehci, &hw->hw_info2), in qh_lines()
405 hc32_to_cpup(ehci, &hw->hw_token), mark, in qh_lines()
406 (cpu_to_hc32(ehci, QTD_TOGGLE) & hw->hw_token) in qh_lines()
408 (hc32_to_cpup(ehci, &hw->hw_alt_next) >> 1) & 0x0f, in qh_lines()
409 hc32_to_cpup(ehci, &hw->hw_current), in qh_lines()
410 hc32_to_cpup(ehci, &hw->hw_qtd_next), in qh_lines()
411 hc32_to_cpup(ehci, &hw->hw_buf[0])); in qh_lines()
412 size -= temp; in qh_lines()
413 next += temp; in qh_lines()
416 list_for_each(entry, &qh->qtd_list) { in qh_lines()
420 scratch = hc32_to_cpup(ehci, &td->hw_token); in qh_lines()
422 if (hw_curr == td->qtd_dma) { in qh_lines()
424 } else if (hw->hw_qtd_next == cpu_to_hc32(ehci, td->qtd_dma)) { in qh_lines()
427 if (td->hw_alt_next == ehci->async->hw->hw_alt_next) in qh_lines()
429 else if (td->hw_alt_next != list_end) in qh_lines()
446 temp = scnprintf(next, size, in qh_lines()
452 td->urb, in qh_lines()
453 (u32) td->qtd_dma, in qh_lines()
454 hc32_to_cpup(ehci, &td->hw_buf[0])); in qh_lines()
455 size -= temp; in qh_lines()
456 next += temp; in qh_lines()
457 if (temp == size) in qh_lines()
461 temp = scnprintf(next, size, "\n"); in qh_lines()
462 size -= temp; in qh_lines()
463 next += temp; in qh_lines()
475 unsigned temp, size; in fill_async_buffer() local
479 hcd = bus_to_hcd(buf->bus); in fill_async_buffer()
481 next = buf->output_buf; in fill_async_buffer()
482 size = buf->alloc_size; in fill_async_buffer()
488 * usually empty except for long-term bulk reads, or head. in fill_async_buffer()
491 spin_lock_irqsave(&ehci->lock, flags); in fill_async_buffer()
492 for (qh = ehci->async->qh_next.qh; size > 0 && qh; qh = qh->qh_next.qh) in fill_async_buffer()
494 if (!list_empty(&ehci->async_unlink) && size > 0) { in fill_async_buffer()
495 temp = scnprintf(next, size, "\nunlink =\n"); in fill_async_buffer()
496 size -= temp; in fill_async_buffer()
497 next += temp; in fill_async_buffer()
499 list_for_each_entry(qh, &ehci->async_unlink, unlink_node) { in fill_async_buffer()
505 spin_unlock_irqrestore(&ehci->lock, flags); in fill_async_buffer()
507 return strlen(buf->output_buf); in fill_async_buffer()
515 unsigned temp, size; in fill_bandwidth_buffer() local
522 ehci = hcd_to_ehci(bus_to_hcd(buf->bus)); in fill_bandwidth_buffer()
523 next = buf->output_buf; in fill_bandwidth_buffer()
524 size = buf->alloc_size; in fill_bandwidth_buffer()
528 spin_lock_irq(&ehci->lock); in fill_bandwidth_buffer()
531 temp = scnprintf(next, size, in fill_bandwidth_buffer()
533 size -= temp; in fill_bandwidth_buffer()
534 next += temp; in fill_bandwidth_buffer()
536 bw = &ehci->bandwidth[i]; in fill_bandwidth_buffer()
537 temp = scnprintf(next, size, in fill_bandwidth_buffer()
538 "%2u: %4u%4u%4u%4u%4u%4u%4u%4u\n", in fill_bandwidth_buffer()
540 bw[4], bw[5], bw[6], bw[7]); in fill_bandwidth_buffer()
541 size -= temp; in fill_bandwidth_buffer()
542 next += temp; in fill_bandwidth_buffer()
546 list_for_each_entry(tt, &ehci->tt_list, tt_list) { in fill_bandwidth_buffer()
547 temp = scnprintf(next, size, in fill_bandwidth_buffer()
549 dev_name(&tt->usb_tt->hub->dev), in fill_bandwidth_buffer()
550 tt->tt_port + !!tt->usb_tt->multi); in fill_bandwidth_buffer()
551 size -= temp; in fill_bandwidth_buffer()
552 next += temp; in fill_bandwidth_buffer()
554 bf = tt->bandwidth; in fill_bandwidth_buffer()
555 temp = scnprintf(next, size, in fill_bandwidth_buffer()
558 bf[4], bf[5], bf[6], bf[7]); in fill_bandwidth_buffer()
559 size -= temp; in fill_bandwidth_buffer()
560 next += temp; in fill_bandwidth_buffer()
562 temp = scnprintf(next, size, in fill_bandwidth_buffer()
564 size -= temp; in fill_bandwidth_buffer()
565 next += temp; in fill_bandwidth_buffer()
569 temp = scnprintf(next, size, in fill_bandwidth_buffer()
570 "%2u: %4u%4u%4u%4u%4u%4u%4u%4u\n", in fill_bandwidth_buffer()
572 bw[4], bw[5], bw[6], bw[7]); in fill_bandwidth_buffer()
573 size -= temp; in fill_bandwidth_buffer()
574 next += temp; in fill_bandwidth_buffer()
576 list_for_each_entry(ps, &tt->ps_list, ps_list) { in fill_bandwidth_buffer()
577 temp = scnprintf(next, size, in fill_bandwidth_buffer()
578 "%s ep %02x: %4u @ %2u.%u+%u mask %04x\n", in fill_bandwidth_buffer()
579 dev_name(&ps->udev->dev), in fill_bandwidth_buffer()
580 ps->ep->desc.bEndpointAddress, in fill_bandwidth_buffer()
581 ps->tt_usecs, in fill_bandwidth_buffer()
582 ps->bw_phase, ps->phase_uf, in fill_bandwidth_buffer()
583 ps->bw_period, ps->cs_mask); in fill_bandwidth_buffer()
584 size -= temp; in fill_bandwidth_buffer()
585 next += temp; in fill_bandwidth_buffer()
588 spin_unlock_irq(&ehci->lock); in fill_bandwidth_buffer()
590 return next - buf->output_buf; in fill_bandwidth_buffer()
596 u32 scratch = hc32_to_cpup(ehci, &hw->hw_info1); in output_buf_tds_dir()
599 unsigned temp = 0; in output_buf_tds_dir() local
602 list_for_each_entry(qtd, &qh->qtd_list, qtd_list) { in output_buf_tds_dir()
603 temp++; in output_buf_tds_dir()
604 switch ((hc32_to_cpu(ehci, qtd->hw_token) >> 8) & 0x03) { in output_buf_tds_dir()
616 (scratch >> 8) & 0x000f, type, qh->ps.usecs, in output_buf_tds_dir()
617 qh->ps.c_usecs, temp, 0x7ff & (scratch >> 16)); in output_buf_tds_dir()
627 unsigned temp, size, seen_count; in fill_periodic_buffer() local
637 hcd = bus_to_hcd(buf->bus); in fill_periodic_buffer()
639 next = buf->output_buf; in fill_periodic_buffer()
640 size = buf->alloc_size; in fill_periodic_buffer()
642 temp = scnprintf(next, size, "size = %d\n", ehci->periodic_size); in fill_periodic_buffer()
643 size -= temp; in fill_periodic_buffer()
644 next += temp; in fill_periodic_buffer()
650 spin_lock_irqsave(&ehci->lock, flags); in fill_periodic_buffer()
651 for (i = 0; i < ehci->periodic_size; i++) { in fill_periodic_buffer()
652 p = ehci->pshadow[i]; in fill_periodic_buffer()
655 tag = Q_NEXT_TYPE(ehci, ehci->periodic[i]); in fill_periodic_buffer()
657 temp = scnprintf(next, size, "%4d: ", i); in fill_periodic_buffer()
658 size -= temp; in fill_periodic_buffer()
659 next += temp; in fill_periodic_buffer()
666 hw = p.qh->hw; in fill_periodic_buffer()
667 temp = scnprintf(next, size, " qh%d-%04x/%p", in fill_periodic_buffer()
668 p.qh->ps.period, in fill_periodic_buffer()
670 &hw->hw_info2) in fill_periodic_buffer()
674 size -= temp; in fill_periodic_buffer()
675 next += temp; in fill_periodic_buffer()
677 for (temp = 0; temp < seen_count; temp++) { in fill_periodic_buffer()
678 if (seen[temp].ptr != p.ptr) in fill_periodic_buffer()
680 if (p.qh->qh_next.ptr) { in fill_periodic_buffer()
681 temp = scnprintf(next, size, in fill_periodic_buffer()
683 size -= temp; in fill_periodic_buffer()
684 next += temp; in fill_periodic_buffer()
689 if (temp == seen_count) { in fill_periodic_buffer()
690 temp = output_buf_tds_dir(next, ehci, in fill_periodic_buffer()
696 temp = 0; in fill_periodic_buffer()
698 tag = Q_NEXT_TYPE(ehci, hw->hw_next); in fill_periodic_buffer()
699 p = p.qh->qh_next; in fill_periodic_buffer()
702 temp = scnprintf(next, size, in fill_periodic_buffer()
703 " fstn-%8x/%p", p.fstn->hw_prev, in fill_periodic_buffer()
705 tag = Q_NEXT_TYPE(ehci, p.fstn->hw_next); in fill_periodic_buffer()
706 p = p.fstn->fstn_next; in fill_periodic_buffer()
709 temp = scnprintf(next, size, in fill_periodic_buffer()
711 tag = Q_NEXT_TYPE(ehci, p.itd->hw_next); in fill_periodic_buffer()
712 p = p.itd->itd_next; in fill_periodic_buffer()
715 temp = scnprintf(next, size, in fill_periodic_buffer()
716 " sitd%d-%04x/%p", in fill_periodic_buffer()
717 p.sitd->stream->ps.period, in fill_periodic_buffer()
718 hc32_to_cpup(ehci, &p.sitd->hw_uframe) in fill_periodic_buffer()
721 tag = Q_NEXT_TYPE(ehci, p.sitd->hw_next); in fill_periodic_buffer()
722 p = p.sitd->sitd_next; in fill_periodic_buffer()
725 size -= temp; in fill_periodic_buffer()
726 next += temp; in fill_periodic_buffer()
729 temp = scnprintf(next, size, "\n"); in fill_periodic_buffer()
730 size -= temp; in fill_periodic_buffer()
731 next += temp; in fill_periodic_buffer()
733 spin_unlock_irqrestore(&ehci->lock, flags); in fill_periodic_buffer()
736 return buf->alloc_size - size; in fill_periodic_buffer()
742 switch (ehci->rh_state) { in rh_state_string()
760 unsigned temp, size, i; in fill_registers_buffer() local
765 hcd = bus_to_hcd(buf->bus); in fill_registers_buffer()
767 next = buf->output_buf; in fill_registers_buffer()
768 size = buf->alloc_size; in fill_registers_buffer()
770 spin_lock_irqsave(&ehci->lock, flags); in fill_registers_buffer()
777 hcd->self.controller->bus->name, in fill_registers_buffer()
778 dev_name(hcd->self.controller), in fill_registers_buffer()
779 hcd->product_desc); in fill_registers_buffer()
784 i = HC_VERSION(ehci, ehci_readl(ehci, &ehci->caps->hc_capbase)); in fill_registers_buffer()
785 temp = scnprintf(next, size, in fill_registers_buffer()
789 hcd->self.controller->bus->name, in fill_registers_buffer()
790 dev_name(hcd->self.controller), in fill_registers_buffer()
791 hcd->product_desc, in fill_registers_buffer()
793 size -= temp; in fill_registers_buffer()
794 next += temp; in fill_registers_buffer()
798 if (dev_is_pci(hcd->self.controller)) { in fill_registers_buffer()
801 unsigned count = 256 / 4; in fill_registers_buffer()
803 pdev = to_pci_dev(ehci_to_hcd(ehci)->self.controller); in fill_registers_buffer()
805 &ehci->caps->hcc_params)); in fill_registers_buffer()
806 while (offset && count--) { in fill_registers_buffer()
810 temp = scnprintf(next, size, in fill_registers_buffer()
814 size -= temp; in fill_registers_buffer()
815 next += temp; in fill_registers_buffer()
817 offset += 4; in fill_registers_buffer()
819 temp = scnprintf(next, size, in fill_registers_buffer()
821 size -= temp; in fill_registers_buffer()
822 next += temp; in fill_registers_buffer()
836 i = ehci_readl(ehci, &ehci->caps->hcs_params); in fill_registers_buffer()
837 temp = scnprintf(next, size, "structural params 0x%08x\n", i); in fill_registers_buffer()
838 size -= temp; in fill_registers_buffer()
839 next += temp; in fill_registers_buffer()
841 i = ehci_readl(ehci, &ehci->caps->hcc_params); in fill_registers_buffer()
842 temp = scnprintf(next, size, "capability params 0x%08x\n", i); in fill_registers_buffer()
843 size -= temp; in fill_registers_buffer()
844 next += temp; in fill_registers_buffer()
847 temp = dbg_status_buf(scratch, sizeof(scratch), label, in fill_registers_buffer()
848 ehci_readl(ehci, &ehci->regs->status)); in fill_registers_buffer()
849 temp = scnprintf(next, size, fmt, temp, scratch); in fill_registers_buffer()
850 size -= temp; in fill_registers_buffer()
851 next += temp; in fill_registers_buffer()
853 temp = dbg_command_buf(scratch, sizeof(scratch), label, in fill_registers_buffer()
854 ehci_readl(ehci, &ehci->regs->command)); in fill_registers_buffer()
855 temp = scnprintf(next, size, fmt, temp, scratch); in fill_registers_buffer()
856 size -= temp; in fill_registers_buffer()
857 next += temp; in fill_registers_buffer()
859 temp = dbg_intr_buf(scratch, sizeof(scratch), label, in fill_registers_buffer()
860 ehci_readl(ehci, &ehci->regs->intr_enable)); in fill_registers_buffer()
861 temp = scnprintf(next, size, fmt, temp, scratch); in fill_registers_buffer()
862 size -= temp; in fill_registers_buffer()
863 next += temp; in fill_registers_buffer()
865 temp = scnprintf(next, size, "uframe %04x\n", in fill_registers_buffer()
867 size -= temp; in fill_registers_buffer()
868 next += temp; in fill_registers_buffer()
870 for (i = 1; i <= HCS_N_PORTS(ehci->hcs_params); i++) { in fill_registers_buffer()
871 temp = dbg_port_buf(scratch, sizeof(scratch), label, i, in fill_registers_buffer()
873 &ehci->regs->port_status[i - 1])); in fill_registers_buffer()
874 temp = scnprintf(next, size, fmt, temp, scratch); in fill_registers_buffer()
875 size -= temp; in fill_registers_buffer()
876 next += temp; in fill_registers_buffer()
877 if (i == HCS_DEBUG_PORT(ehci->hcs_params) && ehci->debug) { in fill_registers_buffer()
878 temp = scnprintf(next, size, in fill_registers_buffer()
881 &ehci->debug->control)); in fill_registers_buffer()
882 size -= temp; in fill_registers_buffer()
883 next += temp; in fill_registers_buffer()
887 if (!list_empty(&ehci->async_unlink)) { in fill_registers_buffer()
888 temp = scnprintf(next, size, "async unlink qh %p\n", in fill_registers_buffer()
889 list_first_entry(&ehci->async_unlink, in fill_registers_buffer()
891 size -= temp; in fill_registers_buffer()
892 next += temp; in fill_registers_buffer()
896 temp = scnprintf(next, size, in fill_registers_buffer()
898 ehci->stats.normal, ehci->stats.error, ehci->stats.iaa, in fill_registers_buffer()
899 ehci->stats.lost_iaa); in fill_registers_buffer()
900 size -= temp; in fill_registers_buffer()
901 next += temp; in fill_registers_buffer()
903 temp = scnprintf(next, size, "complete %ld unlink %ld\n", in fill_registers_buffer()
904 ehci->stats.complete, ehci->stats.unlink); in fill_registers_buffer()
905 size -= temp; in fill_registers_buffer()
906 next += temp; in fill_registers_buffer()
910 spin_unlock_irqrestore(&ehci->lock, flags); in fill_registers_buffer()
912 return buf->alloc_size - size; in fill_registers_buffer()
923 buf->bus = bus; in alloc_buffer()
924 buf->fill_func = fill_func; in alloc_buffer()
925 mutex_init(&buf->mutex); in alloc_buffer()
926 buf->alloc_size = PAGE_SIZE; in alloc_buffer()
936 if (!buf->output_buf) in fill_buffer()
937 buf->output_buf = vmalloc(buf->alloc_size); in fill_buffer()
939 if (!buf->output_buf) { in fill_buffer()
940 ret = -ENOMEM; in fill_buffer()
944 ret = buf->fill_func(buf); in fill_buffer()
947 buf->count = ret; in fill_buffer()
958 struct debug_buffer *buf = file->private_data; in debug_output()
961 mutex_lock(&buf->mutex); in debug_output()
962 if (buf->count == 0) { in debug_output()
965 mutex_unlock(&buf->mutex); in debug_output()
969 mutex_unlock(&buf->mutex); in debug_output()
972 buf->output_buf, buf->count); in debug_output()
980 struct debug_buffer *buf = file->private_data; in debug_close()
983 vfree(buf->output_buf); in debug_close()
992 file->private_data = alloc_buffer(inode->i_private, fill_async_buffer); in debug_async_open()
994 return file->private_data ? 0 : -ENOMEM; in debug_async_open()
999 file->private_data = alloc_buffer(inode->i_private, in debug_bandwidth_open()
1002 return file->private_data ? 0 : -ENOMEM; in debug_bandwidth_open()
1009 buf = alloc_buffer(inode->i_private, fill_periodic_buffer); in debug_periodic_open()
1011 return -ENOMEM; in debug_periodic_open()
1013 buf->alloc_size = (sizeof(void *) == 4 ? 6 : 8) * PAGE_SIZE; in debug_periodic_open()
1014 file->private_data = buf; in debug_periodic_open()
1020 file->private_data = alloc_buffer(inode->i_private, in debug_registers_open()
1023 return file->private_data ? 0 : -ENOMEM; in debug_registers_open()
1028 struct usb_bus *bus = &ehci_to_hcd(ehci)->self; in create_debug_files()
1030 ehci->debug_dir = debugfs_create_dir(bus->bus_name, ehci_debug_root); in create_debug_files()
1032 debugfs_create_file("async", S_IRUGO, ehci->debug_dir, bus, in create_debug_files()
1034 debugfs_create_file("bandwidth", S_IRUGO, ehci->debug_dir, bus, in create_debug_files()
1036 debugfs_create_file("periodic", S_IRUGO, ehci->debug_dir, bus, in create_debug_files()
1038 debugfs_create_file("registers", S_IRUGO, ehci->debug_dir, bus, in create_debug_files()
1044 debugfs_remove_recursive(ehci->debug_dir); in remove_debug_files()