| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 |  * This program is free software; you can redistribute it and/or modify | 
 | 26 |  * it under the terms of the GNU General Public License as published by | 
 | 27 |  * the Free Software Foundation; either version 2 of the License, or | 
 | 28 |  * (at your option) any later version. | 
 | 29 |  * | 
 | 30 |  * This program is distributed in the hope that it will be useful, | 
 | 31 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
 | 32 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
 | 33 |  * GNU General Public License for more details. | 
 | 34 |  * | 
 | 35 |  * You should have received a copy of the GNU General Public License | 
 | 36 |  * along with this program; if not, write to the Free Software | 
 | 37 |  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | 
 | 38 |  */ | 
 | 39 |  | 
 | 40 | #ifndef SYM53C8XX_H | 
 | 41 | #define SYM53C8XX_H | 
 | 42 |  | 
 | 43 | #include <linux/config.h> | 
 | 44 |  | 
 | 45 | /* | 
 | 46 |  *  DMA addressing mode. | 
 | 47 |  * | 
 | 48 |  *  0 : 32 bit addressing for all chips. | 
 | 49 |  *  1 : 40 bit addressing when supported by chip. | 
 | 50 |  *  2 : 64 bit addressing when supported by chip, | 
 | 51 |  *      limited to 16 segments of 4 GB -> 64 GB max. | 
 | 52 |  */ | 
 | 53 | #define	SYM_CONF_DMA_ADDRESSING_MODE CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE | 
 | 54 |  | 
 | 55 | /* | 
 | 56 |  *  NVRAM support. | 
 | 57 |  */ | 
 | 58 | #if 1 | 
 | 59 | #define SYM_CONF_NVRAM_SUPPORT		(1) | 
 | 60 | #endif | 
 | 61 |  | 
 | 62 | /* | 
 | 63 |  *  These options are not tunable from 'make config' | 
 | 64 |  */ | 
 | 65 | #if 1 | 
 | 66 | #define	SYM_LINUX_PROC_INFO_SUPPORT | 
 | 67 | #define SYM_LINUX_USER_COMMAND_SUPPORT | 
 | 68 | #define SYM_LINUX_USER_INFO_SUPPORT | 
 | 69 | #define SYM_LINUX_DEBUG_CONTROL_SUPPORT | 
 | 70 | #endif | 
 | 71 |  | 
 | 72 | /* | 
 | 73 |  *  Also handle old NCR chips if not (0). | 
 | 74 |  */ | 
 | 75 | #define SYM_CONF_GENERIC_SUPPORT	(1) | 
 | 76 |  | 
 | 77 | /* | 
 | 78 |  *  Allow tags from 2 to 256, default 8 | 
 | 79 |  */ | 
 | 80 | #ifndef CONFIG_SCSI_SYM53C8XX_MAX_TAGS | 
 | 81 | #define CONFIG_SCSI_SYM53C8XX_MAX_TAGS	(8) | 
 | 82 | #endif | 
 | 83 |  | 
 | 84 | #if	CONFIG_SCSI_SYM53C8XX_MAX_TAGS < 2 | 
 | 85 | #define SYM_CONF_MAX_TAG	(2) | 
 | 86 | #elif	CONFIG_SCSI_SYM53C8XX_MAX_TAGS > 256 | 
 | 87 | #define SYM_CONF_MAX_TAG	(256) | 
 | 88 | #else | 
 | 89 | #define	SYM_CONF_MAX_TAG	CONFIG_SCSI_SYM53C8XX_MAX_TAGS | 
 | 90 | #endif | 
 | 91 |  | 
 | 92 | #ifndef	CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS | 
 | 93 | #define	CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS	SYM_CONF_MAX_TAG | 
 | 94 | #endif | 
 | 95 |  | 
 | 96 | /* | 
 | 97 |  *  Anyway, we configure the driver for at least 64 tags per LUN. :) | 
 | 98 |  */ | 
 | 99 | #if	SYM_CONF_MAX_TAG <= 64 | 
 | 100 | #define SYM_CONF_MAX_TAG_ORDER	(6) | 
 | 101 | #elif	SYM_CONF_MAX_TAG <= 128 | 
 | 102 | #define SYM_CONF_MAX_TAG_ORDER	(7) | 
 | 103 | #else | 
 | 104 | #define SYM_CONF_MAX_TAG_ORDER	(8) | 
 | 105 | #endif | 
 | 106 |  | 
 | 107 | /* | 
 | 108 |  *  Max number of SG entries. | 
 | 109 |  */ | 
 | 110 | #define SYM_CONF_MAX_SG		(96) | 
 | 111 |  | 
 | 112 | /* | 
 | 113 |  *  Driver setup structure. | 
 | 114 |  * | 
 | 115 |  *  This structure is initialized from linux config options. | 
 | 116 |  *  It can be overridden at boot-up by the boot command line. | 
 | 117 |  */ | 
 | 118 | struct sym_driver_setup { | 
 | 119 | 	u_short	max_tag; | 
 | 120 | 	u_char	burst_order; | 
 | 121 | 	u_char	scsi_led; | 
 | 122 | 	u_char	scsi_diff; | 
 | 123 | 	u_char	irq_mode; | 
 | 124 | 	u_char	scsi_bus_check; | 
 | 125 | 	u_char	host_id; | 
 | 126 |  | 
 | 127 | 	u_char	verbose; | 
 | 128 | 	u_char	settle_delay; | 
 | 129 | 	u_char	use_nvram; | 
 | 130 | 	u_long	excludes[8]; | 
 | 131 | 	char	tag_ctrl[100]; | 
 | 132 | }; | 
 | 133 |  | 
 | 134 | #define SYM_SETUP_MAX_TAG		sym_driver_setup.max_tag | 
 | 135 | #define SYM_SETUP_BURST_ORDER		sym_driver_setup.burst_order | 
 | 136 | #define SYM_SETUP_SCSI_LED		sym_driver_setup.scsi_led | 
 | 137 | #define SYM_SETUP_SCSI_DIFF		sym_driver_setup.scsi_diff | 
 | 138 | #define SYM_SETUP_IRQ_MODE		sym_driver_setup.irq_mode | 
 | 139 | #define SYM_SETUP_SCSI_BUS_CHECK	sym_driver_setup.scsi_bus_check | 
 | 140 | #define SYM_SETUP_HOST_ID		sym_driver_setup.host_id | 
 | 141 | #define boot_verbose			sym_driver_setup.verbose | 
 | 142 |  | 
 | 143 | /* | 
 | 144 |  *  Initial setup. | 
 | 145 |  * | 
 | 146 |  *  Can be overriden at startup by a command line. | 
 | 147 |  */ | 
 | 148 | #define SYM_LINUX_DRIVER_SETUP	{				\ | 
 | 149 | 	.max_tag	= CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS,	\ | 
 | 150 | 	.burst_order	= 7,					\ | 
 | 151 | 	.scsi_led	= 1,					\ | 
 | 152 | 	.scsi_diff	= 1,					\ | 
 | 153 | 	.irq_mode	= 0,					\ | 
 | 154 | 	.scsi_bus_check	= 1,					\ | 
 | 155 | 	.host_id	= 7,					\ | 
 | 156 | 	.verbose	= 0,					\ | 
 | 157 | 	.settle_delay	= 3,					\ | 
 | 158 | 	.use_nvram	= 1,					\ | 
 | 159 | } | 
 | 160 |  | 
 | 161 | extern struct sym_driver_setup sym_driver_setup; | 
 | 162 | extern unsigned int sym_debug_flags; | 
 | 163 | #define DEBUG_FLAGS	sym_debug_flags | 
 | 164 |  | 
 | 165 | /* | 
 | 166 |  *  Max number of targets. | 
 | 167 |  *  Maximum is 16 and you are advised not to change this value. | 
 | 168 |  */ | 
 | 169 | #ifndef SYM_CONF_MAX_TARGET | 
 | 170 | #define SYM_CONF_MAX_TARGET	(16) | 
 | 171 | #endif | 
 | 172 |  | 
 | 173 | /* | 
 | 174 |  *  Max number of logical units. | 
 | 175 |  *  SPI-2 allows up to 64 logical units, but in real life, target | 
 | 176 |  *  that implements more that 7 logical units are pretty rare. | 
 | 177 |  *  Anyway, the cost of accepting up to 64 logical unit is low in  | 
 | 178 |  *  this driver, thus going with the maximum is acceptable. | 
 | 179 |  */ | 
 | 180 | #ifndef SYM_CONF_MAX_LUN | 
 | 181 | #define SYM_CONF_MAX_LUN	(64) | 
 | 182 | #endif | 
 | 183 |  | 
 | 184 | /* | 
 | 185 |  *  Max number of IO control blocks queued to the controller. | 
 | 186 |  *  Each entry needs 8 bytes and the queues are allocated contiguously. | 
 | 187 |  *  Since we donnot want to allocate more than a page, the theorical  | 
 | 188 |  *  maximum is PAGE_SIZE/8. For safety, we announce a bit less to the  | 
 | 189 |  *  access method. :) | 
 | 190 |  *  When not supplied, as it is suggested, the driver compute some  | 
 | 191 |  *  good value for this parameter. | 
 | 192 |  */ | 
 | 193 | /* #define SYM_CONF_MAX_START	(PAGE_SIZE/8 - 16) */ | 
 | 194 |  | 
 | 195 | /* | 
 | 196 |  *  Support for Immediate Arbitration. | 
 | 197 |  *  Not advised. | 
 | 198 |  */ | 
 | 199 | /* #define SYM_CONF_IARB_SUPPORT */ | 
 | 200 |  | 
 | 201 | /* | 
 | 202 |  *  Only relevant if IARB support configured. | 
 | 203 |  *  - Max number of successive settings of IARB hints. | 
 | 204 |  *  - Set IARB on arbitration lost. | 
 | 205 |  */ | 
 | 206 | #define SYM_CONF_IARB_MAX 3 | 
 | 207 | #define SYM_CONF_SET_IARB_ON_ARB_LOST 1 | 
 | 208 |  | 
 | 209 | /* | 
 | 210 |  *  Returning wrong residuals may make problems. | 
 | 211 |  *  When zero, this define tells the driver to  | 
 | 212 |  *  always return 0 as transfer residual. | 
 | 213 |  *  Btw, all my testings of residuals have succeeded. | 
 | 214 |  */ | 
 | 215 | #define SYM_SETUP_RESIDUAL_SUPPORT 1 | 
 | 216 |  | 
 | 217 | #endif /* SYM53C8XX_H */ |