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