aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.h
diff options
context:
space:
mode:
authorSarah Sharp <sarah.a.sharp@linux.intel.com>2009-04-27 22:58:38 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-06-16 00:44:49 -0400
commitf94e0186312b0fc39f41eed4e21836ed74b7efe1 (patch)
treed445d846f62c23cfbefc4958168d9cf4bacea3a4 /drivers/usb/host/xhci.h
parent79abb1ab13cee5ba488210798b6e7bbae0b391ac (diff)
USB: xhci: Bandwidth allocation support
Since the xHCI host controller hardware (xHC) has an internal schedule, it needs a better representation of what devices are consuming bandwidth on the bus. Each device is represented by a device context, with data about the device, endpoints, and pointers to each endpoint ring. We need to update the endpoint information for a device context before a new configuration or alternate interface setting is selected. We setup an input device context with modified endpoint information and newly allocated endpoint rings, and then submit a Configure Endpoint Command to the hardware. The host controller can reject the new configuration if it exceeds the bus bandwidth, or the host controller doesn't have enough internal resources for the configuration. If the command fails, we still have the older device context with the previous configuration. If the command succeeds, we free the old endpoint rings. The root hub isn't a real device, so always say yes to any bandwidth changes for it. The USB core will enable, disable, and then enable endpoint 0 several times during the initialization sequence. The device will always have an endpoint ring for endpoint 0 and bandwidth allocated for that, unless the device is disconnected or gets a SetAddress 0 request. So we don't pay attention for when xhci_check_bandwidth() is called for a re-add of endpoint 0. 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.h18
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index fc8dcd2aa770..1a6fd997c343 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -486,8 +486,6 @@ struct xhci_slot_ctx {
486#define LAST_CTX_MASK (0x1f << 27) 486#define LAST_CTX_MASK (0x1f << 27)
487#define LAST_CTX(p) ((p) << 27) 487#define LAST_CTX(p) ((p) << 27)
488#define LAST_CTX_TO_EP_NUM(p) (((p) >> 27) - 1) 488#define LAST_CTX_TO_EP_NUM(p) (((p) >> 27) - 1)
489/* Plus one for the slot context flag */
490#define EPI_TO_FLAG(p) (1 << ((p) + 1))
491#define SLOT_FLAG (1 << 0) 489#define SLOT_FLAG (1 << 0)
492#define EP0_FLAG (1 << 1) 490#define EP0_FLAG (1 << 1)
493 491
@@ -566,7 +564,7 @@ struct xhci_ep_ctx {
566/* bits 10:14 are Max Primary Streams */ 564/* bits 10:14 are Max Primary Streams */
567/* bit 15 is Linear Stream Array */ 565/* bit 15 is Linear Stream Array */
568/* Interval - period between requests to an endpoint - 125u increments. */ 566/* Interval - period between requests to an endpoint - 125u increments. */
569#define EP_INTERVAL (0xff << 16) 567#define EP_INTERVAL(p) ((p & 0xff) << 16)
570 568
571/* ep_info2 bitmasks */ 569/* ep_info2 bitmasks */
572/* 570/*
@@ -626,6 +624,11 @@ struct xhci_virt_device {
626 dma_addr_t in_ctx_dma; 624 dma_addr_t in_ctx_dma;
627 /* FIXME when stream support is added */ 625 /* FIXME when stream support is added */
628 struct xhci_ring *ep_rings[31]; 626 struct xhci_ring *ep_rings[31];
627 /* Temporary storage in case the configure endpoint command fails and we
628 * have to restore the device state to the previous state
629 */
630 struct xhci_ring *new_ep_rings[31];
631 struct completion cmd_completion;
629 /* Status of the last command issued for this device */ 632 /* Status of the last command issued for this device */
630 u32 cmd_status; 633 u32 cmd_status;
631}; 634};
@@ -1075,6 +1078,10 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id);
1075int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags); 1078int xhci_alloc_virt_device(struct xhci_hcd *xhci, int slot_id, struct usb_device *udev, gfp_t flags);
1076int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev); 1079int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *udev);
1077unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc); 1080unsigned int xhci_get_endpoint_index(struct usb_endpoint_descriptor *desc);
1081unsigned int xhci_get_endpoint_flag(struct usb_endpoint_descriptor *desc);
1082void xhci_endpoint_zero(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_host_endpoint *ep);
1083int xhci_endpoint_init(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_device *udev, struct usb_host_endpoint *ep);
1084void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring);
1078 1085
1079#ifdef CONFIG_PCI 1086#ifdef CONFIG_PCI
1080/* xHCI PCI glue */ 1087/* xHCI PCI glue */
@@ -1096,6 +1103,10 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev);
1096int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev); 1103int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev);
1097int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags); 1104int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flags);
1098int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status); 1105int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status);
1106int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep);
1107int xhci_drop_endpoint(struct usb_hcd *hcd, struct usb_device *udev, struct usb_host_endpoint *ep);
1108int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev);
1109void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev);
1099 1110
1100/* xHCI ring, segment, TRB, and TD functions */ 1111/* xHCI ring, segment, TRB, and TD functions */
1101dma_addr_t trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb); 1112dma_addr_t trb_virt_to_dma(struct xhci_segment *seg, union xhci_trb *trb);
@@ -1106,6 +1117,7 @@ void set_hc_event_deq(struct xhci_hcd *xhci);
1106int queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); 1117int queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id);
1107int queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, u32 slot_id); 1118int queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, u32 slot_id);
1108int queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index); 1119int queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, int slot_id, unsigned int ep_index);
1120int queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, u32 slot_id);
1109 1121
1110/* xHCI roothub code */ 1122/* xHCI roothub code */
1111int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex, 1123int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,