head	1.10;
access;
symbols
	RELENG_2_2_8_RELEASE:1.9
	RELENG_2_2_7_RELEASE:1.9
	PRE_NOBDEV:1.9
	POST_DEVFS_SLICE:1.9
	PRE_DEVFS_SLICE:1.9
	RELENG_2_2_6_RELEASE:1.9
	POST_SOFTUPDATE:1.9
	PRE_SOFTUPDATE:1.9
	RELENG_2_2_5_RELEASE:1.9
	WOLLMAN_MBUF:1.9.0.12
	BP_WOLLMAN_MBUF:1.9
	RELENG_2_2_2_RELEASE:1.9
	post_smp_merge:1.9
	pre_smp_merge:1.9
	RELENG_2_2_1_RELEASE:1.9
	RELENG_2_2_0_RELEASE:1.9
	RELENG_2_1_7_RELEASE:1.9
	RELENG_2_1_6_1_RELEASE:1.9
	RELENG_2_1_6_RELEASE:1.9
	RELENG_2_2:1.9.0.10
	RELENG_2_2_BP:1.9
	SCSI:1.9.0.8
	RELENG_2_1_5_RELEASE:1.9
	wollman_polling:1.9.0.6
	RELENG_2_1_0_RELEASE:1.9
	RELENG_2_1_0:1.9.0.4
	RELENG_2_1_0_BP:1.9
	RELENG_2_0_5_RELEASE:1.9
	RELENG_2_0_5:1.9.0.2
	RELENG_2_0_5_BP:1.9
	RELENG_2_0_5_ALPHA:1.9
	OLAH_TTCP:1.8.0.6
	RELEASE_2_0:1.8
	BETA_2_0:1.8
	ALPHA_2_0:1.8.0.4
	REL_before_johndavid_2_0_0:1.8
	MOVED_NEWCVS:1.8
	FINAL_1_1:1.8
	GAMMA_1_1:1.8
	BETA_1_1:1.8.0.2
	BP_BETA_1_1:1.8
	FINAL_1_0_2:1.7
	BRANCH_1_0:1.7.0.2
	FINAL_1_0:1.7
	EPSILON_1_0:1.6
	SCSI_1_0:1.6.0.2
	BP_SCSI_1_0:1.6
	GAMMA_1_0:1.5
	BETA_1_0:1.2
	ALPHA_1_0:1.1.1.1
	V_0_1_2_4:1.1.1.1;
locks; strict;
comment	@# @;


1.10
date	98.09.15.10.38.25;	author gibbs;	state dead;
branches;
next	1.9;

1.9
date	95.03.01.22.24.38;	author dufault;	state Exp;
branches
	1.9.8.1;
next	1.8;

1.8
date	93.11.18.05.02.44;	author rgrimes;	state Exp;
branches;
next	1.7;

1.7
date	93.10.16.17.21.04;	author rgrimes;	state Exp;
branches;
next	1.6;

1.6
date	93.09.21.20.26.02;	author rgrimes;	state Exp;
branches;
next	1.5;

1.5
date	93.08.28.03.08.47;	author rgrimes;	state Exp;
branches;
next	1.4;

1.4
date	93.08.21.20.01.48;	author rgrimes;	state Exp;
branches;
next	1.3;

1.3
date	93.08.20.09.14.22;	author rgrimes;	state Exp;
branches;
next	1.2;

1.2
date	93.07.29.11.48.59;	author nate;	state Exp;
branches;
next	1.1;

1.1
date	93.06.12.14.57.27;	author rgrimes;	state Exp;
branches
	1.1.1.1;
next	;

1.1.1.1
date	93.06.12.14.57.28;	author rgrimes;	state Exp;
branches;
next	;

1.9.8.1
date	96.09.06.06.35.46;	author gibbs;	state Exp;
branches;
next	;


desc
@@


1.10
log
@Obsoleted by CAM.
@
text
@WARNING: This file was not fully updated by dufault@@hda.com when
changing the configuration.  See the end for new notes.

