- Add an atac_bustype_ata member to atac_softc to hold a pointer to
the ata_bustype for the controller. Fill it in and use it instead of referencing wdc_ata_bustype directly. - Add an atac_atapibus_attach member to atac_softc to hold a pointer to the function that attaches the ATAPI bus for the controller. Fill it in and use it instead of referencing wdc_atapibus_attach directly.
This commit is contained in:
parent
8bff586af3
commit
2606542c7b
@ -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.
|
* Copyright (c) 1998, 2001 Manuel Bouyer.
|
||||||
@ -380,6 +380,8 @@ struct atac_softc {
|
|||||||
struct ata_channel **atac_channels;
|
struct ata_channel **atac_channels;
|
||||||
int atac_nchannels;
|
int atac_nchannels;
|
||||||
|
|
||||||
|
const struct ata_bustype *atac_bustype_ata;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Glue between ATA and SCSIPI for the benefit of ATAPI.
|
* Glue between ATA and SCSIPI for the benefit of ATAPI.
|
||||||
*
|
*
|
||||||
@ -387,6 +389,7 @@ struct atac_softc {
|
|||||||
* devices.
|
* devices.
|
||||||
*/
|
*/
|
||||||
struct atapi_adapter atac_atapi_adapter;
|
struct atapi_adapter atac_atapi_adapter;
|
||||||
|
void (*atac_atapibus_attach)(struct atabus_softc *);
|
||||||
|
|
||||||
/* Driver callback to probe for drives. */
|
/* Driver callback to probe for drives. */
|
||||||
void (*atac_probe)(struct ata_channel *);
|
void (*atac_probe)(struct ata_channel *);
|
||||||
|
@ -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.
|
* 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.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
|
#ifndef ATADEBUG
|
||||||
#define ATADEBUG
|
#define ATADEBUG
|
||||||
@ -409,7 +409,7 @@ atabusconfig(struct atabus_softc *atabus_sc)
|
|||||||
for (i = 0; i < chp->ch_ndrive; i++) {
|
for (i = 0; i < chp->ch_ndrive; i++) {
|
||||||
if (chp->ch_drive[i].drive_flags & DRIVE_ATAPI) {
|
if (chp->ch_drive[i].drive_flags & DRIVE_ATAPI) {
|
||||||
#if NATAPIBUS > 0
|
#if NATAPIBUS > 0
|
||||||
wdc_atapibus_attach(atabus_sc);
|
(*atac->atac_atapibus_attach)(atabus_sc);
|
||||||
#else
|
#else
|
||||||
/*
|
/*
|
||||||
* Fake the autoconfig "not configured" message
|
* Fake the autoconfig "not configured" message
|
||||||
@ -431,7 +431,7 @@ atabusconfig(struct atabus_softc *atabus_sc)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
memset(&adev, 0, sizeof(struct ata_device));
|
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_channel = chp->ch_channel;
|
||||||
adev.adev_openings = 1;
|
adev.adev_openings = 1;
|
||||||
adev.adev_drv_data = &chp->ch_drive[i];
|
adev.adev_drv_data = &chp->ch_drive[i];
|
||||||
@ -800,8 +800,14 @@ wdcattach(struct ata_channel *chp)
|
|||||||
|
|
||||||
/* initialise global data */
|
/* initialise global data */
|
||||||
callout_init(&chp->ch_callout);
|
callout_init(&chp->ch_callout);
|
||||||
|
if (atac->atac_bustype_ata == NULL)
|
||||||
|
atac->atac_bustype_ata = &wdc_ata_bustype;
|
||||||
if (atac->atac_probe == NULL)
|
if (atac->atac_probe == NULL)
|
||||||
atac->atac_probe = wdc_drvprobe;
|
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);
|
TAILQ_INIT(&chp->ch_queue->queue_xfer);
|
||||||
chp->ch_queue->queue_freeze = 0;
|
chp->ch_queue->queue_freeze = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user