1fcf3ce44SJohn Forte /*
2fcf3ce44SJohn Forte  * CDDL HEADER START
3fcf3ce44SJohn Forte  *
4fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7fcf3ce44SJohn Forte  *
8fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11fcf3ce44SJohn Forte  * and limitations under the License.
12fcf3ce44SJohn Forte  *
13fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18fcf3ce44SJohn Forte  *
19fcf3ce44SJohn Forte  * CDDL HEADER END
20fcf3ce44SJohn Forte  */
21fcf3ce44SJohn Forte 
22*4c3888b8SHans Rosenfeld /* Copyright 2015 QLogic Corporation */
23fcf3ce44SJohn Forte 
24fcf3ce44SJohn Forte /*
255dfd244aSDaniel Beauregard  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
26fcf3ce44SJohn Forte  * Use is subject to license terms.
27fcf3ce44SJohn Forte  */
28fcf3ce44SJohn Forte 
29fcf3ce44SJohn Forte #ifndef	_QL_APPS_H
30fcf3ce44SJohn Forte #define	_QL_APPS_H
31fcf3ce44SJohn Forte 
32fcf3ce44SJohn Forte /*
33fcf3ce44SJohn Forte  * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
34fcf3ce44SJohn Forte  *
35fcf3ce44SJohn Forte  * ***********************************************************************
36fcf3ce44SJohn Forte  * *									**
37fcf3ce44SJohn Forte  * *				NOTICE					**
38*4c3888b8SHans Rosenfeld  * *		COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION		**
39fcf3ce44SJohn Forte  * *			ALL RIGHTS RESERVED				**
40fcf3ce44SJohn Forte  * *									**
41fcf3ce44SJohn Forte  * ***********************************************************************
42fcf3ce44SJohn Forte  *
43fcf3ce44SJohn Forte  */
44fcf3ce44SJohn Forte 
45fcf3ce44SJohn Forte #ifdef	__cplusplus
46fcf3ce44SJohn Forte extern "C" {
47fcf3ce44SJohn Forte #endif
48fcf3ce44SJohn Forte 
49fcf3ce44SJohn Forte #include <sys/scsi/scsi_types.h>
50fcf3ce44SJohn Forte 
515dfd244aSDaniel Beauregard /* f/w trace sizes */
525dfd244aSDaniel Beauregard #define	FWEXTSIZE		(0x4000 * 4)	/* bytes - 16kb multiples */
535dfd244aSDaniel Beauregard #define	FWFCESIZE		(0x4000 * 4)	/* bytes - 16kb multiples */
545dfd244aSDaniel Beauregard 
555dfd244aSDaniel Beauregard /*
565dfd244aSDaniel Beauregard  * ISP8100 Extended Initialization Control Block
575dfd244aSDaniel Beauregard  */
585dfd244aSDaniel Beauregard typedef struct ql_ext_icb_8100 {
595dfd244aSDaniel Beauregard 	uint8_t version[2];
605dfd244aSDaniel Beauregard 	/*
615dfd244aSDaniel Beauregard 	 * BIT 0 = FCF VLAN ID Match
625dfd244aSDaniel Beauregard 	 * BIT 1 = FCF Fabric Name Match
635dfd244aSDaniel Beauregard 	 * BIT 2-7 = Reserved
645dfd244aSDaniel Beauregard 	 */
655dfd244aSDaniel Beauregard 	uint8_t fcf_vlan_match;
665dfd244aSDaniel Beauregard 	uint8_t reserved_6[3];
675dfd244aSDaniel Beauregard 	uint8_t fcf_vlan_id[2];
685dfd244aSDaniel Beauregard 	uint8_t fcf_fabric_name[8];
695dfd244aSDaniel Beauregard 	uint8_t reserved_7[14];
705dfd244aSDaniel Beauregard 	uint8_t spma_proposed_mac_address[6];
715dfd244aSDaniel Beauregard 	uint8_t reserved_8[28];
725dfd244aSDaniel Beauregard } ql_ext_icb_8100_t;
735dfd244aSDaniel Beauregard 
74fcf3ce44SJohn Forte /*
75fcf3ce44SJohn Forte  * Name:	Adapter Revsion Level Structure
76fcf3ce44SJohn Forte  *
77fcf3ce44SJohn Forte  * Purpose:	Supply various revision levels of h/w and driver
78fcf3ce44SJohn Forte  *
79fcf3ce44SJohn Forte  * Used by:
80fcf3ce44SJohn Forte  *		qlctest utility
81fcf3ce44SJohn Forte  *
82fcf3ce44SJohn Forte  */
83fcf3ce44SJohn Forte typedef struct ql_adapter_revlvl {
84fcf3ce44SJohn Forte 	uint16_t isp2200;			/* 2200 chip rev level */
85fcf3ce44SJohn Forte 	uint16_t risc;				/* risc rev level */
86fcf3ce44SJohn Forte 	uint16_t frmbfr;			/* frame buffer rev level */
87fcf3ce44SJohn Forte 	uint16_t riscrom;			/* risc rom rev level */
88fcf3ce44SJohn Forte 	char qlddv[16];				/* ql driver version string */
89fcf3ce44SJohn Forte } ql_adapter_revlvl_t;
90fcf3ce44SJohn Forte 
91fcf3ce44SJohn Forte /*
92fcf3ce44SJohn Forte  * Name:	Application Mailbox Interface Structure
93fcf3ce44SJohn Forte  *
94fcf3ce44SJohn Forte  * Purpose:	Used to pass mailbox data between app and driver.
95fcf3ce44SJohn Forte  *
96fcf3ce44SJohn Forte  * Used by:
97fcf3ce44SJohn Forte  *		qlctest utility
98fcf3ce44SJohn Forte  *
99fcf3ce44SJohn Forte  */
100fcf3ce44SJohn Forte typedef struct app_mbx_cmd {
101fcf3ce44SJohn Forte 	uint16_t	mb[32];
102fcf3ce44SJohn Forte 	uint8_t		reserved1[32];
103fcf3ce44SJohn Forte } app_mbx_cmd_t;
104fcf3ce44SJohn Forte 
105fcf3ce44SJohn Forte /*
106fcf3ce44SJohn Forte  * Name:	Diagnostic Loopback Parameter Structure
107fcf3ce44SJohn Forte  *
108fcf3ce44SJohn Forte  * Purpose:	Used for loopback parameter data
109fcf3ce44SJohn Forte  *
110fcf3ce44SJohn Forte  * Used by:
111fcf3ce44SJohn Forte  *		qlctest utility
112fcf3ce44SJohn Forte  *
113fcf3ce44SJohn Forte  */
114fcf3ce44SJohn Forte #ifndef apps_64bit
115fcf3ce44SJohn Forte typedef struct lbp {
116*4c3888b8SHans Rosenfeld 	uint16_t	options;
117*4c3888b8SHans Rosenfeld 	uint32_t	transfer_count;
118*4c3888b8SHans Rosenfeld 	uint16_t	transfer_segment_count;
119*4c3888b8SHans Rosenfeld 	uint16_t	receive_segment_count;
120*4c3888b8SHans Rosenfeld 	uint32_t	transfer_data_address;
121*4c3888b8SHans Rosenfeld 	uint32_t	receive_data_address;
122*4c3888b8SHans Rosenfeld 	uint32_t	iteration_count;
123fcf3ce44SJohn Forte } lbp_t;
124fcf3ce44SJohn Forte #else
125fcf3ce44SJohn Forte typedef struct lbp {
126*4c3888b8SHans Rosenfeld 	uint16_t	options;
127*4c3888b8SHans Rosenfeld 	uint32_t	transfer_count;
128*4c3888b8SHans Rosenfeld 	uint16_t	transfer_segment_count;
129*4c3888b8SHans Rosenfeld 	uint16_t	receive_segment_count;
130*4c3888b8SHans Rosenfeld 	uint64_t	transfer_data_address;
131*4c3888b8SHans Rosenfeld 	uint64_t	receive_data_address;
132*4c3888b8SHans Rosenfeld 	uint32_t	iteration_count;
133fcf3ce44SJohn Forte } lbp_t;
134fcf3ce44SJohn Forte #endif
135fcf3ce44SJohn Forte 
136fcf3ce44SJohn Forte /*
137fcf3ce44SJohn Forte  * Defines used by:
138fcf3ce44SJohn Forte  *			qlctest utility
139fcf3ce44SJohn Forte  *
140fcf3ce44SJohn Forte  * Prupose:
141fcf3ce44SJohn Forte  *	diag switch clause hooks provided for requested diagnostic
142fcf3ce44SJohn Forte  *	functionality (Check command Queue, Revision Level, Firmwware
143fcf3ce44SJohn Forte  *	Checksum, Self Test, Loopback Mailbox, Loopback Data, Execute
144fcf3ce44SJohn Forte  *	Firmware and send ECHO.
145fcf3ce44SJohn Forte  */
146fcf3ce44SJohn Forte #define	QL_DIAG_CHKCMDQUE		0
147fcf3ce44SJohn Forte #define	QL_DIAG_FMWCHKSUM		1
148fcf3ce44SJohn Forte #define	QL_DIAG_SLFTST			2
149fcf3ce44SJohn Forte #define	QL_DIAG_REVLVL			3
150fcf3ce44SJohn Forte #define	QL_DIAG_LPBMBX			4
151fcf3ce44SJohn Forte #define	QL_DIAG_LPBDTA			5
152fcf3ce44SJohn Forte #define	QL_DIAG_EXEFMW			6
153fcf3ce44SJohn Forte #define	QL_GET_ADAPTER_FEATURE_BITS	7
154fcf3ce44SJohn Forte #define	QL_SET_ADAPTER_FEATURE_BITS	8
155fcf3ce44SJohn Forte #define	QL_SET_ADAPTER_NVRAM_DEFAULTS	9
156fcf3ce44SJohn Forte #define	QL_DIAG_ECHO			10
157fcf3ce44SJohn Forte 
158fcf3ce44SJohn Forte /*
159fcf3ce44SJohn Forte  * Defines used for:
160fcf3ce44SJohn Forte  *			qladm utility
161fcf3ce44SJohn Forte  *			qlctest utility
162fcf3ce44SJohn Forte  *
163fcf3ce44SJohn Forte  * Purpose:
164fcf3ce44SJohn Forte  *	Driver IOCTL numbers for nvram dump/load, and driverop
165fcf3ce44SJohn Forte  *	functions. NB: 300 --> 399 are reserved for qla2x00 foapi's
166fcf3ce44SJohn Forte  */
167fcf3ce44SJohn Forte #define	QL_UTIL_LOAD	100
168fcf3ce44SJohn Forte #define	QL_UTIL_DUMP	101
169fcf3ce44SJohn Forte #define	QL_FOAPI_START	300
170fcf3ce44SJohn Forte #define	QL_FOAPI_END	399
171fcf3ce44SJohn Forte #define	QL_ADM_OP	402
172fcf3ce44SJohn Forte 
173fcf3ce44SJohn Forte /*
174fcf3ce44SJohn Forte  * Purpose:
175fcf3ce44SJohn Forte  *	QLA_ADM_OP command definitions
176fcf3ce44SJohn Forte  *
177fcf3ce44SJohn Forte  * Used by:
178fcf3ce44SJohn Forte  *		qladm utility
179fcf3ce44SJohn Forte  *		qlctest utility
180fcf3ce44SJohn Forte  */
181*4c3888b8SHans Rosenfeld typedef enum ql_adm_cmd {
182fcf3ce44SJohn Forte 	QL_EXTENDED_LOGGING,
183fcf3ce44SJohn Forte 	QL_ADAPTER_INFO,
184fcf3ce44SJohn Forte 	QL_DEVICE_LIST,
185fcf3ce44SJohn Forte 	QL_LOOP_RESET,
186fcf3ce44SJohn Forte 	QL_FW_DUMP,
187*4c3888b8SHans Rosenfeld 	QL_FW_DUMP_TRIGGER,
188*4c3888b8SHans Rosenfeld 	QL_BEACON_ENABLE,
189*4c3888b8SHans Rosenfeld 	QL_BEACON_DISABLE,
190fcf3ce44SJohn Forte 	QL_NVRAM_LOAD,
191fcf3ce44SJohn Forte 	QL_NVRAM_DUMP,
192fcf3ce44SJohn Forte 	QL_FLASH_LOAD,
193fcf3ce44SJohn Forte 	QL_PROP_UPDATE_INT,
194fcf3ce44SJohn Forte 	QL_UPDATE_PROPERTIES,
195fcf3ce44SJohn Forte 	QL_VPD_LOAD,
196fcf3ce44SJohn Forte 	QL_VPD_DUMP,
197fcf3ce44SJohn Forte 	QL_VPD_GETTAG,
198fcf3ce44SJohn Forte 	QL_UPD_FWMODULE
199fcf3ce44SJohn Forte } ql_adm_cmd_t;
200fcf3ce44SJohn Forte 
201fcf3ce44SJohn Forte /*
202fcf3ce44SJohn Forte  * Purpose:
203fcf3ce44SJohn Forte  *	QLA_ADM_OP Parameter Interface Structure
204fcf3ce44SJohn Forte  *
205fcf3ce44SJohn Forte  * Used by:
206fcf3ce44SJohn Forte  *		qladm utility
207fcf3ce44SJohn Forte  *		qlctest utility
208fcf3ce44SJohn Forte  */
209fcf3ce44SJohn Forte typedef struct ql_adm_op {
210fcf3ce44SJohn Forte 	uint64_t	buffer;
211fcf3ce44SJohn Forte 	uint32_t	length;
212fcf3ce44SJohn Forte 	uint32_t	option;
213fcf3ce44SJohn Forte 	ql_adm_cmd_t	cmd;	/* driver_op command */
214fcf3ce44SJohn Forte } ql_adm_op_t;
215fcf3ce44SJohn Forte 
216fcf3ce44SJohn Forte /*
217fcf3ce44SJohn Forte  * Purpose:
218fcf3ce44SJohn Forte  *	QLA_ADM_OP parameter data structure
219fcf3ce44SJohn Forte  *
220fcf3ce44SJohn Forte  * Used by:
221fcf3ce44SJohn Forte  *		qladm utility
222fcf3ce44SJohn Forte  *		qlctest utility
223fcf3ce44SJohn Forte  */
224fcf3ce44SJohn Forte #define	MAX_PROP_LENGTH	256
225fcf3ce44SJohn Forte typedef struct ql_adapter_info {
226fcf3ce44SJohn Forte 	uint8_t		wwpn[8];
227fcf3ce44SJohn Forte 	uint32_t	d_id;
228fcf3ce44SJohn Forte 	uint32_t	flash_size;
229fcf3ce44SJohn Forte 	uint16_t	device_id;
230fcf3ce44SJohn Forte 	char		fw_ver[MAX_PROP_LENGTH];
231fcf3ce44SJohn Forte 	char		fcode_ver[MAX_PROP_LENGTH];
232fcf3ce44SJohn Forte 	char		driver_ver[MAX_PROP_LENGTH];
233fcf3ce44SJohn Forte } ql_adapter_info_t;
234fcf3ce44SJohn Forte 
235fcf3ce44SJohn Forte /*
236fcf3ce44SJohn Forte  * Purpose:
237fcf3ce44SJohn Forte  *	QLA_ADM_OP data types (Fibre channel port types)
238fcf3ce44SJohn Forte  *
239fcf3ce44SJohn Forte  * Used by:
240fcf3ce44SJohn Forte  *		qladm utility
241fcf3ce44SJohn Forte  *		qlctest utility
242fcf3ce44SJohn Forte  */
243fcf3ce44SJohn Forte typedef enum ql_port_type {
244fcf3ce44SJohn Forte 	FCT_UNKNOWN,
245fcf3ce44SJohn Forte 	FCT_TAPE,
246fcf3ce44SJohn Forte 	FCT_INITIATOR,
247fcf3ce44SJohn Forte 	FCT_TARGET
248fcf3ce44SJohn Forte } ql_port_type_t;
249fcf3ce44SJohn Forte 
250fcf3ce44SJohn Forte /*
251fcf3ce44SJohn Forte  * Purpose:
252fcf3ce44SJohn Forte  *	QLA_ADM_OP Device Information Structure
253fcf3ce44SJohn Forte  *
254fcf3ce44SJohn Forte  * Used by:
255fcf3ce44SJohn Forte  *		qladm utility
256fcf3ce44SJohn Forte  *		qlctest utility
257fcf3ce44SJohn Forte  */
258fcf3ce44SJohn Forte typedef struct ql_device_info {
259fcf3ce44SJohn Forte 	uint8_t		wwpn[8];
260fcf3ce44SJohn Forte 	uint32_t	address;
261fcf3ce44SJohn Forte 	ql_port_type_t	type;
262fcf3ce44SJohn Forte 	uint16_t	loop_id;
263fcf3ce44SJohn Forte } ql_device_info_t;
264fcf3ce44SJohn Forte 
265fcf3ce44SJohn Forte #ifdef	__cplusplus
266fcf3ce44SJohn Forte }
267fcf3ce44SJohn Forte #endif
268fcf3ce44SJohn Forte 
269fcf3ce44SJohn Forte #endif /* _QL_APPS_H */
270