This release consists of the following files 
(relative to the base of the source tree )

share/man/man4/scsi.4 <-useful general info
share/man/man4/uk.4
share/man/man4/su.4
share/man/man4/ch.4
share/man/man4/cd.4
share/man/man4/sd.4
share/man/man4/st.4 <--READ THIS IF YOU USE TAPES!
sbin/scsi/procargs.c
sbin/scsi/scsi.c
sbin/scsi/scsi.1
sbin/scsi/Makefile
sbin/st/Makefile
sbin/st/st.1
sbin/st/st.c
sys/sys/chio.h
sys/sys/cdio.h
sys/sys/mtio.h
sys/sys/scsiio.h
sys/i386/conf/EXAMPLE
sys/i386/isa/ultra14f.c <-runs 14f and 34f
sys/i386/isa/ultra_all.c.beta <-beta version, runs 14f,24f and 34f
sys/i386/isa/bt742a.c
sys/i386/isa/aha1742.c
sys/i386/isa/aha1542.c
sys/scsi/syspatches
sys/scsi/syspatches/conf.c
sys/scsi/syspatches/user_scsi.diffs
sys/scsi/syspatches/MAKEDEV.diff
sys/scsi/syspatches/isa.c.patch
sys/scsi/syspatches/README
sys/scsi/uk.c
sys/scsi/su.c
sys/scsi/st.c
sys/scsi/sd.c
sys/scsi/ch.c
sys/scsi/cd.c
sys/scsi/scsi_ioctl.c
sys/scsi/scsi_base.c
sys/scsi/scsiconf.c
sys/scsi/scsi_tape.h
sys/scsi/scsi_disk.h
sys/scsi/scsi_changer.h
sys/scsi/scsi_cd.h
sys/scsi/scsi_all.h
sys/scsi/scsi_debug.h
sys/scsi/scsiconf.h
sys/scsi/README <--this file

notice sys/scsi/sg.c and sys/sys/sgio.h have been removed


----------------------------------------------------------------
This scsi system is designed to allow the re-use of top end drivers
such as disk and tape drivers, with different scsi adapters.

As of writing this document, There are top end drivers working for:
----------------------------------------------------------------
generic scsi disk
generic scsi tape
cd-rom  (plays music under the xcplayer (?) program)
AEG Character recognition devices *
Calera Character recognition devices *
Generic scsi-II scanners *
Exabyte tape changer device.
GENERIC SCSI DEVICES (user generated scsi commands) 
----------------------------------------------------------------


There are also working bottom end drivers for:
----------------------------------------------------------------
adaptec 1542 (and 1742 in 1542 mode)
bustec 742a (apparently works for VESA version (445S?))(and 747?)
adaptec 174x  (note NOT 27xx)
Ultrastore 14f (works for 34f (VESA version))				
Ultrastore 24f RSN (Beta version included here)
----------------------------------------------------------------


################## Using the scsi system ##################
------------minor numbers---------------
This scsi system does not allocate minor numbers to devices depending
on their SCSI IDs is any way. A devices minor number is dependant
on the order in which it was found.
e.g. the first tape found will become st0 (minor number 0)
	the second found will become st1 (minor number 16)
	the third will become st2 (minor 32) 
	etc.

These devices could be on the same scsi bus or different scsi busses.
That would not change their minor numbers.

THE EXCEPTION  TO THIS IS IN THE GENERIC SCSI DRIVER. in which case
the following mapping applies:

BB TTT LLL  B= scsi bus number, T = target number, L = LUN.

It is possible to run two different TYPES of scsi adapters at the 
same time and have st0 on one and st1 on another. (for example)

There is a scheme supported in which scsi devices can be 'wired in' even
if they are not present or powered on at probe time. (see scsiconf.c)
In addition, the scsi(1) command allows the operator ask for a
reprobe at any time.  Newly found devices will be configured in. Any
device that does not map to a known device type is attached to the
'unknown' (uk) driver.


