Lines Matching +full:x +full:- +full:size
1 // SPDX-License-Identifier: GPL-1.0+
6 * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
11 /*-------------------------------------------------------------------------*/
23 #define ohci_dbg_sw(ohci, next, size, format, arg...) \ argument
27 s_len = scnprintf (*next, *size, format, ## arg ); \
28 *size -= s_len; *next += s_len; \
34 #define ohci_dbg_nosw(ohci, next, size, format, arg...) \ argument
37 s_len = scnprintf(*next, *size, format, ## arg); \
38 *size -= s_len; *next += s_len; \
47 unsigned *size) in ohci_dump_intr_mask() argument
49 ohci_dbg_sw (ohci, next, size, "%s 0x%08x%s%s%s%s%s%s%s%s%s\n", in ohci_dump_intr_mask()
69 unsigned *size) in maybe_print_eds() argument
72 ohci_dbg_sw (ohci, next, size, "%s %08x\n", label, value); in maybe_print_eds()
88 switch (ohci->rh_state) { in rh_state_string()
101 ohci_dump_status (struct ohci_hcd *controller, char **next, unsigned *size) in ohci_dump_status() argument
103 struct ohci_regs __iomem *regs = controller->regs; in ohci_dump_status()
106 temp = ohci_readl (controller, ®s->revision) & 0xff; in ohci_dump_status()
107 ohci_dbg_sw (controller, next, size, in ohci_dump_status()
113 temp = ohci_readl (controller, ®s->control); in ohci_dump_status()
114 ohci_dbg_sw (controller, next, size, in ohci_dump_status()
115 "control 0x%03x%s%s%s HCFS=%s%s%s%s%s CBSR=%d\n", in ohci_dump_status()
128 temp = ohci_readl (controller, ®s->cmdstatus); in ohci_dump_status()
129 ohci_dbg_sw (controller, next, size, in ohci_dump_status()
130 "cmdstatus 0x%05x SOC=%d%s%s%s%s\n", temp, in ohci_dump_status()
139 ohci_readl (controller, ®s->intrstatus), in ohci_dump_status()
140 next, size); in ohci_dump_status()
142 ohci_readl (controller, ®s->intrenable), in ohci_dump_status()
143 next, size); in ohci_dump_status()
147 ohci_readl (controller, ®s->ed_periodcurrent), in ohci_dump_status()
148 next, size); in ohci_dump_status()
151 ohci_readl (controller, ®s->ed_controlhead), in ohci_dump_status()
152 next, size); in ohci_dump_status()
154 ohci_readl (controller, ®s->ed_controlcurrent), in ohci_dump_status()
155 next, size); in ohci_dump_status()
158 ohci_readl (controller, ®s->ed_bulkhead), in ohci_dump_status()
159 next, size); in ohci_dump_status()
161 ohci_readl (controller, ®s->ed_bulkcurrent), in ohci_dump_status()
162 next, size); in ohci_dump_status()
165 ohci_readl (controller, ®s->donehead), next, size); in ohci_dump_status()
168 #define dbg_port_sw(hc,num,value,next,size) \ argument
169 ohci_dbg_sw (hc, next, size, \
171 "0x%08x%s%s%s%s%s%s%s%s%s%s%s%s\n", \
195 unsigned *size) in ohci_dump_roothub() argument
204 ohci_dbg_sw (controller, next, size, in ohci_dump_roothub()
205 "roothub.a %08x POTPGT=%d%s%s%s%s%s NDP=%d(%d)\n", temp, in ohci_dump_roothub()
212 (temp & RH_A_NDP), controller->num_ports in ohci_dump_roothub()
215 ohci_dbg_sw (controller, next, size, in ohci_dump_roothub()
216 "roothub.b %08x PPCM=%04x DR=%04x\n", in ohci_dump_roothub()
222 ohci_dbg_sw (controller, next, size, in ohci_dump_roothub()
223 "roothub.status %08x%s%s%s%s%s%s\n", in ohci_dump_roothub()
234 for (i = 0; i < controller->num_ports; i++) { in ohci_dump_roothub()
236 dbg_port_sw (controller, i, temp, next, size); in ohci_dump_roothub()
246 if (controller->hcca) in ohci_dump()
248 "hcca frame #%04x\n", ohci_frame_no(controller)); in ohci_dump()
258 u32 tmp = hc32_to_cpup (ohci, &td->hwINFO); in ohci_dump_td()
260 ohci_dbg (ohci, "%s td %p%s; urb %p index %d; hw next td %08x\n", in ohci_dump_td()
263 td->urb, td->index, in ohci_dump_td()
264 hc32_to_cpup (ohci, &td->hwNextTD)); in ohci_dump_td()
281 ohci_dbg (ohci, " info %08x CC=%x %s DI=%d %s %s\n", tmp, in ohci_dump_td()
285 cbp = hc32_to_cpup (ohci, &td->hwCBP); in ohci_dump_td()
286 be = hc32_to_cpup (ohci, &td->hwBE); in ohci_dump_td()
287 ohci_dbg (ohci, " cbp %08x be %08x (len %d)\n", cbp, be, in ohci_dump_td()
288 cbp ? (be + 1 - cbp) : 0); in ohci_dump_td()
291 ohci_dbg (ohci, " info %08x CC=%x FC=%d DI=%d SF=%04x\n", tmp, in ohci_dump_td()
296 ohci_dbg (ohci, " bp0 %08x be %08x\n", in ohci_dump_td()
297 hc32_to_cpup (ohci, &td->hwCBP) & ~0x0fff, in ohci_dump_td()
298 hc32_to_cpup (ohci, &td->hwBE)); in ohci_dump_td()
302 ohci_dbg (ohci, " psw [%d] = %2x, CC=%x %s=%d\n", i, in ohci_dump_td()
304 (cc >= 0x0e) ? "OFFSET" : "SIZE", in ohci_dump_td()
315 u32 tmp = hc32_to_cpu (ohci, ed->hwINFO); in ohci_dump_ed()
318 ohci_dbg (ohci, "%s, ed %p state 0x%x type %s; next ed %08x\n", in ohci_dump_ed()
320 ed, ed->state, edstring (ed->type), in ohci_dump_ed()
321 hc32_to_cpup (ohci, &ed->hwNextED)); in ohci_dump_ed()
323 case ED_OUT: type = "-OUT"; break; in ohci_dump_ed()
324 case ED_IN: type = "-IN"; break; in ohci_dump_ed()
328 " info %08x MAX=%d%s%s%s%s EP=%d%s DEV=%d\n", tmp, in ohci_dump_ed()
337 tmp = hc32_to_cpup (ohci, &ed->hwHeadP); in ohci_dump_ed()
338 ohci_dbg (ohci, " tds: head %08x %s%s tail %08x%s\n", in ohci_dump_ed()
342 hc32_to_cpup (ohci, &ed->hwTailP), in ohci_dump_ed()
347 /* use ed->td_list because HC concurrently modifies in ohci_dump_ed()
350 list_for_each (tmp, &ed->td_list) { in ohci_dump_ed()
353 ohci_dump_td (ohci, " ->", td); in ohci_dump_ed()
358 /*-------------------------------------------------------------------------*/
402 unsigned temp, size = count; in show_list() local
407 /* print first --> last */ in show_list()
408 while (ed->ed_prev) in show_list()
409 ed = ed->ed_prev; in show_list()
413 u32 info = hc32_to_cpu (ohci, ed->hwINFO); in show_list()
414 u32 headp = hc32_to_cpu (ohci, ed->hwHeadP); in show_list()
418 temp = scnprintf (buf, size, in show_list()
419 "ed/%p %cs dev%d ep%d%s max %d %08x%s%s %s", in show_list()
430 size -= temp; in show_list()
433 list_for_each (entry, &ed->td_list) { in show_list()
437 info = hc32_to_cpup (ohci, &td->hwINFO); in show_list()
438 cbp = hc32_to_cpup (ohci, &td->hwCBP); in show_list()
439 be = hc32_to_cpup (ohci, &td->hwBE); in show_list()
440 temp = scnprintf (buf, size, in show_list()
441 "\n\ttd %p %s %d cc=%x urb %p (%08x)", in show_list()
450 cbp ? (be + 1 - cbp) : 0, in show_list()
451 TD_CC_GET (info), td->urb, info); in show_list()
452 size -= temp; in show_list()
456 temp = scnprintf (buf, size, "\n"); in show_list()
457 size -= temp; in show_list()
460 ed = ed->ed_next; in show_list()
462 return count - size; in show_list()
468 size_t temp, size; in fill_async_buffer() local
471 ohci = buf->ohci; in fill_async_buffer()
472 size = PAGE_SIZE; in fill_async_buffer()
475 spin_lock_irqsave (&ohci->lock, flags); in fill_async_buffer()
476 temp = show_list(ohci, buf->page, size, ohci->ed_controltail); in fill_async_buffer()
477 temp += show_list(ohci, buf->page + temp, size - temp, in fill_async_buffer()
478 ohci->ed_bulktail); in fill_async_buffer()
479 spin_unlock_irqrestore (&ohci->lock, flags); in fill_async_buffer()
491 unsigned temp, size, seen_count; in fill_periodic_buffer() local
500 ohci = buf->ohci; in fill_periodic_buffer()
501 next = buf->page; in fill_periodic_buffer()
502 size = PAGE_SIZE; in fill_periodic_buffer()
504 temp = scnprintf (next, size, "size = %d\n", NUM_INTS); in fill_periodic_buffer()
505 size -= temp; in fill_periodic_buffer()
509 spin_lock_irqsave (&ohci->lock, flags); in fill_periodic_buffer()
511 ed = ohci->periodic[i]; in fill_periodic_buffer()
515 temp = scnprintf (next, size, "%2d [%3d]:", i, ohci->load [i]); in fill_periodic_buffer()
516 size -= temp; in fill_periodic_buffer()
520 temp = scnprintf (next, size, " ed%d/%p", in fill_periodic_buffer()
521 ed->interval, ed); in fill_periodic_buffer()
522 size -= temp; in fill_periodic_buffer()
531 u32 info = hc32_to_cpu (ohci, ed->hwINFO); in fill_periodic_buffer()
536 list_for_each (entry, &ed->td_list) in fill_periodic_buffer()
539 temp = scnprintf (next, size, in fill_periodic_buffer()
540 " (%cs dev%d ep%d%s-%s qlen %u" in fill_periodic_buffer()
541 " max %d %08x%s%s)", in fill_periodic_buffer()
551 (ed->hwHeadP & in fill_periodic_buffer()
554 size -= temp; in fill_periodic_buffer()
560 ed = ed->ed_next; in fill_periodic_buffer()
570 temp = scnprintf (next, size, "\n"); in fill_periodic_buffer()
571 size -= temp; in fill_periodic_buffer()
574 spin_unlock_irqrestore (&ohci->lock, flags); in fill_periodic_buffer()
577 return PAGE_SIZE - size; in fill_periodic_buffer()
587 unsigned temp, size; in fill_registers_buffer() local
591 ohci = buf->ohci; in fill_registers_buffer()
593 regs = ohci->regs; in fill_registers_buffer()
594 next = buf->page; in fill_registers_buffer()
595 size = PAGE_SIZE; in fill_registers_buffer()
597 spin_lock_irqsave (&ohci->lock, flags); in fill_registers_buffer()
601 ohci_dbg_nosw(ohci, &next, &size, in fill_registers_buffer()
605 hcd->self.controller->bus->name, in fill_registers_buffer()
606 dev_name(hcd->self.controller), in fill_registers_buffer()
607 hcd->product_desc, in fill_registers_buffer()
611 size -= scnprintf (next, size, in fill_registers_buffer()
616 ohci_dump_status(ohci, &next, &size); in fill_registers_buffer()
619 if (ohci->hcca) in fill_registers_buffer()
620 ohci_dbg_nosw(ohci, &next, &size, in fill_registers_buffer()
621 "hcca frame 0x%04x\n", ohci_frame_no(ohci)); in fill_registers_buffer()
624 rdata = ohci_readl (ohci, ®s->fminterval); in fill_registers_buffer()
625 temp = scnprintf (next, size, in fill_registers_buffer()
626 "fmintvl 0x%08x %sFSMPS=0x%04x FI=0x%04x\n", in fill_registers_buffer()
629 size -= temp; in fill_registers_buffer()
632 rdata = ohci_readl (ohci, ®s->fmremaining); in fill_registers_buffer()
633 temp = scnprintf (next, size, "fmremaining 0x%08x %sFR=0x%04x\n", in fill_registers_buffer()
636 size -= temp; in fill_registers_buffer()
639 rdata = ohci_readl (ohci, ®s->periodicstart); in fill_registers_buffer()
640 temp = scnprintf (next, size, "periodicstart 0x%04x\n", in fill_registers_buffer()
642 size -= temp; in fill_registers_buffer()
645 rdata = ohci_readl (ohci, ®s->lsthresh); in fill_registers_buffer()
646 temp = scnprintf (next, size, "lsthresh 0x%04x\n", in fill_registers_buffer()
648 size -= temp; in fill_registers_buffer()
651 temp = scnprintf (next, size, "hub poll timer %s\n", in fill_registers_buffer()
653 size -= temp; in fill_registers_buffer()
657 ohci_dump_roothub (ohci, 1, &next, &size); in fill_registers_buffer()
660 spin_unlock_irqrestore (&ohci->lock, flags); in fill_registers_buffer()
662 return PAGE_SIZE - size; in fill_registers_buffer()
673 buf->ohci = ohci; in alloc_buffer()
674 buf->fill_func = fill_func; in alloc_buffer()
675 mutex_init(&buf->mutex); in alloc_buffer()
685 if (!buf->page) in fill_buffer()
686 buf->page = (char *)get_zeroed_page(GFP_KERNEL); in fill_buffer()
688 if (!buf->page) { in fill_buffer()
689 ret = -ENOMEM; in fill_buffer()
693 ret = buf->fill_func(buf); in fill_buffer()
696 buf->count = ret; in fill_buffer()
707 struct debug_buffer *buf = file->private_data; in debug_output()
710 mutex_lock(&buf->mutex); in debug_output()
711 if (buf->count == 0) { in debug_output()
714 mutex_unlock(&buf->mutex); in debug_output()
718 mutex_unlock(&buf->mutex); in debug_output()
721 buf->page, buf->count); in debug_output()
730 struct debug_buffer *buf = file->private_data; in debug_close()
733 if (buf->page) in debug_close()
734 free_page((unsigned long)buf->page); in debug_close()
742 file->private_data = alloc_buffer(inode->i_private, fill_async_buffer); in debug_async_open()
744 return file->private_data ? 0 : -ENOMEM; in debug_async_open()
749 file->private_data = alloc_buffer(inode->i_private, in debug_periodic_open()
752 return file->private_data ? 0 : -ENOMEM; in debug_periodic_open()
757 file->private_data = alloc_buffer(inode->i_private, in debug_registers_open()
760 return file->private_data ? 0 : -ENOMEM; in debug_registers_open()
764 struct usb_bus *bus = &ohci_to_hcd(ohci)->self; in create_debug_files()
767 root = debugfs_create_dir(bus->bus_name, ohci_debug_root); in create_debug_files()
768 ohci->debug_dir = root; in create_debug_files()
781 debugfs_remove_recursive(ohci->debug_dir); in remove_debug_files()
784 /*-------------------------------------------------------------------------*/