Some bug fixes for the worm driver:

o  don't use polled mode after the device probe phase
o  don't biodone() a NULL buffer pointer
o  increase the timeout for scsi_read_capacity(); WORMs are slooow
o  make WORMMs known to scsiconf at all

This brings the driver in a state where it at least doesn't
immediately panic, nor hangs the controller any more.  Unfortunately,
at least the YAMAHA CDR100 i've been testing with answered my write
attempts with an "Incorrect command sequence" response.  Perhaps other
CD burners might work however.

Reviewed by:	dufault
This commit is contained in:
Joerg Wunsch 1995-10-09 15:15:01 +00:00
parent 86a727d96d
commit b629f8ebbe
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=11376
3 changed files with 37 additions and 16 deletions

View File

@ -8,7 +8,7 @@
* file.
*
* Written by Julian Elischer (julian@dialix.oz.au)
* $Id: scsi_base.c,v 1.29 1995/05/30 08:13:27 rgrimes Exp $
* $Id: scsi_base.c,v 1.30 1995/07/25 22:09:06 bde Exp $
*/
#define SPLSD splbio
@ -143,8 +143,8 @@ scsi_read_capacity(sc_link, blk_size, flags)
sizeof(scsi_cmd),
(u_char *) & rdcap,
sizeof(rdcap),
2,
20000,
4,
5000000, /* WORMs tend to take a HUGE amount of time */
NULL,
flags | SCSI_DATA_IN) != 0) {

View File

@ -16,7 +16,7 @@
*
* New configuration setup: dufault@hda.com
*
* $Id: scsiconf.c,v 1.33 1995/08/16 16:13:53 bde Exp $
* $Id: scsiconf.c,v 1.34 1995/08/23 23:03:33 gibbs Exp $
*/
#include <sys/types.h>
@ -36,6 +36,7 @@
#include "st.h"
#include "cd.h"
#include "ch.h"
#include "worm.h"
#include "su.h"
#include "sctarg.h"
@ -278,13 +279,23 @@ static struct scsidevs knowndevs[] =
T_READONLY, T_REMOV, "CHINON", "CD-ROM CDS-535","*",
"cd", SC_ONE_LU
},
#endif
#endif /* !UKTEST */
#endif /* NCD */
#if NWORM > 0
{
T_WORM, T_REMOV, "YAMAHA", "CDR100", "*",
"worm", SC_ONE_LU
},
{
T_WORM, T_REMOV, "*", "*", "*",
"worm", SC_ONE_LU
},
#endif /* NWORM */
{
0
}
};
#else
#else /* !NEW_SCSICONF */
{
#if NSD > 0
{
@ -326,8 +337,14 @@ static struct scsidevs knowndevs[] =
T_READONLY, T_REMOV, "CHINON", "CD-ROM CDS-535"
,"any", "cd", SC_ONE_LU
},
#endif
#endif /* !UKTEST */
#endif /* NCD */
#if NWORM > 0
{
T_WORM, T_REMOV, "YAMAHA", "CDR100"
,"any", "worm", SC_ONE_LU
},
#endif /* NWORM */
{
0
}

View File

@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: worm.c,v 1.6 1995/05/03 23:53:32 dufault Exp $
* $Id: worm.c,v 1.7 1995/05/30 08:13:58 rgrimes Exp $
*/
/* XXX This is PRELIMINARY.
@ -101,14 +101,17 @@ struct scsi_device worm_switch =
worm_strategy,
};
static int worm_size(struct scsi_link *sc_link)
static int worm_size(struct scsi_link *sc_link, int flags)
{
int ret;
struct scsi_data *worm = sc_link->sd;
worm->n_blks = scsi_read_capacity(sc_link, &worm->blk_size,
SCSI_NOSLEEP | SCSI_NOMASK);
flags);
if(worm->blk_size == 0)
/* XXX */
worm->blk_size = 2048;
if (worm->n_blks)
{
sc_link->flags |= SDEV_MEDIA_LOADED;
@ -130,11 +133,10 @@ wormattach(struct scsi_link *sc_link)
printf("- UNTESTED ");
if (worm_size(sc_link) == 0)
if (worm_size(sc_link, SCSI_NOSLEEP | SCSI_NOMASK) == 0)
printf("- can't get capacity.");
else
printf("with %ld %ld byte blocks.", worm->n_blks, worm->blk_size);
return 0;
}
@ -241,9 +243,11 @@ wormstart(unit, flags)
} else {
badnews:
printf("worm%ld: oops not queued\n", unit);
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
biodone(bp);
if (bp) {
bp->b_flags |= B_ERROR;
bp->b_error = EIO;
biodone(bp);
}
}
} /* go back and see if we can cram more work in.. */
}
@ -337,7 +341,7 @@ struct scsi_link *sc_link)
scsi_prevent(sc_link, PR_PREVENT, SCSI_SILENT);
if (worm_size(sc_link) == 0) {
if (worm_size(sc_link, 0) == 0) {
scsi_stop_unit(sc_link, 0, SCSI_SILENT);
scsi_prevent(sc_link, PR_ALLOW, SCSI_SILENT);
sc_link->flags &= ~SDEV_OPEN;