Newsgroups: comp.os.linux.announce,comp.os.linux.admin
From: Drew Eckhardt <drew@kinglear.cs.Colorado.EDU>
Subject: Linux SCSI HOWTO
Keywords: Linux SCSI drive tape CD-ROM HOWTO
Organization: University of Colorado at Boulder
Approved: linux-announce@tc.cornell.edu (Matt Welsh)

Archive-name: linux/howto/scsi
Last-modified: 23 Feb 94
Version: 2.00

Copyright 1994, Drew Eckhardt

The SCSI-HOWTO is copyrighted by Drew Eckhardt. A verbatim copy may be 
reproduced and distributed in any medium physical or electronic without 
permission of the author. Translations are similarly permitted without 
express permission if it includes a notice on who translated it. Commercial 
redistribution is allowed and encouraged; however, the author would like to 
be notified of any such distributions. 

Short quotes may be used without prior consent by the author. Derivative work
and partial distributions of the SCSI-HOWTO have to either include a verbatim
copy of this file or make a verbatim copy of this file available. If the 
latter is the case, a pointer to the verbatim copy must be stated at a 
clearly visible place.

In short, we wish to promote dissemination of this information through as
many channels as possible. However, we do wish to retain copyright on the
HOWTO documents, and would like to be notified of any plans to redistribute
the HOWTOs. We further want that ALL information provided in the HOWTOS is 
disseminated. If you have questions, please contact Matt Welsh, the Linux
HOWTO coordinator, at mdw@sunsite.unc.edu, or +1 607 256 7372.

IMPORTANT :
This HOWTO covers the Linux SCSI subsystem, as implemented in Linux
kernel revision .99.14 and newer alpha code.

Earlier revisions of the SCSI code are UNSUPPORTED, and may differ
significantly in terms of the drivers implemented, performance, 
and options available.

For additional information, you may wish to join the SCSI channel of the
Linux activists list - mail to linux-activists-request@joker.cs.hut.fi 
with the line 

X-MN-Admin: join SCSI

in the header.

I'm aware that this document isn't the most user-friendly, if 
you have constructive comments on how to rectify the situation
you're free to mail me about it.

Table of contents 
Section 1 			Common Problems 

Section 2			Reporting Bugs

Section 3			Hosts
	Subsection A		Supported and Unsupported Hardware
	Subsection B		Common Problems
	Subsection C		Adaptec 152x, 151x, Sound Blaster 16 SCSI,
				    AIC 6260/6360 chips (Standard)
	Subsection D		Adaptec 154x, AMI FastDisk VLB,
				     Buslogic, DTC 329x (Standard)  
	Subsection E		Adaptec 174x (Standard)
	Subsection F		Allways IN2000 (ALPHA)
	Subsection G		Future Domain 16x0 with TMC-1800 or 
				TMC-18C50 chip (Standard)
	Subsection H		Generic NCR5380 / T130B (Standard)
	Subsection I		Seagate ST0x/Future Domain TMC-8xx/TMC-9xx 
					(Standard)
	Subsection J 		PAS16 (Standard)
	Subsection K		Trantor T128/T128F/T228 (Standard)
	Subsection L		Ultrastor 14f, 24f,  34f (Standard)
	Subsection M		Western Digital 7000 (Standard)

Section 4			Disks
	Subsection A 		Supported and Unsupported Hardware 
	Subsection B 		Common Problems 
	Subsection C		Device Files
	Subsection D		Disk Geometry
	Subsection E 		Partitioning 

Section 5 			CD ROMs
	Subsection A		Supported and Unsupported Hardware 
	Subsection B		Common Problems
	Subsection C		Device Files 

Section 6			Tapes
	Subsection A		Supported and Unsupported Hardware
	Subsection B		Common Problems
	Subsection C		Device Files

Section 7			Generic 
	Subsection A		Supported and Unsupported Hardware
	Subsection B		Common Problems
	Subsection C		Device Files


Section 1 : Common Problems 
1.  Other parts of the documentation refer to a "kernel command line".  
    How do I use it?

    References to the kernel command line refer to the options you
    may specify from the LILO : prompt.

    Boot your system with LILO, and hit one of the alt, control, or 
    shift keys when it first comes up to get a prompt.  LILO 
    should respond with 

    	:

    At this prompt, you can select a kernel image to boot, or list
    them with ?.  Ie

    	:?

    	linux

    To boot that kernel with the command line options you have 
    selected, simply enter the name followed by a white space delimited
    list of options, terminating with a return.  

    Options take the form of 

    	variable=valuelist

    Where valuelist may be a single value or comma delimited list
    of values with no whitespace.  With the exception of root device,
    individual values are numbers, and may be specified in either 
    decimal or hexadecimal.

    Ie, to boot linux with an Adaptec 1520 clone not recognized 
    at bootup, you might type 

	:linux aha152x=0x340,11,7,1

    If you don't care to type all of this at boot time, it is also
    possible to use the LILO configuration file "append" option 
    with LILO .13 and newer.


2.  A SCSI device shows up at all possible IDs 

	If this is the case, you've strapped the device at the same 
	address as the controller (typically, 7, although some boards
	use other addresses).  Please change the jumper settings.

3.  You get sense errors when you know the devices are error free

	Sometimes this is caused by bad cables or impropper termination.

	Your SCSI bus must be terminated at both ends (using external
	terminators, or onboard terminators on the host adapter or 
	devices) and not in the middle.

