2 * linux/drivers/message/fusion/mptscsih.h
3 * High performance SCSI / Fibre Channel SCSI Host device driver.
4 * For use with PCI chip/adapter(s):
5 * LSIFC9xx/LSI409xx Fibre Channel
6 * running LSI Logic Fusion MPT (Message Passing Technology) firmware.
9 * This driver would not exist if not for Alan Cox's development
10 * of the linux i2o driver.
12 * A huge debt of gratitude is owed to David S. Miller (DaveM)
13 * for fixing much of the stupid and broken stuff in the early
14 * driver while porting to sparc64 platform. THANK YOU!
16 * (see also mptbase.c)
18 * Copyright (c) 1999-2002 LSI Logic Corporation
19 * Originally By: Steven J. Ralston
20 * (mailto:netscape.net)
21 * (mailto:Pam.Delaney@lsil.com)
23 * $Id: mptscsih.h,v 1.1.1.1 2005/04/11 02:50:25 jack Exp $
25 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
27 This program is free software; you can redistribute it and/or modify
28 it under the terms of the GNU General Public License as published by
29 the Free Software Foundation; version 2 of the License.
31 This program is distributed in the hope that it will be useful,
32 but WITHOUT ANY WARRANTY; without even the implied warranty of
33 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
34 GNU General Public License for more details.
37 THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
38 CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT
39 LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
40 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is
41 solely responsible for determining the appropriateness of using and
42 distributing the Program and assumes all risks associated with its
43 exercise of rights under this Agreement, including but not limited to
44 the risks and costs of program errors, damage to or loss of data,
45 programs or equipment, and unavailability or interruption of operations.
47 DISCLAIMER OF LIABILITY
48 NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY
49 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50 DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
51 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
52 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
53 USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED
54 HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
56 You should have received a copy of the GNU General Public License
57 along with this program; if not, write to the Free Software
58 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
61 #ifndef SCSIHOST_H_INCLUDED
62 #define SCSIHOST_H_INCLUDED
63 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
65 #include "linux/version.h"
67 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
69 * SCSI Public stuff...
73 * Try to keep these at 2^N-1
75 #define MPT_FC_CAN_QUEUE 63
76 //#define MPT_SCSI_CAN_QUEUE 31
77 #define MPT_SCSI_CAN_QUEUE MPT_FC_CAN_QUEUE
78 #define MPT_SCSI_CMD_PER_LUN 7
80 #define MPT_SCSI_MAX_SECTORS 8192
83 * Set the MAX_SGE value based on user input.
85 #ifdef CONFIG_FUSION_MAX_SGE
86 #if CONFIG_FUSION_MAX_SGE < 16
87 #define MPT_SCSI_SG_DEPTH 16
88 #elif CONFIG_FUSION_MAX_SGE > 128
89 #define MPT_SCSI_SG_DEPTH 128
91 #define MPT_SCSI_SG_DEPTH CONFIG_FUSION_MAX_SGE
94 #define MPT_SCSI_SG_DEPTH 40
97 /* To disable domain validation, uncomment the
98 * following line. No effect for FC devices.
99 * For SCSI devices, driver will negotiate to
100 * NVRAM settings (if available) or to maximum adapter
103 /* #define MPTSCSIH_DISABLE_DOMAIN_VALIDATION */
106 /* SCSI driver setup structure. Settings can be overridden
107 * by command line options.
109 #define MPTSCSIH_DOMAIN_VALIDATION 1
110 #define MPTSCSIH_MAX_WIDTH 1
111 #define MPTSCSIH_MIN_SYNC 0x08
113 struct mptscsih_driver_setup
121 #define MPTSCSIH_DRIVER_SETUP \
123 MPTSCSIH_DOMAIN_VALIDATION, \
124 MPTSCSIH_MAX_WIDTH, \
130 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
132 * Various bits and pieces broke within the lk-2.4.0-testN series:-(
133 * So here are various HACKS to work around them.
137 * Conditionalizing with "#ifdef MODULE/#endif" around:
138 * static Scsi_Host_Template driver_template = XX;
139 * #include <../../scsi/scsi_module.c>
140 * lines was REMOVED @ lk-2.4.0-test9
141 * Issue discovered 20001213 by: sshirron
143 #define MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS 1
144 #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,4,0)
145 # if LINUX_VERSION_CODE == KERNEL_VERSION(2,4,0)
147 * Super HACK! -by sralston:-(
148 * (good grief; heaven help me!)
150 # include <linux/capability.h>
151 # if !defined(CAP_LEASE) && !defined(MODULE)
152 # undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
156 # undef MPT_SCSIHOST_NEED_ENTRY_EXIT_HOOKUPS
162 * tq_scheduler disappeared @ lk-2.4.0-test12
163 * (right when <linux/sched.h> newly defined TQ_ACTIVE)
164 * tq_struct reworked in 2.5.41. Include workqueue.h.
166 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,41)
167 # include <linux/sched.h>
168 # include <linux/workqueue.h>
169 #define SCHEDULE_TASK(x) \
170 if (schedule_work(x) == 0) { \
171 /*MOD_DEC_USE_COUNT*/; \
174 #define HAVE_TQ_SCHED 1
175 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
176 # include <linux/sched.h>
178 # undef HAVE_TQ_SCHED
180 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,40)
181 # undef HAVE_TQ_SCHED
185 #define SCHEDULE_TASK(x) \
186 /*MOD_INC_USE_COUNT*/; \
188 queue_task(x, &tq_scheduler)
190 #define SCHEDULE_TASK(x) \
191 /*MOD_INC_USE_COUNT*/; \
192 if (schedule_task(x) == 0) { \
193 /*MOD_DEC_USE_COUNT*/; \
198 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
200 #define x_scsi_detect mptscsih_detect
201 #define x_scsi_release mptscsih_release
202 #define x_scsi_info mptscsih_info
203 #define x_scsi_queuecommand mptscsih_qcmd
204 #define x_scsi_abort mptscsih_abort
205 #define x_scsi_bus_reset mptscsih_bus_reset
206 #define x_scsi_dev_reset mptscsih_dev_reset
207 #define x_scsi_host_reset mptscsih_host_reset
208 #define x_scsi_bios_param mptscsih_bios_param
209 #define x_scsi_select_queue_depths mptscsih_select_queue_depths
211 #define x_scsi_taskmgmt_bh mptscsih_taskmgmt_bh
212 #define x_scsi_old_abort mptscsih_old_abort
213 #define x_scsi_old_reset mptscsih_old_reset
215 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
217 * MPT SCSI Host / Initiator decls...
219 extern int x_scsi_detect(Scsi_Host_Template *);
220 extern int x_scsi_release(struct Scsi_Host *host);
221 extern const char *x_scsi_info(struct Scsi_Host *);
222 extern int x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
223 #ifdef MPT_SCSI_USE_NEW_EH
224 extern int x_scsi_abort(Scsi_Cmnd *);
225 extern int x_scsi_bus_reset(Scsi_Cmnd *);
226 extern int x_scsi_dev_reset(Scsi_Cmnd *);
227 extern int x_scsi_host_reset(Scsi_Cmnd *);
229 extern int x_scsi_old_abort(Scsi_Cmnd *);
230 extern int x_scsi_old_reset(Scsi_Cmnd *, unsigned int);
232 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,28)
233 extern int x_scsi_bios_param(Disk *, struct block_device *, int *);
235 extern int x_scsi_bios_param(Disk *, kdev_t, int *);
237 extern void x_scsi_select_queue_depths(struct Scsi_Host *, Scsi_Device *);
238 extern void x_scsi_taskmgmt_bh(void *);
240 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0)
241 #define PROC_SCSI_DECL
243 #define PROC_SCSI_DECL proc_name: "mptscsih",
246 #ifdef MPT_SCSI_USE_NEW_EH
248 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1)
250 #define MPT_SCSIHOST { \
253 name: "MPT SCSI Host", \
254 detect: x_scsi_detect, \
255 release: x_scsi_release, \
258 queuecommand: x_scsi_queuecommand, \
259 eh_strategy_handler: NULL, \
260 eh_abort_handler: x_scsi_abort, \
261 eh_device_reset_handler: x_scsi_dev_reset, \
262 eh_bus_reset_handler: x_scsi_bus_reset, \
263 eh_host_reset_handler: x_scsi_host_reset, \
264 bios_param: x_scsi_bios_param, \
265 can_queue: MPT_SCSI_CAN_QUEUE, \
267 sg_tablesize: MPT_SCSI_SG_DEPTH, \
268 max_sectors: MPT_SCSI_MAX_SECTORS, \
269 cmd_per_lun: MPT_SCSI_CMD_PER_LUN, \
270 unchecked_isa_dma: 0, \
271 use_clustering: ENABLE_CLUSTERING, \
274 #else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
276 #define MPT_SCSIHOST { \
279 name: "MPT SCSI Host", \
280 detect: x_scsi_detect, \
281 release: x_scsi_release, \
284 queuecommand: x_scsi_queuecommand, \
285 eh_strategy_handler: NULL, \
286 eh_abort_handler: x_scsi_abort, \
287 eh_device_reset_handler: x_scsi_dev_reset, \
288 eh_bus_reset_handler: x_scsi_bus_reset, \
289 eh_host_reset_handler: NULL, \
290 bios_param: x_scsi_bios_param, \
291 can_queue: MPT_SCSI_CAN_QUEUE, \
293 sg_tablesize: MPT_SCSI_SG_DEPTH, \
294 cmd_per_lun: MPT_SCSI_CMD_PER_LUN, \
295 unchecked_isa_dma: 0, \
296 use_clustering: ENABLE_CLUSTERING, \
300 #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,1) */
302 #else /* MPT_SCSI_USE_NEW_EH */
304 #define MPT_SCSIHOST { \
307 name: "MPT SCSI Host", \
308 detect: x_scsi_detect, \
309 release: x_scsi_release, \
312 queuecommand: x_scsi_queuecommand, \
313 abort: x_scsi_old_abort, \
314 reset: x_scsi_old_reset, \
315 bios_param: x_scsi_bios_param, \
316 can_queue: MPT_SCSI_CAN_QUEUE, \
318 sg_tablesize: MPT_SCSI_SG_DEPTH, \
319 cmd_per_lun: MPT_SCSI_CMD_PER_LUN, \
320 unchecked_isa_dma: 0, \
321 use_clustering: ENABLE_CLUSTERING \
323 #endif /* MPT_SCSI_USE_NEW_EH */
326 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
328 /* include/scsi/scsi.h may not be quite complete... */
330 #define RESERVE_10 0x56
333 #define RELEASE_10 0x57
335 #ifndef PERSISTENT_RESERVE_IN
336 #define PERSISTENT_RESERVE_IN 0x5e
338 #ifndef PERSISTENT_RESERVE_OUT
339 #define PERSISTENT_RESERVE_OUT 0x5f
342 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/