xhci-caps.h 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* hc_capbase bitmasks */
  3. /* bits 7:0 - how long is the Capabilities register */
  4. #define HC_LENGTH(p) XHCI_HC_LENGTH(p)
  5. /* bits 31:16 */
  6. #define HC_VERSION(p) (((p) >> 16) & 0xffff)
  7. /* HCSPARAMS1 - hcs_params1 - bitmasks */
  8. /* bits 0:7, Max Device Slots */
  9. #define HCS_MAX_SLOTS(p) (((p) >> 0) & 0xff)
  10. #define HCS_SLOTS_MASK 0xff
  11. /* bits 8:18, Max Interrupters */
  12. #define HCS_MAX_INTRS(p) (((p) >> 8) & 0x7ff)
  13. /* bits 24:31, Max Ports - max value is 0x7F = 127 ports */
  14. #define HCS_MAX_PORTS(p) (((p) >> 24) & 0x7f)
  15. /* HCSPARAMS2 - hcs_params2 - bitmasks */
  16. /* bits 0:3, frames or uframes that SW needs to queue transactions
  17. * ahead of the HW to meet periodic deadlines */
  18. #define HCS_IST(p) (((p) >> 0) & 0xf)
  19. /* bits 4:7, max number of Event Ring segments */
  20. #define HCS_ERST_MAX(p) (((p) >> 4) & 0xf)
  21. /* bits 21:25 Hi 5 bits of Scratchpad buffers SW must allocate for the HW */
  22. /* bit 26 Scratchpad restore - for save/restore HW state - not used yet */
  23. /* bits 27:31 Lo 5 bits of Scratchpad buffers SW must allocate for the HW */
  24. #define HCS_MAX_SCRATCHPAD(p) ((((p) >> 16) & 0x3e0) | (((p) >> 27) & 0x1f))
  25. /* HCSPARAMS3 - hcs_params3 - bitmasks */
  26. /* bits 0:7, Max U1 to U0 latency for the roothub ports */
  27. #define HCS_U1_LATENCY(p) (((p) >> 0) & 0xff)
  28. /* bits 16:31, Max U2 to U0 latency for the roothub ports */
  29. #define HCS_U2_LATENCY(p) (((p) >> 16) & 0xffff)
  30. /* HCCPARAMS - hcc_params - bitmasks */
  31. /* true: HC can use 64-bit address pointers */
  32. #define HCC_64BIT_ADDR(p) ((p) & (1 << 0))
  33. /* true: HC can do bandwidth negotiation */
  34. #define HCC_BANDWIDTH_NEG(p) ((p) & (1 << 1))
  35. /* true: HC uses 64-byte Device Context structures
  36. * FIXME 64-byte context structures aren't supported yet.
  37. */
  38. #define HCC_64BYTE_CONTEXT(p) ((p) & (1 << 2))
  39. /* true: HC has port power switches */
  40. #define HCC_PPC(p) ((p) & (1 << 3))
  41. /* true: HC has port indicators */
  42. #define HCS_INDICATOR(p) ((p) & (1 << 4))
  43. /* true: HC has Light HC Reset Capability */
  44. #define HCC_LIGHT_RESET(p) ((p) & (1 << 5))
  45. /* true: HC supports latency tolerance messaging */
  46. #define HCC_LTC(p) ((p) & (1 << 6))
  47. /* true: no secondary Stream ID Support */
  48. #define HCC_NSS(p) ((p) & (1 << 7))
  49. /* true: HC supports Stopped - Short Packet */
  50. #define HCC_SPC(p) ((p) & (1 << 9))
  51. /* true: HC has Contiguous Frame ID Capability */
  52. #define HCC_CFC(p) ((p) & (1 << 11))
  53. /* Max size for Primary Stream Arrays - 2^(n+1), where n is bits 12:15 */
  54. #define HCC_MAX_PSA(p) (1 << ((((p) >> 12) & 0xf) + 1))
  55. /* Extended Capabilities pointer from PCI base - section 5.3.6 */
  56. #define HCC_EXT_CAPS(p) XHCI_HCC_EXT_CAPS(p)
  57. #define CTX_SIZE(_hcc) (HCC_64BYTE_CONTEXT(_hcc) ? 64 : 32)
  58. /* db_off bitmask - bits 0:1 reserved */
  59. #define DBOFF_MASK (~0x3)
  60. /* run_regs_off bitmask - bits 0:4 reserved */
  61. #define RTSOFF_MASK (~0x1f)
  62. /* HCCPARAMS2 - hcc_params2 - bitmasks */
  63. /* true: HC supports U3 entry Capability */
  64. #define HCC2_U3C(p) ((p) & (1 << 0))
  65. /* true: HC supports Configure endpoint command Max exit latency too large */
  66. #define HCC2_CMC(p) ((p) & (1 << 1))
  67. /* true: HC supports Force Save context Capability */
  68. #define HCC2_FSC(p) ((p) & (1 << 2))
  69. /* true: HC supports Compliance Transition Capability */
  70. #define HCC2_CTC(p) ((p) & (1 << 3))
  71. /* true: HC support Large ESIT payload Capability > 48k */
  72. #define HCC2_LEC(p) ((p) & (1 << 4))
  73. /* true: HC support Configuration Information Capability */
  74. #define HCC2_CIC(p) ((p) & (1 << 5))
  75. /* true: HC support Extended TBC Capability, Isoc burst count > 65535 */
  76. #define HCC2_ETC(p) ((p) & (1 << 6))