4.  A kernel configured with networking does not work.

	The auto-probe routines for many of the network drivers 
	are not passive, and will interfere with operation with some
	of the SCSI drivers.

5.  A SCSI device is detected by the kernel, but you are unable to
	access it - ie mkfs /dev/sdc, tar xvf /dev/rst2, etc fails.

	You don't have a special file in /dev for the device.

	Unix devices are identified as either block or character (block 
	devices go through the buffer cache, character devices do not) devices,
	a major number (ie which driver is used - block major 8 corresponds
	to SCSI disks) and a minor number (ie which unit is being accessed 
	through a given driver - ie character major 4, minor 0 is the first 
	virtual console, minor 1 the next, etc).  However, accessing devices through
	this separate namespace would break the unix/Linux metaphor of 
	"everything is a file," so character and block device special files 
	are created under /dev.  This lets you access the raw third SCSI disk
	device as /dev/sdc, the first serial port as /dev/ttyS0, etc.  

	The preferred method for creating a file is using the MAKDEV script -
	cd /dev

	and run MAKEDEV (as root) for the devices you want to create - ie

	./MAKEDEV sdc

	wildcards "should" work - ie

	./MAKEDEV sd\*

	"should" create entries for all SCSI disk devices (doing this should create
	/dev/sda through /dev/sdp, with fifteen partition entries for each)

	./MAKEDEV sdc\*

	"should" create entries for /dev/sdc and all fifteen permissible partitions
	on /dev/sdc, etc.

	I say "should" because this is the standard unix behavior - the MAKEDEV
	script in your installation may not conform to this behavior, or may have
	restricted the number of devices it will create.

	If MAKEDEV won't do the right magic for you, you'll have to create the
	device entries by hand with the mknod command.

	The block/character type, major, and minor numbers are specified for the
	various SCSI devices in Subsection C : Device Files in the appropriate 
	section.  

	Take those numbers, and use (as root)

	mknod /dev/device b|c major minor

	ie - 

	mknod /dev/sdc b 8 32
	mknod /dev/rst0 c 9 0

Section 2 : Reporting Bugs

The Linux SCSI developers don't necessarily maintain old revisions
of the code due to space constraints.  So, if you are not running the
latest publically released Linux kernel (note that many of the Linux
distributions, such as MCC, SLS, Yggdrasil, etc. often lag one or more 
revisions behind this) chances are we will be unable to solve your 
problem.  So, before reporting a bug, please check to see if it exists
with the latest publically available kernel.

If after upgrading, and reading this document thoroughly, you still
believe that you have a bug, please mail a bug report to the SCSI channel
of the mailing list where it will be seen by many of the people who've 
contributed to the Linux SCSI drivers.

In your bug report, please provide as much information as possible
regarding your hardware configuration, and the exact text of 
all of the messages that Linux prints when it boots and when the 
error condition occurs.  Failure to provide the exact text of any and
all messages may result in misdiagnosis of your problem.

The bottom line is that if we can't reproduce your bug, and you can't 
point at us what's broken, it won't get fixed.

Assuming you don't yet have Linux up and running, a good way to provide
the information we need would be to perform the following procedure :

Format a floppy diskette under DOS.  Note that if you have a distribution
which mounts the root diskette off of floppy rather than RAM drive, you'll
have to format a diskette readable in the drive not being used to mount
root.

Boot Linux, and login as root

	mkdir /tmp/dos

Insert the diskette in a drive not being used to mount root, and
mount it.  Ie

	mount -t msdos /dev/fd0 /tmp/dos

	or 

	mount -t msdos /dev/fd1 /tmp/dos

Insure that the /proc filesystem is mounted.

	grep proc /etc/mtab

If the /proc filesystem is not mounted, mount it 

	mkdir /proc
	chmod 755 /proc
	mount -t proc /proc /proc

Copy the kernel revision and messages into a log file

	cat /proc/version > /tmp/dos/log
	cat /proc/kmsg >> /tmp/dos/log

Type CNTRL-C after a second or two.

Unmount the DOS floppy

	umount /tmp/dos

And shutdown Linux

	shutdown

Reboot into DOS, and using your favorite communications software include
the log file in your trouble mail.

Section 3 : Hosts

Subsection A : Supported and Unsupported Hardware
Drivers in the distribution kernel :

Adaptec 152x, Adaptec 154x (including clones from Bustek and DTC 329x 
boards), Adaptec 174x, Future Domain 850, 885, 950, and other boards 
in that series (but not the 880 board unless you make the appropriate 
patch), Future Domain 16x0 with TMC-1800 or TMC-18C50 chip, PAS16 
SCSI ports, Seagate ST0x, Trantor T128 boards, Ultrastor 14F, 24F, and 34F, 
and Western Digital 7000. 

Alpha drivers :
Allways IN2000
Bustek : (native mode)
Richoh GSI-8	 
	dplatt@ntg.com (Dave Platt) 

Drivers that are being developed, but aren't publically available yet.

Announcements WILL be made when drivers are available for public 
alpha testing.  Until then, please don't use up the developers' 
valuable time with mail asking for release dates, etc.

Adaptec 2742 / 2842 / AIC 7770
DPT EATA 
NCR53c8x0/7x0
Qlogic 
Trantor T130B (interrupt driven, using pseudo-DMA)

SCSI hosts that will not work :

All parallel->SCSI adapters, Rancho SCSI boards, and Grass Roots SCSI
boards.

