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