1.\" $OpenBSD: ahc.4,v 1.36 2007/05/31 19:19:48 jmc Exp $ 2.\" $NetBSD: ahc.4,v 1.1.2.1 1996/08/25 17:22:14 thorpej Exp $ 3.\" 4.\" Copyright (c) 1995, 1996 5.\" Justin T. Gibbs. All rights reserved. 6.\" 7.\" Redistribution and use in source and binary forms, with or without 8.\" modification, are permitted provided that the following conditions 9.\" are met: 10.\" 1. Redistributions of source code must retain the above copyright 11.\" notice, this list of conditions and the following disclaimer. 12.\" 2. Redistributions in binary form must reproduce the above copyright 13.\" notice, this list of conditions and the following disclaimer in the 14.\" documentation and/or other materials provided with the distribution. 15.\" 3. The name of the author may not be used to endorse or promote products 16.\" derived from this software without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 19.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 20.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 21.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 22.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 23.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28.\" 29.\" 30.Dd $Mdocdate: May 31 2007 $ 31.Dt AHC 4 32.Os 33.Sh NAME 34.Nm ahc 35.Nd Adaptec VL/EISA/PCI SCSI interface 36.Sh SYNOPSIS 37.Cd "ahc0 at isa? " Pq VL 38.Cd "ahc* at eisa? " Pq EISA 39.Cd "ahc* at pci? " Pq PCI 40.Cd "scsibus* at ahc?" 41.Cd "option AHC_ALLOW_MEMIO" 42.Cd "option AHC_TMODE_ENABLE" 43.Sh DESCRIPTION 44This driver provides access to the 45.Tn SCSI 46bus(es) connected to Adaptec 47.Tn AIC7770 , 48.Tn AIC7850 , 49.Tn AIC7860 , 50.Tn AIC7870 , 51.Tn AIC7880 , 52.Tn AIC7890 , 53.Tn AIC7891 , 54.Tn AIC7892 , 55.Tn AIC7895 , 56.Tn AIC7896 , 57.Tn AIC7897 58and 59.Tn AIC7899 60host adapter chips. 61These chips are found on many motherboards as well as the following 62Adaptec SCSI controller cards: 63.Tn 274X(W) , 64.Tn 274X(T) , 65.Tn 284X , 66.Tn 2910 , 67.Tn 2915 , 68.Tn 2920 , 69.Tn 2930C , 70.Tn 2930U2 , 71.Tn 2940 , 72.Tn 2940J , 73.Tn 2940N , 74.Tn 2940U , 75.Tn 2940AU , 76.Tn 2940UW , 77.Tn 2940UW Dual , 78.Tn 2940UW Pro , 79.Tn 2940U2W , 80.Tn 2940U2B , 81.Tn 2950U2W , 82.Tn 2950U2B , 83.Tn 19160B , 84.Tn 29160B , 85.Tn 29160N , 86.Tn 3940 , 87.Tn 3940U , 88.Tn 3940AU , 89.Tn 3940UW , 90.Tn 3940AUW , 91.Tn 3940U2W , 92.Tn 3950U2 , 93.Tn 3960 , 94.Tn 39160 , 95.Tn 3985 , 96and 97.Tn 4944UW . 98.Pp 99Driver features include support for twin and wide buses, 100fast, ultra, ultra2 and ultra160 synchronous transfers depending on 101controller type, tagged queuing, and SCB paging, and target mode. 102.Pp 103Memory mapped I/O can be enabled for PCI devices with the 104.Dq Dv AHC_ALLOW_MEMIO 105configuration option. 106Memory mapped I/O is more efficient than the alternative, programmed I/O. 107Most PCI BIOSes will map devices so that either technique for communicating 108with the card is available. 109In some cases, 110usually when the PCI device is sitting behind a PCI->PCI bridge, 111the BIOS may fail to properly initialize the chip for memory mapped I/O. 112The typical symptom of this problem is a system hang if memory mapped I/O 113is attempted. 114Most modern motherboards perform the initialization correctly and work fine 115with this option enabled. 116This is the default mode of operation on every architecture except i386. 117.Pp 118Individual controllers may be configured to operate in the target role through 119the 120.Dq Dv AHC_TMODE_ENABLE 121configuration option. 122The value assigned to this option should be a bitmap of all units where target 123mode is desired. 124For example, a value of 0x25, would enable target mode on units 0, 2, and 5. 125A value of 0x8a enables it for units 1, 3, and 7. 126.Pp 127Per target configuration performed in the 128.Tn SCSI-Select 129menu, accessible at boot 130in 131.No non- Ns Tn EISA 132models, 133or through an 134.Tn EISA 135configuration utility for 136.Tn EISA 137models, 138is honored by this driver. 139This includes synchronous/asynchronous transfers, 140maximum synchronous negotiation rate, 141wide transfers, 142disconnection, 143the host adapter's SCSI ID, 144and, 145in the case of 146.Tn EISA 147Twin Channel controllers, 148the primary channel selection. 149For systems that store non-volatile settings in a system specific manner 150rather than a serial eeprom directly connected to the aic7xxx controller, 151the 152.Tn BIOS 153must be enabled for the driver to access this information. 154This restriction applies to all 155.Tn EISA 156and many motherboard configurations. 157.Pp 158Note that I/O addresses are determined automatically by the probe routines, 159but care should be taken when using a 284x 160.Pq Tn VESA No local bus controller 161in an 162.Tn EISA 163system. 164The jumpers setting the I/O area for the 284x should match the 165.Tn EISA 166slot into which the card is inserted to prevent conflicts with other 167.Tn EISA 168cards. 169.Pp 170Performance and feature sets vary throughout the aic7xxx product line. 171The following table provides a comparison of the different chips supported by 172the 173.Nm 174driver. 175Note that wide and twin channel features, although always supported by a 176particular chip, may be disabled in a particular motherboard or card design. 177.Bd -ragged -offset indent 178.Bl -column "aic7770 " "10 " "EISA/VL " "10MHz " "16bit " "SCBs " Features 179.Em "Chip MIPS Bus MaxSync MaxWidth SCBs Features" 180aic7770 10 EISA/VL 10MHz 16Bit 4 1 181aic7850 10 PCI/32 10MHz 8Bit 3 182aic7860 10 PCI/32 20MHz 8Bit 3 183aic7870 10 PCI/32 10MHz 16Bit 16 184aic7880 10 PCI/32 20MHz 16Bit 16 185aic7890 20 PCI/32 40MHz 16Bit 16 3 4 5 6 7 8 186aic7891 20 PCI/64 40MHz 16Bit 16 3 4 5 6 7 8 187aic7892 20 PCI/64 80MHz 16Bit 16 3 4 5 6 7 8 188aic7895 15 PCI/32 20MHz 16Bit 16 2 3 4 5 189aic7895C 15 PCI/32 20MHz 16Bit 16 2 3 4 5 8 190aic7896 20 PCI/32 40MHz 16Bit 16 2 3 4 5 6 7 8 191aic7897 20 PCI/64 40MHz 16Bit 16 2 3 4 5 6 7 8 192aic7899 20 PCI/64 80MHz 16Bit 16 2 3 4 5 6 7 8 193.El 194.Pp 195.Bl -enum -compact 196.It 197Multiplexed Twin Channel Device - One controller servicing two buses. 198.It 199Multi-function Twin Channel Device - Two controllers on one chip. 200.It 201Command Channel Secondary DMA Engine - Allows scatter gather list and 202SCB prefetch. 203.It 20464 Byte SCB Support - SCSI CDB is embedded in the SCB to eliminate an extra DMA. 205.It 206Block Move Instruction Support - Doubles the speed of certain sequencer 207operations. 208.It 209.Sq Bayonet 210style Scatter Gather Engine - Improves S/G prefetch performance. 211.It 212Queuing Registers - Allows queuing of new transactions without pausing the 213sequencer. 214.It 215Ultra160 support. 216.It 217Multiple Target IDs - Allows the controller to respond to selection as a target 218on multiple SCSI IDs. 219.El 220.Ed 221.Sh SCSI CONTROL BLOCKS (SCBs) 222Every transaction sent to a device on the SCSI bus is assigned a 223.Sq SCSI Control Block 224(SCB). 225The SCB contains all of the information required by the controller to process a 226transaction. 227The chip feature table lists the number of SCBs that can be stored in on-chip 228memory. 229All chips with model numbers greater than or equal to 7870 allow for the 230on-chip SCB space to be augmented with external SRAM up to a maximum of 255 231SCBs. 232Very few Adaptec controller configurations have external SRAM. 233.Pp 234If external SRAM is not available, 235SCBs are a limited resource. 236Using the SCBs in a straight forward manner would only allow the driver to 237handle as many concurrent transactions as there are physical SCBs. 238To fully utilize the SCSI bus and the devices on it, 239requires much more concurrency. 240The solution to this problem is 241.Em SCB Paging , 242a concept similar to memory paging. 243SCB paging takes advantage of the fact that devices usually disconnect from the 244SCSI bus for long periods of time without talking to the controller. 245The SCBs for disconnected transactions are only of use to the controller when 246the transfer is resumed. 247When the host queues another transaction for the controller to execute, 248the controller firmware will use a free SCB if one is available. 249Otherwise, the state of the most recently disconnected (and therefore most 250likely to stay disconnected) SCB is saved, via DMA, to host memory, 251and the local SCB reused to start the new transaction. 252This allows the controller to queue up to 255 transactions regardless of the 253amount of SCB space. 254Since the local SCB space serves as a cache for disconnected transactions, 255the more SCB space available, the less host bus traffic consumed saving and 256restoring SCB data. 257.Sh SEE ALSO 258.Xr ahd 4 , 259.Xr cd 4 , 260.Xr ch 4 , 261.Xr eisa 4 , 262.Xr intro 4 , 263.Xr isa 4 , 264.Xr pci 4 , 265.Xr scsi 4 , 266.Xr sd 4 , 267.Xr ss 4 , 268.Xr st 4 , 269.Xr uk 4 270.Sh AUTHORS 271The core 272.Nm 273driver, the 274.Tn AIC7xxx 275sequencer-code assembler, and the firmware running on the aic7xxx chips 276were written by 277.An Justin T. Gibbs . 278.Pp 279The 280.Ox 281platform dependent code was written by Steve P. Murphree, Jr and Kenneth 282R. Westerback. 283.Sh BUGS 284Some Quantum drives (at least the Empire 2100 and 1080s) will not run on an 285.Tn AIC7870 286Rev B in synchronous mode at 10MHz. 287Controllers with this problem have a 42 MHz clock crystal on them and run 288slightly above 10MHz. 289This confuses the drive and hangs the bus. 290Setting a maximum synchronous negotiation rate of 8MHz in the 291.Tn SCSI-Select 292utility will allow normal operation. 293.Pp 294Although the Ultra2 and Ultra160 products have sufficient instruction RAM space 295to support both the initiator and target roles concurrently, 296this configuration is disabled in favor of allowing the target role to respond 297on multiple target ids. 298A method for configuring dual role mode should be provided. 299.Pp 300Tagged Queuing is not supported in target mode. 301.Pp 302Reselection in target mode fails to function correctly on all high voltage 303differential boards as shipped by Adaptec. 304Information on how to modify HVD board to work correctly in target mode is 305available from Adaptec. 306