Lines Matching full:xhci

3  * xhci-debugfs.c - xHCI debugfs interface
13 #include "xhci.h"
14 #include "xhci-debugfs.h"
86 static struct xhci_regset *xhci_debugfs_alloc_regset(struct xhci_hcd *xhci) in xhci_debugfs_alloc_regset() argument
99 list_add_tail(&regset->list, &xhci->regset_list); in xhci_debugfs_alloc_regset()
114 static void xhci_debugfs_regset(struct xhci_hcd *xhci, u32 base, in xhci_debugfs_regset() argument
122 struct usb_hcd *hcd = xhci_to_hcd(xhci); in xhci_debugfs_regset()
124 rgs = xhci_debugfs_alloc_regset(xhci); in xhci_debugfs_regset()
141 static void xhci_debugfs_extcap_regset(struct xhci_hcd *xhci, int cap_id, in xhci_debugfs_extcap_regset() argument
148 void __iomem *base = &xhci->cap_regs->hc_capbase; in xhci_debugfs_extcap_regset()
157 xhci_debugfs_regset(xhci, offset, regs, nregs, in xhci_debugfs_extcap_regset()
158 xhci->debugfs_root, "%s:%02d", in xhci_debugfs_extcap_regset()
249 struct xhci_hcd *xhci; in xhci_slot_context_show() local
255 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus)); in xhci_slot_context_show()
256 slot_ctx = xhci_get_slot_ctx(xhci, dev->out_ctx); in xhci_slot_context_show()
271 struct xhci_hcd *xhci; in xhci_endpoint_context_show() local
277 xhci = hcd_to_xhci(bus_to_hcd(dev->udev->bus)); in xhci_endpoint_context_show()
280 ep_ctx = xhci_get_ep_ctx(xhci, dev->out_ctx, ep_index); in xhci_endpoint_context_show()
281 dma = dev->out_ctx->dma + (ep_index + 1) * CTX_SIZE(xhci->hcc_params); in xhci_endpoint_context_show()
348 struct xhci_hcd *xhci = hcd_to_xhci(port->rhub->hcd); in xhci_port_write() local
358 if (!HCC2_CTC(xhci->hcc_params2)) in xhci_port_write()
360 spin_lock_irqsave(&xhci->lock, flags); in xhci_port_write()
364 spin_unlock_irqrestore(&xhci->lock, flags); in xhci_port_write()
371 spin_unlock_irqrestore(&xhci->lock, flags); in xhci_port_write()
386 static void xhci_debugfs_create_files(struct xhci_hcd *xhci, in xhci_debugfs_create_files() argument
399 static struct dentry *xhci_debugfs_create_ring_dir(struct xhci_hcd *xhci, in xhci_debugfs_create_ring_dir() argument
407 xhci_debugfs_create_files(xhci, ring_files, ARRAY_SIZE(ring_files), in xhci_debugfs_create_ring_dir()
413 static void xhci_debugfs_create_context_files(struct xhci_hcd *xhci, in xhci_debugfs_create_context_files() argument
417 struct xhci_virt_device *dev = xhci->devs[slot_id]; in xhci_debugfs_create_context_files()
419 xhci_debugfs_create_files(xhci, context_files, in xhci_debugfs_create_context_files()
425 void xhci_debugfs_create_endpoint(struct xhci_hcd *xhci, in xhci_debugfs_create_endpoint() argument
445 epriv->root = xhci_debugfs_create_ring_dir(xhci, in xhci_debugfs_create_endpoint()
452 void xhci_debugfs_remove_endpoint(struct xhci_hcd *xhci, in xhci_debugfs_remove_endpoint() argument
548 void xhci_debugfs_create_stream_files(struct xhci_hcd *xhci, in xhci_debugfs_create_stream_files() argument
573 void xhci_debugfs_create_slot(struct xhci_hcd *xhci, int slot_id) in xhci_debugfs_create_slot() argument
576 struct xhci_virt_device *dev = xhci->devs[slot_id]; in xhci_debugfs_create_slot()
583 priv->root = debugfs_create_dir(priv->name, xhci->debugfs_slots); in xhci_debugfs_create_slot()
587 xhci_debugfs_create_ring_dir(xhci, &dev->eps[0].ring, in xhci_debugfs_create_slot()
590 xhci_debugfs_create_context_files(xhci, priv->root, slot_id); in xhci_debugfs_create_slot()
593 void xhci_debugfs_remove_slot(struct xhci_hcd *xhci, int slot_id) in xhci_debugfs_remove_slot() argument
597 struct xhci_virt_device *dev = xhci->devs[slot_id]; in xhci_debugfs_remove_slot()
613 static void xhci_debugfs_create_ports(struct xhci_hcd *xhci, in xhci_debugfs_create_ports() argument
621 num_ports = HCS_MAX_PORTS(xhci->hcs_params1); in xhci_debugfs_create_ports()
629 port = &xhci->hw_ports[num_ports]; in xhci_debugfs_create_ports()
634 static int xhci_port_bw_show(struct xhci_hcd *xhci, u8 dev_speed, in xhci_port_bw_show() argument
641 struct usb_hcd *hcd = xhci_to_hcd(xhci); in xhci_port_bw_show()
648 num_ports = HCS_MAX_PORTS(xhci->hcs_params1); in xhci_port_bw_show()
650 ctx = xhci_alloc_port_bw_ctx(xhci, 0); in xhci_port_bw_show()
657 ret = xhci_get_port_bandwidth(xhci, ctx, dev_speed); in xhci_port_bw_show()
662 * refer to xhci rev1_2 protocol 6.2.6 , byte 0 is reserved in xhci_port_bw_show()
669 xhci_free_port_bw_ctx(xhci, ctx); in xhci_port_bw_show()
676 struct xhci_hcd *xhci = (struct xhci_hcd *)s->private; in xhci_ss_bw_show() local
678 ret = xhci_port_bw_show(xhci, USB_SPEED_SUPER, s); in xhci_ss_bw_show()
685 struct xhci_hcd *xhci = (struct xhci_hcd *)s->private; in xhci_hs_bw_show() local
687 ret = xhci_port_bw_show(xhci, USB_SPEED_HIGH, s); in xhci_hs_bw_show()
694 struct xhci_hcd *xhci = (struct xhci_hcd *)s->private; in xhci_fs_bw_show() local
696 ret = xhci_port_bw_show(xhci, USB_SPEED_FULL, s); in xhci_fs_bw_show()
729 static void xhci_debugfs_create_bandwidth(struct xhci_hcd *xhci, in xhci_debugfs_create_bandwidth() argument
734 xhci_debugfs_create_files(xhci, bw_context_files, in xhci_debugfs_create_bandwidth()
736 xhci, in xhci_debugfs_create_bandwidth()
740 void xhci_debugfs_init(struct xhci_hcd *xhci) in xhci_debugfs_init() argument
742 struct device *dev = xhci_to_hcd(xhci)->self.controller; in xhci_debugfs_init()
744 xhci->debugfs_root = debugfs_create_dir(dev_name(dev), in xhci_debugfs_init()
747 INIT_LIST_HEAD(&xhci->regset_list); in xhci_debugfs_init()
749 xhci_debugfs_regset(xhci, in xhci_debugfs_init()
752 xhci->debugfs_root, "reg-cap"); in xhci_debugfs_init()
754 xhci_debugfs_regset(xhci, in xhci_debugfs_init()
755 HC_LENGTH(readl(&xhci->cap_regs->hc_capbase)), in xhci_debugfs_init()
757 xhci->debugfs_root, "reg-op"); in xhci_debugfs_init()
759 xhci_debugfs_regset(xhci, in xhci_debugfs_init()
760 readl(&xhci->cap_regs->run_regs_off) & RTSOFF_MASK, in xhci_debugfs_init()
762 xhci->debugfs_root, "reg-runtime"); in xhci_debugfs_init()
764 xhci_debugfs_extcap_regset(xhci, XHCI_EXT_CAPS_LEGACY, in xhci_debugfs_init()
769 xhci_debugfs_extcap_regset(xhci, XHCI_EXT_CAPS_PROTOCOL, in xhci_debugfs_init()
774 xhci_debugfs_extcap_regset(xhci, XHCI_EXT_CAPS_DEBUG, in xhci_debugfs_init()
779 xhci_debugfs_create_ring_dir(xhci, &xhci->cmd_ring, in xhci_debugfs_init()
781 xhci->debugfs_root); in xhci_debugfs_init()
783 xhci_debugfs_create_ring_dir(xhci, &xhci->interrupters[0]->event_ring, in xhci_debugfs_init()
785 xhci->debugfs_root); in xhci_debugfs_init()
787 xhci->debugfs_slots = debugfs_create_dir("devices", xhci->debugfs_root); in xhci_debugfs_init()
789 xhci_debugfs_create_ports(xhci, xhci->debugfs_root); in xhci_debugfs_init()
791 xhci_debugfs_create_bandwidth(xhci, xhci->debugfs_root); in xhci_debugfs_init()
794 void xhci_debugfs_exit(struct xhci_hcd *xhci) in xhci_debugfs_exit() argument
798 debugfs_remove_recursive(xhci->debugfs_root); in xhci_debugfs_exit()
799 xhci->debugfs_root = NULL; in xhci_debugfs_exit()
800 xhci->debugfs_slots = NULL; in xhci_debugfs_exit()
802 list_for_each_entry_safe(rgs, tmp, &xhci->regset_list, list) in xhci_debugfs_exit()
808 xhci_debugfs_root = debugfs_create_dir("xhci", usb_debug_root); in xhci_debugfs_create_root()