From: tatsuro@sra.CO.JP (Tatsuro Nakamura)
Subject: Re: [Q]HDD
	<1ie62tINNjea@lachesis.rokugo.co.jp>
Organization: Software Research Associates, Inc., Japan
Date: Wed, 6 Jan 1993 10:44:29 GMT
Distribution: fj

In article <1ie62tINNjea@lachesis.rokugo.co.jp>
		 masuda@rokugo.CO.JP (Yoshihiro Masuda) writes:

 > $B!V(B100M $B$N(BIDE $B$rGc$C$F!"(BFuture domain $BMQ$N(B scsi $B%I%i%$%P!<$r(B$B=q$/!W$H(B
 > $B8@$&A*Br$b;D$5$l$F$$$k$N$G!"$3$l$rA*Br$9$k$H3'$K4n$P$l$k$+(B$B$bCN$l$J$$(B
 > $B$3$H$rIU$12C$($F$*$-$^$9!#(B:-P

  $B$3$&$$$&$N$r;}$C$F$$$^$9(B$B!#(B

Newsgroups: comp.unix.bsd
From: overby@cray.com (Glen Overby)
Subject: [Source] Seagate ST01/ST02 SCSI driver
Summary: source for sys.i386bsd/i386/isa/st01-[1s].[cs]
Organization: Yuppie suburbs
Date: 1 Nov 92 15:41:43 CST

/*
   This is a re-release of my Seagate (and maybe Future Domain) driver for 0.1
   The README describes it all.

   I've deposited a copy on agate in incoming/ST01.shar
 */

--- README ---
History:
5/28/92		First release of my ST-01 driver: works on 386BSD 0.0
10/31/92	Second release for 0.1 and assmebly-level copy

Hardware:

This driver is written to support a Seagate ST-01/ST-02 controler.  This
is supposedly a re-labeled Future Domain (unsure what model number).  If
you are successful using it with a Future Domain (or if you're not), 
please tell me.

The Seagate ST-01 is a simiple non-DMA SCSI host adapter which resides
entirely in memory (no I/O space is taken).  

It uses interrupts (IRQ3 or IRQ5) to notify the CPU of a reconnect from target,
and will insert wait-states durring data in/out phases to synchronize the host
CPU with the SCSI device.

You may configure the board to reside at any of it's possible addresses and
interrupt numbers (just be sure they match your configuration file).  If you
plan to use the assembly-level copy routines, you MUST enable the 0WS 
(wait-state) jumper.

If you do NOT have an ISA disk drive, you should disable the IDA disk register,
otherwise the wd driver will think that there is a WD controler available.

				Jumpers

ST-01B 			ST-02
Jumper/Connector				Description

	W1		JP1			BIOS address selection
	W2		JP2			0WS Enable
	W3		JP3			IRQ Enable
			JP6			Register Enable/Disable
	W5		J7			Channel Activity LED connector
	J2		J2			50-pin SCSI connector
	J3		J6			Drive power connector

Source: Seagate ST01/ST02 Product Manual, Rev. G  Pub No. 36027-002

The Driver

The code to talk to the ST-01 controler itself is derived from a
driver for Microport System V/386 Copyright 1988 by by Tatu Yl|nen
with BSD-specific driver code liberally stolen from sys/vax/uda/uba.c
and sys/i386/isa/wd.c.

INSTALLATION

Copy st01-1.c to src/sys/i386/isa
Copy st01-s.s to src/sys/i386/isa

add the following to your configuration file:

controler	sg0  at isa? bio irq 5 iomem 0xC8000 iosiz 0x2000 vector sgintr
disk		dk8  at sg0 drive 0

This assumes your controler is at the first ST01 address and uses IRQ5.

NOTE: Interrupts MUST be enabled on the card!  The factory setting
does not enable interrupts.

If you do NOT enable interrupts, you must go into the code and disable the
driver's use of SCSI disconnects (which certainly can't hurt performance
if you have one device).

add to src/sys/i386/conf/files.i386:

i386/isa/st01-1.c		optional sg device-driver
i386/isa/st01-s.s		optional sg device-driver

add the driver to src/sys/i386/i386/conf.c (conf.c.diff)

Check the driver source (st01-1.c) for the proper definition of "ASM":
defined if you want to use the assembly-level data copy, undefined otherwise.
If you have problems, undefine it.

configure your system with 'config'.

Manually edit "swap386bsd.c" to add a swap space entry:

struct	swdevt swdevt[] = {
	{ makedev(5, 1),	0,	0 },	/* sg0b */
	{ makedev(0, 1),	0,	0 },	/* wd0b */
	{ 0, 0, 0 }
};

this is requred because 'config' doesn't recognise 'sg' on the 'swap' 
parameter.

finally, compile your new system!

LIMITATIONS

I have only tested the code with one SCSI target, a Seagate ST-296N
80MB hard drive, allthough there is nothing in the code intended to
prevent it from working with a full bus.  This probably won't work for 
cartridge tape drives.

PROBLEMS

The config code for 386BSD does not do anything with 'disk'
definitions.  This should be changed to be like what a VAX does and
define a structure for each disk.  Then the device driver will get a
isa_device structure for each configured SCSI target.

FUTURE PLANS

I think the code that handles the low-level SCSI bus handling is
inefficient and rather grody (too many gotos for my liking).  I have
begun sketching out a completely new low-level interface.  I'll make it
part of Julian's generic SCSI system.

Glen Overby
overby@plains.nodak.edu / overby@{cobber,nic}.cord.edu / overby@cray.com

--
	$BCfB<C#O/!w4D6-;Y1gIt!%#S#R#A(B
		tatsuro@sra.co.jp