Source-Changes-HG archive

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

[src/trunk]: src/sys/dev Since we can't detect ghost drives in the wdc back-e...



details:   https://anonhg.NetBSD.org/src/rev/9fbae0ce51da
branches:  trunk
changeset: 552188:9fbae0ce51da
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Sun Sep 21 11:14:00 2003 +0000

description:
Since we can't detect ghost drives in the wdc back-end, resurect
WDC_CAPABILITY_SINGLE_DRIVE.

diffstat:

 sys/dev/ic/wdc.c            |  21 +++++++++++++++++++--
 sys/dev/ic/wdcvar.h         |   3 ++-
 sys/dev/isa/wdc_isa.c       |   7 +++++--
 sys/dev/pci/pciide.c        |   6 +++---
 sys/dev/pcmcia/wdc_pcmcia.c |   5 +++--
 5 files changed, 32 insertions(+), 10 deletions(-)

diffs (157 lines):

diff -r b66eef6d1b70 -r 9fbae0ce51da sys/dev/ic/wdc.c
--- a/sys/dev/ic/wdc.c  Sun Sep 21 07:59:04 2003 +0000
+++ b/sys/dev/ic/wdc.c  Sun Sep 21 11:14:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc.c,v 1.128 2003/09/20 21:42:47 bouyer Exp $ */
+/*     $NetBSD: wdc.c,v 1.129 2003/09/21 11:14:00 bouyer Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.128 2003/09/20 21:42:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.129 2003/09/21 11:14:00 bouyer Exp $");
 
 #ifndef WDCDEBUG
 #define WDCDEBUG
@@ -193,6 +193,7 @@
        u_int8_t st0, st1, sc, sn, cl, ch;
        u_int8_t ret_value = 0x03;
        u_int8_t drive;
+       int found;
 
        /*
         * Sanity check to see if the wdc channel responds at all.
@@ -316,9 +317,25 @@
         * something here assume it's ATA or OLD. Ghost will be killed later in
         * attach routine.
         */
