isp_ioctl.h revision 1.10 1 /* $NetBSD: isp_ioctl.h,v 1.10 2007/05/24 21:30:42 mjacob Exp $ */
2 /*
3 * Copyright (c) 2001-2007 by Matthew Jacob
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
20 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28 /*
29 * ioctl definitions for Qlogic FC/SCSI HBA driver
30 */
31 #define ISP_IOC (021) /* 'Ctrl-Q' */
32
33 /*
34 * This ioctl sets/retrieves the debugging level for this hba instance.
35 * Note that this is not a simple integer level- see ispvar.h for definitions.
36 *
37 * The arguments is a pointer to an integer with the new debugging level.
38 * The old value is written into this argument.
39 */
40
41 #define ISP_SDBLEV _IOWR(ISP_IOC, 1, int)
42
43 /*
44 * This ioctl resets the HBA. Use with caution.
45 */
46 #define ISP_RESETHBA _IO(ISP_IOC, 2)
47
48 /*
49 * This ioctl performs a fibre channel rescan.
50 */
51 #define ISP_RESCAN _IO(ISP_IOC, 3)
52
53 /*
54 * This ioctl performs a reset and then will set the adapter to the
55 * role that was passed in (the old role will be returned). It almost
56 * goes w/o saying: use with caution.
57 */
58 #define ISP_SETROLE _IOWR(ISP_IOC, 4, int)
59
60 #define ISP_ROLE_NONE 0x0
61 #define ISP_ROLE_TARGET 0x1
62 #define ISP_ROLE_INITIATOR 0x2
63 #define ISP_ROLE_BOTH (ISP_ROLE_TARGET|ISP_ROLE_INITIATOR)
64
65 /*
66 * Get the current adapter role
67 */
68 #define ISP_GETROLE _IOR(ISP_IOC, 5, int)
69
70 /*
71 * Get/Clear Stats
72 */
73 #define ISP_STATS_VERSION 0
74 typedef struct {
75 uint8_t isp_stat_version;
76 uint8_t isp_type; /* (ro) reflects chip type */
77 uint8_t isp_revision; /* (ro) reflects chip version */
78 uint8_t unused1;
79 uint32_t unused2;
80 /*
81 * Statistics Counters
82 */
83 #define ISP_NSTATS 16
84 #define ISP_INTCNT 0
85 #define ISP_INTBOGUS 1
86 #define ISP_INTMBOXC 2
87 #define ISP_INGOASYNC 3
88 #define ISP_RSLTCCMPLT 4
89 #define ISP_FPHCCMCPLT 5
90 #define ISP_RSCCHIWAT 6
91 #define ISP_FPCCHIWAT 7
92 uint64_t isp_stats[ISP_NSTATS];
93 } isp_stats_t;
94
95 #define ISP_GET_STATS _IOR(ISP_IOC, 6, isp_stats_t)
96 #define ISP_CLR_STATS _IO(ISP_IOC, 7)
97
98 /*
99 * Initiate a LIP
100 */
101 #define ISP_FC_LIP _IO(ISP_IOC, 8)
102
103 /*
104 * Return the Port Database structure for the named device, or ENODEV if none.
105 * Caller fills in virtual loopid (0..255), aka 'target'. The driver returns
106 * ENODEV (if nothing valid there) or the actual loopid (for local loop devices
107 * only), 24 bit Port ID and Node and Port WWNs.
108 */
109 struct isp_fc_device {
110 uint32_t loopid; /* 0..255 */
111 uint32_t : 6,
112 role : 2,
113 portid : 24; /* 24 bit Port ID */
114 uint64_t node_wwn;
115 uint64_t port_wwn;
116 };
117 #define ISP_FC_GETDINFO _IOWR(ISP_IOC, 9, struct isp_fc_device)
118
119 /*
120 * Get F/W crash dump
121 */
122 #define ISP_GET_FW_CRASH_DUMP _IO(ISP_IOC, 10)
123 #define ISP_FORCE_CRASH_DUMP _IO(ISP_IOC, 11)
124
125 /*
126 * Get information about this Host Adapter, including current connection
127 * topology and capabilities.
128 */
129 struct isp_hba_device {
130 uint32_t
131 : 8,
132 : 4,
133 fc_speed : 4, /* Gbps */
134 : 2,
135 fc_class2 : 1,
136 fc_ip_supported : 1,
137 fc_scsi_supported : 1,
138 fc_topology : 3,
139 fc_loopid : 8;
140 uint8_t fc_fw_major;
141 uint8_t fc_fw_minor;
142 uint8_t fc_fw_micro;
143 uint8_t reserved;
144 uint64_t nvram_node_wwn;
145 uint64_t nvram_port_wwn;
146 uint64_t active_node_wwn;
147 uint64_t active_port_wwn;
148 };
149
150 #define ISP_TOPO_UNKNOWN 0 /* connection topology unknown */
151 #define ISP_TOPO_FCAL 1 /* private or PL_DA */
152 #define ISP_TOPO_LPORT 2 /* public loop */
153 #define ISP_TOPO_NPORT 3 /* N-port */
154 #define ISP_TOPO_FPORT 4 /* F-port */
155
156 #define ISP_FC_GETHINFO _IOR(ISP_IOC, 12, struct isp_hba_device)
157 /*
158 * Set some internal parameters. This doesn't take effect until
159 * the chip is reset.
160 *
161 * Each parameter is generalized to be a name string with an integer value.
162 *
163 * Known parameters are:
164 *
165 * Name Value Range
166 *
167 * "framelength" 512,1024,2048
168 * "exec_throttle" 16..255
169 * "fullduplex" 0,1
170 * "loopid" 0..125
171 */
172
173 struct isp_fc_param {
174 char param_name[16]; /* null terminated */
175 uint32_t parameter;
176 };
177
178 #define ISP_GET_FC_PARAM _IOWR(ISP_IOC, 98, struct isp_fc_param)
179 #define ISP_SET_FC_PARAM _IOWR(ISP_IOC, 99, struct isp_fc_param)
180
181 /*
182 * Various Reset Goodies
183 */
184 struct isp_fc_tsk_mgmt {
185 uint32_t loopid; /* 0..255 */
186 uint32_t lun;
187 enum {
188 IPT_CLEAR_ACA,
189 IPT_TARGET_RESET,
190 IPT_LUN_RESET,
191 IPT_CLEAR_TASK_SET,
192 IPT_ABORT_TASK_SET
193 } action;
194 };
195 #define ISP_TSK_MGMT _IOWR(ISP_IOC, 97, struct isp_fc_tsk_mgmt)
196