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