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