hipz_hw.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * eHCA register definitions
  5. *
  6. * Authors: Waleri Fomin <fomin@de.ibm.com>
  7. * Christoph Raisch <raisch@de.ibm.com>
  8. * Reinhard Ernst <rernst@de.ibm.com>
  9. *
  10. * Copyright (c) 2005 IBM Corporation
  11. *
  12. * All rights reserved.
  13. *
  14. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  15. * BSD.
  16. *
  17. * OpenIB BSD License
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. *
  25. * Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials
  28. * provided with the distribution.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  36. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  37. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  38. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGE.
  41. */
  42. #ifndef __HIPZ_HW_H__
  43. #define __HIPZ_HW_H__
  44. #include "ehca_tools.h"
  45. #define EHCA_MAX_MTU 4
  46. /* QP Table Entry Memory Map */
  47. struct hipz_qptemm {
  48. u64 qpx_hcr;
  49. u64 qpx_c;
  50. u64 qpx_herr;
  51. u64 qpx_aer;
  52. /* 0x20*/
  53. u64 qpx_sqa;
  54. u64 qpx_sqc;
  55. u64 qpx_rqa;
  56. u64 qpx_rqc;
  57. /* 0x40*/
  58. u64 qpx_st;
  59. u64 qpx_pmstate;
  60. u64 qpx_pmfa;
  61. u64 qpx_pkey;
  62. /* 0x60*/
  63. u64 qpx_pkeya;
  64. u64 qpx_pkeyb;
  65. u64 qpx_pkeyc;
  66. u64 qpx_pkeyd;
  67. /* 0x80*/
  68. u64 qpx_qkey;
  69. u64 qpx_dqp;
  70. u64 qpx_dlidp;
  71. u64 qpx_portp;
  72. /* 0xa0*/
  73. u64 qpx_slidp;
  74. u64 qpx_slidpp;
  75. u64 qpx_dlida;
  76. u64 qpx_porta;
  77. /* 0xc0*/
  78. u64 qpx_slida;
  79. u64 qpx_slidpa;
  80. u64 qpx_slvl;
  81. u64 qpx_ipd;
  82. /* 0xe0*/
  83. u64 qpx_mtu;
  84. u64 qpx_lato;
  85. u64 qpx_rlimit;
  86. u64 qpx_rnrlimit;
  87. /* 0x100*/
  88. u64 qpx_t;
  89. u64 qpx_sqhp;
  90. u64 qpx_sqptp;
  91. u64 qpx_nspsn;
  92. /* 0x120*/
  93. u64 qpx_nspsnhwm;
  94. u64 reserved1;
  95. u64 qpx_sdsi;
  96. u64 qpx_sdsbc;
  97. /* 0x140*/
  98. u64 qpx_sqwsize;
  99. u64 qpx_sqwts;
  100. u64 qpx_lsn;
  101. u64 qpx_nssn;
  102. /* 0x160 */
  103. u64 qpx_mor;
  104. u64 qpx_cor;
  105. u64 qpx_sqsize;
  106. u64 qpx_erc;
  107. /* 0x180*/
  108. u64 qpx_rnrrc;
  109. u64 qpx_ernrwt;
  110. u64 qpx_rnrresp;
  111. u64 qpx_lmsna;
  112. /* 0x1a0 */
  113. u64 qpx_sqhpc;
  114. u64 qpx_sqcptp;
  115. u64 qpx_sigt;
  116. u64 qpx_wqecnt;
  117. /* 0x1c0*/
  118. u64 qpx_rqhp;
  119. u64 qpx_rqptp;
  120. u64 qpx_rqsize;
  121. u64 qpx_nrr;
  122. /* 0x1e0*/
  123. u64 qpx_rdmac;
  124. u64 qpx_nrpsn;
  125. u64 qpx_lapsn;
  126. u64 qpx_lcr;
  127. /* 0x200*/
  128. u64 qpx_rwc;
  129. u64 qpx_rwva;
  130. u64 qpx_rdsi;
  131. u64 qpx_rdsbc;
  132. /* 0x220*/
  133. u64 qpx_rqwsize;
  134. u64 qpx_crmsn;
  135. u64 qpx_rdd;
  136. u64 qpx_larpsn;
  137. /* 0x240*/
  138. u64 qpx_pd;
  139. u64 qpx_scqn;
  140. u64 qpx_rcqn;
  141. u64 qpx_aeqn;
  142. /* 0x260*/
  143. u64 qpx_aaelog;
  144. u64 qpx_ram;
  145. u64 qpx_rdmaqe0;
  146. u64 qpx_rdmaqe1;
  147. /* 0x280*/
  148. u64 qpx_rdmaqe2;
  149. u64 qpx_rdmaqe3;
  150. u64 qpx_nrpsnhwm;
  151. /* 0x298*/
  152. u64 reserved[(0x400 - 0x298) / 8];
  153. /* 0x400 extended data */
  154. u64 reserved_ext[(0x500 - 0x400) / 8];
  155. /* 0x500 */
  156. u64 reserved2[(0x1000 - 0x500) / 8];
  157. /* 0x1000 */
  158. };
  159. #define QPX_SQADDER EHCA_BMASK_IBM(48,63)
  160. #define QPX_RQADDER EHCA_BMASK_IBM(48,63)
  161. #define QPTEMM_OFFSET(x) offsetof(struct hipz_qptemm,x)
  162. /* MRMWPT Entry Memory Map */
  163. struct hipz_mrmwmm {
  164. /* 0x00 */
  165. u64 mrx_hcr;
  166. u64 mrx_c;
  167. u64 mrx_herr;
  168. u64 mrx_aer;
  169. /* 0x20 */
  170. u64 mrx_pp;
  171. u64 reserved1;
  172. u64 reserved2;
  173. u64 reserved3;
  174. /* 0x40 */
  175. u64 reserved4[(0x200 - 0x40) / 8];
  176. /* 0x200 */
  177. u64 mrx_ctl[64];
  178. };
  179. #define MRMWMM_OFFSET(x) offsetof(struct hipz_mrmwmm,x)
  180. struct hipz_qpedmm {
  181. /* 0x00 */
  182. u64 reserved0[(0x400) / 8];
  183. /* 0x400 */
  184. u64 qpedx_phh;
  185. u64 qpedx_ppsgp;
  186. /* 0x410 */
  187. u64 qpedx_ppsgu;
  188. u64 qpedx_ppdgp;
  189. /* 0x420 */
  190. u64 qpedx_ppdgu;
  191. u64 qpedx_aph;
  192. /* 0x430 */
  193. u64 qpedx_apsgp;
  194. u64 qpedx_apsgu;
  195. /* 0x440 */
  196. u64 qpedx_apdgp;
  197. u64 qpedx_apdgu;
  198. /* 0x450 */
  199. u64 qpedx_apav;
  200. u64 qpedx_apsav;
  201. /* 0x460 */
  202. u64 qpedx_hcr;
  203. u64 reserved1[4];
  204. /* 0x488 */
  205. u64 qpedx_rrl0;
  206. /* 0x490 */
  207. u64 qpedx_rrrkey0;
  208. u64 qpedx_rrva0;
  209. /* 0x4a0 */
  210. u64 reserved2;
  211. u64 qpedx_rrl1;
  212. /* 0x4b0 */
  213. u64 qpedx_rrrkey1;
  214. u64 qpedx_rrva1;
  215. /* 0x4c0 */
  216. u64 reserved3;
  217. u64 qpedx_rrl2;
  218. /* 0x4d0 */
  219. u64 qpedx_rrrkey2;
  220. u64 qpedx_rrva2;
  221. /* 0x4e0 */
  222. u64 reserved4;
  223. u64 qpedx_rrl3;
  224. /* 0x4f0 */
  225. u64 qpedx_rrrkey3;
  226. u64 qpedx_rrva3;
  227. };
  228. #define QPEDMM_OFFSET(x) offsetof(struct hipz_qpedmm,x)
  229. /* CQ Table Entry Memory Map */
  230. struct hipz_cqtemm {
  231. u64 cqx_hcr;
  232. u64 cqx_c;
  233. u64 cqx_herr;
  234. u64 cqx_aer;
  235. /* 0x20 */
  236. u64 cqx_ptp;
  237. u64 cqx_tp;
  238. u64 cqx_fec;
  239. u64 cqx_feca;
  240. /* 0x40 */
  241. u64 cqx_ep;
  242. u64 cqx_eq;
  243. /* 0x50 */
  244. u64 reserved1;
  245. u64 cqx_n0;
  246. /* 0x60 */
  247. u64 cqx_n1;
  248. u64 reserved2[(0x1000 - 0x60) / 8];
  249. /* 0x1000 */
  250. };
  251. #define CQX_FEC_CQE_CNT EHCA_BMASK_IBM(32,63)
  252. #define CQX_FECADDER EHCA_BMASK_IBM(32,63)
  253. #define CQX_N0_GENERATE_SOLICITED_COMP_EVENT EHCA_BMASK_IBM(0,0)
  254. #define CQX_N1_GENERATE_COMP_EVENT EHCA_BMASK_IBM(0,0)
  255. #define CQTEMM_OFFSET(x) offsetof(struct hipz_cqtemm,x)
  256. /* EQ Table Entry Memory Map */
  257. struct hipz_eqtemm {
  258. u64 eqx_hcr;
  259. u64 eqx_c;
  260. u64 eqx_herr;
  261. u64 eqx_aer;
  262. /* 0x20 */
  263. u64 eqx_ptp;
  264. u64 eqx_tp;
  265. u64 eqx_ssba;
  266. u64 eqx_psba;
  267. /* 0x40 */
  268. u64 eqx_cec;
  269. u64 eqx_meql;
  270. u64 eqx_xisbi;
  271. u64 eqx_xisc;
  272. /* 0x60 */
  273. u64 eqx_it;
  274. };
  275. #define EQTEMM_OFFSET(x) offsetof(struct hipz_eqtemm,x)
  276. /* access control defines for MR/MW */
  277. #define HIPZ_ACCESSCTRL_L_WRITE 0x00800000
  278. #define HIPZ_ACCESSCTRL_R_WRITE 0x00400000
  279. #define HIPZ_ACCESSCTRL_R_READ 0x00200000
  280. #define HIPZ_ACCESSCTRL_R_ATOMIC 0x00100000
  281. #define HIPZ_ACCESSCTRL_MW_BIND 0x00080000
  282. /* query hca response block */
  283. struct hipz_query_hca {
  284. u32 cur_reliable_dg;
  285. u32 cur_qp;
  286. u32 cur_cq;
  287. u32 cur_eq;
  288. u32 cur_mr;
  289. u32 cur_mw;
  290. u32 cur_ee_context;
  291. u32 cur_mcast_grp;
  292. u32 cur_qp_attached_mcast_grp;
  293. u32 reserved1;
  294. u32 cur_ipv6_qp;
  295. u32 cur_eth_qp;
  296. u32 cur_hp_mr;
  297. u32 reserved2[3];
  298. u32 max_rd_domain;
  299. u32 max_qp;
  300. u32 max_cq;
  301. u32 max_eq;
  302. u32 max_mr;
  303. u32 max_hp_mr;
  304. u32 max_mw;
  305. u32 max_mrwpte;
  306. u32 max_special_mrwpte;
  307. u32 max_rd_ee_context;
  308. u32 max_mcast_grp;
  309. u32 max_total_mcast_qp_attach;
  310. u32 max_mcast_qp_attach;
  311. u32 max_raw_ipv6_qp;
  312. u32 max_raw_ethy_qp;
  313. u32 internal_clock_frequency;
  314. u32 max_pd;
  315. u32 max_ah;
  316. u32 max_cqe;
  317. u32 max_wqes_wq;
  318. u32 max_partitions;
  319. u32 max_rr_ee_context;
  320. u32 max_rr_qp;
  321. u32 max_rr_hca;
  322. u32 max_act_wqs_ee_context;
  323. u32 max_act_wqs_qp;
  324. u32 max_sge;
  325. u32 max_sge_rd;
  326. u32 memory_page_size_supported;
  327. u64 max_mr_size;
  328. u32 local_ca_ack_delay;
  329. u32 num_ports;
  330. u32 vendor_id;
  331. u32 vendor_part_id;
  332. u32 hw_ver;
  333. u64 node_guid;
  334. u64 hca_cap_indicators;
  335. u32 data_counter_register_size;
  336. u32 max_shared_rq;
  337. u32 max_isns_eq;
  338. u32 max_neq;
  339. } __attribute__ ((packed));
  340. /* query port response block */
  341. struct hipz_query_port {
  342. u32 state;
  343. u32 bad_pkey_cntr;
  344. u32 lmc;
  345. u32 lid;
  346. u32 subnet_timeout;
  347. u32 qkey_viol_cntr;
  348. u32 sm_sl;
  349. u32 sm_lid;
  350. u32 capability_mask;
  351. u32 init_type_reply;
  352. u32 pkey_tbl_len;
  353. u32 gid_tbl_len;
  354. u64 gid_prefix;
  355. u32 port_nr;
  356. u16 pkey_entries[16];
  357. u8 reserved1[32];
  358. u32 trent_size;
  359. u32 trbuf_size;
  360. u64 max_msg_sz;
  361. u32 max_mtu;
  362. u32 vl_cap;
  363. u8 reserved2[1900];
  364. u64 guid_entries[255];
  365. } __attribute__ ((packed));
  366. #endif