xref: /illumos-gate/usr/src/uts/common/sys/ib/adapters/hermon/hermon_cfg.h (revision 9e39c5ba00a55fa05777cc94b148296af305e135)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_SYS_IB_ADAPTERS_HERMON_CFG_H
28 #define	_SYS_IB_ADAPTERS_HERMON_CFG_H
29 
30 /*
31  * hermon_cfg.h
32  *    Contains some prototypes and the structure needed to provided the
33  *    Hermon Configuration Profile variables.
34  */
35 
36 #include <sys/types.h>
37 #include <sys/conf.h>
38 #include <sys/ddi.h>
39 #include <sys/sunddi.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /* For PCIe Relaxed Ordering implementation */
46 #define	HERMON_RO_DISABLED	0
47 #define	HERMON_RO_ENABLED	1
48 
49 /*
50  * Configuration profiles
51  */
52 #define	HERMON_CFG_MEMFREE	0x0001
53 
54 #define	HERMON_MAX_PORTS		2
55 
56 #define	HERMON_LOG_CMPT_PER_TYPE	24	/* for now, allot 2**24 per */
57 
58 /*
59  * The hermon_cfg_profile_t structure is used internally by the Hermon driver
60  * to hold all of the configuration information for the driver.  It contains
61  * information such as the maximum number (and size) of Hermon's queue pairs.
62  * completion queues, translation tables, etc.  It also contains configuration
63  * information such as whether the device is using agents in the Hermon
64  * firmware (i.e. SMA, PMA, BMA) or whether it must register with the IBMF
65  * for management requests.  Each of the fields is described below.
66  */
67 typedef struct hermon_cfg_profile_s {
68 	/* Number of supported QPs and their maximum size */
69 	uint32_t	cp_log_num_qp;
70 	uint32_t	cp_log_max_qp_sz;
71 
72 	/* Number of supported SGL per WQE */
73 	uint32_t	cp_wqe_max_sgl;
74 	uint32_t	cp_wqe_real_max_sgl;
75 
76 	/* Number of supported CQs and their maximum size */
77 	uint32_t	cp_log_num_cq;
78 	uint32_t	cp_log_max_cq_sz;
79 
80 	/* Number of supported SRQs and their maximum size */
81 	uint32_t	cp_log_num_srq;
82 	uint32_t	cp_log_max_srq_sz;
83 	uint32_t	cp_srq_max_sgl;
84 	uint32_t	cp_srq_resize_enabled;
85 
86 	/* The max remaps of a particular fmr */
87 	uint32_t	cp_fmr_max_remaps;
88 
89 	/* Number of EQs, and their default size */
90 	uint32_t	cp_log_num_eq;
91 	uint32_t	cp_log_eq_sz;
92 
93 	/* Number of supported RDBs and their default size */
94 	uint32_t	cp_log_num_rdb;
95 	uint32_t	cp_log_default_rdb_sz;
96 
97 	/*
98 	 * Number of support multicast groups, number of QP per multicast
99 	 * group, and the number of entries (from the total number) in
100 	 * the multicast group "hash table"
101 	 */
102 	uint32_t	cp_log_num_mcg;
103 	uint32_t	cp_num_qp_per_mcg;
104 	uint32_t	cp_log_num_mcg_hash;
105 
106 	/*
107 	 * Number of supported MPTs (memory regions and windows) and their
108 	 * maximum size.  Also the number of MTTs.
109 	 */
110 	uint32_t	cp_log_num_cmpt;	/* control MPTs */
111 	uint32_t	cp_log_num_dmpt;	/* data MPTs */
112 	uint32_t	cp_log_max_mrw_sz;
113 	uint32_t	cp_log_num_mtt;
114 
115 	/*
116 	 * Number of supported Hermon mailboxes ("In" and "Out") and their
117 	 * maximum sizes, respectively
118 	 */
119 	uint32_t	cp_log_num_inmbox;
120 	uint32_t	cp_log_num_outmbox;
121 	uint32_t	cp_log_num_intr_inmbox;
122 	uint32_t	cp_log_num_intr_outmbox;
123 	uint32_t	cp_log_inmbox_size;
124 	uint32_t	cp_log_outmbox_size;
125 
126 	/* Number of supported UAR pages */
127 	uint32_t	cp_log_num_uar;
128 
129 	/* Number of ICM (4KB) pages per UAR context entry */
130 	uint32_t	cp_num_pgs_per_uce;
131 
132 	/* Number of supported Protection Domains (PD) */
133 	uint32_t	cp_log_num_pd;
134 
135 	/* Number of supported Address Handles (AH) */
136 	uint32_t	cp_log_num_ah;
137 
138 	/*
139 	 * Number of supported PKeys per PKey table (i.e. per port).  Also the
140 	 * number of SGID per GID table.
141 	 */
142 	uint32_t	cp_log_max_pkeytbl;
143 	uint32_t	cp_log_max_gidtbl;
144 
145 	/* Maximum "responder resources" and "initiator depth" per QP */
146 	uint32_t	cp_hca_max_rdma_in_qp;
147 	uint32_t	cp_hca_max_rdma_out_qp;
148 
149 	/* Maximum supported MTU and port width */
150 	uint32_t	cp_max_mtu;
151 	uint32_t	cp_max_port_width;
152 
153 	/* Number of supported Virtual Lanes (VL) */
154 	uint32_t	cp_max_vlcap;
155 
156 	/* Number of supported ports (1 or 2) */
157 	uint32_t	cp_num_ports;
158 
159 	/*
160 	 * Whether or not to use the built-in (i.e. in firmware) agents
161 	 * for QP0 and QP1, respectively
162 	 */
163 	uint32_t	cp_qp0_agents_in_fw;
164 	uint32_t	cp_qp1_agents_in_fw;
165 
166 	/* Whether DMA mappings should bypass the PCI IOMMU or not */
167 	uint32_t	cp_iommu_bypass;
168 
169 	/* Delay after software reset */
170 	uint32_t	cp_sw_reset_delay;
171 
172 	/* Time to wait in-between attempts to poll the 'go' bit */
173 	uint32_t	cp_cmd_poll_delay;
174 
175 	/* Max time to continue to poll the 'go bit */
176 	uint32_t	cp_cmd_poll_max;
177 
178 	/* Default AckReq frequency */
179 	uint32_t	cp_ackreq_freq;
180 
181 	/* Specify whether to use MSI (if available) */
182 	uint32_t	cp_use_msi_if_avail;
183 
184 	/*
185 	 * Used to override SystemImageGUID, NodeGUID and PortGUID(s) as
186 	 * specified by the Hermon device node properties
187 	 */
188 	uint64_t	cp_sysimgguid;
189 	uint64_t	cp_nodeguid;
190 	uint64_t	cp_portguid[HERMON_MAX_PORTS];
191 
192 } hermon_cfg_profile_t;
193 
194 int hermon_cfg_profile_init_phase1(hermon_state_t *state);
195 int hermon_cfg_profile_init_phase2(hermon_state_t *state);
196 void hermon_cfg_profile_fini(hermon_state_t *state);
197 
198 #ifdef __cplusplus
199 }
200 #endif
201 
202 #endif	/* _SYS_IB_ADAPTERS_HERMON_CFG_H */
203