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