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