--------------making devices------------
A changed version of /dev/MAKEDEV is supplied that
can be used to make devices sd[01234] and st[01234]

e.g. 
cd /dev
sh MAKEDEV sd0 sd1 sd2 st0 st1 cd0

see st(1) and st(4) for info on tape devices.

--------------file layout-------------------
Originally I had all scsi definitions in one file: scsi.h
I have since moved definitions of commands so that all
definitions needed for a particular type of device are
found together in the include file of that name.
This approximatly follows the layout of their definition 
in the SCSI-2 spec. 
As such they are:

scsi_all.h  		general commands for all devices --- CHAPTER 7
scsi-disk.h  		commands relevant to disk        --- CHAPTER 8
scsi-tape.h  		commands for scsi tapes          --- CHAPTER 9
scsi-cd.h    		commands for cd-roms (and audio) --- CHAPTER 13
scsi-changer.h    	commands medium changer devices  --- CHAPTER 16

---------ioctl definitions-------------
User accessable structures (e.g. ioctl definitions) have been
placed in sys/cdio, sys/sgio and sys/chio (based after sys/mtio for
the ioctls for mag tapes (including st).
General scsi ioctls are found in sys/scsiio.h.

-----------cd-rom-----------------
The cd rom driver ha been tested by a number of people and
grefen@@convex.com has completed the audio play
functions.
(xcdplayer was available from the 'from_ref' directory on agate)

At this time it is possible audio play is broken on cdroms and I will
be unable to fix it until I get one to test.
***IMPORTANT***
Cdrom audio is only suported at all for cdroms that use SCSI2 audio
definitions.

-------------media changer---------------
Once again courtesy of grefen@@convex.com (in germany)
I have not tested this but he assures me it's ready for testing.
If anyone has an exabyte tape changer or similar, 
contact the author for information regarding the control interface
and program.

WARNING: This has not been tested for a LONG TIME!


---------recent changes-----------
Removed all bitfields from machine independent sections to make
it possible for them to be used on big-endian architectures.

Removed scsi specific timeouts in favour of system timeout handling.

Many structures (getting more all the time) now dynamically allocated.

Addition of code in the tape driver to recognise models of drive that
have particular problems so they can be handled specially.

many bug-fixes and cleanups.

---------even more recent changes:--------

rewrote almost the entire thing..



------Mon Oct 11 22:20:25 WST 1993------

Code is now all KNF (or close to it).

A new structure has been introduced..
Called scsi_link, one of these exists for every bus/target/lun
that has a driver attached to it.
It has links to the adapter and to the driver, as well as status
information of global interest. (e.g. if the device is in use).
The use of this new structure has allowed the compaction of a
lot of duplicated code into a single copy (now in scsi_base.c)
and makes more simple the USER level scsi implimentation.

------Tue Feb 28 07:43:17 EST 1995-----
dufault@@hda.com: Redid configuration to support wired devices.
All driver entries now get bounced directly into the routines in
"scsi_driver" via a set of functions generated by the SCSI_ENTRIES macro
in scsi_conf.h.  This lets us put the common code in a single place.
@


1.9
log
@Reviewed by:	gibbs@@freefall.cdrom.com julian@@freefall.cdrom.com
1. Support for fixed device configuration
2. Hoisted common code to scsi_driver
3. SCSI busses dynamically allocated at boot
4. Reorg'd for LKMs
@
text
@@


1.9.8.1
log
@Bring my SCSI WIP in on a the 'SCSI' branch.  Full details of this checkin
can be found in the sys/scsi/README file.

Some portions of this code were obtained from NetBSD
@
text
@a203 120

------Thu Sep  5 23:27:18 PDT 1996-----
gibbs@@FreeBSD.org
1) Made a first pass over the data structures:
	There is still lots of work to be done on the current set of data
	structures.  My main changes were to remove obsolete fields, separate
	adapter reated information into a separate "adapter_link", and to
	create the scsi_queue structure.

