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 2010 Emulex.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _EMLXS_CONFIG_H
28 #define	_EMLXS_CONFIG_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 #define	EMLXS_CFG_STR_SIZE	32
35 #define	EMLXS_CFG_HELP_SIZE	80
36 
37 typedef struct emlxs_config
38 {
39 	char		string[EMLXS_CFG_STR_SIZE];
40 	uint32_t	low;
41 	uint32_t	hi;
42 	uint32_t	def;
43 	uint32_t	current;
44 	uint32_t	flags;
45 	char		help[EMLXS_CFG_HELP_SIZE];
46 } emlxs_config_t;
47 
48 
49 typedef enum emlxs_cfg_parm
50 {
51 	CFG_CONSOLE_NOTICES,	/* console-notices */
52 	CFG_CONSOLE_WARNINGS,	/* console-warnings */
53 	CFG_CONSOLE_ERRORS,	/* console-errors */
54 	CFG_CONSOLE_DEBUGS,	/* console-debugs (hidden) */
55 	CFG_LOG_NOTICES,	/* log-notices */
56 	CFG_LOG_WARNINGS,	/* log-warnings */
57 	CFG_LOG_ERRORS,		/* log-errors */
58 	CFG_LOG_DEBUGS,		/* log-debugs (hidden) */
59 	CFG_NUM_IOCBS,		/* num-iocbs */
60 	CFG_MAX_XFER_SIZE,	/* max-xfer-size */
61 	CFG_UB_BUFS,		/* ub-bufs */
62 	CFG_NETWORK_ON,		/* network-on */
63 	CFG_ACK0,		/* ack0 */
64 	CFG_TOPOLOGY,		/* topology */
65 	CFG_LINK_SPEED,		/* link-speed */
66 	CFG_NUM_NODES,		/* num-nodes */
67 	CFG_CR_DELAY,		/* cr-delay */
68 	CFG_CR_COUNT,		/* cr-count */
69 	CFG_ASSIGN_ALPA,	/* assign-alpa */
70 	CFG_ADISC_SUPPORT,	/* adisc-support */
71 	CFG_PM_SUPPORT,		/* pm-support */
72 	CFG_PM_IDLE,		/* pm-idle */
73 	CFG_FW_CHECK,		/* fw-check (hidden) */
74 	CFG_TRI_REQUIRED,	/* tri-required (hidden) */
75 	CFG_DISC_TIMEOUT,	/* discovery-timeout (hidden) */
76 	CFG_LINKUP_TIMEOUT,	/* linkup-timeout (hidden) */
77 	CFG_LINKUP_DELAY,	/* linkup-delay */
78 	CFG_OFFLINE_TIMEOUT,	/* offline-timeout (hidden) */
79 	CFG_LILP_ENABLE,	/* enable-lilp (hidden) */
80 	CFG_PCI_MAX_READ,	/* pci-max-read */
81 	CFG_HEARTBEAT_ENABLE,	/* heartbeat-enable (hidden) */
82 	CFG_RESET_ENABLE,	/* reset-enable (hidden) */
83 	CFG_TIMEOUT_ENABLE,	/* timeout-enable (hidden) */
84 	CFG_NUM_IOTAGS,		/* num-iotags (hidden) */
85 
86 #ifdef FMA_SUPPORT
87 	CFG_FM_CAPS,		/* fm-capable (hidden) */
88 #endif	/* FMA_SUPPORT */
89 
90 
91 #ifdef MAX_RRDY_SUPPORT
92 	CFG_MAX_RRDY,		/* max-rrdy (hidden) */
93 #endif	/* MAX_RRDY_SUPPORT */
94 
95 #ifdef MSI_SUPPORT
96 	CFG_MSI_MODE,		/* msi-mode (hidden) */
97 #endif	/* MSI_SUPPORT */
98 
99 	CFG_SLI_MODE,		/* sli-mode (hidden) */
100 	CFG_NPIV_ENABLE,	/* enable-npiv */
101 	CFG_VPORT_RESTRICTED,	/* vport-restrict-login */
102 	CFG_NPIV_DELAY,		/* enable-npiv-delay */
103 
104 #ifdef DHCHAP_SUPPORT
105 	CFG_AUTH_ENABLE, 	/* enable-auth */
106 	CFG_AUTH_E2E,		/* auth-e2e */
107 	CFG_AUTH_NPIV,		/* auth-npiv (hidden) */
108 	CFG_AUTH_TMO,    	/* auth-tmo (hidden) */
109 	CFG_AUTH_MODE,   	/* auth-mode (hidden) */
110 	CFG_AUTH_BIDIR, 	/* auth-bidir (hidden) */
111 	CFG_AUTH_TYPE,   	/* auth-type (hidden) */
112 	CFG_AUTH_HASH,   	/* auth-hash (hidden) */
113 	CFG_AUTH_GROUP,  	/* auth-group (hidden) */
114 	CFG_AUTH_INTERVAL,  	/* auth-interval (hidden) */
115 #endif	/* DHCHAP_SUPPORT */
116 
117 #ifdef SFCT_SUPPORT
118 	CFG_TARGET_MODE,	/* target-mode */
119 	CFG_FCT_QDEPTH,		/* fct-queue-depth */
120 #endif /* SFCT_SUPPORT */
121 	CFG_NUM_WQ,		/* num-wq (hidden) */
122 	CFG_PERSIST_LINKDOWN,	/* persist-linkdown */
123 	CFG_ENABLE_PATCH,	/* enable-patch (hidden) */
124 	CFG_FAST_TGT_RESET,	/* fast-tgt-reset (hidden) */
125 	CFG_FAST_TGT_RESET_TMR,	/* fast-tgt-reset-timer (hidden) */
126 
127 	NUM_CFG_PARAM
128 
129 } emlxs_cfg_parm_t;
130 
131 #define	PARM_HIDDEN	0x80000000
132 
133 
134 
135 #ifdef DEF_ICFG
136 
137 /*
138  * The entries in this array must be in the exact order
139  * defined in emlxs_cfg_parm_t
140  */
141 emlxs_config_t  emlxs_cfg[] = {
142 	/* CFG_CONSOLE_NOTICES */
143 	{"console-notices",
144 		0, 0xffffffff, 0, 0,
145 		PARM_DYNAMIC | PARM_HEX,
146 	"Verbose mask for notice messages to the console."},
147 
148 	/* CFG_CONSOLE_WARNINGS */
149 	{"console-warnings",
150 		0, 0xffffffff, 0, 0,
151 		PARM_DYNAMIC | PARM_HEX,
152 	"Verbose mask for warning messages to the console."},
153 
154 	/* CFG_CONSOLE_ERRORS */
155 	{"console-errors",
156 		0, 0xffffffff, 0, 0,
157 		PARM_DYNAMIC | PARM_HEX,
158 	"Verbose mask for error messages to the console."},
159 
160 	/* CFG_CONSOLE_DEBUGS */
161 	{"console-debugs",
162 		0, 0xffffffff, 0, 0,
163 		PARM_DYNAMIC | PARM_HEX | PARM_HIDDEN,
164 	"Verbose mask for debugging messages to the console."},
165 
166 	/* CFG_LOG_NOTICES */
167 	{"log-notices",
168 		0, 0xffffffff, 0xffffffff, 0,
169 		PARM_DYNAMIC | PARM_HEX,
170 	"Verbose mask for notice messages to the messages file."},
171 
172 	/* CFG_LOG_WARNINGS */
173 	{"log-warnings",
174 		0, 0xffffffff, 0xffffffff, 0,
175 		PARM_DYNAMIC | PARM_HEX,
176 	"Verbose mask for warning messages to the messages file."},
177 
178 	/* CFG_LOG_ERRORS */
179 	{"log-errors",
180 		0, 0xffffffff, 0xffffffff, 0,
181 		PARM_DYNAMIC | PARM_HEX,
182 	"Verbose mask for error messages to the messages file."},
183 
184 	/* CFG_LOG_DEBUGS */
185 	{"log-debugs",
186 		0, 0xffffffff, 0, 0,
187 		PARM_DYNAMIC | PARM_HEX | PARM_HIDDEN,
188 	"Verbose mask for debugging messages to the messages file."},
189 
190 
191 	/* CFG_NUM_IOCBS */
192 	{"num-iocbs",
193 		128, 10240, 1024, 0,
194 		PARM_DYNAMIC_RESET,
195 	"Number of IOCB buffers the driver should allocate."},
196 
197 	/* CFG_MAX_XFER_SIZE */
198 	{"max-xfer-size",
199 		131072, 1388544, 339968, 0,
200 		0,
201 	"Sets maximum bytes per IO the driver can transfer."},
202 
203 	/* CFG_UB_BUFS */
204 	{"ub-bufs",
205 		40, 16320, 1000, 0,
206 		0,
207 	"Number of unsolicited buffers the driver should allocate."},
208 
209 	/* IP specific parameters */
210 
211 	/* CFG_NETWORK_ON */
212 	{"network-on",
213 		0, 1, 1, 0,
214 		PARM_BOOLEAN,
215 	"Enable IP processing. [0=Disabled, 1=Enabled]"},
216 
217 	/* Fibre Channel specific parameters */
218 
219 	/* CFG_ACK0 */
220 	{"ack0",
221 		0, 1, 0, 0,
222 		PARM_DYNAMIC_LINK | PARM_BOOLEAN,
223 	"Enables ACK0 support. [0=Disabled, 1=Enabled]"},
224 
225 	/* CFG_TOPOLOGY */
226 	{"topology",
227 		0, 6, 0, 0,
228 		PARM_DYNAMIC_LINK,
229 	"Select Fibre Channel topology. "
230 		"[0=Loop->PTP, 2=PTP, 4=Loop, 6=PTP->Loop]"},
231 
232 	/* CFG_LINK_SPEED */
233 	{"link-speed",
234 		0, 8, 0, 0,
235 		PARM_DYNAMIC_LINK,
236 	"Select link speed. [0=Auto, 1=1Gb, 2=2Gb, 4=4Gb, 8=8Gb]"},
237 
238 	/* CFG_NUM_NODES */
239 	{"num-nodes",
240 		0, 4096, 0, 0,
241 		PARM_DYNAMIC_RESET,
242 	"Number of fibre channel nodes (NPorts) the driver will support. "
243 		"[0=no_limit]"},
244 
245 	/* CFG_CR_DELAY */
246 	{"cr-delay",
247 		0, 63, 0, 0,
248 		PARM_DYNAMIC_LINK,
249 	"A count of milliseconds after which "
250 		"an interrupt response is generated"},
251 
252 	/* CFG_CR_COUNT */
253 	{"cr-count",
254 		1, 255, 1, 0,
255 		PARM_DYNAMIC_LINK,
256 	"A count of I/O completions after "
257 		"which an interrupt response is generated"},
258 
259 	/* CFG_ASSIGN_ALPA */
260 	{"assign-alpa",
261 		0, 0xef, 0, 0,
262 		PARM_DYNAMIC_LINK | PARM_HEX,
263 	"Assigns a preferred ALPA to the port. Only used in Loop topology."},
264 
265 	/* CFG_ADISC_SUPPORT */
266 	{"adisc-support",
267 		0, 2, 1, 0,
268 		PARM_DYNAMIC,
269 	"Sets the Fibre Channel ADISC login support level. "
270 		"[0=None, 1=Partial, 2=Full]"},
271 
272 	/* CFG_PM_SUPPORT */
273 	{"pm-support",
274 		0, 1, 0, 0,
275 		PARM_BOOLEAN,
276 	"Enables power management support. [0=Disabled, 1=Enabled]"},
277 
278 	/* CFG_PM_IDLE */
279 	{"pm-idle",
280 		0, 3600, 300, 0,
281 		PARM_DYNAMIC | PARM_HIDDEN,
282 	"Sets power management idle timeout value (seconds)."},
283 
284 	/* CFG_FW_CHECK */
285 	{"fw-check",
286 		0, 2, 1, 0,
287 		PARM_DYNAMIC_RESET | PARM_BOOLEAN | PARM_HIDDEN,
288 	"Enables firmware revision checking of adapters. "
289 		"[0=Off 1=Sun-only 2=All]"},
290 
291 	/* CFG_TRI_REQUIRED */
292 	{"tri-required",
293 		0, 1, 0, 0,
294 		PARM_DYNAMIC | PARM_BOOLEAN | PARM_HIDDEN,
295 	"Requires Task Retry Id support by a remote device "
296 		"for FCP-2 error recovery."},
297 
298 	/* CFG_DISC_TIMEOUT */
299 	{"discovery-timeout",
300 		0, 600, 25, 0,
301 		PARM_DYNAMIC | PARM_HIDDEN,
302 	"Sets the discovery timeout period (seconds) "
303 		"for managing FCP-2 devices."},
304 
305 	/* CFG_LINKUP_TIMEOUT */
306 	{"linkup-timeout",
307 		0, 10, 2, 0,
308 		PARM_DYNAMIC | PARM_HIDDEN,
309 	"Sets the linkup timeout period (seconds)."},
310 
311 	/* CFG_LINKUP_DELAY */
312 	{"linkup-delay",
313 		0, 60, 10, 0,
314 		PARM_DYNAMIC_RESET,
315 	"Sets the driver wait period (seconds) "
316 		"for a linkup after initialization."},
317 
318 	/* CFG_OFFLINE_TIMEOUT */
319 	{"offline-timeout",
320 		0, 600, 45, 0,
321 		PARM_DYNAMIC | PARM_HIDDEN,
322 	"Sets the offline timeout period (seconds)."},
323 
324 	/* CFG_LILP_ENABLE */
325 	{"enable-lilp",
326 		0, 1, 1, 0,
327 		PARM_DYNAMIC_RESET | PARM_BOOLEAN | PARM_HIDDEN,
328 	"Enables LIRP/LILP support in the driver. [0=Disabled, 1=Enabled]"},
329 
330 	/* CFG_PCI_MAX_READ */
331 	{"pci-max-read",
332 		512, 4096, 2048, 0,
333 		PARM_DYNAMIC_RESET,
334 	"Sets the PCI-X max memory read byte count. [512,1024,2048 or 4096]"},
335 
336 	/* CFG_HEARTBEAT_ENABLE */
337 	{"heartbeat-enable",
338 		0, 1, 1, 0,
339 		PARM_DYNAMIC | PARM_BOOLEAN | PARM_HIDDEN,
340 	"Enables driver's mailbox heartbeat to the adapter. "
341 		"[0=Disabled, 1=Enabled]"},
342 
343 	/* CFG_RESET_ENABLE */
344 	{"reset-enable",
345 		0, 1, 1, 0,
346 		PARM_DYNAMIC | PARM_BOOLEAN | PARM_HIDDEN,
347 	"Enables driver's ability to reset the adapter. "
348 		"[0=Disabled, 1=Enabled]"},
349 
350 	/* CFG_TIMEOUT_ENABLE */
351 	{"timeout-enable",
352 		0, 1, 1, 0,
353 		PARM_DYNAMIC | PARM_BOOLEAN | PARM_HIDDEN,
354 	"Enables driver's ability to timeout commands. "
355 		"[0=Disabled, 1=Enabled]"},
356 
357 	/* CFG_NUM_IOTAGS */
358 	{"num-iotags",
359 		0, 4096, 0, 0,
360 		PARM_DYNAMIC_RESET | PARM_HIDDEN,
361 	"Sets number of outstanding IO's. "
362 		"[0=max determined by type of HBA]"},
363 
364 #ifdef FMA_SUPPORT
365 	/* CFG_FM_CAPS */
366 	{"fm-capable",
367 		0, 0xF, 0xB, 0,
368 		PARM_HEX | PARM_HIDDEN,
369 	"Sets FMA capabilities. [bit 3:errcb, 2:dmachk, 1:accchk, 0:ereport]"},
370 #endif	/* FMA_SUPPORT */
371 
372 
373 #ifdef MAX_RRDY_SUPPORT
374 	/* CFG_MAX_RRDY */
375 	{"max-rrdy",
376 		0, 255, 2, 0,
377 		PARM_DYNAMIC_RESET | PARM_HIDDEN,
378 	"Sets maximum number RRDY's for the adapter on private loop."},
379 #endif	/* MAX_RRDY_SUPPORT */
380 
381 #ifdef MSI_SUPPORT
382 	/* CFG_MSI_MODE */
383 	{"msi-mode",
384 		0, 3, 3, 0,
385 		PARM_HIDDEN,
386 	"Sets the default MSI mode in driver. "
387 		"[0=Off 1=Single-MSI 2=Multi-MSI 3=Auto]"},
388 #endif	/* MSI_SUPPORT */
389 
390 	/* CFG_SLI_MODE */
391 	{"sli-mode",
392 		0, 4, 0, 0,
393 		PARM_DYNAMIC_RESET | PARM_HIDDEN,
394 	"Sets default SLI mode. "
395 		"[0=Auto, 2=SLI2-remove all vports first, 3=SLI3, 4=SLI4]"},
396 
397 	/* CFG_NPIV_ENABLE */
398 	{"enable-npiv",
399 		0, 1, 0, 0,
400 		PARM_DYNAMIC_RESET | PARM_BOOLEAN,
401 	"Enables NPIV. [0=Disabled-remove all vports first, "
402 		"1=Enabled-requires SLI3]"},
403 
404 	/* CFG_VPORT_RESTRICTED */
405 	{"vport-restrict-login",
406 		0, 1, 1, 0,
407 		PARM_DYNAMIC_LINK | PARM_BOOLEAN,
408 	"Restricts login to virtual ports to conserve resources. "
409 		"[0=Disabled, 1=Enabled]"},
410 
411 	/* CFG_NPIV_DELAY */
412 	{"enable-npiv-delay",
413 		0, 1, 1, 0,
414 		PARM_DYNAMIC | PARM_HIDDEN,
415 	"Enable FDISC/NS command delay from vports to switch. "
416 		"[0=Disabled, 1=Enabled]"},
417 
418 #ifdef DHCHAP_SUPPORT
419 	/* CFG_AUTH_ENABLE */
420 	{"enable-auth",
421 		0, 1, 0, 0,
422 		PARM_DYNAMIC_LINK | PARM_BOOLEAN,
423 	"Enables DHCHAP support in the driver. [0=Disabled, 1=Enabled]"},
424 
425 	/* CFG_AUTH_E2E */
426 	{"auth-e2e",
427 		0, 1, 0, 0,
428 		PARM_DYNAMIC_LINK | PARM_BOOLEAN | PARM_HIDDEN,
429 	"Enables end-to-end DHCHAP support in the driver. "
430 		"[0=Disabled, 1=Enabled]"},
431 
432 	/* CFG_AUTH_NPIV */
433 	{"auth-npiv",
434 		0, 1, 0, 0,
435 		PARM_DYNAMIC_LINK | PARM_BOOLEAN | PARM_HIDDEN,
436 	"Enables DHCHAP support for virtual ports. [0=Disabled, 1=Enabled]"},
437 
438 	/* CFG_AUTH_TMO */
439 	{"auth-tmo",
440 		20, 999, 45, 0,
441 		PARM_DYNAMIC_LINK | PARM_HIDDEN,
442 	"Sets authentication timeout value. (seconds)"},
443 
444 	/* CFG_AUTH_MODE */
445 	{"auth-mode",
446 		1, 3, 1, 0,
447 		PARM_DYNAMIC_LINK | PARM_HIDDEN,
448 	"Sets authentication mode. [1=Disabled, 2=Active, 3=Passive]"},
449 
450 	/* CFG_AUTH_BIDIR */
451 	{"auth-bidir",
452 		0, 1, 0, 0,
453 		PARM_DYNAMIC_LINK | PARM_BOOLEAN | PARM_HIDDEN,
454 	"Sets authentication bidirectional mode. [0=Disabled, 1=Enabled]"},
455 
456 	/* CFG_AUTH_TYPE */
457 	{"auth-type",
458 		0, 0x1111, 0x1000, 0,
459 		PARM_DYNAMIC_LINK | PARM_HEX | PARM_HIDDEN,
460 	"Sets authentication type priorities[4]. [0=Undef, 1=DHCHAP]"},
461 
462 	/* CFG_AUTH_HASH */
463 	{"auth-hash",
464 		0, 0x2222, 0x1200, 0,
465 		PARM_DYNAMIC_LINK | PARM_HEX | PARM_HIDDEN,
466 	"Sets authentication hash priorities[4]. [0=Undef, 1=MD5, 2=SHA1]"},
467 
468 	/* CFG_AUTH_GROUP */
469 	{"auth-group",
470 		0, 0x55555555, 0x54321000, 0,
471 		PARM_DYNAMIC_LINK | PARM_HEX | PARM_HIDDEN,
472 	"Sets auth group priorities[8]. "
473 		"[0=Undef,1=NULL,2=1024,3=1280,4=1536,5=2048]"},
474 
475 	/* CFG_AUTH_INTERVAL */
476 	{"auth-interval",
477 		0, 3600, 300, 0,
478 		PARM_DYNAMIC_LINK | PARM_HIDDEN,
479 	"Sets re-authentication interval. (minutes)"},
480 
481 #endif	/* DHCHAP_SUPPORT */
482 
483 #ifdef SFCT_SUPPORT
484 	/* CFG_TARGET_MODE */
485 	{"target-mode",
486 #ifdef SFCT_ENABLED
487 		0, 1, 1, 0,
488 #else
489 		0, 1, 0, 0,
490 #endif /* SFCT_ENABLED */
491 		0,
492 	"Enables target mode support in driver. [0=Disabled, 1=Enabled]"},
493 
494 	/* CFG_FCT_QDEPTH */
495 	{"fct-queue-depth",
496 		0, 4096, 0, 0,
497 		PARM_BOOLEAN,
498 	"Queue depth of target mode port. "
499 		"[0=max determined by type of HBA]"},
500 #endif /* SFCT_SUPPORT */
501 
502 	/* CFG_NUM_WQ */
503 	{"num-wq",
504 		1, 4, 1, 0,
505 		PARM_DYNAMIC_RESET | PARM_HIDDEN,
506 	"Defines number of Work Queues (WQs) per EQ."},
507 
508 	/* CFG_PERSIST_LINKDOWN */
509 	{"persist-linkdown",
510 		0, 1, 0, 0,
511 		PARM_DYNAMIC_RESET | PARM_BOOLEAN,
512 	"Set link persistently down [0=Disabled, 1=Enabled]."},
513 
514 	/* CFG_ENABLE_PATCH */
515 	{"enable-patch",
516 		0, 0xFFFFFFFF, DEFAULT_PATCHES, 0,
517 		PARM_DYNAMIC | PARM_HEX | PARM_HIDDEN,
518 	"Enables patches in driver."},
519 
520 	/* CFG_FAST_TGT_RESET */
521 	{"fast-tgt-reset",
522 		0, 1, 0, 0,
523 		PARM_DYNAMIC_RESET | PARM_BOOLEAN | PARM_HIDDEN,
524 	"Enables alternative target reset processing. "
525 		"[0=Disabled 1=Enabled]"},
526 
527 	/* CFG_FAST_TGT_RESET_TMR */
528 	{"fast-tgt-reset-timer",
529 		0, 60, 10, 0,
530 		PARM_DYNAMIC_RESET | PARM_BOOLEAN | PARM_HIDDEN,
531 	"RSCN notification timer for fast target reset. "
532 		"[0=Disabled 1-60=seconds]"},
533 
534 };
535 
536 #endif	/* DEF_ICFG */
537 
538 #ifdef	__cplusplus
539 }
540 #endif
541 
542 #endif	/* _EMLXS_CONFIG_H */
543