From owner-freebsd-scsi Mon Dec 8 20:15:18 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id UAA24363 for freebsd-scsi-outgoing; Mon, 8 Dec 1997 20:15:18 -0800 (PST) (envelope-from owner-freebsd-scsi) Received: from pluto.plutotech.com (mail.plutotech.com [206.168.67.137]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id UAA24340; Mon, 8 Dec 1997 20:15:10 -0800 (PST) (envelope-from gibbs@plutotech.com) Received: from narnia.plutotech.com (narnia.plutotech.com [206.168.67.130]) by pluto.plutotech.com (8.8.7/8.8.5) with ESMTP id VAA29018; Mon, 8 Dec 1997 21:15:09 -0700 (MST) Message-Id: <199712090415.VAA29018@pluto.plutotech.com> Date: Mon, 08 Dec 1997 21:13:29 -0700 From: "Justin T. Gibbs" Subject: 971208 CAM Snapshot Available Sender: owner-freebsd-scsi@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk To: undisclosed-recipients:; ------- Blind-Carbon-Copy Subject: 971208 CAM Snapshot Available Date: Mon, 08 Dec 1997 21:13:29 -0700 From: "Justin T. Gibbs" Bcc: Blind Distribution List: ; Common Access Method SCSI layer Patches Available You've all seen messages talking about a new SCSI layer for FreeBSD, and I'm pleased to announce yet another snapshot of that work. I plan to release snapshots on a regular basis as new features and hardware support are added. To see what is currently supported, skip down to the supported hardware section. "What is CAM? and why would I want it?" CAM is an ANSI ratified spec that defines a software interface for talking to SCSI and ATAPI devices. This new SCSI layer for FreeBSD is not strictly CAM compliant, but follows many of the precepts of CAM. More importantly, this work addresses many of the short comings of the previous SCSI layer and should provide better performance, reliability, and ease the task of adding support for new controllers. I hope that many of you will try CAM. Although "work in progress", this code has been through over four months of testing here at Pluto and I feel pretty good about the stability of the code. If you do have the facilities to experiment (you must be running current), please do. I welcome your feedback especially about the performance of the new system. Features Since Last Snapshot: Preliminary tape support. This has only been tested on a DDS2 drive and the driver is fairly green. New device statistic code. A whole slew of information is now recorded on a per-device basis. The interface is generic and once we have iostat and systat converted to using this code, all other drivers using the old "dk" stat interface will be converted. A sample utility is included in this snapshot so you can read the statistics. Bus DMA based bounce buffer support. ISA AdvanSys support now works in all memory configurations. aic7xxx driver improvements. The aic7895 is now supported. The command queing algorithm is now more efficient. Bug fixes include some problems with error recovery and target initiated sync/wide negotiation. AdvanSys driver improvements. The driver has now been tested on almost every narrow SCSI card AdvanSys has produced. Many bugs in the device probe code have been fixed. Table driven error handling. This greatly simplifies the task of enhancing or modifying how errors are handled. Enhanced PCI conf support. Although this isn't really CAM related, you get it for free. Check out the pciconf utilty for details. Numerous other bug fixes I've forgotten about. Features: Round-robin, per priority level scheduling of devices and their resources. I/O Completion, error recovery, and processing queued I/O is performed in a separate software interrupt handler. The old system had the potential of blocking out hardware interrupts for lengthy periods as much of this processing occurred as the result of a call from the controller's interrupt handler. The generic SCSI layer now understands tagged I/O and exports this functionality to the peripheral drivers. This allows drivers like the "direct access" driver to perform ordered tagged transactions for meta-data writes. Async, ordered, meta-data writes are now enabled in vfs_bio.c The "direct access" driver prevents "tag starvation" from occurring by guaranteeing that at least one write in every 5 second period to a tagged queuing device has an ordered tag. This removes the need for individual controller drivers to worry about this problem. Complete and controller independent handling of the "QUEUE FULL" and "BUSY" status codes. The number of tags that are queued to a device are dynamically adjusted by the generic layer. Interrupt driven sub-device probing. At boot time, all buses are probed in parallel yielding a much faster boot. As probing occurs after all interrupt and timer services are available, no additional (and often error prone) "polling" code is needed in each controller driver. Better error recovery. When an error occurs, the queue of transactions to the erring device is "frozen", full status is reported back to the peripheral driver, and the peripheral driver can recover the device without perturbing queued up I/O. As all transactions have an associated priority and generation count, after recovery is complete, transactions that are retried are automatically re-queued in their original order. All error handling is performed based on a detected failure. The old code would often perform actions "just in case" before accessing a device as the error recovery mechanism was inadequate. Now, for example, if your disk spins down, the system will properly recover even if the device is already open. Support for "high power" commands. Peripheral drivers can mark actions that may tax a power supply as "high powered". Only a certain number (default of 4, but configurable with the CAM_MAX_HIGHPOWER kernel option) of these commands are allowed to be active at a time. This allows a user to, for example, disable spin-up on the drives in an enclosure and let the system spin them up in a controlled fashion. By default, all luns are scanned on devices during probe. In the old SCSI layer, this was often problematic as it performed a Test Unit Ready prior to performing an Identify. Many devices that properly handle the Identify will hang the bus if you attempt a different command to a high lun. Transfer negotiations only occurs to devices that actually support negotiations (based on their inquiry information). This is performed in a controller independent fashion. There is now a generic quirk mechanism that allows controllers, peripheral drivers, or the CAM transport layer to define their own quirks entries. Currently the CAM transport layer has quirk entries that allow for modulation of tags and disabling multi-lun probing. The AdvanSys driver uses quirk entries to control some of the "hardware bug fixes" in the driver that only apply to certain types of devices. Hard-wiring of devices to specific unit numbers is supported as it was in the old system. Userland "pass-through" commands are supported. The interface is different than from the old SCSI code, but sample code is provided (including patches to XMCD), and we do plan to provide a scsi.8 command in the future. SUPPORTED HARDWARE Aic7xxx driver (ahc): This driver supports all of the devices the original FreeBSD driver supports but with the following new features: Support for aic7895 based controllers. Autotermination support for aic7860 based cards. SCB paging that allows up to 255 SCBs to be active on aic7770, aic7850, and aic7860 cards. Bug fixes to the multi-lun support. The beginnings of a target mode implementation. AdvanSys Driver (adv): This driver supports the entire line of AdvanSys narrow channel devices. Tagged queuing is also supported. Supported peripherals: Direct Access driver (da): 512 byte sectored disk drivers. Support for other sector sizes is planned, but further investigation on the "right" approach for this is needed. It probably belongs in the disk-slice code. CDROM driver (cd): This driver should support everything the old driver did. Sequential Access driver (sa): This driver should support most "newer" tape drives. It does not have the ability to change either the density or compression settings yet. This is the "greenest" component in CAM currently, having only been tested on an Archive Python. Look for additional enhancements to this driver in the near term. Other peripheral drivers are in the works. HOW TO INSTALL IT BACKUP YOUR OLD SRC TREE AND KERNEL!!!! cp /kernel /kernel.works Get the code: ftp://ftp.FreeBSD.org/pub/FreeBSD/cam/cam-971208.diffs.gz ftp://ftp.FreeBSD.org/pub/FreeBSD/cam/cam-971208.samples.tar.gz or ftp://ftp.kdm.org/pub/FreeBSD/cam/cam-971208.diffs.gz ftp://ftp.kdm.org/pub/FreeBSD/cam/cam-971208.samples.tar.gz On a FreeBSD-current system from ~971208: cd /usr/src zcat cam-971208.diffs.gz | patch cd usr.sbin/config make clean all install cd sys/i386/conf vi MYKERNEL Comment out all unsupported SCSI devices, and substitute "da" for "sd" and "sa" for "st". Look in LINT or GENERIC for examples. config MYKERNEL cd ../../MYKERNEL make all make install If you want XMCD or the userland sample code, untar cam-971208.samples.tar.gz and read the enclosed README files. - -- Justin T. Gibbs gibbs@FreeBSD.org =========================================== FreeBSD - Turning PCs into workstations =========================================== ------- End of Blind-Carbon-Copy