diff options
author | Mathias Nyman <mathias.nyman@linux.intel.com> | 2014-05-08 12:26:00 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-05-19 21:03:25 -0400 |
commit | ddba5cd0aeff5bbed92ebdf4b1223300b0541e78 (patch) | |
tree | df3c979cd4ee80815538dc2f86cb4bfb451e7c43 /drivers/usb/host/xhci.h | |
parent | be9820383b10984d77abe1abc26e2b7029e78e21 (diff) |
xhci: Use command structures when queuing commands on the command ring
To create a global command queue we require that each command put on the
command ring is submitted with a command structure.
Functions that queue commands and wait for completion need to allocate a command
before submitting it, and free it once completed. The following command queuing
functions need to be modified.
xhci_configure_endpoint()
xhci_address_device()
xhci_queue_slot_control()
xhci_queue_stop_endpoint()
xhci_queue_new_dequeue_state()
xhci_queue_reset_ep()
xhci_configure_endpoint()
xhci_configure_endpoint() could already be called with a command structure,
and only xhci_check_maxpacket and xhci_check_bandwidth did not do so. These
are changed and a command structure is now required. This change also simplifies
the configure endpoint command completion handling and the "goto bandwidth_change"
handling code can be removed.
In some cases the command queuing function is called in interrupt context.
These commands needs to be allocated atomically, and they can't wait for
completion. These commands will in this patch be freed directly after queuing,
but freeing will be moved to the command completion event handler in a later
patch once we get the global command queue up.(Just so that we won't leak
memory in the middle of the patch set)
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r-- | drivers/usb/host/xhci.h | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index cc67c7686706..c0fdb4984b0d 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -1807,13 +1807,14 @@ struct xhci_segment *trb_in_td(struct xhci_segment *start_seg, | |||
1807 | dma_addr_t suspect_dma); | 1807 | dma_addr_t suspect_dma); |
1808 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code); | 1808 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code); |
1809 | void xhci_ring_cmd_db(struct xhci_hcd *xhci); | 1809 | void xhci_ring_cmd_db(struct xhci_hcd *xhci); |
1810 | int xhci_queue_slot_control(struct xhci_hcd *xhci, u32 trb_type, u32 slot_id); | 1810 | int xhci_queue_slot_control(struct xhci_hcd *xhci, struct xhci_command *cmd, |
1811 | int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1811 | u32 trb_type, u32 slot_id); |
1812 | u32 slot_id, enum xhci_setup_dev); | 1812 | int xhci_queue_address_device(struct xhci_hcd *xhci, struct xhci_command *cmd, |
1813 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, | 1813 | dma_addr_t in_ctx_ptr, u32 slot_id, enum xhci_setup_dev); |
1814 | int xhci_queue_vendor_command(struct xhci_hcd *xhci, struct xhci_command *cmd, | ||
1814 | u32 field1, u32 field2, u32 field3, u32 field4); | 1815 | u32 field1, u32 field2, u32 field3, u32 field4); |
1815 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, int slot_id, | 1816 | int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, struct xhci_command *cmd, |
1816 | unsigned int ep_index, int suspend); | 1817 | int slot_id, unsigned int ep_index, int suspend); |
1817 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1818 | int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
1818 | int slot_id, unsigned int ep_index); | 1819 | int slot_id, unsigned int ep_index); |
1819 | int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1820 | int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
@@ -1822,18 +1823,21 @@ int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | |||
1822 | int slot_id, unsigned int ep_index); | 1823 | int slot_id, unsigned int ep_index); |
1823 | int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, | 1824 | int xhci_queue_isoc_tx_prepare(struct xhci_hcd *xhci, gfp_t mem_flags, |
1824 | struct urb *urb, int slot_id, unsigned int ep_index); | 1825 | struct urb *urb, int slot_id, unsigned int ep_index); |
1825 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1826 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, |
1826 | u32 slot_id, bool command_must_succeed); | 1827 | struct xhci_command *cmd, dma_addr_t in_ctx_ptr, u32 slot_id, |
1827 | int xhci_queue_evaluate_context(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1828 | bool command_must_succeed); |
1828 | u32 slot_id, bool command_must_succeed); | 1829 | int xhci_queue_evaluate_context(struct xhci_hcd *xhci, struct xhci_command *cmd, |
1829 | int xhci_queue_reset_ep(struct xhci_hcd *xhci, int slot_id, | 1830 | dma_addr_t in_ctx_ptr, u32 slot_id, bool command_must_succeed); |
1830 | unsigned int ep_index); | 1831 | int xhci_queue_reset_ep(struct xhci_hcd *xhci, struct xhci_command *cmd, |
1831 | int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id); | 1832 | int slot_id, unsigned int ep_index); |
1833 | int xhci_queue_reset_device(struct xhci_hcd *xhci, struct xhci_command *cmd, | ||
1834 | u32 slot_id); | ||
1832 | void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, | 1835 | void xhci_find_new_dequeue_state(struct xhci_hcd *xhci, |
1833 | unsigned int slot_id, unsigned int ep_index, | 1836 | unsigned int slot_id, unsigned int ep_index, |
1834 | unsigned int stream_id, struct xhci_td *cur_td, | 1837 | unsigned int stream_id, struct xhci_td *cur_td, |
1835 | struct xhci_dequeue_state *state); | 1838 | struct xhci_dequeue_state *state); |
1836 | void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, | 1839 | void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci, |
1840 | struct xhci_command *cmd, | ||
1837 | unsigned int slot_id, unsigned int ep_index, | 1841 | unsigned int slot_id, unsigned int ep_index, |
1838 | unsigned int stream_id, | 1842 | unsigned int stream_id, |
1839 | struct xhci_dequeue_state *deq_state); | 1843 | struct xhci_dequeue_state *deq_state); |
@@ -1847,7 +1851,6 @@ int xhci_cancel_cmd(struct xhci_hcd *xhci, struct xhci_command *command, | |||
1847 | union xhci_trb *cmd_trb); | 1851 | union xhci_trb *cmd_trb); |
1848 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, | 1852 | void xhci_ring_ep_doorbell(struct xhci_hcd *xhci, unsigned int slot_id, |
1849 | unsigned int ep_index, unsigned int stream_id); | 1853 | unsigned int ep_index, unsigned int stream_id); |
1850 | union xhci_trb *xhci_find_next_enqueue(struct xhci_ring *ring); | ||
1851 | 1854 | ||
1852 | /* xHCI roothub code */ | 1855 | /* xHCI roothub code */ |
1853 | void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, | 1856 | void xhci_set_link_state(struct xhci_hcd *xhci, __le32 __iomem **port_array, |