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.
This commit is contained in:
thorpej 2003-12-15 00:27:13 +00:00
parent a8c35a134f
commit 9de2760c3e
2 changed files with 14 additions and 4 deletions

View File

@ -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. * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved.
@ -70,7 +70,7 @@
*/ */
#include <sys/cdefs.h> #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 #ifndef WDCDEBUG
#define WDCDEBUG #define WDCDEBUG
@ -329,9 +329,15 @@ atabusconfig(atabus_sc)
} }
need_delref = 1; 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. */ /* If no drives, abort attach here. */
goto out; goto out;
}
/* for ATA/OLD drives, wait for DRDY, 3s timeout */ /* for ATA/OLD drives, wait for DRDY, 3s timeout */
for (i = 0; i < mstohz(3000); i++) { for (i = 0; i < mstohz(3000); i++) {

View File

@ -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. * Copyright (c) 1998, 2003 The NetBSD Foundation, Inc.
@ -121,6 +121,7 @@ struct wdc_softc { /* Per controller state */
#define WDC_CAPABILITY_NOIRQ 0x1000 /* Controller never interrupts */ #define WDC_CAPABILITY_NOIRQ 0x1000 /* Controller never interrupts */
#define WDC_CAPABILITY_SELECT 0x2000 /* Controller selects target */ #define WDC_CAPABILITY_SELECT 0x2000 /* Controller selects target */
#define WDC_CAPABILITY_RAID 0x4000 /* Controller "supports" RAID */ #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 PIO_cap; /* highest PIO mode supported */
u_int8_t DMA_cap; /* highest DMA mode supported */ u_int8_t DMA_cap; /* highest DMA mode supported */
u_int8_t UDMA_cap; /* highest UDMA mode supported */ u_int8_t UDMA_cap; /* highest UDMA mode supported */
@ -159,6 +160,9 @@ struct wdc_softc { /* Per controller state */
/* if WDC_CAPABILITY_IRQACK set in 'cap' */ /* if WDC_CAPABILITY_IRQACK set in 'cap' */
void (*irqack) __P((struct channel_softc *)); void (*irqack) __P((struct channel_softc *));
/* if WDC_CAPABILITY_DRVPROBE is set in 'cap' */
int (*drv_probe) __P((struct channel_softc *));
}; };
/* /*