2) Renamed flags and data structure members to lessen the differences
with Open/NetBSD:
	There are lots of gratuitous and some not so gratuitous
	differences between the two camps SCSI code.  I hope to bring the
	code bases closer together over the next month so that
	we can easily share controller drivers.
	
3) Changed how transfers are queued, started, and completed:
	The original scsi system has had a long standing problem with how
	queued transactions are handled.  The root of the problem comes
	from the policy of deferring the reservation of controller
	resources until way down in the controller scsi_cmd routine where
	we may not have a process context and thus cannot always sleep.
	With these patches, the scsi system relies almost entirely on queue
	management instead of sleeping to handle its resources.  More
	specifically, I've introduced a new data structure, the scsi_queue,
	that relates devices that share common controller resources.  A
	scsi_queue has "openings" as do the individual scsi_links.  A
	scsi_link is on the scsi_queue's run queue only when it has spare
	openings and work to do.  When running a scsi_queue, the scsi_links
	are handled in round-robin fashion with each link allowed to send
	a single transaction per round.  Before a transaction is dequeued,
	controller resources are obtained through adapter->get_cdb and
	attached to the scsi_xfer structure.  get_cdb and free_cdb
	are two entry points provided by the controller drivers that
	encapsulate controller resource management.  They should
	never be called directly by the controller driver (the wd7000 
	driver is the only current exception to this rule).  Transaction
	ordering is also maintained by locking the scsi_link off the run
	queue until the controller drivers completes queueing the command.
	This strategy should yield greater performance since a freed
	controller resource can start any scsi_link attached to that
	device instead of only attempting to start pending transactions on
	the device that just completed a transaction.  The round-robin scheme
	also ensures resource fairness when devices with multiple openings
	compete for a small number of resources.  The scheduling algorithm
	should be changed to support real-time priorities.  The scsi_queue
	structure is an opaque type to the controller drivers to make this
	easier to accomplish.

4) Centralized error handling and "done" processing:
	The scsi_cmd entry point now returns void.  The controller drivers
	now exclusively use scsi_done() along with a properly set
	scsi_xfer->error to report errors.  This removes superflous code
	paths and duplicated code.

5) Commands are built directly in the scsi_xfer structure instead of on the
stack:
	The original design forced each and every command structure to be
	copied into the scsi_xfer by the scsi_scsi_cmd routine.  The 
	scsi_xfer is now obtained up front and the command built directly
	into the scsi_xfer->cmd_store.  The members of the scsi_xfer
	structure are filled in directly via an inline function,
	scsi_prepare_xs, instead of stuffing all of them on the stack to
	simply be assigned into the scsi_xfer by scsi_scsi_cmd.
	scsi_scsi_cmd has also been replaced by scsi_schedule_xs().

6) Converted individual controller resource management to use the queue(3)
macros.
	Many of the drivers performed complicated list manipulations that
	were simplified by using the queue macros.  The generic scsi layer's
	queue managment is also queue(3) based.

7) Removed error detection and reporting from the xxstart routines:
	The goal here is to make the xxstart routines as small and
	efficient as possible.  Error detection occurs in the strategy
	routine or in the sense handlers.  If an error is detected that
	may affect queued transactions, the new driver entry point
	clean_queue() is called to synchronously remove any entries that
	would have been gradually drained by the start routines in the past.

8) Added the complete driver entry point:
	The complete entry point is called as the last operation on a
	scsi_xfer before it is freed.  This is the place where device usage
	statistic hooks should be added.  In NetBSD, they have overloaded
	the scsi_done routine by adding an additional argument to serve
	this purpose which I think is the wrong approach.  Currently all
	disk type drivers have a complete routine using the old dk_* stat
	stuff.  Eventually I'd like to bring in NetBSD's disk status code
	which is much cleaner and provides more information.

9) Removed the async driver entry point:
	This entry point has never been used.

