hw-txe-regs.h 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
  2. /*
  3. * Copyright (c) 2013-2014, Intel Corporation. All rights reserved.
  4. * Intel Management Engine Interface (Intel MEI) Linux driver
  5. */
  6. #ifndef _MEI_HW_TXE_REGS_H_
  7. #define _MEI_HW_TXE_REGS_H_
  8. #include "hw.h"
  9. #define SEC_ALIVENESS_TIMER_TIMEOUT (5 * MSEC_PER_SEC)
  10. #define SEC_ALIVENESS_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  11. #define SEC_RESET_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  12. #define SEC_READY_WAIT_TIMEOUT (5 * MSEC_PER_SEC)
  13. #define START_MESSAGE_RESPONSE_WAIT_TIMEOUT (5 * MSEC_PER_SEC)
  14. #define RESET_CANCEL_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  15. enum {
  16. SEC_BAR,
  17. BRIDGE_BAR,
  18. NUM_OF_MEM_BARS
  19. };
  20. /* SeC FW Status Register
  21. *
  22. * FW uses this register in order to report its status to host.
  23. * This register resides in PCI-E config space.
  24. */
  25. #define PCI_CFG_TXE_FW_STS0 0x40
  26. # define PCI_CFG_TXE_FW_STS0_WRK_ST_MSK 0x0000000F
  27. # define PCI_CFG_TXE_FW_STS0_OP_ST_MSK 0x000001C0
  28. # define PCI_CFG_TXE_FW_STS0_FW_INIT_CMPLT 0x00000200
  29. # define PCI_CFG_TXE_FW_STS0_ERR_CODE_MSK 0x0000F000
  30. # define PCI_CFG_TXE_FW_STS0_OP_MODE_MSK 0x000F0000
  31. # define PCI_CFG_TXE_FW_STS0_RST_CNT_MSK 0x00F00000
  32. #define PCI_CFG_TXE_FW_STS1 0x48
  33. #define IPC_BASE_ADDR 0x80400 /* SeC IPC Base Address */
  34. /* IPC Input Doorbell Register */
  35. #define SEC_IPC_INPUT_DOORBELL_REG (0x0000 + IPC_BASE_ADDR)
  36. /* IPC Input Status Register
  37. * This register indicates whether or not processing of
  38. * the most recent command has been completed by the SEC
  39. * New commands and payloads should not be written by the Host
  40. * until this indicates that the previous command has been processed.
  41. */
  42. #define SEC_IPC_INPUT_STATUS_REG (0x0008 + IPC_BASE_ADDR)
  43. # define SEC_IPC_INPUT_STATUS_RDY BIT(0)
  44. /* IPC Host Interrupt Status Register */
  45. #define SEC_IPC_HOST_INT_STATUS_REG (0x0010 + IPC_BASE_ADDR)
  46. #define SEC_IPC_HOST_INT_STATUS_OUT_DB BIT(0)
  47. #define SEC_IPC_HOST_INT_STATUS_IN_RDY BIT(1)
  48. #define SEC_IPC_HOST_INT_STATUS_HDCP_M0_RCVD BIT(5)
  49. #define SEC_IPC_HOST_INT_STATUS_ILL_MEM_ACCESS BIT(17)
  50. #define SEC_IPC_HOST_INT_STATUS_AES_HKEY_ERR BIT(18)
  51. #define SEC_IPC_HOST_INT_STATUS_DES_HKEY_ERR BIT(19)
  52. #define SEC_IPC_HOST_INT_STATUS_TMRMTB_OVERFLOW BIT(21)
  53. /* Convenient mask for pending interrupts */
  54. #define SEC_IPC_HOST_INT_STATUS_PENDING \
  55. (SEC_IPC_HOST_INT_STATUS_OUT_DB| \
  56. SEC_IPC_HOST_INT_STATUS_IN_RDY)
  57. /* IPC Host Interrupt Mask Register */
  58. #define SEC_IPC_HOST_INT_MASK_REG (0x0014 + IPC_BASE_ADDR)
  59. # define SEC_IPC_HOST_INT_MASK_OUT_DB BIT(0) /* Output Doorbell Int Mask */
  60. # define SEC_IPC_HOST_INT_MASK_IN_RDY BIT(1) /* Input Ready Int Mask */
  61. /* IPC Input Payload RAM */
  62. #define SEC_IPC_INPUT_PAYLOAD_REG (0x0100 + IPC_BASE_ADDR)
  63. /* IPC Shared Payload RAM */
  64. #define IPC_SHARED_PAYLOAD_REG (0x0200 + IPC_BASE_ADDR)
  65. /* SeC Address Translation Table Entry 2 - Ctrl
  66. *
  67. * This register resides also in SeC's PCI-E Memory space.
  68. */
  69. #define SATT2_CTRL_REG 0x1040
  70. # define SATT2_CTRL_VALID_MSK BIT(0)
  71. # define SATT2_CTRL_BR_BASE_ADDR_REG_SHIFT 8
  72. # define SATT2_CTRL_BRIDGE_HOST_EN_MSK BIT(12)
  73. /* SATT Table Entry 2 SAP Base Address Register */
  74. #define SATT2_SAP_BA_REG 0x1044
  75. /* SATT Table Entry 2 SAP Size Register. */
  76. #define SATT2_SAP_SIZE_REG 0x1048
  77. /* SATT Table Entry 2 SAP Bridge Address - LSB Register */
  78. #define SATT2_BRG_BA_LSB_REG 0x104C
  79. /* Host High-level Interrupt Status Register */
  80. #define HHISR_REG 0x2020
  81. /* Host High-level Interrupt Enable Register
  82. *
  83. * Resides in PCI memory space. This is the top hierarchy for
  84. * interrupts from SeC to host, aggregating both interrupts that
  85. * arrive through HICR registers as well as interrupts
  86. * that arrive via IPC.
  87. */
  88. #define HHIER_REG 0x2024
  89. #define IPC_HHIER_SEC BIT(0)
  90. #define IPC_HHIER_BRIDGE BIT(1)
  91. #define IPC_HHIER_MSK (IPC_HHIER_SEC | IPC_HHIER_BRIDGE)
  92. /* Host High-level Interrupt Mask Register.
  93. *
  94. * Resides in PCI memory space.
  95. * This is the top hierarchy for masking interrupts from SeC to host.
  96. */
  97. #define HHIMR_REG 0x2028
  98. #define IPC_HHIMR_SEC BIT(0)
  99. #define IPC_HHIMR_BRIDGE BIT(1)
  100. /* Host High-level IRQ Status Register */
  101. #define HHIRQSR_REG 0x202C
  102. /* Host Interrupt Cause Register 0 - SeC IPC Readiness
  103. *
  104. * This register is both an ICR to Host from PCI Memory Space
  105. * and it is also exposed in the SeC memory space.
  106. * This register is used by SeC's IPC driver in order
  107. * to synchronize with host about IPC interface state.
  108. */
  109. #define HICR_SEC_IPC_READINESS_REG 0x2040
  110. #define HICR_SEC_IPC_READINESS_HOST_RDY BIT(0)
  111. #define HICR_SEC_IPC_READINESS_SEC_RDY BIT(1)
  112. #define HICR_SEC_IPC_READINESS_SYS_RDY \
  113. (HICR_SEC_IPC_READINESS_HOST_RDY | \
  114. HICR_SEC_IPC_READINESS_SEC_RDY)
  115. #define HICR_SEC_IPC_READINESS_RDY_CLR BIT(2)
  116. /* Host Interrupt Cause Register 1 - Aliveness Response */
  117. /* This register is both an ICR to Host from PCI Memory Space
  118. * and it is also exposed in the SeC memory space.
  119. * The register may be used by SeC to ACK a host request for aliveness.
  120. */
  121. #define HICR_HOST_ALIVENESS_RESP_REG 0x2044
  122. #define HICR_HOST_ALIVENESS_RESP_ACK BIT(0)
  123. /* Host Interrupt Cause Register 2 - SeC IPC Output Doorbell */
  124. #define HICR_SEC_IPC_OUTPUT_DOORBELL_REG 0x2048
  125. /* Host Interrupt Status Register.
  126. *
  127. * Resides in PCI memory space.
  128. * This is the main register involved in generating interrupts
  129. * from SeC to host via HICRs.
  130. * The interrupt generation rules are as follows:
  131. * An interrupt will be generated whenever for any i,
  132. * there is a transition from a state where at least one of
  133. * the following conditions did not hold, to a state where
  134. * ALL the following conditions hold:
  135. * A) HISR.INT[i]_STS == 1.
  136. * B) HIER.INT[i]_EN == 1.
  137. */
  138. #define HISR_REG 0x2060
  139. #define HISR_INT_0_STS BIT(0)
  140. #define HISR_INT_1_STS BIT(1)
  141. #define HISR_INT_2_STS BIT(2)
  142. #define HISR_INT_3_STS BIT(3)
  143. #define HISR_INT_4_STS BIT(4)
  144. #define HISR_INT_5_STS BIT(5)
  145. #define HISR_INT_6_STS BIT(6)
  146. #define HISR_INT_7_STS BIT(7)
  147. #define HISR_INT_STS_MSK \
  148. (HISR_INT_0_STS | HISR_INT_1_STS | HISR_INT_2_STS)
  149. /* Host Interrupt Enable Register. Resides in PCI memory space. */
  150. #define HIER_REG 0x2064
  151. #define HIER_INT_0_EN BIT(0)
  152. #define HIER_INT_1_EN BIT(1)
  153. #define HIER_INT_2_EN BIT(2)
  154. #define HIER_INT_3_EN BIT(3)
  155. #define HIER_INT_4_EN BIT(4)
  156. #define HIER_INT_5_EN BIT(5)
  157. #define HIER_INT_6_EN BIT(6)
  158. #define HIER_INT_7_EN BIT(7)
  159. #define HIER_INT_EN_MSK \
  160. (HIER_INT_0_EN | HIER_INT_1_EN | HIER_INT_2_EN)
  161. /* SEC Memory Space IPC output payload.
  162. *
  163. * This register is part of the output payload which SEC provides to host.
  164. */
  165. #define BRIDGE_IPC_OUTPUT_PAYLOAD_REG 0x20C0
  166. /* SeC Interrupt Cause Register - Host Aliveness Request
  167. * This register is both an ICR to SeC and it is also exposed
  168. * in the host-visible PCI memory space.
  169. * The register is used by host to request SeC aliveness.
  170. */
  171. #define SICR_HOST_ALIVENESS_REQ_REG 0x214C
  172. #define SICR_HOST_ALIVENESS_REQ_REQUESTED BIT(0)
  173. /* SeC Interrupt Cause Register - Host IPC Readiness
  174. *
  175. * This register is both an ICR to SeC and it is also exposed
  176. * in the host-visible PCI memory space.
  177. * This register is used by the host's SeC driver uses in order
  178. * to synchronize with SeC about IPC interface state.
  179. */
  180. #define SICR_HOST_IPC_READINESS_REQ_REG 0x2150
  181. #define SICR_HOST_IPC_READINESS_HOST_RDY BIT(0)
  182. #define SICR_HOST_IPC_READINESS_SEC_RDY BIT(1)
  183. #define SICR_HOST_IPC_READINESS_SYS_RDY \
  184. (SICR_HOST_IPC_READINESS_HOST_RDY | \
  185. SICR_HOST_IPC_READINESS_SEC_RDY)
  186. #define SICR_HOST_IPC_READINESS_RDY_CLR BIT(2)
  187. /* SeC Interrupt Cause Register - SeC IPC Output Status
  188. *
  189. * This register indicates whether or not processing of the most recent
  190. * command has been completed by the Host.
  191. * New commands and payloads should not be written by SeC until this
  192. * register indicates that the previous command has been processed.
  193. */
  194. #define SICR_SEC_IPC_OUTPUT_STATUS_REG 0x2154
  195. # define SEC_IPC_OUTPUT_STATUS_RDY BIT(0)
  196. /* MEI IPC Message payload size 64 bytes */
  197. #define PAYLOAD_SIZE 64
  198. /* MAX size for SATT range 32MB */
  199. #define SATT_RANGE_MAX (32 << 20)
  200. #endif /* _MEI_HW_TXE_REGS_H_ */