hw-txe-regs.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. /******************************************************************************
  2. * Intel Management Engine Interface (Intel MEI) Linux driver
  3. * Intel MEI Interface Header
  4. *
  5. * This file is provided under a dual BSD/GPLv2 license. When using or
  6. * redistributing this file, you may do so under either license.
  7. *
  8. * GPL LICENSE SUMMARY
  9. *
  10. * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of version 2 of the GNU General Public License as
  14. * published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful, but
  17. * WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  19. * General Public License for more details.
  20. *
  21. * The full GNU General Public License is included in this distribution
  22. * in the file called COPYING
  23. *
  24. * Contact Information:
  25. * Intel Corporation.
  26. * linux-mei@linux.intel.com
  27. * http://www.intel.com
  28. *
  29. * BSD LICENSE
  30. *
  31. * Copyright(c) 2013 - 2014 Intel Corporation. All rights reserved.
  32. * All rights reserved.
  33. *
  34. * Redistribution and use in source and binary forms, with or without
  35. * modification, are permitted provided that the following conditions
  36. * are met:
  37. *
  38. * * Redistributions of source code must retain the above copyright
  39. * notice, this list of conditions and the following disclaimer.
  40. * * Redistributions in binary form must reproduce the above copyright
  41. * notice, this list of conditions and the following disclaimer in
  42. * the documentation and/or other materials provided with the
  43. * distribution.
  44. * * Neither the name Intel Corporation nor the names of its
  45. * contributors may be used to endorse or promote products derived
  46. * from this software without specific prior written permission.
  47. *
  48. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  49. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  50. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  51. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  52. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  53. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  54. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  55. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  56. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  57. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  58. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  59. *
  60. *****************************************************************************/
  61. #ifndef _MEI_HW_TXE_REGS_H_
  62. #define _MEI_HW_TXE_REGS_H_
  63. #include "hw.h"
  64. #define SEC_ALIVENESS_TIMER_TIMEOUT (5 * MSEC_PER_SEC)
  65. #define SEC_ALIVENESS_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  66. #define SEC_RESET_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  67. #define SEC_READY_WAIT_TIMEOUT (5 * MSEC_PER_SEC)
  68. #define START_MESSAGE_RESPONSE_WAIT_TIMEOUT (5 * MSEC_PER_SEC)
  69. #define RESET_CANCEL_WAIT_TIMEOUT (1 * MSEC_PER_SEC)
  70. enum {
  71. SEC_BAR,
  72. BRIDGE_BAR,
  73. NUM_OF_MEM_BARS
  74. };
  75. /* SeC FW Status Register
  76. *
  77. * FW uses this register in order to report its status to host.
  78. * This register resides in PCI-E config space.
  79. */
  80. #define PCI_CFG_TXE_FW_STS0 0x40
  81. # define PCI_CFG_TXE_FW_STS0_WRK_ST_MSK 0x0000000F
  82. # define PCI_CFG_TXE_FW_STS0_OP_ST_MSK 0x000001C0
  83. # define PCI_CFG_TXE_FW_STS0_FW_INIT_CMPLT 0x00000200
  84. # define PCI_CFG_TXE_FW_STS0_ERR_CODE_MSK 0x0000F000
  85. # define PCI_CFG_TXE_FW_STS0_OP_MODE_MSK 0x000F0000
  86. # define PCI_CFG_TXE_FW_STS0_RST_CNT_MSK 0x00F00000
  87. #define PCI_CFG_TXE_FW_STS1 0x48
  88. #define IPC_BASE_ADDR 0x80400 /* SeC IPC Base Address */
  89. /* IPC Input Doorbell Register */
  90. #define SEC_IPC_INPUT_DOORBELL_REG (0x0000 + IPC_BASE_ADDR)
  91. /* IPC Input Status Register
  92. * This register indicates whether or not processing of
  93. * the most recent command has been completed by the SEC
  94. * New commands and payloads should not be written by the Host
  95. * until this indicates that the previous command has been processed.
  96. */
  97. #define SEC_IPC_INPUT_STATUS_REG (0x0008 + IPC_BASE_ADDR)
  98. # define SEC_IPC_INPUT_STATUS_RDY BIT(0)
  99. /* IPC Host Interrupt Status Register */
  100. #define SEC_IPC_HOST_INT_STATUS_REG (0x0010 + IPC_BASE_ADDR)
  101. #define SEC_IPC_HOST_INT_STATUS_OUT_DB BIT(0)
  102. #define SEC_IPC_HOST_INT_STATUS_IN_RDY BIT(1)
  103. #define SEC_IPC_HOST_INT_STATUS_HDCP_M0_RCVD BIT(5)
  104. #define SEC_IPC_HOST_INT_STATUS_ILL_MEM_ACCESS BIT(17)
  105. #define SEC_IPC_HOST_INT_STATUS_AES_HKEY_ERR BIT(18)
  106. #define SEC_IPC_HOST_INT_STATUS_DES_HKEY_ERR BIT(19)
  107. #define SEC_IPC_HOST_INT_STATUS_TMRMTB_OVERFLOW BIT(21)
  108. /* Convenient mask for pending interrupts */
  109. #define SEC_IPC_HOST_INT_STATUS_PENDING \
  110. (SEC_IPC_HOST_INT_STATUS_OUT_DB| \
  111. SEC_IPC_HOST_INT_STATUS_IN_RDY)
  112. /* IPC Host Interrupt Mask Register */
  113. #define SEC_IPC_HOST_INT_MASK_REG (0x0014 + IPC_BASE_ADDR)
  114. # define SEC_IPC_HOST_INT_MASK_OUT_DB BIT(0) /* Output Doorbell Int Mask */
  115. # define SEC_IPC_HOST_INT_MASK_IN_RDY BIT(1) /* Input Ready Int Mask */
  116. /* IPC Input Payload RAM */
  117. #define SEC_IPC_INPUT_PAYLOAD_REG (0x0100 + IPC_BASE_ADDR)
  118. /* IPC Shared Payload RAM */
  119. #define IPC_SHARED_PAYLOAD_REG (0x0200 + IPC_BASE_ADDR)
  120. /* SeC Address Translation Table Entry 2 - Ctrl
  121. *
  122. * This register resides also in SeC's PCI-E Memory space.
  123. */
  124. #define SATT2_CTRL_REG 0x1040
  125. # define SATT2_CTRL_VALID_MSK BIT(0)
  126. # define SATT2_CTRL_BR_BASE_ADDR_REG_SHIFT 8
  127. # define SATT2_CTRL_BRIDGE_HOST_EN_MSK BIT(12)
  128. /* SATT Table Entry 2 SAP Base Address Register */
  129. #define SATT2_SAP_BA_REG 0x1044
  130. /* SATT Table Entry 2 SAP Size Register. */
  131. #define SATT2_SAP_SIZE_REG 0x1048
  132. /* SATT Table Entry 2 SAP Bridge Address - LSB Register */
  133. #define SATT2_BRG_BA_LSB_REG 0x104C
  134. /* Host High-level Interrupt Status Register */
  135. #define HHISR_REG 0x2020
  136. /* Host High-level Interrupt Enable Register
  137. *
  138. * Resides in PCI memory space. This is the top hierarchy for
  139. * interrupts from SeC to host, aggregating both interrupts that
  140. * arrive through HICR registers as well as interrupts
  141. * that arrive via IPC.
  142. */
  143. #define HHIER_REG 0x2024
  144. #define IPC_HHIER_SEC BIT(0)
  145. #define IPC_HHIER_BRIDGE BIT(1)
  146. #define IPC_HHIER_MSK (IPC_HHIER_SEC | IPC_HHIER_BRIDGE)
  147. /* Host High-level Interrupt Mask Register.
  148. *
  149. * Resides in PCI memory space.
  150. * This is the top hierarchy for masking interrupts from SeC to host.
  151. */
  152. #define HHIMR_REG 0x2028
  153. #define IPC_HHIMR_SEC BIT(0)
  154. #define IPC_HHIMR_BRIDGE BIT(1)
  155. /* Host High-level IRQ Status Register */
  156. #define HHIRQSR_REG 0x202C
  157. /* Host Interrupt Cause Register 0 - SeC IPC Readiness
  158. *
  159. * This register is both an ICR to Host from PCI Memory Space
  160. * and it is also exposed in the SeC memory space.
  161. * This register is used by SeC's IPC driver in order
  162. * to synchronize with host about IPC interface state.
  163. */
  164. #define HICR_SEC_IPC_READINESS_REG 0x2040
  165. #define HICR_SEC_IPC_READINESS_HOST_RDY BIT(0)
  166. #define HICR_SEC_IPC_READINESS_SEC_RDY BIT(1)
  167. #define HICR_SEC_IPC_READINESS_SYS_RDY \
  168. (HICR_SEC_IPC_READINESS_HOST_RDY | \
  169. HICR_SEC_IPC_READINESS_SEC_RDY)
  170. #define HICR_SEC_IPC_READINESS_RDY_CLR BIT(2)
  171. /* Host Interrupt Cause Register 1 - Aliveness Response */
  172. /* This register is both an ICR to Host from PCI Memory Space
  173. * and it is also exposed in the SeC memory space.
  174. * The register may be used by SeC to ACK a host request for aliveness.
  175. */
  176. #define HICR_HOST_ALIVENESS_RESP_REG 0x2044
  177. #define HICR_HOST_ALIVENESS_RESP_ACK BIT(0)
  178. /* Host Interrupt Cause Register 2 - SeC IPC Output Doorbell */
  179. #define HICR_SEC_IPC_OUTPUT_DOORBELL_REG 0x2048
  180. /* Host Interrupt Status Register.
  181. *
  182. * Resides in PCI memory space.
  183. * This is the main register involved in generating interrupts
  184. * from SeC to host via HICRs.
  185. * The interrupt generation rules are as follows:
  186. * An interrupt will be generated whenever for any i,
  187. * there is a transition from a state where at least one of
  188. * the following conditions did not hold, to a state where
  189. * ALL the following conditions hold:
  190. * A) HISR.INT[i]_STS == 1.
  191. * B) HIER.INT[i]_EN == 1.
  192. */
  193. #define HISR_REG 0x2060
  194. #define HISR_INT_0_STS BIT(0)
  195. #define HISR_INT_1_STS BIT(1)
  196. #define HISR_INT_2_STS BIT(2)
  197. #define HISR_INT_3_STS BIT(3)
  198. #define HISR_INT_4_STS BIT(4)
  199. #define HISR_INT_5_STS BIT(5)
  200. #define HISR_INT_6_STS BIT(6)
  201. #define HISR_INT_7_STS BIT(7)
  202. #define HISR_INT_STS_MSK \
  203. (HISR_INT_0_STS | HISR_INT_1_STS | HISR_INT_2_STS)
  204. /* Host Interrupt Enable Register. Resides in PCI memory space. */
  205. #define HIER_REG 0x2064
  206. #define HIER_INT_0_EN BIT(0)
  207. #define HIER_INT_1_EN BIT(1)
  208. #define HIER_INT_2_EN BIT(2)
  209. #define HIER_INT_3_EN BIT(3)
  210. #define HIER_INT_4_EN BIT(4)
  211. #define HIER_INT_5_EN BIT(5)
  212. #define HIER_INT_6_EN BIT(6)
  213. #define HIER_INT_7_EN BIT(7)
  214. #define HIER_INT_EN_MSK \
  215. (HIER_INT_0_EN | HIER_INT_1_EN | HIER_INT_2_EN)
  216. /* SEC Memory Space IPC output payload.
  217. *
  218. * This register is part of the output payload which SEC provides to host.
  219. */
  220. #define BRIDGE_IPC_OUTPUT_PAYLOAD_REG 0x20C0
  221. /* SeC Interrupt Cause Register - Host Aliveness Request
  222. * This register is both an ICR to SeC and it is also exposed
  223. * in the host-visible PCI memory space.
  224. * The register is used by host to request SeC aliveness.
  225. */
  226. #define SICR_HOST_ALIVENESS_REQ_REG 0x214C
  227. #define SICR_HOST_ALIVENESS_REQ_REQUESTED BIT(0)
  228. /* SeC Interrupt Cause Register - Host IPC Readiness
  229. *
  230. * This register is both an ICR to SeC and it is also exposed
  231. * in the host-visible PCI memory space.
  232. * This register is used by the host's SeC driver uses in order
  233. * to synchronize with SeC about IPC interface state.
  234. */
  235. #define SICR_HOST_IPC_READINESS_REQ_REG 0x2150
  236. #define SICR_HOST_IPC_READINESS_HOST_RDY BIT(0)
  237. #define SICR_HOST_IPC_READINESS_SEC_RDY BIT(1)
  238. #define SICR_HOST_IPC_READINESS_SYS_RDY \
  239. (SICR_HOST_IPC_READINESS_HOST_RDY | \
  240. SICR_HOST_IPC_READINESS_SEC_RDY)
  241. #define SICR_HOST_IPC_READINESS_RDY_CLR BIT(2)
  242. /* SeC Interrupt Cause Register - SeC IPC Output Status
  243. *
  244. * This register indicates whether or not processing of the most recent
  245. * command has been completed by the Host.
  246. * New commands and payloads should not be written by SeC until this
  247. * register indicates that the previous command has been processed.
  248. */
  249. #define SICR_SEC_IPC_OUTPUT_STATUS_REG 0x2154
  250. # define SEC_IPC_OUTPUT_STATUS_RDY BIT(0)
  251. /* MEI IPC Message payload size 64 bytes */
  252. #define PAYLOAD_SIZE 64
  253. /* MAX size for SATT range 32MB */
  254. #define SATT_RANGE_MAX (32 << 20)
  255. #endif /* _MEI_HW_TXE_REGS_H_ */