1/* 2 * Device driver optimized for the Symbios/LSI 53C896/53C895A/53C1010 3 * PCI-SCSI controllers. 4 * 5 * Copyright (C) 1999 Gerard Roudier <groudier@club-internet.fr> 6 * 7 * This driver also supports the following Symbios/LSI PCI-SCSI chips: 8 * 53C810A, 53C825A, 53C860, 53C875, 53C876, 53C885, 53C895. 9 * 10 * but does not support earlier chips as the following ones: 11 * 53C810, 53C815, 53C825. 12 * 13 * This driver for FreeBSD-CAM is derived from the Linux sym53c8xx driver. 14 * Copyright (C) 1998-1999 Gerard Roudier 15 * 16 * The sym53c8xx driver is derived from the ncr53c8xx driver that had been 17 * a port of the FreeBSD ncr driver to Linux-1.2.13. 18 * 19 * The original ncr driver has been written for 386bsd and FreeBSD by 20 * Wolfgang Stanglmeier <wolf@cologne.de> 21 * Stefan Esser <se@mi.Uni-Koeln.de> 22 * Copyright (C) 1994 Wolfgang Stanglmeier 23 * 24 * The initialisation code, and part of the code that addresses 25 * FreeBSD-CAM services is based on the aic7xxx driver for FreeBSD-CAM 26 * written by Justin T. Gibbs. 27 * 28 * Other major contributions: 29 * 30 * NVRAM detection and reading. 31 * Copyright (C) 1997 Richard Waltham <dormouse@farsrobt.demon.co.uk> 32 * 33 *----------------------------------------------------------------------------- 34 * 35 * Redistribution and use in source and binary forms, with or without 36 * modification, are permitted provided that the following conditions 37 * are met: 38 * 1. Redistributions of source code must retain the above copyright 39 * notice, this list of conditions and the following disclaimer. 40 * 2. Redistributions in binary form must reproduce the above copyright 41 * notice, this list of conditions and the following disclaimer in the 42 * documentation and/or other materials provided with the distribution. 43 * 3. The name of the author may not be used to endorse or promote products 44 * derived from this software without specific prior written permission. 45 * 46 * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND 47 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 49 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR 50 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 52 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 53 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 54 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 55 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 56 * SUCH DAMAGE. 57 */ 58 59Status: 60 BETA-RELEASE 61 This driver is currently developped under the following O/S: 62 FreeBSD 4.0 SNAPSHOT July 5th 1999 63 FreeBSD 4.0 current October 1999 64 Starting with version 0.9.0, the driver contains conditionnal code 65 for using pre-4.0 BUS stuff for PCI. I have successfully tested driver 66 version 0.9.0 under: 67 FreeBSD 3.2 RELEASE 68 FreeBSD 3.3 RELEASE 69 70Latest revision: 71 sym-0.12.0-19991127 72 Files to download: 73 SYM-0.9.0-19991024.tar.gz 74 PATCH-SYM-0.10.0-19991111.gz 75 PATCH-SYM-0.11.0-19991120.gz 76 PATCH-SYM-0.12.0-19991127.gz 77 78Supported SCSI features: 79 - Initiator mode 80 - Wide 16 SCSI BUS 81 - FAST10 up to FAST80-DT synchronous data transfers 82 (depends on controller capabilities) 83 - 64 luns per target 84 - 256 tags per lun 85 - MDP (1) 86 - BUS DEVICE RESET message 87 - ABORT, ABORT TAG message 88 89Supported generic chip features: 90 - On chip RAM 91 - PCI optimized transactions. 92 93Supported features of 896/895A/1010: 94 - Full SCRIPTS in on-board RAM (8K) 95 - Phase mismatch handling from SCRIPTS. 96 97Others: 98 - SYMBIOS NVRAM layout using 24c16 EEPROM 99 - TEKRAM NVRAM layout using 24c16 EEPROM (2) 100 - TEKRAM NVRAM layout using 93c46 EEPROM (2) 101 - Transfer residuals 102 - 0(1) for both SCRIPTS and C code, allowing 103 100% scalability. 104 105Notes: 106(1) Not yet reported. May not work as expected. 107 108Files: 109 README.sym this file 110 sym_conf.h driver configuration 111 sym_defs.h driver definitions 112 sym_hipd.c driver code 113 sym_sys.patch kernel patch for FreeBSD 4 114 sym_sys_3.patch kernel patch for FreeBSD 3 115 116These patches apply a change to the ncr.c driver that forces it to 117ignore SYM53C8XX chips that support LOAD/STORE. These devices will 118be attached by the sym_hipd.c driver. 119 120Installation: 121 1) Untar SYM-0.9.0-19991024.tar.gz 122 2) Create the /usr/src/sys/dev/sym directory 123 3) Copy README.sym, sym_conf.h, sym_defs.h and sym_hipd.c to 124 /usr/src/sys/dev/sym/ 125 4) Change to /usr/src/sys/ directory 126 5) If FreeBSD-4, apply the unified patch sym_sys.patch 127 (patch -p0 <sym_sys.patch) 128 Otherwise, 129 If FreeBSD-3, apply the unified patch sym_sys_3.patch 130 (patch -p0 <sym_sys_3.patch) 131 Otherwise, leave here. ;) 132 6) Change to /usr/src/sys/dev/sym directory 133 7) Update to SYM-0.11.0-19991120 134 gzip -d <PATCH-SYM-0.10.0-19991111.gz | patch -p0 135 gzip -d <PATCH-SYM-0.11.0-19991120.gz | patch -p0 136 gzip -d <PATCH-SYM-0.12.0-19991127.gz | patch -p0 137 8) Add sym0 to your kernel configuration as indicated in patched LINT file. 138 Configure and make your kernel. 139 140As seen from the shell history file (driver material assumed from /tmp), 141installation should proceed as follow (modulo mistakes from me:)): 142 143cd /tmp 144tar zxvf SYM-0.9.0-19991024.tar.gz 145cp SYM-0.9.0-19991024/* /usr/src/sys/dev/sym 146cd /usr/src/sys 147patch -p0 <dev/sym/sym_sys.patch # use sym_sys_3.patch if FreeBSD-3.X 148cd dev/sym 149gzip -d </tmp/PATCH-SYM-0.10.0-19991111.gz | patch -p0 150gzip -d </tmp/PATCH-SYM-0.11.0-19991120.gz | patch -p0 151gzip -d </tmp/PATCH-SYM-0.12.0-19991127.gz | patch -p0 152 153Configuring Ultra-3 DT data transfer support. 154--------------------------------------------- 155If you have a board using the SYM53C1010 (only evaluation boards seem to 156be available for now), you may want to give Ultra-3 DT transfer a try. 157For the reasons that FreeBSD-CAM is not yet ready for Ultra-3 and that 158early SYM53C1010 chips need some work-around for DT transfers to work 159reliably, you must apply manually the following additionnal patch to your 160kernel tree: 161 162---------------------- Cut Here ------------------------ 163--- cam/scsi/scsi_all.c.00 1999/08/29 16:21:44 164+++ cam/scsi/scsi_all.c 1999/11/23 22:11:22 165@@ -2394,6 +2394,7 @@ 166 u_int period_factor; 167 u_int period; /* in 10ths of ns */ 168 } scsi_syncrates[] = { 169+ { 0x09, 125 }, 170 { 0x0a, 250 }, 171 { 0x0b, 303 }, 172 { 0x0c, 500 } 173--- pci/sym_conf.h.00 Fri Nov 26 22:58:59 1999 174+++ pci/sym_conf.h Fri Nov 26 22:58:38 1999 175@@ -69,6 +69,7 @@ 176 * corresponding code will get useless. 177 */ 178 /* #define SYMCONF_BROKEN_U3EN_SUPPORT */ 179+#define SYMCONF_BROKEN_U3EN_SUPPORT 180 181 /* 182 * Use Normal IO instead of MMIO. 183---------------------- Cut Here ------------------------ 184 185This change consist in allowing sync factor 9 support to be handled 186by scsi_all.c and a compilation option to be defined in sym_conf.h. 187The driver may only start a PPR negotiation if sync factor is 9. 188This change has been only tested on FreeBSD-3.3 for the moment. 189 190For the PPR negotiation to occur at system startup time, you need to 191configure Ultra3 hard disks in the NVRAM for 80 Mega-transfers per second 192Wide. 193If you prefer to use camcontrol for such a negotiation to be performed after 194system startup, then you have to rebuild either the libcam shareable library 195with the patched version of scsi_all.c, on to rebuild camcontrol using 196the new static version of the libcam library that includes the patched 197version of scsi_all.o. 198 199Warnings: 200- This driver uses LOAD/STORE instructions from SCRIPTS and therefore does 201 not support earliest NCR chips (NCR53C810, NCR53C815, NCR53C825). 202 203Versionning: 204- The version number consists in 3 numbers X.Y.Z, starting with 0.0.0. 205- Z will not be used for incremental patches, but may be used for 206 quick fixes. 207- Incremental diff files are of the following pattern: 208 PATCH-SYM-X.Y.Z-YYYYMMDD 209 They must be applied from directory: /usr/src/sys/dev/sym/ 210- Version 1.0.0 will happen when the driver will be tested enough but this 211 driver version will probably not officially support the C1010 (Ultra-3) 212 since the testing of Ultra3 has just started and FreeBSD-CAM is not yet 213 ready for the support of Ultra-3. Some 1.X.0 version will support 214 DT data transfer for the C1010. 215- Version 2.0.0 is not planned for now, but will add support for host target 216 mode if it will ever exist. 217 218Change log: 219* SYM-0.0.0-19990915 220 Initial release. 221 222* SYM-0.1.0-19990919 (diff file PATCH-SYM-0.1.0-19990919 223 Add NVRAM support for latest Tekram boards using 24c16 EEPROM. 224 225* SYM-0.2.0-19990922 (diff file PATCH-SYM-0.2.0-19990922 226 Add PPR negotiation and Ultra3 DT transfers for the LSI53C1010. 227 This corresponding code is untested since I haven't yet the 228 hardware. But the driver is not broken for current chips. 229 230* SYM-0.3.0-19990925 (diff file PATCH-SYM-0.3.0-19990925 231 Source review. 232 Testing of the QUEUE FULL handling (some fixes applied). 233 234* SYM-0.4.0-19990925 (diff file PATCH-SYM-0.4.0-19990928) 235 Fixes, notably the QUEUE FULL handling that requeued everything 236 without telling the XPT about the error. Note that this did not 237 break anything, but the queue depth was never reduced. 238 239* SYM-0.5.0-19991001 (diff file PATCH-SYM-0.5.0-19991001) 240 Problem of not discovering LUNs != 0 hopefully fixed. 241 Some other minor fixes. 242 243* SYM-0.6.0-19991003 (diff file PATCH-SYM-0.6.0-19991003) 244 Test error recovery pathes and residual calculation. 245 Improve Symbios NVRAM support by applying the SCAN_LUNS flag. The driver 246 answers DEV_NOT_THERE to INQUIRYs for LUNs that are not to be scanned. 247 Switch the driver status for SPI2 support to BETA-RELEASE. 248 249* SYM-0.7.0-19991006 (diff file PATCH-SYM-0.7.0-19991006) 250 Add support of the LSI1510D that emulates a 895 (infos sent by Compaq 251 that seems to be the only supplier of this chip) 252 Return CAM_REQ_ABORTED on HS_ABORT host status. 253 Fix a tiny bug that let the driver miss the TAG setting. 254 255* SYM-0.8.0-19991016 (diff file PATCH-SYM-0.8.0-19991016) 256 Heavy rewrite/rewamping of the error handling code in order to conform 257 to FreeBSD-CAM expectation of commands having to be requeued and device 258 queue to be frozen on any kind of error. Driver status switched back 259 to EXPERIMENTAL due to these changes. 260 Warn user about targets that are not flagged for SCAN AT BOOT in the 261 NVRAM, since the driver will not allow the corresponding devices to be 262 discovered by XPT. 263 And numerous minor changes. 264 265* SYM-0.9.0-19991024 (Tar file SYM-0.9.0-19991024.tar.gz) 266 Add support for previous PCI BUS stuff, for the driver to be useable 267 under FreeBSD 3.X RELEASES. The source is #ifdefed for using the old 268 PCI BUS code under __FreeBSD_version < 400000 and the new one otherwise. 269 Tested under RELENG_3_2_0_RELEASE, but should also be just fine for 3.3. 270 Other changes against version 0.8.0 are only minor buglet fixes. 271 272* SYM-0.10.0-19991111 (diff file PATCH-SYM-0.10.0-19991111) 273 Add support for Alpha - UNTESTED. Consists in some minor changes picked 274 mostly from the ncr driver and some others as ahc_pci.c. 275 Fix the LED support through GPIO0 for pre-896 chips. In fact some code 276 was wrongly conditionned by something that was never met. 277 Switch driver status to BETA-RELEASE given that this driver has been rock 278 solid even if a small number of users seems to actually use it. 279 280* SYM-0.11.0-19991120 (diff file PATCH-SYM-0.11.0-19991120) 281 Rearrange a bit the initialisation code that deals with IO registers. 282 Fix a bug in MODIFY_DP/IGN_RESIDUE handling (May-be this code will 283 never be used). 284 Fix a tiny problem in Wide nego. The driver didn't start the Sync nego 285 after a Wide nego if synchronous parameters weren't also changed. 286 Apply fixes that should allow to successfully link the kernel on Alpha. 287 LSI53C1010 tested with Asynchronous, FAST5, FAST10, FAST20 and FAST40 288 data transfers. 289 290* SYM-0.12.0-19991127 (diff file PATCH-SYM-0.12.0-19991127) 291 Some testing in Ultra3 FAST-80 DT mode using a SYM53C1010 connected 292 to an ATLAS 4 Ultra3 disk. Required some tiny fix in the ppr nego code. 293 Some cosmetic changes in messages displayed under DEBUG. 294 Fix the chip table (and code) that made the driver wrongly attach 295 810 and 825 devices. 296 297November 27 1999. "Gerard Roudier"<groudier@club-internet.fr> 298