From 8cdd8d251c492cd163d011709f76d742bc586c32 Mon Sep 17 00:00:00 2001 From: bouyer Date: Tue, 27 Apr 2004 18:15:37 +0000 Subject: [PATCH] Revert part of 1.102: Don't decrease/check xs_retries when the device report "Power On, Reset, or Bus Device Reset" sense condition, just retry the command. The initial bus reset would cause the first TEST_UNIT_READY to report this condition, and as xs_retries is set to 0 when XS_CTL_DISCOVERY is set, it would report an error instead of being retried, causing the disk probe to report "drive offline" instead of the geometry and capacity. Checking/decreasing xs_retries on the bus reset reported by the adapter is enouth to avoid the problem reported by rev 1.102. Problem analysed by Paul Kranenburg, fix confirmed by Anders Hjalmars, and explaination as to why the INQUIRY wasn't affected by this provided by Bill Studenmund. --- sys/dev/scsipi/scsipi_base.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sys/dev/scsipi/scsipi_base.c b/sys/dev/scsipi/scsipi_base.c index 0ef268be4c46..727465c0aedb 100644 --- a/sys/dev/scsipi/scsipi_base.c +++ b/sys/dev/scsipi/scsipi_base.c @@ -1,4 +1,4 @@ -/* $NetBSD: scsipi_base.c,v 1.104 2004/03/16 19:10:43 bouyer Exp $ */ +/* $NetBSD: scsipi_base.c,v 1.105 2004/04/27 18:15:37 bouyer Exp $ */ /*- * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc. @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.104 2004/03/16 19:10:43 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scsipi_base.c,v 1.105 2004/04/27 18:15:37 bouyer Exp $"); #include "opt_scsi.h" @@ -938,12 +938,7 @@ scsipi_interpret_sense(xs) if (sense->add_sense_code == 0x29 && sense->add_sense_code_qual == 0x00) { /* device or bus reset */ - if (xs->xs_retries != 0) { - xs->xs_retries--; - error = ERESTART; - } else - error = EIO; - return (error); + return (ERESTART); } if ((periph->periph_flags & PERIPH_REMOVABLE) != 0) periph->periph_flags &= ~PERIPH_MEDIA_LOADED;