Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Add a (*drv_probe)() optional callback into the d...



details:   https://anonhg.NetBSD.org/src/rev/bdef61272d39
branches:  trunk
changeset: 556397:bdef61272d39
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Dec 15 00:27:13 2003 +0000

description:
Add a (*drv_probe)() optional callback into the driver to probe for
drives on a channel.  Drivers should provide this if they have some
sort of intelligent probing mechanism.

diffstat:

 sys/dev/ic/wdc.c    |  12 +++++++++---
 sys/dev/ic/wdcvar.h |   6 +++++-
 2 files changed, 14 insertions(+), 4 deletions(-)

diffs (62 lines):

diff -r d4eb87a2004c -r bdef61272d39 sys/dev/ic/wdc.c
--- a/sys/dev/ic/wdc.c  Sun Dec 14 23:56:28 2003 +0000
+++ b/sys/dev/ic/wdc.c  Mon Dec 15 00:27:13 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdc.c,v 1.160 2003/12/14 18:51:10 thorpej Exp $ */
+/*     $NetBSD: wdc.c,v 1.161 2003/12/15 00:27:13 thorpej Exp $ */
 
 /*
  * Copyright (c) 1998, 2001, 2003 Manuel Bouyer.  All rights reserved.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.160 2003/12/14 18:51:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.161 2003/12/15 00:27:13 thorpej Exp $");
 
 #ifndef WDCDEBUG
 #define WDCDEBUG
@@ -329,9 +329,15 @@
        }
        need_delref = 1;
 
-       if (wdcprobe1(chp, 0) == 0)
+       if (chp->wdc && (chp->wdc->cap & WDC_CAPABILITY_DRVPROBE) != 0) {
+               if ((*chp->wdc->drv_probe)(chp) == 0) {
+                       /* If no drives, abort attach here. */
+                       goto out;
+               }
+       } else if (wdcprobe1(chp, 0) == 0) {
                /* If no drives, abort attach here. */
                goto out;
+       }
 
        /* for ATA/OLD drives, wait for DRDY, 3s timeout */
        for (i = 0; i < mstohz(3000); i++) {
diff -r d4eb87a2004c -r bdef61272d39 sys/dev/ic/wdcvar.h
--- a/sys/dev/ic/wdcvar.h       Sun Dec 14 23:56:28 2003 +0000
+++ b/sys/dev/ic/wdcvar.h       Mon Dec 15 00:27:13 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wdcvar.h,v 1.45 2003/12/03 12:01:18 bouyer Exp $       */
+/*     $NetBSD: wdcvar.h,v 1.46 2003/12/15 00:27:13 thorpej Exp $      */
 
 /*-
  * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@@ -121,6 +121,7 @@
 #define WDC_CAPABILITY_NOIRQ  0x1000   /* Controller never interrupts */
 #define WDC_CAPABILITY_SELECT  0x2000  /* Controller selects target */
 #define        WDC_CAPABILITY_RAID   0x4000    /* Controller "supports" RAID */
+#define        WDC_CAPABILITY_DRVPROBE 0x8000  /* Controller has smart drive probe */
        u_int8_t      PIO_cap; /* highest PIO mode supported */
        u_int8_t      DMA_cap; /* highest DMA mode supported */
        u_int8_t      UDMA_cap; /* highest UDMA mode supported */
@@ -159,6 +160,9 @@
 
        /* if WDC_CAPABILITY_IRQACK set in 'cap' */
        void            (*irqack) __P((struct channel_softc *));
+
+       /* if WDC_CAPABILITY_DRVPROBE is set in 'cap' */
+       int             (*drv_probe) __P((struct channel_softc *));
 };
 
  /*



Home | Main Index | Thread Index | Old Index