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  */
21*c4ddbbe1SDaniel Beauregard 
22*c4ddbbe1SDaniel Beauregard /*
23*c4ddbbe1SDaniel Beauregard  * Copyright 2009 QLogic Corporation.  All rights reserved.
24*c4ddbbe1SDaniel Beauregard  * Use is subject to license terms.
25*c4ddbbe1SDaniel Beauregard  */
26*c4ddbbe1SDaniel Beauregard 
27fcf3ce44SJohn Forte /*
28fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
29fcf3ce44SJohn Forte  * Use is subject to license terms.
30fcf3ce44SJohn Forte  */
31*c4ddbbe1SDaniel Beauregard 
32fcf3ce44SJohn Forte #ifndef	_QLT_IOCTL_H
33fcf3ce44SJohn Forte #define	_QLT_IOCTL_H
34fcf3ce44SJohn Forte 
35fcf3ce44SJohn Forte #ifdef	__cplusplus
36fcf3ce44SJohn Forte extern "C" {
37fcf3ce44SJohn Forte #endif
38fcf3ce44SJohn Forte 
39fcf3ce44SJohn Forte /*
40fcf3ce44SJohn Forte  * stmf error codes from qlt_ioctl
41fcf3ce44SJohn Forte  */
42fcf3ce44SJohn Forte typedef enum qlt_ioctl_err {
43fcf3ce44SJohn Forte 	QLTIO_NO_DUMP = 1,
44fcf3ce44SJohn Forte 	QLTIO_DUMP_INPROGRESS,
45fcf3ce44SJohn Forte 	QLTIO_NOT_ONLINE,
46fcf3ce44SJohn Forte 	QLTIO_INVALID_FW_SIZE,
47fcf3ce44SJohn Forte 	QLTIO_INVALID_FW_TYPE,
48fcf3ce44SJohn Forte 	QLTIO_ALREADY_FETCHED,
49fcf3ce44SJohn Forte 	QLTIO_MBOX_NOT_INITIALIZED,
50fcf3ce44SJohn Forte 	QLTIO_CANT_GET_MBOXES,
51fcf3ce44SJohn Forte 	QLTIO_MBOX_TIMED_OUT,
52fcf3ce44SJohn Forte 	QLTIO_MBOX_ABORTED,
53fcf3ce44SJohn Forte 
54fcf3ce44SJohn Forte 	QLTIO_MAX_ERR
55fcf3ce44SJohn Forte } qlt_ioctl_err_t;
56fcf3ce44SJohn Forte 
57fcf3ce44SJohn Forte #define	QLTIO_ERR_STRINGS	{ \
58fcf3ce44SJohn Forte 	"No additional information", \
59fcf3ce44SJohn Forte 	"No firmware dump available", \
60fcf3ce44SJohn Forte 	"Firmware dump in progress", \
61fcf3ce44SJohn Forte 	"Port is not online", \
62fcf3ce44SJohn Forte 	"Firmware size is invalid", \
63fcf3ce44SJohn Forte 	"Firmware type does not match this chip", \
64fcf3ce44SJohn Forte 	"Firmware dump already fetched by user", \
65fcf3ce44SJohn Forte 	"Mailboxes are not yet initialized", \
66fcf3ce44SJohn Forte 	"Mailboxes are not busy", \
67fcf3ce44SJohn Forte 	"Mailbox command timed out", \
68fcf3ce44SJohn Forte 	"Mailbox command got aborted", \
69fcf3ce44SJohn Forte 	"" \
70fcf3ce44SJohn Forte 	}
71fcf3ce44SJohn Forte 
72fcf3ce44SJohn Forte typedef struct qlt_fw_info {
73fcf3ce44SJohn Forte 	uint32_t	fwi_stay_offline:1,
74fcf3ce44SJohn Forte 			fwi_port_active:1,
75fcf3ce44SJohn Forte 			fwi_fw_uploaded:1,
76fcf3ce44SJohn Forte 			fwi_rsvd:29;
77fcf3ce44SJohn Forte 	uint16_t	fwi_active_major;
78fcf3ce44SJohn Forte 	uint16_t	fwi_active_minor;
79fcf3ce44SJohn Forte 	uint16_t	fwi_active_subminor;
80fcf3ce44SJohn Forte 	uint16_t	fwi_active_attr;
81fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_major;
82fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_minor;
83fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_subminor;
84fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_attr;
85fcf3ce44SJohn Forte 	uint16_t	fwi_default_major;
86fcf3ce44SJohn Forte 	uint16_t	fwi_default_minor;
87fcf3ce44SJohn Forte 	uint16_t	fwi_default_subminor;
88fcf3ce44SJohn Forte 	uint16_t	fwi_default_attr;
89fcf3ce44SJohn Forte } qlt_fw_info_t;
90fcf3ce44SJohn Forte 
91fcf3ce44SJohn Forte typedef struct qlt_ioctl_mbox {
92fcf3ce44SJohn Forte 	uint16_t	to_fw[32];
93fcf3ce44SJohn Forte 	uint32_t	to_fw_mask;
94fcf3ce44SJohn Forte 	uint16_t	from_fw[32];
95fcf3ce44SJohn Forte 	uint32_t	from_fw_mask;
96fcf3ce44SJohn Forte } qlt_ioctl_mbox_t;
97fcf3ce44SJohn Forte 
98fcf3ce44SJohn Forte #define	QLT_FWDUMP_BUFSIZE		(4 * 1024 * 1024)
99fcf3ce44SJohn Forte /*
100fcf3ce44SJohn Forte  * QLT IOCTLs
101fcf3ce44SJohn Forte  */
102fcf3ce44SJohn Forte #define	QLT_IOCTL_FETCH_FWDUMP		0x9001
103fcf3ce44SJohn Forte #define	QLT_IOCTL_TRIGGER_FWDUMP	0x9002
104fcf3ce44SJohn Forte #define	QLT_IOCTL_UPLOAD_FW		0x9003
105fcf3ce44SJohn Forte #define	QLT_IOCTL_CLEAR_FW		0x9004
106fcf3ce44SJohn Forte #define	QLT_IOCTL_GET_FW_INFO		0x9005
107fcf3ce44SJohn Forte #define	QLT_IOCTL_STAY_OFFLINE		0x9006
108fcf3ce44SJohn Forte #define	QLT_IOCTL_MBOX			0x9007
109*c4ddbbe1SDaniel Beauregard #define	QLT_IOCTL_ELOG			0x9008
110fcf3ce44SJohn Forte 
111fcf3ce44SJohn Forte #ifdef	__cplusplus
112fcf3ce44SJohn Forte }
113fcf3ce44SJohn Forte #endif
114fcf3ce44SJohn Forte 
115fcf3ce44SJohn Forte #endif /* _QLT_IOCTL_H */
116