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.
This commit is contained in:
Rodney W. Grimes 1993-08-28 03:08:59 +00:00
parent 6526fb8330
commit a3e4335498
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345
8 changed files with 1688 additions and 1296 deletions

View File

@ -13,9 +13,14 @@ scsi/scsi_all.h
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
@ -52,15 +57,16 @@ AEG Character recognition devices *
Calera Character recognition devices *
Kodak IL900 scanner *
Exabyte tape changer device.
GENERIC SCSI DEVICES (user generated scsi commands) (port not complete)
----------------------------------------------------------------
There are also working bottom end drivers for:
----------------------------------------------------------------
adaptec 1542 (and 1742 in 1542 mode)
bustec 742a
bustec 742a (apparently works for VESA version)
adaptec 174x
Ultrastore 14f
Ultrastore 14f (works for 34f (VESA version))
----------------------------------------------------------------
@ -90,6 +96,12 @@ e.g. the first tape found will become st0 (minor number 0)
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 LLL TTT B= scsi bus number, T = target number, L = LUN.
(yes I know it's strange but it's SGI compatible)
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)
@ -122,6 +134,7 @@ 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,
@ -145,16 +158,17 @@ scsi-changer.h commands medium changer devices --- CHAPTER 16
---------ioctl definitions-------------
User accessable structures (e.g. ioctl definitions) have been
placed in sys/cdio and sys/chio (based after sys/mtio for
placed in sys/cdio, sys/sgio and sys/chio (based after sys/mtio for
the ioctls for mag tapes (including st).
-----------cd-rom-----------------
The cd rom driver ha been tested by a number of people and
grefen@wilbur.zdv.uni-mainz.de has completed the audio play
functions.
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.
(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.
-------------media changer---------------
Once again courtesy of grefen@wilbur.zdv.uni-mainz.de.
@ -163,6 +177,8 @@ 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!
-----------booting from an AHA-174x---------
For some reason I have not yet worked out,
the BIOS-based bootblocks I have posted will not boot
@ -173,3 +189,20 @@ 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 ]
---------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.

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id$
* $Id: cd.c,v 1.6 93/08/26 21:09:07 julian Exp Locker: julian $
*/
#define SPLCD splbio
@ -115,8 +115,6 @@ struct scsi_switch *scsi_switch;
struct cd_parms *dp;
unit = next_cd_unit++;
cd = cd_data + unit;
dp = &(cd->params);
if(scsi_debug & PRINTROUTINES) printf("cdattach: ");
/*******************************************************\
* Check we have the resources for another drive *
@ -127,6 +125,8 @@ struct scsi_switch *scsi_switch;
(unit + 1),NCD);
return(0);
}
cd = cd_data + unit;
dp = &(cd->params);
/*******************************************************\
* Store information needed to contact our base driver *
\*******************************************************/
@ -713,6 +713,27 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag)
));
}
break;
case CDIOCPLAYMSF:
{
struct ioc_play_msf *args
= (struct ioc_play_msf *)addr;
struct cd_mode_data data;
if(error = cd_get_mode(unit,&data,AUDIO_PAGE))
break;
data.page.audio.flags &= ~CD_PA_SOTC;
data.page.audio.flags |= CD_PA_IMMED;
if(error = cd_set_mode(unit,&data))
break;
return(cd_play_msf(unit
,args->start_m
,args->start_s
,args->start_f
,args->end_m
,args->end_s
,args->end_f
));
}
break;
case CDIOCPLAYBLOCKS:
{
struct ioc_play_blocks *args
@ -1182,6 +1203,31 @@ int unit,strack,sindex,etrack,eindex;
return(retval);
}
/*******************************************************\
* Get scsi driver to send a "play msf" command *
\*******************************************************/
cd_play_msf(unit,startm,starts,startf,endm,ends,endf)
int unit,startm,starts,startf,endm,ends,endf;
{
struct scsi_play_msf scsi_cmd;
bzero(&scsi_cmd, sizeof(scsi_cmd));
scsi_cmd.op_code = PLAY_MSF;
scsi_cmd.start_m=startm;
scsi_cmd.start_s=starts;
scsi_cmd.start_f=startf;
scsi_cmd.end_m=endm;
scsi_cmd.end_s=ends;
scsi_cmd.end_f=endf;
return (cd_scsi_cmd(unit,
&scsi_cmd,
sizeof(scsi_cmd),
0,
0,
2000,
0));
}
/*******************************************************\
* Get scsi driver to send a "start up" command *
\*******************************************************/
cd_pause(unit,go)

61
sys/scsi/scsi_generic.h Normal file
View File

@ -0,0 +1,61 @@
#ifndef _SCSI_GENERIC_H_
#define _SCSI_GENERIC_H_
/*
* Contributed by HD Associates (hd@world.std.com).
* Copyright (c) 1992, 1993 HD Associates
*
* Berkeley style copyright. I've just snarfed it out of stdio.h:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
/* generic SCSI header file. We use the same minor number format
* as on SGI except that the flag bits aren't available because they
* are used as the board index.
*
* The minor number format is:
* FF UUU III (FFUU UIII)
*
* Where:
* FF is the board index
* UUU are the LUN
* III is the SCSI ID (controller)
*/
#define G_SCSI_FLAG(DEV) (((DEV) & 0xC0) >> 6)
#define G_SCSI_UNIT(DEV) G_SCSI_FLAG(DEV)
#define G_SCSI_LUN(DEV) (((DEV) & 0x38) >> 3)
#define G_SCSI_ID(DEV) ((DEV) & 0x7)
#define G_SCSI_MINOR(FLAG, LUN, ID) \
(((FLAG) << 6) | ((LUN) << 3) | (ID))
#endif /* _SCSI_GENERIC_H_ */