SCSI hosts that will NEVER work :

Non Adaptec compatable DTC boards (including the 3270 and 3280).

Aquiring programming information requires a non-disclosure agreement
with DTC.  This means that it would be impossible to distribute a 
Linux driver if one were written, since complying with the NDA would
mean distributing no source, in violation of the GPL, and complying 
with the GPL would mean distributing source, in violation of the NDA.
 
If you want to run Linux on an unsupported piece of hardware, your 
options are to either write a driver yourself (Eric Youngdale and I are 
usually willing to answer technical questions concerning the Linux
SCSI drivers) or to commision a driver.

Subsection B : Common Problems 
1.  SCSI timeouts 
	Make sure interrupts are enabled correctly, and there are no 
	IRQ, DMA, or address conflicts with other boards.

2.  Boards with a driver that uses the BIOS for autoprobe are not detected 
	(This includes the Adaptec 152x, Future Domain 1680, Trantor T128, 
	Seagate, and Western Digital 7000 drivers, but not the Adaptec 
	154x, 174x, Generic NCR5380, PAS16, and Ultrastor drivers).

	Autodetection will fail for drivers using the BIOS for autodetection
	if the BIOS is disabled, or the board's "signature" and/or BIOS address
	don't match known ones.

	If the BIOS is installed, please use DOS and DEBUG to 
	find a signature that will detect your board -

	Ie, if your board lives at 0xc8000, under DOS do

	debug
	d c800:0
	q

	and send a message to the SCSI channel of the mailing list with
	the ASCII message, with the length and offset from the base 
	address (ie, 0xc8000).  Note that the EXACT text is required.

	If no BIOS is installed, and you are using an Adaptec 152x,
	Trantor T128, or Seagate driver, you can use command line 
	or compile time overrides to force detection.

	Please consult the appropriate subsection for your SCSI board.


3.  Boards using memory mapped IO, (This include the Trantor T128 and 
	Seagate boards, but not the Adaptec, Generic NCR5380, PAS16,
	and Ultrastor drivers)

	This is often caused when the memory mapped I/O ports 
	are incorrectly cached.  You should have the board's 
	address space marked as uncachable in the XCMOS settings.

	If this is not possible, you will have to disable cache 
	entirely.

4.  The bootable kernel for an ALPHA driver does not work,
	resulting in a "kernel panic : cannot mount root device"
	message, or it does not work with your Linux distribution.

	You'll need to edit the binary image of the kernel (before
	or after writing it out to disk), and modify a few two byte 
	fields (little endian) to gurantee that it will work on your 
	system.  

	1.  default swap device at offset 502, this should be set to 0

	2.  ram disk size at offset 504, this should be set to the size
		of the boot floppy in K - ie, 5.25" = 1200, 3.5" = 1440.

		This means the bytes are 

		3.5" : 0xA0 0x05 
		5.25" : 0xB0  0x04

	3.  root device offset at 508, this should be 0, ie the boot
		device. 

	dd or rawrite the file to a disk.  Insert the disk in the
	first floppy drive, wait until it prompts you to insert
	the root disk, and insert the root floppy from your 
	distribution.


5.  Installing a device driver not bundled with the distribution kernel
	You need to start with the version of the kernel used by the 
	driver author.  This revision may be alluded to in the documentation
	included with the driver.

	Various recent kernel revisions can be found at 
		nic.funet.fi:/pub/OS/Linux/PEOPLE/Linus

	as linux-version.tar.gz

	They are also mirrored at tsx-11.mit.edu and various other sites.

	cd to /usr/src.

	Remove your old Linux sources, if you want to keep a backup copy
	of them

	mv linux linux-old

	Untar the archive

	gunzip < linux-0.99.12.tar.gz | tar xvfp -

	Apply the patches.  The patches will be relative to some directory
	in the filesystem.  By examining the output file lines in the patch
	file (grep for ^---), you can tell where this is - ie patches with 
	these lines

	--- ./kernel/blk_drv/scsi/Makefile

	--- ./config.in Wed Sep  1 16:19:33 1993


	would have the files relative to /usr/src/linux.

	Untar the driver sources at an appropriate place - you
	can type

	tar tfv patches.tar 

	to get a listing, and move files as necessary (The SCSI driver files 
	should live in /usr/src/linux/kernel/drivers/scsi)

	Either cd to the directory they are relative to and type

	patch -p0 < patch_file

	or tell patch to strip off leading path components.  Ie,
	if the files started with

	--- linux-new/kernel/blk_drv/scsi/Makefile 

	and you wanted to apply them while in /usr/src/linux, you 
	could cd to /usr/src/linux and type

	patch -p1 <  patches 

	to strip off the "linux-new" component.

	After you have applied the patches, look for any patch rejects,
	which will be the name of the rejected file with a # suffix appended.

	find /usr/src/linux/ -name "*#" -print 

	If any of these exist, look at them.  In some cases, the 
	differences will be in RCS identifiers and will be harmless,
	in other cases, you'll have to manually apply important 
	parts.  Documentation on diffs files and patch is beyond the
	scope of this document.

	Next, cd to /usr/src/linux and do a 

	make config

	to choose the options you want

	If you are installing off of floppy disk, you'll also have to 
	edit the Makefile to set the ROOT device to ramdisk.

	do a make depend

	followed by 

	make

	You should end up with a file "zImage".  Write this out to a floppy
	disk -

	cat zImage > /dev/fd0

	and use that to boot your system.  When it comes up, it should prompt
	for the root floppy, use a1 from SLS or whatever and you'll be fine.

