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 /*
25f885d00fSDaniel Beauregard  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
26fcf3ce44SJohn Forte  */
27fcf3ce44SJohn Forte 
28fcf3ce44SJohn Forte #ifndef _QL_XIOCTL_H
29fcf3ce44SJohn Forte #define	_QL_XIOCTL_H
30fcf3ce44SJohn Forte 
31fcf3ce44SJohn Forte /*
32fcf3ce44SJohn Forte  * ISP2xxx Solaris Fibre Channel Adapter (FCA) driver header file.
33fcf3ce44SJohn Forte  *
34fcf3ce44SJohn Forte  * ***********************************************************************
35fcf3ce44SJohn Forte  * *									**
36fcf3ce44SJohn Forte  * *				NOTICE					**
37*4c3888b8SHans Rosenfeld  * *		COPYRIGHT (C) 1996-2015 QLOGIC CORPORATION		**
38fcf3ce44SJohn Forte  * *			ALL RIGHTS RESERVED				**
39fcf3ce44SJohn Forte  * *									**
40fcf3ce44SJohn Forte  * ***********************************************************************
41fcf3ce44SJohn Forte  *
42fcf3ce44SJohn Forte  */
43fcf3ce44SJohn Forte 
44fcf3ce44SJohn Forte #ifdef __cplusplus
45fcf3ce44SJohn Forte extern "C" {
46fcf3ce44SJohn Forte #endif
47fcf3ce44SJohn Forte 
48fcf3ce44SJohn Forte #include <exioct.h>
49fcf3ce44SJohn Forte 
50fcf3ce44SJohn Forte /* 0xFFFFFA Mgmt Server */
51fcf3ce44SJohn Forte #define	MANAGEMENT_SERVER_LOOP_ID	0xfe
52fcf3ce44SJohn Forte #define	MANAGEMENT_SERVER_24XX_LOOP_ID	0x7ef
53fcf3ce44SJohn Forte 
54fcf3ce44SJohn Forte /* Returned Mailbox registers. */
55fcf3ce44SJohn Forte typedef struct ql_mbx_ret {
56fcf3ce44SJohn Forte 	uint16_t	mb[MAX_MBOX_COUNT];
57fcf3ce44SJohn Forte } ql_mbx_ret_t;
58fcf3ce44SJohn Forte 
59fcf3ce44SJohn Forte /*
605dfd244aSDaniel Beauregard  * Name type defines for use with ql_scsi_passthru() and
61fcf3ce44SJohn Forte  * elsewhere when searching for name matches.
62fcf3ce44SJohn Forte  * NOTE that these defines are used both as flags and values.
63fcf3ce44SJohn Forte  */
64fcf3ce44SJohn Forte #define	QLNT_NODE		0x01
65fcf3ce44SJohn Forte #define	QLNT_PORT		0x02
66fcf3ce44SJohn Forte #define	QLNT_BOTH		(QLNT_NODE | QLNT_PORT)
67fcf3ce44SJohn Forte #define	QLNT_PID		0x04
68fcf3ce44SJohn Forte #define	QLNT_LOOP_ID		0x08
69fcf3ce44SJohn Forte #define	QLNT_MASK		0x0F
70fcf3ce44SJohn Forte 
71fcf3ce44SJohn Forte /*
72fcf3ce44SJohn Forte  * CT information unit basic preamble.
73fcf3ce44SJohn Forte  */
74fcf3ce44SJohn Forte typedef struct ql_ct_iu_preamble {
75fcf3ce44SJohn Forte 	uint8_t		revision;
76fcf3ce44SJohn Forte 	uint8_t		in_id[3];
77fcf3ce44SJohn Forte 	uint8_t		gs_type;
78fcf3ce44SJohn Forte 	uint8_t		gs_subtype;
79fcf3ce44SJohn Forte 	uint8_t		options;
80fcf3ce44SJohn Forte 	uint8_t		reserved;
81fcf3ce44SJohn Forte 	uint16_t	command_response_code;
82fcf3ce44SJohn Forte 	uint16_t	max_residual_size;
83fcf3ce44SJohn Forte 	uint8_t		fragment_id;
84fcf3ce44SJohn Forte 	uint8_t		reason_code;
85fcf3ce44SJohn Forte 	uint8_t		reason_code_explanation;
86fcf3ce44SJohn Forte 	uint8_t		vendor_specific;
87fcf3ce44SJohn Forte } ql_ct_iu_preamble_t;
88fcf3ce44SJohn Forte 
89fcf3ce44SJohn Forte #define	GS_TYPE_DIR_SERVER	0xFC
90fcf3ce44SJohn Forte 
91fcf3ce44SJohn Forte /*
92fcf3ce44SJohn Forte  * Link Status Counts structure
93fcf3ce44SJohn Forte  *
94fcf3ce44SJohn Forte  * Counts are BIG ENDIAN
95fcf3ce44SJohn Forte  */
96fcf3ce44SJohn Forte typedef struct ql_link_stats {
97fcf3ce44SJohn Forte 	uint32_t	link_fail_cnt;
98fcf3ce44SJohn Forte 	uint32_t	sync_loss_cnt;
99fcf3ce44SJohn Forte 	uint32_t	signal_loss_cnt;
100fcf3ce44SJohn Forte 	uint32_t	prot_err_cnt;	/* Primitive seq protocol errors */
101fcf3ce44SJohn Forte 	uint32_t	inv_xmit_cnt;	/* Invalid transmission word count */
102fcf3ce44SJohn Forte 	uint32_t	inv_crc_cnt;	/* Invalid CRC count */
103fcf3ce44SJohn Forte } ql_link_stats_t;
104fcf3ce44SJohn Forte 
105fcf3ce44SJohn Forte /*
106fcf3ce44SJohn Forte  * Report LUN definitions.
107fcf3ce44SJohn Forte  */
108fcf3ce44SJohn Forte typedef struct ql_rpt_hdr {
109fcf3ce44SJohn Forte 	uint32_t	len;
110fcf3ce44SJohn Forte 	uint32_t	rsrv;
111fcf3ce44SJohn Forte } ql_rpt_hdr_t;
112fcf3ce44SJohn Forte 
113fcf3ce44SJohn Forte typedef struct ql_rpt_lun {
114fcf3ce44SJohn Forte 	struct {
115fcf3ce44SJohn Forte 		uint8_t		b : 6;
116fcf3ce44SJohn Forte 		uint8_t		address_method : 2;
117fcf3ce44SJohn Forte 	} msb;
118fcf3ce44SJohn Forte 	uint8_t		lsb;
119fcf3ce44SJohn Forte 	uint8_t		unused[6];
120fcf3ce44SJohn Forte } ql_rpt_lun_t;
121fcf3ce44SJohn Forte 
122fcf3ce44SJohn Forte typedef struct ql_rpt_lun_lst {
123fcf3ce44SJohn Forte 	ql_rpt_hdr_t	hdr;
124fcf3ce44SJohn Forte 	ql_rpt_lun_t	lst[MAX_LUNS];
125fcf3ce44SJohn Forte } ql_rpt_lun_lst_t;
126fcf3ce44SJohn Forte 
127fcf3ce44SJohn Forte #define	INQ_DATA_SIZE	8
128fcf3ce44SJohn Forte 
129fcf3ce44SJohn Forte /*
130fcf3ce44SJohn Forte  * Flash definitions.
131fcf3ce44SJohn Forte  */
132fcf3ce44SJohn Forte typedef struct ql_flash_info {
133fcf3ce44SJohn Forte 	uint32_t	type;		/* flash type */
134fcf3ce44SJohn Forte 	uint32_t	size;		/* length in bytes of flash */
135fcf3ce44SJohn Forte 	uint32_t	sec_mask;	/* sector number mask */
136fcf3ce44SJohn Forte 	uint8_t		man_id;		/* flash chip manufacturer id */
137fcf3ce44SJohn Forte 	uint8_t		id;		/* flash chip id */
138fcf3ce44SJohn Forte 	uint8_t		cap;		/* flash chip capacity */
139fcf3ce44SJohn Forte } ql_flash_info_t;
140fcf3ce44SJohn Forte 
141fcf3ce44SJohn Forte /*
142fcf3ce44SJohn Forte  * Flash Description Table
143fcf3ce44SJohn Forte  */
144fcf3ce44SJohn Forte #define	FLASH_DESC_VERSION	1
145fcf3ce44SJohn Forte #define	FLASH_DESC_VAILD	0x44494C51	/* "QLID" */
146fcf3ce44SJohn Forte typedef struct flash_desc {
147fcf3ce44SJohn Forte 	uint32_t	flash_valid;
148fcf3ce44SJohn Forte 	uint16_t	flash_version;
149fcf3ce44SJohn Forte 	uint16_t	flash_len;
150fcf3ce44SJohn Forte 	uint16_t	flash_checksum;
151fcf3ce44SJohn Forte 	uint16_t	flash_unused;
152fcf3ce44SJohn Forte 	uint8_t		flash_model[16];
153fcf3ce44SJohn Forte 	uint16_t	flash_manuf;
154fcf3ce44SJohn Forte 	uint16_t	flash_id;
155fcf3ce44SJohn Forte 	uint8_t		flash_flag;
156fcf3ce44SJohn Forte 	uint8_t		erase_cmd;
157fcf3ce44SJohn Forte 	uint8_t		alt_erase_cmd;
158fcf3ce44SJohn Forte 	uint8_t		write_enable_cmd;
159fcf3ce44SJohn Forte 	uint8_t		write_enable_bits;
160fcf3ce44SJohn Forte 	uint8_t		write_statusreg_cmd;
161fcf3ce44SJohn Forte 	uint8_t		unprotect_sector_cmd;
162fcf3ce44SJohn Forte 	uint8_t		read_manuf_cmd;
163fcf3ce44SJohn Forte 	uint32_t	block_size;
164fcf3ce44SJohn Forte 	uint32_t	alt_block_size;
165fcf3ce44SJohn Forte 	uint32_t	flash_size;
166fcf3ce44SJohn Forte 	uint32_t	write_enable_data;
167fcf3ce44SJohn Forte 	uint8_t		readid_address_len;
168fcf3ce44SJohn Forte 	uint8_t		write_disable_bits;
169fcf3ce44SJohn Forte 	uint8_t		read_device_id_len;
170fcf3ce44SJohn Forte 	uint8_t		chip_erase_cmd;
171fcf3ce44SJohn Forte 	uint16_t	read_timeout;
172fcf3ce44SJohn Forte 	uint8_t		protect_sector_cmd;
173fcf3ce44SJohn Forte 	uint8_t		exp_reserved[65];
174fcf3ce44SJohn Forte } flash_desc_t;
175fcf3ce44SJohn Forte 
176fcf3ce44SJohn Forte /* flash manufacturer id's */
177fcf3ce44SJohn Forte #define	AMD_FLASH		0x01	/* AMD / Spansion */
178fcf3ce44SJohn Forte #define	ST_FLASH		0x20	/* ST Electronics */
179fcf3ce44SJohn Forte #define	SST_FLASH		0xbf	/* SST Electronics */
180fcf3ce44SJohn Forte #define	MXIC_FLASH		0xc2	/* Macronix (MXIC) */
181fcf3ce44SJohn Forte #define	ATMEL_FLASH		0x1f	/* Atmel (AT26DF081A) */
182fcf3ce44SJohn Forte #define	WINBOND_FLASH		0xef	/* Winbond (W25X16) */
183fcf3ce44SJohn Forte #define	INTEL_FLASH		0x89	/* Intel (QB25F016S33B8) */
184*4c3888b8SHans Rosenfeld #define	EON_FLASH		0x1c	/* EON Silicon Solutions */
185fcf3ce44SJohn Forte 
186fcf3ce44SJohn Forte /* flash id defines */
187fcf3ce44SJohn Forte #define	AMD_FLASHID_128K	0x6e	/* 128k AMD flash chip */
188fcf3ce44SJohn Forte #define	AMD_FLASHID_512K	0x4f	/* 512k AMD flash chip */
189fcf3ce44SJohn Forte #define	AMD_FLASHID_512Kt	0xb9	/* 512k AMD flash chip - top boot blk */
190fcf3ce44SJohn Forte #define	AMD_FLASHID_512Kb	0xba	/* 512k AMD flash chip - btm boot blk */
191fcf3ce44SJohn Forte #define	AMD_FLASHID_1024K	0x38	/* 1 MB AMD flash chip */
192fcf3ce44SJohn Forte #define	ST_FLASHID_128K		0x23	/* 128k ST flash chip */
193fcf3ce44SJohn Forte #define	ST_FLASHID_512K		0xe3	/* 512k ST flash chip */
194fcf3ce44SJohn Forte #define	ST_FLASHID_M25PXX	0x20	/* M25Pxx ST flash chip */
195*4c3888b8SHans Rosenfeld #define	ST_FLASHID_N25QXXX	0xBA	/* M25Qxx ST flash chip */
196fcf3ce44SJohn Forte #define	SST_FLASHID_128K	0xd5	/* 128k SST flash chip */
197fcf3ce44SJohn Forte #define	SST_FLASHID_1024K	0xd8	/* 1 MB SST flash chip */
198fcf3ce44SJohn Forte #define	SST_FLASHID_1024K_A	0x80	/* 1 MB SST 25LF080A flash chip */
199fcf3ce44SJohn Forte #define	SST_FLASHID_1024K_B	0x8e	/* 1 MB SST 25VF080B flash chip */
200fcf3ce44SJohn Forte #define	SST_FLASHID_2048K	0x25	/* 2 MB SST 25VF016B flash chip */
201fcf3ce44SJohn Forte #define	MXIC_FLASHID_512K	0x4f	/* 512k MXIC flash chip */
202fcf3ce44SJohn Forte #define	MXIC_FLASHID_1024K	0x38	/* 1 MB MXIC flash chip */
203fcf3ce44SJohn Forte #define	MXIC_FLASHID_25LXX	0x20	/* 25Lxx MXIC flash chip */
204fcf3ce44SJohn Forte #define	ATMEL_FLASHID_1024K	0x45	/* 1 MB ATMEL flash chip */
205fcf3ce44SJohn Forte #define	SPAN_FLASHID_2048K	0x02	/* 2 MB Spansion flash chip */
206*4c3888b8SHans Rosenfeld #define	SPAN_FLASHID_16384K	0x20	/* 16 MB Spansion flash chip */
207fcf3ce44SJohn Forte #define	WINBOND_FLASHID		0x30	/* Winbond W25Xxx flash chip */
208*4c3888b8SHans Rosenfeld #define	WINBOND_FLASHID_Q	0x40	/* Winbond W25Qxxx flash chip */
209fcf3ce44SJohn Forte #define	INTEL_FLASHID		0x89	/* Intel QB25F016S33B8 flash chip */
210*4c3888b8SHans Rosenfeld #define	EON_FLASHID_EN25QXXX	0x30	/* EON EN25Qxxx flash chip */
211fcf3ce44SJohn Forte 
212fcf3ce44SJohn Forte /* flash type defines */
213fcf3ce44SJohn Forte #define	FLASH128	BIT_0
214fcf3ce44SJohn Forte #define	FLASH512	BIT_1
215fcf3ce44SJohn Forte #define	FLASH512S	BIT_2
216fcf3ce44SJohn Forte #define	FLASH1024	BIT_3
217fcf3ce44SJohn Forte #define	FLASH2048	BIT_4
218fcf3ce44SJohn Forte #define	FLASH4096	BIT_5
219fcf3ce44SJohn Forte #define	FLASH8192	BIT_6
220fcf3ce44SJohn Forte #define	FLASH_PAGE	BIT_31
221fcf3ce44SJohn Forte #define	FLASH_LEGACY	(FLASH128 | FLASH512S)
222fcf3ce44SJohn Forte 
223fcf3ce44SJohn Forte /*
224fcf3ce44SJohn Forte  * ledstate flags definitions
225fcf3ce44SJohn Forte  */
226fcf3ce44SJohn Forte #define	LED_ACTIVE	BIT_0
227fcf3ce44SJohn Forte 
228fcf3ce44SJohn Forte /*
229fcf3ce44SJohn Forte  * ledstate BeaconState definitions
230fcf3ce44SJohn Forte  */
231fcf3ce44SJohn Forte #define	BEACON_OFF	0
232fcf3ce44SJohn Forte #define	BEACON_ON	BIT_0
233fcf3ce44SJohn Forte 
234fcf3ce44SJohn Forte /*
235fcf3ce44SJohn Forte  * ledstate LEDflags definitions
236fcf3ce44SJohn Forte  */
237fcf3ce44SJohn Forte #define	LED_ALL_OFF	0
238fcf3ce44SJohn Forte #define	LED_RED		BIT_0
239fcf3ce44SJohn Forte #define	LED_GREEN	BIT_6
240fcf3ce44SJohn Forte #define	LED_AMBER	BIT_7
241fcf3ce44SJohn Forte #define	LED_MASK	(LED_AMBER | LED_GREEN | LED_RED)
242fcf3ce44SJohn Forte 
243fcf3ce44SJohn Forte /*
244fcf3ce44SJohn Forte  * 24xx ledstate LEDflags definitions
245fcf3ce44SJohn Forte  */
246fcf3ce44SJohn Forte #define	LED_MASK_UPDATE_24	(BIT_20 | BIT_19 | BIT_18)
247fcf3ce44SJohn Forte #define	LED_YELLOW_24		BIT_2
248fcf3ce44SJohn Forte #define	LED_GREEN_24		BIT_3
249fcf3ce44SJohn Forte #define	LED_AMBER_24		BIT_4
250fcf3ce44SJohn Forte #define	LED_MASK_COLORS_24	(LED_AMBER_24 | LED_GREEN_24 | LED_YELLOW_24)
251fcf3ce44SJohn Forte 
252fcf3ce44SJohn Forte typedef struct {
253fcf3ce44SJohn Forte 	uint8_t		signature[2];
254fcf3ce44SJohn Forte 	uint8_t		reserved[0x16];
255fcf3ce44SJohn Forte 	uint8_t		dataoffset[2];
256fcf3ce44SJohn Forte 	uint8_t		pad[6];
257fcf3ce44SJohn Forte } pci_header_t;
258fcf3ce44SJohn Forte 
259fcf3ce44SJohn Forte typedef struct {
260fcf3ce44SJohn Forte 	uint8_t		 signature[4];
261fcf3ce44SJohn Forte 	uint8_t		 vid[2];
262fcf3ce44SJohn Forte 	uint8_t		 did[2];
263fcf3ce44SJohn Forte 	uint8_t		 reserved0[2];
264fcf3ce44SJohn Forte 	uint8_t		 pcidatalen[2];
265fcf3ce44SJohn Forte 	uint8_t		 pcidatarev;
266fcf3ce44SJohn Forte 	uint8_t		 classcode[3];
267fcf3ce44SJohn Forte 	uint8_t		 imagelength[2];   /* In sectors */
268fcf3ce44SJohn Forte 	uint8_t		 revisionlevel[2];
269fcf3ce44SJohn Forte 	uint8_t		 codetype;
270fcf3ce44SJohn Forte 	uint8_t		 indicator;
271fcf3ce44SJohn Forte 	uint8_t		 reserved1[2];
272fcf3ce44SJohn Forte 	uint8_t		 pad[8];
273fcf3ce44SJohn Forte } pci_data_t;
274fcf3ce44SJohn Forte 
275fcf3ce44SJohn Forte #define	PCI_HEADER0		0x55
276fcf3ce44SJohn Forte #define	PCI_HEADER1		0xAA
277fcf3ce44SJohn Forte #define	PCI_DATASIG		"PCIR"
278fcf3ce44SJohn Forte #define	PCI_SECTOR_SIZE		0x200
279fcf3ce44SJohn Forte #define	PCI_CODE_X86PC		0
280fcf3ce44SJohn Forte #define	PCI_CODE_FCODE		1
281fcf3ce44SJohn Forte #define	PCI_CODE_HPPA		2
282fcf3ce44SJohn Forte #define	PCI_CODE_EFI		3
283fcf3ce44SJohn Forte #define	PCI_CODE_FW		0xfe
284fcf3ce44SJohn Forte #define	PCI_IND_LAST_IMAGE	0x80
285fcf3ce44SJohn Forte #define	SBUS_CODE_FCODE		0xf1
286fcf3ce44SJohn Forte 
287fcf3ce44SJohn Forte typedef struct ql_fcache {
288fcf3ce44SJohn Forte 	struct ql_fcache	*next;
289fcf3ce44SJohn Forte 	uint32_t		type;
290fcf3ce44SJohn Forte 	int8_t			verstr[FCHBA_OPTION_ROM_VERSION_LEN];
291fcf3ce44SJohn Forte 	uint32_t		buflen;
292fcf3ce44SJohn Forte 	uint8_t			*buf;
293fcf3ce44SJohn Forte } ql_fcache_t;
294fcf3ce44SJohn Forte 
295fcf3ce44SJohn Forte /* fcache types */
296fcf3ce44SJohn Forte #define	FTYPE_UNKNOWN	0
297fcf3ce44SJohn Forte #define	FTYPE_FCODE	BIT_0
298fcf3ce44SJohn Forte #define	FTYPE_BIOS	BIT_1
299fcf3ce44SJohn Forte #define	FTYPE_EFI	BIT_2
300fcf3ce44SJohn Forte #define	FTYPE_FW	BIT_3
301fcf3ce44SJohn Forte #define	FTYPE_HPPA	BIT_4
302fcf3ce44SJohn Forte 
303fcf3ce44SJohn Forte #define	FBUFSIZE	100
304fcf3ce44SJohn Forte 
3055dfd244aSDaniel Beauregard /*
3065dfd244aSDaniel Beauregard  * Flash Layout Table definitions.
3075dfd244aSDaniel Beauregard  */
3085dfd244aSDaniel Beauregard typedef struct ql_flash_layout_pointer {
3095dfd244aSDaniel Beauregard 	uint8_t		sig[4];
3105dfd244aSDaniel Beauregard 	uint8_t		addr[4];
3115dfd244aSDaniel Beauregard 	uint8_t		version;
3125dfd244aSDaniel Beauregard 	uint8_t		reserved[5];
3135dfd244aSDaniel Beauregard 	uint8_t		checksum[2];
3145dfd244aSDaniel Beauregard } ql_flt_ptr_t;
3155dfd244aSDaniel Beauregard 
3165dfd244aSDaniel Beauregard typedef struct ql_flash_layout_header {
3175dfd244aSDaniel Beauregard 	uint8_t		version[2];
3185dfd244aSDaniel Beauregard 	uint8_t		len[2];
3195dfd244aSDaniel Beauregard 	uint8_t		checksum[2];
3205dfd244aSDaniel Beauregard 	uint8_t		reserved[2];
3215dfd244aSDaniel Beauregard } ql_flt_hdr_t;
3225dfd244aSDaniel Beauregard 
3235dfd244aSDaniel Beauregard typedef struct ql_flash_layout_region {
3245dfd244aSDaniel Beauregard 	uint8_t		region;
3255dfd244aSDaniel Beauregard 	uint8_t		reserved;
3265dfd244aSDaniel Beauregard 	uint8_t		attribute;
3275dfd244aSDaniel Beauregard 	uint8_t		reserved_1;
3285dfd244aSDaniel Beauregard 	uint8_t		size[4];
3295dfd244aSDaniel Beauregard 	uint8_t		beg_addr[4];
3305dfd244aSDaniel Beauregard 	uint8_t		end_addr[4];
3315dfd244aSDaniel Beauregard } ql_flt_region_t;
3325dfd244aSDaniel Beauregard 
333f885d00fSDaniel Beauregard typedef struct ql_fp_cfg_hdr {
334f885d00fSDaniel Beauregard 	uint8_t		version[2];
335f885d00fSDaniel Beauregard 	uint8_t		len[2];
336f885d00fSDaniel Beauregard 	uint8_t		checksum[2];
337f885d00fSDaniel Beauregard 	uint8_t		NumberEntries[2];
338f885d00fSDaniel Beauregard 	uint8_t		SizeEntry[2];
339f885d00fSDaniel Beauregard 	uint8_t		unused[2];
340f885d00fSDaniel Beauregard 	uint8_t		Signature[4];
341f885d00fSDaniel Beauregard } ql_fp_cfg_hdr_t;
342f885d00fSDaniel Beauregard 
343f885d00fSDaniel Beauregard typedef struct ql_fp_cfg {
344f885d00fSDaniel Beauregard 	uint8_t		FunctionNumber[2];
345f885d00fSDaniel Beauregard 	uint8_t		FunctionType;
346f885d00fSDaniel Beauregard 	uint8_t		PortConfigIndex;
347f885d00fSDaniel Beauregard 	uint8_t		ConfigRegion;
348f885d00fSDaniel Beauregard 	uint8_t		VpdRegion;
349f885d00fSDaniel Beauregard 	uint8_t		DCBXRegion;
350f885d00fSDaniel Beauregard 	uint8_t		Reserved;
351f885d00fSDaniel Beauregard } ql_fp_cfg_t;
352f885d00fSDaniel Beauregard 
353f885d00fSDaniel Beauregard #define	FT_NIC		0
354f885d00fSDaniel Beauregard #define	FT_FC		1
355f885d00fSDaniel Beauregard #define	FT_ISCSI	2
356f885d00fSDaniel Beauregard #define	FT_VNIC		3
357f885d00fSDaniel Beauregard 
358f885d00fSDaniel Beauregard typedef struct ql_fp_cfg_map {
359f885d00fSDaniel Beauregard 	ql_fp_cfg_hdr_t	hdr;
360f885d00fSDaniel Beauregard 	ql_fp_cfg_t	cfg[6];
361f885d00fSDaniel Beauregard } ql_fp_cfg_map_t;
362f885d00fSDaniel Beauregard 
3635dfd244aSDaniel Beauregard #define	FLASH_FW_REGION			0x01
364*4c3888b8SHans Rosenfeld #define	FLASH_BOOT_CODE_REGION		0x07
3655dfd244aSDaniel Beauregard #define	FLASH_VPD_0_REGION		0x14
3665dfd244aSDaniel Beauregard #define	FLASH_NVRAM_0_REGION		0x15
3675dfd244aSDaniel Beauregard #define	FLASH_VPD_1_REGION		0x16
3685dfd244aSDaniel Beauregard #define	FLASH_NVRAM_1_REGION		0x17
3695dfd244aSDaniel Beauregard #define	FLASH_DESC_TABLE_REGION		0x1A
3705dfd244aSDaniel Beauregard #define	FLASH_ERROR_LOG_0_REGION	0x1D
3715dfd244aSDaniel Beauregard #define	FLASH_ERROR_LOG_1_REGION	0x1F
3725dfd244aSDaniel Beauregard #define	FLASH_GOLDEN_FW_REGION		0x2F
373*4c3888b8SHans Rosenfeld #define	FLASH_BOOTLOADER_REGION		0x72
3745dfd244aSDaniel Beauregard 
375eb82ff87SDaniel Beauregard #define	FLASH_8021_FW_REGION		0x74
376eb82ff87SDaniel Beauregard #define	FLASH_8021_GOLDEN_FW_REGION	0x75
377eb82ff87SDaniel Beauregard #define	FLASH_8021_BOOTLOADER_REGION	0x72
378eb82ff87SDaniel Beauregard #define	FLASH_8021_VPD_REGION		0x81
379eb82ff87SDaniel Beauregard 
3805dfd244aSDaniel Beauregard #define	FLASH_LAYOUT_TABLE_SIZE		4096
3815dfd244aSDaniel Beauregard 
382fcf3ce44SJohn Forte /*
383fcf3ce44SJohn Forte  * Per instance XIOCTL context defintions.
384fcf3ce44SJohn Forte  */
385fcf3ce44SJohn Forte typedef struct ql_xioctl {
386fcf3ce44SJohn Forte 	/* Driver context */
387fcf3ce44SJohn Forte 	flash_desc_t	fdesc;
388fcf3ce44SJohn Forte 
389fcf3ce44SJohn Forte 	/* Adapter I/O statistics */
390fcf3ce44SJohn Forte 	uint32_t		ControllerErrorCount;
391fcf3ce44SJohn Forte 	uint32_t		DeviceErrorCount;
392fcf3ce44SJohn Forte 	uint32_t		TotalLipResets;
393fcf3ce44SJohn Forte 	uint32_t		TotalInterrupts;
394fcf3ce44SJohn Forte 
395fcf3ce44SJohn Forte 	uint64_t		BytesRequested;
396fcf3ce44SJohn Forte 	uint64_t		IosRequested;
397fcf3ce44SJohn Forte 
398fcf3ce44SJohn Forte 	/* SNIA stat counters */
399fcf3ce44SJohn Forte 	int64_t			IOInputRequests;
400fcf3ce44SJohn Forte 	int64_t			IOOutputRequests;
401fcf3ce44SJohn Forte 	int64_t			IOControlRequests;
402fcf3ce44SJohn Forte 	int64_t			IOOutputMByteCnt;	/* # of mb's */
403fcf3ce44SJohn Forte 	int64_t			IOInputMByteCnt;	/* # of mb's */
404fcf3ce44SJohn Forte 
405fcf3ce44SJohn Forte 	/* SNIA intermediate (less than 1mb) counters  */
406fcf3ce44SJohn Forte 	int64_t			IOOutputByteCnt;
407fcf3ce44SJohn Forte 	int64_t			IOInputByteCnt;
408fcf3ce44SJohn Forte 
409fcf3ce44SJohn Forte 	/* Async event context */
410fcf3ce44SJohn Forte 	void			*aen_tracking_queue;
411fcf3ce44SJohn Forte 	uint8_t			aen_q_head;
412fcf3ce44SJohn Forte 	uint8_t			aen_q_tail;
413fcf3ce44SJohn Forte 
414fcf3ce44SJohn Forte 	uint32_t		flags;
415fcf3ce44SJohn Forte } ql_xioctl_t;
416fcf3ce44SJohn Forte 
417fcf3ce44SJohn Forte /*
418fcf3ce44SJohn Forte  * ql adapter flag defintions.
419fcf3ce44SJohn Forte  */
420fcf3ce44SJohn Forte #define	QL_AEN_TRACKING_ENABLE		BIT_0
421fcf3ce44SJohn Forte #define	QL_MGMT_SERVER_LOGIN		BIT_1
422fcf3ce44SJohn Forte 
423fcf3ce44SJohn Forte /*
424fcf3ce44SJohn Forte  * Global Data in ql_xioctl.c source file.
425fcf3ce44SJohn Forte  */
426fcf3ce44SJohn Forte 
427fcf3ce44SJohn Forte /*
428fcf3ce44SJohn Forte  * Global Function Prototypes in ql_xioctl.c source file.
429fcf3ce44SJohn Forte  */
430fcf3ce44SJohn Forte int ql_alloc_xioctl_resource(ql_adapter_state_t *);
431fcf3ce44SJohn Forte void ql_free_xioctl_resource(ql_adapter_state_t *);
432fcf3ce44SJohn Forte int ql_xioctl(ql_adapter_state_t *, int, intptr_t, int, cred_t *, int *);
433fcf3ce44SJohn Forte void ql_enqueue_aen(ql_adapter_state_t *, uint16_t, void *);
4345dfd244aSDaniel Beauregard int ql_setup_fcache(ql_adapter_state_t *);
435fcf3ce44SJohn Forte void ql_blink_led(ql_adapter_state_t *);
436fcf3ce44SJohn Forte void ql_fcache_rel(ql_fcache_t *);
437fcf3ce44SJohn Forte ql_fcache_t *ql_get_fbuf(ql_fcache_t *, uint32_t);
438fcf3ce44SJohn Forte int ql_dump_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
439fcf3ce44SJohn Forte int ql_pci_dump(ql_adapter_state_t *, uint32_t *, uint32_t, int);
4405dfd244aSDaniel Beauregard int ql_load_fcode(ql_adapter_state_t *, uint8_t *, uint32_t, uint32_t);
441*4c3888b8SHans Rosenfeld int ql_set_loop_point(ql_adapter_state_t *, uint16_t);
442fcf3ce44SJohn Forte 
443fcf3ce44SJohn Forte #ifdef __cplusplus
444fcf3ce44SJohn Forte }
445fcf3ce44SJohn Forte #endif
446fcf3ce44SJohn Forte 
447fcf3ce44SJohn Forte #endif /* _QL_XIOCTL_H */
448