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