hipz_hw.h 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  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 QPX_AAELOG_RESET_SRQ_LIMIT EHCA_BMASK_IBM(3, 3)
  162. #define QPTEMM_OFFSET(x) offsetof(struct hipz_qptemm, x)
  163. /* MRMWPT Entry Memory Map */
  164. struct hipz_mrmwmm {
  165. /* 0x00 */
  166. u64 mrx_hcr;
  167. u64 mrx_c;
  168. u64 mrx_herr;
  169. u64 mrx_aer;
  170. /* 0x20 */
  171. u64 mrx_pp;
  172. u64 reserved1;
  173. u64 reserved2;
  174. u64 reserved3;
  175. /* 0x40 */
  176. u64 reserved4[(0x200 - 0x40) / 8];
  177. /* 0x200 */
  178. u64 mrx_ctl[64];
  179. };
  180. #define MRMWMM_OFFSET(x) offsetof(struct hipz_mrmwmm, x)
  181. struct hipz_qpedmm {
  182. /* 0x00 */
  183. u64 reserved0[(0x400) / 8];
  184. /* 0x400 */
  185. u64 qpedx_phh;
  186. u64 qpedx_ppsgp;
  187. /* 0x410 */
  188. u64 qpedx_ppsgu;
  189. u64 qpedx_ppdgp;
  190. /* 0x420 */
  191. u64 qpedx_ppdgu;
  192. u64 qpedx_aph;
  193. /* 0x430 */
  194. u64 qpedx_apsgp;
  195. u64 qpedx_apsgu;
  196. /* 0x440 */
  197. u64 qpedx_apdgp;
  198. u64 qpedx_apdgu;
  199. /* 0x450 */
  200. u64 qpedx_apav;
  201. u64 qpedx_apsav;
  202. /* 0x460 */
  203. u64 qpedx_hcr;
  204. u64 reserved1[4];
  205. /* 0x488 */
  206. u64 qpedx_rrl0;
  207. /* 0x490 */
  208. u64 qpedx_rrrkey0;
  209. u64 qpedx_rrva0;
  210. /* 0x4a0 */
  211. u64 reserved2;
  212. u64 qpedx_rrl1;
  213. /* 0x4b0 */
  214. u64 qpedx_rrrkey1;
  215. u64 qpedx_rrva1;
  216. /* 0x4c0 */
  217. u64 reserved3;
  218. u64 qpedx_rrl2;
  219. /* 0x4d0 */
  220. u64 qpedx_rrrkey2;
  221. u64 qpedx_rrva2;
  222. /* 0x4e0 */
  223. u64 reserved4;
  224. u64 qpedx_rrl3;
  225. /* 0x4f0 */
  226. u64 qpedx_rrrkey3;
  227. u64 qpedx_rrva3;
  228. };
  229. #define QPEDMM_OFFSET(x) offsetof(struct hipz_qpedmm, x)
  230. /* CQ Table Entry Memory Map */
  231. struct hipz_cqtemm {
  232. u64 cqx_hcr;
  233. u64 cqx_c;
  234. u64 cqx_herr;
  235. u64 cqx_aer;
  236. /* 0x20 */
  237. u64 cqx_ptp;
  238. u64 cqx_tp;
  239. u64 cqx_fec;
  240. u64 cqx_feca;
  241. /* 0x40 */
  242. u64 cqx_ep;
  243. u64 cqx_eq;
  244. /* 0x50 */
  245. u64 reserved1;
  246. u64 cqx_n0;
  247. /* 0x60 */
  248. u64 cqx_n1;
  249. u64 reserved2[(0x1000 - 0x60) / 8];
  250. /* 0x1000 */
  251. };
  252. #define CQX_FEC_CQE_CNT EHCA_BMASK_IBM(32, 63)
  253. #define CQX_FECADDER EHCA_BMASK_IBM(32, 63)
  254. #define CQX_N0_GENERATE_SOLICITED_COMP_EVENT EHCA_BMASK_IBM(0, 0)
  255. #define CQX_N1_GENERATE_COMP_EVENT EHCA_BMASK_IBM(0, 0)
  256. #define CQTEMM_OFFSET(x) offsetof(struct hipz_cqtemm, x)
  257. /* EQ Table Entry Memory Map */
  258. struct hipz_eqtemm {
  259. u64 eqx_hcr;
  260. u64 eqx_c;
  261. u64 eqx_herr;
  262. u64 eqx_aer;
  263. /* 0x20 */
  264. u64 eqx_ptp;
  265. u64 eqx_tp;
  266. u64 eqx_ssba;
  267. u64 eqx_psba;
  268. /* 0x40 */
  269. u64 eqx_cec;
  270. u64 eqx_meql;
  271. u64 eqx_xisbi;
  272. u64 eqx_xisc;
  273. /* 0x60 */
  274. u64 eqx_it;
  275. };
  276. #define EQTEMM_OFFSET(x) offsetof(struct hipz_eqtemm, x)
  277. /* access control defines for MR/MW */
  278. #define HIPZ_ACCESSCTRL_L_WRITE 0x00800000
  279. #define HIPZ_ACCESSCTRL_R_WRITE 0x00400000
  280. #define HIPZ_ACCESSCTRL_R_READ 0x00200000
  281. #define HIPZ_ACCESSCTRL_R_ATOMIC 0x00100000
  282. #define HIPZ_ACCESSCTRL_MW_BIND 0x00080000
  283. /* query hca response block */
  284. struct hipz_query_hca {
  285. u32 cur_reliable_dg;
  286. u32 cur_qp;
  287. u32 cur_cq;
  288. u32 cur_eq;
  289. u32 cur_mr;
  290. u32 cur_mw;
  291. u32 cur_ee_context;
  292. u32 cur_mcast_grp;
  293. u32 cur_qp_attached_mcast_grp;
  294. u32 reserved1;
  295. u32 cur_ipv6_qp;
  296. u32 cur_eth_qp;
  297. u32 cur_hp_mr;
  298. u32 reserved2[3];
  299. u32 max_rd_domain;
  300. u32 max_qp;
  301. u32 max_cq;
  302. u32 max_eq;
  303. u32 max_mr;
  304. u32 max_hp_mr;
  305. u32 max_mw;
  306. u32 max_mrwpte;
  307. u32 max_special_mrwpte;
  308. u32 max_rd_ee_context;
  309. u32 max_mcast_grp;
  310. u32 max_total_mcast_qp_attach;
  311. u32 max_mcast_qp_attach;
  312. u32 max_raw_ipv6_qp;
  313. u32 max_raw_ethy_qp;
  314. u32 internal_clock_frequency;
  315. u32 max_pd;
  316. u32 max_ah;
  317. u32 max_cqe;
  318. u32 max_wqes_wq;
  319. u32 max_partitions;
  320. u32 max_rr_ee_context;
  321. u32 max_rr_qp;
  322. u32 max_rr_hca;
  323. u32 max_act_wqs_ee_context;
  324. u32 max_act_wqs_qp;
  325. u32 max_sge;
  326. u32 max_sge_rd;
  327. u32 memory_page_size_supported;
  328. u64 max_mr_size;
  329. u32 local_ca_ack_delay;
  330. u32 num_ports;
  331. u32 vendor_id;
  332. u32 vendor_part_id;
  333. u32 hw_ver;
  334. u64 node_guid;
  335. u64 hca_cap_indicators;
  336. u32 data_counter_register_size;
  337. u32 max_shared_rq;
  338. u32 max_isns_eq;
  339. u32 max_neq;
  340. } __attribute__ ((packed));
  341. #define HCA_CAP_AH_PORT_NR_CHECK EHCA_BMASK_IBM( 0, 0)
  342. #define HCA_CAP_ATOMIC EHCA_BMASK_IBM( 1, 1)
  343. #define HCA_CAP_AUTO_PATH_MIG EHCA_BMASK_IBM( 2, 2)
  344. #define HCA_CAP_BAD_P_KEY_CTR EHCA_BMASK_IBM( 3, 3)
  345. #define HCA_CAP_SQD_RTS_PORT_CHANGE EHCA_BMASK_IBM( 4, 4)
  346. #define HCA_CAP_CUR_QP_STATE_MOD EHCA_BMASK_IBM( 5, 5)
  347. #define HCA_CAP_INIT_TYPE EHCA_BMASK_IBM( 6, 6)
  348. #define HCA_CAP_PORT_ACTIVE_EVENT EHCA_BMASK_IBM( 7, 7)
  349. #define HCA_CAP_Q_KEY_VIOL_CTR EHCA_BMASK_IBM( 8, 8)
  350. #define HCA_CAP_WQE_RESIZE EHCA_BMASK_IBM( 9, 9)
  351. #define HCA_CAP_RAW_PACKET_MCAST EHCA_BMASK_IBM(10, 10)
  352. #define HCA_CAP_SHUTDOWN_PORT EHCA_BMASK_IBM(11, 11)
  353. #define HCA_CAP_RC_LL_QP EHCA_BMASK_IBM(12, 12)
  354. #define HCA_CAP_SRQ EHCA_BMASK_IBM(13, 13)
  355. #define HCA_CAP_UD_LL_QP EHCA_BMASK_IBM(16, 16)
  356. #define HCA_CAP_RESIZE_MR EHCA_BMASK_IBM(17, 17)
  357. #define HCA_CAP_MINI_QP EHCA_BMASK_IBM(18, 18)
  358. #define HCA_CAP_H_ALLOC_RES_SYNC EHCA_BMASK_IBM(19, 19)
  359. /* query port response block */
  360. struct hipz_query_port {
  361. u32 state;
  362. u32 bad_pkey_cntr;
  363. u32 lmc;
  364. u32 lid;
  365. u32 subnet_timeout;
  366. u32 qkey_viol_cntr;
  367. u32 sm_sl;
  368. u32 sm_lid;
  369. u32 capability_mask;
  370. u32 init_type_reply;
  371. u32 pkey_tbl_len;
  372. u32 gid_tbl_len;
  373. u64 gid_prefix;
  374. u32 port_nr;
  375. u16 pkey_entries[16];
  376. u8 reserved1[32];
  377. u32 trent_size;
  378. u32 trbuf_size;
  379. u64 max_msg_sz;
  380. u32 max_mtu;
  381. u32 vl_cap;
  382. u32 phys_pstate;
  383. u32 phys_state;
  384. u32 phys_speed;
  385. u32 phys_width;
  386. u8 reserved2[1884];
  387. u64 guid_entries[255];
  388. } __attribute__ ((packed));
  389. #endif