Merge from vendor branch OPENSSH:
[dragonfly.git] / sys / dev / disk / sym / sym_conf.h
1 /*
2  *  Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 
3  *  PCI-SCSI controllers.
4  *
5  *  Copyright (C) 1999-2001  Gerard Roudier <groudier@free.fr>
6  *
7  *  This driver also supports the following Symbios/LSI PCI-SCSI chips:
8  *      53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895,
9  *      53C810,  53C815,  53C825 and the 53C1510D is 53C8XX mode.
10  *
11  *  
12  *  This driver for FreeBSD-CAM is derived from the Linux sym53c8xx driver.
13  *  Copyright (C) 1998-1999  Gerard Roudier
14  *
15  *  The sym53c8xx driver is derived from the ncr53c8xx driver that had been 
16  *  a port of the FreeBSD ncr driver to Linux-1.2.13.
17  *
18  *  The original ncr driver has been written for 386bsd and FreeBSD by
19  *          Wolfgang Stanglmeier        <wolf@cologne.de>
20  *          Stefan Esser                <se@mi.Uni-Koeln.de>
21  *  Copyright (C) 1994  Wolfgang Stanglmeier
22  *
23  *  The initialisation code, and part of the code that addresses 
24  *  FreeBSD-CAM services is based on the aic7xxx driver for FreeBSD-CAM 
25  *  written by Justin T. Gibbs.
26  *
27  *  Other major contributions:
28  *
29  *  NVRAM detection and reading.
30  *  Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk>
31  *
32  *-----------------------------------------------------------------------------
33  *
34  * Redistribution and use in source and binary forms, with or without
35  * modification, are permitted provided that the following conditions
36  * are met:
37  * 1. Redistributions of source code must retain the above copyright
38  *    notice, this list of conditions and the following disclaimer.
39  * 2. Redistributions in binary form must reproduce the above copyright
40  *    notice, this list of conditions and the following disclaimer in the
41  *    documentation and/or other materials provided with the distribution.
42  * 3. The name of the author may not be used to endorse or promote products
43  *    derived from this software without specific prior written permission.
44  *
45  * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND
46  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
47  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
48  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
49  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
50  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
51  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
52  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
53  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
54  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
55  * SUCH DAMAGE.
56  */
57
58 /* $FreeBSD: src/sys/dev/sym/sym_conf.h,v 1.4.2.2 2001/11/11 17:58:53 groudier Exp $ */
59 /* $DragonFly: src/sys/dev/disk/sym/sym_conf.h,v 1.2 2003/06/17 04:28:31 dillon Exp $ */
60
61 #ifndef SYM_CONF_H
62 #define SYM_CONF_H
63
64 /*-------------------------------------------------------------------
65  *  Static configuration.
66  *-------------------------------------------------------------------
67  */
68
69 /*
70  *  Also support early NCR 810, 815 and 825 chips.
71  */
72 #define SYM_CONF_GENERIC_SUPPORT
73
74 /*
75  *  Use Normal IO instead of MMIO.
76  */
77 /* #define SYM_CONF_IOMAPPED */
78
79 /*
80  *  Max tags for a device (logical unit)
81  *      We use a power of 2, (7) means 2<<7=128
82  *  Maximum is 8 -> 256 tags
83  */
84 #define SYM_CONF_MAX_TAG_ORDER  (6)
85
86 /*
87  *  Max number of scatter/gather entries for en IO.
88  *  Each entry costs 8 bytes in the internal CCB data structure.
89  *  For now 65 should suffice given the BSD O/Ses capabilities.
90  */
91 #define SYM_CONF_MAX_SG         (33)
92
93 /*
94  *  Max number of targets.
95  *  Maximum is 16 and you are advised not to change this value.
96  */
97 #define SYM_CONF_MAX_TARGET     (16)
98
99 /*
100  *  Max number of logical units.
101  *  SPI-2 allows up to 64 logical units, but in real life, target
102  *  that implements more that 7 logical units are pretty rare.
103  *  Anyway, the cost of accepting up to 64 logical unit is low in 
104  *  this driver, thus going with the maximum is acceptable.
105  */
106 #define SYM_CONF_MAX_LUN                (64)
107
108 /*
109  *  Max number of IO control blocks queued to the controller.
110  *  Each entry needs 8 bytes and the queues are allocated contiguously.
111  *  Since we donnot want to allocate more than a page, the theorical 
112  *  maximum is PAGE_SIZE/8. For safety, we announce a bit less to the 
113  *  access method. :)
114  *  When not supplied, as it is suggested, the driver compute some 
115  *  good value for this parameter.
116  */
117 /* #define SYM_CONF_MAX_START   (PAGE_SIZE/8 - 16) */
118
119 /*
120  *  Support for NVRAM.
121  */
122 #define SYM_CONF_NVRAM_SUPPORT
123 /* #define SYM_CONF_NVRAM_SUPPORT */
124
125 /*
126  *  Support for Immediate Arbitration.
127  *  Not advised.
128  */
129 /* #define SYM_CONF_IARB_SUPPORT */
130
131 /*-------------------------------------------------------------------
132  *  Configuration that could be dynamic if it was possible 
133  *  to pass arguments to the driver.
134  *-------------------------------------------------------------------
135  */
136
137 /*
138  *  HOST default scsi id.
139  */
140 #define SYM_SETUP_HOST_ID       7
141
142 /*
143  *  Max synchronous transfers.
144  */
145 #define SYM_SETUP_MIN_SYNC      (9)
146
147 /*
148  *  Max wide order.
149  */
150 #define SYM_SETUP_MAX_WIDE      (1)
151
152 /*
153  *  Max SCSI offset.
154  */
155 #define SYM_SETUP_MAX_OFFS      (63)
156
157 /*
158  *  Default number of tags.
159  */
160 #define SYM_SETUP_MAX_TAG       (1<<SYM_CONF_MAX_TAG_ORDER)
161
162 /*
163  *  SYMBIOS NVRAM format support.
164  */
165 #define SYM_SETUP_SYMBIOS_NVRAM (1)
166
167 /*
168  *  TEKRAM NVRAM format support.
169  */
170 #define SYM_SETUP_TEKRAM_NVRAM  (1)
171
172 /*
173  *  PCI parity checking.
174  *  It should not be an option, but some poor or broken 
175  *  PCI-HOST bridges have been reported to make problems 
176  *  when this feature is enabled.
177  *  Setting this option to 0 tells the driver not to 
178  *  enable the checking against PCI parity.
179  */
180 #ifndef SYM_SETUP_PCI_PARITY
181 #define SYM_SETUP_PCI_PARITY    (1)
182 #endif
183
184 /*
185  *  SCSI parity checking.
186  */
187 #define SYM_SETUP_SCSI_PARITY   (1)
188
189 /*
190  *  SCSI activity LED.
191  */
192 #define SYM_SETUP_SCSI_LED      (0)
193
194 /*
195  *  SCSI High Voltage Differential support.
196  *
197  *  HVD/LVD/SE capable controllers (895, 895A, 896, 1010) 
198  *  report the actual SCSI BUS mode from the STEST4 IO 
199  *  register.
200  *
201  *  But for HVD/SE only capable chips (825a, 875, 885), 
202  *  the driver uses some heuristic to probe against HVD. 
203  *  Normally, the chip senses the DIFFSENS signal and 
204  *  should switch its BUS tranceivers to high impedance 
205  *  in situation of the driver having been wrong about 
206  *  the actual BUS mode. May-be, the BUS mode probing of 
207  *  the driver is safe, but, given that it may be partially 
208  *  based on some previous IO register settings, it 
209  *  cannot be stated so. Thus, decision has been taken 
210  *  to require a user option to be set for the DIFF probing 
211  *  to be applied for the 825a, 875 and 885 chips.
212  *  
213  *  This setup option works as follows:
214  *
215  *    0  ->  HVD only supported for 895, 895A, 896, 1010.
216  *    1  ->  HVD probed  for 825A, 875, 885.
217  *    2  ->  HVD assumed for 825A, 875, 885 (not advised).
218  */
219 #ifndef SYM_SETUP_SCSI_DIFF
220 #define SYM_SETUP_SCSI_DIFF     (0)
221 #endif
222
223 /*
224  *  IRQ mode.
225  */
226 #define SYM_SETUP_IRQ_MODE      (0)
227
228 /*
229  *  Check SCSI BUS signal on reset.
230  */
231 #define SYM_SETUP_SCSI_BUS_CHECK        (1)
232
233 /*
234  *  Max burst for PCI (1<<value)
235  *  7 means: (1<<7) = 128 DWORDS.
236  */
237 #define SYM_SETUP_BURST_ORDER   (7)
238
239 /*
240  *  Only relevant if IARB support configured.
241  *  - Max number of successive settings of IARB hints.
242  *  - Set IARB on arbitration lost.
243  */
244 #define SYM_CONF_IARB_MAX 3
245 #define SYM_CONF_SET_IARB_ON_ARB_LOST 1
246
247 /*
248  *  Returning wrong residuals may make problems.
249  *  When zero, this define tells the driver to 
250  *  always return 0 as transfer residual.
251  *  Btw, all my testings of residuals have succeeded.
252  */
253 #define SYM_CONF_RESIDUAL_SUPPORT 1
254
255 /*
256  *  Supported maximum number of LUNs to announce to 
257  *  the access method.
258  *  The driver supports up to 64 LUNs per target as 
259  *  required by SPI-2/SPI-3. However some SCSI devices  
260  *  designed prior to these specifications or not being  
261  *  conformant may be highly confused when they are 
262  *  asked about a LUN > 7.
263  */
264 #ifndef SYM_SETUP_MAX_LUN
265 #define SYM_SETUP_MAX_LUN       (8)
266 #endif
267
268 /*
269  *  Low priority probe map.
270  * 
271  *  This option is used as a bitmap to tell the driver 
272  *  about chips that are to be claimed with a low priority 
273  *  (-2000) by the probe method. This allows any other driver 
274  *  that may return some higher priority value for the same 
275  *  chips to take precedence over this driver (sym).
276  *  This option may be used when both the ncr driver and this 
277  *  driver are configured.
278  *
279  *  Bits are to be coded as follows:
280  *    0x01  ->  810a, 860
281  *    0x02  ->  825a, 875, 885, 895
282  *    0x04  ->  895a, 896, 1510d
283  *    0x08  ->  1010
284  *    0x40  ->  810, 815, 825
285  *
286  *  For example, value 5 tells the driver to claim support 
287  *  for 810a, 860, 895a, 896 and 1510d with low priority, 
288  *  allowing the ncr driver to take precedence if configured.
289  */
290 #ifndef SYM_SETUP_LP_PROBE_MAP
291 #define SYM_SETUP_LP_PROBE_MAP 0
292 #endif
293
294 #endif /* SYM_CONF_H */