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