summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
Diffstat (limited to 'sys/scsi')
-rw-r--r--sys/scsi/cd.c31
-rw-r--r--sys/scsi/ch.c10
-rw-r--r--sys/scsi/scsi_base.c39
-rw-r--r--sys/scsi/scsi_ioctl.c10
-rw-r--r--sys/scsi/scsiconf.c6
-rw-r--r--sys/scsi/scsiconf.h4
-rw-r--r--sys/scsi/sd.c9
-rw-r--r--sys/scsi/st.c18
-rw-r--r--sys/scsi/uk.c5
9 files changed, 74 insertions, 58 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index 46e9e3b..2fe220a 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: cd.c,v 1.12 1993/11/18 05:02:46 rgrimes Exp $
+ * $Id: cd.c,v 1.13 1993/11/25 01:37:28 wollman Exp $
*/
#define SPLCD splbio
@@ -40,11 +40,18 @@
#include <scsi/scsi_disk.h> /* rw_big and start_stop come from there */
#include <scsi/scsiconf.h>
+/* static function prototypes */
+static errval cd_get_parms(int, int);
+static errval cd_get_mode(u_int32, struct cd_mode_data *, u_int32);
+static errval cd_set_mode(u_int32 unit, struct cd_mode_data *);
+static errval cd_read_toc(u_int32, u_int32, u_int32, struct cd_toc_entry *,
+ u_int32);
+
+
int32 cdstrats, cdqueues;
#include <ddb.h>
#if NDDB > 0
-int Debugger();
#else /* NDDB > 0 */
#define Debugger()
#endif /* NDDB > 0 */
@@ -59,7 +66,6 @@ int Debugger();
#define RAW_PART 3
#define UNIT(z) ( (minor(z) >> UNITSHIFT) )
-extern int hz;
errval cdstrategy();
void cdstart();
@@ -509,7 +515,7 @@ cdstart(unit)
*/
bzero(&cmd, sizeof(cmd));
cmd.op_code = READ_BIG;
- cmd.addr_3 = (blkno & 0xff000000) >> 24;
+ cmd.addr_3 = (blkno & 0xff000000UL) >> 24;
cmd.addr_2 = (blkno & 0xff0000) >> 16;
cmd.addr_1 = (blkno & 0xff00) >> 8;
cmd.addr_0 = blkno & 0xff;
@@ -680,12 +686,14 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag)
}
break;
case CDIOREADTOCHEADER:
- {
+ { /* ??? useless bcopy? XXX */
struct ioc_toc_header th;
- if (error = cd_read_toc(unit, 0, 0, &th, sizeof(th)))
+ if (error = cd_read_toc(unit, 0, 0,
+ (struct cd_toc_entry *)&th,
+ sizeof th))
break;
th.len = (th.len & 0xff) << 8 + ((th.len >> 8) & 0xff);
- bcopy(&th, addr, sizeof(th));
+ bcopy(&th, addr, sizeof th);
}
break;
case CDIOREADTOCENTRYS:
@@ -971,7 +979,7 @@ cd_size(unit, flags)
/*
* Get the requested page into the buffer given
*/
-errval
+static errval
cd_get_mode(unit, data, page)
u_int32 unit;
struct cd_mode_data *data;
@@ -1218,10 +1226,11 @@ cd_read_subchannel(unit, mode, format, track, data, len)
/*
* Read table of contents
*/
-errval
+static errval
cd_read_toc(unit, mode, start, data, len)
- u_int32 unit, mode, start, len;
+ u_int32 unit, mode, start;
struct cd_toc_entry *data;
+ u_int32 len;
{
struct scsi_read_toc scsi_cmd;
errval error;
@@ -1256,7 +1265,7 @@ cd_read_toc(unit, mode, start, data, len)
* Get the scsi driver to send a full inquiry to the device and use the
* results to fill out the disk parameter structure.
*/
-errval
+static errval
cd_get_parms(unit, flags)
int unit;
int flags;
diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c
index fd7b1eb..ceec9d2 100644
--- a/sys/scsi/ch.c
+++ b/sys/scsi/ch.c
@@ -2,7 +2,7 @@
* Written by grefen@?????
* Based on scsi drivers by Julian Elischer (julian@tfs.com)
*
- * $Id: ch.c,v 1.5 1993/11/18 05:02:48 rgrimes Exp $
+ * $Id: ch.c,v 1.6 1993/11/25 01:37:31 wollman Exp $
*/
#include <sys/types.h>
@@ -22,6 +22,8 @@
#include <scsi/scsi_changer.h>
#include <scsi/scsiconf.h>
+static errval ch_mode_sense(u_int32, u_int32);
+
struct scsi_xfer ch_scsi_xfer[NCH];
u_int32 ch_xfer_block_wait[NCH];
@@ -233,7 +235,7 @@ chioctl(dev, cmd, arg, mode)
unit = UNIT(dev);
sc_link = ch_data[unit].sc_link;
- switch (cmd) {
+ switch ((int)cmd) {
case CHIOOP:{
struct chop *ch = (struct chop *) arg;
SC_DEBUG(sc_link, SDEV_DB2,
@@ -384,7 +386,7 @@ ch_position(unit, stat, chm, to, flags)
* device and use the results to fill out the global
* parameter structure.
*/
-errval
+static errval
ch_mode_sense(unit, flags)
u_int32 unit, flags;
{
@@ -449,7 +451,7 @@ ch_mode_sense(unit, flags)
u_int32 pc = (*b++) & 0x3f;
u_int32 pl = *b++;
u_char *bb = b;
- switch (pc) {
+ switch ((int)pc) {
case 0x1d:
ch_data[unit].chmo = p2copy(bb);
ch_data[unit].chms = p2copy(bb);
diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c
index da9c2b4..2b4e9e9 100644
--- a/sys/scsi/scsi_base.c
+++ b/sys/scsi/scsi_base.c
@@ -8,13 +8,13 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
- * $Id: scsi_base.c,v 1.1 1993/11/18 05:02:51 rgrimes Exp $
+ * $Id: scsi_base.c,v 1.2 1993/11/25 06:30:58 davidg Exp $
*/
#define SPLSD splbio
#define ESUCCESS 0
-#include <sys/types.h>
#include <sys/param.h>
+#include "systm.h"
#include <sys/buf.h>
#include <sys/uio.h>
#include <sys/malloc.h>
@@ -23,6 +23,9 @@
#include <scsi/scsi_disk.h>
#include <scsi/scsiconf.h>
+static errval sc_err1(struct scsi_xfer *);
+static errval scsi_interpret_sense(struct scsi_xfer *);
+
#ifdef NetBSD
#ifdef DDB
int Debugger();
@@ -30,9 +33,8 @@ int Debugger();
#define Debugger()
#endif /* DDB */
#else /* NetBSD */
-#include <ddb.h>
+#include "ddb.h"
#if NDDB > 0
-int Debugger();
#else /* NDDB > 0 */
#define Debugger()
#endif /* NDDB > 0 */
@@ -70,7 +72,7 @@ get_xs(sc_link, flags)
return 0;
}
sc_link->flags |= SDEV_WAITING;
- sleep(sc_link, PRIBIO);
+ tsleep((caddr_t)sc_link, PRIBIO, "scsiget", 0);
}
sc_link->opennings--;
if (xs = next_free_xs) {
@@ -110,7 +112,7 @@ free_xs(xs, sc_link, flags)
/* if was 0 and someone waits, wake them up */
if ((!sc_link->opennings++) && (sc_link->flags & SDEV_WAITING)) {
sc_link->flags &= ~SDEV_WAITING;
- wakeup(sc_link); /* remember, it wakes them ALL up */
+ wakeup((caddr_t)sc_link); /* remember, it wakes them ALL up */
} else {
if (sc_link->device->start) {
SC_DEBUG(sc_link, SDEV_DB2, ("calling private start()\n"));
@@ -347,7 +349,7 @@ scsi_done(xs)
* the upper level code to handle error checking
* rather than doing it here at interrupt time
*/
- wakeup(xs);
+ wakeup((caddr_t)xs);
return;
}
/*
@@ -409,7 +411,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
xs->resid = datalen;
xs->bp = bp;
/*XXX*/ /*use constant not magic number */
- if (datalen && ((caddr_t) data_addr < (caddr_t) 0xfe000000)) {
+ if (datalen && ((caddr_t) data_addr < (caddr_t) 0xfe000000UL)) {
if (bp) {
printf("Data buffered space not in kernel context\n");
#ifdef SCSIDEBUG
@@ -420,7 +422,7 @@ scsi_scsi_cmd(sc_link, scsi_cmd, cmdlen, data_addr, datalen,
}
xs->data = malloc(datalen, M_TEMP, M_WAITOK);
/* I think waiting is ok *//*XXX */
- switch (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
+ switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) {
case 0:
printf("No direction flags, assuming both\n");
#ifdef SCSIDEBUG
@@ -466,8 +468,9 @@ retry:
if (bp)
return retval; /* will sleep (or not) elsewhere */
s = splbio();
- while (!(xs->flags & ITSDONE))
- sleep(xs, PRIBIO + 1);
+ while (!(xs->flags & ITSDONE)) {
+ tsleep((caddr_t)xs, PRIBIO + 1, "scsicmd", 0);
+ }
splx(s);
/* fall through to check success of completed command */
case COMPLETE: /* Polling command completed ok */
@@ -493,7 +496,7 @@ retry:
* and free the memory buffer
*/
if (datalen && (xs->data != data_addr)) {
- switch (flags & (SCSI_DATA_IN | SCSI_DATA_OUT)) {
+ switch ((int)(flags & (SCSI_DATA_IN | SCSI_DATA_OUT))) {
case 0:
case SCSI_DATA_IN | SCSI_DATA_OUT: /* weird */
case SCSI_DATA_IN:
@@ -516,7 +519,7 @@ bad:
return (retval);
}
-errval
+static errval
sc_err1(xs)
struct scsi_xfer *xs;
{
@@ -531,7 +534,7 @@ sc_err1(xs)
* errors at inetrrupt time. We have probably
* been called by scsi_done()
*/
- switch (xs->error) {
+ switch ((int)xs->error) {
case XS_NOERROR: /* nearly always hit this one */
retval = ESUCCESS;
if (bp) {
@@ -560,6 +563,8 @@ sc_err1(xs)
case XS_BUSY:
/*should somehow arange for a 1 sec delay here (how?) */
+ /* XXX tsleep(&localvar, priority, "foo", hz);
+ that's how! */
case XS_TIMEOUT:
/*
* If we can, resubmit it to the adapter.
@@ -593,7 +598,7 @@ retry:
*
* THIS IS THE DEFAULT ERROR HANDLER
*/
-errval
+static errval
scsi_interpret_sense(xs)
struct scsi_xfer *xs;
{
@@ -680,7 +685,7 @@ scsi_interpret_sense(xs)
sc_print_addr(sc_link);
printf("%s", error_mes[key - 1]);
if (sense->error_code & SSD_ERRCODE_VALID) {
- switch (key) {
+ switch ((int)key) {
case 0x2: /* NOT READY */
case 0x5: /* ILLEGAL REQUEST */
case 0x6: /* UNIT ATTENTION */
@@ -696,7 +701,7 @@ scsi_interpret_sense(xs)
}
printf("\n");
}
- switch (key) {
+ switch ((int)key) {
case 0x0: /* NO SENSE */
case 0x1: /* RECOVERED ERROR */
if (xs->resid == xs->datalen)
diff --git a/sys/scsi/scsi_ioctl.c b/sys/scsi/scsi_ioctl.c
index 0e50b49..01bacf1 100644
--- a/sys/scsi/scsi_ioctl.c
+++ b/sys/scsi/scsi_ioctl.c
@@ -6,9 +6,9 @@
*
*
*/
-#include <sys/types.h>
-#include <sys/errno.h>
#include <sys/param.h>
+#include "systm.h"
+#include <sys/errno.h>
#include <sys/malloc.h>
#include <sys/buf.h>
#define b_screq b_driver1 /* a patch in buf.h */
@@ -57,7 +57,7 @@ struct scsi_xfer *xs;
SC_DEBUG(xs->sc_link,SDEV_DB2,("user-done\n"));
screq->retsts = 0;
screq->status = xs->status;
- switch(xs->error) {
+ switch((int)xs->error) {
case XS_NOERROR:
SC_DEBUG(xs->sc_link,SDEV_DB3,("no error\n"));
screq->datalen_used = xs->datalen - xs->resid; /* probably rubbish */
@@ -238,7 +238,7 @@ errval scsi_do_ioctl(struct scsi_link *sc_link, int cmd, caddr_t addr, int f)
caddr_t d_addr;
int len;
- if((unsigned int)screq < (unsigned int)0xfe000000)
+ if((unsigned int)screq < (unsigned int)0xfe000000UL)
{
screq = malloc(sizeof(scsireq_t),M_TEMP,M_WAITOK);
bcopy(screq2,screq,sizeof(scsireq_t));
@@ -269,7 +269,7 @@ errval scsi_do_ioctl(struct scsi_link *sc_link, int cmd, caddr_t addr, int f)
ret = bp->b_error;
}
free(bp,M_TEMP);
- if((unsigned int)screq2 < (unsigned int)0xfe000000)
+ if((unsigned int)screq2 < (unsigned int)0xfe000000UL)
{
bcopy(screq,screq2,sizeof(scsireq_t));
free(screq,M_TEMP);
diff --git a/sys/scsi/scsiconf.c b/sys/scsi/scsiconf.c
index 708cc7c..9e2dfef 100644
--- a/sys/scsi/scsiconf.c
+++ b/sys/scsi/scsiconf.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: scsiconf.c,v 2.6 93/10/24 12:43:51 julian Exp Locker: julian $
+ * $Id: scsiconf.c,v 1.7 1993/11/18 05:02:58 rgrimes Exp $
*/
#include <sys/types.h>
@@ -485,7 +485,7 @@ scsi_probedev(sc_link, maybe_more)
* is vendor specific and won't match in this switch.
*/
- switch (qualifier) {
+ switch ((int)qualifier) {
case SID_QUAL_LU_OK:
qtype = "";
break;
@@ -517,7 +517,7 @@ scsi_probedev(sc_link, maybe_more)
break;
}
if (dtype == 0) {
- switch (type) {
+ switch ((int)type) {
case T_DIRECT:
dtype = "direct";
break;
diff --git a/sys/scsi/scsiconf.h b/sys/scsi/scsiconf.h
index 856fe89..018d019 100644
--- a/sys/scsi/scsiconf.h
+++ b/sys/scsi/scsiconf.h
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: scsiconf.h,v 2.4 93/10/16 00:59:13 julian Exp Locker: julian $
+ * $Id: scsiconf.h,v 1.7 1993/11/18 05:02:59 rgrimes Exp $
*/
#ifndef SCSI_SCSICONF_H
#define SCSI_SCSICONF_H 1
@@ -242,5 +242,7 @@ void show_mem(unsigned char * , u_int32);
void lto3b __P((int val, u_char *bytes));
int _3btol __P((u_char *bytes));
+extern void sc_print_addr(struct scsi_link *);
+
#endif /*SCSI_SCSICONF_H*/
/* END OF FILE */
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index 660d194..b543631 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.12 1993/11/18 05:03:02 rgrimes Exp $
+ * $Id: sd.c,v 1.13 1993/11/25 01:37:34 wollman Exp $
*/
#define SPLSD splbio
@@ -48,9 +48,8 @@ int Debugger();
#else /* NetBSD */
#include <ddb.h>
#if NDDB > 0
-int Debugger();
#else /* NDDB > 0 */
-#define Debugger()
+#define Debugger(s)
#endif /* NDDB > 0 */
#endif
@@ -271,7 +270,7 @@ sdopen(dev)
if (sd->params.secsiz != SECSIZE) { /* XXX One day... */
printf("sd%d: Can't deal with %d bytes logical blocks\n",
unit, sd->params.secsiz);
- Debugger();
+ Debugger("sd");
errcode = ENXIO;
goto bad;
}
@@ -516,7 +515,7 @@ sdstart(unit)
bzero(&cmd, sizeof(cmd));
cmd.op_code = (bp->b_flags & B_READ)
? READ_BIG : WRITE_BIG;
- cmd.addr_3 = (blkno & 0xff000000) >> 24;
+ cmd.addr_3 = (blkno & 0xff000000UL) >> 24;
cmd.addr_2 = (blkno & 0xff0000) >> 16;
cmd.addr_1 = (blkno & 0xff00) >> 8;
cmd.addr_0 = blkno & 0xff;
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 08c8d467..686337a 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -21,13 +21,13 @@
* 16 Feb 93 Julian Elischer ADDED for SCSI system
* 1.15 is the last version to support MACH and OSF/1
*/
-/* $Revision: 2.6 $ */
+/* $Revision: 1.13 $ */
/*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
* major changes by Julian Elischer (julian@jules.dialix.oz.au) May 1993
*
- * $Id: st.c,v 2.6 93/10/21 03:24:38 julian Exp Locker: julian $
+ * $Id: st.c,v 1.13 1993/11/18 05:03:05 rgrimes Exp $
*/
/*
@@ -736,7 +736,7 @@ st_decide_mode(unit, first_read)
*
* Our first shot at a method is, "The quirks made me do it!"
*/
- switch (st->quirks & (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE)) {
+ switch ((int)(st->quirks & (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE))) {
case (ST_Q_FORCE_FIXED_MODE | ST_Q_FORCE_VAR_MODE):
printf("st%d: bad quirks\n", unit);
return (EINVAL);
@@ -772,7 +772,7 @@ st_decide_mode(unit, first_read)
* If the tape density mandates (or even suggests) use of fixed
* or variable-length blocks, comply.
*/
- switch (st->density) {
+ switch ((int)st->density) {
case HALFINCH_800:
case HALFINCH_1600:
case HALFINCH_6250:
@@ -833,7 +833,7 @@ done:
* first read.
* (I think this should be a by-product of fixed/variable..julian)
*/
- switch (st->density) {
+ switch ((int)st->density) {
/* case 8 mm: What is the SCSI density code for 8 mm, anyway? */
case QIC_11:
case QIC_24:
@@ -1517,7 +1517,7 @@ st_space(unit, number, what, flags)
struct scsi_space scsi_cmd;
struct st_data *st = st_data[unit];
- switch (what) {
+ switch ((int)what) {
case SP_BLKS:
if (st->flags & ST_PER_ACTION) {
if (number > 0) {
@@ -1597,7 +1597,7 @@ st_write_filemarks(unit, number, flags)
if (number < 0) {
return EINVAL;
}
- switch (number) {
+ switch ((int)number) {
case 0: /* really a command to sync the drive's buffers */
break;
case 1:
@@ -1643,7 +1643,7 @@ st_chkeod(unit, position, nmarks, flags)
errval error;
struct st_data *st = st_data[unit];
- switch (st->flags & (ST_WRITTEN | ST_FM_WRITTEN | ST_2FM_AT_EOD)) {
+ switch ((int)(st->flags & (ST_WRITTEN | ST_FM_WRITTEN | ST_2FM_AT_EOD))) {
default:
*nmarks = 0;
return (ESUCCESS);
@@ -1904,7 +1904,7 @@ st_touch_tape(unit)
}
st->blksiz = 1024;
do {
- switch (st->blksiz) {
+ switch ((int)st->blksiz) {
case 512:
case 1024:
readsiz = st->blksiz;
diff --git a/sys/scsi/uk.c b/sys/scsi/uk.c
index b503593..149e2df 100644
--- a/sys/scsi/uk.c
+++ b/sys/scsi/uk.c
@@ -2,12 +2,11 @@
* Dummy driver for a device we can't identify.
* by Julian Elischer (julian@tfs.com)
*
- * $Id: uk.c,v 1.1 1993/11/18 05:03:13 rgrimes Exp $
+ * $Id: uk.c,v 1.2 1993/11/25 01:37:35 wollman Exp $
*/
-
-#include <sys/types.h>
#include <sys/param.h>
+#include "systm.h"
#include <sys/errno.h>
#include <sys/ioctl.h>
#include <scsi/scsi_all.h>
OpenPOWER on IntegriCloud