aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/xhci.h')
-rw-r--r--drivers/usb/host/xhci.h61
1 files changed, 34 insertions, 27 deletions
diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h
index d4d3c7777fb8..9c108c632704 100644
--- a/drivers/usb/host/xhci.h
+++ b/drivers/usb/host/xhci.h
@@ -447,6 +447,27 @@ struct xhci_doorbell_array {
447 447
448 448
449/** 449/**
450 * struct xhci_container_ctx
451 * @type: Type of context. Used to calculated offsets to contained contexts.
452 * @size: Size of the context data
453 * @bytes: The raw context data given to HW
454 * @dma: dma address of the bytes
455 *
456 * Represents either a Device or Input context. Holds a pointer to the raw
457 * memory used for the context (bytes) and dma address of it (dma).
458 */
459struct xhci_container_ctx {
460 unsigned type;
461#define XHCI_CTX_TYPE_DEVICE 0x1
462#define XHCI_CTX_TYPE_INPUT 0x2
463
464 int size;
465
466 u8 *bytes;
467 dma_addr_t dma;
468};
469
470/**
450 * struct xhci_slot_ctx 471 * struct xhci_slot_ctx
451 * @dev_info: Route string, device speed, hub info, and last valid endpoint 472 * @dev_info: Route string, device speed, hub info, and last valid endpoint
452 * @dev_info2: Max exit latency for device number, root hub port number 473 * @dev_info2: Max exit latency for device number, root hub port number
@@ -583,32 +604,16 @@ struct xhci_ep_ctx {
583 604
584 605
585/** 606/**
586 * struct xhci_device_control 607 * struct xhci_input_control_context
587 * Input context; see section 6.2.5. 608 * Input control context; see section 6.2.5.
588 * 609 *
589 * @drop_context: set the bit of the endpoint context you want to disable 610 * @drop_context: set the bit of the endpoint context you want to disable
590 * @add_context: set the bit of the endpoint context you want to enable 611 * @add_context: set the bit of the endpoint context you want to enable
591 */ 612 */
592struct xhci_device_control { 613struct xhci_input_control_ctx {
593 /* Input control context */
594 u32 drop_flags; 614 u32 drop_flags;
595 u32 add_flags; 615 u32 add_flags;
596 u32 rsvd[6]; 616 u32 rsvd2[6];
597 /* Copy of device context */
598 struct xhci_slot_ctx slot;
599 struct xhci_ep_ctx ep[31];
600};
601
602/**
603 * struct xhci_device_ctx
604 * Device context; see section 6.2.1.
605 *
606 * @slot: slot context for the device.
607 * @ep: array of endpoint contexts for the device.
608 */
609struct xhci_device_ctx {
610 struct xhci_slot_ctx slot;
611 struct xhci_ep_ctx ep[31];
612}; 617};
613 618
614/* drop context bitmasks */ 619/* drop context bitmasks */
@@ -616,7 +621,6 @@ struct xhci_device_ctx {
616/* add context bitmasks */ 621/* add context bitmasks */
617#define ADD_EP(x) (0x1 << x) 622#define ADD_EP(x) (0x1 << x)
618 623
619
620struct xhci_virt_device { 624struct xhci_virt_device {
621 /* 625 /*
622 * Commands to the hardware are passed an "input context" that 626 * Commands to the hardware are passed an "input context" that
@@ -626,11 +630,10 @@ struct xhci_virt_device {
626 * track of input and output contexts separately because 630 * track of input and output contexts separately because
627 * these commands might fail and we don't trust the hardware. 631 * these commands might fail and we don't trust the hardware.
628 */ 632 */
629 struct xhci_device_ctx *out_ctx; 633 struct xhci_container_ctx *out_ctx;
630 dma_addr_t out_ctx_dma;
631 /* Used for addressing devices and configuration changes */ 634 /* Used for addressing devices and configuration changes */
632 struct xhci_device_control *in_ctx; 635 struct xhci_container_ctx *in_ctx;
633 dma_addr_t in_ctx_dma; 636
634 /* FIXME when stream support is added */ 637 /* FIXME when stream support is added */
635 struct xhci_ring *ep_rings[31]; 638 struct xhci_ring *ep_rings[31];
636 /* Temporary storage in case the configure endpoint command fails and we 639 /* Temporary storage in case the configure endpoint command fails and we
@@ -1139,8 +1142,7 @@ void xhci_debug_ring(struct xhci_hcd *xhci, struct xhci_ring *ring);
1139void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst); 1142void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst);
1140void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci); 1143void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci);
1141void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring); 1144void xhci_dbg_ring_ptrs(struct xhci_hcd *xhci, struct xhci_ring *ring);
1142void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_device_control *ctx, dma_addr_t dma, unsigned int last_ep); 1145void xhci_dbg_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int last_ep);
1143void xhci_dbg_device_ctx(struct xhci_hcd *xhci, struct xhci_device_ctx *ctx, dma_addr_t dma, unsigned int last_ep);
1144 1146
1145/* xHCI memory managment */ 1147/* xHCI memory managment */
1146void xhci_mem_cleanup(struct xhci_hcd *xhci); 1148void xhci_mem_cleanup(struct xhci_hcd *xhci);
@@ -1207,4 +1209,9 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, u16 wIndex,
1207 char *buf, u16 wLength); 1209 char *buf, u16 wLength);
1208int xhci_hub_status_data(struct usb_hcd *hcd, char *buf); 1210int xhci_hub_status_data(struct usb_hcd *hcd, char *buf);
1209 1211
1212/* xHCI contexts */
1213struct xhci_input_control_ctx *xhci_get_input_control_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx);
1214struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx);
1215struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, unsigned int ep_index);
1216
1210#endif /* __LINUX_XHCI_HCD_H */ 1217#endif /* __LINUX_XHCI_HCD_H */