diff options
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r-- | drivers/usb/host/xhci.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 627092286d1b..36f7d4f91d9f 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h | |||
@@ -620,6 +620,22 @@ struct xhci_input_control_ctx { | |||
620 | u32 rsvd2[6]; | 620 | u32 rsvd2[6]; |
621 | }; | 621 | }; |
622 | 622 | ||
623 | /* Represents everything that is needed to issue a command on the command ring. | ||
624 | * It's useful to pre-allocate these for commands that cannot fail due to | ||
625 | * out-of-memory errors, like freeing streams. | ||
626 | */ | ||
627 | struct xhci_command { | ||
628 | /* Input context for changing device state */ | ||
629 | struct xhci_container_ctx *in_ctx; | ||
630 | u32 status; | ||
631 | /* If completion is null, no one is waiting on this command | ||
632 | * and the structure can be freed after the command completes. | ||
633 | */ | ||
634 | struct completion *completion; | ||
635 | union xhci_trb *command_trb; | ||
636 | struct list_head cmd_list; | ||
637 | }; | ||
638 | |||
623 | /* drop context bitmasks */ | 639 | /* drop context bitmasks */ |
624 | #define DROP_EP(x) (0x1 << x) | 640 | #define DROP_EP(x) (0x1 << x) |
625 | /* add context bitmasks */ | 641 | /* add context bitmasks */ |
@@ -658,6 +674,7 @@ struct xhci_virt_device { | |||
658 | struct completion cmd_completion; | 674 | struct completion cmd_completion; |
659 | /* Status of the last command issued for this device */ | 675 | /* Status of the last command issued for this device */ |
660 | u32 cmd_status; | 676 | u32 cmd_status; |
677 | struct list_head cmd_list; | ||
661 | }; | 678 | }; |
662 | 679 | ||
663 | 680 | ||
@@ -920,6 +937,8 @@ union xhci_trb { | |||
920 | * It must also be greater than 16. | 937 | * It must also be greater than 16. |
921 | */ | 938 | */ |
922 | #define TRBS_PER_SEGMENT 64 | 939 | #define TRBS_PER_SEGMENT 64 |
940 | /* Allow two commands + a link TRB, along with any reserved command TRBs */ | ||
941 | #define MAX_RSVD_CMD_TRBS (TRBS_PER_SEGMENT - 3) | ||
923 | #define SEGMENT_SIZE (TRBS_PER_SEGMENT*16) | 942 | #define SEGMENT_SIZE (TRBS_PER_SEGMENT*16) |
924 | /* TRB buffer pointers can't cross 64KB boundaries */ | 943 | /* TRB buffer pointers can't cross 64KB boundaries */ |
925 | #define TRB_MAX_BUFF_SHIFT 16 | 944 | #define TRB_MAX_BUFF_SHIFT 16 |
@@ -1040,6 +1059,7 @@ struct xhci_hcd { | |||
1040 | /* data structures */ | 1059 | /* data structures */ |
1041 | struct xhci_device_context_array *dcbaa; | 1060 | struct xhci_device_context_array *dcbaa; |
1042 | struct xhci_ring *cmd_ring; | 1061 | struct xhci_ring *cmd_ring; |
1062 | unsigned int cmd_ring_reserved_trbs; | ||
1043 | struct xhci_ring *event_ring; | 1063 | struct xhci_ring *event_ring; |
1044 | struct xhci_erst erst; | 1064 | struct xhci_erst erst; |
1045 | /* Scratchpad */ | 1065 | /* Scratchpad */ |
@@ -1178,12 +1198,20 @@ unsigned int xhci_get_endpoint_flag_from_index(unsigned int ep_index); | |||
1178 | unsigned int xhci_last_valid_endpoint(u32 added_ctxs); | 1198 | unsigned int xhci_last_valid_endpoint(u32 added_ctxs); |
1179 | void xhci_endpoint_zero(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_host_endpoint *ep); | 1199 | void xhci_endpoint_zero(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, struct usb_host_endpoint *ep); |
1180 | void xhci_endpoint_copy(struct xhci_hcd *xhci, | 1200 | void xhci_endpoint_copy(struct xhci_hcd *xhci, |
1181 | struct xhci_virt_device *vdev, unsigned int ep_index); | 1201 | struct xhci_container_ctx *in_ctx, |
1182 | void xhci_slot_copy(struct xhci_hcd *xhci, struct xhci_virt_device *vdev); | 1202 | struct xhci_container_ctx *out_ctx, |
1203 | unsigned int ep_index); | ||
1204 | void xhci_slot_copy(struct xhci_hcd *xhci, | ||
1205 | struct xhci_container_ctx *in_ctx, | ||
1206 | struct xhci_container_ctx *out_ctx); | ||
1183 | int xhci_endpoint_init(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, | 1207 | int xhci_endpoint_init(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, |
1184 | struct usb_device *udev, struct usb_host_endpoint *ep, | 1208 | struct usb_device *udev, struct usb_host_endpoint *ep, |
1185 | gfp_t mem_flags); | 1209 | gfp_t mem_flags); |
1186 | void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring); | 1210 | void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring); |
1211 | struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, | ||
1212 | bool allocate_completion, gfp_t mem_flags); | ||
1213 | void xhci_free_command(struct xhci_hcd *xhci, | ||
1214 | struct xhci_command *command); | ||
1187 | 1215 | ||
1188 | #ifdef CONFIG_PCI | 1216 | #ifdef CONFIG_PCI |
1189 | /* xHCI PCI glue */ | 1217 | /* xHCI PCI glue */ |
@@ -1229,7 +1257,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | |||
1229 | int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, | 1257 | int xhci_queue_intr_tx(struct xhci_hcd *xhci, gfp_t mem_flags, struct urb *urb, |
1230 | int slot_id, unsigned int ep_index); | 1258 | int slot_id, unsigned int ep_index); |
1231 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1259 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, |
1232 | u32 slot_id); | 1260 | u32 slot_id, bool command_must_succeed); |
1233 | int xhci_queue_evaluate_context(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 1261 | int xhci_queue_evaluate_context(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, |
1234 | u32 slot_id); | 1262 | u32 slot_id); |
1235 | int xhci_queue_reset_ep(struct xhci_hcd *xhci, int slot_id, | 1263 | int xhci_queue_reset_ep(struct xhci_hcd *xhci, int slot_id, |