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