hw.h 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. /*
  2. * Copyright(c) 2004 - 2009 Intel Corporation. All rights reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify it
  5. * under the terms of the GNU General Public License as published by the Free
  6. * Software Foundation; either version 2 of the License, or (at your option)
  7. * any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful, but WITHOUT
  10. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12. * more details.
  13. *
  14. * The full GNU General Public License is included in this distribution in the
  15. * file called COPYING.
  16. */
  17. #ifndef _IOAT_HW_H_
  18. #define _IOAT_HW_H_
  19. /* PCI Configuration Space Values */
  20. #define IOAT_MMIO_BAR 0
  21. /* CB device ID's */
  22. #define PCI_DEVICE_ID_INTEL_IOAT_IVB0 0x0e20
  23. #define PCI_DEVICE_ID_INTEL_IOAT_IVB1 0x0e21
  24. #define PCI_DEVICE_ID_INTEL_IOAT_IVB2 0x0e22
  25. #define PCI_DEVICE_ID_INTEL_IOAT_IVB3 0x0e23
  26. #define PCI_DEVICE_ID_INTEL_IOAT_IVB4 0x0e24
  27. #define PCI_DEVICE_ID_INTEL_IOAT_IVB5 0x0e25
  28. #define PCI_DEVICE_ID_INTEL_IOAT_IVB6 0x0e26
  29. #define PCI_DEVICE_ID_INTEL_IOAT_IVB7 0x0e27
  30. #define PCI_DEVICE_ID_INTEL_IOAT_IVB8 0x0e2e
  31. #define PCI_DEVICE_ID_INTEL_IOAT_IVB9 0x0e2f
  32. #define PCI_DEVICE_ID_INTEL_IOAT_HSW0 0x2f20
  33. #define PCI_DEVICE_ID_INTEL_IOAT_HSW1 0x2f21
  34. #define PCI_DEVICE_ID_INTEL_IOAT_HSW2 0x2f22
  35. #define PCI_DEVICE_ID_INTEL_IOAT_HSW3 0x2f23
  36. #define PCI_DEVICE_ID_INTEL_IOAT_HSW4 0x2f24
  37. #define PCI_DEVICE_ID_INTEL_IOAT_HSW5 0x2f25
  38. #define PCI_DEVICE_ID_INTEL_IOAT_HSW6 0x2f26
  39. #define PCI_DEVICE_ID_INTEL_IOAT_HSW7 0x2f27
  40. #define PCI_DEVICE_ID_INTEL_IOAT_HSW8 0x2f2e
  41. #define PCI_DEVICE_ID_INTEL_IOAT_HSW9 0x2f2f
  42. #define PCI_DEVICE_ID_INTEL_IOAT_BWD0 0x0C50
  43. #define PCI_DEVICE_ID_INTEL_IOAT_BWD1 0x0C51
  44. #define PCI_DEVICE_ID_INTEL_IOAT_BWD2 0x0C52
  45. #define PCI_DEVICE_ID_INTEL_IOAT_BWD3 0x0C53
  46. #define PCI_DEVICE_ID_INTEL_IOAT_BDXDE0 0x6f50
  47. #define PCI_DEVICE_ID_INTEL_IOAT_BDXDE1 0x6f51
  48. #define PCI_DEVICE_ID_INTEL_IOAT_BDXDE2 0x6f52
  49. #define PCI_DEVICE_ID_INTEL_IOAT_BDXDE3 0x6f53
  50. #define PCI_DEVICE_ID_INTEL_IOAT_BDX0 0x6f20
  51. #define PCI_DEVICE_ID_INTEL_IOAT_BDX1 0x6f21
  52. #define PCI_DEVICE_ID_INTEL_IOAT_BDX2 0x6f22
  53. #define PCI_DEVICE_ID_INTEL_IOAT_BDX3 0x6f23
  54. #define PCI_DEVICE_ID_INTEL_IOAT_BDX4 0x6f24
  55. #define PCI_DEVICE_ID_INTEL_IOAT_BDX5 0x6f25
  56. #define PCI_DEVICE_ID_INTEL_IOAT_BDX6 0x6f26
  57. #define PCI_DEVICE_ID_INTEL_IOAT_BDX7 0x6f27
  58. #define PCI_DEVICE_ID_INTEL_IOAT_BDX8 0x6f2e
  59. #define PCI_DEVICE_ID_INTEL_IOAT_BDX9 0x6f2f
  60. #define PCI_DEVICE_ID_INTEL_IOAT_SKX 0x2021
  61. #define IOAT_VER_1_2 0x12 /* Version 1.2 */
  62. #define IOAT_VER_2_0 0x20 /* Version 2.0 */
  63. #define IOAT_VER_3_0 0x30 /* Version 3.0 */
  64. #define IOAT_VER_3_2 0x32 /* Version 3.2 */
  65. #define IOAT_VER_3_3 0x33 /* Version 3.3 */
  66. int system_has_dca_enabled(struct pci_dev *pdev);
  67. #define IOAT_DESC_SZ 64
  68. struct ioat_dma_descriptor {
  69. uint32_t size;
  70. union {
  71. uint32_t ctl;
  72. struct {
  73. unsigned int int_en:1;
  74. unsigned int src_snoop_dis:1;
  75. unsigned int dest_snoop_dis:1;
  76. unsigned int compl_write:1;
  77. unsigned int fence:1;
  78. unsigned int null:1;
  79. unsigned int src_brk:1;
  80. unsigned int dest_brk:1;
  81. unsigned int bundle:1;
  82. unsigned int dest_dca:1;
  83. unsigned int hint:1;
  84. unsigned int rsvd2:13;
  85. #define IOAT_OP_COPY 0x00
  86. unsigned int op:8;
  87. } ctl_f;
  88. };
  89. uint64_t src_addr;
  90. uint64_t dst_addr;
  91. uint64_t next;
  92. uint64_t rsv1;
  93. uint64_t rsv2;
  94. /* store some driver data in an unused portion of the descriptor */
  95. union {
  96. uint64_t user1;
  97. uint64_t tx_cnt;
  98. };
  99. uint64_t user2;
  100. };
  101. struct ioat_xor_descriptor {
  102. uint32_t size;
  103. union {
  104. uint32_t ctl;
  105. struct {
  106. unsigned int int_en:1;
  107. unsigned int src_snoop_dis:1;
  108. unsigned int dest_snoop_dis:1;
  109. unsigned int compl_write:1;
  110. unsigned int fence:1;
  111. unsigned int src_cnt:3;
  112. unsigned int bundle:1;
  113. unsigned int dest_dca:1;
  114. unsigned int hint:1;
  115. unsigned int rsvd:13;
  116. #define IOAT_OP_XOR 0x87
  117. #define IOAT_OP_XOR_VAL 0x88
  118. unsigned int op:8;
  119. } ctl_f;
  120. };
  121. uint64_t src_addr;
  122. uint64_t dst_addr;
  123. uint64_t next;
  124. uint64_t src_addr2;
  125. uint64_t src_addr3;
  126. uint64_t src_addr4;
  127. uint64_t src_addr5;
  128. };
  129. struct ioat_xor_ext_descriptor {
  130. uint64_t src_addr6;
  131. uint64_t src_addr7;
  132. uint64_t src_addr8;
  133. uint64_t next;
  134. uint64_t rsvd[4];
  135. };
  136. struct ioat_pq_descriptor {
  137. union {
  138. uint32_t size;
  139. uint32_t dwbes;
  140. struct {
  141. unsigned int rsvd:25;
  142. unsigned int p_val_err:1;
  143. unsigned int q_val_err:1;
  144. unsigned int rsvd1:4;
  145. unsigned int wbes:1;
  146. } dwbes_f;
  147. };
  148. union {
  149. uint32_t ctl;
  150. struct {
  151. unsigned int int_en:1;
  152. unsigned int src_snoop_dis:1;
  153. unsigned int dest_snoop_dis:1;
  154. unsigned int compl_write:1;
  155. unsigned int fence:1;
  156. unsigned int src_cnt:3;
  157. unsigned int bundle:1;
  158. unsigned int dest_dca:1;
  159. unsigned int hint:1;
  160. unsigned int p_disable:1;
  161. unsigned int q_disable:1;
  162. unsigned int rsvd2:2;
  163. unsigned int wb_en:1;
  164. unsigned int prl_en:1;
  165. unsigned int rsvd3:7;
  166. #define IOAT_OP_PQ 0x89
  167. #define IOAT_OP_PQ_VAL 0x8a
  168. #define IOAT_OP_PQ_16S 0xa0
  169. #define IOAT_OP_PQ_VAL_16S 0xa1
  170. unsigned int op:8;
  171. } ctl_f;
  172. };
  173. uint64_t src_addr;
  174. uint64_t p_addr;
  175. uint64_t next;
  176. uint64_t src_addr2;
  177. union {
  178. uint64_t src_addr3;
  179. uint64_t sed_addr;
  180. };
  181. uint8_t coef[8];
  182. uint64_t q_addr;
  183. };
  184. struct ioat_pq_ext_descriptor {
  185. uint64_t src_addr4;
  186. uint64_t src_addr5;
  187. uint64_t src_addr6;
  188. uint64_t next;
  189. uint64_t src_addr7;
  190. uint64_t src_addr8;
  191. uint64_t rsvd[2];
  192. };
  193. struct ioat_pq_update_descriptor {
  194. uint32_t size;
  195. union {
  196. uint32_t ctl;
  197. struct {
  198. unsigned int int_en:1;
  199. unsigned int src_snoop_dis:1;
  200. unsigned int dest_snoop_dis:1;
  201. unsigned int compl_write:1;
  202. unsigned int fence:1;
  203. unsigned int src_cnt:3;
  204. unsigned int bundle:1;
  205. unsigned int dest_dca:1;
  206. unsigned int hint:1;
  207. unsigned int p_disable:1;
  208. unsigned int q_disable:1;
  209. unsigned int rsvd:3;
  210. unsigned int coef:8;
  211. #define IOAT_OP_PQ_UP 0x8b
  212. unsigned int op:8;
  213. } ctl_f;
  214. };
  215. uint64_t src_addr;
  216. uint64_t p_addr;
  217. uint64_t next;
  218. uint64_t src_addr2;
  219. uint64_t p_src;
  220. uint64_t q_src;
  221. uint64_t q_addr;
  222. };
  223. struct ioat_raw_descriptor {
  224. uint64_t field[8];
  225. };
  226. struct ioat_pq16a_descriptor {
  227. uint8_t coef[8];
  228. uint64_t src_addr3;
  229. uint64_t src_addr4;
  230. uint64_t src_addr5;
  231. uint64_t src_addr6;
  232. uint64_t src_addr7;
  233. uint64_t src_addr8;
  234. uint64_t src_addr9;
  235. };
  236. struct ioat_pq16b_descriptor {
  237. uint64_t src_addr10;
  238. uint64_t src_addr11;
  239. uint64_t src_addr12;
  240. uint64_t src_addr13;
  241. uint64_t src_addr14;
  242. uint64_t src_addr15;
  243. uint64_t src_addr16;
  244. uint64_t rsvd;
  245. };
  246. union ioat_sed_pq_descriptor {
  247. struct ioat_pq16a_descriptor a;
  248. struct ioat_pq16b_descriptor b;
  249. };
  250. #define SED_SIZE 64
  251. struct ioat_sed_raw_descriptor {
  252. uint64_t a[8];
  253. uint64_t b[8];
  254. uint64_t c[8];
  255. };
  256. #endif