ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / message / fusion / mptscsih.h
1 /*
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.
7  *
8  *  Credits:
9  *      This driver would not exist if not for Alan Cox's development
10  *      of the linux i2o driver.
11  *
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!
15  *
16  *      (see also mptbase.c)
17  *
18  *  Copyright (c) 1999-2004 LSI Logic Corporation
19  *  Originally By: Steven J. Ralston
20  *  (mailto:netscape.net)
21  *  (mailto:mpt_linux_developer@lsil.com)
22  *
23  *  $Id: mptscsih.h,v 1.21 2002/12/03 21:26:35 pdelaney Exp $
24  */
25 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
26 /*
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.
30
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.
35
36     NO WARRANTY
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.
46
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
55
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
59 */
60
61 #ifndef SCSIHOST_H_INCLUDED
62 #define SCSIHOST_H_INCLUDED
63
64 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
65 /*
66  *      SCSI Public stuff...
67  */
68
69 #define MPT_SCSI_CMD_PER_DEV_HIGH       31
70 #define MPT_SCSI_CMD_PER_DEV_LOW        7
71
72 #define MPT_SCSI_CMD_PER_LUN            7
73
74 #define MPT_SCSI_MAX_SECTORS    8192
75
76 /* To disable domain validation, uncomment the
77  * following line. No effect for FC devices.
78  * For SCSI devices, driver will negotiate to
79  * NVRAM settings (if available) or to maximum adapter
80  * capabilities.
81  */
82
83 #define MPTSCSIH_ENABLE_DOMAIN_VALIDATION
84
85
86 /* SCSI driver setup structure. Settings can be overridden
87  * by command line options.
88  */
89 #define MPTSCSIH_DOMAIN_VALIDATION      1
90 #define MPTSCSIH_MAX_WIDTH              1
91 #define MPTSCSIH_MIN_SYNC               0x08
92 #define MPTSCSIH_SAF_TE                 0
93
94 struct mptscsih_driver_setup
95 {
96         u8      dv;
97         u8      max_width;
98         u8      min_sync_fac;
99         u8      saf_te;
100 };
101
102
103 #define MPTSCSIH_DRIVER_SETUP                   \
104 {                                               \
105         MPTSCSIH_DOMAIN_VALIDATION,             \
106         MPTSCSIH_MAX_WIDTH,                     \
107         MPTSCSIH_MIN_SYNC,                      \
108         MPTSCSIH_SAF_TE,                        \
109 }
110
111
112
113 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
114 /*
115  *      Various bits and pieces broke within the lk-2.4.0-testN series:-(
116  *      So here are various HACKS to work around them.
117  */
118
119 /*
120  *      tq_scheduler disappeared @ lk-2.4.0-test12
121  *      (right when <linux/sched.h> newly defined TQ_ACTIVE)
122  *      tq_struct reworked in 2.5.41. Include workqueue.h.
123  */
124 #       include <linux/sched.h>
125 #       include <linux/workqueue.h>
126 #define SCHEDULE_TASK(x)                \
127         if (schedule_work(x) == 0) {    \
128                 /*MOD_DEC_USE_COUNT*/;  \
129         }
130
131 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
132
133 #define x_scsi_info             mptscsih_info
134 #define x_scsi_queuecommand     mptscsih_qcmd
135 #define x_scsi_abort            mptscsih_abort
136 #define x_scsi_bus_reset        mptscsih_bus_reset
137 #define x_scsi_dev_reset        mptscsih_dev_reset
138 #define x_scsi_host_reset       mptscsih_host_reset
139 #define x_scsi_bios_param       mptscsih_bios_param
140
141 #define x_scsi_slave_alloc      mptscsih_slave_alloc
142 #define x_scsi_slave_configure  mptscsih_slave_configure
143 #define x_scsi_slave_destroy    mptscsih_slave_destroy
144 #define x_scsi_proc_info        mptscsih_proc_info
145
146 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
147 /*
148  *      MPT SCSI Host / Initiator decls...
149  */
150 extern  const char      *x_scsi_info(struct Scsi_Host *);
151 extern  int              x_scsi_queuecommand(Scsi_Cmnd *, void (*done)(Scsi_Cmnd *));
152 extern  int              x_scsi_abort(Scsi_Cmnd *);
153 extern  int              x_scsi_bus_reset(Scsi_Cmnd *);
154 extern  int              x_scsi_dev_reset(Scsi_Cmnd *);
155 extern  int              x_scsi_host_reset(Scsi_Cmnd *);
156 extern int               x_scsi_bios_param(struct scsi_device * sdev, struct block_device *bdev,
157                                 sector_t capacity, int geom[]);
158 extern  int              x_scsi_slave_alloc(Scsi_Device *);
159 extern  int              x_scsi_slave_configure(Scsi_Device *);
160 extern  void             x_scsi_slave_destroy(Scsi_Device *);
161 extern  int              x_scsi_proc_info(struct Scsi_Host *, char *, char **, off_t, int, int);
162
163 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
164
165 /*  include/scsi/scsi.h may not be quite complete...  */
166 #ifndef RESERVE_10
167 #define RESERVE_10              0x56
168 #endif
169 #ifndef RELEASE_10
170 #define RELEASE_10              0x57
171 #endif
172 #ifndef PERSISTENT_RESERVE_IN
173 #define PERSISTENT_RESERVE_IN   0x5e
174 #endif
175 #ifndef PERSISTENT_RESERVE_OUT
176 #define PERSISTENT_RESERVE_OUT  0x5f
177 #endif
178
179 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
180
181 #endif
182