xref: /illumos-gate/usr/src/uts/common/sys/fibre-channel/fca/qlc/ql_apps.h (revision a724c049b7e0dd8612bc3aaec84e96e80511050d)
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 /* Copyright 2008 QLogic Corporation */
23 
24 /*
25  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  */
28 
29 #ifndef	_QL_APPS_H
30 #define	_QL_APPS_H
31 
32 
33 /*
34  * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
35  *
36  * ***********************************************************************
37  * *									**
38  * *				NOTICE					**
39  * *		COPYRIGHT (C) 1996-2008 QLOGIC CORPORATION		**
40  * *			ALL RIGHTS RESERVED				**
41  * *									**
42  * ***********************************************************************
43  *
44  */
45 
46 #ifdef	__cplusplus
47 extern "C" {
48 #endif
49 
50 #include <sys/scsi/scsi_types.h>
51 
52 /*
53  * Name:	Adapter Revsion Level Structure
54  *
55  * Purpose:	Supply various revision levels of h/w and driver
56  *
57  * Used by:
58  *		qlctest utility
59  *
60  */
61 typedef struct ql_adapter_revlvl {
62 	uint16_t isp2200;			/* 2200 chip rev level */
63 	uint16_t risc;				/* risc rev level */
64 	uint16_t frmbfr;			/* frame buffer rev level */
65 	uint16_t riscrom;			/* risc rom rev level */
66 	char qlddv[16];				/* ql driver version string */
67 } ql_adapter_revlvl_t;
68 
69 /*
70  * Name:	Application Mailbox Interface Structure
71  *
72  * Purpose:	Used to pass mailbox data between app and driver.
73  *
74  * Used by:
75  *		qlctest utility
76  *
77  */
78 typedef struct app_mbx_cmd {
79 	uint16_t	mb[32];
80 	uint8_t		reserved1[32];
81 } app_mbx_cmd_t;
82 
83 /*
84  * Name:	Diagnostic Loopback Parameter Structure
85  *
86  * Purpose:	Used for loopback parameter data
87  *
88  * Used by:
89  *		qlctest utility
90  *
91  */
92 #ifndef apps_64bit
93 typedef struct lbp {
94 	uint16_t  options;
95 	uint32_t  transfer_count;
96 	uint16_t  transfer_segment_count;
97 	uint16_t  receive_segment_count;
98 	uint32_t  transfer_data_address;
99 	uint32_t  receive_data_address;
100 	uint32_t  iteration_count;
101 } lbp_t;
102 #else
103 typedef struct lbp {
104 	uint16_t  options;
105 	uint32_t  transfer_count;
106 	uint16_t  transfer_segment_count;
107 	uint16_t  receive_segment_count;
108 	uint64_t  transfer_data_address;
109 	uint64_t  receive_data_address;
110 	uint32_t  iteration_count;
111 } lbp_t;
112 #endif
113 
114 /*
115  * Defines used by:
116  *			qlctest utility
117  *
118  * Prupose:
119  *	diag switch clause hooks provided for requested diagnostic
120  *	functionality (Check command Queue, Revision Level, Firmwware
121  *	Checksum, Self Test, Loopback Mailbox, Loopback Data, Execute
122  *	Firmware and send ECHO.
123  */
124 #define	QL_DIAG_CHKCMDQUE		0
125 #define	QL_DIAG_FMWCHKSUM		1
126 #define	QL_DIAG_SLFTST			2
127 #define	QL_DIAG_REVLVL			3
128 #define	QL_DIAG_LPBMBX			4
129 #define	QL_DIAG_LPBDTA			5
130 #define	QL_DIAG_EXEFMW			6
131 #define	QL_GET_ADAPTER_FEATURE_BITS	7
132 #define	QL_SET_ADAPTER_FEATURE_BITS	8
133 #define	QL_SET_ADAPTER_NVRAM_DEFAULTS	9
134 #define	QL_DIAG_ECHO			10
135 
136 /*
137  * Defines used for:
138  *			qladm utility
139  *			qlctest utility
140  *
141  * Purpose:
142  *	Driver IOCTL numbers for nvram dump/load, and driverop
143  *	functions. NB: 300 --> 399 are reserved for qla2x00 foapi's
144  */
145 #define	QL_UTIL_LOAD	100
146 #define	QL_UTIL_DUMP	101
147 #define	QL_FOAPI_START	300
148 #define	QL_FOAPI_END	399
149 #define	QL_ADM_OP	402
150 
151 /*
152  * Purpose:
153  *	QLA_ADM_OP command definitions
154  *
155  * Used by:
156  *		qladm utility
157  *		qlctest utility
158  */
159 typedef enum ql_adm_cmd  {
160 	QL_EXTENDED_LOGGING,
161 	QL_ADAPTER_INFO,
162 	QL_DEVICE_LIST,
163 	QL_LOOP_RESET,
164 	QL_FW_DUMP,
165 	QL_NVRAM_LOAD,
166 	QL_NVRAM_DUMP,
167 	QL_FLASH_LOAD,
168 	QL_PROP_UPDATE_INT,
169 	QL_UPDATE_PROPERTIES,
170 	QL_VPD_LOAD,
171 	QL_VPD_DUMP,
172 	QL_VPD_GETTAG,
173 	QL_UPD_FWMODULE
174 } ql_adm_cmd_t;
175 
176 /*
177  * Purpose:
178  *	QLA_ADM_OP Parameter Interface Structure
179  *
180  * Used by:
181  *		qladm utility
182  *		qlctest utility
183  */
184 typedef struct ql_adm_op {
185 	uint64_t	buffer;
186 	uint32_t	length;
187 	uint32_t	option;
188 	ql_adm_cmd_t	cmd;	/* driver_op command */
189 } ql_adm_op_t;
190 
191 /*
192  * Purpose:
193  *	QLA_ADM_OP parameter data structure
194  *
195  * Used by:
196  *		qladm utility
197  *		qlctest utility
198  */
199 #define	MAX_PROP_LENGTH	256
200 typedef struct ql_adapter_info {
201 	uint8_t		wwpn[8];
202 	uint32_t	d_id;
203 	uint32_t	flash_size;
204 	uint16_t	device_id;
205 	char		fw_ver[MAX_PROP_LENGTH];
206 	char		fcode_ver[MAX_PROP_LENGTH];
207 	char		driver_ver[MAX_PROP_LENGTH];
208 } ql_adapter_info_t;
209 
210 /*
211  * Purpose:
212  *	QLA_ADM_OP data types (Fibre channel port types)
213  *
214  * Used by:
215  *		qladm utility
216  *		qlctest utility
217  */
218 typedef enum ql_port_type {
219 	FCT_UNKNOWN,
220 	FCT_TAPE,
221 	FCT_INITIATOR,
222 	FCT_TARGET
223 } ql_port_type_t;
224 
225 /*
226  * Purpose:
227  *	QLA_ADM_OP Device Information Structure
228  *
229  * Used by:
230  *		qladm utility
231  *		qlctest utility
232  */
233 typedef struct ql_device_info {
234 	uint8_t		wwpn[8];
235 	uint32_t	address;
236 	ql_port_type_t	type;
237 	uint16_t	loop_id;
238 } ql_device_info_t;
239 
240 #ifdef	__cplusplus
241 }
242 #endif
243 
244 #endif /* _QL_APPS_H */
245