Subsection C : Adaptec 152x, 151x, Sound Blaster 16 SCSI, 
	AIC 6260 chips (Standard)
Supported Configurations : 
BIOS addresses : 0xd8000, 0xdc000, 0xd0000, 0xd4000, 0xc8000, 0xcc000, 0xe0000,
	0xe4000.
Ports : 0x140, 0x340
IRQs : 9, 10, 11, 12
DMA is not used
IO : port mapped

IMPORTANT : VLB and motherboard 6360 implementations should be treated
    as unsupported, since there appears to be a timing problem in 
    these systems.

Autoprobe : works with many 152x boards with an installed BIOS.  All
    other boards must use a kernel command line or compile time override.

Autoprobe Override : 
Compile time : 
Define PORTBASE, IRQ, SCSI_ID, RECONNECT as appropriate, see Defines

kernel command line : aha152x=<PORTBASE>,<IRQ>,<SCSI-ID>,<RECONNECT>

Defines : 
AUTOCONF      : use configuration the controller reports (only 152x)
IRQ           : override interrupt channel (9,10,11 or 12) (default 11)
SCSI_ID       : override scsiid of AIC-6260 (0-7) (default 7)
RECONNECT     : override target dis-/reconnection/multiple 
	outstanding command - set to non-zero to enable, zero to
	disable.
DONT_SNARF     : Don't register ports (pl12 and below)
SKIP_BIOSTEST  : Don't test for BIOS signature (AHA-1510 or disabled BIOS)
PORTBASE       : Force port base. Don't try to probe

Subsection D : Adaptec 154x, AMI FastDisk VLB, Buslogic, DTC 329x (Standard)  
Supported Configurations :
Ports : 0x330 and 0x334 
IRQs : 9, 10, 11, 12, 14, 15
DMA channels : 5, 6, 7
IO : port mapped, bus master

Autoprobe : works with all supported configurations, does not 
	require an installed BIOS.

Autoprobe override : none

Antiquity Problems, fix by upgrading : 

1.  Linux kernel revisions prior to .99.10 don't support the 'C' 
	revision.

2.  Linux kernel revisions prior to .99.14k don't support the 'C'
	revision options for 

	- BIOS support for the extended mapping for disks > 1G

	- BIOS support for > 2 drives

	- BIOS support for autoscanning the SCSI bus

Common problems :

1.  There are unexpected errors with a revision C board. 
	Early examples of the 154xC boards have a high slew rate on 
	one of the SCSI signals, which results in signal reflections 
	when cables with the wrong impedance are used.

	Try changing cables, especially if you are using external devices.

2.  There are error messages (ie, interrupt received, no mail) during
	initialization with the C revision boards.

	These may result from the use of one of the unsupported BIOS
	options.  Turn it off.


3.  An "Interrupt received, but no mail" message is printed on bootup
	and your SCSI devices are not detected.

	Disable the BIOS options to support the extended mapping for 
	disks > 1G, support for > 2 drives, and for autoscanning the 
	bus.  Or, upgrade to Linux .99.14k or newer.


Subsection E : Adaptec 174x
Supported Configurations : 
Slots : 1-8
Ports : EISA board, not applicable
IRQs : 9, 10, 11, 12, 14, 15
DMA Channels : EISA board, not applicable
IO : port mapped, bus master

Autoprobe : works with all supported configurations

Autoprobe override : none

Common Problems : 
1. If the Adaptec 1740 driver prints the message 
	"aha1740: Board detected, but EBCNTRL = %x, so disabled it."

	your board was disabled because it was not running in enhanced 
    	mode.  Boards running in standard 1542 mode are not supported.

Subsection F : Allways IN2000 
ALPHA available via ftp tsx-11.mit.edu/pub/linux/ALPHA/SCSI/in2000
	driver is in2000.tar.z, bootable kernel zImage
Ports : 0x100, 0x110, 0x200, 0x220
IRQs : 10, 11, 14, 15
DMA is not used
IO : port mapped

Autoprobe : BIOS not required

Autoprobe override : none

Common Problems : 

1.  There are known problems in systems with IDE drives and with 
	swapping.

Subsection G : Future Domain 16x0 with TMC-1800 or TMC-18C50 chip
Supported Configurations :
BIOSs :  2.0, 3.0, 3.2
BIOS Addresses :    0xc8000, 0xca000, 0xce000, 0xde000
Ports : 0x140, 0x150, 0x160, 0x170
IRQs : 3, 5, 10, 11, 12, 14, 15
DMA is not used
IO : port mapped

Autoprobe : works with all supported configurations, requires 
	installed BIOS

Autoprobe Override : none

Antiquity Problems, fix by upgrading : 

1.  Old versions do not support the TMC-18C50 chip, and will fail with
	newer boards. 

2.  Old versions will not have the most current BIOS signatures for 
	autodetection.

Subsection H : Generic NCR5380 / T130B
Supported and Unsupported Configurations : 
Ports : all
IRQs : all
DMA channels - DMA is not used
IO : port mapped

Autoprobe : none

Autoprobe Override :
Compile time : Define GENERIC_NCR5380_OVERRIDE to be an array of tupples 
with port, irq - ie 
#define GENERIC_NCR5380_OVERRIDE {{0x330, 5,}} 

