xref: /illumos-gate/usr/src/uts/common/sys/ib/adapters/mlnx_umap.h (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
1*9e39c5baSBill Taylor /*
2*9e39c5baSBill Taylor  * CDDL HEADER START
3*9e39c5baSBill Taylor  *
4*9e39c5baSBill Taylor  * The contents of this file are subject to the terms of the
5*9e39c5baSBill Taylor  * Common Development and Distribution License (the "License").
6*9e39c5baSBill Taylor  * You may not use this file except in compliance with the License.
7*9e39c5baSBill Taylor  *
8*9e39c5baSBill Taylor  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*9e39c5baSBill Taylor  * or http://www.opensolaris.org/os/licensing.
10*9e39c5baSBill Taylor  * See the License for the specific language governing permissions
11*9e39c5baSBill Taylor  * and limitations under the License.
12*9e39c5baSBill Taylor  *
13*9e39c5baSBill Taylor  * When distributing Covered Code, include this CDDL HEADER in each
14*9e39c5baSBill Taylor  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*9e39c5baSBill Taylor  * If applicable, add the following below this CDDL HEADER, with the
16*9e39c5baSBill Taylor  * fields enclosed by brackets "[]" replaced with your own identifying
17*9e39c5baSBill Taylor  * information: Portions Copyright [yyyy] [name of copyright owner]
18*9e39c5baSBill Taylor  *
19*9e39c5baSBill Taylor  * CDDL HEADER END
20*9e39c5baSBill Taylor  */
21*9e39c5baSBill Taylor 
22*9e39c5baSBill Taylor /*
23*9e39c5baSBill Taylor  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
24*9e39c5baSBill Taylor  * Use is subject to license terms.
25*9e39c5baSBill Taylor  */
26*9e39c5baSBill Taylor 
27*9e39c5baSBill Taylor #ifndef	_SYS_IB_ADAPTERS_MLNX_UMAP_H
28*9e39c5baSBill Taylor #define	_SYS_IB_ADAPTERS_MLNX_UMAP_H
29*9e39c5baSBill Taylor 
30*9e39c5baSBill Taylor #ifdef __cplusplus
31*9e39c5baSBill Taylor extern "C" {
32*9e39c5baSBill Taylor #endif
33*9e39c5baSBill Taylor 
34*9e39c5baSBill Taylor /*
35*9e39c5baSBill Taylor  * mlnx_umap.h
36*9e39c5baSBill Taylor  *	Contains all of the definions necessary for communicating the data
37*9e39c5baSBill Taylor  *	needed for direct userland access to resources on Mellanox HCAs.
38*9e39c5baSBill Taylor  */
39*9e39c5baSBill Taylor 
40*9e39c5baSBill Taylor /*
41*9e39c5baSBill Taylor  * Note: The structs in this file are used in the interface(s)
42*9e39c5baSBill Taylor  *	between kernel service drivers, e.g. daplt, and the libraries
43*9e39c5baSBill Taylor  *	on top of them, e.g. udapl_tavor.so.1.  When any of the
44*9e39c5baSBill Taylor  *	structs in this file change, any version control between the
45*9e39c5baSBill Taylor  *	kernel service driver and the library will need to change.
46*9e39c5baSBill Taylor  *
47*9e39c5baSBill Taylor  * There is a version control on the structs defined here.  The library
48*9e39c5baSBill Taylor  * (consumer of structs from ibt_ci_data_out()) must verify a version
49*9e39c5baSBill Taylor  * field to correctly read the data provided by the kernel driver
50*9e39c5baSBill Taylor  * (tavor, arbel, and hermon).
51*9e39c5baSBill Taylor  */
52*9e39c5baSBill Taylor 
53*9e39c5baSBill Taylor #define	MLNX_UMAP_IF_VERSION	2
54*9e39c5baSBill Taylor 
55*9e39c5baSBill Taylor /*
56*9e39c5baSBill Taylor  * The following defines are used in the database type field for each database
57*9e39c5baSBill Taylor  * entry.  They specify the type of object (UAR pages, PIDs, CQ, QP, and MR
58*9e39c5baSBill Taylor  * umemcookie) that corresponds to the database key value.  On database queries,
59*9e39c5baSBill Taylor  * this type value must match the search criterion.
60*9e39c5baSBill Taylor  */
61*9e39c5baSBill Taylor #define	MLNX_UMAP_UARPG_RSRC		0x11
62*9e39c5baSBill Taylor #define	MLNX_UMAP_BLUEFLAMEPG_RSRC	0x12
63*9e39c5baSBill Taylor #define	MLNX_UMAP_PID_RSRC		0x22
64*9e39c5baSBill Taylor #define	MLNX_UMAP_CQMEM_RSRC		0x33
65*9e39c5baSBill Taylor #define	MLNX_UMAP_QPMEM_RSRC		0x44
66*9e39c5baSBill Taylor #define	MLNX_UMAP_MRMEM_RSRC		0x55
67*9e39c5baSBill Taylor #define	MLNX_UMAP_SRQMEM_RSRC		0x66
68*9e39c5baSBill Taylor #define	MLNX_UMAP_DBRMEM_RSRC		0x77
69*9e39c5baSBill Taylor #define	MLNX_UMAP_RSRC_TYPE_MASK	0xFF
70*9e39c5baSBill Taylor #define	MLNX_UMAP_RSRC_TYPE_SHIFT	8
71*9e39c5baSBill Taylor 
72*9e39c5baSBill Taylor /* umap structures */
73*9e39c5baSBill Taylor 
74*9e39c5baSBill Taylor typedef struct mlnx_umap_cq_data_out_s {
75*9e39c5baSBill Taylor 	uint_t		mcq_rev;
76*9e39c5baSBill Taylor 	uint32_t	mcq_cqnum;
77*9e39c5baSBill Taylor 	uint64_t	mcq_mapoffset;
78*9e39c5baSBill Taylor 	uint64_t	mcq_maplen;
79*9e39c5baSBill Taylor 	uint32_t	mcq_numcqe;
80*9e39c5baSBill Taylor 	uint32_t	mcq_cqesz;
81*9e39c5baSBill Taylor 
82*9e39c5baSBill Taylor 	/* Arbel/Hermon doorbell records */
83*9e39c5baSBill Taylor 	uint64_t	mcq_armdbr_mapoffset;
84*9e39c5baSBill Taylor 	uint64_t	mcq_armdbr_maplen;
85*9e39c5baSBill Taylor 	uint64_t	mcq_polldbr_mapoffset;
86*9e39c5baSBill Taylor 	uint64_t	mcq_polldbr_maplen;
87*9e39c5baSBill Taylor 	uint32_t	mcq_armdbr_offset;
88*9e39c5baSBill Taylor 	uint32_t	mcq_polldbr_offset;
89*9e39c5baSBill Taylor } mlnx_umap_cq_data_out_t;
90*9e39c5baSBill Taylor 
91*9e39c5baSBill Taylor typedef struct mlnx_umap_qp_data_out_s {
92*9e39c5baSBill Taylor 	uint_t		mqp_rev;
93*9e39c5baSBill Taylor 	uint32_t	mqp_qpnum;
94*9e39c5baSBill Taylor 	uint64_t	mqp_mapoffset;
95*9e39c5baSBill Taylor 	uint64_t	mqp_maplen;
96*9e39c5baSBill Taylor 
97*9e39c5baSBill Taylor 	uint32_t	mqp_rq_off;
98*9e39c5baSBill Taylor 	uint32_t	mqp_rq_desc_addr;
99*9e39c5baSBill Taylor 	uint32_t	mqp_rq_numwqe;
100*9e39c5baSBill Taylor 	uint32_t	mqp_rq_wqesz;
101*9e39c5baSBill Taylor 
102*9e39c5baSBill Taylor 	uint32_t	mqp_sq_off;
103*9e39c5baSBill Taylor 	uint32_t	mqp_sq_desc_addr;
104*9e39c5baSBill Taylor 	uint32_t	mqp_sq_numwqe;
105*9e39c5baSBill Taylor 	uint32_t	mqp_sq_wqesz;
106*9e39c5baSBill Taylor 
107*9e39c5baSBill Taylor 	/* Arbel/Hermon doorbell records */
108*9e39c5baSBill Taylor 	uint64_t	mqp_sdbr_mapoffset;
109*9e39c5baSBill Taylor 	uint64_t	mqp_sdbr_maplen;
110*9e39c5baSBill Taylor 	uint64_t	mqp_rdbr_mapoffset;
111*9e39c5baSBill Taylor 	uint64_t	mqp_rdbr_maplen;
112*9e39c5baSBill Taylor 	uint32_t	mqp_sdbr_offset;
113*9e39c5baSBill Taylor 	uint32_t	mqp_rdbr_offset;
114*9e39c5baSBill Taylor 
115*9e39c5baSBill Taylor 	/* Hermon send queue headroom, in units of wqes */
116*9e39c5baSBill Taylor 	uint32_t	mqp_sq_headroomwqes;
117*9e39c5baSBill Taylor } mlnx_umap_qp_data_out_t;
118*9e39c5baSBill Taylor 
119*9e39c5baSBill Taylor typedef struct mlnx_umap_srq_data_out_s {
120*9e39c5baSBill Taylor 	uint_t		msrq_rev;
121*9e39c5baSBill Taylor 	uint32_t	msrq_srqnum;
122*9e39c5baSBill Taylor 	uint64_t	msrq_mapoffset;
123*9e39c5baSBill Taylor 	uint64_t	msrq_maplen;
124*9e39c5baSBill Taylor 	uint32_t	msrq_desc_addr;
125*9e39c5baSBill Taylor 	uint32_t	msrq_numwqe;
126*9e39c5baSBill Taylor 	uint32_t	msrq_wqesz;
127*9e39c5baSBill Taylor 	uint32_t	msrq_pad1;	/* reserved */
128*9e39c5baSBill Taylor 
129*9e39c5baSBill Taylor 	/* Arbel/Hermon doorbell records */
130*9e39c5baSBill Taylor 	uint64_t	msrq_rdbr_mapoffset;
131*9e39c5baSBill Taylor 	uint64_t	msrq_rdbr_maplen;
132*9e39c5baSBill Taylor 	uint32_t	msrq_rdbr_offset;
133*9e39c5baSBill Taylor 	uint32_t	msrq_reserved;
134*9e39c5baSBill Taylor } mlnx_umap_srq_data_out_t;
135*9e39c5baSBill Taylor 
136*9e39c5baSBill Taylor typedef struct mlnx_umap_pd_data_out_s {
137*9e39c5baSBill Taylor 	uint_t		mpd_rev;
138*9e39c5baSBill Taylor 	uint32_t	mpd_pdnum;
139*9e39c5baSBill Taylor } mlnx_umap_pd_data_out_t;
140*9e39c5baSBill Taylor 
141*9e39c5baSBill Taylor #ifdef __cplusplus
142*9e39c5baSBill Taylor }
143*9e39c5baSBill Taylor #endif
144*9e39c5baSBill Taylor 
145*9e39c5baSBill Taylor #endif	/* _SYS_IB_ADAPTERS_MLNX_UMAP_H */
146