+       found = 0;
        for (drive = 0; drive < 2; drive++) {
                if ((ret_value & (0x01 << drive)) == 0)
                        continue;
+               if (1 < ++found && chp->wdc != NULL &&
+                           (chp->wdc->cap & WDC_CAPABILITY_SINGLE_DRIVE)) {
+                       /*
+                        * Ignore second drive if WDC_CAPABILITY_SINGLE_DRIVE
+                        * is set.
+                        *
+                        * Some CF Card (for ex. IBM MicroDrive and SanDisk) 
+                        * doesn't seem to implement drive select command. In
+                        * this case, you can't eliminate ghost drive properly.
+                        */
+                       WDCDEBUG_PRINT(("%s:%d:%d: ignored.\n",
+                           chp->wdc->sc_dev.dv_xname,
+                           chp->channel, drive), DEBUG_PROBE);
+                       break;
+               }
                if (chp->wdc && chp->wdc->cap & WDC_CAPABILITY_SELECT)
                        chp->wdc->select(chp,drive);
                bus_space_write_1(chp->cmd_iot, chp->cmd_ioh, wd_sdh,
diff -r b66eef6d1b70 -r 9fbae0ce51da sys/dev/ic/wdcvar.h
--- a/sys/dev/ic/wdcvar.h       Sun Sep 21 07:59:04 2003 +0000
+++ b/sys/dev/ic/wdcvar.h       Sun Sep 21 11:14:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdcvar.h,v 1.37 2003/09/19 21:36:03 mycroft Exp $      */
+/*     $NetBSD: wdcvar.h,v 1.38 2003/09/21 11:14:01 bouyer Exp $       */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -103,6 +103,7 @@
 #define WDC_CAPABILITY_NO_EXTRA_RESETS 0x0100 /* only reset once */
 #define WDC_CAPABILITY_PREATA 0x0200 /* ctrl can be a pre-ata one */
 #define WDC_CAPABILITY_IRQACK 0x0400 /* callback to ack interrupt */
+#define WDC_CAPABILITY_SINGLE_DRIVE 0x0800 /* Don't probe second drive */
 #define WDC_CAPABILITY_NOIRQ  0x1000   /* Controller never interrupts */
 #define WDC_CAPABILITY_SELECT  0x2000  /* Controller selects target */
 #define        WDC_CAPABILITY_RAID   0x4000    /* Controller "supports" RAID */
diff -r b66eef6d1b70 -r 9fbae0ce51da sys/dev/isa/wdc_isa.c
--- a/sys/dev/isa/wdc_isa.c     Sun Sep 21 07:59:04 2003 +0000
+++ b/sys/dev/isa/wdc_isa.c     Sun Sep 21 11:14:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_isa.c,v 1.32 2003/09/19 21:36:04 mycroft Exp $ */
+/*     $NetBSD: wdc_isa.c,v 1.33 2003/09/21 11:14:02 bouyer Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.32 2003/09/19 21:36:04 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_isa.c,v 1.33 2003/09/21 11:14:02 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -59,6 +59,7 @@
 
 /* options passed via the 'flags' config keyword */
 #define WDC_OPTIONS_32                 0x01 /* try to use 32bit data I/O */
+#define WDC_OPTIONS_SINGLE_DRIVE       0x02 /* Don't probe second drive */
 #define WDC_OPTIONS_ATA_NOSTREAM       0x04
 #define WDC_OPTIONS_ATAPI_NOSTREAM     0x08
 
@@ -181,6 +182,8 @@
        sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_PREATA;
        if (wdc_cf_flags & WDC_OPTIONS_32)
                sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA32;
+       if (wdc_cf_flags & WDC_OPTIONS_SINGLE_DRIVE)
+               sc->sc_wdcdev.cap |= WDC_CAPABILITY_SINGLE_DRIVE;
        if (wdc_cf_flags & WDC_OPTIONS_ATA_NOSTREAM)
                sc->sc_wdcdev.cap |= WDC_CAPABILITY_ATA_NOSTREAM;
        if (wdc_cf_flags & WDC_OPTIONS_ATAPI_NOSTREAM)
diff -r b66eef6d1b70 -r 9fbae0ce51da sys/dev/pci/pciide.c
--- a/sys/dev/pci/pciide.c      Sun Sep 21 07:59:04 2003 +0000
+++ b/sys/dev/pci/pciide.c      Sun Sep 21 11:14:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pciide.c,v 1.201 2003/09/20 22:46:02 enami Exp $       */
+/*     $NetBSD: pciide.c,v 1.202 2003/09/21 11:14:02 bouyer Exp $      */
 
 
 /*
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.201 2003/09/20 22:46:02 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pciide.c,v 1.202 2003/09/21 11:14:02 bouyer Exp $");
 
 #ifndef WDCDEBUG
 #define WDCDEBUG
@@ -2521,7 +2521,7 @@
        sc->sc_wdcdev.channels = sc->wdc_chanarray;
        sc->sc_wdcdev.nchannels = PCIIDE_NUM_CHANNELS;
        sc->sc_wdcdev.cap |= WDC_CAPABILITY_DATA16 | WDC_CAPABILITY_DATA32 |
-               WDC_CAPABILITY_MODE;
+               WDC_CAPABILITY_MODE | WDC_CAPABILITY_SINGLE_DRIVE;
        sc->sc_wdcdev.set_modes = sata_setup_channel;
 
        for (channel = 0; channel < sc->sc_wdcdev.nchannels; channel++) {
diff -r b66eef6d1b70 -r 9fbae0ce51da sys/dev/pcmcia/wdc_pcmcia.c
--- a/sys/dev/pcmcia/wdc_pcmcia.c       Sun Sep 21 07:59:04 2003 +0000
+++ b/sys/dev/pcmcia/wdc_pcmcia.c       Sun Sep 21 11:14:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc_pcmcia.c,v 1.56 2003/09/19 21:36:07 mycroft Exp $ */
+/*     $NetBSD: wdc_pcmcia.c,v 1.57 2003/09/21 11:14:04 bouyer Exp $ */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.56 2003/09/19 21:36:07 mycroft Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc_pcmcia.c,v 1.57 2003/09/21 11:14:04 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -360,6 +360,7 @@
        }
        sc->wdc_channel.data32iot = sc->wdc_channel.cmd_iot;
        sc->wdc_channel.data32ioh = sc->wdc_channel.cmd_ioh;
+       sc->sc_wdcdev.cap |= WDC_CAPABILITY_SINGLE_DRIVE;
        sc->sc_wdcdev.PIO_cap = 0;
        sc->wdc_chanlist[0] = &sc->wdc_channel;
        sc->sc_wdcdev.channels = sc->wdc_chanlist;



Home | Main Index | Thread Index | Old Index