for a board at port 330, IRQ 5.

The symbolic IRQs IRQ_NONE and IRQ_AUTO may be used.
    
kernel command line : ncr5380=port,irq

255 may be used for no irq, 254 for irq autoprobe.

Common Problems : 

1. Using the T130B board with the generic NCR5380 driver

	The NCR5380 compatable registers are offset eight from
	the base address.  So, if your address is 0x350, use 

	ncr53480=0x358,254

	on the kernel command line.

Notes : the generic driver doesn't support DMA yet, and pseudo-DMA 
	isn't supported in the generic driver.

Subsection I : Seagate ST0x/Future Domain TMC-8xx/TMC-9xx 
Supported and Unsupported Configurations : 
Base addresses : 0xc8000, 0xca000, 0xcc000, 0xce000, 0xdc000, 0xde000 
IRQs : 3, 5
DMA channels : DMA is not used
IO : memory mapped

Autoprobe : probes for address only, IRQ is assumed to be 5,
	requires installed BIOS.

Autoprobe Override :
Compile time : Define OVERRIDE to be the base address, CONTROLLER to 
FD or SEAGATE as appropriate, and IRQ to the IRQ.

kernel command line : st0x=address,irq or fd8xx=address,irq (only works 
	for .99.13b and newer)

Antiquity Problems, fix by upgrading :

1.  Versions prior to the one in the Linux .99.12 kernel had a problem
	handshaking with some slow devices, where

	This is what happens when you write data out to the bus

	1.  Write byte to data register, data register is asserted to bus
	2.  time_remaining = 12us
	3.  wait while time_remaining > 0 and REQ is not asserted
	4.  if time_remaining > 0, assert ACK
	5.  wait while time remaining > 0  and REQ is asserted
	6.  deassert ACK

	The problem was encountered in slow devices that do the command
	processing as they read the command, where the REQ/ACK handshake
	takes over 12us - REQ didn't go false when the driver expected it
	to, so the driver ended up sending multiple bytes of data for
	each REQ pulse.

2.  With Linux .99.12, a bug was introduced when I fixed the arbitration
	code, resulting in failed selections on some systems.  This was
	fixed in .99.13.

Common Problems : 

1.  There are command timeouts when Linux attempts to read the partition
    table or do other disk access.

    The board ships with the defaults set up for MSDOS, ie interrupts
    are disabled.  To jumper the board for interrupts, on the Seagate
    use jumper W3 (ST01) or JP3 (ST02) and short pins F-G to select 
    IRQ 5.

2.  The driver can't handle some devices, particularly cheap SCSI 
    tapes and CDROMs.

    The Seagate ties the SCSI bus REQ/ACK handshaking into the PC bus
    IO CHANNEL READY and (optionally) 0WS signals.  Unfortunately, it 
    doesn't tell you when the watchdog timer runs out, and you have 
    no way of knowing for certain that REQ went low, and may end up
    seeing one REQ pulse as multiple REQ pulses.

    Dealing with this means using a tight loop to look for REQ to 
    go low, with a timeout incase you don't catch the transition due
    to an interrupt, etc.  This results in a performance decrease, so it
    would be undesireable to apply this to all SCSI devices.  Instead, 
    it is selected on a per-device basis with the "borken" field for 
    the given SCSI device in the scsi_devices array.  If you run into
    problems, you should try adding your device to the list of 
    devices for which borken is not reset to zero (currently, 
    only the TENEX CDROM drives).

3.  A future domain board (most notably the 880) doesn't work.
	
	A few of the Future domain boards use the Seagate 
	register mapping, and have the MSG and CD bits of the 
	status register flipped.

	You should edit seagate.h, swapping the definitions for 
	STAT_MSG and STAT_CD, and recompile the kernel with 
	CONTROLLER defined to SEAGATE and an appropriate 
	IRQ and OVERRIDE specified.

Defines : 

FAST or FAST32 will use blind transfers where possible

ARBITRATE will cause the host adapter to arbitrate for the 
	bus for better SCSI-II compatability, rather than just 
        waiting for BUS FREE and then doing its thing.  Should
	let us do one command per Lun when I integrate my 
	reorganization changes into the distribution sources.

