diff options
author | rgrimes <rgrimes@FreeBSD.org> | 1994-01-29 10:30:41 +0000 |
---|---|---|
committer | rgrimes <rgrimes@FreeBSD.org> | 1994-01-29 10:30:41 +0000 |
commit | a3e76b107d028854c76e23751c764a554a0cceac (patch) | |
tree | d86ec8739b84cc647c8c5bd6e85c4a14d66c646a /sys/scsi | |
parent | f0a631d52235cfabec2ccc253ed0cbeae0e78571 (diff) | |
download | FreeBSD-src-a3e76b107d028854c76e23751c764a554a0cceac.zip FreeBSD-src-a3e76b107d028854c76e23751c764a554a0cceac.tar.gz |
Patch from Julian. Commit message by me.
cd.c:
Initialize channel info in CDIOCSETVOL ioctl.
Correct CDIOCSTOP and CDIOCEJCET ioctls to use scsi_stop_unit
instead of scsi_start_unit.
Add CDIOCALLOW and CDIOCPREVENT ioctls.
ch.h:
Return EBUSY instead of ENXIO if the device is already in use.
scsi_base.c:
Add scsi_stop_unit routine.
sd.c:
Add mising indirection through sc_link to sd_get_parms routine
when checking for media loaded.
st.c:
Return EBUSY instead of ENXIO if the device is already in use.
Clear the SDEV_WAITING flag in ststart if we do the wakeup call.
Diffstat (limited to 'sys/scsi')
-rw-r--r-- | sys/scsi/cd.c | 14 | ||||
-rw-r--r-- | sys/scsi/ch.c | 4 | ||||
-rw-r--r-- | sys/scsi/scsi_base.c | 30 | ||||
-rw-r--r-- | sys/scsi/sd.c | 4 | ||||
-rw-r--r-- | sys/scsi/st.c | 7 |
5 files changed, 48 insertions, 11 deletions
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c index 2fe220a..35b1469 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.13 1993/11/25 01:37:28 wollman Exp $ + * $Id: cd.c,v 1.14 1993/12/19 00:54:44 wollman Exp $ */ #define SPLCD splbio @@ -753,7 +753,9 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) struct cd_mode_data data; if (error = cd_get_mode(unit, &data, AUDIO_PAGE)) break; + data.page.audio.port[LEFT_PORT].channels = CHANNEL_0; data.page.audio.port[LEFT_PORT].volume = arg->vol[LEFT_PORT]; + data.page.audio.port[RIGHT_PORT].channels = CHANNEL_1; data.page.audio.port[RIGHT_PORT].volume = arg->vol[RIGHT_PORT]; data.page.audio.port[2].volume = arg->vol[2]; data.page.audio.port[3].volume = arg->vol[3]; @@ -841,10 +843,16 @@ cdioctl(dev_t dev, int cmd, caddr_t addr, int flag) error = scsi_start_unit(cd->sc_link, 0); break; case CDIOCSTOP: - error = scsi_start_unit(cd->sc_link, 0); + error = scsi_stop_unit(cd->sc_link, 0, 0); break; case CDIOCEJECT: - error = scsi_start_unit(cd->sc_link, 0); + error = scsi_stop_unit(cd->sc_link, 1, 0); + break; + case CDIOCALLOW: + error = scsi_prevent(cd->sc_link, PR_ALLOW, 0); + break; + case CDIOCPREVENT: + error = scsi_prevent(cd->sc_link, PR_PREVENT, 0); break; case CDIOCSETDEBUG: cd->sc_link->flags |= (SDEV_DB1 | SDEV_DB2); diff --git a/sys/scsi/ch.c b/sys/scsi/ch.c index ceec9d2..315dab9 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.6 1993/11/25 01:37:31 wollman Exp $ + * $Id: ch.c,v 1.7 1993/12/19 00:54:49 wollman Exp $ */ #include <sys/types.h> @@ -148,7 +148,7 @@ chopen(dev) */ if (ch_data[unit].flags & CH_OPEN) { printf("ch%d: already open\n", unit); - return ENXIO; + return EBUSY; } /* * Make sure the device has been initialised diff --git a/sys/scsi/scsi_base.c b/sys/scsi/scsi_base.c index 39b1baf..22b826f 100644 --- a/sys/scsi/scsi_base.c +++ b/sys/scsi/scsi_base.c @@ -8,7 +8,7 @@ * file. * * Written by Julian Elischer (julian@dialix.oz.au) - * $Id: scsi_base.c,v 1.3 1993/12/19 00:54:50 wollman Exp $ + * $Id: scsi_base.c,v 1.4 1994/01/14 16:25:29 davidg Exp $ */ #define SPLSD splbio @@ -293,6 +293,34 @@ scsi_start_unit(sc_link, flags) 0, 0, 2, + 2000, + NULL, + flags)); +} + +/* + * Get scsi driver to send a "stop" command + */ +errval +scsi_stop_unit(sc_link, eject, flags) + struct scsi_link *sc_link; + u_int32 eject; + u_int32 flags; +{ + struct scsi_start_stop scsi_cmd; + + bzero(&scsi_cmd, sizeof(scsi_cmd)); + scsi_cmd.op_code = START_STOP; + if (eject) { + scsi_cmd.how = SSS_LOEJ; + } + + return (scsi_scsi_cmd(sc_link, + (struct scsi_generic *) &scsi_cmd, + sizeof(scsi_cmd), + 0, + 0, + 2, 6000, NULL, flags)); diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c index 3c13904..01008ec 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.15 1994/01/06 18:08:03 rgrimes Exp $ + * $Id: sd.c,v 1.16 1994/01/22 11:05:16 rgrimes Exp $ */ #define SPLSD splbio @@ -818,7 +818,7 @@ sd_get_parms(unit, flags) /* * First check if we have it all loaded */ - if (sd->flags & SDEV_MEDIA_LOADED) + if (sd->sc_link->flags & SDEV_MEDIA_LOADED) return 0; /* diff --git a/sys/scsi/st.c b/sys/scsi/st.c index 686337a..871614d 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: 1.13 $ */ +/* $Revision: 1.14 $ */ /* * 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 1.13 1993/11/18 05:03:05 rgrimes Exp $ + * $Id: st.c,v 1.14 1993/12/19 00:54:59 wollman Exp $ */ /* @@ -485,7 +485,7 @@ stopen(dev, flags) * Only allow one at a time */ if (st->flags & ST_OPEN) { - return (ENXIO); + return (EBUSY); } /* * Throw out a dummy instruction to catch 'Unit attention @@ -975,6 +975,7 @@ ststart(unit) /* if a special awaits, let it proceed first */ if (sc_link->flags & SDEV_WAITING) { + sc_link->flags &= ~SDEV_WAITING; wakeup((caddr_t)sc_link); return; } |