Merge tag 'usb-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
[sfrench/cifs-2.6.git] / drivers / usb / host / xhci.h
index 3d0451f5880ab7c55fe1ca85f39fa63fbb8f44ff..3ea5c092bba7176fbbbf01aa597107178ececb31 100644 (file)
@@ -525,7 +525,7 @@ struct xhci_intr_reg {
  * a work queue (or delayed service routine)?
  */
 #define ERST_EHB               (1 << 3)
-#define ERST_PTR_MASK          (0xf)
+#define ERST_PTR_MASK          (GENMASK_ULL(63, 4))
 
 /**
  * struct xhci_run_regs
@@ -558,33 +558,6 @@ struct xhci_doorbell_array {
 #define DB_VALUE(ep, stream)   ((((ep) + 1) & 0xff) | ((stream) << 16))
 #define DB_VALUE_HOST          0x00000000
 
-/**
- * struct xhci_protocol_caps
- * @revision:          major revision, minor revision, capability ID,
- *                     and next capability pointer.
- * @name_string:       Four ASCII characters to say which spec this xHC
- *                     follows, typically "USB ".
- * @port_info:         Port offset, count, and protocol-defined information.
- */
-struct xhci_protocol_caps {
-       u32     revision;
-       u32     name_string;
-       u32     port_info;
-};
-
-#define        XHCI_EXT_PORT_MAJOR(x)  (((x) >> 24) & 0xff)
-#define        XHCI_EXT_PORT_MINOR(x)  (((x) >> 16) & 0xff)
-#define        XHCI_EXT_PORT_PSIC(x)   (((x) >> 28) & 0x0f)
-#define        XHCI_EXT_PORT_OFF(x)    ((x) & 0xff)
-#define        XHCI_EXT_PORT_COUNT(x)  (((x) >> 8) & 0xff)
-
-#define        XHCI_EXT_PORT_PSIV(x)   (((x) >> 0) & 0x0f)
-#define        XHCI_EXT_PORT_PSIE(x)   (((x) >> 4) & 0x03)
-#define        XHCI_EXT_PORT_PLT(x)    (((x) >> 6) & 0x03)
-#define        XHCI_EXT_PORT_PFD(x)    (((x) >> 8) & 0x01)
-#define        XHCI_EXT_PORT_LP(x)     (((x) >> 14) & 0x03)
-#define        XHCI_EXT_PORT_PSIM(x)   (((x) >> 16) & 0xffff)
-
 #define PLT_MASK        (0x03 << 6)
 #define PLT_SYM         (0x00 << 6)
 #define PLT_ASYM_RX     (0x02 << 6)
@@ -1545,6 +1518,7 @@ struct xhci_segment {
        union xhci_trb          *trbs;
        /* private to HCD */
        struct xhci_segment     *next;
+       unsigned int            num;
        dma_addr_t              dma;
        /* Max packet sized bounce buffer for td-fragmant alignment */
        dma_addr_t              bounce_dma;
@@ -1669,12 +1643,8 @@ struct urb_priv {
        struct  xhci_td td[] __counted_by(num_tds);
 };
 
-/*
- * Each segment table entry is 4*32bits long.  1K seems like an ok size:
- * (1K bytes * 8bytes/bit) / (4*32 bits) = 64 segment entries in the table,
- * meaning 64 ring segments.
- * Initial allocated size of the ERST, in number of entries */
-#define        ERST_NUM_SEGS   1
+/* Reasonable limit for number of Event Ring segments (spec allows 32k) */
+#define        ERST_MAX_SEGS   2
 /* Poll every 60 seconds */
 #define        POLL_TIMEOUT    60
 /* Stop endpoint command timeout (secs) for URB cancellation watchdog timer */
@@ -2078,13 +2048,8 @@ struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci,
 void xhci_ring_free(struct xhci_hcd *xhci, struct xhci_ring *ring);
 int xhci_ring_expansion(struct xhci_hcd *xhci, struct xhci_ring *ring,
                unsigned int num_trbs, gfp_t flags);
-int xhci_alloc_erst(struct xhci_hcd *xhci,
-               struct xhci_ring *evt_ring,
-               struct xhci_erst *erst,
-               gfp_t flags);
 void xhci_initialize_ring_info(struct xhci_ring *ring,
                        unsigned int cycle_state);
-void xhci_free_erst(struct xhci_hcd *xhci, struct xhci_erst *erst);
 void xhci_free_endpoint_ring(struct xhci_hcd *xhci,
                struct xhci_virt_device *virt_dev,
                unsigned int ep_index);
@@ -2119,6 +2084,8 @@ void xhci_free_container_ctx(struct xhci_hcd *xhci,
 /* xHCI host controller glue */
 typedef void (*xhci_get_quirks_t)(struct device *, struct xhci_hcd *);
 int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, u64 timeout_us);
+int xhci_handshake_check_state(struct xhci_hcd *xhci, void __iomem *ptr,
+               u32 mask, u32 done, int usec, unsigned int exit_state);
 void xhci_quiesce(struct xhci_hcd *xhci);
 int xhci_halt(struct xhci_hcd *xhci);
 int xhci_start(struct xhci_hcd *xhci);