From 379429d4df27beae81ed20a6db1ca18687250f40 Mon Sep 17 00:00:00 2001 From: bouyer Date: Mon, 15 Feb 1999 18:40:01 +0000 Subject: [PATCH] If the REQUEST_SENSE command fails, issue a reset instead of XS_DRIVER_STUFFUP. If REQUEST_SENSE succeeds but doens't return any data, return XS_SHORTSENSE as the sense field will just contain a copy or the error register. --- sys/dev/scsipi/atapi_wdc.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index b36dd6de3fc3..a2e0243a7e63 100644 --- a/sys/dev/scsipi/atapi_wdc.c +++ b/sys/dev/scsipi/atapi_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: atapi_wdc.c,v 1.16 1999/02/02 12:59:31 bouyer Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.17 1999/02/15 18:40:01 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -595,10 +595,21 @@ again: * request sense failed ! it's not suppossed * to be possible */ - sc_xfer->error = XS_DRIVER_STUFFUP; - } else { + if (dma_err < 0) + drvp->n_dmaerrs++; + sc_xfer->error = XS_RESET; + wdc_atapi_reset(chp, xfer); + return (1); + } else if (xfer->c_bcount < + sizeof(sc_xfer->sense.scsi_sense)) { /* use the sense we just read */ sc_xfer->error = XS_SENSE; + } else { + /* + * command completed, but no data was read. + * use the short sense we saved previsouly. + */ + sc_xfer->error = XS_SHORTSENSE; } } else { if (chp->ch_status & WDCS_ERR) {