hw-ish-regs.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*
  2. * ISH registers definitions
  3. *
  4. * Copyright (c) 2012-2016, Intel Corporation.
  5. *
  6. * This program is free software; you can redistribute it and/or modify it
  7. * under the terms and conditions of the GNU General Public License,
  8. * version 2, as published by the Free Software Foundation.
  9. *
  10. * This program is distributed in the hope it will be useful, but WITHOUT
  11. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  13. * more details.
  14. */
  15. #ifndef _ISHTP_ISH_REGS_H_
  16. #define _ISHTP_ISH_REGS_H_
  17. /*** IPC PCI Offsets and sizes ***/
  18. /* ISH IPC Base Address */
  19. #define IPC_REG_BASE 0x0000
  20. /* Peripheral Interrupt Status Register */
  21. #define IPC_REG_PISR_CHV_AB (IPC_REG_BASE + 0x00)
  22. /* Peripheral Interrupt Mask Register */
  23. #define IPC_REG_PIMR_CHV_AB (IPC_REG_BASE + 0x04)
  24. /*BXT, CHV_K0*/
  25. /*Peripheral Interrupt Status Register */
  26. #define IPC_REG_PISR_BXT (IPC_REG_BASE + 0x0C)
  27. /*Peripheral Interrupt Mask Register */
  28. #define IPC_REG_PIMR_BXT (IPC_REG_BASE + 0x08)
  29. /***********************************/
  30. /* ISH Host Firmware status Register */
  31. #define IPC_REG_ISH_HOST_FWSTS (IPC_REG_BASE + 0x34)
  32. /* Host Communication Register */
  33. #define IPC_REG_HOST_COMM (IPC_REG_BASE + 0x38)
  34. /* Reset register */
  35. #define IPC_REG_ISH_RST (IPC_REG_BASE + 0x44)
  36. /* Inbound doorbell register Host to ISH */
  37. #define IPC_REG_HOST2ISH_DRBL (IPC_REG_BASE + 0x48)
  38. /* Outbound doorbell register ISH to Host */
  39. #define IPC_REG_ISH2HOST_DRBL (IPC_REG_BASE + 0x54)
  40. /* ISH to HOST message registers */
  41. #define IPC_REG_ISH2HOST_MSG (IPC_REG_BASE + 0x60)
  42. /* HOST to ISH message registers */
  43. #define IPC_REG_HOST2ISH_MSG (IPC_REG_BASE + 0xE0)
  44. /* REMAP2 to enable DMA (D3 RCR) */
  45. #define IPC_REG_ISH_RMP2 (IPC_REG_BASE + 0x368)
  46. #define IPC_REG_MAX (IPC_REG_BASE + 0x400)
  47. /*** register bits - HISR ***/
  48. /* bit corresponds HOST2ISH interrupt in PISR and PIMR registers */
  49. #define IPC_INT_HOST2ISH_BIT (1<<0)
  50. /***********************************/
  51. /*CHV_A0, CHV_B0*/
  52. /* bit corresponds ISH2HOST interrupt in PISR and PIMR registers */
  53. #define IPC_INT_ISH2HOST_BIT_CHV_AB (1<<3)
  54. /*BXT, CHV_K0*/
  55. /* bit corresponds ISH2HOST interrupt in PISR and PIMR registers */
  56. #define IPC_INT_ISH2HOST_BIT_BXT (1<<0)
  57. /***********************************/
  58. /* bit corresponds ISH2HOST busy clear interrupt in PIMR register */
  59. #define IPC_INT_ISH2HOST_CLR_MASK_BIT (1<<11)
  60. /* offset of ISH2HOST busy clear interrupt in IPC_BUSY_CLR register */
  61. #define IPC_INT_ISH2HOST_CLR_OFFS (0)
  62. /* bit corresponds ISH2HOST busy clear interrupt in IPC_BUSY_CLR register */
  63. #define IPC_INT_ISH2HOST_CLR_BIT (1<<IPC_INT_ISH2HOST_CLR_OFFS)
  64. /* bit corresponds busy bit in doorbell registers */
  65. #define IPC_DRBL_BUSY_OFFS (31)
  66. #define IPC_DRBL_BUSY_BIT (1<<IPC_DRBL_BUSY_OFFS)
  67. #define IPC_HOST_OWNS_MSG_OFFS (30)
  68. /*
  69. * A0: bit means that host owns MSGnn registers and is reading them.
  70. * ISH FW may not write to them
  71. */
  72. #define IPC_HOST_OWNS_MSG_BIT (1<<IPC_HOST_OWNS_MSG_OFFS)
  73. /*
  74. * Host status bits (HOSTCOMM)
  75. */
  76. /* bit corresponds host ready bit in Host Status Register (HOST_COMM) */
  77. #define IPC_HOSTCOMM_READY_OFFS (7)
  78. #define IPC_HOSTCOMM_READY_BIT (1<<IPC_HOSTCOMM_READY_OFFS)
  79. /***********************************/
  80. /*CHV_A0, CHV_B0*/
  81. #define IPC_HOSTCOMM_INT_EN_OFFS_CHV_AB (31)
  82. #define IPC_HOSTCOMM_INT_EN_BIT_CHV_AB \
  83. (1<<IPC_HOSTCOMM_INT_EN_OFFS_CHV_AB)
  84. /*BXT, CHV_K0*/
  85. #define IPC_PIMR_INT_EN_OFFS_BXT (0)
  86. #define IPC_PIMR_INT_EN_BIT_BXT (1<<IPC_PIMR_INT_EN_OFFS_BXT)
  87. #define IPC_HOST2ISH_BUSYCLEAR_MASK_OFFS_BXT (8)
  88. #define IPC_HOST2ISH_BUSYCLEAR_MASK_BIT \
  89. (1<<IPC_HOST2ISH_BUSYCLEAR_MASK_OFFS_BXT)
  90. /***********************************/
  91. /*
  92. * both Host and ISH have ILUP at bit 0
  93. * bit corresponds host ready bit in both status registers
  94. */
  95. #define IPC_ILUP_OFFS (0)
  96. #define IPC_ILUP_BIT (1<<IPC_ILUP_OFFS)
  97. /*
  98. * FW status bits (relevant)
  99. */
  100. #define IPC_FWSTS_ILUP 0x1
  101. #define IPC_FWSTS_ISHTP_UP (1<<1)
  102. #define IPC_FWSTS_DMA0 (1<<16)
  103. #define IPC_FWSTS_DMA1 (1<<17)
  104. #define IPC_FWSTS_DMA2 (1<<18)
  105. #define IPC_FWSTS_DMA3 (1<<19)
  106. #define IPC_ISH_IN_DMA \
  107. (IPC_FWSTS_DMA0 | IPC_FWSTS_DMA1 | IPC_FWSTS_DMA2 | IPC_FWSTS_DMA3)
  108. /* bit corresponds host ready bit in ISH FW Status Register */
  109. #define IPC_ISH_ISHTP_READY_OFFS (1)
  110. #define IPC_ISH_ISHTP_READY_BIT (1<<IPC_ISH_ISHTP_READY_OFFS)
  111. #define IPC_RMP2_DMA_ENABLED 0x1 /* Value to enable DMA, per D3 RCR */
  112. #define IPC_MSG_MAX_SIZE 0x80
  113. #define IPC_HEADER_LENGTH_MASK 0x03FF
  114. #define IPC_HEADER_PROTOCOL_MASK 0x0F
  115. #define IPC_HEADER_MNG_CMD_MASK 0x0F
  116. #define IPC_HEADER_LENGTH_OFFSET 0
  117. #define IPC_HEADER_PROTOCOL_OFFSET 10
  118. #define IPC_HEADER_MNG_CMD_OFFSET 16
  119. #define IPC_HEADER_GET_LENGTH(drbl_reg) \
  120. (((drbl_reg) >> IPC_HEADER_LENGTH_OFFSET)&IPC_HEADER_LENGTH_MASK)
  121. #define IPC_HEADER_GET_PROTOCOL(drbl_reg) \
  122. (((drbl_reg) >> IPC_HEADER_PROTOCOL_OFFSET)&IPC_HEADER_PROTOCOL_MASK)
  123. #define IPC_HEADER_GET_MNG_CMD(drbl_reg) \
  124. (((drbl_reg) >> IPC_HEADER_MNG_CMD_OFFSET)&IPC_HEADER_MNG_CMD_MASK)
  125. #define IPC_IS_BUSY(drbl_reg) \
  126. (((drbl_reg)&IPC_DRBL_BUSY_BIT) == ((uint32_t)IPC_DRBL_BUSY_BIT))
  127. /***********************************/
  128. /*CHV_A0, CHV_B0*/
  129. #define IPC_INT_FROM_ISH_TO_HOST_CHV_AB(drbl_reg) \
  130. (((drbl_reg)&IPC_INT_ISH2HOST_BIT_CHV_AB) == \
  131. ((u32)IPC_INT_ISH2HOST_BIT_CHV_AB))
  132. /*BXT, CHV_K0*/
  133. #define IPC_INT_FROM_ISH_TO_HOST_BXT(drbl_reg) \
  134. (((drbl_reg)&IPC_INT_ISH2HOST_BIT_BXT) == \
  135. ((u32)IPC_INT_ISH2HOST_BIT_BXT))
  136. /***********************************/
  137. #define IPC_BUILD_HEADER(length, protocol, busy) \
  138. (((busy)<<IPC_DRBL_BUSY_OFFS) | \
  139. ((protocol) << IPC_HEADER_PROTOCOL_OFFSET) | \
  140. ((length)<<IPC_HEADER_LENGTH_OFFSET))
  141. #define IPC_BUILD_MNG_MSG(cmd, length) \
  142. (((1)<<IPC_DRBL_BUSY_OFFS)| \
  143. ((IPC_PROTOCOL_MNG)<<IPC_HEADER_PROTOCOL_OFFSET)| \
  144. ((cmd)<<IPC_HEADER_MNG_CMD_OFFSET)| \
  145. ((length)<<IPC_HEADER_LENGTH_OFFSET))
  146. #define IPC_SET_HOST_READY(host_status) \
  147. ((host_status) |= (IPC_HOSTCOMM_READY_BIT))
  148. #define IPC_SET_HOST_ILUP(host_status) \
  149. ((host_status) |= (IPC_ILUP_BIT))
  150. #define IPC_CLEAR_HOST_READY(host_status) \
  151. ((host_status) ^= (IPC_HOSTCOMM_READY_BIT))
  152. #define IPC_CLEAR_HOST_ILUP(host_status) \
  153. ((host_status) ^= (IPC_ILUP_BIT))
  154. /* todo - temp until PIMR HW ready */
  155. #define IPC_HOST_BUSY_READING_OFFS 6
  156. /* bit corresponds host ready bit in Host Status Register (HOST_COMM) */
  157. #define IPC_HOST_BUSY_READING_BIT (1<<IPC_HOST_BUSY_READING_OFFS)
  158. #define IPC_SET_HOST_BUSY_READING(host_status) \
  159. ((host_status) |= (IPC_HOST_BUSY_READING_BIT))
  160. #define IPC_CLEAR_HOST_BUSY_READING(host_status)\
  161. ((host_status) ^= (IPC_HOST_BUSY_READING_BIT))
  162. #define IPC_IS_ISH_ISHTP_READY(ish_status) \
  163. (((ish_status) & IPC_ISH_ISHTP_READY_BIT) == \
  164. ((uint32_t)IPC_ISH_ISHTP_READY_BIT))
  165. #define IPC_IS_ISH_ILUP(ish_status) \
  166. (((ish_status) & IPC_ILUP_BIT) == ((uint32_t)IPC_ILUP_BIT))
  167. #define IPC_PROTOCOL_ISHTP 1
  168. #define IPC_PROTOCOL_MNG 3
  169. #define MNG_RX_CMPL_ENABLE 0
  170. #define MNG_RX_CMPL_DISABLE 1
  171. #define MNG_RX_CMPL_INDICATION 2
  172. #define MNG_RESET_NOTIFY 3
  173. #define MNG_RESET_NOTIFY_ACK 4
  174. #define MNG_SYNC_FW_CLOCK 5
  175. #define MNG_ILLEGAL_CMD 0xFF
  176. #endif /* _ISHTP_ISH_REGS_H_ */