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