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