View File

@ -16,15 +16,21 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id$
*/
/*
* SCSI command format
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id: scsi_tape.h,v 1.7 93/08/26 21:09:32 julian Exp Locker: julian $
*/
/*
* SCSI command formats
*/
struct scsi_rw_tape
{
u_char op_code;
@ -183,6 +189,7 @@ struct blk_desc_cipher
#define HALFINCH_800 0x01
#define HALFINCH_1600 0x02
#define HALFINCH_6250 0x03
#define QIC_11 0x04 /* from Archive 150S Theory of Op. XXX */
#define QIC_24 0x05 /* may be bad, works for CIPHER ST150S XXX */
#define QIC_120 0x0f
#define QIC_150 0x10

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id$
* $Id: scsiconf.c,v 1.6 93/08/26 21:09:39 julian Exp Locker: julian $
*/
#include <sys/types.h>
@ -22,6 +22,7 @@
#include "sd.h"
#include "ch.h"
#include "cd.h"
#include "sg.h"
#ifdef MACH
#include <i386/machparam.h>
@ -231,12 +232,12 @@ struct scsi_switch *scsi_switch;
}
targ++;
}
#if NGENSCSI > 0
#if NSG > 0
/***************************************************************\
* If available hook up the generic scsi driver, letting it *
* know which target is US. (i.e. illegal or at least special) *
\***************************************************************/
genscsi_attach(unit,scsi_addr,0,scsi_switch);
sg_attach(unit,scsi_addr,scsi_switch);
#endif
scsibus++; /* next time we are on the NEXT scsi bus */
}
@ -449,7 +450,7 @@ int *maybe_more;
strncpy(model,"unknown",16);
strncpy(version,"????",4);
}
printf("%s%d targ %d lun %d: type %d(%s) %s <%s%s%s> SCSI%d\n"
printf("%s%d targ %d lun %d: type %d(%s) %s SCSI%d\n"
,scsi_switch->name
,unit
,target
@ -457,14 +458,20 @@ int *maybe_more;
,type
,dtype
,remov?"removable":"fixed"
,inqbuf.version & SID_ANSII
);
printf("%s%d targ %d lun %d: <%s%s%s>\n"
,scsi_switch->name
,unit
,target
,lu
,manu
,model
,version
,inqbuf.version & SID_ANSII
);
if(qtype[0])
{
printf("%s%d targ %d lun %d: qulaifier %d(%s)\n"
printf("%s%d targ %d lun %d: qualifier %d(%s)\n"
,scsi_switch->name
,unit
,target

View File

@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
* $Id$
* $Id: scsiconf.h,v 1.3 93/08/26 21:09:43 julian Exp Locker: julian $
*/
/***********************************************\
@ -24,18 +24,18 @@
\***********************************************/
struct scsi_switch
{
char *name; /* name of scsi bus controller */
int (*scsi_cmd)();
void (*scsi_minphys)();
int (*open_target_lu)();
int (*close_target_lu)();
long int (*adapter_info)(); /* see definitions below */
u_long spare[3];
char *name; /* name of scsi bus controller */
u_long spare[2];
};
#define AD_INF_MAX_CMDS 0x000000FF /* maximum number of entries
queuable to a device by
the adapter */
/* 24 bits of other adapter charcteristics go here */
/* 24 bits of other adapter characteristics go here */
/***********************************************\
* The scsi debug control bits *
@ -57,6 +57,7 @@ extern int scsi_debug;
#define TRY_AGAIN_LATER 1
#define COMPLETE 2
#define HAD_ERROR 3
#define ESCAPE_NOT_SUPPORTED 4
struct scsi_xfer
{
@ -78,6 +79,13 @@ struct scsi_xfer
int error;
struct buf *bp;
struct scsi_sense_data sense;
/* Believe it or not, Some targets fall on the ground with
* anything but a certain sense length.
*/
int req_sense_length; /* Explicit request sense length */
int status; /* SCSI status */
};
/********************************/
/* Flag values */
@ -94,6 +102,17 @@ struct scsi_xfer
#define SCSI_DATA_IN 0x400 /* expect data to come INTO memory */
#define SCSI_DATA_OUT 0x800 /* expect data to flow OUT of memory */
#define SCSI_TARGET 0x1000 /* This defines a TARGET mode op. */
#define SCSI_ESCAPE 0x2000 /* Escape operation */
/*************************************************************************/
/* Escape op codes. This provides an extensible setup for operations */
/* that are not scsi commands. They are intended for modal operations. */
/*************************************************************************/
#define SCSI_OP_TARGET 0x0001
#define SCSI_OP_RESET 0x0002
#define SCSI_OP_BDINFO 0x0003
/********************************/
/* Error values */
/********************************/

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff