Add a new drive flag, DRIVE_MODE, set when the drive properly reported its

PIO/DMA modes. Don't try a SET_FEATURE if it didn't report its mode.
This commit is contained in:
bouyer 1998-10-13 15:18:46 +00:00
parent 3a86ff1e67
commit e8322de657
4 changed files with 12 additions and 4 deletions

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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;