hw.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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. * You should have received a copy of the GNU General Public License along with
  15. * this program; if not, write to the Free Software Foundation, Inc., 59
  16. * Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  17. *
  18. * The full GNU General Public License is included in this distribution in the
  19. * file called COPYING.
  20. */
  21. #ifndef _IOAT_HW_H_
  22. #define _IOAT_HW_H_
  23. /* PCI Configuration Space Values */
  24. #define IOAT_MMIO_BAR 0
  25. /* CB device ID's */
  26. #define IOAT_PCI_DID_5000 0x1A38
  27. #define IOAT_PCI_DID_CNB 0x360B
  28. #define IOAT_PCI_DID_SCNB 0x65FF
  29. #define IOAT_PCI_DID_SNB 0x402F
  30. #define PCI_DEVICE_ID_INTEL_IOAT_IVB0 0x0e20
  31. #define PCI_DEVICE_ID_INTEL_IOAT_IVB1 0x0e21
  32. #define PCI_DEVICE_ID_INTEL_IOAT_IVB2 0x0e22
  33. #define PCI_DEVICE_ID_INTEL_IOAT_IVB3 0x0e23
  34. #define PCI_DEVICE_ID_INTEL_IOAT_IVB4 0x0e24
  35. #define PCI_DEVICE_ID_INTEL_IOAT_IVB5 0x0e25
  36. #define PCI_DEVICE_ID_INTEL_IOAT_IVB6 0x0e26
  37. #define PCI_DEVICE_ID_INTEL_IOAT_IVB7 0x0e27
  38. #define PCI_DEVICE_ID_INTEL_IOAT_IVB8 0x0e2e
  39. #define PCI_DEVICE_ID_INTEL_IOAT_IVB9 0x0e2f
  40. #define PCI_DEVICE_ID_INTEL_IOAT_HSW0 0x2f20
  41. #define PCI_DEVICE_ID_INTEL_IOAT_HSW1 0x2f21
  42. #define PCI_DEVICE_ID_INTEL_IOAT_HSW2 0x2f22
  43. #define PCI_DEVICE_ID_INTEL_IOAT_HSW3 0x2f23
  44. #define PCI_DEVICE_ID_INTEL_IOAT_HSW4 0x2f24
  45. #define PCI_DEVICE_ID_INTEL_IOAT_HSW5 0x2f25
  46. #define PCI_DEVICE_ID_INTEL_IOAT_HSW6 0x2f26
  47. #define PCI_DEVICE_ID_INTEL_IOAT_HSW7 0x2f27
  48. #define PCI_DEVICE_ID_INTEL_IOAT_HSW8 0x2f2e
  49. #define PCI_DEVICE_ID_INTEL_IOAT_HSW9 0x2f2f
  50. #define PCI_DEVICE_ID_INTEL_IOAT_BWD0 0x0C50
  51. #define PCI_DEVICE_ID_INTEL_IOAT_BWD1 0x0C51
  52. #define PCI_DEVICE_ID_INTEL_IOAT_BWD2 0x0C52
  53. #define PCI_DEVICE_ID_INTEL_IOAT_BWD3 0x0C53
  54. #define IOAT_VER_1_2 0x12 /* Version 1.2 */
  55. #define IOAT_VER_2_0 0x20 /* Version 2.0 */
  56. #define IOAT_VER_3_0 0x30 /* Version 3.0 */
  57. #define IOAT_VER_3_2 0x32 /* Version 3.2 */
  58. #define IOAT_VER_3_3 0x33 /* Version 3.3 */
  59. int system_has_dca_enabled(struct pci_dev *pdev);
  60. struct ioat_dma_descriptor {
  61. uint32_t size;
  62. union {
  63. uint32_t ctl;
  64. struct {
  65. unsigned int int_en:1;
  66. unsigned int src_snoop_dis:1;
  67. unsigned int dest_snoop_dis:1;
  68. unsigned int compl_write:1;
  69. unsigned int fence:1;
  70. unsigned int null:1;
  71. unsigned int src_brk:1;
  72. unsigned int dest_brk:1;
  73. unsigned int bundle:1;
  74. unsigned int dest_dca:1;
  75. unsigned int hint:1;
  76. unsigned int rsvd2:13;
  77. #define IOAT_OP_COPY 0x00
  78. unsigned int op:8;
  79. } ctl_f;
  80. };
  81. uint64_t src_addr;
  82. uint64_t dst_addr;
  83. uint64_t next;
  84. uint64_t rsv1;
  85. uint64_t rsv2;
  86. /* store some driver data in an unused portion of the descriptor */
  87. union {
  88. uint64_t user1;
  89. uint64_t tx_cnt;
  90. };
  91. uint64_t user2;
  92. };
  93. struct ioat_fill_descriptor {
  94. uint32_t size;
  95. union {
  96. uint32_t ctl;
  97. struct {
  98. unsigned int int_en:1;
  99. unsigned int rsvd:1;
  100. unsigned int dest_snoop_dis:1;
  101. unsigned int compl_write:1;
  102. unsigned int fence:1;
  103. unsigned int rsvd2:2;
  104. unsigned int dest_brk:1;
  105. unsigned int bundle:1;
  106. unsigned int rsvd4:15;
  107. #define IOAT_OP_FILL 0x01
  108. unsigned int op:8;
  109. } ctl_f;
  110. };
  111. uint64_t src_data;
  112. uint64_t dst_addr;
  113. uint64_t next;
  114. uint64_t rsv1;
  115. uint64_t next_dst_addr;
  116. uint64_t user1;
  117. uint64_t user2;
  118. };
  119. struct ioat_xor_descriptor {
  120. uint32_t size;
  121. union {
  122. uint32_t ctl;
  123. struct {
  124. unsigned int int_en:1;
  125. unsigned int src_snoop_dis:1;
  126. unsigned int dest_snoop_dis:1;
  127. unsigned int compl_write:1;
  128. unsigned int fence:1;
  129. unsigned int src_cnt:3;
  130. unsigned int bundle:1;
  131. unsigned int dest_dca:1;
  132. unsigned int hint:1;
  133. unsigned int rsvd:13;
  134. #define IOAT_OP_XOR 0x87
  135. #define IOAT_OP_XOR_VAL 0x88
  136. unsigned int op:8;
  137. } ctl_f;
  138. };
  139. uint64_t src_addr;
  140. uint64_t dst_addr;
  141. uint64_t next;
  142. uint64_t src_addr2;
  143. uint64_t src_addr3;
  144. uint64_t src_addr4;
  145. uint64_t src_addr5;
  146. };
  147. struct ioat_xor_ext_descriptor {
  148. uint64_t src_addr6;
  149. uint64_t src_addr7;
  150. uint64_t src_addr8;
  151. uint64_t next;
  152. uint64_t rsvd[4];
  153. };
  154. struct ioat_pq_descriptor {
  155. union {
  156. uint32_t size;
  157. uint32_t dwbes;
  158. struct {
  159. unsigned int rsvd:25;
  160. unsigned int p_val_err:1;
  161. unsigned int q_val_err:1;
  162. unsigned int rsvd1:4;
  163. unsigned int wbes:1;
  164. } dwbes_f;
  165. };
  166. union {
  167. uint32_t ctl;
  168. struct {
  169. unsigned int int_en:1;
  170. unsigned int src_snoop_dis:1;
  171. unsigned int dest_snoop_dis:1;
  172. unsigned int compl_write:1;
  173. unsigned int fence:1;
  174. unsigned int src_cnt:3;
  175. unsigned int bundle:1;
  176. unsigned int dest_dca:1;
  177. unsigned int hint:1;
  178. unsigned int p_disable:1;
  179. unsigned int q_disable:1;
  180. unsigned int rsvd2:2;
  181. unsigned int wb_en:1;
  182. unsigned int prl_en:1;
  183. unsigned int rsvd3:7;
  184. #define IOAT_OP_PQ 0x89
  185. #define IOAT_OP_PQ_VAL 0x8a
  186. #define IOAT_OP_PQ_16S 0xa0
  187. #define IOAT_OP_PQ_VAL_16S 0xa1
  188. unsigned int op:8;
  189. } ctl_f;
  190. };
  191. uint64_t src_addr;
  192. uint64_t p_addr;
  193. uint64_t next;
  194. uint64_t src_addr2;
  195. union {
  196. uint64_t src_addr3;
  197. uint64_t sed_addr;
  198. };
  199. uint8_t coef[8];
  200. uint64_t q_addr;
  201. };
  202. struct ioat_pq_ext_descriptor {
  203. uint64_t src_addr4;
  204. uint64_t src_addr5;
  205. uint64_t src_addr6;
  206. uint64_t next;
  207. uint64_t src_addr7;
  208. uint64_t src_addr8;
  209. uint64_t rsvd[2];
  210. };
  211. struct ioat_pq_update_descriptor {
  212. uint32_t size;
  213. union {
  214. uint32_t ctl;
  215. struct {
  216. unsigned int int_en:1;
  217. unsigned int src_snoop_dis:1;
  218. unsigned int dest_snoop_dis:1;
  219. unsigned int compl_write:1;
  220. unsigned int fence:1;
  221. unsigned int src_cnt:3;
  222. unsigned int bundle:1;
  223. unsigned int dest_dca:1;
  224. unsigned int hint:1;
  225. unsigned int p_disable:1;
  226. unsigned int q_disable:1;
  227. unsigned int rsvd:3;
  228. unsigned int coef:8;
  229. #define IOAT_OP_PQ_UP 0x8b
  230. unsigned int op:8;
  231. } ctl_f;
  232. };
  233. uint64_t src_addr;
  234. uint64_t p_addr;
  235. uint64_t next;
  236. uint64_t src_addr2;
  237. uint64_t p_src;
  238. uint64_t q_src;
  239. uint64_t q_addr;
  240. };
  241. struct ioat_raw_descriptor {
  242. uint64_t field[8];
  243. };
  244. struct ioat_pq16a_descriptor {
  245. uint8_t coef[8];
  246. uint64_t src_addr3;
  247. uint64_t src_addr4;
  248. uint64_t src_addr5;
  249. uint64_t src_addr6;
  250. uint64_t src_addr7;
  251. uint64_t src_addr8;
  252. uint64_t src_addr9;
  253. };
  254. struct ioat_pq16b_descriptor {
  255. uint64_t src_addr10;
  256. uint64_t src_addr11;
  257. uint64_t src_addr12;
  258. uint64_t src_addr13;
  259. uint64_t src_addr14;
  260. uint64_t src_addr15;
  261. uint64_t src_addr16;
  262. uint64_t rsvd;
  263. };
  264. union ioat_sed_pq_descriptor {
  265. struct ioat_pq16a_descriptor a;
  266. struct ioat_pq16b_descriptor b;
  267. };
  268. #define SED_SIZE 64
  269. struct ioat_sed_raw_descriptor {
  270. uint64_t a[8];
  271. uint64_t b[8];
  272. uint64_t c[8];
  273. };
  274. #endif