ftp://ftp.kernel.org/pub/linux/kernel/v2.6/linux-2.6.6.tar.bz2
[linux-2.6.git] / drivers / scsi / sym53c8xx_2 / sym53c8xx.h
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 SYM53C8XX_H
54 #define SYM53C8XX_H
55
56 #include <linux/config.h>
57
58 #ifdef CONFIG_SCSI_SYM53C8XX_IOMAPPED
59 #define SYM_CONF_IOMAPPED
60 #endif
61
62 /*
63  *  DMA addressing mode.
64  *
65  *  0 : 32 bit addressing for all chips.
66  *  1 : 40 bit addressing when supported by chip.
67  *  2 : 64 bit addressing when supported by chip,
68  *      limited to 16 segments of 4 GB -> 64 GB max.
69  */
70 #define SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE
71
72 /*
73  *  NVRAM support.
74  */
75 #if 1
76 #define SYM_CONF_NVRAM_SUPPORT          (1)
77 #endif
78
79 /*
80  *  These options are not tunable from 'make config'
81  */
82 #if 1
83 #define SYM_LINUX_PROC_INFO_SUPPORT
84 #define SYM_LINUX_BOOT_COMMAND_LINE_SUPPORT
85 #define SYM_LINUX_USER_COMMAND_SUPPORT
86 #define SYM_LINUX_USER_INFO_SUPPORT
87 #define SYM_LINUX_DEBUG_CONTROL_SUPPORT
88 #endif
89
90 /*
91  *  Also handle old NCR chips if not (0).
92  */
93 #define SYM_CONF_GENERIC_SUPPORT        (1)
94
95 /*
96  *  Allow tags from 2 to 256, default 8
97  */
98 #ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS
99 #define CONFIG_SCSI_SYM53C8XX_MAX_TAGS  (8)
100 #endif
101
102 #if     CONFIG_SCSI_SYM53C8XX_MAX_TAGS < 2
103 #define SYM_CONF_MAX_TAG        (2)
104 #elif   CONFIG_SCSI_SYM53C8XX_MAX_TAGS > 256
105 #define SYM_CONF_MAX_TAG        (256)
106 #else
107 #define SYM_CONF_MAX_TAG        CONFIG_SCSI_SYM53C8XX_MAX_TAGS
108 #endif
109
110 #ifndef CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS
111 #define CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS      SYM_CONF_MAX_TAG
112 #endif
113
114 /*
115  *  Anyway, we configure the driver for at least 64 tags per LUN. :)
116  */
117 #if     SYM_CONF_MAX_TAG <= 64
118 #define SYM_CONF_MAX_TAG_ORDER  (6)
119 #elif   SYM_CONF_MAX_TAG <= 128
120 #define SYM_CONF_MAX_TAG_ORDER  (7)
121 #else
122 #define SYM_CONF_MAX_TAG_ORDER  (8)
123 #endif
124
125 /*
126  *  Max number of SG entries.
127  */
128 #define SYM_CONF_MAX_SG         (96)
129
130 /*
131  *  Driver setup structure.
132  *
133  *  This structure is initialized from linux config options.
134  *  It can be overridden at boot-up by the boot command line.
135  */
136 struct sym_driver_setup {
137         u_short max_tag;
138         u_char  burst_order;
139         u_char  scsi_led;
140         u_char  scsi_diff;
141         u_char  irq_mode;
142         u_char  scsi_bus_check;
143         u_char  host_id;
144
145         u_char  reverse_probe;
146         u_char  verbose;
147         u_short debug;
148         u_char  settle_delay;
149         u_char  use_nvram;
150         u_long  excludes[8];
151         char    tag_ctrl[100];
152 };
153
154 #define SYM_SETUP_MAX_TAG               sym_driver_setup.max_tag
155 #define SYM_SETUP_BURST_ORDER           sym_driver_setup.burst_order
156 #define SYM_SETUP_SCSI_LED              sym_driver_setup.scsi_led
157 #define SYM_SETUP_SCSI_DIFF             sym_driver_setup.scsi_diff
158 #define SYM_SETUP_IRQ_MODE              sym_driver_setup.irq_mode
159 #define SYM_SETUP_SCSI_BUS_CHECK        sym_driver_setup.scsi_bus_check
160 #define SYM_SETUP_HOST_ID               sym_driver_setup.host_id
161
162 /* Always enable parity. */
163 #define SYM_SETUP_PCI_PARITY            1
164 #define SYM_SETUP_SCSI_PARITY           1
165
166 /*
167  *  Initial setup.
168  *
169  *  Can be overriden at startup by a command line.
170  */
171 #define SYM_LINUX_DRIVER_SETUP  {                               \
172         .max_tag        = CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS,   \
173         .burst_order    = 7,                                    \
174         .scsi_led       = 1,                                    \
175         .scsi_diff      = 1,                                    \
176         .irq_mode       = 0,                                    \
177         .scsi_bus_check = 1,                                    \
178         .host_id        = 7,                                    \
179         .reverse_probe  = 0,                                    \
180         .verbose        = 0,                                    \
181         .debug          = 0,                                    \
182         .settle_delay   = 3,                                    \
183         .use_nvram      = 1,                                    \
184 }
185
186 /*
187  *  Boot fail safe setup.
188  *
189  *  Override initial setup from boot command line:
190  *    sym53c8xx=safe:y
191  */
192 #define SYM_LINUX_DRIVER_SAFE_SETUP {                           \
193         .max_tag        = 0,                                    \
194         .burst_order    = 0,                                    \
195         .scsi_led       = 0,                                    \
196         .scsi_diff      = 1,                                    \
197         .irq_mode       = 0,                                    \
198         .scsi_bus_check = 2,                                    \
199         .host_id        = 7,                                    \
200         .reverse_probe  = 0,                                    \
201         .verbose        = 2,                                    \
202         .debug          = 0,                                    \
203         .settle_delay   = 10,                                   \
204         .use_nvram      = 1,                                    \
205 }
206
207 /*
208  *  This structure is initialized from linux config options.
209  *  It can be overridden at boot-up by the boot command line.
210  */
211 #ifdef SYM_GLUE_C
212 struct sym_driver_setup
213         sym_driver_setup = SYM_LINUX_DRIVER_SETUP;
214 #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
215 u_int   sym_debug_flags = 0;
216 #endif
217 #else
218 extern struct sym_driver_setup sym_driver_setup;
219 #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
220 extern u_int sym_debug_flags;
221 #endif
222 #endif /* SYM_GLUE_C */
223
224 #ifdef SYM_LINUX_DEBUG_CONTROL_SUPPORT
225 #define DEBUG_FLAGS     sym_debug_flags
226 #endif
227 #define boot_verbose    sym_driver_setup.verbose
228
229 #endif /* SYM53C8XX_H */