SLOW_HANDSHAKE will allow compatability with broken devices that don't 
	handshake fast enough (ie, some CD ROM's) for the Seagate
	code.

SLOW_RATE=x, x some number will let you specify a default 
	transfer rate if handshaking isn't working correctly.

Subsection J : PAS16 SCSI
Supported and Unsupported Configurations : 
Ports : 0x388, 0x384, 0x38x, 0x288
IRQs : 10, 12, 14, 15
    IMPORTANT : IRQ MUST be different from the IRQ used for the sound
	portion of the board. 
DMA is not used for the SCSI portion of the board
IO : port mapped

Autoprobe : does not require BIOS

Autoprobe Override : 
Compile time : Define PAS16_OVERRIDE to be an array of port, irq 
tupples.  Ie 

#define PAS16_OVERRIDE {{0x388, 10}} 

for a board at port 0x388, IRQ 10.

kernel command line : 
pas16=port,irq 

Defines :
AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
for commands that return with a CHECK CONDITION status. 

PSEUDO_DMA - enables PSEUDO-DMA hardware, should give a 3-4X performance
increase compared to polled I/O.

PARITY - enable parity checking.  Not supported

SCSI2 - enable support for SCSI-II tagged queueing.  Untested


UNSAFE - leave interrupts enabled during pseudo-DMA transfers.  You
         only really want to use this if you're having a problem with
         dropped characters during high speed communications, and even
         then, you're going to be better off twiddling with transfersize.

USLEEP - enable support for devices that don't disconnect.  Untested.


Common problems : 

1.  Command timeouts, aborts, etc.

    You should install the NCR5380 patches that I posted to the net 
    some time ago, which should be integrated into some future alpha
    release.  These patches fix a race condition in earlier NCR5380
    driver cores, as well as fixing support for multiple devices on 
    NCR5380 based boards.

    If that fails, you should disable the PSEUDO_DMA option by 
    changing the #define PSEUDO_DMA line in drivers/scsi/pas16.c to #undef
    PSEUDO_DMA.

    Note that the later should be considered a last resort, because
    there will be a severe performance degradation.



Subsection K : Trantor T128/T128F/T228 
Supported and Unsupported Configurations : 
Base addresses :  0xcc000, 00xc8000, 0xdc000, 0xd8000
IRQs : none, 3, 5, 7 (all boards)
	10, 12, 14, 15 (T128F only)
DMA is not used.
IO : memory mapped

Autoprobe : works for all supported configurations, requires 
	installed BIOS.

Autoprobe Override :
Compile time : Define T128_OVERRIDE to be an array of address, irq 
tupples.  Ie 

#define T128_OVERRIDE {{0xcc000, 5}} 

for a board at address 0xcc000, IRQ 5.

The symbolic IRQs IRQ_NONE and IRQ_AUTO may be used.

kernel command line : t128=address,irq

-1 may be used for no irq, -2 for irq autoprobe.

Defines : 
AUTOSENSE - if defined, REQUEST SENSE will be performed automatically
for commands that return with a CHECK CONDITION status. 

PSEUDO_DMA - enables PSEUDO-DMA hardware, should give a 3-4X performance
increase compared to polled I/O.

PARITY - enable parity checking.  Not supported

SCSI2 - enable support for SCSI-II tagged queueing.  Untested


UNSAFE - leave interrupts enabled during pseudo-DMA transfers.  You
         only really want to use this if you're having a problem with
         dropped characters during high speed communications, and even
         then, you're going to be better off twiddling with transfersize.

USLEEP - enable support for devices that don't disconnect.  Untested.

Common Problems :
1.  Command timeouts, aborts, etc.

    You should install the NCR5380 patches that I posted to the net 
    some time ago, which should be integrated into some future alpha
    release.  These patches fix a race condition in earlier NCR5380
    driver cores, as well as fixing support for multiple devices on 
    NCR5380 based boards.

    If that fails, you should disable the PSEUDO_DMA option by 
    changing the #define PSEUDO_DMA line in drivers/scsi/pas16.c to #undef
    PSEUDO_DMA.

    Note that the later should be considered a last resort, because
    there will be a severe performance degradation.

Subsection L : Ultrastor 14f, 24f, 34f
Ports : 0x130, 0x140, 0x210, 0x230, 0x240, 0x310, 0x330, 0x340
IRQs : 10, 11, 14, 15
DMA channels : 5, 6, 7
IO : port mapped, bus master

Autoprobe : does not work for boards at port 0x310, BIOS not required.  

Autoprobe override : compile time only, define PORT_OVERRIDE

Common Problems :
1.  The address 0x310 is not supported by the autoprobe code, and may 
        cause conflicts if networking is enabled.

        Please use a different address.
 
2.  Using an Ultrastor at address 0x330 may cause the system to hang
        when the sound drivers are autoprobing.

        Please use a different address.

3.  Various other drivers do unsafe probes at various addresses, if you
        are having problems with detection or the system is hanging at 
        boot time, please try a different address.

        0x340 is recommended as an address that is known to work.

4.  Linux detects no SCSI devices, but detects your SCSI hard disk
	on an Ultrastor SCSI board as a normal hard disk, and the
	hard disk driver refuses to support it.  Note that when this 
	occurs, you will probably also get a message
	
	hd.c: ST-506 interface disk with more than 16 heads detected,
	  probably due to non-standard sector translation.  Giving up.
	  (disk %d: cyl=%d, sect=63, head=64)

	If this is the case, you are running the Ultrastor board in
	WD1003 emulation mode.  You have 

	1.  Switch the ultrastor into native mode.  This is the 
	    recommended action, since the SCSI driver can be 
	    significantly faster than the IDE driver, especially with
	    the clustered read/write patches installed.  Some users have 
	    sustained in excess of 2M/sec through the file system using 
	    these patches.

	    Note that this will be necessary if you wish to use any non-
	    hard disk, or more than two hard disk devices on the Ultrastor.

	2.  Use the kernel command line switch 

	    hd=cylinders,heads,sectors

	    to override the default setting to bootstrap yourself,
	    keeping number of cylinders <= 2048, number of heads <= 16,
	    and number of sectors <= 255 such that cylinders * heads * sectors
	    is the same for both mappings.

	    You'll also have to manually specify the disk geometry when
	    running fdisk under Linux.  Failure to do so will result in 
	    incorrect partition entries being written, which will work
	    correctly with Linux but fail under MSDOS which looks at 
	    the cylinder/head/sector entries in the table.

	    Once Linux is up, you can avoid the inconvience of having 
	    to boot by hand by recompiling the kernel with an appropriately
	    defined HD_TYPE macro in include/linux/config.h.

Subsection M : Western Digital 7000
Supported Configurations :
BIOS Addresses : 0xce000
Ports : 0x350
IRQs : 15
DMA Channels : 6
IO : port mapped, bus master

Autoprobe :  requires installed BIOS 

Common Problems : 

1.  There are several revisisions of the chip and firmware.  Supposedly,
	revision 3 boards do not work, revision 5 boards do, 
	chips with no suffix do not work, chips with an 'A' suffix do.

2.  The board supports a few BIOS addresses which aren't on the list 
	of supported addresses.  If you run into this situation,
	please use one of the supported addresses and submit a bug 
	report as outlined in Section 2, "Bug Reports"

Section 4 : Disks 
Subsection A : Supported and Unsupported Hardware

All direct access SCSI devices with a block size of 256, 512, or 
1024 bytes should work.  Other block sizes will not work (Note
that this can often be fixed by changing the block and/or 
sector sizes using the MODE SELECT SCSI command)

Sector size refers to the number of data bytes allocated per sector 
on a device, ie CDROMs use a 2048 byte sector size.  

Block size refers to the size of the logical blocks used to interface
with the device.  Although this is usually identical to sector size,
some devices map multiple smaller physical sectors (ie, 256 bytes
in the case of 55M Syquest drives) to larger logical blocks or 
vice versa (ie, 512 byte blocks on SUN compatable CDROM drives).

Removeable media devices, including Bernoulis, flopticals, and MO drives 
work.  

Subsection B: Common Problems 

1.  When partitioning, you get a warning message about "cylinder > 1024"
	or you are unable to boot from a partition including a logical
	cylinder past logical cylinder 1024.

	This is a BIOS limitation.

	See Subsection D, Disk Geometry, for an explanation.

2.  You are unable to partition /dev/hd*

	/dev/hd* aren't SCSI devices, /dev/sd* are.  

	See Subsection C, Device files, and Subsection E, partitioning
	for the correct device names and partitioning procedure.

3.  You are unable to eject media from a removeable media drive

	Linux attempts to lock the drive door when a piece of 
	media is mounted to prevent filesystem corruption due to
	an inadvertant media change.

	Please unmount your disks before ejecting them.

4.  You are using a busmastering controller and are getting 
	poor performance.



Subsection C : Device Files

SCSI disks use block device major 8, and there are no "raw" devices
ala BSD.

16 minor numbers are allocated to each SCSI disk, with minor % 16 == 0 
being the whole disk, minors  1 <= (minor % 16) <= 4 the four primary 
partitions, minors 5 <= (minor % 16) <= 15 any extended partitions.

Due to constraints imposed by Linux's use of a sixteen bit dev_t with
only eight bits allocated to the minor number, the SCSI disk minor 
numbers are assigned dynamically starting with the lowest SCSI HOST/ID/LUN.

Ie, a configuration may work out like this (with one host adapter)
Device			Target, Lun		SCSI disk
84M Seagate 		0	0		/dev/sda
SCSI->SMD bridge disk 0	3	0		/dev/sdb 
SCSI->SMD bridge disk 1	3	1		/dev/sdc
Wangtek tape		4	0		none
213M Maxtor		6	0		/dev/sdd

Etc.  

The standard naming convention is 

/dev/sd{letter} for the entire disk device ((minor % 16) == 0)
/dev/sd{letter}{partition} for the partitions on that device 
	(1 <= (minor % 16) <= 15)

Ie

/dev/sda	block device major 8 minor 0
/dev/sda1	block device major 8 minor 1
/dev/sda2	block device major 8 minor 2
/dev/sdb	block device major 8 minor 16

etc.

Subsection D: Disk Geometry

The problem with partitioning SCSI disks and Linux is that Linux talks
directly to the SCSI interface.  Each disk is viewed as the SCSI host
sees it : N blocks, numbered from 0 to N-1, all error free.  There is
no portable way to get disk geometry.  Conversly, DOS predates 
intelligent disks, and requires a head / cylinder / sector mapping.

If you don't care about using DOS, create a translation such that 
H * C * S * 512 < size of your drive in bytes (a megabyte is
defined as 2^20 bytes).

Otherwise, you'll have to use the BIOS mapping.  In some cases, this
will mean reconfiguring the disk so that it is at SCSI ID 0, and 
disabling the second IDE drive (if you have one).

You can either use a program like NU, or you can use the following 
program :

begin 664 dparam.com
MBAZ``##_B+^!`+N!`(H'0SP@=/D\,'5:@#]X=`6`/UAU4(!_`3AU2H!_`P!U
M1(I7`H#J,(#Z`7<Y@,*`M`C-$PCD=3-14HC()#\PY.@R`.@J`%J(\/[`,.3H
M)0#H'0!8AL2Q!M+L0.@7`+K"`;0)S2'#NIP!ZR"ZQ0'K&[K5`>L6N]T!,=*Y
M"@#W\8#",$N(%PG`=>^)VK0)S2'#=7-A9V4Z(&1P87)A;2`P>#@P#0H@("!O
L<B`@9'!A<F%M(#!X.#$-"B1);G9A;&ED(&1R:79E#0HD("`D```````D``!O
`
end

When run it prints the heads, sectors and cylinders of the first
BIOS-recognised disk.  

The BIOS imposed limits on the mapped disk geometry are  

1 <= # of heads <= 256
1 <= # of cylinders <= 1024
1 <= # of sectors <= 63

So, if you create a partition that includes logical cylinders at or 
past logical cylinder 1024, it will be inaccessable to the BIOS and 
you will be unable to boot kernels from it.  Since Linux uses the 
relative sector and length fields in the partition table, and not 
the head, cylinder, sector tuples, it is not bound by this restriction
and you will have no problems accessing the partition once Linux is 
booted.

You can partition your SCSI disks using the partitioning program
of your choice, under DOS, OS/2, Linux or any other operating 
system supporting the standard partitioning scheme.

The correct way to run the Linux fdisk program is by specifying the
device on the command line. Ie, to partition the first SCSI disk,

fdisk /dev/sda

If you don't explicitly specify the device, the partitioning program
may default to /dev/hda, which isn't a SCSI disk.

In some cases, you will get a warning message about a partition ending
past cylinder 1024, see Subsection D, Disk Geometry for an explanation.

Section 5 : CD ROMs

Subsection A: Supported and Unsupported Hardware

SCSI CDs with a block size of 512 or 2048 bytes should work.  Other
block sizes will not work.

Subsection B: Common Problems

1.  You can't mount a CDROM
        The correct syntax to mount an ISO-9660 CDROM is

        mount -t iso9660 /dev/sr0 /mount_point

        Note that for this to work, you must have the kernel
        configured with support for SCSI, your host adapter,
        the SCSI CDROM driver, and the iso9660 filesystem.

2.  You can't eject a CDROM

	Linux attempts to lock the drive door when a piece of 
	media is mounted to prevent filesystem corruption due to
	an inadvertant media change.

Subsection C: Device Files

SCSI CD ROMs use major 11.

Minors are allocated dynamically (See Section 4, Disks, Subsection C,
Device Files for an example) with the first CDROM found being minor 0,
the second minor 1, etc.

The standard naming convention is 

/dev/sr{digit} ie 

/dev/sr0
/dev/sr1

etc.

Section 6 : Tapes
Subsection A : Supported and Unsupported Hardware

Drives using both fixed and variable length blocks smaller than the
the driver buffer length (set to 32K in the distribution sources) are
supported.

Parameters (block size, buffering, density) are set with ioctls
(usually with the mt program), and remain in effect after the 
device is closed and reopened.

Virtually all drives should work, including :
	Archive Viper QIC drives, including the 150M and 525M models
	Exabyte 8mm drives
	Wangtek 5150S drives
	Wangdat DAT drives

Subsection B : Common Problems
1. The tape drive is not recognized at boot time.

	Try booting with a tape in the drive.

2.  When reading a tape with multiple files, the first tar 
	is successful, a second tar fails silently, and retrying 
	the second tar is successful.

	User level programs, such as tar, don't understand file marks.
	The first tar reads up until the end of the file.  The second 
	tar attempts to read at the file mark, gets nothing, but the 
	tape spaces over the file mark.  The third tar is successful
	since the tape is at the start of the next file.

	Use mt on the no-rewind device to space forward to the next file.


3.  Decompressing programs cannot handle the zeros padding the 
	last block of the file. 

	To prevent warnings and errors, wrap your compressed files 
	in a .tar file - ie, rather than doing 

	tar cfvz /dev/nrst0 file.1 file.2 ...

	do 

	tar cfvz tmp.tar.z file.1 file.2 ...

	tar cf /dev/nrst0 tmp.tar.z

5.  You can't read a tape made with another operating system or
	another operating system can't read a tape written in Linux.

	Different systems often use different block sizes.  On a
	tape device using a fixed blocksize, you will get errors 
	when reading blocks written using a different block size.

	To read these tapes, you must set the blocksize of 
	the tape driver to match the blocksize used when
	the tape was written, or to variable.

	NOTE : this is the hardware block size, not the blocking
	factor used with tar, dump, etc.

	You can do this with the mt command - 

	
		mt setblk <size>

	or 
	
		mt setblk 0

	to get variable block length support.


6.  All attempts to access the tape result in a 

	"No such device"

	or similar error message.  Check the type of 
	your tape device - it MUST be a character device with 
	major and minor numbers matching those specified in subsection
	C, Device Files.

Subsection C : Device Files

SCSI tapes use character device major 9.  

Due to constraints imposed by Linux's use of a sixteen bit dev_t with
only eight bits allocated to the minor number, the SCSI tape minor 
numbers are assigned dynamically starting with the lowest SCSI HOST/ID/LUN.

Rewinding devices are numbered from 0 - with the first 
SCSI tape, /dev/rst0 being c 9 0, the second /dev/rst1 c 9 1, etc.  
Non-rewinding devices have the high bit set in the minor number, 
ie /dev/nrst0 is c 9 128.

The standard naming convention is 
/dev/nrst{digit} 	for non-rewinding devices
/dev/rst{digit}		for rewinding devices

Section 7 : Generic 
Subsection A : Supported Hardware 

The Generic SCSI device driver provides an interface for sending 
SCSI commands to all SCSI devices - disks, tapes, CDROMs, media
changer robots, etc. 

Everything electrically compatable with your SCSI board should work.

Subsection B : Common Problems

Subsection C : Device Files

SCSI generic devices use character major 21.  Due to constraints 
imposed by Linux's use of a 16 bit dev_t, minor numbers are dynamically
assigned from 0, one per device, with

/dev/sg0 

corresponding to the lowest numerical target/lun on the first 
SCSI board.

