Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/dev/scsipi Pull up revision 1.217 (requested by bou...
details: https://anonhg.NetBSD.org/src/rev/8cf7eb464301
branches: netbsd-2-0
changeset: 561172:8cf7eb464301
user: tron <tron%NetBSD.org@localhost>
date: Sat May 29 14:21:18 2004 +0000
description:
Pull up revision 1.217 (requested by bouyer in ticket #399):
If READ_FORMAT_CAPACITIES fails with "Medium Format Corrupted" ASC/ASQ error,
handle it as if the drive was not formatted, so that "scsictl sdx format"
can open the raw device.
diffstat:
sys/dev/scsipi/sd.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diffs (74 lines):
diff -r 075994a68d51 -r 8cf7eb464301 sys/dev/scsipi/sd.c
--- a/sys/dev/scsipi/sd.c Sat May 29 14:18:45 2004 +0000
+++ b/sys/dev/scsipi/sd.c Sat May 29 14:21:18 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sd.c,v 1.216 2004/03/14 00:17:37 thorpej Exp $ */
+/* $NetBSD: sd.c,v 1.216.2.1 2004/05/29 14:21:18 tron Exp $ */
/*-
* Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -54,7 +54,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.216 2004/03/14 00:17:37 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sd.c,v 1.216.2.1 2004/05/29 14:21:18 tron Exp $");
#include "opt_scsi.h"
#include "rnd.h"
@@ -532,6 +532,7 @@
}
if ((periph->periph_flags & PERIPH_MEDIA_LOADED) == 0) {
+ int param_error;
periph->periph_flags |= PERIPH_MEDIA_LOADED;
/*
@@ -542,16 +543,19 @@
* The drive should refuse real I/O, if the media is
* unformatted.
*/
- if (sd_get_parms(sd, &sd->params,
- 0) == SDGP_RESULT_OFFLINE) {
+ if ((param_error = sd_get_parms(sd, &sd->params, 0))
+ == SDGP_RESULT_OFFLINE) {
error = ENXIO;
goto bad2;
}
SC_DEBUG(periph, SCSIPI_DB3, ("Params loaded "));
/* Load the partition info if not already loaded. */
- sdgetdisklabel(sd);
- SC_DEBUG(periph, SCSIPI_DB3, ("Disklabel loaded "));
+ if (param_error == 0) {
+ sdgetdisklabel(sd);
+ SC_DEBUG(periph, SCSIPI_DB3,
+ ("Disklabel loaded "));
+ }
}
}
@@ -1393,6 +1397,12 @@
splx(s);
}
}
+ if ((sense->flags & SSD_KEY) == SKEY_MEDIUM_ERROR &&
+ sense->add_sense_code == 0x31 &&
+ sense->add_sense_code_qual == 0x00) { /* maybe for any asq ? */
+ /* Medium Format Corrupted */
+ retval = EFTYPE;
+ }
return (retval);
}
@@ -1701,6 +1711,10 @@
sizeof(scsipi_result), SDRETRIES, 20000,
NULL, flags | XS_CTL_DATA_IN | XS_CTL_DATA_ONSTACK /*|
XS_CTL_IGNORE_ILLEGAL_REQUEST*/);
+ if (error == EFTYPE) {
+ /* Medium Format Corrupted, handle as not formatted */
+ return (SDGP_RESULT_UNFORMATTED);
+ }
if (error || scsipi_result.header.length == 0)
return (SDGP_RESULT_OFFLINE);
Home |
Main Index |
Thread Index |
Old Index