1*8357f9b2Sdlg.\" $OpenBSD: ahc.4,v 1.39 2012/08/14 01:08:19 dlg Exp $ 27105464fSderaadt.\" $NetBSD: ahc.4,v 1.1.2.1 1996/08/25 17:22:14 thorpej Exp $ 33142a87aSderaadt.\" 43142a87aSderaadt.\" Copyright (c) 1995, 1996 53142a87aSderaadt.\" Justin T. Gibbs. All rights reserved. 63142a87aSderaadt.\" 73142a87aSderaadt.\" Redistribution and use in source and binary forms, with or without 83142a87aSderaadt.\" modification, are permitted provided that the following conditions 93142a87aSderaadt.\" are met: 103142a87aSderaadt.\" 1. Redistributions of source code must retain the above copyright 113142a87aSderaadt.\" notice, this list of conditions and the following disclaimer. 123142a87aSderaadt.\" 2. Redistributions in binary form must reproduce the above copyright 133142a87aSderaadt.\" notice, this list of conditions and the following disclaimer in the 143142a87aSderaadt.\" documentation and/or other materials provided with the distribution. 153142a87aSderaadt.\" 3. The name of the author may not be used to endorse or promote products 1682f48f33Savsm.\" derived from this software without specific prior written permission. 173142a87aSderaadt.\" 183142a87aSderaadt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 193142a87aSderaadt.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 203142a87aSderaadt.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 213142a87aSderaadt.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 223142a87aSderaadt.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 233142a87aSderaadt.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 243142a87aSderaadt.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 253142a87aSderaadt.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 263142a87aSderaadt.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 273142a87aSderaadt.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 283142a87aSderaadt.\" 293142a87aSderaadt.\" 30*8357f9b2Sdlg.Dd $Mdocdate: August 14 2012 $ 317105464fSderaadt.Dt AHC 4 327105464fSderaadt.Os 333142a87aSderaadt.Sh NAME 343142a87aSderaadt.Nm ahc 350f10088eSjmc.Nd Adaptec VL/EISA/PCI SCSI interface 363142a87aSderaadt.Sh SYNOPSIS 370215239dSmartin.Cd "ahc0 at isa? " Pq VL 380215239dSmartin.Cd "ahc* at eisa? " Pq EISA 390215239dSmartin.Cd "ahc* at pci? " Pq PCI 400215239dSmartin.Cd "option AHC_ALLOW_MEMIO" 410215239dSmartin.Cd "option AHC_TMODE_ENABLE" 423142a87aSderaadt.Sh DESCRIPTION 433142a87aSderaadtThis driver provides access to the 443142a87aSderaadt.Tn SCSI 45d83edbeaSsmurphbus(es) connected to Adaptec 463142a87aSderaadt.Tn AIC7770 , 473142a87aSderaadt.Tn AIC7850 , 483142a87aSderaadt.Tn AIC7860 , 493142a87aSderaadt.Tn AIC7870 , 50d83edbeaSsmurph.Tn AIC7880 , 51d83edbeaSsmurph.Tn AIC7890 , 52d83edbeaSsmurph.Tn AIC7891 , 53908a2779Sjmc.Tn AIC7892 , 54d83edbeaSsmurph.Tn AIC7895 , 55d83edbeaSsmurph.Tn AIC7896 , 568c3565c6Skrw.Tn AIC7897 578c3565c6Skrwand 585a36f415Sderaadt.Tn AIC7899 593142a87aSderaadthost adapter chips. 60d83edbeaSsmurphThese chips are found on many motherboards as well as the following 61d83edbeaSsmurphAdaptec SCSI controller cards: 62d83edbeaSsmurph.Tn 274X(W) , 63d83edbeaSsmurph.Tn 274X(T) , 64d83edbeaSsmurph.Tn 284X , 658c3565c6Skrw.Tn 2910 , 668c3565c6Skrw.Tn 2915 , 678c3565c6Skrw.Tn 2920 , 688c3565c6Skrw.Tn 2930C , 69d83edbeaSsmurph.Tn 2930U2 , 70d83edbeaSsmurph.Tn 2940 , 718c3565c6Skrw.Tn 2940J , 728c3565c6Skrw.Tn 2940N , 73d83edbeaSsmurph.Tn 2940U , 74d83edbeaSsmurph.Tn 2940AU , 75d83edbeaSsmurph.Tn 2940UW , 76d83edbeaSsmurph.Tn 2940UW Dual , 778c3565c6Skrw.Tn 2940UW Pro , 78d83edbeaSsmurph.Tn 2940U2W , 79d83edbeaSsmurph.Tn 2940U2B , 80d83edbeaSsmurph.Tn 2950U2W , 81d83edbeaSsmurph.Tn 2950U2B , 828c3565c6Skrw.Tn 19160B , 838c3565c6Skrw.Tn 29160B , 848c3565c6Skrw.Tn 29160N , 85d83edbeaSsmurph.Tn 3940 , 86d83edbeaSsmurph.Tn 3940U , 87d83edbeaSsmurph.Tn 3940AU , 88d83edbeaSsmurph.Tn 3940UW , 89d83edbeaSsmurph.Tn 3940AUW , 90d83edbeaSsmurph.Tn 3940U2W , 91d83edbeaSsmurph.Tn 3950U2 , 92d68408faSsmurph.Tn 3960 , 938c3565c6Skrw.Tn 39160 , 948c3565c6Skrw.Tn 3985 , 95d83edbeaSsmurphand 968c3565c6Skrw.Tn 4944UW . 97d83edbeaSsmurph.Pp 98e4876f1bSjmcDriver features include support for twin and wide buses, 99954ddbd6Smpechfast, ultra, ultra2 and ultra160 synchronous transfers depending on 1008c3565c6Skrwcontroller type, tagged queuing, and SCB paging, and target mode. 101d83edbeaSsmurph.Pp 102d83edbeaSsmurphMemory mapped I/O can be enabled for PCI devices with the 103d83edbeaSsmurph.Dq Dv AHC_ALLOW_MEMIO 1043142a87aSderaadtconfiguration option. 105d83edbeaSsmurphMemory mapped I/O is more efficient than the alternative, programmed I/O. 106d83edbeaSsmurphMost PCI BIOSes will map devices so that either technique for communicating 107d83edbeaSsmurphwith the card is available. 108d83edbeaSsmurphIn some cases, 109d83edbeaSsmurphusually when the PCI device is sitting behind a PCI->PCI bridge, 1108c3565c6Skrwthe BIOS may fail to properly initialize the chip for memory mapped I/O. 1118c3565c6SkrwThe typical symptom of this problem is a system hang if memory mapped I/O 112d83edbeaSsmurphis attempted. 113d83edbeaSsmurphMost modern motherboards perform the initialization correctly and work fine 114d83edbeaSsmurphwith this option enabled. 1150215239dSmartinThis is the default mode of operation on every architecture except i386. 1163142a87aSderaadt.Pp 1178c3565c6SkrwIndividual controllers may be configured to operate in the target role through 1188c3565c6Skrwthe 1198c3565c6Skrw.Dq Dv AHC_TMODE_ENABLE 1208c3565c6Skrwconfiguration option. 1218c3565c6SkrwThe value assigned to this option should be a bitmap of all units where target 1228c3565c6Skrwmode is desired. 1238c3565c6SkrwFor example, a value of 0x25, would enable target mode on units 0, 2, and 5. 1248c3565c6SkrwA value of 0x8a enables it for units 1, 3, and 7. 1258c3565c6Skrw.Pp 1263142a87aSderaadtPer target configuration performed in the 1273142a87aSderaadt.Tn SCSI-Select 128a8f174ddSderaadtmenu, accessible at boot 1293142a87aSderaadtin 1303142a87aSderaadt.No non- Ns Tn EISA 131d83edbeaSsmurphmodels, 132d83edbeaSsmurphor through an 1333142a87aSderaadt.Tn EISA 1343142a87aSderaadtconfiguration utility for 1353142a87aSderaadt.Tn EISA 1363142a87aSderaadtmodels, 1378c3565c6Skrwis honored by this driver. 1388c3565c6SkrwThis includes synchronous/asynchronous transfers, 1398c3565c6Skrwmaximum synchronous negotiation rate, 1408c3565c6Skrwwide transfers, 1418c3565c6Skrwdisconnection, 1428c3565c6Skrwthe host adapter's SCSI ID, 1438c3565c6Skrwand, 144d83edbeaSsmurphin the case of 145d83edbeaSsmurph.Tn EISA 1468c3565c6SkrwTwin Channel controllers, 1478c3565c6Skrwthe primary channel selection. 1488c3565c6SkrwFor systems that store non-volatile settings in a system specific manner 1498c3565c6Skrwrather than a serial eeprom directly connected to the aic7xxx controller, 1508c3565c6Skrwthe 1518c3565c6Skrw.Tn BIOS 1528c3565c6Skrwmust be enabled for the driver to access this information. 1538c3565c6SkrwThis restriction applies to all 1548c3565c6Skrw.Tn EISA 1558c3565c6Skrwand many motherboard configurations. 1568c3565c6Skrw.Pp 1578c3565c6SkrwNote that I/O addresses are determined automatically by the probe routines, 1588c3565c6Skrwbut care should be taken when using a 284x 1598c3565c6Skrw.Pq Tn VESA No local bus controller 1608c3565c6Skrwin an 1618c3565c6Skrw.Tn EISA 1628c3565c6Skrwsystem. 1638c3565c6SkrwThe jumpers setting the I/O area for the 284x should match the 1648c3565c6Skrw.Tn EISA 1658c3565c6Skrwslot into which the card is inserted to prevent conflicts with other 1668c3565c6Skrw.Tn EISA 1678c3565c6Skrwcards. 1683142a87aSderaadt.Pp 169d83edbeaSsmurphPerformance and feature sets vary throughout the aic7xxx product line. 1708c3565c6SkrwThe following table provides a comparison of the different chips supported by 1718c3565c6Skrwthe 172d83edbeaSsmurph.Nm 17325a6efdcSaarondriver. 17425a6efdcSaaronNote that wide and twin channel features, although always supported by a 17525a6efdcSaaronparticular chip, may be disabled in a particular motherboard or card design. 1769812b99bSschwarze.Bd -literal 177d83edbeaSsmurph.Em "Chip MIPS Bus MaxSync MaxWidth SCBs Features" 178d83edbeaSsmurphaic7770 10 EISA/VL 10MHz 16Bit 4 1 179d83edbeaSsmurphaic7850 10 PCI/32 10MHz 8Bit 3 180d83edbeaSsmurphaic7860 10 PCI/32 20MHz 8Bit 3 181d83edbeaSsmurphaic7870 10 PCI/32 10MHz 16Bit 16 182d83edbeaSsmurphaic7880 10 PCI/32 20MHz 16Bit 16 1838c3565c6Skrwaic7890 20 PCI/32 40MHz 16Bit 16 3 4 5 6 7 8 1848c3565c6Skrwaic7891 20 PCI/64 40MHz 16Bit 16 3 4 5 6 7 8 1858c3565c6Skrwaic7892 20 PCI/64 80MHz 16Bit 16 3 4 5 6 7 8 186d83edbeaSsmurphaic7895 15 PCI/32 20MHz 16Bit 16 2 3 4 5 1878c3565c6Skrwaic7895C 15 PCI/32 20MHz 16Bit 16 2 3 4 5 8 1888c3565c6Skrwaic7896 20 PCI/32 40MHz 16Bit 16 2 3 4 5 6 7 8 1898c3565c6Skrwaic7897 20 PCI/64 40MHz 16Bit 16 2 3 4 5 6 7 8 1908c3565c6Skrwaic7899 20 PCI/64 80MHz 16Bit 16 2 3 4 5 6 7 8 1919812b99bSschwarze.Ed 192d83edbeaSsmurph.Pp 193d83edbeaSsmurph.Bl -enum -compact 194d83edbeaSsmurph.It 195df9fa2d9SjmcMultiplexed Twin Channel Device - One controller servicing two buses. 196d83edbeaSsmurph.It 197d83edbeaSsmurphMulti-function Twin Channel Device - Two controllers on one chip. 198d83edbeaSsmurph.It 199d83edbeaSsmurphCommand Channel Secondary DMA Engine - Allows scatter gather list and 200d83edbeaSsmurphSCB prefetch. 201d83edbeaSsmurph.It 202d83edbeaSsmurph64 Byte SCB Support - SCSI CDB is embedded in the SCB to eliminate an extra DMA. 203d83edbeaSsmurph.It 204d83edbeaSsmurphBlock Move Instruction Support - Doubles the speed of certain sequencer 205d83edbeaSsmurphoperations. 206d83edbeaSsmurph.It 207d83edbeaSsmurph.Sq Bayonet 208d83edbeaSsmurphstyle Scatter Gather Engine - Improves S/G prefetch performance. 209d83edbeaSsmurph.It 210d83edbeaSsmurphQueuing Registers - Allows queuing of new transactions without pausing the 211d83edbeaSsmurphsequencer. 212d68408faSsmurph.It 213d68408faSsmurphUltra160 support. 2148c3565c6Skrw.It 2158c3565c6SkrwMultiple Target IDs - Allows the controller to respond to selection as a target 2168c3565c6Skrwon multiple SCSI IDs. 217d83edbeaSsmurph.El 218d83edbeaSsmurph.Sh SCSI CONTROL BLOCKS (SCBs) 219d83edbeaSsmurphEvery transaction sent to a device on the SCSI bus is assigned a 220d83edbeaSsmurph.Sq SCSI Control Block 22125a6efdcSaaron(SCB). 2228c3565c6SkrwThe SCB contains all of the information required by the controller to process a 2238c3565c6Skrwtransaction. 2248c3565c6SkrwThe chip feature table lists the number of SCBs that can be stored in on-chip 2258c3565c6Skrwmemory. 22625a6efdcSaaronAll chips with model numbers greater than or equal to 7870 allow for the 2278c3565c6Skrwon-chip SCB space to be augmented with external SRAM up to a maximum of 255 2288c3565c6SkrwSCBs. 2298c3565c6SkrwVery few Adaptec controller configurations have external SRAM. 23025a6efdcSaaron.Pp 2318c3565c6SkrwIf external SRAM is not available, 2328c3565c6SkrwSCBs are a limited resource. 2338c3565c6SkrwUsing the SCBs in a straight forward manner would only allow the driver to 2348c3565c6Skrwhandle as many concurrent transactions as there are physical SCBs. 2358c3565c6SkrwTo fully utilize the SCSI bus and the devices on it, 2368c3565c6Skrwrequires much more concurrency. 237d83edbeaSsmurphThe solution to this problem is 238d83edbeaSsmurph.Em SCB Paging , 23925a6efdcSaarona concept similar to memory paging. 2408c3565c6SkrwSCB paging takes advantage of the fact that devices usually disconnect from the 2418c3565c6SkrwSCSI bus for long periods of time without talking to the controller. 2428c3565c6SkrwThe SCBs for disconnected transactions are only of use to the controller when 2438c3565c6Skrwthe transfer is resumed. 24425a6efdcSaaronWhen the host queues another transaction for the controller to execute, 24525a6efdcSaaronthe controller firmware will use a free SCB if one is available. 24625a6efdcSaaronOtherwise, the state of the most recently disconnected (and therefore most 24725a6efdcSaaronlikely to stay disconnected) SCB is saved, via DMA, to host memory, 24825a6efdcSaaronand the local SCB reused to start the new transaction. 2498c3565c6SkrwThis allows the controller to queue up to 255 transactions regardless of the 2508c3565c6Skrwamount of SCB space. 25125a6efdcSaaronSince the local SCB space serves as a cache for disconnected transactions, 2528c3565c6Skrwthe more SCB space available, the less host bus traffic consumed saving and 2538c3565c6Skrwrestoring SCB data. 2543142a87aSderaadt.Sh SEE ALSO 2559052ea46Smiod.Xr ahd 4 , 2567908d52fSmiod.Xr cd 4 , 2577908d52fSmiod.Xr ch 4 , 258fdfba211Smickey.Xr eisa 4 , 2597908d52fSmiod.Xr intro 4 , 260fdfba211Smickey.Xr isa 4 , 2617908d52fSmiod.Xr pci 4 , 2627908d52fSmiod.Xr scsi 4 , 2637908d52fSmiod.Xr sd 4 , 2647908d52fSmiod.Xr st 4 , 2657908d52fSmiod.Xr uk 4 266d97e605aStodd.Sh AUTHORS 267d68408faSsmurphThe core 2683142a87aSderaadt.Nm 269d83edbeaSsmurphdriver, the 2703142a87aSderaadt.Tn AIC7xxx 27125a6efdcSaaronsequencer-code assembler, and the firmware running on the aic7xxx chips 27225a6efdcSaaronwere written by 273d83edbeaSsmurph.An Justin T. Gibbs . 274d68408faSsmurph.Pp 275954ddbd6SmpechThe 276954ddbd6Smpech.Ox 2778c3565c6Skrwplatform dependent code was written by Steve P. Murphree, Jr and Kenneth 2788c3565c6SkrwR. Westerback. 27925a6efdcSaaron.Sh BUGS 28025a6efdcSaaronSome Quantum drives (at least the Empire 2100 and 1080s) will not run on an 28125a6efdcSaaron.Tn AIC7870 28225a6efdcSaaronRev B in synchronous mode at 10MHz. 2838c3565c6SkrwControllers with this problem have a 42 MHz clock crystal on them and run 2848c3565c6Skrwslightly above 10MHz. 28525a6efdcSaaronThis confuses the drive and hangs the bus. 28625a6efdcSaaronSetting a maximum synchronous negotiation rate of 8MHz in the 28725a6efdcSaaron.Tn SCSI-Select 288954ddbd6Smpechutility will allow normal operation. 2898c3565c6Skrw.Pp 2900215239dSmartinAlthough the Ultra2 and Ultra160 products have sufficient instruction RAM space 2918c3565c6Skrwto support both the initiator and target roles concurrently, 2928c3565c6Skrwthis configuration is disabled in favor of allowing the target role to respond 2938c3565c6Skrwon multiple target ids. 2948c3565c6SkrwA method for configuring dual role mode should be provided. 2958c3565c6Skrw.Pp 2968c3565c6SkrwTagged Queuing is not supported in target mode. 2978c3565c6Skrw.Pp 2988c3565c6SkrwReselection in target mode fails to function correctly on all high voltage 2998c3565c6Skrwdifferential boards as shipped by Adaptec. 3008c3565c6SkrwInformation on how to modify HVD board to work correctly in target mode is 3018c3565c6Skrwavailable from Adaptec. 302