diff --git a/sys/dev/ata/ata_wdc.c b/sys/dev/ata/ata_wdc.c index 33c730d19ceb..cf05794e6ff8 100644 --- a/sys/dev/ata/ata_wdc.c +++ b/sys/dev/ata/ata_wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: ata_wdc.c,v 1.5 1998/10/13 15:02:41 bouyer Exp $ */ +/* $NetBSD: ata_wdc.c,v 1.6 1998/10/13 15:18:46 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -586,6 +586,9 @@ again: /* Don't try to set modes if controller can't be adjusted */ if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0) goto geometry; + /* Also don't try if the drive didn't report its mode */ + if ((drvp->drive_flags & DRIVE_MODE) == 0) + goto geometry; wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0, 0x08 | drvp->PIO_mode, WDSF_SET_MODE); drvp->state = PIOMODE_WAIT; diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h index bc2bcf33c9b1..1a0396426f90 100644 --- a/sys/dev/ata/atavar.h +++ b/sys/dev/ata/atavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: atavar.h,v 1.2 1998/10/12 16:09:15 bouyer Exp $ */ +/* $NetBSD: atavar.h,v 1.3 1998/10/13 15:18:47 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -45,6 +45,7 @@ struct ata_drive_datas { #define DRIVE_CAP32 0x04 #define DRIVE_DMA 0x08 #define DRIVE_UDMA 0x10 +#define DRIVE_MODE 0x20 /* the drive reported its mode */ /* * Current setting of drive's PIO, DMA and UDMA modes. * Is initialised by the disks drivers at attach time, and may be diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 1b84201b206b..71662546a638 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.34 1998/10/13 15:02:42 bouyer Exp $ */ +/* $NetBSD: wdc.c,v 1.35 1998/10/13 15:18:47 bouyer Exp $ */ /* @@ -770,6 +770,7 @@ wdc_probe_caps(drvp) printf("\n"); return; } + drvp->drive_flags |= DRIVE_MODE; printed = 0; for (i = 7; i >= 0; i--) { if ((params.atap_dmamode_supp & (1 << i)) == 0) diff --git a/sys/dev/scsipi/atapi_wdc.c b/sys/dev/scsipi/atapi_wdc.c index dee2c6caab06..5e82ee493674 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.5 1998/10/13 15:02:43 bouyer Exp $ */ +/* $NetBSD: atapi_wdc.c,v 1.6 1998/10/13 15:18:48 bouyer Exp $ */ /* * Copyright (c) 1998 Manuel Bouyer. @@ -607,6 +607,9 @@ again: /* Don't try to set mode if controller can't be adjusted */ if ((chp->wdc->cap & WDC_CAPABILITY_MODE) == 0) goto ready; + /* Also don't try if the drive didn't report its mode */ + if ((drvp->drive_flags & DRIVE_MODE) == 0) + goto ready;; wdccommand(chp, drvp->drive, SET_FEATURES, 0, 0, 0, 0x08 | drvp->PIO_mode, WDSF_SET_MODE); drvp->state = PIOMODE_WAIT;