diff --git a/sys/dev/ata/atavar.h b/sys/dev/ata/atavar.h index 45838ff2afc9..26abc8fc685c 100644 --- a/sys/dev/ata/atavar.h +++ b/sys/dev/ata/atavar.h @@ -1,4 +1,4 @@ -/* $NetBSD: atavar.h,v 1.61 2004/08/20 17:19:44 thorpej Exp $ */ +/* $NetBSD: atavar.h,v 1.62 2004/08/20 20:52:31 thorpej Exp $ */ /* * Copyright (c) 1998, 2001 Manuel Bouyer. @@ -380,6 +380,8 @@ struct atac_softc { struct ata_channel **atac_channels; int atac_nchannels; + const struct ata_bustype *atac_bustype_ata; + /* * Glue between ATA and SCSIPI for the benefit of ATAPI. * @@ -387,6 +389,7 @@ struct atac_softc { * devices. */ struct atapi_adapter atac_atapi_adapter; + void (*atac_atapibus_attach)(struct atabus_softc *); /* Driver callback to probe for drives. */ void (*atac_probe)(struct ata_channel *); diff --git a/sys/dev/ic/wdc.c b/sys/dev/ic/wdc.c index 4163e382a918..11b5b5c075a0 100644 --- a/sys/dev/ic/wdc.c +++ b/sys/dev/ic/wdc.c @@ -1,4 +1,4 @@ -/* $NetBSD: wdc.c,v 1.207 2004/08/20 06:39:38 thorpej Exp $ */ +/* $NetBSD: wdc.c,v 1.208 2004/08/20 20:52:31 thorpej Exp $ */ /* * Copyright (c) 1998, 2001, 2003 Manuel Bouyer. All rights reserved. @@ -70,7 +70,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.207 2004/08/20 06:39:38 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: wdc.c,v 1.208 2004/08/20 20:52:31 thorpej Exp $"); #ifndef ATADEBUG #define ATADEBUG @@ -409,7 +409,7 @@ atabusconfig(struct atabus_softc *atabus_sc) for (i = 0; i < chp->ch_ndrive; i++) { if (chp->ch_drive[i].drive_flags & DRIVE_ATAPI) { #if NATAPIBUS > 0 - wdc_atapibus_attach(atabus_sc); + (*atac->atac_atapibus_attach)(atabus_sc); #else /* * Fake the autoconfig "not configured" message @@ -431,7 +431,7 @@ atabusconfig(struct atabus_softc *atabus_sc) continue; } memset(&adev, 0, sizeof(struct ata_device)); - adev.adev_bustype = &wdc_ata_bustype; + adev.adev_bustype = atac->atac_bustype_ata; adev.adev_channel = chp->ch_channel; adev.adev_openings = 1; adev.adev_drv_data = &chp->ch_drive[i]; @@ -800,8 +800,14 @@ wdcattach(struct ata_channel *chp) /* initialise global data */ callout_init(&chp->ch_callout); + if (atac->atac_bustype_ata == NULL) + atac->atac_bustype_ata = &wdc_ata_bustype; if (atac->atac_probe == NULL) atac->atac_probe = wdc_drvprobe; +#if NATAPIBUS > 0 + if (atac->atac_atapibus_attach == NULL) + atac->atac_atapibus_attach = wdc_atapibus_attach; +#endif TAILQ_INIT(&chp->ch_queue->queue_xfer); chp->ch_queue->queue_freeze = 0;