Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/ata Some drives reports ATA version < 4, and still s...



details:   https://anonhg.NetBSD.org/src/rev/eeacf3d22f11
branches:  trunk
changeset: 571335:eeacf3d22f11
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Thu Nov 18 22:14:53 2004 +0000

description:
Some drives reports ATA version < 4, and still support (and need) the
WDCC_FLUSHCACHE command. So for drive < ATA4, test WDC_CMD2_FC in atap_cmd_set2
before returning ENODEV.
Problem reported and fix tested by Michael Gerhards on port-sparc64.

diffstat:

 sys/dev/ata/wd.c |  12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diffs (33 lines):

diff -r 2f1c90dec694 -r eeacf3d22f11 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Thu Nov 18 21:29:43 2004 +0000
+++ b/sys/dev/ata/wd.c  Thu Nov 18 22:14:53 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.296 2004/10/28 07:07:39 yamt Exp $ */
+/*     $NetBSD: wd.c,v 1.297 2004/11/18 22:14:53 bouyer Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -66,7 +66,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.296 2004/10/28 07:07:39 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.297 2004/11/18 22:14:53 bouyer Exp $");
 
 #ifndef ATADEBUG
 #define ATADEBUG
@@ -1760,7 +1760,13 @@
 {
        struct ata_command ata_c;
 
-       if (wd->drvp->ata_vers < 4) /* WDCC_FLUSHCACHE is here since ATA-4 */
+       /*
+        * WDCC_FLUSHCACHE is here since ATA-4, but some drives report
+        * only ATA-2 and still support it.
+        */
+       if (wd->drvp->ata_vers < 4 &&
+           ((wd->sc_params.atap_cmd_set2 & WDC_CMD2_FC) == 0 ||
+           wd->sc_params.atap_cmd_set2 == 0xffff))
                return ENODEV;
        memset(&ata_c, 0, sizeof(struct ata_command));
        if ((wd->sc_params.atap_cmd2_en & ATA_CMD2_LBA48) != 0 &&



Home | Main Index | Thread Index | Old Index