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