1*fcf3ce44SJohn Forte /*
2*fcf3ce44SJohn Forte  * CDDL HEADER START
3*fcf3ce44SJohn Forte  *
4*fcf3ce44SJohn Forte  * The contents of this file are subject to the terms of the
5*fcf3ce44SJohn Forte  * Common Development and Distribution License (the "License").
6*fcf3ce44SJohn Forte  * You may not use this file except in compliance with the License.
7*fcf3ce44SJohn Forte  *
8*fcf3ce44SJohn Forte  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9*fcf3ce44SJohn Forte  * or http://www.opensolaris.org/os/licensing.
10*fcf3ce44SJohn Forte  * See the License for the specific language governing permissions
11*fcf3ce44SJohn Forte  * and limitations under the License.
12*fcf3ce44SJohn Forte  *
13*fcf3ce44SJohn Forte  * When distributing Covered Code, include this CDDL HEADER in each
14*fcf3ce44SJohn Forte  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15*fcf3ce44SJohn Forte  * If applicable, add the following below this CDDL HEADER, with the
16*fcf3ce44SJohn Forte  * fields enclosed by brackets "[]" replaced with your own identifying
17*fcf3ce44SJohn Forte  * information: Portions Copyright [yyyy] [name of copyright owner]
18*fcf3ce44SJohn Forte  *
19*fcf3ce44SJohn Forte  * CDDL HEADER END
20*fcf3ce44SJohn Forte  */
21*fcf3ce44SJohn Forte /*
22*fcf3ce44SJohn Forte  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23*fcf3ce44SJohn Forte  * Use is subject to license terms.
24*fcf3ce44SJohn Forte  */
25*fcf3ce44SJohn Forte #ifndef	_QLT_IOCTL_H
26*fcf3ce44SJohn Forte #define	_QLT_IOCTL_H
27*fcf3ce44SJohn Forte 
28*fcf3ce44SJohn Forte #ifdef	__cplusplus
29*fcf3ce44SJohn Forte extern "C" {
30*fcf3ce44SJohn Forte #endif
31*fcf3ce44SJohn Forte 
32*fcf3ce44SJohn Forte /*
33*fcf3ce44SJohn Forte  * stmf error codes from qlt_ioctl
34*fcf3ce44SJohn Forte  */
35*fcf3ce44SJohn Forte typedef enum qlt_ioctl_err {
36*fcf3ce44SJohn Forte 	QLTIO_NO_DUMP = 1,
37*fcf3ce44SJohn Forte 	QLTIO_DUMP_INPROGRESS,
38*fcf3ce44SJohn Forte 	QLTIO_NOT_ONLINE,
39*fcf3ce44SJohn Forte 	QLTIO_INVALID_FW_SIZE,
40*fcf3ce44SJohn Forte 	QLTIO_INVALID_FW_TYPE,
41*fcf3ce44SJohn Forte 	QLTIO_ALREADY_FETCHED,
42*fcf3ce44SJohn Forte 	QLTIO_MBOX_NOT_INITIALIZED,
43*fcf3ce44SJohn Forte 	QLTIO_CANT_GET_MBOXES,
44*fcf3ce44SJohn Forte 	QLTIO_MBOX_TIMED_OUT,
45*fcf3ce44SJohn Forte 	QLTIO_MBOX_ABORTED,
46*fcf3ce44SJohn Forte 
47*fcf3ce44SJohn Forte 	QLTIO_MAX_ERR
48*fcf3ce44SJohn Forte } qlt_ioctl_err_t;
49*fcf3ce44SJohn Forte 
50*fcf3ce44SJohn Forte #define	QLTIO_ERR_STRINGS	{ \
51*fcf3ce44SJohn Forte 	"No additional information", \
52*fcf3ce44SJohn Forte 	"No firmware dump available", \
53*fcf3ce44SJohn Forte 	"Firmware dump in progress", \
54*fcf3ce44SJohn Forte 	"Port is not online", \
55*fcf3ce44SJohn Forte 	"Firmware size is invalid", \
56*fcf3ce44SJohn Forte 	"Firmware type does not match this chip", \
57*fcf3ce44SJohn Forte 	"Firmware dump already fetched by user", \
58*fcf3ce44SJohn Forte 	"Mailboxes are not yet initialized", \
59*fcf3ce44SJohn Forte 	"Mailboxes are not busy", \
60*fcf3ce44SJohn Forte 	"Mailbox command timed out", \
61*fcf3ce44SJohn Forte 	"Mailbox command got aborted", \
62*fcf3ce44SJohn Forte 	"" \
63*fcf3ce44SJohn Forte 	}
64*fcf3ce44SJohn Forte 
65*fcf3ce44SJohn Forte typedef struct qlt_fw_info {
66*fcf3ce44SJohn Forte 	uint32_t	fwi_stay_offline:1,
67*fcf3ce44SJohn Forte 			fwi_port_active:1,
68*fcf3ce44SJohn Forte 			fwi_fw_uploaded:1,
69*fcf3ce44SJohn Forte 			fwi_rsvd:29;
70*fcf3ce44SJohn Forte 	uint16_t	fwi_active_major;
71*fcf3ce44SJohn Forte 	uint16_t	fwi_active_minor;
72*fcf3ce44SJohn Forte 	uint16_t	fwi_active_subminor;
73*fcf3ce44SJohn Forte 	uint16_t	fwi_active_attr;
74*fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_major;
75*fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_minor;
76*fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_subminor;
77*fcf3ce44SJohn Forte 	uint16_t	fwi_loaded_attr;
78*fcf3ce44SJohn Forte 	uint16_t	fwi_default_major;
79*fcf3ce44SJohn Forte 	uint16_t	fwi_default_minor;
80*fcf3ce44SJohn Forte 	uint16_t	fwi_default_subminor;
81*fcf3ce44SJohn Forte 	uint16_t	fwi_default_attr;
82*fcf3ce44SJohn Forte } qlt_fw_info_t;
83*fcf3ce44SJohn Forte 
84*fcf3ce44SJohn Forte typedef struct qlt_ioctl_mbox {
85*fcf3ce44SJohn Forte 	uint16_t	to_fw[32];
86*fcf3ce44SJohn Forte 	uint32_t	to_fw_mask;
87*fcf3ce44SJohn Forte 	uint16_t	from_fw[32];
88*fcf3ce44SJohn Forte 	uint32_t	from_fw_mask;
89*fcf3ce44SJohn Forte } qlt_ioctl_mbox_t;
90*fcf3ce44SJohn Forte 
91*fcf3ce44SJohn Forte #define	QLT_FWDUMP_BUFSIZE		(4 * 1024 * 1024)
92*fcf3ce44SJohn Forte /*
93*fcf3ce44SJohn Forte  * QLT IOCTLs
94*fcf3ce44SJohn Forte  */
95*fcf3ce44SJohn Forte #define	QLT_IOCTL_FETCH_FWDUMP		0x9001
96*fcf3ce44SJohn Forte #define	QLT_IOCTL_TRIGGER_FWDUMP	0x9002
97*fcf3ce44SJohn Forte #define	QLT_IOCTL_UPLOAD_FW		0x9003
98*fcf3ce44SJohn Forte #define	QLT_IOCTL_CLEAR_FW		0x9004
99*fcf3ce44SJohn Forte #define	QLT_IOCTL_GET_FW_INFO		0x9005
100*fcf3ce44SJohn Forte #define	QLT_IOCTL_STAY_OFFLINE		0x9006
101*fcf3ce44SJohn Forte #define	QLT_IOCTL_MBOX			0x9007
102*fcf3ce44SJohn Forte 
103*fcf3ce44SJohn Forte #ifdef	__cplusplus
104*fcf3ce44SJohn Forte }
105*fcf3ce44SJohn Forte #endif
106*fcf3ce44SJohn Forte 
107*fcf3ce44SJohn Forte #endif /* _QLT_IOCTL_H */
108