10) Brough in Jason Thorpe's ch driver.
	I haven't added the quirk entries for the supported changers yet,
	but we should probably invert the meaning of our quirks (probe
	multiple luns by default) first.

11) Set the lun in the second byte of CDBs.
	This was brought up on the NetBSD lists and the lack of setting it
	is probably the main reason for our code probing multiple luns on
	so many devices.  The SCSI-II spec allows for the lun to be set
	although it is "optional".

12) Removed the need for a static scsi_link prototype and dummy scsi_device
	entry in each controller driver.

13) Added tagged queueing support to the generic SCSI code and modified the
	aic7xxx driver to use it.  We now honor the B_ORDERED buffer flag
	and convert sync writes to async/ordered writes if the target device
	does tagged queueing.

14) Added proper, timeout based, retries for the XS_BUSY case.  We don't retry
	until either the timeout expires or the target successfully completes
	a command.  This should also be done for the QUEUE FULL condition, but
	that is NYI.

15) Brought in NetBSD's scsi_message.h file and converted the generic scsi
	scsi layer and the aic7xxx driver to use its constants instead of
	home grown ones.
@


1.8
log
@New version of scsi code from Julian
@
text
@d1 3
d199 5
a203 1

@


1.7
log
@Removed all patch kit headers, sccsid and rcsid strings, put $Id$ in, some
minor cleanup.  Added $Id$ to files that did not have any version info, etc
@
text
@d2 1
a2 1
(relative to the base of the kernel tree)
d4 47
d52 1
a52 1
MAKEDEV
a53 5
scsi
scsi/README
scsi/scsiconf.h
scsi/scsiconf.c
scsi/scsi_all.h
a54 33
scsi/scsi_disk.h
scsi/sd.c

sys/mtio.h (modified)
scsi/scsi_tape.h
scsi/st.c

sys/sgio.h
scsi/scsi_generic.h
scsi/sg.c /* port not complete */

sys/chio.h
scsi/scsi_changer.h
scsi/ch.c

sys/cdio.h
scsi/scsi_cd.h
scsi/cd.c

i386/conf/SCSITEST
i386/isa/aha1542.c

i386/conf/AHBTEST
i386/isa/aha1742.c

i386/conf/UHATEST
i386/isa/ultra14f.c

i386/conf/BTTEST
i386/isa/bt742a.c



d66 1
a66 1
Kodak IL900 scanner *
d68 1
a68 1
GENERIC SCSI DEVICES (user generated scsi commands) (port not complete)
d75 2
a76 2
bustec 742a (apparently works for VESA version)
adaptec 174x 
d78 1
a78 4
----------------------------------------------------------------


Work is proceeding on the following bottom end drivers:
a79 9
Future Domain (1680)**			hosler@@tfs.com & me
Future Domain (8  bit)****		rpr@@oce.nl
WD7000**				terry@@icarus.weber.edu
seagate st01/st02****			overby@@aspen.cray.com ?
----------------------------------------------------------------
* drivers not made public (proprietary.. proof that the concept works though)
** driver not yet released but working.
*** just a dream so far.
**** some amount more than just a dream so far.
d98 1
a98 2
BB LLL TTT  B= scsi bus number, T = target number, L = LUN.
(yes I know it's strange but it's SGI compatible)
d105 4
a109 4
--------------getting started------------
It should be possible to use the /dev entries for as0 as if they were 
/dev entries for sd0 and the old as bootblocks should
continue to work if you are using an adaptec 1542b.
d119 1
a119 19

The tape devices are as follows:
rst0	basic raw device, will rewind on close
nrst0	will not rewind on close
erst0	will rewind and EJECTon close
nerst0  will not rewind and WILL eject (some devices may rewind anyhow)

------------future enhancements--------------
Some people have indicated that they would like to have the SCSI ID
encoded into the minor number in some way, and
this may be supported at some timein the future, using
minor numbers greater than 128. (or maybe a different major number)


