aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.h
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2011-09-02 14:05:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-09 18:52:53 -0400
commit839c817ce67178ca3c7c7ad534c571bba1e69ebe (patch)
treedcf27811dfebe7fcad0a91885744552d0065cdb2 /drivers/usb/host/xhci.h
parent66381755442189bbeb15f1a51b1e0059327d84ed (diff)
xhci: Store information about roothubs and TTs.
For upcoming patches, we need to keep information about the bandwidth domains under the xHCI host. Each root port is a separate primary bandwidth domain, and each high speed hub's TT (and potentially each port on a multi-TT hub) is a secondary bandwidth domain. If the table were in text form, it would look a bit like this: EP Interval Sum of Number Largest Max Max Packet of Packets Packet Size Overhead 0 N mps overhead ... 15 N mps overhead Overhead is the maximum packet overhead (for bit stuffing, CRC, protocol overhead, etc) for all the endpoints in this interval. Devices with different speeds have different max packet overhead. For example, if there is a low speed and a full speed endpoint that both have an interval of 3, we would use the higher overhead (the low speed overhead). Interval 0 is a bit special, since we really just want to know the sum of the max ESIT payloads instead of the largest max packet size. That's stored in the interval0_esit_payload variable. For root ports, we also need to keep track of the number of active TTs. For each root port, and each TT under a root port, store some information about the bandwidth consumption. Dynamically allocate an array of root port bandwidth information for the number of root ports on the xHCI host. Each root port stores a list of TTs under the root port. A single TT hub only has one entry in the list, but a multi-TT hub will have an entry per port. When the USB core says that a USB device is a hub, create one or more entries in the root port TT list for the hub. When a device is deleted, and it is a hub, search through the root port TT list and delete all TT entries for the hub. Keep track of which TT entry is associated with a device under a TT. LS/FS devices attached directly to the root port will have usb_device->tt set to the roothub. Ignore that, and treat it like a primary bandwidth domain, since there isn't really a high speed bus between the roothub and the host. Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r--drivers/usb/host/xhci.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index ec4817003a56..eee47c8a6ee8 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -774,6 +774,26 @@ struct xhci_virt_ep {
774 bool skip; 774 bool skip;
775}; 775};
776 776
777enum xhci_overhead_type {
778 LS_OVERHEAD_TYPE = 0,
779 FS_OVERHEAD_TYPE,
780 HS_OVERHEAD_TYPE,
781};
782
783struct xhci_interval_bw {
784 unsigned int num_packets;
785 /* How many endpoints of each speed are present. */
786 unsigned int overhead[3];
787};
788
789#define XHCI_MAX_INTERVAL 16
790
791struct xhci_interval_bw_table {
792 unsigned int interval0_esit_payload;
793 struct xhci_interval_bw interval_bw[XHCI_MAX_INTERVAL];
794};
795
796
777struct xhci_virt_device { 797struct xhci_virt_device {
778 struct usb_device *udev; 798 struct usb_device *udev;
779 /* 799 /*
@@ -800,6 +820,30 @@ struct xhci_virt_device {
800 struct list_head cmd_list; 820 struct list_head cmd_list;
801 u8 fake_port; 821 u8 fake_port;
802 u8 real_port; 822 u8 real_port;
823 struct xhci_interval_bw_table *bw_table;
824 struct xhci_tt_bw_info *tt_info;
825};
826
827/*
828 * For each roothub, keep track of the bandwidth information for each periodic
829 * interval.
830 *
831 * If a high speed hub is attached to the roothub, each TT associated with that
832 * hub is a separate bandwidth domain. The interval information for the
833 * endpoints on the devices under that TT will appear in the TT structure.
834 */
835struct xhci_root_port_bw_info {
836 struct list_head tts;
837 unsigned int num_active_tts;
838 struct xhci_interval_bw_table bw_table;
839};
840
841struct xhci_tt_bw_info {
842 struct list_head tt_list;
843 int slot_id;
844 int ttport;
845 struct xhci_interval_bw_table bw_table;
846 int active_eps;
803}; 847};
804 848
805 849
@@ -1268,6 +1312,8 @@ struct xhci_hcd {
1268 int slot_id; 1312 int slot_id;
1269 /* Internal mirror of the HW's dcbaa */ 1313 /* Internal mirror of the HW's dcbaa */
1270 struct xhci_virt_device *devs[MAX_HC_SLOTS]; 1314 struct xhci_virt_device *devs[MAX_HC_SLOTS];
1315 /* For keeping track of bandwidth domains per roothub. */
1316 struct xhci_root_port_bw_info *rh_bw;
1271 1317
1272 /* DMA pools */ 1318 /* DMA pools */
1273 struct dma_pool *device_pool; 1319 struct dma_pool *device_pool;
@@ -1508,6 +1554,10 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd);
1508irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd); 1554irqreturn_t xhci_msi_irq(int irq, struct usb_hcd *hcd);
1509int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev); 1555int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev);
1510void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev); 1556void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev);
1557int xhci_alloc_tt_info(struct xhci_hcd *xhci,
1558 struct xhci_virt_device *virt_dev,
1559 struct usb_device *hdev,
1560 struct usb_tt *tt, gfp_t mem_flags);
1511int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev, 1561int xhci_alloc_streams(struct usb_hcd *hcd, struct usb_device *udev,
1512 struct usb_host_endpoint **eps, unsigned int num_eps, 1562 struct usb_host_endpoint **eps, unsigned int num_eps,
1513 unsigned int num_streams, gfp_t mem_flags); 1563 unsigned int num_streams, gfp_t mem_flags);