I will also be writing (probably) a generic scsi-error
handling routine that will be table driven, so that the routine can
be removed from each individual driver. With enough care,
two similar devices with different error codes (quite common) could run
the same driver but use different error tables.
d140 1
d144 1
a144 1
grefen@@wilbur.zdv.uni-mainz.de has completed the audio play
d150 3
d155 1
a155 1
Once again courtesy of grefen@@wilbur.zdv.uni-mainz.de.
a162 13
-----------booting from an AHA-174x---------
For some reason I have not yet worked out,
the BIOS-based bootblocks I have posted will not boot
from the aha1742 in extended mode. (it can't be serious
because the MACH version works) This is in fact not a 
problem because the aha1742 driver will force the board into extended
mode during probe, so it can be left in standard mode during the boot.
During the next reboot, the bios will place it back in standard mode
ready for the NEXT boot.

[Update: This has apparently been fixed in the newest NetBSD/FreeBSD
releases ]

a163 1

d177 20
a196 1
$Id$
@


1.6
log
@Bring README into sync with Julians latest README (1 line deleted which was
a reference to README.AHA1742)
@
text
@d208 2
@


1.5
log
@Revised drivers from Julian.  Support for generic scsi.  Fixed scsi tape (st.c)
problems with respect to multiple tar files on one tape.  Now uses malloc
of data structures to reduce static kernel size.
@
text
@a34 1
README.AHA1742
@


1.4
log
@Fixed printf's so that they announce them selfs correctly (ie aha%d: before
every error message and every probe message).
@
text
@d16 1
d20 4
d60 1
d67 1
a67 1
bustec 742a
d69 1
a69 1
Ultrastore 14f				
d99 6
d137 1
d161 1
a161 1
placed in sys/cdio and sys/chio (based after sys/mtio for
d168 1
a168 3
He tells me he has some Public Domain package that
allows an control of the cd player from an Xwindow
but I don't have it.
d170 3
d180 2
d192 17
@


1.3
log
@Update scsi code to the latest from Julian.  This code is now identical
to the last copy from Julian.  After this commit I will be commiting the
local fixes and makeing diffs to send back to Julian so he can update his
code.

----
From julian@@jules.DIALix.oz.au  Thu Aug  5 09:25:23 1993
To: hd@@world.std.com, julian@@jules.DIALix.oz.au
Cc: nate@@bsd.coe.montana.edu
Subject: Re: new scsi

----
From julian@@jules.DIALix.oz.au  Sat Aug  7 04:13:17 1993
To: hd@@world.std.com (HD Associates)
Cc: nate@@bsd.coe.montana.edu
Subject: Re: timeout diffs

Here are the diffs to take the scsi stuff to my latest tree from what
Nate and you received..

the changes remove all the local timeout stuff and use (un)timeout(),

----
From julian@@jules.DIALix.oz.au  Sat Aug  7 04:13:45 1993
To: hd@@world.std.com (HD Associates)
Cc: nate@@bsd.coe.montana.edu, briggs@@csugrad.cs.vt.edu

here is a fix for a silly bug in the scsiconf I just sent out
and a similar fix for st.c
@
text
@a0 7
 *
 * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
 * --------------------         -----   ----------------------
 * CURRENT PATCH LEVEL:         1       00098
 * --------------------         -----   ----------------------
 *
 * 16 Feb 93	Julian Elischer		ADDED for SCSI system
@


1.2
log
@Removed PATCHKIT headers and updated our sources to Julian's with
our patches back in.  Major changes to the Bustek driver and the
Tape driver, the rest are minor.
@
text
@d1 7
@


1.1
log
@Initial revision
@
text
@a0 7
 *
 * PATCHES MAGIC                LEVEL   PATCH THAT GOT US HERE
 * --------------------         -----   ----------------------
 * CURRENT PATCH LEVEL:         1       00098
 * --------------------         -----   ----------------------
 *
 * 16 Feb 93	Julian Elischer		ADDED for SCSI system
@


1.1.1.1
log
@Initial import, 0.1 + pk 0.2.4-B1
@
text
@@
